:root {
    --primary-blue: #4facfe;
    --primary-blue-dark: #00f2fe;
    --card-bg: #ffffff;
    --bg-color: #f4f7f6;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-pill: 50px;
    --shadow-soft: 0 10px 25px rgba(112, 144, 176, 0.12);
    --shadow-hover: 0 20px 40px rgba(112, 144, 176, 0.2);
}

body {
    background-color: var(--bg-color);
    font-family: 'Nunito', sans-serif;
    color: var(--text-main);
}

/* Navbar */
.navbar {
    background-color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 1rem 0;
}

.navbar-brand {
    font-family: 'Audiowide', cursive;
    font-weight: 400;
    font-style: normal;
    color: #ff7200 !important;
    font-size: 1.65rem;
}

.navbar-brand img {
    vertical-align: text-bottom;
}

.nav-link {
    font-weight: 700;
    color: var(--text-muted) !important;
    margin-left: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: #f1f2f6;
    border-radius: var(--radius-lg);
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-blue) !important;
    background-color: #e2e6ea;
    transform: translateY(-2px);
}

.nav-link.text-success {
    color: #00b894 !important;
}

/* Hero Section */
.hero-banner {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    border-radius: var(--radius-xl);
    padding: 1.5rem 2rem;
    color: white;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-soft);
}

.py-5 {
    padding: 1.5rem 2rem !important;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-weight: 800;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
}

/* Decorative 3D-ish Shapes for Hero (CSS only) */
.hero-shape {
    position: absolute;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    backdrop-filter: blur(5px);
}

.shape-1 {
    top: -20px;
    right: -20px;
    width: 150px;
    height: 150px;
}

.shape-2 {
    bottom: 20px;
    right: 80px;
    width: 80px;
    height: 80px;
    background: rgba(255, 215, 0, 0.3);
}

.shape-3 {
    top: 40px;
    left: 40%;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    transform: rotate(45deg);
}

/* Filter Pills */
.filter-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.filter-pill {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius-pill);
    background: white;
    color: var(--text-muted);
    border: 2px solid #dfe6e9;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.filter-pill:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
    transform: translateY(-2px);
}

.filter-pill.active {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: white;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
}

/* Game Cards */
.game-card {
    border-radius: var(--radius-xl);
    border: none;
    padding: 1.5rem;
    height: 100%;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow-soft);
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.game-card-normal {
    background: #ffffff;
    /* Default White/Lightest Grey */
}

.game-card-super {
    background: #f0f8ff;
    /* AliceBlue */
}

.game-card-insane {
    background: #fff0f5;
    /* LavenderBlush */
}

.game-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-hover);
}

/* Hover Utilities */
.hover-scale {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.hover-scale:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1) !important;
}

.cursor-pointer {
    cursor: pointer;
}

#btn-start-trivia:hover {
    border-color: var(--primary-blue) !important;
    background-color: rgba(79, 172, 254, 0.05);
}

#btn-start-geo:hover {
    border-color: #00b894 !important;
    background-color: rgba(0, 184, 148, 0.05);
}

.icon-box {
    width: 70px;
    height: 70px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin-bottom: 1.2rem;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.1);
}

/* Icon Colors */
.bg-blue-soft {
    background-color: #74b9ff;
    color: #fff;
}

.bg-yellow-soft {
    background-color: #ffeaa7;
    color: #d35400;
}

.bg-green-soft {
    background-color: #55efc4;
    color: #00897b;
}

.bg-red-soft {
    background-color: #ff7675;
    color: #fff;
}

.bg-purple-soft {
    background-color: #a29bfe;
    color: #fff;
}

