/* ============================================================
   MATH BRAIN GAMES – mind.css  v4.0
   Ronny Best · Sticky Sidebar Navigation + Full Accessibility
   ============================================================ */

/* ── CSS Reset & Variables ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bisque:        #ffe4c4;
    --bisque-dark:   #f5d0a9;
    --bisque-deeper: #e8b98a;
    --bisque-light:  #fff9f3;
    --brown:         #7b4a1e;
    --brown-dark:    #4a2508;
    --brown-mid:     #a0622a;
    --amber:         #c97b0a;
    --amber-light:   #e8a84e;
    --green:         #2e6645;
    --green-light:   #3d8559;
    --accent:        #1a56a0;
    --accent-light:  #2a6cbf;
    --text:          #2e1a0c;
    --muted:         #7a5c42;
    --border:        rgba(123, 74, 30, 0.15);
    --shadow-sm:     0 2px 8px rgba(74, 37, 8, 0.08);
    --shadow-md:     0 4px 20px rgba(74, 37, 8, 0.12);
    --radius-sm:     6px;
    --radius-md:     10px;
    --radius-lg:     16px;
    --transition:    0.2s ease;

    --primary-c:        #16a34a;
    --primary-bg:       #f0fdf4;
    --primary-border:   #86efac;
    --secondary-c:      #d97706;
    --secondary-bg:     #fffbeb;
    --secondary-border: #fcd34d;
    --uni-c:            #dc2626;
    --uni-bg:           #fef2f2;
    --uni-border:       #fca5a5;

    /* Sidebar width */
    --sidebar-w: 210px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
    background: var(--bisque-light);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
}

/* ── SKIP LINKS ──────────────────────────────────────────────── */
.skip-link,
.skip-link-2 {
    position: absolute;
    top: -100%;
    left: 1rem;
    background: var(--brown-dark);
    color: var(--bisque);
    padding: 8px 16px;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: none;
    z-index: 9999;
    transition: top 0.2s;
}
.skip-link-2 { left: 14rem; }
.skip-link:focus,
.skip-link-2:focus { top: 0; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── PAGE WRAP ───────────────────────────────────────────────── */
.mind-page-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 3%, 2rem) 5rem;
}

/* ── HERO QUICK JUMP ─────────────────────────────────────────── */
.hero-quick-jump {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 228, 196, 0.15);
}

.hqj-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 228, 196, 0.5);
    white-space: nowrap;
}

.hqj-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    border: 1.5px solid rgba(255, 228, 196, 0.25);
    color: var(--bisque);
    background: rgba(255, 228, 196, 0.08);
    transition: all 0.2s;
    cursor: pointer;
    white-space: nowrap;
}
.hqj-btn:hover,
.hqj-btn:focus {
    background: rgba(255, 228, 196, 0.18);
    border-color: rgba(255, 228, 196, 0.5);
    outline: 2px solid var(--bisque);
    outline-offset: 2px;
}
.hqj-primary:hover  { background: rgba(22, 163, 74, 0.2);  border-color: #86efac; }
.hqj-secondary:hover{ background: rgba(217, 119, 6, 0.2);  border-color: #fcd34d; }
.hqj-uni:hover      { background: rgba(220, 38, 38, 0.2);  border-color: #fca5a5; }

/* ── COLLAPSIBLE INTRO ───────────────────────────────────────── */
.mind-collapsible {
    background: #fff;
    border: 1px solid var(--bisque-dark);
    border-radius: var(--radius-lg);
    margin: 1.5rem 0;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.mind-collapsible-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    background: var(--bisque-light);
    border-bottom: 1px solid transparent;
    transition: background 0.2s;
}
.mind-collapsible-summary::-webkit-details-marker { display: none; }
.mind-collapsible-summary:hover { background: var(--bisque-dark); }
.mind-collapsible[open] .mind-collapsible-summary {
    border-bottom-color: var(--bisque-dark);
}

.mcs-icon { font-size: 1.2rem; flex-shrink: 0; }
.mcs-text {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--brown-dark);
}
.mcs-chevron {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--muted);
    transition: transform 0.25s;
    display: flex;
    align-items: center;
}
.mind-collapsible[open] .mcs-chevron { transform: rotate(180deg); }

.mind-collapsible-body {
    padding: 0;
}

/* ── GAME LAYOUT: SIDEBAR + MAIN ─────────────────────────────── */
.mind-game-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    gap: 20px;
    align-items: start;
    margin: 1.5rem 0;
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.mind-game-sidebar {
    position: sticky;
    top: 80px; /* clears fixed nav */
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    border: 1px solid var(--bisque-dark);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: var(--bisque-dark) transparent;
}
.mind-game-sidebar::-webkit-scrollbar { width: 4px; }
.mind-game-sidebar::-webkit-scrollbar-track { background: transparent; }
.mind-game-sidebar::-webkit-scrollbar-thumb { background: var(--bisque-dark); border-radius: 4px; }

/* Sidebar header */
.mgn-header {
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--bisque-dark);
    flex-shrink: 0;
}
.mgn-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: 'Playfair Display', serif;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--brown-dark);
    letter-spacing: 0.02em;
}
.mgn-title svg { color: var(--muted); flex-shrink: 0; }

