/* ==========================================================================
   History Quest - Page-Specific Styles
   Consolidated from inline <style> blocks for caching & compression
   ========================================================================== */

/* ==========================================================================
   INDEX PAGE (index.html)
   ========================================================================== */
.google-login-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    color: #444;
    padding: 12px 24px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    margin: 20px auto;
    width: fit-content;
    border: 1px solid #ddd;
    transition: box-shadow 0.3s;
}
.google-login-btn:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.welcome-back-banner {
    background: linear-gradient(135deg, rgba(100, 181, 246, 0.15) 0%, rgba(255, 152, 0, 0.15) 100%);
    border: 2px solid rgba(100, 181, 246, 0.3);
    border-radius: 15px;
    padding: 18px 20px;
    margin-bottom: 22px;
    text-align: center;
}
.welcome-back-banner h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: var(--text-primary);
}
.welcome-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 26px;
}
.welcome-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.welcome-stat-value {
    font-size: 22px;
    font-weight: bold;
    color: var(--accent-gold);
}
.welcome-stat-label {
    font-size: 12px;
    opacity: 0.8;
    color: var(--text-secondary);
}
/* Goal 66: Today in History daily card */
.today-card {
    display: flex;
    align-items: center;
    gap: 18px;
    background: linear-gradient(135deg, var(--card-bg) 0%, var(--bg-tertiary) 100%);
    border: 2px solid transparent;
    border-image: linear-gradient(135deg, #FFD700, #64B5F6, #FF9800) 1;
    border-radius: 16px;
    padding: 16px 22px;
    text-decoration: none;
    color: var(--text-primary);
    margin: 0 auto 24px auto;
    max-width: 640px;
    box-shadow: 0 4px 18px var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}
.today-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px var(--shadow);
}
.today-card-icon {
    font-size: 2.4em;
    flex-shrink: 0;
}
.today-card-body {
    flex: 1;
    min-width: 0;
}
.today-card-eyebrow {
    font-size: 0.85em;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 2px;
}
.today-card-title {
    font-size: 1.15em;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
/* G14 Phase 4: the dated On-This-Day line, above the CTA */
.today-card-event {
    font-size: 0.92em;
    line-height: 1.35;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.today-card-cta {
    font-size: 0.95em;
    color: var(--accent-blue);
    font-weight: 600;
}
.today-card.today-card-done {
    opacity: 0.7;
    border-image: linear-gradient(135deg, #999, #ccc, #999) 1;
    pointer-events: none;
}
.today-card.today-card-done .today-card-cta {
    color: var(--accent-green);
}

/* Goal 65: streak-at-risk nudge */
.streak-at-risk-note {
    margin: 14px auto 0 auto;
    padding: 10px 16px;
    border-radius: 12px;
    background: rgba(255, 152, 0, 0.12);
    border: 1px solid rgba(255, 152, 0, 0.35);
    color: var(--text-primary);
    text-align: center;
    font-size: 0.95em;
    max-width: 560px;
    line-height: 1.45;
}
.grade-selector {
    margin: 20px 0;
    text-align: center;
}
.grade-selector > label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: var(--text-primary);
}
.grade-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.grade-option input[type="radio"] {
    display: none;
}
.grade-btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 25px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 14px;
}
.grade-btn:hover {
    border-color: #64B5F6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}
.grade-option input[type="radio"]:checked + .grade-btn {
    background: linear-gradient(135deg, #64B5F6 0%, #FF9800 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(100, 181, 246, 0.4);
}
.logo-container {
    text-align: center;
    margin-bottom: 20px;
}
.logo-container img {
    max-width: 300px;
    width: 100%;
    height: auto;
}

/* Action Links (Review, Minigame) */
.action-link-wrap {
    text-align: center;
    margin: 15px 0;
}
.action-link {
    display: inline-block;
    padding: 12px 24px;
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: bold;
    transition: all 0.3s;
}
.action-link:hover {
    transform: translateY(-2px);
}
.action-link-review {
    background: linear-gradient(135deg, #9C27B0 0%, #E040FB 100%);
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.4);
}

/* Weekly Challenges (compact 3-up grid since the 2026-09 landing rework) */
.weekly-challenges {
    background: linear-gradient(135deg, rgba(103, 58, 183, 0.1), rgba(156, 39, 176, 0.1));
    border: 2px solid rgba(156, 39, 176, 0.3);
    border-radius: 15px;
    padding: 16px 16px 12px;
    margin: 18px 0 6px;
}
.challenge-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}
.challenge-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}
.challenge-card.completed {
    border-color: rgba(76, 175, 80, 0.4);
    background: rgba(76, 175, 80, 0.05);
}
.challenge-icon { font-size: 24px; flex-shrink: 0; }
.challenge-info { flex: 1; }
.challenge-name {
    font-weight: bold;
    font-size: 14px;
    color: var(--text-primary);
}
.challenge-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 2px 0 6px 0;
}
.challenge-progress-bar {
    height: 6px;
    background: var(--progress-bg);
    border-radius: 3px;
    overflow: hidden;
}
.challenge-fill {
    height: 100%;
    background: linear-gradient(90deg, #9C27B0, #E040FB);
    border-radius: 3px;
    transition: width 0.5s ease;
}
.challenge-card.completed .challenge-fill {
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
}
.challenge-status {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
    font-weight: bold;
}
.challenge-card.completed .challenge-status { color: #4CAF50; }

/* --- 2026-09 landing rework ------------------------------------------------
   Anonymous = sign-in gate. Members = hero play card, 5 mode cards, a utility
   row (join-with-a-code panel + how-to modal), the two daily hooks in one row
   (the postcard tucks into a stamp once visited), compact weekly challenges. */

/* Sign-in gate */
.welcome-screen--gate {
    max-width: 560px;
    margin: 4vh auto 0;
    text-align: center;
}
.signin-gate { padding: 4px 0 10px; }
.signin-gate-pitch {
    font-size: 1.12em;
    line-height: 1.55;
    color: var(--text-secondary);
    margin: 0 0 22px;
}
.google-login-btn--hero {
    padding: 14px 28px;
    font-size: 1.05em;
    border-radius: 50px;
    border: 2px solid var(--border-color);
    box-shadow: 0 6px 20px var(--shadow-light);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.google-login-btn--hero:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px var(--shadow);
}
.signin-gate .signin-value-line {
    max-width: 380px;
    margin: 4px auto 0;
    font-weight: 500;
    line-height: 1.5;
}

/* Hero play card */
.play-hero {
    margin: 4px 0 24px;
    padding: 22px 20px 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(100, 181, 246, 0.10), rgba(255, 152, 0, 0.10));
    border: 2px solid rgba(100, 181, 246, 0.35);
}
.play-hero .grade-selector { margin: 0 0 16px; }
.play-hero .grade-selector > label {
    font-family: var(--font-display);
    font-size: 15px;
    letter-spacing: 0.3px;
    margin-bottom: 10px;
}
.play-hero .grade-option { display: inline-block; font-size: 14px; margin: 0; }
.play-hero-hint {
    margin: 12px 0 0;
    font-size: 13px;
    color: var(--text-tertiary);
}

/* Section eyebrow (replaces the 20px section headers) */
.hq-section-title {
    text-align: center;
    margin: 0 0 12px;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* Utility row + join panel */
.utility-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 18px;
}
.util-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 16px;
    border-radius: 50px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.util-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-light);
}
.util-btn.is-active {
    background: var(--accent-blue);
    color: #fff;
    border-color: transparent;
}
.join-panel { margin: -6px 0 20px; }
.join-panel[hidden] { display: none; }