.card-title {
    font-weight: 800;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.card-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

/* Difficulty Tags */
.difficulty-tag {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-easy {
    background: #e0f2f1;
    color: #00695c;
}

.tag-medium {
    background: #fff8e1;
    color: #f57f17;
}

.tag-hard {
    background: #ffebee;
    color: #c62828;
}

/* Game Canvas Container Override */

/* Call to Action Button */
.btn-light-orange {
    background-color: #ffbb00;
    /* Orange 500 */
    color: rgb(255, 255, 255) !important;

    border: 0px solid #ffffff;
    transition: all 0.3s ease;
}

.btn-light-orange:hover {
    background-color: #FFF;
    /* Orange 700 */
    color: #ffbb00 !important;
    border: 0px solid #ffb300;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(245, 124, 0, 0.3);
}

/* View Toggle Button */
.view-toggle-btn {
    background: white;
    border: 2px solid #dfe6e9;
    color: var(--text-muted);
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-toggle-btn.active {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: white;
}

/* List View Mode */
#games-grid.list-view-mode .game-card-wrapper {
    width: 100%;
    flex: 0 0 100%;
    max-width: 100%;
}

#games-grid.list-view-mode .game-card {
    flex-direction: row;
    align-items: center;
    padding: 1rem 1.5rem;
    height: auto;
}

#games-grid.list-view-mode .game-card>div:first-child {
    width: auto;
    margin-bottom: 0 !important;
    display: flex;
    align-items: center;
    margin-right: 1.5rem;
}

#games-grid.list-view-mode .icon-box {
    margin-bottom: 0;
    margin-right: 0;
    width: 60px;
    height: 60px;
    font-size: 2rem;
}

#games-grid.list-view-mode .difficulty-tag {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

#games-grid.list-view-mode .card-title {
    margin-bottom: 0.75rem !important;
    font-size: 1.2rem;
    vertical-align: top;
}

#games-grid.list-view-mode .card-text {
    margin-bottom: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    /* Limit to 1 line in list view for neatness, or keep full? */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Specific layout adjustment for list view content wrapper */
#games-grid.list-view-mode .game-card-content {
    flex-grow: 1;
}

/* --- List View Mode Styles --- */
#games-grid.list-view-mode .game-card-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

#games-grid.list-view-mode .game-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
        "icon title difficulty"
        "icon desc difficulty";
    align-items: center;
    column-gap: 1.25rem;
    padding: 0.75rem 1.25rem;
    text-align: left;
    height: auto;
}

/* This allows the icon and difficulty tag to become direct grid items */
#games-grid.list-view-mode .game-card>div:first-child {
    display: contents;
}

#games-grid.list-view-mode .icon-box {
    grid-area: icon;
    margin-bottom: 0 !important;
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
    border-radius: 12px;
}

#games-grid.list-view-mode .card-title {
    grid-area: title;
    margin-bottom: 0.2rem;
    font-size: 1.25rem;
    align-self: end;
}

#games-grid.list-view-mode .card-text {
    grid-area: desc;
    margin-bottom: 0;
    font-size: 0.95rem;
    color: var(--text-muted);
    align-self: start;
    /* Limit description length in list view */
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#games-grid.list-view-mode .difficulty-tag {
    grid-area: difficulty;
    margin-left: 1rem;
    align-self: center;
}

/* Adjust filter container when inside the toolbar */
.filter-container {
    padding-bottom: 0;
    /* Override default */
    margin-bottom: 0;
}

.mb-3 {
    margin-top: 0.5rem !important;
    margin-bottom: 0rem !important;
}

.mb-3-desc {
    margin-bottom: 0rem !important;
    margin-left: 2rem;
}

.mb-3 button {
    margin-bottom: 1.0rem;
    background-color: #51c5ff;
    color: #FFF;
}

/* Trivia Time Page Styles */
.animate-bounce {
    animation: bounce 2s infinite;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(-5%);
    }

    50% {
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .5;
    }
}

.option-btn {
    transition: all 0.2s ease;
    border-width: 2px;
}

.option-btn:hover:not(.btn-success):not(.btn-danger) {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Responsive Grid for Options */
@media (min-width: 768px) {
    #options-container {
        grid-template-columns: 1fr 1fr;
        display: grid;
    }
}

@media (min-width: 300px) and (max-width: 768px) {
    .filter-pill {
        margin: 0rem;
        padding: 0.25rem 0.25rem 0.25rem 0.25rem;

    }
}

/* --- Dark Mode Styles --- */
body.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
}