/* Sidebar groups */
.mgn-group {
    padding: 8px 8px 4px;
    border-bottom: 1px solid var(--bisque-dark);
}
.mgn-group:last-of-type { border-bottom: none; }

.mgn-level-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 6px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
}

.mgn-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.mgn-dot-green { background: #16a34a; }
.mgn-dot-amber { background: #d97706; }
.mgn-dot-red   { background: #dc2626; }

/* Sidebar links */
.mgn-link {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 7px 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    line-height: 1.2;
}
.mgn-link:hover {
    background: var(--bisque-light);
    color: var(--brown-dark);
    border-color: var(--bisque-dark);
}
.mgn-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
.mgn-link.active {
    background: var(--bisque-light);
    color: var(--brown-dark);
    font-weight: 700;
    border-color: var(--bisque-dark);
}

.mgn-link-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

/* Difficulty stars in sidebar */
.mgn-diff {
    margin-left: auto;
    font-size: 0.62rem;
    flex-shrink: 0;
    letter-spacing: -1px;
}
.mgn-diff-1 { color: #86efac; }
.mgn-diff-2 { color: #fcd34d; }
.mgn-diff-3 { color: #fca5a5; }

/* Sidebar footer */
.mgn-footer {
    margin-top: auto;
    padding: 10px 8px;
    border-top: 1px solid var(--bisque-dark);
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}
.mgn-footer-link {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 8px;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    background: rgba(26, 86, 160, 0.05);
    border: 1px solid rgba(26, 86, 160, 0.12);
    transition: background 0.15s;
}
.mgn-footer-link:hover { background: rgba(26, 86, 160, 0.1); }
.mgn-footer-link svg { flex-shrink: 0; }

/* ── STATUS BAR ──────────────────────────────────────────────── */
.mind-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bisque-light);
    border: 1px solid var(--bisque-dark);
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 14px;
    min-height: 36px;
}
.msb-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse-dot 2s infinite;
}
.msb-dot-green  { background: #16a34a; }
.msb-dot-amber  { background: #d97706; }
.msb-dot-red    { background: #dc2626; }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ── LEVEL SELECTOR TABS ─────────────────────────────────────── */
.level-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.level-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #fff;
    border: 2px solid var(--bisque-dark);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    box-shadow: var(--shadow-sm);
    font-family: 'DM Sans', sans-serif;
}
.level-tab:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.level-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.level-tab[data-level="primary"].active   { border-color: var(--primary-c);   background: var(--primary-bg); }
.level-tab[data-level="secondary"].active { border-color: var(--secondary-c); background: var(--secondary-bg); }
.level-tab[data-level="university"].active{ border-color: var(--uni-c);       background: var(--uni-bg); }

.lt-emoji { font-size: 1.3rem; flex-shrink: 0; }
.lt-info  { flex: 1; min-width: 0; }
.lt-info strong { display: block; font-size: 0.88rem; font-weight: 700; color: var(--text); line-height: 1; margin-bottom: 2px; }
.lt-info span   { font-size: 0.7rem; color: var(--muted); }
.lt-count { font-size: 0.68rem; background: var(--bisque-dark); color: var(--brown-dark); padding: 2px 7px; border-radius: 50px; font-weight: 700; white-space: nowrap; }

/* ── LEVEL PANELS ────────────────────────────────────────────── */
.level-panel { display: none; }
.level-panel.active { display: block; animation: fadePanel 0.3s ease; }

@keyframes fadePanel {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── GAME TABS ───────────────────────────────────────────────── */
.game-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #fff;
    border: 1px solid var(--bisque-dark);
    border-radius: var(--radius-lg);
    padding: 10px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.gtab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: 1.5px solid var(--bisque-dark);
    border-radius: var(--radius-sm);
    background: var(--bisque-light);
    color: var(--muted);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.gtab:hover { background: var(--bisque-dark); border-color: var(--brown-mid); transform: translateY(-2px); }
.gtab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gtab.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 2px 8px rgba(26, 86, 160, 0.25); }

/* ── GAME PANELS ─────────────────────────────────────────────── */
.game-panel {
    display: none;
    background: #fff;
    border: 1px solid var(--bisque-dark);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    animation: slideIn 0.3s ease;
    margin-top: 4px;
}
.game-panel.active { display: block; }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── GAME HEADER ─────────────────────────────────────────────── */
.gp-header {
    border-bottom: 1px solid var(--bisque-dark);
    padding-bottom: 14px;
    margin-bottom: 20px;
}
.gp-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 50px;
    border: 1.5px solid;
    margin-bottom: 7px;
}
.badge-p { color: var(--primary-c);   background: var(--primary-bg);   border-color: var(--primary-border); }
.badge-s { color: var(--secondary-c); background: var(--secondary-bg); border-color: var(--secondary-border); }
.badge-u { color: var(--uni-c);       background: var(--uni-bg);       border-color: var(--uni-border); }

.gp-header h2 { font-family: 'Playfair Display', Georgia, serif; font-size: clamp(1.35rem, 2.5vw, 1.8rem); color: var(--brown-dark); margin-bottom: 5px; }
.gp-header p  { color: var(--muted); font-size: 0.88rem; }

.difficulty-stars { margin-top: 7px; }
.star        { color: var(--bisque-dark); font-size: 0.95rem; }
.star.filled { color: var(--amber); }

.gp-body { max-width: 680px; margin: 0 auto; }

/* ── GAME GUIDE ──────────────────────────────────────────────── */
.game-guide {
    background: var(--bisque-light);
    border: 1px solid var(--bisque-dark);
    border-top: 3px solid var(--amber);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    padding: 18px 22px;
    margin-top: 20px;
}
.game-guide h3 { font-family: 'Playfair Display', serif; font-size: 0.97rem; color: var(--brown-dark); margin-bottom: 10px; font-weight: 700; }

.formula-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.formula-list li { font-size: 0.85rem; color: var(--text); padding-left: 14px; position: relative; line-height: 1.6; }
.formula-list li::before { content: '›'; position: absolute; left: 0; color: var(--amber); font-weight: 700; }
.formula-list li strong  { color: var(--brown-dark); font-weight: 700; }

/* ── TYPE / MODE ROWS ────────────────────────────────────────── */
.algebra-type-row, .calc-mode-row, .matrix-op-row, .complex-mode-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 14px;
}
.atype-btn {
    padding: 6px 14px;
    border: 1.5px solid var(--bisque-dark);
    border-radius: var(--radius-sm);
    background: var(--bisque-light);
    color: var(--muted);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
}
.atype-btn:hover { background: var(--bisque-dark); border-color: var(--brown-mid); }
.atype-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.atype-btn.active { background: var(--brown-dark); color: var(--bisque); border-color: var(--brown-dark); }

/* ── DISPLAY CARDS ───────────────────────────────────────────── */
.display-card {
    background: var(--bisque-light);
    border: 1px solid var(--bisque-dark);
    border-radius: var(--radius-md);
    padding: 28px 20px;
    text-align: center;
    margin-bottom: 18px;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    transition: background 0.2s;
}
.display-card.flash-ok  { background: #d4edda; }
.display-card.flash-err { background: #fde8e8; }

.display-eq { font-family: 'Playfair Display', serif; font-size: clamp(1.5rem, 3.5vw, 2.2rem); color: var(--text); }
.eq-card { min-height: 90px; }

.series-card { flex-direction: column; gap: 5px; padding: 20px; }
.series-sigma { font-family: 'Playfair Display', serif; font-size: 2.8rem; color: var(--brown-mid); line-height: 1; }
.series-term  { font-family: 'DM Mono', monospace; font-size: clamp(1.3rem, 3vw, 1.9rem); color: var(--brown-dark); font-weight: 500; }
.series-range { font-size: 0.85rem; color: var(--muted); }

/* ── PILLS ───────────────────────────────────────────────────── */
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; justify-content: center; }
.pill { background: var(--bisque-light); border: 1px solid var(--bisque-dark); color: var(--muted); padding: 4px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: 500; }
.pill strong  { color: var(--brown-dark); }
.pill-fire    { background: #fff3e0; border-color: #f5a623; }
.pill-fire strong { color: #c0700a; }

/* ── CONTROLS ────────────────────────────────────────────────── */
.control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

input[type="text"],
input[type="number"],
textarea {
    padding: 10px 14px;
    border: 1.5px solid var(--bisque-dark);
    border-radius: var(--radius-md);
    background: var(--bisque-light);
    font-family: 'DM Mono', monospace;
    font-size: 1rem;
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
input[type="text"],
input[type="number"] { width: 175px; }
textarea { width: 100%; font-family: 'DM Sans', sans-serif; resize: vertical; }
input:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26, 86, 160, 0.12);
}

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn-primary {
    padding: 10px 22px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s;
    box-shadow: 0 2px 8px rgba(26, 86, 160, 0.25);
}
.btn-primary:hover          { background: var(--accent-light); transform: translateY(-2px); }
.btn-primary:focus-visible  { outline: 2px solid var(--accent); outline-offset: 3px; }

.btn-ghost {
    padding: 9px 20px;
    background: transparent;
    color: var(--brown-dark);
    border: 1.5px solid var(--bisque-dark);
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
}
.btn-ghost:hover         { background: var(--bisque-dark); transform: translateY(-2px); }
.btn-ghost:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.btn-start {
    padding: 10px 22px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s;
    box-shadow: 0 2px 8px rgba(46, 102, 69, 0.25);
}
.btn-start:hover         { background: var(--green-light); transform: translateY(-2px); }
.btn-start:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

.btn-hint {
    padding: 9px 18px;
    background: #fff8e6;
    color: #8a6000;
    border: 1.5px solid #f0d080;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
}
.btn-hint:hover         { background: #fdeea0; transform: translateY(-2px); }
.btn-hint:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

.btn-outline-navy {
    display: inline-block;
    padding: 10px 22px;
    border: 2px solid var(--accent);
    border-radius: var(--radius-md);
    color: var(--accent);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.18s;
}
.btn-outline-navy:hover         { background: var(--accent); color: #fff; transform: translateY(-2px); }
.btn-outline-navy:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.dual-btns { display: flex; gap: 14px; justify-content: center; margin: 14px 0; flex-wrap: wrap; }
.btn-yes {
    padding: 12px 28px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.97rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s;
    box-shadow: 0 2px 8px rgba(46, 102, 69, 0.25);
}
.btn-yes:hover         { background: var(--green-light); transform: translateY(-2px); }
.btn-yes:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

.btn-no {
    padding: 12px 28px;
    background: #b91c1c;
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.97rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s;
    box-shadow: 0 2px 8px rgba(185, 28, 28, 0.25);
}
.btn-no:hover         { background: #8f2020; transform: translateY(-2px); }
.btn-no:focus-visible { outline: 2px solid #b91c1c; outline-offset: 3px; }

/* ── RESULT ──────────────────────────────────────────────────── */
.result {
    text-align: center;
    padding: 11px 16px;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-weight: 600;
    min-height: 42px;
    transition: all 0.18s;
}
.result.ok  { background: #d4edda; color: #155724; border: 1.5px solid #28a745; }
.result.err { background: #f8d7da; color: #721c24; border: 1.5px solid #dc3545; }

/* ── OPTIONS GRID ────────────────────────────────────────────── */
.options-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0; }
.options-grid.four-col { grid-template-columns: repeat(2, 1fr); }

.opt-btn {
    padding: 13px 10px;
    background: var(--bisque-light);
    border: 1.5px solid var(--bisque-dark);
    border-radius: var(--radius-md);
    font-family: 'DM Mono', monospace;
    font-size: 0.92rem;
    color: var(--brown-dark);
    cursor: pointer;
    transition: all 0.18s;
    text-align: center;
    line-height: 1.4;
    word-break: break-word;
}
.opt-btn:hover          { background: var(--bisque-dark); border-color: var(--brown-mid); transform: translateY(-2px); }
.opt-btn:focus-visible  { outline: 2px solid var(--accent); outline-offset: 2px; }
.opt-btn.correct        { background: #d4edda !important; border-color: #28a745 !important; color: #155724 !important; }
.opt-btn.wrong          { background: #f8d7da !important; border-color: #dc3545 !important; color: #721c24 !important; }

/* ── WORKING PANEL ───────────────────────────────────────────── */
.working-panel {
    background: var(--bisque-light);
    border: 1px solid var(--bisque-dark);
    border-left: 4px solid var(--amber);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 14px 18px;
    font-size: 0.88rem;
    color: var(--text);
    line-height: 1.8;
    margin: 10px 0;
    font-family: 'DM Mono', monospace;
    white-space: pre-wrap;
}

/* ── PROGRESS TRACK ──────────────────────────────────────────── */
.progress-track {
    height: 7px;
    background: var(--bisque-dark);
    border-radius: 50px;
    overflow: hidden;
    flex: 1;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green), var(--green-light));
    border-radius: 50px;
    transition: width 0.5s ease;
}

/* ── NUMBER NINJA ────────────────────────────────────────────── */
.ninja-arena {
    background: linear-gradient(135deg, var(--brown-dark) 0%, #1a3d6e 100%);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 18px;
    text-align: center;
}
.chain-display { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.chain-start, .chain-val  { font-family: 'Playfair Display', serif; font-size: clamp(1.8rem, 5vw, 3.2rem); font-weight: 900; color: #fff; }
.chain-op                 { font-family: 'Playfair Display', serif; font-size: clamp(1.4rem, 3.5vw, 2.3rem); font-weight: 700; color: var(--amber-light); }
.chain-eq                 { font-family: 'DM Mono', monospace; font-size: clamp(1.2rem, 2.5vw, 1.8rem); color: rgba(255,255,255,0.6); }
.chain-blank              { font-family: 'Playfair Display', serif; font-size: clamp(1.8rem, 5vw, 3.2rem); font-weight: 900; color: var(--amber-light); border-bottom: 3px dashed var(--amber-light); padding: 0 10px; min-width: 55px; display: inline-block; }
.ninja-progress           { display: flex; align-items: center; gap: 10px; }
.ninja-progress span      { color: rgba(255,255,255,0.7); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }

/* ── TIMES TABLE BLITZ ───────────────────────────────────────── */
.table-selector { margin-bottom: 14px; }
.table-selector p { font-size: 0.85rem; color: var(--muted); font-weight: 600; margin-bottom: 7px; }
.table-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.tbl-btn {
    width: 42px; height: 42px;
    border: 1.5px solid var(--bisque-dark);
    border-radius: var(--radius-sm);
    background: var(--bisque-light);
    font-family: 'DM Mono', monospace;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--brown-dark);
    cursor: pointer;
    transition: all 0.18s;
    display: flex; align-items: center; justify-content: center;
}
.tbl-btn:hover { background: var(--bisque-dark); transform: translateY(-2px); }
.tbl-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tbl-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── SHAPE QUEST ─────────────────────────────────────────────── */
.shape-arena {
    background: var(--bisque-light);
    border: 1px solid var(--bisque-dark);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 180px;
}
.shape-display { width: 100%; display: flex; justify-content: center; }
.shape-display svg { max-width: 220px; height: auto; }
.shape-question { font-family: 'Playfair Display', serif; font-size: clamp(1rem, 2.2vw, 1.4rem); color: var(--brown-dark); font-weight: 700; text-align: center; }

/* ── ALGEBRA DUEL ────────────────────────────────────────────── */
.algebra-note { background: #fff8e6; border-left: 3px solid var(--amber); padding: 7px 12px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 0.83rem; color: var(--muted); margin-bottom: 10px; display: none; }
.algebra-note.visible { display: block; }
.algebra-input-area { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 10px; }
.algebra-input-area input { width: 155px; }
.algebra-input-area label { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 0.78rem; color: var(--muted); font-weight: 600; }

/* ── TRIG CHALLENGE ──────────────────────────────────────────── */
.trig-arena { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 14px; align-items: flex-start; }
.trig-diagram { background: var(--bisque-light); border: 1px solid var(--bisque-dark); border-radius: var(--radius-md); padding: 14px; display: flex; justify-content: center; align-items: center; flex: 0 0 auto; }
.trig-question { flex: 1; min-width: 160px; padding: 14px; background: var(--bisque-light); border: 1px solid var(--bisque-dark); border-radius: var(--radius-md); font-size: 0.9rem; color: var(--text); line-height: 1.7; }
.trig-question strong { color: var(--brown-dark); }
.trig-hint { background: #fff8e6; border-left: 4px solid var(--amber); padding: 9px 12px; font-size: 0.85rem; color: var(--muted); margin-bottom: 10px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-family: 'DM Mono', monospace; }

/* ── GRAPH DECODER ───────────────────────────────────────────── */
.graph-arena { display: flex; justify-content: center; margin-bottom: 12px; }
#graphCanvas { border: 1px solid var(--bisque-dark); border-radius: var(--radius-md); background: #fff; max-width: 100%; }
.graph-question { font-family: 'Playfair Display', serif; font-size: 1.05rem; color: var(--brown-dark); font-weight: 700; text-align: center; margin-bottom: 10px; padding: 9px; background: var(--bisque-light); border-radius: var(--radius-sm); }

/* ── FACTOR STORM ────────────────────────────────────────────── */
.storm-card { border: 2px solid var(--secondary-border) !important; }
.storm-bar-wrap { margin-bottom: 10px; display: flex; flex-direction: column; gap: 5px; }
.storm-label { font-size: 0.75rem; color: var(--muted); text-align: center; }
.storm-bar { height: 7px; background: var(--bisque-dark); border-radius: 50px; width: 100%; position: relative; overflow: hidden; }
#stormOverlay {
    position: absolute; top: 0; left: 0; height: 100%;
    background: linear-gradient(90deg, #16a34a 0%, #d97706 50%, #dc2626 100%);
    border-radius: 50px;
    transition: width 8s linear;
    width: 100%;
}

/* ── CALCULUS DUEL ───────────────────────────────────────────── */
.calc-directive { font-size: 0.82rem; color: var(--muted); font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 4px; }
.calc-fn { font-family: 'Playfair Display', serif; font-size: clamp(1.3rem, 2.8vw, 1.9rem); color: var(--brown-dark); font-weight: 700; text-align: center; }
.calc-domain { font-family: 'DM Mono', monospace; font-size: 0.82rem; color: var(--muted); margin-top: 4px; }

/* ── MATRIX CIPHER ───────────────────────────────────────────── */
.matrix-arena { background: var(--bisque-light); border: 1px solid var(--bisque-dark); border-radius: var(--radius-md); padding: 20px; margin-bottom: 12px; text-align: center; min-height: 110px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; }
.matrix-prompt { color: var(--muted); font-size: 0.88rem; }
.matrix-display { display: flex; align-items: center; justify-content: center; gap: 20px; flex-wrap: wrap; }
.matrix-box { font-family: 'DM Mono', monospace; font-size: 0.97rem; color: var(--brown-dark); display: inline-block; text-align: center; border-left: 3px solid var(--brown-dark); border-right: 3px solid var(--brown-dark); padding: 7px 14px; line-height: 1.9; white-space: pre; }
.matrix-op-symbol { font-family: 'Playfair Display', serif; font-size: 1.7rem; color: var(--accent); font-weight: 700; }
.matrix-question { font-size: 0.92rem; color: var(--text); font-weight: 600; text-align: center; margin-bottom: 10px; }

/* ── SERIES VERDICT ──────────────────────────────────────────── */
.verdict-tests { margin-bottom: 10px; }
.shelf-label { font-size: 0.85rem; font-weight: 700; color: var(--muted); margin-bottom: 7px; }
.test-btns { display: flex; flex-wrap: wrap; gap: 7px; }
.stest-btn { padding: 6px 12px; background: var(--bisque-light); border: 1.5px solid var(--bisque-dark); border-radius: 20px; font-family: 'DM Sans', sans-serif; font-size: 0.8rem; font-weight: 600; color: var(--brown-dark); cursor: pointer; transition: all 0.18s; }
.stest-btn:hover { background: var(--bisque-dark); transform: translateY(-1px); }
.stest-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stest-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.selected-test-display { background: #fff8e6; border-left: 4px solid var(--amber); padding: 9px 12px; font-size: 0.85rem; color: var(--text); margin-bottom: 9px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-family: 'DM Mono', monospace; min-height: 30px; display: none; }
.selected-test-display.visible { display: block; }

/* ── COMPLEX ARENA ───────────────────────────────────────────── */
.complex-q { font-family: 'Playfair Display', serif; font-size: clamp(1.05rem, 2.3vw, 1.55rem); color: var(--brown-dark); font-weight: 700; text-align: center; padding: 6px; }
.argand-wrap { display: flex; justify-content: center; margin-bottom: 12px; }
#argandCanvas { border: 1px solid var(--bisque-dark); border-radius: var(--radius-md); background: #fff; max-width: 100%; }

/* ── EDUCATIONAL INTRO (inside collapsible) ──────────────────── */
.mind-edu-intro { background: #fff; border-bottom: 1px solid var(--bisque-dark); }
.mind-edu-inner { padding: clamp(1.2rem, 3vw, 2rem); }
.mind-edu-inner h2 { font-family: 'Playfair Display', Georgia, serif; font-size: clamp(1.25rem, 2.2vw, 1.7rem); color: var(--brown-dark); margin-bottom: .7rem; }
.mind-edu-inner > p { font-size: .92rem; color: var(--muted); line-height: 1.8; margin-bottom: .7rem; }
.mind-edu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 1.2rem; }
.mind-edu-card { background: var(--bisque-light); border: 1px solid var(--bisque-dark); border-radius: var(--radius-md); padding: 1.1rem; transition: transform .2s, box-shadow .2s; }
.mind-edu-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.mind-edu-icon { display: block; font-size: 1.5rem; margin-bottom: .5rem; }
.mind-edu-card h3 { font-family: 'Playfair Display', serif; font-size: .93rem; color: var(--brown-dark); margin-bottom: .35rem; font-weight: 700; }
.mind-edu-card p  { font-size: .82rem; color: var(--muted); line-height: 1.6; }

/* ── RONNYGAME BANNER ────────────────────────────────────────── */
.ronnygame-banner { background: linear-gradient(135deg, var(--brown-dark) 0%, #1a3d6e 100%); border-bottom: 1px solid var(--bisque-dark); }
.rg-banner-inner { display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; padding: clamp(1.2rem, 3vw, 2rem); align-items: center; }
.rg-eyebrow { font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--bisque-dark); margin-bottom: .5rem; }
.rg-banner-text h2 { font-family: 'Playfair Display', serif; font-size: clamp(1.1rem, 2.2vw, 1.5rem); color: var(--bisque-light); margin-bottom: .6rem; }
.rg-banner-text p  { font-size: .88rem; color: rgba(255,228,196,.55); line-height: 1.7; margin-bottom: .9rem; }
.rg-banner-text a  { color: var(--bisque-dark); font-weight: 600; }
.rg-subjects { display: flex; flex-direction: column; gap: 10px; margin-bottom: 1rem; }
.rg-subject { display: flex; gap: 10px; align-items: flex-start; background: rgba(255,228,196,.06); border: 1px solid rgba(255,228,196,.1); border-radius: var(--radius-md); padding: .8rem .9rem; }
.rg-subject-icon { font-size: 1.2rem; flex-shrink: 0; color: var(--bisque-dark); font-family: 'DM Mono', monospace; }
.rg-subject strong { display: block; font-size: .85rem; color: var(--bisque-light); font-weight: 700; margin-bottom: 2px; }
.rg-subject p      { font-size: .77rem; color: rgba(255,228,196,.45); margin: 0; line-height: 1.5; }
.rg-cta-btn { display: inline-flex; align-items: center; gap: 5px; background: var(--bisque); color: var(--brown-dark); font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: .88rem; padding: .7rem 1.6rem; border-radius: 50px; text-decoration: none; border: 2px solid var(--bisque-dark); transition: var(--transition); }
.rg-cta-btn:hover { background: var(--bisque-light); transform: translateY(-2px); }
.rg-banner-badge { flex-shrink: 0; }
.rg-badge-circle { width: 120px; height: 120px; background: rgba(255,228,196,.08); border: 2px solid rgba(255,228,196,.2); border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.rg-big-num   { font-family: 'Playfair Display', serif; font-size: 2.4rem; font-weight: 900; color: var(--bisque-dark); line-height: 1; }
.rg-big-label { font-size: .7rem; font-weight: 700; color: var(--bisque-light); letter-spacing: .05em; }
.rg-big-sub   { font-size: .62rem; color: rgba(255,228,196,.4); }

/* ── CURRICULUM OVERVIEW ─────────────────────────────────────── */
.mind-curriculum { padding: clamp(1.2rem, 3vw, 2rem); }
.mind-curriculum-inner h2 { font-family: 'Playfair Display', serif; font-size: clamp(1.25rem, 2.2vw, 1.7rem); color: var(--brown-dark); margin-bottom: 1rem; padding-bottom: .6rem; border-bottom: 2px solid var(--bisque-dark); }
.mind-level-cards { display: flex; flex-direction: column; gap: 1.2rem; }
.mind-level-card { background: var(--bisque-light); border: 1px solid var(--bisque-dark); border-radius: var(--radius-lg); overflow: hidden; }
.mlc-primary   { border-top: 4px solid #16a34a; }
.mlc-secondary { border-top: 4px solid #d97706; }
.mlc-uni       { border-top: 4px solid #dc2626; }
.mlc-header { display: flex; align-items: center; gap: 12px; padding: 1rem 1.2rem; background: #fff; border-bottom: 1px solid var(--bisque-dark); }
.mlc-emoji  { font-size: 1.4rem; flex-shrink: 0; }
.mlc-header h3 { font-family: 'Playfair Display', serif; font-size: 1rem; color: var(--brown-dark); margin: 0 0 2px; }
.mlc-tag { font-size: .68rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.mlc-body { padding: 1rem 1.2rem 1.2rem; }
.mlc-body > p { font-size: .88rem; color: var(--muted); line-height: 1.75; margin-bottom: .9rem; }
.mlc-games { display: flex; flex-direction: column; gap: .9rem; margin-bottom: .9rem; }
.mlc-game { background: #fff; border: 1px solid var(--bisque-dark); border-radius: var(--radius-md); padding: .85rem 1rem; }
.mlc-game strong { display: block; font-size: .87rem; font-weight: 700; color: var(--brown-dark); margin-bottom: .3rem; }
.mlc-game p { font-size: .8rem; color: var(--muted); line-height: 1.6; margin: 0; }
.mlc-formulas { background: var(--brown-dark); border-radius: var(--radius-md); padding: .8rem 1rem; display: flex; flex-wrap: wrap; gap: 5px 12px; align-items: center; }
.mlc-formulas strong { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,228,196,.4); width: 100%; margin-bottom: 2px; }
.mlc-formulas span { font-family: 'DM Mono', monospace; font-size: .75rem; color: var(--bisque); background: rgba(255,228,196,.07); border: 1px solid rgba(255,228,196,.12); border-radius: var(--radius-sm); padding: 2px 8px; }

/* ── HOW-TO SECTION ──────────────────────────────────────────── */
.mind-how-section { background: #fff; border: 1px solid var(--bisque-dark); border-radius: var(--radius-lg); margin: 2rem 0; box-shadow: var(--shadow-sm); }
.mind-how-inner { padding: clamp(1.2rem, 3vw, 2rem); }
.mind-how-inner h2 { font-family: 'Playfair Display', serif; font-size: clamp(1.2rem, 2.2vw, 1.6rem); color: var(--brown-dark); margin-bottom: .5rem; }
.mind-how-inner > p { font-size: .9rem; color: var(--muted); line-height: 1.75; margin-bottom: 1.2rem; }
.mind-how-steps { display: flex; flex-direction: column; gap: 0; }
.mind-how-step { display: flex; gap: 1rem; padding: 1.1rem 0; border-top: 1px solid var(--bisque-dark); align-items: flex-start; }
.mind-how-step:first-child { border-top: none; }
.mhs-num { width: 38px; height: 38px; flex-shrink: 0; background: var(--brown-dark); color: var(--bisque-dark); font-family: 'Playfair Display', serif; font-size: 1.05rem; font-weight: 900; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.mhs-body h3 { font-family: 'Playfair Display', serif; font-size: .97rem; color: var(--brown-dark); margin-bottom: .3rem; }
.mhs-body p  { font-size: .86rem; color: var(--muted); line-height: 1.75; margin: 0; }
.mhs-body a  { color: var(--accent); font-weight: 600; }

/* ── ABOUT SECTION ───────────────────────────────────────────── */
.mind-about-section { background: var(--bisque-light); border: 1px solid var(--bisque-dark); border-radius: var(--radius-lg); margin: 2rem 0; }
.mind-about-inner { padding: clamp(1.2rem, 3vw, 2rem); }
.mind-about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.2rem, 3vw, 2.5rem); }
.mind-about-grid h2 { font-family: 'Playfair Display', serif; font-size: clamp(1.2rem, 2.2vw, 1.6rem); color: var(--brown-dark); margin-bottom: .7rem; }
.mind-about-grid h3 { font-family: 'Playfair Display', serif; font-size: 1rem; color: var(--brown-dark); margin-bottom: .6rem; font-weight: 700; }
.mind-about-grid p  { font-size: .88rem; color: var(--muted); line-height: 1.8; margin-bottom: .75rem; }
.mind-about-grid a  { color: var(--accent); font-weight: 600; }

/* ── RESPONSIVE ──────────────────────────────────────────────── */

/* Tablet: sidebar collapses to horizontal scroll strip */
@media (max-width: 860px) {
    .mind-game-layout {
        grid-template-columns: 1fr;
    }
    .mind-game-sidebar {
        position: static;
        max-height: none;
        overflow-y: visible;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: stretch;
        border-radius: var(--radius-lg);
        padding: 0;
    }
    .mgn-header { display: none; }
    .mgn-footer { display: none; }
    .mgn-group {
        display: flex;
        flex-direction: column;
        padding: 8px;
        border-bottom: none;
        border-right: 1px solid var(--bisque-dark);
        flex-shrink: 0;
        min-width: 130px;
    }
    .mgn-group:last-of-type { border-right: none; }
    .mgn-level-label { font-size: .62rem; padding: 4px 2px 4px; }
    .mgn-link { font-size: .78rem; padding: 6px 6px; }
    .mgn-link-icon { font-size: .9rem; }
    .mgn-diff { display: none; }
}

/* Mobile */
@media (max-width: 640px) {
    .mind-page-wrap { padding: 0 1rem 4rem; }

    .hero-quick-jump { gap: 7px; }
    .hqj-btn { font-size: .75rem; padding: 5px 12px; }

    .mind-game-sidebar { min-width: 0; }
    .mgn-group { min-width: 110px; }

    .level-selector { grid-template-columns: 1fr; gap: 7px; }
    .lt-count { display: none; }

    .game-tabs { gap: 5px; padding: 8px; }
    .gtab { padding: 6px 10px; font-size: 0.77rem; }

    .game-panel { padding: 14px 12px; }

    .options-grid { grid-template-columns: repeat(2, 1fr); }
    .options-grid.four-col { grid-template-columns: repeat(2, 1fr); }

    .dual-btns { flex-direction: column; align-items: center; }
    .control-row { flex-direction: column; }
    input[type="text"],
    input[type="number"] { width: 100%; max-width: 100%; }

    .trig-arena { flex-direction: column; }
    .chain-display { gap: 8px; }
    .matrix-display { flex-direction: column; }
    .algebra-type-row, .calc-mode-row, .matrix-op-row, .complex-mode-row { gap: 5px; }
    .atype-btn { padding: 5px 10px; font-size: .78rem; }

    #graphCanvas { width: 100%; height: auto; }
    #argandCanvas { width: 240px; height: 240px; }

    .rg-banner-inner { grid-template-columns: 1fr; }
    .rg-banner-badge { display: none; }
    .mind-about-grid { grid-template-columns: 1fr; }
    .mind-edu-grid { grid-template-columns: 1fr 1fr; }
    .mind-how-step { gap: .7rem; }
}

@media (max-width: 400px) {
    .mind-edu-grid { grid-template-columns: 1fr; }
}

/* Desktop: 4-column option grid */
@media (min-width: 641px) {
    .options-grid.four-col { grid-template-columns: repeat(4, 1fr); }
}

/* Focus-visible ring for high-contrast / keyboard users */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}