/* Daily hooks row */
.daily-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: stretch;
    margin: 4px 0 16px;
}
@media (min-width: 720px) {
    .daily-row:not(.postcard-tucked) { grid-template-columns: 1fr 1fr; }
}
.daily-row.postcard-tucked {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}
.daily-row .today-card { max-width: none; margin: 0; }
.daily-row .postcard-card {
    max-width: none;
    margin: 0;
    height: 100%;
    padding-right: 38px;
}
.postcard-slot { position: relative; min-width: 0; }
.postcard-tuck {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--bg-accent);
    color: var(--text-tertiary);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.postcard-tuck:hover { background: var(--accent-orange); color: #fff; }
/* The tucked stamp: a small tilted postcard that wiggles on hover */
.postcard-mini {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 68px;
    height: 74px;
    padding: 4px;
    border-radius: 8px;
    border: 2px dashed var(--accent-orange);
    background: var(--bg-accent);
    color: var(--text-tertiary);
    font-family: inherit;
    cursor: pointer;
    transform: rotate(-4deg);
    transform-origin: 50% 80%;
    box-shadow: 0 4px 12px var(--shadow-light);
    transition: box-shadow 0.2s ease;
}
.postcard-slot.is-tucked .postcard-card,
.postcard-slot.is-tucked .postcard-tuck { display: none; }
.postcard-slot.is-tucked .postcard-mini { display: inline-flex; }
.postcard-mini-emoji { font-size: 26px; line-height: 1; }
.postcard-mini-label {
    font-size: 8px;
    letter-spacing: 1px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
}
.postcard-mini:hover,
.postcard-mini:focus-visible {
    animation: postcard-wiggle 0.7s ease-in-out;
    box-shadow: 0 8px 18px var(--shadow);
}
@keyframes postcard-wiggle {
    0%, 100% { transform: rotate(-4deg); }
    20%      { transform: rotate(-12deg) scale(1.06); }
    40%      { transform: rotate(6deg) scale(1.06); }
    60%      { transform: rotate(-9deg) scale(1.04); }
    80%      { transform: rotate(3deg) scale(1.02); }
}

/* Intro / how-to modal */
.hq-modal {
    margin: auto; /* the global `* { margin: 0 }` reset kills the UA centring */
    border: none;
    border-radius: 20px;
    padding: 0;
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    background: var(--card-bg);
    color: var(--text-primary);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    overflow: auto;
}
.hq-modal::backdrop {
    background: rgba(15, 20, 45, 0.55);
    backdrop-filter: blur(2px);
}
.hq-modal[open] { animation: hq-modal-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes hq-modal-in {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}
.hq-modal-body {
    position: relative;
    padding: 28px 28px 22px;
    text-align: center;
}
.hq-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
}
.hq-modal-close:hover { background: var(--accent-orange); color: #fff; }
.hq-modal-mascot { font-size: 44px; line-height: 1; margin-bottom: 6px; }
.hq-modal h2 {
    font-family: var(--font-display);
    color: var(--accent-blue);
    font-size: 1.7em;
    margin: 0 0 10px;
}
.hq-modal-lead {
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0 0 10px;
}
.hq-modal-mission {
    line-height: 1.5;
    margin: 0 0 18px;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--bg-accent);
}
.hq-modal-sub {
    font-family: var(--font-display);
    color: var(--accent-orange);
    font-size: 1.05em;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin: 0 0 10px;
}
.howto-list {
    list-style: none;
    counter-reset: howto;
    text-align: left;
    max-width: 440px;
    margin: 0 auto 20px;
    display: grid;
    gap: 8px;
}
.howto-list li {
    counter-increment: howto;
    position: relative;
    padding-left: 38px;
    min-height: 26px;
    line-height: 1.45;
}
.howto-list li::before {
    content: counter(howto);
    position: absolute;
    left: 0;
    top: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #64B5F6, #FF9800);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
}
.hq-modal-cta { font-size: 1.15em; padding: 14px 36px; }
.hq-modal-note {
    margin: 18px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-tertiary);
}
@media (prefers-reduced-motion: reduce) {
    .hq-modal[open] { animation: none; }
    .postcard-mini:hover,
    .postcard-mini:focus-visible { animation: none; transform: rotate(-4deg) scale(1.06); }
}
@media (max-width: 480px) {
    .hq-modal-body { padding: 22px 18px 18px; }
    /* Scoped: features.css loads after this file and would otherwise win */
    .welcome-screen .mode-cards { grid-template-columns: repeat(2, 1fr); }
    .welcome-screen .mode-card-minigame { grid-column: 1 / -1; }
}

/* ==========================================================================
   PLAY PAGE (play.html)
   ========================================================================== */
.floating-emojis {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}
.timer-container {
    display: flex;
    align-items: center;
    gap: 8px;
}
.timer-bar {
    width: 120px;
    height: 8px;
    background: var(--progress-bg);
    border-radius: 4px;
    overflow: hidden;
}
.timer-fill {
    height: 100%;
    background: #4CAF50;
    border-radius: 4px;
    transition: width 0.1s linear, background-color 0.5s;
}
.timer-fill.warning {
    /* Goal 33: softer warning (amber, not orange) — gentle pacing, no anxiety */
    background: #FFC107;
}
.timer-text {
    font-weight: bold;
    font-size: 14px;
    min-width: 40px;
    text-align: right;
    color: var(--text-primary);
}
.timer-text.warning { color: #B8860B; }
.speed-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 5px;
}