body.dark-mode .navbar {
    background-color: #1e1e1e;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

body.dark-mode .nav-link {
    background-color: #2c2c2c;
    color: #b0b0b0 !important;
}

body.dark-mode .nav-link:hover {
    color: var(--primary-blue) !important;
    background-color: #383838;
}

body.dark-mode .game-card-normal,
body.dark-mode .card,
body.dark-mode .bg-white,
body.dark-mode .bg-light,
body.dark-mode .alert {
    background-color: #1e1e1e !important;
    border-color: #333 !important;
    color: #e0e0e0 !important;
}

body.dark-mode .game-card-super {
    background: #1a222e !important;
    /* Dark AliceBlue equivalent */
    border-color: #2c3a4d !important;
}

body.dark-mode .game-card-insane {
    background: #2e1a22 !important;
    /* Dark LavenderBlush equivalent */
    border-color: #4d2c3a !important;
}

body.dark-mode .card {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

body.dark-mode .card-title,
body.dark-mode .text-dark {
    color: #e0e0e0 !important;
}

body.dark-mode .text-primary {
    color: #74b9ff !important;
}

body.dark-mode .card-text,
body.dark-mode .text-muted {
    color: #a0a0a0 !important;
}

body.dark-mode .filter-pill {
    background: #1e1e1e;
    border-color: #333;
    color: #b0b0b0;
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: #2c2c2c;
    border-color: #444444;
    color: #e0e0e0;
}

body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
    background-color: #2c2c2c;
    color: #e0e0e0;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 0.25rem rgba(79, 172, 254, 0.25);
}

body.dark-mode .form-select option {
    background-color: #2c2c2c;
    color: #e0e0e0;
}

body.dark-mode #grade-selector-container .input-group {
    background-color: #383838 !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5) !important;
}

body.dark-mode .form-control::placeholder {
    color: #888888;
    opacity: 1;
}

/* Fix browser autofill style in dark mode */
body.dark-mode input:-webkit-autofill,
body.dark-mode input:-webkit-autofill:hover,
body.dark-mode input:-webkit-autofill:focus,
body.dark-mode input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #2c2c2c inset !important;
    -webkit-text-fill-color: #e0e0e0 !important;
    transition: background-color 5000s ease-in-out 0s;
}

body.dark-mode .input-group-text {
    background-color: #383838;
    border-color: #444444;
    color: #e0e0e0;
}

body.dark-mode .filter-pill.active {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: white;
}

body.dark-mode .view-toggle-btn {
    background: #1e1e1e;
    border-color: #333;
}

body.dark-mode .dropdown-menu {
    background-color: #1e1e1e;
    border: 1px solid #333 !important;
}

body.dark-mode .dropdown-item,
body.dark-mode .dropdown-item-text {
    color: #e0e0e0;
}

body.dark-mode .dropdown-item:hover {
    background-color: #333;
    color: #fff;
}

body.dark-mode .dropdown-divider {
    border-top-color: #333;
}

body.dark-mode .border {
    border-color: #333 !important;
}

body.dark-mode .navbar-toggler {
    background-color: #f8f9fa;
    border-color: #6c757d;
}

body.dark-mode .navbar-toggler-icon {
    filter: invert(1);
}

/* Dark mode overrides for trivia hovers */
body.dark-mode #btn-start-trivia:hover {
    background-color: rgba(74, 185, 255, 0.1);
}

body.dark-mode #btn-start-geo:hover {
    background-color: rgba(0, 184, 148, 0.1);
}

.hero-title .ti-rocket {
    color: #ff6600;
}

/* Base icon colors mapping to darker hues */
body.dark-mode .bg-blue-soft {
    background-color: #0984e3;
    color: #fff;
}

body.dark-mode .bg-yellow-soft {
    background-color: #b38000;
    color: #ffeb3b;
}

body.dark-mode .bg-green-soft {
    background-color: #00b894;
    color: #e8f8f5;
}

body.dark-mode .bg-red-soft {
    background-color: #d63031;
    color: #fff;
}

body.dark-mode .bg-purple-soft {
    background-color: #6c5ce7;
    color: #fff;
}

/* Difficulty Tags adjustments for dark mode */
body.dark-mode .tag-easy {
    background: #004d40;
    color: #80cbc4;
}

body.dark-mode .tag-medium {
    background: #ff8f00;
    color: #fff8e1;
}

body.dark-mode .tag-hard {
    background: #c62828;
    color: #ffcdd2;
}