body {
    font-family: Arial, sans-serif;
    padding: 0;
    margin: 0;
    background-color: #f5f9ff;
    color: #333;
}

.header-container {
    background-color: #007bff;
    color: white;
    padding: 2rem;
    text-align: center;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.search-input {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: none;
    margin-top: 1rem;
    width: 60%;
    max-width: 300px;
}

.search-button {
    padding: 0.5rem 1.5rem;
    margin-left: 0.5rem;
    border-radius: 20px;
    border: none;
    background-color: #ffc107;
    color: black;
    font-weight: bold;
    cursor: pointer;
}

.card-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem;
}

.card {
    background-color: #fff;
    border: 1px solid #d0d0d0;
    padding: 1rem;
    border-radius: 16px;
    text-align: center;
    width: 200px;
    text-decoration: none;
    color: #333;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.back-btn {
    display: inline-block;
    margin: 2rem;
    text-decoration: none;
    color: #007bff;
    font-weight: bold;
}

.details {
    margin-top: 2rem;
    background: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.logo-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.logo {
    height: 50px;
    width: auto;
}

.logo {
    height: 50px;
    width: auto;
    animation: spin 3s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    -webkit-overflow-scrolling: touch;
    -webkit-tap-highlight-color: transparent;
    padding-bottom: 60px; /* room for the fixed footer */
}

.model-container {
    position: relative;
    width: 100%;
    height: 400px;
    margin: 0;
    padding: 0;
    touch-action: pan-y;
}

.model-container model-viewer {
    touch-action: pan-y;
}

@media (max-width: 600px) {
    .header-container {
        padding: 1.5rem 1rem;
    }

    .header-container h1 {
        font-size: 1.4rem;
    }

    .logo-title {
        flex-direction: column;
        gap: 0.5rem;
    }

    .search-form {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .search-input {
        width: 100%;
        max-width: none;
        box-sizing: border-box;
        min-height: 44px;
        margin-top: 0.5rem;
        font-size: 16px; /* prevents iOS zoom on focus */
    }

    .search-button {
        min-height: 44px;
        margin-left: 0;
    }

    .card-container {
        padding: 1rem;
        gap: 1rem;
    }

    .card {
        width: 100%;
        box-sizing: border-box;
    }

    .back-btn {
        margin: 1rem;
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }

    .details {
        margin: 1rem;
        padding: 1.25rem;
    }

    .page-btn {
        min-height: 44px;
        box-sizing: border-box;
        display: inline-flex;
        align-items: center;
    }

    .model-container,
    .model-container model-viewer {
        height: 300px !important;
    }

    /* higher specificity: the base .expand-btn rule comes later in the file */
    .model-container .expand-btn {
        min-height: 44px;
        right: 10px;
    }
}

.expand-btn {
    position: absolute;
    bottom: 10px;
    right: 300px;
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    transition: background-color 0.3s;
}

.expand-btn:hover {
    background-color: #005fa3;
}

.pagination {
    margin: 30px auto;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 14px;
    background-color: #0066cc;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.3s;
}

.page-btn:hover {
    background-color: #004d99;
}

.page-btn.current-page {
    background-color: #ffaa00;
    color: black;
    font-weight: bold;
    pointer-events: none;
}

.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #f0f8ff; /* light bluish-white */
    color: #004080; /* deep blue text */
    text-align: center;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 500;
    border-top: 2px solid #ffcc00; /* yellow highlight */
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
    z-index: 1000;
}



/* Category chips */
.chip-strip {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.25rem 0.25rem 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    scrollbar-width: none;
}

.chip-strip::-webkit-scrollbar {
    display: none;
}

.chip {
    flex: 0 0 auto;
    min-height: 44px;
    min-width: 44px;
    padding: 0 1.1rem;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 22px;
    background: transparent;
    color: white;
    font: inherit;
    font-weight: bold;
    cursor: pointer;
}

.chip.active {
    background-color: #ffc107;
    border-color: #ffc107;
    color: black;
}

@media (min-width: 601px) {
    .chip-strip {
        justify-content: center;
    }
}

.card[hidden] {
    display: none;
}

.card-name mark {
    background-color: #ffe08a;
    color: inherit;
    border-radius: 3px;
}

.card-category {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 2px 10px;
    border-radius: 12px;
    background-color: #e8f1ff;
    color: #004080;
    font-size: 12px;
}

.no-results {
    text-align: center;
    padding: 2rem 1rem;
    color: #555;
}

.result-count {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin: 0;
}

/* Teaching tools */
.header-container {
    position: relative;
}

.more-menu {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    text-align: left;
}

.more-btn {
    width: 44px;
    height: 44px;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.more-btn[aria-expanded="true"] {
    background: #ffc107;
    border-color: #ffc107;
    color: #000;
}

.more-list {
    position: absolute;
    top: 68px;
    right: 0;
    z-index: 10;
    min-width: 270px;
    padding: 0.75rem;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.more-list[hidden] {
    display: none;
}

.more-list button {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    width: 100%;
    min-height: 52px;
    padding: 0 1rem;
    border: none;
    border-radius: 8px;
    background: none;
    color: #004080;
    font: inherit;
    font-size: 1.05rem;
    text-align: left;
    cursor: pointer;
}

.more-list button + button {
    margin-top: 0.75rem;
}

.more-list svg {
    flex: 0 0 auto;
}

.more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.more-list button:hover,
.more-list button:focus-visible {
    background: #e8f1ff;
}

.more-list button[aria-checked="true"] {
    background: #ffc107;
    color: #000;
    font-weight: bold;
}

.exam-points summary {
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.exam-points ol {
    padding-left: 1.4rem;
    line-height: 1.6;
}

.muted {
    color: #666;
}

/* Projector mode: white canvas, maximum contrast, larger text */
.projector body {
    background: #fff;
    color: #000;
}

.projector .model-container,
.projector .model-container model-viewer {
    background-color: #fff;
    --poster-color: #ffffff;
}

.projector .details {
    background: #fff;
    border: 2px solid #000;
    box-shadow: none;
    font-size: 1.2rem;
}

.projector .muted,
.projector .back-btn {
    color: #000;
}

.projector .header-container {
    background: #000;
    color: #fff;
}

.placard {
    display: none;
}

@media print {
    @page {
        size: A4;
        margin: 15mm;
    }

    body > *:not(.placard) {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
        padding: 0;
    }

    .placard {
        display: block;
        font-family: Arial, sans-serif;
        font-size: 13pt;
    }

    .placard h1 {
        font-size: 28pt;
        margin: 0 0 4pt;
        border-bottom: 3px solid #000;
    }

    .placard h2 {
        font-size: 15pt;
        margin: 16pt 0 6pt;
    }

    .placard-formula {
        font-size: 22pt;
        margin: 4pt 0;
    }

    .placard ol {
        padding-left: 20pt;
        line-height: 1.5;
    }

    .placard .blank-line {
        border-bottom: 1px solid #000;
    }

    .note-lines {
        height: 80mm;
        background: repeating-linear-gradient(transparent, transparent 9mm, #000 9mm, #000 calc(9mm + 1px));
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .placard-qr {
        display: flex;
        align-items: center;
        gap: 12pt;
        margin-top: 14pt;
        break-inside: avoid;
    }

    .placard-qr svg {
        width: 35mm;
        height: 35mm;
    }

    .placard-qr p {
        font-size: 10pt;
        word-break: break-all;
    }
}

/* ---------- Top bar + slide-out drawer ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem 0;
    padding-top: calc(0.5rem + env(safe-area-inset-top));
    background: #007bff;
    color: #fff;
}
.hamburger,
.drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
}
.hamburger:hover, .drawer-close:hover { background: rgba(255, 255, 255, 0.2); }

.drawer-open { overflow: hidden; }
.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 0.3s ease;
    touch-action: none;
}
.drawer-overlay.show { opacity: 1; }
.drawer-overlay[hidden] { display: none; }

.drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 2001;
    width: min(300px, 82vw);
    box-sizing: border-box;
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
    background: #fff;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform 0.3s ease, visibility 0s linear 0.3s;
    overscroll-behavior: contain;
    overflow-y: auto;
    will-change: transform;
}
.drawer.open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.3s ease, visibility 0s;
}
.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem 0.5rem 1.25rem;
    background: #007bff;
    color: #fff;
}
.drawer-title { font-weight: bold; font-size: 1.15rem; }
.drawer-links { list-style: none; margin: 0; padding: 0.5rem; }
.drawer-links a {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-height: 52px;
    padding: 0 1rem;
    border-radius: 10px;
    color: #004080;
    text-decoration: none;
    font-size: 1.05rem;
}
.drawer-links a:hover { background: #e8f1ff; }
.drawer-links a[aria-current="page"] { background: #ffc107; color: #000; font-weight: bold; }
.drawer-icon { flex: 0 0 auto; }
.drawer-logout { padding: 0.5rem 1rem 1rem; }
.drawer-logout button {
    width: 100%;
    min-height: 48px;
    border: 2px solid #004080;
    border-radius: 10px;
    background: none;
    color: #004080;
    font: inherit;
    font-weight: bold;
    cursor: pointer;
}

/* ---------- Home hub (reuses the original header, card and button styles) ---------- */
.home-header { padding: 0.25rem 1rem 1rem; }
.home-header .logo-title { margin: 0; flex-direction: row; gap: 0.6rem; }
.home-header .logo { height: 34px; }
.home-header h1 { margin: 0; font-size: 1.4rem; }
.home-tag { display: block; font-size: 0.8rem; font-weight: normal; opacity: 0.9; }

.offline-note { text-align: center; margin: 0 1rem 1rem; }
.offline-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 36px;
    padding: 0 1rem;
    border: 2px solid #007bff;
    border-radius: 22px;
    color: #004080;
    font-size: 14px;
    font-weight: bold;
}

.reveal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 1.5rem;
    border: none;
    border-radius: 20px;
    background-color: #ffc107;
    color: black;
    font: inherit;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
}
.soon .reveal-btn { margin-top: 1rem; }

/* Stacked, overlapping destination cards */
.card-stack { max-width: 520px; margin: 1.5rem auto 1rem; padding: 0 1rem; }
.stack-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 120px;
    padding: 1rem 1rem 2.25rem;
    border: 1px solid #d0d0d0;
    border-radius: 20px;
    text-decoration: none;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.25s ease;
}
.stack-card + .stack-card { margin-top: -1.75rem; }
.stack-card:nth-child(1) { z-index: 1; transform: rotate(-1deg); }
.stack-card:nth-child(2) { z-index: 2; transform: rotate(1deg); }
.stack-card:nth-child(3) { z-index: 3; transform: rotate(-0.5deg); }
.stack-card:hover, .stack-card:focus-visible { transform: translateY(-6px) rotate(0); }
.stack-blue { background: #007bff; color: #fff; }
.stack-yellow { background: #ffc107; color: #000; }
.stack-light { background: #e8f1ff; color: #004080; }
.stack-art {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    border-radius: 14px;
    background: #fff;
    color: #007bff;
}
.stack-text h3 { margin: 0 0 0.25rem; font-size: 1.25rem; }
.stack-text p { margin: 0; font-size: 14px; line-height: 1.4; }

.soon { text-align: center; }
.soon-icon { font-size: 3rem; margin: 0; }

@media (max-width: 600px) {
    }

@media (prefers-reduced-motion: reduce) {
    .drawer, .drawer-overlay, .card, .stack-card { transition: none; }
}

/* Desktop: lay the cards out side by side */
@media (min-width: 768px) {
    .card-stack {
        display: flex;
        gap: 1.25rem;
        max-width: 1000px;
        margin-top: 2rem;
    }
    .stack-card {
        flex: 1 1 0;
        flex-direction: column;
        align-items: flex-start;
        min-height: 260px;
        padding: 1.5rem;
    }
    .stack-card + .stack-card { margin-top: 0; }
    .stack-card:nth-child(n) { transform: none; }
    .stack-card:hover, .stack-card:focus-visible { transform: translateY(-6px); }
    .stack-art { width: 96px; height: 96px; }
}

@media (min-width: 768px) {
    .home-page {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
        box-sizing: border-box;
    }
    .home-main {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding-bottom: 1rem;
    }
    .home-main .card-stack { margin-top: 0; width: 100%; box-sizing: border-box; }
}

/* ---------- Quick Quiz Arena ---------- */
.quiz { max-width: 960px; margin: 0 auto; padding: 1rem; }
.subject-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
.subject-card {
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.subject-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.subject-head h3 { margin: 0; color: #004080; font-size: 1.25rem; }
.subject-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: #e8f1ff;
    color: #007bff;
}
.level-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    min-height: 56px;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    border: 2px solid #007bff;
    border-radius: 12px;
    background: #fff;
    color: #004080;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.level-btn:hover:not(:disabled), .level-btn:focus-visible { background: #e8f1ff; }
.level-btn:disabled { border-color: #d0d0d0; color: #888; cursor: not-allowed; background: #f5f9ff; }
.level-text { display: flex; flex-direction: column; }
.level-text small { color: #666; }
.level-right { display: flex; flex-direction: column; align-items: flex-end; font-size: 13px; font-weight: bold; }
.star-row { display: inline-flex; gap: 2px; }
.star { color: #d0d0d0; display: inline-flex; }
.star.on { color: #ffc107; }
.star.on svg { fill: currentColor; }
.quiz-note { text-align: center; margin-top: 1.25rem; }

.quiz-meta { margin: 0 0 0.5rem; font-weight: bold; color: #004080; }
.progress { height: 10px; border-radius: 5px; background: #e8f1ff; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: #007bff; transition: width 0.3s ease; }
.quiz-q { margin: 1.25rem 0; font-size: 1.3rem; line-height: 1.4; outline: none; }
.options { display: grid; gap: 0.75rem; }
.option {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    width: 100%;
    min-height: 56px;
    padding: 0.5rem 1rem;
    border: 2px solid #007bff;
    border-radius: 12px;
    background: #fff;
    color: #004080;
    font: inherit;
    font-size: 1.05rem;
    text-align: left;
    cursor: pointer;
}
.option:hover { background: #e8f1ff; }
.option.selected { background: #ffc107; border-color: #ffc107; color: #000; font-weight: bold; }
.option-letter {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #007bff;
    color: #fff;
    font-weight: bold;
}
.option.selected .option-letter { background: #000; }
.quiz-actions { display: flex; justify-content: space-between; gap: 0.75rem; margin-top: 1.25rem; flex-wrap: wrap; }
.quiz-actions .reveal-btn { margin-top: 0; min-height: 48px; }
.reveal-btn:disabled { background: #e0e0e0; color: #888; cursor: not-allowed; }
.reveal-btn.quiz-quit { background: #e8f1ff; color: #004080; }
.summary-score { margin: 0; text-align: center; color: #004080; font-size: 1.6rem; outline: none; }
.summary-stars { text-align: center; margin: 0.5rem 0; }
.summary-stars .star svg { width: 32px; height: 32px; }
#summary-msg { text-align: center; }
.summary-actions { justify-content: center; }
.review { padding: 0; margin: 1.5rem 0 0; list-style: none; display: grid; gap: 0.75rem; }
.review-item { padding: 0.75rem 1rem; border-radius: 12px; background: #ffffff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); }
.review-item p { margin: 0.25rem 0; }
.review-q { font-weight: bold; }
@media (prefers-reduced-motion: reduce) { .progress-bar { transition: none; } }

/* ---------- Brain Games & Squads ---------- */
.mode-switch { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.mode-switch .chip { border-color: #007bff; color: #004080; background: #fff; }
.mode-switch .chip.active { background: #ffc107; border-color: #ffc107; color: #000; }
.games-note { text-align: center; margin: 0.75rem 0 1.25rem; }
.best-line { margin: 0 0 0.5rem; font-weight: bold; color: #004080; }
.team-list { display: grid; gap: 0.75rem; margin: 1rem 0; }
.team-row { display: grid; gap: 0.25rem; font-weight: bold; color: #004080; }
.team-row input {
    min-height: 48px;
    padding: 0 1rem;
    border: 2px solid #007bff;
    border-radius: 12px;
    font: inherit;
    font-size: 16px;
}
.pass-screen { text-align: center; }
.big-btn { min-height: 64px; padding: 0 2rem; font-size: 1.2rem; margin-top: 1rem; }
.play-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; color: #004080; flex-wrap: wrap; }
.play-info { min-height: 1.2em; margin: 0.5rem 0; text-align: center; }
.math-q { text-align: center; font-size: 2.2rem; font-weight: bold; color: #004080; margin: 1rem 0 1.25rem; }
.math-opts { grid-template-columns: 1fr 1fr; }
.math-opt { justify-content: center; font-size: 1.4rem; min-height: 64px; }
.math-opt.miss { background: #004080; border-color: #004080; color: #fff; }
.match-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
@media (min-width: 600px) { .match-grid { grid-template-columns: repeat(4, 1fr); } }
.match-card {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    padding: 0.4rem;
    border: 2px solid #007bff;
    border-radius: 12px;
    background: #007bff;
    color: #fff;
    font: inherit;
    font-weight: bold;
    cursor: pointer;
}
.match-face { font-size: 0.85rem; line-height: 1.2; word-break: break-word; text-align: center; }
.match-card .match-face:only-child { font-size: 1.4rem; }
.match-card.open { background: #fff; color: #004080; }
.match-card.open.formula .match-face { font-size: 1.1rem; }
.match-card.done { background: #ffc107; border-color: #ffc107; color: #000; cursor: default; }

.victory { position: relative; overflow: hidden; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 0.5rem; margin: 1.5rem 0 0.5rem; min-height: 220px; }
.pod { flex: 1 1 0; max-width: 130px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.15rem; }
.pod-name { font-weight: bold; color: #004080; word-break: break-word; }
.pod-score { font-size: 14px; color: #666; }
.pod-block {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px 12px 0 0;
    background: #007bff;
    color: #fff;
    font-size: 1.6rem;
    font-weight: bold;
}
.pod-1 .pod-block { height: 130px; background: #ffc107; color: #000; }
.pod-2 .pod-block { height: 100px; }
.pod-3 .pod-block { height: 75px; background: #004080; }
.pod-4 .pod-block { height: 55px; background: #e8f1ff; color: #004080; border: 1px solid #d0d0d0; }
.crown { color: #ffc107; animation: bob 1.2s ease-in-out infinite; }
.crown svg { fill: currentColor; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti-piece {
    position: absolute;
    top: -12px;
    width: 8px;
    height: 14px;
    border-radius: 2px;
    animation: fall linear infinite;
}
@keyframes fall { to { transform: translateY(520px) rotate(540deg); } }
@media (prefers-reduced-motion: reduce) { .crown { animation: none; } }

/* Super admin */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; }
.stat { display: flex; flex-direction: column; align-items: center; padding: 1rem; border-radius: 12px; background: #e8f1ff; color: #004080; text-align: center; }
.stat strong { font-size: 2rem; }
.stat-list { list-style: none; margin: 0; padding: 0; }
.stat-list li { display: flex; justify-content: space-between; padding: 0.6rem 0; border-bottom: 1px solid #e0e0e0; }
.stat-list li:last-child { border-bottom: none; }

/* ---------- Global search overlay ---------- */
.topbar-search { margin-left: auto; }
.gs-open { overflow: hidden; }
.gs-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: calc(1rem + env(safe-area-inset-top)) 1rem 1rem;
    background: rgba(0, 0, 0, 0.55);
}
.gs-overlay[hidden] { display: none; }
.gs-panel {
    width: 100%;
    max-width: 600px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}
.gs-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    background: #007bff;
    color: #fff;
}
.gs-input {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 0 1rem;
    border: none;
    border-radius: 22px;
    font: inherit;
    font-size: 16px;
}
.gs-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
}
.gs-close:hover { background: rgba(255, 255, 255, 0.2); }
.gs-results { overflow-y: auto; padding: 0.5rem 0.5rem 1rem; }
.gs-note { margin: 1rem; color: #666; }
.gs-group h3 {
    margin: 0.75rem 0.5rem 0.25rem;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #007bff;
}
.gs-item {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    align-items: baseline;
    min-height: 44px;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    color: #222;
    text-decoration: none;
}
.gs-item:hover, .gs-item:focus-visible { background: #e8f1ff; outline: none; }
.gs-kind { font-weight: bold; color: #004080; }
.gs-sub { color: #666; font-size: 0.9rem; }

/* ---------- Interactive Study Guide ---------- */
.guide {
    max-width: 680px;
    margin: 0 auto;
    padding: 1rem 1rem 2rem;
}
.guide-count { margin: 0.5rem 0.25rem; }
.guide-topic[hidden] { display: none; }
.guide-topic {
    margin-bottom: 0.75rem;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
.guide-topic.guide-flash { box-shadow: 0 0 0 3px #ffc107; }
.guide-topic summary {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-height: 44px;
    padding: 1rem 1.25rem;
    cursor: pointer;
    list-style: none;
}
.guide-topic summary::-webkit-details-marker { display: none; }
.guide-title { font-size: 1.1rem; font-weight: bold; color: #004080; }
.guide-tag { font-size: 0.85rem; color: #666; }
.guide-body {
    padding: 0 1.25rem 1.25rem;
    font-size: 1.05rem;
    line-height: 1.65;
}
.guide-summary { margin-top: 0; }
.guide-points { padding-left: 1.25rem; }
.guide-points li { margin-bottom: 0.5rem; }
.guide-trap {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
.guide-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.guide-save.is-saved { background-color: #007bff; color: #fff; }
.guide-empty { text-align: center; margin-top: 2rem; }

/* ---------- STEM Career Compass ---------- */
.careers { max-width: 680px; margin: 0 auto; padding: 1rem 1rem 2rem; }
.careers [hidden] { display: none; }
.cc-heading { margin: 1.5rem 0.25rem 0.5rem; color: #004080; }
.guide-body h3 { margin: 1rem 0 0.25rem; font-size: 1rem; color: #007bff; }
.cc-fields { padding-left: 0; }
.cc-pillars { display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.cc-pillar { display: grid; grid-template-columns: 9.5rem 1fr 2.5rem; gap: 0.5rem; align-items: center; font-size: 0.9rem; }
.cc-bar { height: 10px; border-radius: 5px; background: #e8f1ff; overflow: hidden; }
.cc-fill { height: 100%; background: #007bff; border-radius: 5px; transition: width 0.4s ease; }
.cc-pval { text-align: right; color: #666; }
.cc-match { margin-top: 1rem; }
.cc-match-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.cc-match-head h3 { margin: 0; color: #004080; }
.cc-pct { flex: 0 0 auto; padding: 0.15rem 0.6rem; border-radius: 12px; background: #ffc107; color: #000; font-weight: bold; font-size: 0.85rem; }
.cc-col + .cc-col { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #e0e0e0; }
.cc-col h3 { margin-top: 0; }
.cc-more { margin-top: 0.25rem; }
.cc-actions { margin-top: 1.5rem; justify-content: center; }
@media (min-width: 768px) {
    .cc-compare .guide-body { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
    .cc-col + .cc-col { margin-top: 0; padding-top: 0; border-top: none; }
}
@media (prefers-reduced-motion: reduce) { .cc-fill { transition: none; } }

/* ---------- Game stages & Sudoku ---------- */
.stage-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.25rem 0 0.5rem; }
.stage-row .chip { border-color: #007bff; color: #004080; background: #fff; }
.stage-row .chip.active { background: #ffc107; border-color: #ffc107; color: #000; }
.stage-info { margin: 0 0 0.5rem; min-height: 2.6em; }
.match-grid.match-small { grid-template-columns: repeat(4, 1fr); }
.sudoku { max-width: 440px; margin: 0 auto; }
.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    border: 3px solid #004080;
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 1;
    background: #fff;
}
.sudoku-cell {
    padding: 0;
    min-width: 0;
    border: 1px solid #b8d4f5;
    border-radius: 0;
    background: #fff;
    color: #007bff;
    font: inherit;
    font-size: clamp(1rem, 5.2vw, 1.5rem);
    font-weight: bold;
    cursor: pointer;
}
.sudoku-cell.box-r { border-right: 2px solid #004080; }
.sudoku-cell.box-b { border-bottom: 2px solid #004080; }
.sudoku-cell.given { color: #004080; background: #f5f9ff; }
.sudoku-cell.peer { background: #e8f1ff; }
.sudoku-cell.same { background: #ffe9a6; }
.sudoku-cell.sel { background: #ffc107; color: #000; }
.sudoku-cell.conflict { background: #fdd; color: #c62828; }
.sudoku-cell.sel.conflict { background: #f5a3a3; }
.sudoku-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem; margin-top: 0.75rem; }
.sudoku-key {
    min-height: 52px;
    border: 2px solid #007bff;
    border-radius: 12px;
    background: #fff;
    color: #004080;
    font: inherit;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
}
.sudoku-key:hover, .sudoku-key:focus-visible { background: #e8f1ff; }
.sudoku-erase { font-size: 1rem; }

/* ---------- Topic Practice ---------- */
.practice-pick { margin-bottom: 1rem; }
.pick-title { margin: 0.75rem 0 0.4rem; font-size: 1rem; color: #004080; }
.practice-pick .pick-title:first-child { margin-top: 0; }
.practice .mode-switch { justify-content: flex-start; }
.practice .mode-switch .chip { border-color: #007bff; color: #004080; background: #fff; }
.practice .mode-switch .chip.active { background: #ffc107; border-color: #ffc107; color: #000; }
.topics-title { margin-top: 1.25rem; }
.topic-list { display: grid; gap: 0.5rem; }
.topic-btn { margin-top: 0; }
.topic-tag { margin: 0.5rem 0 0; font-size: 14px; }
.option.correct { background: #ffc107; border-color: #ffc107; color: #000; font-weight: bold; }
.option.correct .option-letter { background: #000; }
.option.miss { background: #004080; border-color: #004080; color: #fff; }
.option:disabled { cursor: default; }
.explain { margin-top: 1rem; padding: 0.75rem 1rem; border-radius: 12px; background: #ffffff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); line-height: 1.4; }

/* Optional display-name prompt (telemetry.js) */
.alias-prompt {
    position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%);
    z-index: 1000; width: min(92vw, 380px); display: flex; flex-direction: column; gap: 0.5rem;
    padding: 1rem; background: #fff; border-radius: 12px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.alias-prompt input { padding: 0.6rem 0.75rem; border: 1px solid #d0d0d0; border-radius: 8px; font: inherit; }
.alias-actions { display: flex; gap: 0.5rem; }
.alias-actions .reveal-btn { flex: 1; }

/* ---------- Chess ---------- */
.chess { max-width: 480px; margin: 0 auto; }
.chess-board { display: grid; grid-template-columns: repeat(8, 1fr); aspect-ratio: 1; border: 3px solid #004080; border-radius: 6px; overflow: hidden; }
.chess-sq { position: relative; padding: 0; min-width: 0; border: 0; border-radius: 0; font: inherit; font-size: clamp(1.6rem, 9vw, 2.8rem); line-height: 1; cursor: pointer; }
.chess-sq.light { background: #f0e6c8; }
.chess-sq.dark { background: #8fb3d9; }
.chess-sq.pw { color: #fff; text-shadow: 0 0 2px #000, 0 0 2px #000, 0 1px 1px #000; }
.chess-sq.pb { color: #1b1b1b; text-shadow: 0 0 1px #fff; }
.chess-sq.last { box-shadow: inset 0 0 0 100px rgba(255, 193, 7, 0.45); }
.chess-sq.sel { box-shadow: inset 0 0 0 100px rgba(255, 193, 7, 0.85); }
.chess-sq.check { box-shadow: inset 0 0 0 100px rgba(220, 53, 69, 0.6); }
.chess-sq.target::after { content: ''; position: absolute; left: 35%; top: 35%; width: 30%; height: 30%; border-radius: 50%; background: rgba(0, 64, 128, 0.45); }
.chess-sq.target.cap::after { left: 6%; top: 6%; width: 88%; height: 88%; background: none; border: 4px solid rgba(220, 53, 69, 0.7); }
.chess-sq:focus-visible { outline: 3px solid #004080; outline-offset: -3px; z-index: 1; }
.chess-promo { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-top: 0.6rem; }
.chess-promo-btn { width: 56px; height: 56px; font-size: 2rem; border: 2px solid #007bff; border-radius: 12px; background: #8fb3d9; cursor: pointer; }
.chess-promo-btn.pw { color: #fff; text-shadow: 0 0 2px #000, 0 0 2px #000; }
.chess-promo-btn.pb { color: #1b1b1b; }
.chess .quiz-actions .reveal-btn:disabled { opacity: 0.5; cursor: default; }