/* Power-ups bar */
.powerups-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
    flex-wrap: wrap;
}
.powerup-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 25px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
}
.powerup-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}
.powerup-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.powerup-btn.used {
    opacity: 0.3;
    pointer-events: none;
    border-style: dashed;
}
.powerup-btn .powerup-icon { font-size: 18px; }
.powerup-btn .powerup-count {
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}
.powerup-btn.fifty-fifty:hover:not(:disabled) { border-color: #9C27B0; }
.powerup-btn.time-freeze:hover:not(:disabled) { border-color: #2196F3; }
.powerup-btn.double-points:hover:not(:disabled) { border-color: #FF9800; }
.powerup-btn.hint-btn:hover:not(:disabled) { border-color: #4CAF50; }
.powerup-active-indicator {
    display: none;
    text-align: center;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
    margin: 8px 0;
    animation: pulse-glow 1.5s ease-in-out infinite;
}
.powerup-active-indicator.visible { display: block; }
.powerup-active-indicator.double-active {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.2), rgba(255, 215, 0, 0.2));
    color: var(--accent-orange);
    border: 1px solid rgba(255, 152, 0, 0.4);
}
@keyframes pulse-glow {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}
.hint-reveal {
    display: none;
    text-align: center;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(139, 195, 74, 0.1));
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 10px;
    margin: 10px 0;
    color: var(--text-primary);
    font-style: italic;
}
.hint-reveal.visible { display: block; }
.choice-btn.eliminated {
    display: none !important;
}

/* True/False question layout */
.tf-choices {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 20px 0;
}
.tf-btn {
    flex: 1;
    max-width: 200px;
    padding: 20px 30px;
    font-size: 22px;
    font-weight: bold;
    border: 3px solid var(--border-color);
    border-radius: 15px;
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}
.tf-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px var(--shadow);
}
.tf-btn.tf-true:hover {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}
.tf-btn.tf-false:hover {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}
.tf-btn:active {
    transform: scale(0.95) !important;
}
.question-type-badge {
    display: inline-block;
    font-size: 0.5em;
    background: #9C27B0;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fff;
    margin-left: 5px;
}

/* ==========================================================================
   RESULTS PAGE (results.html)
   ========================================================================== */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}
.new-best-banner {
    background: linear-gradient(135deg, #FFD700 0%, #FF9800 100%);
    color: #333;
    padding: 12px 20px;
    border-radius: 10px;
    text-align: center;
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 20px;
    animation: glow-pulse 2s ease-in-out infinite;
}
.question-review {
    margin-top: 30px;
}
.review-toggle {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font-size: 18px;
    font-weight: bold;
    color: var(--text-primary);
    transition: all 0.3s;
}
.review-toggle:hover {
    border-color: #64B5F6;
}
.review-list {
    display: none;
    margin-top: 10px;
}
.review-list.expanded {
    display: block;
}
.review-item {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 10px;
    border-left: 4px solid;
    box-shadow: 0 2px 8px var(--shadow-light);
}
.review-item.correct {
    border-left-color: #4CAF50;
}
.review-item.incorrect {
    border-left-color: #f44336;
}
.review-item.partial {
    border-left-color: #FF9800;
}
.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.review-title {
    font-weight: bold;
    color: var(--text-primary);
}
.review-points {
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
}
.review-points.correct {
    background: #4CAF50;
    color: white;
}
.review-points.incorrect {
    background: #f44336;
    color: white;
}
.review-points.partial {
    background: #FF9800;
    color: white;
}
.review-answers {
    font-size: 14px;
    color: var(--text-secondary);
}
.review-answers .your-answer {
    margin-bottom: 4px;
}
.review-answers .correct-answer {
    color: var(--accent-green);
    font-weight: 500;
}
.review-answers .wrong-answer {
    color: #f44336;
}
.review-summary {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}
@media (max-width: 768px) {
    .review-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* ==========================================================================
   PROFILE PAGE (profile.html)
   ========================================================================== */
.profile-container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 20px;
}
.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px var(--shadow);
}
.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--border-color);
}
.profile-info h1 {
    margin: 0;
    font-size: 32px;
    color: var(--text-primary);
}
.profile-email {
    opacity: 0.8;
    margin-top: 5px;
    color: var(--text-secondary);
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 3px 10px var(--shadow-light);
}
.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: var(--accent-gold);
}
.stat-label {
    margin-top: 5px;
    opacity: 0.8;
    color: var(--text-secondary);
}
.section {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 3px 10px var(--shadow-light);
}
.section-title {
    font-size: 24px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    color: var(--text-primary);
}
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}
.achievement-card {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 2px solid transparent;
}
.achievement-card.tier-bronze { border-color: #cd7f32; }
.achievement-card.tier-silver { border-color: #c0c0c0; }
.achievement-card.tier-gold { border-color: #ffd700; }
.achievement-card.tier-platinum { border-color: #e5e4e2; box-shadow: 0 0 10px rgba(229, 228, 226, 0.3); }
.achievement-card.locked {
    opacity: 0.5;
    filter: grayscale(0.6);
}
.achievement-icon {
    font-size: 40px;
}
.achievement-info h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
}
.achievement-info p {
    margin: 5px 0 0 0;
    font-size: 12px;
    color: var(--text-tertiary); /* explicit AA color instead of opacity dimming (Goal 83) */
}
.tier-label {
    display: inline-block;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
}
.tier-label.bronze { background: #cd7f32; color: white; }
.tier-label.silver { background: #c0c0c0; color: #333; }
.tier-label.gold { background: #ffd700; color: #333; }
.tier-label.platinum { background: linear-gradient(135deg, #e5e4e2, #b8b8b8); color: #333; }
.locked-label {
    font-size: 12px;
    color: var(--text-tertiary);
    font-style: italic;
}
.game-history {
    list-style: none;
    padding: 0;
}
.game-item {
    background: var(--bg-tertiary);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.game-rank {
    font-weight: bold;
    color: var(--accent-gold);
}

/* Avatar Customization */
.profile-avatar-emoji {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    background: var(--bg-tertiary);
}
.avatar-edit-btn {
    margin-top: 8px;
    padding: 4px 14px;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}
.avatar-edit-btn:hover {
    background: var(--border-color);
    color: white;
}
.avatar-picker {
    display: none;
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px var(--shadow);
    border: 2px solid var(--border-color);
}
.avatar-picker.visible { display: block; }
.avatar-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.avatar-picker-header h3 {
    margin: 0;
    color: var(--text-primary);
}
.avatar-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 8px;
}
.avatar-category {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.avatar-category-label {
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    color: var(--text-tertiary);
    width: 80px;
    flex-shrink: 0;
}
.avatar-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.avatar-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-tertiary);
    cursor: pointer;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.avatar-option:hover {
    transform: scale(1.15);
    border-color: #FF9800;
    box-shadow: 0 3px 10px var(--shadow);
}
.avatar-option.selected {
    border-color: #FF9800;
    background: rgba(255, 152, 0, 0.15);
    box-shadow: 0 0 12px rgba(255, 152, 0, 0.4);
}
.avatar-reset {
    width: 50px;
    height: 50px;
    padding: 4px;
}
.btn-back {
    display: inline-block;
    background: linear-gradient(135deg, #64B5F6 0%, #FF9800 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    margin-bottom: 20px;
    transition: transform 0.3s;
}
.btn-back:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow);
}

/* Mastery Styles */
.mastery-section {
    margin-top: 30px;
}
.grade-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    border: 2px solid var(--border-color);
    box-shadow: 0 3px 10px var(--shadow-light);
}
.grade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.grade-title {
    font-size: 28px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}
.grade-percentage {
    font-size: 32px;
    font-weight: bold;
    color: var(--accent-gold);
}
.progress-bar-container {
    width: 100%;
    height: 30px;
    background: var(--progress-bg);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.5s ease;
}
/* The label rides the whole track, not the fill: centred inside a 6%-wide fill
   under overflow:hidden it rendered as ".0% omplete". */
.progress-bar-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
    pointer-events: none;
}
.topic-section {
    margin-bottom: 20px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 15px;
}
.topic-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--bg-accent);
    border-radius: 6px;
    margin-bottom: 10px;
    transition: background 0.3s;
}
.topic-header:hover {
    background: var(--border-color);
    color: white;
}
.topic-name {
    font-size: 18px;
    font-weight: bold;
}
.topic-stats {
    display: flex;
    gap: 15px;
    align-items: center;
}
.question-list {
    margin-left: 20px;
    display: none;
}
.question-list.expanded {
    display: block;
}
.question-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin: 8px 0;
    background: var(--input-bg);
    border-radius: 6px;
    border-left: 4px solid transparent;
}
.question-item.mastered {
    border-left-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}
.question-item.in-progress {
    border-left-color: #FFC107;
    background: rgba(255, 193, 7, 0.1);
}
.question-item.not-started {
    border-left-color: #888;
}
.question-item.almost-mastered {
    border-left-color: #FF9800;
    background: rgba(255, 152, 0, 0.1);
}
.almost-fire {
    font-size: 14px;
    margin-left: 6px;
}
.mastery-badge.almost {
    background: linear-gradient(135deg, #FF9800, #FF5722);
    color: white;
}
.question-title-text {
    flex: 1;
    color: var(--text-primary);
}
.question-mastery-info {
    display: flex;
    gap: 15px;
    align-items: center;
    font-size: 14px;
}
.mastery-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}
.mastery-badge.mastered {
    background: #4CAF50;
    color: white;
}
.mastery-badge.in-progress {
    background: #FFC107;
    color: black;
}
.mastery-badge.not-started {
    background: #666;
    color: white;
}
.attempts-count {
    color: var(--text-tertiary);
}

/* Almost Mastered Section */
.almost-mastered-section {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.15) 0%, rgba(255, 87, 34, 0.15) 100%);
    border: 2px solid rgba(255, 152, 0, 0.4);
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 20px;
}
.almost-mastered-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: bold;
    color: var(--accent-orange);
    margin-bottom: 12px;
}
.almost-icon {
    font-size: 20px;
    animation: pulse-fire 1.5s ease-in-out infinite;
}
@keyframes pulse-fire {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}
.almost-mastered-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.almost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 10px 15px;
    border-radius: 8px;
    border-left: 3px solid #FF9800;
}
.almost-title {
    font-size: 14px;
    color: var(--text-primary);
    flex: 1;
}
.almost-progress {
    display: flex;
    align-items: center;
    gap: 12px;
}
.almost-percentage {
    font-weight: bold;
    color: var(--accent-orange);
    font-size: 16px;
}
.almost-hint {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.9;
}
.almost-more {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    padding-top: 8px;
    opacity: 0.8;
}

/* Profile Mobile Responsive */
@media (max-width: 768px) {
    .profile-container {
        margin: 20px auto;
        padding: 10px;
    }
    .profile-header {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    .profile-avatar {
        width: 80px;
        height: 80px;
    }
    .profile-info h1 {
        font-size: 24px;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .stat-card {
        padding: 15px;
    }
    .stat-value {
        font-size: 28px;
    }
    .section {
        padding: 15px;
    }
    .section-title {
        font-size: 20px;
    }
    .achievements-grid {
        grid-template-columns: 1fr;
    }
    .achievement-card {
        padding: 12px;
    }
    .achievement-icon {
        font-size: 32px;
    }
    .game-item {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    .grade-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    .grade-title {
        font-size: 22px;
        flex-direction: column;
    }
    .topic-header {
        flex-direction: column;
        gap: 10px;
    }
    .question-item {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    .question-mastery-info {
        justify-content: center;
    }
}
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   LEADERBOARD PAGE (leaderboard.html)
   ========================================================================== */
.leaderboard-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}
.leaderboard-header {
    text-align: center;
    margin-bottom: 30px;
}
.leaderboard-header h1 {
    color: var(--accent-blue);
    font-size: 2.5em;
    margin-bottom: 10px;
}
.leaderboard-header p {
    color: var(--text-secondary);
    font-size: 1.1em;
}
.leaderboard-scope-tabs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.leaderboard-scope-tabs .scope-tab {
    padding: 10px 22px;
    border-radius: 999px;
    background: var(--card-bg);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    border: 2px solid var(--border-color);
    transition: all 0.2s ease;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}
.leaderboard-scope-tabs .scope-tab:hover {
    transform: translateY(-1px);
    border-color: #64B5F6;
}
.leaderboard-scope-tabs .scope-tab.active {
    background: linear-gradient(135deg, #64B5F6 0%, #FF9800 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(100, 181, 246, 0.3);
}
.class-selector {
    text-align: center;
    margin-bottom: 24px;
}
.class-selector label {
    margin-right: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}
.class-selector select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1em;
    min-height: 44px;
}
.scope-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin: 0 0 24px 0;
}
.personal-stats {
    background: linear-gradient(135deg, #64B5F6 0%, #FF9800 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    text-align: center;
}
.stat-box {
    background: rgba(255, 255, 255, 0.15);
    padding: 15px;
    border-radius: 10px;
}
.leaderboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}
.leaderboard-section {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 20px var(--shadow);
}
.leaderboard-section h2 {
    color: var(--accent-blue);
    margin-bottom: 20px;
    font-size: 1.5em;
    display: flex;
    align-items: center;
    gap: 10px;
}
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}
.leaderboard-table th {
    text-align: left;
    padding: 12px 8px;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.leaderboard-table td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--shadow-light);
}
.leaderboard-table tr:hover {
    background: var(--bg-tertiary);
}
.rank-cell {
    font-weight: bold;
    width: 50px;
}
.rank-1 { color: var(--accent-gold); font-size: 1.2em; }
.rank-2 { color: #C0C0C0; font-size: 1.1em; }
.rank-3 { color: #CD7F32; font-size: 1.05em; }
.player-name {
    font-weight: 500;
}
.score-cell {
    text-align: right;
    font-family: 'Courier New', monospace;
    font-weight: bold;
}
.points-cell {
    color: var(--accent-orange);
}
.empty-message {
    text-align: center;
    padding: 40px;
    color: var(--text-tertiary);
    font-style: italic;
}
.back-btn {
    display: inline-block;
    background: linear-gradient(135deg, #64B5F6 0%, #FF9800 100%);
    color: white;
    text-decoration: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: bold;
    transition: all 0.3s;
    margin-top: 30px;
}
.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(100, 181, 246, 0.4);
}
@media (max-width: 768px) {
    .leaderboard-grid {
        grid-template-columns: 1fr;
    }
    .personal-stats {
        grid-template-columns: 1fr 1fr;
    }
    .leaderboard-section {
        padding: 15px;
    }
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 10px 5px;
        font-size: 0.9em;
    }
}

/* ==========================================================================
   MINIGAME PAGE (minigame.html)
   ========================================================================== */
.minigame-page body {
    overflow: hidden;
    padding-top: 70px;
}
.minigame-page .mascot-container {
    display: none !important;
}
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}
.game-container .game-header {
    text-align: center;
    color: white;
    margin-bottom: 20px;
    z-index: 10;
}
.game-title {
    font-size: 32px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 10px;
}
.game-instruction {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 5px;
}
.game-controls {
    font-size: 14px;
    opacity: 0.7;
}
#gameCanvas {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    background: linear-gradient(180deg, #87CEEB 0%, #E0F6FF 100%);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    max-width: 100%;
    height: auto;
}
.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}
.success-overlay.show {
    display: flex;
}
.success-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 50px;
    border-radius: 20px;
    text-align: center;
    color: white;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.5s ease;
}
.success-emoji {
    font-size: 100px;
    animation: bounce 1s infinite;
}
.success-text {
    font-size: 36px;
    font-weight: bold;
    margin: 20px 0;
}
.success-fact {
    font-size: 18px;
    opacity: 0.9;
    max-width: 600px;
    line-height: 1.6;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes scaleIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}
@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}
.continue-btn {
    margin-top: 25px;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}
.continue-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}
.continue-btn:active {
    transform: translateY(0) scale(0.98);
}
.timer-display {
    /* Goal 85: slimmer HUD tucked under the nav so it can't collide with the header card */
    position: fixed;
    top: 84px;
    right: 12px;
    background: rgba(0, 0, 0, 0.9);
    padding: 12px 16px;
    border-radius: 12px;
    color: white;
    font-family: 'Courier New', monospace;
    z-index: 100;
    min-width: 175px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
}
.timer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.timer-row:last-child {
    border-bottom: none;
}
.timer-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}
.timer-value {
    font-size: 20px;
    font-weight: bold;
}
.timer-value.loading {
    animation: pulse 1s ease-in-out infinite;
    opacity: 0.5;
}
.timer-row.current .timer-value {
    color: #4CAF50; /* on the HUD's near-black panel — bright variants pass here */
    font-size: 22px;
}
.timer-row.personal .timer-value {
    color: #FFD700;
}
.timer-row.global .timer-value {
    color: #64B5F6;
}
.new-record {
    animation: pulse 0.5s ease-in-out infinite;
    color: #FF5722 !important;
}

/* Feedback Modal */
.feedback-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}
.feedback-overlay.hidden {
    display: none;
}
.feedback-content {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    padding: 40px 50px;
    border-radius: 20px;
    color: white;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 520px;
    animation: scaleIn 0.5s ease;
}
.feedback-content h3 {
    margin: 0 0 15px 0;
    font-size: 24px;
}
.feedback-content .outcome-text {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 15px;
}
.feedback-content .points-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 15px 0;
}
.feedback-content .points-earned {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
}
.feedback-content .points-possible {
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    opacity: 0.8;
}
.feedback-content .message {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 15px;
}
.feedback-btn {
    margin-top: 25px;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: bold;
    color: #FF6B6B;
    background: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
.feedback-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.feedback-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Touch controls */
.touch-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    padding: 0 20px;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 50;
    pointer-events: none;
}
.touch-controls.visible {
    display: flex;
}
.touch-dpad {
    display: flex;
    gap: 12px;
    pointer-events: auto;
}
.touch-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.45);
    color: white;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    pointer-events: auto;
    transition: background 0.1s;
}
.touch-btn:active, .touch-btn.pressed {
    background: rgba(100, 181, 246, 0.6);
    border-color: rgba(255, 255, 255, 0.8);
}
.touch-btn-jump {
    width: 80px;
    height: 80px;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
}
.touch-hint {
    display: none;
}

/* Minigame mobile */
@media (max-width: 850px) {
    .game-container .game-header {
        margin-bottom: 10px;
    }
    .game-title {
        font-size: 24px;
    }
    .game-instruction {
        font-size: 14px;
    }
    .timer-display {
        top: 80px;
        right: 10px;
        padding: 10px 14px;
        min-width: 160px;
        font-size: 12px;
    }
    .timer-value {
        font-size: 16px;
    }
    .timer-row.current .timer-value {
        font-size: 18px;
    }
}

/* ==========================================================================
   ADMIN PAGES
   ========================================================================== */

/* Shared admin background */
.admin-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Admin Dashboard */
.admin-container {
    max-width: 1400px;
    margin: 20px auto;
    padding: 20px;
}
.admin-header {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    color: var(--text-primary);
    margin-bottom: 30px;
    box-shadow: 0 5px 20px var(--shadow);
}
.admin-title {
    font-size: 36px;
    margin-bottom: 10px;
    color: var(--accent-blue);
}
.controls-bar {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    box-shadow: 0 5px 20px var(--shadow);
}
.search-box {
    flex: 1;
    min-width: 250px;
}
.search-box input {
    width: 100%;
    padding: 12px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text-primary);
}
.filter-select {
    padding: 12px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    font-size: 14px;
    min-width: 200px;
    background: var(--input-bg);
    color: var(--text-primary);
}
.btn-primary {
    padding: 12px 24px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
}
.btn-primary:hover {
    background: #45a049;
}
.users-table {
    background: var(--card-bg);
    border-radius: 10px;
    overflow-x: auto;
    box-shadow: 0 4px 20px var(--shadow);
}
.users-table table {
    width: 100%;
    border-collapse: collapse;
}
.users-table thead {
    background: #667eea;
    color: white;
}
.users-table th {
    padding: 15px;
    text-align: left;
    font-weight: bold;
}
.users-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}
.users-table tr:hover {
    background: var(--bg-tertiary);
}
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}
.status-online {
    background: #4CAF50;
    color: white;
}
.status-offline {
    background: #666;
    color: white;
}
.progress-mini {
    width: 80px;
    height: 8px;
    background: var(--progress-bg);
    border-radius: 4px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}
.progress-mini-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.3s;
}
.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 8px;
}
.user-name-link {
    color: #667eea;
    text-decoration: none;
    font-weight: bold;
}
.user-name-link:hover {
    text-decoration: underline;
}
.group-select {
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    font-size: 13px;
    background: var(--input-bg);
    color: var(--text-primary);
}
.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}
.email-text {
    color: var(--text-tertiary);
    font-size: 0.9em;
}
.no-users-message {
    text-align: center;
    padding: 40px;
    color: var(--text-primary);
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 5px 20px var(--shadow);
}
.standard-code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-primary);
    font-family: monospace;
}
.standard-badge {
    background: #667eea;
    color: white;
    margin-right: 4px;
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}
.topics-text {
    font-size: 0.9em;
    opacity: 0.8;
}

/* Admin User View */
.admin-notice {
    background: var(--card-bg);
    border: 2px solid #FFC107;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    color: var(--text-primary);
    box-shadow: 0 5px 20px var(--shadow);
}
.admin-notice strong {
    color: var(--accent-orange);
}
.user-header {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 5px 20px var(--shadow);
}
.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #64B5F6;
}
.user-info h1 {
    margin: 0;
    color: var(--accent-blue);
}
.user-info p {
    opacity: 0.8;
    margin: 5px 0;
    color: var(--text-secondary);
}
.member-since {
    opacity: 0.7;
    font-size: 14px;
    color: var(--text-tertiary);
}
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}
.mastery-grade {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 5px 20px var(--shadow);
}
.mastery-grade h3 {
    color: var(--accent-blue);
    margin-bottom: 15px;
}
.mastery-info {
    opacity: 0.8;
    margin-top: 10px;
    color: var(--text-secondary);
}

/* Admin Groups */
/* G13: `.header` (admin/groups.html, admin/group_dashboard.html) had no rule at
   all, and this stylesheet's `*` reset zeroes the browser's default heading and
   paragraph margins - so the page title collided with the card underneath it. */
.header {
    padding-top: 20px;
    margin-bottom: 20px;
}
.header h1 {
    margin-bottom: 4px;
}

.create-form {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px var(--shadow);
}
.create-form h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
}
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--text-primary);
}
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: inherit;
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #FF9800;
}
.btn {
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}
.btn:hover {
    background: #45a049;
}
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.group-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--shadow-light);
    transition: all 0.3s;
}
.group-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px var(--shadow);
}
.group-name {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--accent-blue);
}
.group-desc {
    color: var(--text-secondary);
    margin-bottom: 10px;
}
.group-members {
    font-size: 14px;
    color: var(--text-tertiary);
}
.group-date {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 10px;
}

/* Admin Group Dashboard */
.back-link {
    display: inline-block;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 15px;
    font-size: 14px;
}
.back-link:hover { color: #64B5F6; }

/* Heatmap */
.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}
.heatmap-cell {
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
}
.heatmap-topic { font-size: 12px; font-weight: bold; margin-bottom: 4px; }
.heatmap-pct { font-size: 20px; font-weight: bold; }
.heatmap-count { font-size: 12px; color: var(--text-tertiary); }

/* Grade bars */
.grade-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.grade-label {
    width: 80px;
    font-weight: bold;
    font-size: 14px;
    color: var(--text-primary);
}
.grade-bar {
    flex: 1;
    height: 24px;
    background: var(--progress-bg);
    border-radius: 12px;
    overflow: hidden;
}
.grade-fill {
    height: 100%;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
    transition: width 0.5s;
}

/* Student table */
.student-table {
    width: 100%;
    border-collapse: collapse;
}
.student-table th {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
}
.student-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--shadow-light);
    font-size: 14px;
    color: var(--text-primary);
}
.student-table tr:hover { background: var(--bg-tertiary); }
.mini-bar {
    width: 60px;
    height: 8px;
    background: var(--progress-bg);
    border-radius: 4px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
}
.mini-fill {
    height: 100%;
    border-radius: 4px;
}
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-tertiary);
    font-style: italic;
}
@media (max-width: 768px) {
    .admin-container { padding: 10px; }
    .heatmap-grid { grid-template-columns: repeat(2, 1fr); }
    .student-table { font-size: 12px; }
    .student-table th, .student-table td { padding: 8px 4px; }
}

/* ==========================================================================
   CHROMEBOOK & RESPONSIVE ENHANCEMENTS
   Targets: Chromebook (1366x768, 1280x800), tablets, small screens
   ========================================================================== */

/* --- Chromebook / small laptop (<=1366px) --- */
@media (max-width: 1366px) {
    .admin-container { max-width: 100%; padding: 15px; }
    .users-table th { padding: 12px 8px; font-size: 13px; }
    .users-table td { padding: 10px 8px; font-size: 13px; }
    .progress-mini { width: 60px; }
    .controls-bar { gap: 10px; }
    .search-box { min-width: 200px; }
    .admin-header { padding: 20px; }
    .admin-title { font-size: 28px; }
    .stats-summary { gap: 15px; }
}

/* --- Touch target enforcement (44px minimum for all interactive elements) --- */
@media (pointer: coarse) {
    .choice-btn { min-height: 44px; }
    .powerup-btn { min-height: 44px; padding: 10px 14px; }
    .grade-btn { min-height: 44px; padding: 10px 16px; }
    .nav-link { min-height: 44px; display: inline-flex; align-items: center; }
    .theme-toggle { min-height: 44px; min-width: 44px; }
    .tf-btn { min-height: 54px; }
    .back-btn, .btn-back { min-height: 44px; }
    .feedback-btn { min-height: 48px; }
    .leaderboard-table td, .leaderboard-table th { padding: 14px 8px; }
    .student-table td, .student-table th { padding: 12px 8px; }
    .avatar-option { width: 54px; height: 54px; }
    .group-select { min-height: 44px; font-size: 14px; }
    .filter-select { min-height: 44px; }
    .search-box input { min-height: 44px; }
    .challenge-card { padding: 14px; }
}

/* --- Medium screens / small tablets (<=1024px) --- */
@media (max-width: 1024px) {
    /* Admin tables: horizontal scroll wrapper already in place (overflow-x: auto on .users-table) */
    .users-table table { min-width: 800px; }
    .student-table { min-width: 700px; }

    /* Leaderboard grid stacks earlier on tablets */
    .leaderboard-grid { grid-template-columns: 1fr; gap: 20px; }

    /* Tighten admin header */
    .stats-summary .stat-card { padding: 15px; }

    /* Profile: 2-column stats at this point */
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- Tablet portrait and large phone (<=768px) enhancements --- */
@media (max-width: 768px) {
    /* Welcome stats wrap to 2x2 grid */
    .welcome-stats {
        flex-wrap: wrap;
        gap: 15px;
    }
    .welcome-stat {
        flex: 1 1 40%;
        min-width: 100px;
    }

    /* Power-ups compact layout */
    .powerups-bar { gap: 6px; }
    .powerup-btn {
        padding: 6px 10px;
        font-size: 12px;
        gap: 4px;
    }
    .powerup-btn .powerup-icon { font-size: 16px; }
    .powerup-btn .powerup-count { width: 18px; height: 18px; font-size: 10px; }
    .powerup-btn span:nth-child(2) { display: none; }

    /* Challenge cards stack */
    .challenge-cards { gap: 10px; }
    .challenge-card { padding: 12px; }
    .challenge-icon { font-size: 22px; }
    .challenge-name { font-size: 13px; }
    .challenge-desc { font-size: 11px; }

    /* Timer compact */
    .timer-container { max-width: 100%; }

    /* Admin: make overflow containers scrollable */
    .section { overflow-x: auto; }

    /* Minigame success overlay */
    .success-content { padding: 30px 20px; }
    .success-emoji { font-size: 60px; }
    .success-text { font-size: 24px; }

    /* Feedback overlay */
    .feedback-content { padding: 25px 20px; max-width: 90vw; }
    .feedback-content h3 { font-size: 20px; }
    .feedback-content .points-info { flex-direction: column; gap: 8px; }

    /* Scenario badges wrap */
    .scenario-title div { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }

    /* Review mode button on index */
    .welcome-screen a[href*="review"] { padding: 12px 20px; font-size: 14px; }
}

/* --- Small phone (<=480px) --- */
@media (max-width: 480px) {
    /* Welcome stats single column */
    .welcome-stats { flex-direction: column; gap: 10px; }
    .welcome-stat { flex: 1 1 100%; }
    .welcome-stat-value { font-size: 22px; }

    /* Power-ups: 2x2 grid */
    .powerups-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .powerup-btn {
        justify-content: center;
        font-size: 11px;
    }
    .powerup-btn span:nth-child(2) { display: inline; font-size: 10px; }

    /* Challenge cards tighter */
    .challenge-card { gap: 8px; }
    .challenge-progress-bar { height: 6px; }

    /* Leaderboard tighter */
    .leaderboard-container { padding: 10px; }
    .leaderboard-header h1 { font-size: 1.8em; }
    .personal-stats { padding: 15px; gap: 10px; grid-template-columns: 1fr; }
    .leaderboard-section { padding: 12px; }

    /* Profile tighter */
    .profile-avatar { width: 64px; height: 64px; }
    .profile-info h1 { font-size: 20px; }
    .grade-percentage { font-size: 24px; }
    .grade-title { font-size: 18px; }

    /* Admin group dashboard: heatmap single column */
    .heatmap-grid { grid-template-columns: 1fr; }

    /* Achievements grid */
    .achievements-grid { grid-template-columns: 1fr; gap: 10px; }
    .achievement-icon { font-size: 28px; }

    /* Minigame success overlay small */
    .success-content { padding: 20px 15px; border-radius: 12px; }
    .success-emoji { font-size: 48px; }
    .success-text { font-size: 20px; }
    .success-time { font-size: 18px; }
}

/* =========================================================
   2026-08 audit wave: Goals 35/69/70/71/72/80/81/84/85/88
   ========================================================= */

/* --- Goal 72: Postcards from Chronos --- */
.postcard-card {
    display: flex;
    gap: 14px;
    align-items: stretch;
    max-width: 560px;
    margin: 18px auto 0;
    padding: 14px 16px;
    background: var(--card-bg);
    border: 2px dashed var(--accent-orange);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    text-align: left;
    box-shadow: 0 4px 14px var(--shadow-light);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}
.postcard-card:hover { transform: translateY(-2px) rotate(-0.5deg); box-shadow: 0 8px 20px var(--shadow); }
.postcard-stamp {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 62px;
    border: 2px solid var(--accent-orange);
    border-radius: 6px;
    font-size: 26px;
    background: var(--bg-accent);
    padding: 4px;
}
.postcard-stamp-label {
    font-size: 8px;
    letter-spacing: 1px;
    text-align: center;
    color: var(--text-tertiary);
    font-weight: 700;
}
.postcard-eyebrow {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-orange);
    font-weight: 700;
    margin-bottom: 4px;
}
.postcard-text { font-style: italic; margin: 0 0 6px; color: var(--text-secondary); }
.postcard-cta { font-weight: 700; color: var(--accent-blue); font-size: 0.95em; }

/* --- Goal 80: freeze-saved banner --- */
.freeze-saved-banner {
    max-width: 560px;
    margin: 14px auto;
    padding: 14px 18px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(100, 181, 246, 0.18), rgba(129, 212, 250, 0.18));
    border: 2px solid #4FC3F7;
    color: var(--text-primary);
    font-size: 1.02em;
}

/* --- Goal 81: guest funnel --- */
.signin-value-line {
    margin: 8px 0 0;
    font-size: 0.95em;
    color: var(--text-secondary);
    font-weight: 600;
}
.guest-signin-prompt {
    margin: 22px auto;
    max-width: 520px;
    padding: 18px 20px;
    border-radius: 14px;
    background: var(--card-bg);
    border: 2px solid var(--accent-blue);
    box-shadow: 0 5px 16px var(--shadow-light);
}
.guest-signin-prompt p { margin-bottom: 12px; color: var(--text-primary); }
.guest-signin-prompt .btn-continue { display: inline-block; text-decoration: none; }
.guest-board-caption { margin-top: 8px; font-size: 0.95em; color: var(--text-secondary); }
.guest-board-caption a { color: var(--accent-blue); font-weight: 700; }

/* --- Goal 80: celebration & reward wiring --- */
.mastery-banner {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.16), rgba(103, 58, 183, 0.16));
    border: 2px solid #9C27B0;
    color: var(--text-primary);
    border-radius: 14px;
    padding: 14px 20px;
    margin: 0 0 15px;
    font-size: 1.1em;
    animation: mastery-pop 0.6s cubic-bezier(.2,1.6,.4,1);
}
@keyframes mastery-pop {
    0% { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
/* Rank-up: gold, and louder than the purple mastery banner it can sit beside. */
.rankup-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.20), rgba(255, 111, 0, 0.20));
    border: 2px solid #FFC107;
    color: var(--text-primary);
    border-radius: 14px;
    padding: 14px 20px;
    margin: 0 0 15px;
    animation: rankup-pop 0.7s cubic-bezier(.2, 1.6, .4, 1);
}
.rankup-icon {
    font-size: 2em;
    line-height: 1;
    animation: rankup-spin 1.2s ease-out;
}
.rankup-text { display: flex; flex-direction: column; gap: 2px; }
.rankup-text strong { font-size: 1.15em; letter-spacing: 0.02em; }
.rankup-text small { opacity: 0.85; }
@keyframes rankup-pop {
    0%   { transform: scale(0.6) translateY(8px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes rankup-spin {
    0%   { transform: rotate(-25deg) scale(0.5); }
    60%  { transform: rotate(12deg) scale(1.25); }
    100% { transform: rotate(0deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .rankup-banner, .rankup-icon { animation: none; }
}
.points-badge-zero {
    background: linear-gradient(135deg, #90A4AE 0%, #78909C 100%) !important;
    box-shadow: none !important;
}
.coin-badge {
    display: inline-block;
    background: linear-gradient(135deg, #FBC02D 0%, #F57F17 100%);
    color: #332200;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1.05em;
    box-shadow: 0 3px 12px rgba(251, 192, 45, 0.4);
}
.speed-star-badge {
    display: inline-block;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1.1em;
    box-shadow: 0 3px 12px rgba(255, 215, 0, 0.4);
}
.double-points-badge {
    display: inline-block;
    background: linear-gradient(135deg, #FF9800 0%, #FF5722 100%);
    color: #fff;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1.1em;
    box-shadow: 0 3px 12px rgba(255, 152, 0, 0.4);
}
.powerup-earned-banner {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.15), rgba(103, 58, 183, 0.15));
    border: 2px solid rgba(156, 39, 176, 0.4);
    border-radius: 12px;
    padding: 12px 20px;
    margin: 15px 0;
    text-align: center;
}
.powerup-earned-title { font-size: 18px; font-weight: bold; color: #9C27B0; }
[data-theme="dark"] .powerup-earned-title { color: #CE93D8; }
.powerup-earned-cause { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.stat-caption {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* --- Goal 80: power-up coach mark --- */
.powerup-coachmark {
    background: var(--card-bg);
    border: 2px solid #9C27B0;
    border-radius: 12px;
    padding: 12px 16px;
    margin: 10px 0;
    font-size: 14px;
    color: var(--text-primary);
    box-shadow: 0 6px 18px var(--shadow);
    text-align: center;
}
.coachmark-dismiss {
    margin-top: 8px;
    padding: 6px 18px;
    border: none;
    border-radius: 50px;
    background: #9C27B0;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    min-height: 32px;
}

/* --- Goal 88: somber-topic treatment --- */
.result-somber {
    color: var(--text-primary);
    font-weight: 600;
}

/* --- Goal 84: timer-at-zero reassurance --- */
.timer-text.timer-done {
    color: var(--text-tertiary);
    font-weight: 600;
}

/* --- Goal 84: minigame exit --- */
.minigame-back-link {
    display: inline-block;
    margin-top: 10px;
    color: #fff;
    text-decoration: underline;
    font-weight: 600;
    font-size: 14px;
    opacity: 0.95;
}

/* --- Goal 70: Time Workshop --- */
.workshop-screen {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 34px 26px;
    margin-top: 20px;
    text-align: center;
    box-shadow: 0 8px 30px var(--shadow);
}
.workshop-title { color: var(--accent-blue); margin-bottom: 6px; }
.workshop-subtitle { color: var(--text-secondary); max-width: 520px; margin: 0 auto 18px; }
.workshop-balance {
    font-size: 1.15em;
    margin-bottom: 20px;
    color: var(--text-primary);
}
.workshop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.workshop-card {
    border: 2px solid var(--border-color);
    border-radius: 14px;
    padding: 16px 12px;
    background: var(--bg-tertiary);
}
.workshop-icon { font-size: 34px; }
.workshop-name { font-weight: 700; margin: 6px 0 2px; color: var(--text-primary); }
.workshop-desc { font-size: 13px; color: var(--text-secondary); min-height: 34px; }
.workshop-cost { font-weight: 700; color: var(--accent-gold); margin: 6px 0; }
.workshop-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.workshop-stepper input {
    width: 44px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-primary);
    padding: 6px 0;
}
.ws-step {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--accent-blue);
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}
.ws-step:hover { transform: scale(1.08); }
.workshop-total { font-size: 1.1em; margin-bottom: 18px; color: var(--text-primary); }
.workshop-total-note { display: block; font-size: 13px; color: var(--text-tertiary); margin-top: 4px; }
#wsSubmit:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Goal 69: nav coins --- */
.coin-bump { animation: coin-bump 0.5s ease 2; }
@keyframes coin-bump {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.25); }
}

/* --- Goal 35: results redesign --- */
.results-tabs {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 24px 0 0;
}
.results-tab {
    padding: 10px 18px;
    border-radius: 50px 50px 0 0;
    border: 2px solid var(--border-color);
    border-bottom: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
    min-height: 40px;
}
.results-tab.active {
    background: var(--card-bg);
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}
.results-panel {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 0 14px 14px 14px;
    padding: 18px;
    margin-bottom: 20px;
    text-align: left;
}
.topic-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 18px 0 4px;
}
.topic-chip {
    padding: 6px 14px;
    border-radius: 50px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
}
.topic-chip-perfect { border-color: var(--accent-green); color: var(--accent-green); }
.topic-chip-miss { border-color: var(--accent-orange); color: var(--accent-orange); }
.review-count-correct { color: var(--accent-green); font-weight: 700; }
.review-count-partial { color: var(--accent-orange); font-weight: 700; }
.review-count-incorrect { color: #C62828; font-weight: 700; }
[data-theme="dark"] .review-count-incorrect { color: #EF9A9A; }
.review-stars { color: var(--accent-gold); }
.fact-carousel { text-align: center; }
.fact-carousel-card {
    background: var(--bg-accent);
    border: 2px solid var(--accent-gold);
    border-radius: 14px;
    padding: 24px 20px;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05em;
    color: var(--text-primary);
    margin-bottom: 12px;
}
.fact-carousel-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}
.fact-nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--accent-blue);
    background: var(--card-bg);
    color: var(--accent-blue);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
}
.fact-nav-btn:hover { background: var(--accent-blue); color: #fff; }
.fact-carousel-counter { font-weight: 700; color: var(--text-secondary); }
.challenge-complete-banner {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.14), rgba(139, 195, 74, 0.14));
    border: 2px solid var(--accent-green);
    border-radius: 14px;
    padding: 16px 20px;
    margin: 18px 0;
}
.challenge-complete-banner h3 { color: var(--accent-green); margin-bottom: 8px; }
.challenge-complete-row { margin: 4px 0; color: var(--text-primary); }
.challenge-coin-reward { font-weight: 700; color: var(--accent-gold); }
.score-item .stat-caption { flex-basis: 100%; }
.inline-restart-form { display: inline-block; }
.inline-restart-form .btn-play-again { border: none; cursor: pointer; }
.btn-review-missed { display: inline-block; text-decoration: none; }
.btn-home-link {
    display: inline-block;
    padding: 12px 22px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 700;
}
.btn-home-link:hover { color: var(--accent-blue); }

/* --- Goal 71: wardrobe --- */
.section-hint { color: var(--text-tertiary); font-size: 0.95em; margin-bottom: 14px; }
.wardrobe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.wardrobe-item {
    border: 2px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-tertiary);
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: transform 0.15s ease;
}
.wardrobe-item:hover:not([disabled]) { transform: translateY(-2px); }
.wardrobe-item.equipped { border-color: var(--accent-green); box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.25); }
.wardrobe-item.locked { opacity: 0.55; cursor: not-allowed; }
.wardrobe-icon { font-size: 30px; }
.wardrobe-name { font-weight: 700; }
.wardrobe-status { font-size: 12px; color: var(--text-tertiary); text-align: center; }
.wardrobe-item.equipped .wardrobe-status { color: var(--accent-green); font-weight: 700; }
.bonus-tracks-card { border: 2px dashed var(--accent-orange); }
.topic-pct { color: var(--accent-gold); }

/* Goal 86: topic accordions are real buttons now — keep the old look */
button.topic-header {
    width: 100%;
    background: none;
    border: none;
    font: inherit;
    color: inherit;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

/* --- Goal 85: raise remaining sub-12px text on small screens --- */
@media (max-width: 900px) {
    .powerup-btn .powerup-count { font-size: 12px; }
}
@media (max-width: 480px) {
    .challenge-desc { font-size: 12px; }
    .powerup-btn { font-size: 12px; }
    .powerup-btn span:nth-child(2) { font-size: 12px; }
    .powerup-btn .powerup-count { width: 20px; height: 20px; font-size: 12px; }
}

/* --- Goal 85: reserve breathing room above the mascot on touch layouts --- */
@media (max-width: 768px) {
    .page-content { padding-bottom: 76px; }
}
