/**
 * @file styles.css
 * @filepath css/styles.css
 * @version 3.34.5
 * @updated 2026-02-23 11:10:00 AM CDT
 * @author Greg Paskal
 * @company MissionWares®
 * 
 * @description Core styles for mAi™ Lexicon v3 — Mobile-first with personality
 * 
 * @changeLog:
 * Date        Author          Version  Description
 * ----------  --------------  -------  --------------------------
 * 2026-02-20  Greg / Claude   3.33.0   Removed 132 lines of dead Bug Blaster CSS
 *                                      (.bb-* rules, shared selectors, responsive overrides)
 * 2026-02-19  Greg / Claude   3.32.0   SEO: Add .sr-only utility class
 * 2026-02-15  Greg Paskal     3.30.0   🎪 Carnival Arcade CSS
 *                                      - Animated rainbow title
 *                                      - Marquee blinking lights
 *                                      - Carnival tiles with Lexi
 *                                      - Corner glow lights
 *                                      - Animated gradient borders
 *                                      - High score badges
 *                                      - Play button shimmer effect
 * 2026-02-14  Greg Paskal     3.29.13  Curriculum footer: align with content
 *                                      area on desktop (sidebar offset)
 * 2026-02-14  Greg Paskal     3.29.12  Curriculum selector: centered footer,
 *                                      prettier action bar with blur backdrop
 * 2026-02-14  Greg Paskal     3.29.11  Session Complete: large gradient score,
 *                                      marquee only pauses on click (not hover)
 * 2026-02-14  Greg Paskal     3.29.10  Desktop Study Lounge: large gradient score
 *                                      (48px) positioned in empty space
 * 2026-02-14  Greg Paskal     3.29.9   Marquee: larger mastery scores, 
 *                                      expanded widths, cursor pointer
 * 2026-02-14  Greg Paskal     3.29.8   Marquee: 20s speed, .paused class toggle,
 *                                      .sl-pulse-score-inline for legend area
 * 2026-02-14  Greg Paskal     3.29.7   Add horizontal .curriculum-marquee CSS
 *                                      for multi-curricula scroll display
 * 2026-02-14  Greg Paskal     3.29.6   Add .pulse-header-row with curriculum + score
 *                                      for session summary readiness pulse redesign
 * 2026-02-13  Greg Paskal     3.29.5   Add .fcs-curriculum badge for session summaries
 * 2026-02-13  Greg Paskal     3.29.4   Add .tm-curriculum badge to Term Match topbar
 * 2026-02-13  Greg Paskal     3.29.3   Add mobile mastery strip curriculum context
 *                                      Fix desktop pulse legend missing grey dot
 * 2026-02-08  Greg Paskal     3.13.0   Desktop-1: Pro Mode foundation
 *                                      - Sidebar layout at 1024px+
 *                                      - Collapsible with slide animation
 *                                      - Dashboard horizontal zone cards
 *                                      - Did You Know trivia section
 *                                      - Quick stats row
 *                                      - Zone cards hover (no arrow)
 * 2026-02-03  Greg Paskal     3.0.0    Initial creation
 * 2026-02-03  Greg Paskal     3.0.1    Added term detail view
 * 2026-02-03  Greg Paskal     3.0.2    Mobile-first rewrite
 * 2026-02-03  Greg Paskal     3.0.3    Fix speed-line stroke for iOS
 * 2026-02-03  Greg Paskal     3.0.4    Personality pass — glows,
 *                                      breathing animations, drop
 *                                      shadows, gradient borders,
 *                                      bigger logo, more spacing
 * 2026-02-03  Greg Paskal     3.0.5    Header: 72px tall, logo 50px,
 *                                      true vertical center, edition
 *                                      text "for ISTQB Studies" with
 *                                      separator. Readiness meta text
 *                                      more readable (12px, better
 *                                      contrast)
 * 2026-02-03  Greg Paskal     3.1.0    Phase 2: Study Lounge styles
 *                                      Flashcard 3D flip animation
 *                                      Grade buttons (Got It / Still
 *                                      Learning). Session summary.
 *                                      Mastery breakdown bars.
 *                                      Deck size selector pills.
 */

/* ═══ CSS Variables ═══════════════════════════════════════ */
:root {
    --bg-deep: #0a0e17;
    --bg-surface: #111827;
    --bg-content: rgb(26, 28, 36);  /* V2's lighter content/stage background */
    --bg-card: #151d2e;
    --bg-card-hover: #1c2740;
    --bg-elevated: #243049;
    
    --text-primary: #e8ecf4;
    --text-secondary: #8b95a8;
    --text-muted: #5a6478;
    
    --brand-cyan: #00ccff;
    --brand-purple: #a855f7;
    --brand-cyan-dim: rgba(0, 204, 255, 0.08);
    --brand-cyan-glow: rgba(0, 204, 255, 0.25);
    --brand-purple-glow: rgba(168, 85, 247, 0.25);
    --mai-gradient: linear-gradient(135deg, var(--brand-cyan), var(--brand-purple));
    --lexicon-gradient: linear-gradient(90deg, var(--brand-cyan), var(--brand-purple), rgba(255,255,255,0.9));
    
    --study-primary: #f59e0b;
    --study-glow: rgba(245, 158, 11, 0.15);
    --study-bg: rgba(245, 158, 11, 0.04);
    --study-border: rgba(245, 158, 11, 0.15);
    
    --arcade-primary: #a855f7;
    --arcade-glow: rgba(168, 85, 247, 0.15);
    --arcade-bg: rgba(168, 85, 247, 0.04);
    --arcade-border: rgba(168, 85, 247, 0.15);
    
    --qr-primary: #00ccff;
    --qr-glow: rgba(0, 204, 255, 0.15);
    --qr-bg: rgba(0, 204, 255, 0.04);
    --qr-border: rgba(0, 204, 255, 0.15);
    
    --mastery-notseen: #3a4458;
    --mastery-missed: #ef4444;
    --mastery-familiar: #f59e0b;
    --mastery-mastered: #22c55e;
    
    --header-height: 72px;
    --sidebar-width: 280px;
    --content-max: 720px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ═══ Reset ═══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* ═══ Accessibility ═══════════════════════════════════════ */
.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; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;  /* Fallback for older browsers */
    height: 100dvh; /* Dynamic viewport height for iOS Safari */
    max-width: 100vw;
}
a { color: var(--brand-cyan); text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input { font-family: inherit; }

/* ═══ Animations ══════════════════════════════════════════ */

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes lineColorPulse {
    0%, 100% { stroke: #a855f7; }
    50% { stroke: #00ccff; }
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

@keyframes barShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes breathe {
    0%, 100% { box-shadow: 0 0 12px rgba(0, 204, 255, 0.08); }
    50% { box-shadow: 0 0 20px rgba(0, 204, 255, 0.18); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ═══ App Shell ═══════════════════════════════════════════ */
.lexicon-app {
    display: grid;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-columns: 1fr;
    height: 100vh;  /* Fallback */
    height: 100dvh; /* Dynamic viewport for iOS Safari */
    overflow: hidden;
    max-width: 100vw;
}

/* Fixed footer layout - footer becomes part of grid flow */
.lexicon-app.has-fixed-footer {
    grid-template-rows: var(--header-height) 1fr auto;
}

.app-footer {
    display: none;
    background: rgb(15, 18, 22);  /* Match sidebar/header color */
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 10px 18px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 100;
}

.lexicon-app.has-fixed-footer .app-footer {
    display: block;
    grid-row: 3; /* Footer takes third row */
}

/* Footer content layout - gradient bubble buttons with banner */
.footer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--content-max);
    margin: 0 auto;
    gap: 12px;
}

.footer-bubble {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: linear-gradient(135deg, var(--brand-cyan), var(--brand-purple));
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 16px rgba(0, 204, 255, 0.25), 
                0 2px 8px rgba(168, 85, 247, 0.2);
    color: #fff;
}

.footer-bubble:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 24px rgba(0, 204, 255, 0.35), 
                0 4px 12px rgba(168, 85, 247, 0.3);
}

.footer-bubble:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 204, 255, 0.2), 
                0 1px 4px rgba(168, 85, 247, 0.15);
}

.footer-bubble svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
    stroke-width: 2;
}

.footer-banner {
    flex: 1;
    text-align: center;
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    line-height: 1.4;
    padding: 0 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Quick Reference Navigation Footer */
.qr-nav-footer {
    justify-content: center;
    gap: 16px;
}

.qr-nav-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    justify-content: center;
}

.qr-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qr-nav-btn:hover {
    background: rgba(0, 204, 255, 0.1);
    border-color: var(--brand-cyan);
    color: var(--brand-cyan);
}

.qr-nav-btn:active {
    transform: scale(0.95);
}

.qr-nav-counter {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 80px;
    text-align: center;
}

/* ═══ Share Panel ═══════════════════════════════════════════ */
.share-panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 998;
}

.share-panel-backdrop.visible {
    opacity: 1;
    visibility: visible;
}

.share-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.3);
}

.share-panel.visible {
    transform: translateY(0);
}

.share-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.share-panel-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.share-panel-icon {
    font-size: 28px;
}

.share-panel-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.share-panel-header p {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--text-muted);
}

.share-panel-close {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.share-panel-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.share-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.share-panel-footer {
    padding: 12px 20px;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.share-panel-footer a {
    color: var(--brand-cyan);
    text-decoration: none;
}

/* Share Panel Tabs */
.share-panel-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.share-panel-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.share-panel-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.share-panel-tab.active {
    color: var(--brand-cyan);
    border-bottom-color: var(--brand-cyan);
}

.share-tab-content {
    display: none;
}

.share-tab-content.active {
    display: block;
}

/* Feedback Form */
.feedback-type-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.feedback-type-btn {
    flex: 1;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.feedback-type-btn:hover {
    border-color: var(--brand-cyan);
    background: rgba(0, 204, 255, 0.05);
}

.feedback-type-btn.selected {
    border-color: var(--brand-cyan);
    background: rgba(0, 204, 255, 0.1);
}

.feedback-type-btn span:first-child {
    display: block;
    font-size: 22px;
    margin-bottom: 4px;
}

.feedback-type-btn span:last-child {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.feedback-form-group {
    margin-bottom: 14px;
}

.feedback-form-group label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.feedback-form-group input,
.feedback-form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 16px; /* 16px minimum prevents iOS Safari auto-zoom */
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

.feedback-form-group textarea {
    min-height: 100px;
}

.feedback-form-group input:focus,
.feedback-form-group textarea:focus {
    outline: none;
    border-color: var(--brand-cyan);
}

.feedback-form-group input::placeholder,
.feedback-form-group textarea::placeholder {
    color: var(--text-muted);
}

.feedback-submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--brand-cyan), var(--brand-purple));
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.feedback-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.4);
}

.feedback-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.feedback-success {
    text-align: center;
    padding: 30px 20px;
}

.feedback-success-icon {
    font-size: 56px;
    margin-bottom: 16px;
    animation: successBounce 0.6s ease-out;
}

@keyframes successBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.feedback-success h4 {
    font-size: 18px;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.feedback-success p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* Honeypot - hidden from humans */
.feedback-hp {
    position: absolute;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

/* Share panel content sections */
.share-section {
    margin-bottom: 20px;
}

.share-section-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.share-message-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
    white-space: pre-line;
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 14px;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.share-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.share-btn.primary {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--brand-cyan), var(--brand-purple));
    border: none;
    color: #fff;
    padding: 14px 20px;
    font-size: 15px;
}

.share-btn.primary:hover {
    box-shadow: 0 4px 16px rgba(0, 204, 255, 0.3);
}

.share-btn-icon {
    font-size: 18px;
}

.share-copy-row {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.share-copy-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-secondary);
    font-size: 12px;
}

.share-copy-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--brand-cyan);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.share-copy-btn:hover {
    background: rgba(0, 204, 255, 0.15);
}

@media (min-width: 600px) {
    .share-panel {
        left: 50%;
        right: auto;
        transform: translate(-50%, 100%);
        width: 420px;
        border-radius: 20px 20px 0 0;
    }
    .share-panel.visible {
        transform: translate(-50%, 0);
    }
}

@media (min-width: 768px) {
    .lexicon-app {
        grid-template-columns: var(--sidebar-width) 1fr;
    }
    .app-header { grid-column: 1 / -1; }
}

/* ═══ Section 1: Header ══════════════════════════════════ */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px 0 20px;
    background: rgb(15, 18, 22);  /* Match sidebar color */
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    height: var(--header-height);
    z-index: 100;
    position: relative;
    overflow: hidden;
}

.header-brand {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.header-home {
    display: flex;
    align-items: center;
    height: 100%;
    flex-shrink: 0;
    cursor: pointer;
    transition: filter 0.3s ease, transform 0.3s ease;
}

/* V2-style logo hover animation */
.header-home:hover {
    transform: translateX(2px);
}

.header-home:hover .lexicon-logo-svg {
    filter: drop-shadow(0 4px 12px rgba(0, 204, 255, 0.35));
}

.header-home:hover .logo-byline {
    fill: #00ccff;
}

.header-home.clickable-home {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s, filter 0.3s ease, transform 0.3s ease;
}

.header-home.clickable-home:hover {
    opacity: 1;
    filter: drop-shadow(0 2px 10px rgba(168, 85, 247, 0.35));
}

.lexicon-logo-svg {
    height: 50px;
    width: auto;
    filter: drop-shadow(0 2px 10px rgba(0, 204, 255, 0.18));
    transition: filter 0.3s ease;
}

/* Byline hover effect */
.logo-byline {
    transition: fill 0.3s ease;
}

.speed-line {
    stroke: #a855f7;
    animation: lineColorPulse 3s ease-in-out infinite;
}

/* Edition text — "for ISTQB Studies" */
.header-edition {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
    padding-left: 14px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    height: 32px;
}

.edition-for {
    font-size: 12px;
    font-style: italic;
    color: var(--text-muted);
    font-weight: 400;
}

.edition-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    line-height: 1.15;
    letter-spacing: 0.3px;
}

.header-context {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.header-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.header-back:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.header-zone-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ═══ Main Content ════════════════════════════════════════ */
.app-content {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.view-container {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 20px 18px 48px;
}

/* ═══ Dashboard ═══════════════════════════════════════════ */
.dashboard-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dashboard-view > * {
    animation: fadeSlideUp 0.4s var(--ease-out) backwards;
}

.dashboard-view > *:nth-child(1) { animation-delay: 0s; }
.dashboard-view > *:nth-child(2) { animation-delay: 0.06s; }
.dashboard-view > *:nth-child(3) { animation-delay: 0.12s; }
.dashboard-view > *:nth-child(4) { animation-delay: 0.18s; }
.dashboard-view > *:nth-child(5) { animation-delay: 0.24s; }

/* ─── Welcome Banner ─── */
.welcome-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(0, 204, 255, 0.06), rgba(168, 85, 247, 0.06));
    border: 1px solid rgba(0, 204, 255, 0.1);
    border-radius: var(--radius-sm);
}

.welcome-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.welcome-text strong {
    background: var(--lexicon-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.welcome-close {
    color: var(--text-muted);
    font-size: 16px;
    padding: 4px 8px;
}

/* ─── Section 2: Readiness Strip ─── */
.readiness-strip {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

/* Animated gradient border — shifts cyan↔purple instead of glowing */
.readiness-strip::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: var(--radius-md);
    padding: 1px;
    background: linear-gradient(
        var(--border-angle, 0deg),
        var(--brand-cyan),
        var(--brand-purple),
        var(--brand-cyan)
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.35;
    z-index: 0;
    animation: borderRotate 6s linear infinite;
}

@keyframes borderRotate {
    to { --border-angle: 360deg; }
}

/* Fallback for browsers that don't support @property */
@supports not (background: paint(something)) {
    .readiness-strip::before {
        background: linear-gradient(135deg, var(--brand-cyan), var(--brand-purple), var(--brand-cyan));
        opacity: 0.2;
        animation: glowPulse 4s ease-in-out infinite;
    }
}

.readiness-strip > * {
    position: relative;
    z-index: 1;
}

/* Left column — percentage hero */
.readiness-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 18px;
    background: linear-gradient(145deg, rgba(0, 204, 255, 0.03), rgba(168, 85, 247, 0.04));
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
    min-width: 82px;
}

.readiness-pct-wrap {
    display: flex;
    align-items: baseline;
}

.readiness-pct {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 36px;
    font-weight: 700;
    background: var(--lexicon-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.readiness-word {
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 600;
}

/* Center column — bar + mastery pips */
.readiness-center {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 14px 16px;
    gap: 6px;
}

.readiness-bar-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.readiness-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-cyan), var(--brand-purple));
    background-size: 200% 100%;
    border-radius: 3px;
    transition: width 0.8s var(--ease-out);
    min-width: 0;
    position: relative;
}

/* Shimmer effect on the bar when it has progress */
.readiness-bar-fill:not([style*="width:0%"])::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.25) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: barShimmer 2s linear infinite;
}

.readiness-mastery-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.mastery-pip {
    display: flex;
    align-items: center;
    gap: 3px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 12px;
    font-weight: 600;
}

.mastery-pip i {
    font-style: normal;
    font-size: 8px;
    line-height: 1;
}

.mastery-pip.mastered { color: var(--mastery-mastered); }
.mastery-pip.mastered i { filter: drop-shadow(0 0 3px rgba(34, 197, 94, 0.5)); }
.mastery-pip.familiar { color: var(--mastery-familiar); }
.mastery-pip.familiar i { filter: drop-shadow(0 0 3px rgba(245, 158, 11, 0.5)); }
.mastery-pip.missed { color: var(--mastery-missed); }
.mastery-pip.missed i { filter: drop-shadow(0 0 3px rgba(239, 68, 68, 0.5)); }
.mastery-pip.unseen { color: var(--text-muted); }

.readiness-focus {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    opacity: 0.8;
}

/* Right column — curriculum tag + credits */
.readiness-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 14px 14px 14px 0;
    flex-shrink: 0;
    min-width: 100px;
}

.readiness-curriculum {
    flex-shrink: 0;
    cursor: pointer;
}

.curriculum-tag {
    display: inline-block;
    padding: 5px 12px;
    background: linear-gradient(135deg, rgba(0, 204, 255, 0.08), rgba(168, 85, 247, 0.08));
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    color: var(--brand-purple);
    letter-spacing: 0.5px;
    transition: all 0.3s;
}

.readiness-curriculum:hover .curriculum-tag {
    border-color: var(--brand-cyan);
    color: var(--brand-cyan);
    box-shadow: 0 0 12px rgba(0, 204, 255, 0.15);
}

/* ─── Section 3: Chapter Progress (collapsible) ─── */
.chapter-section {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

.chapter-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 18px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: all 0.2s;
}

.chapter-toggle:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}

.chapter-toggle-icon {
    font-size: 14px;
    transition: transform 0.3s var(--ease-out);
}

.chapter-drawer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s var(--ease-out), padding 0.35s var(--ease-out);
    padding: 0 18px;
}

.chapter-drawer.open {
    max-height: 500px;
    padding: 0 18px 16px;
}

.ch-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.ch-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: var(--brand-cyan);
    min-width: 32px;
    flex-shrink: 0;
}

.ch-name {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ch-bar-track {
    width: 64px;
    height: 5px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.ch-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-cyan), var(--mastery-mastered));
    border-radius: 3px;
    transition: width 0.6s var(--ease-out);
}

.ch-pct {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 30px;
    text-align: right;
    flex-shrink: 0;
}

/* ─── Section 4: Zone Navigation ─── */
.zone-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.zone-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.zone-card:active {
    transform: scale(0.97);
}

/* Zone personalities */
.zone-study {
    background: linear-gradient(135deg, var(--study-bg), rgba(245, 158, 11, 0.02));
    border-color: var(--study-border);
}
.zone-arcade {
    background: linear-gradient(135deg, var(--arcade-bg), rgba(168, 85, 247, 0.02));
    border-color: var(--arcade-border);
}
.zone-ref {
    background: linear-gradient(135deg, var(--qr-bg), rgba(0, 204, 255, 0.02));
    border-color: var(--qr-border);
}

.zone-study:hover  { border-color: var(--study-primary); box-shadow: 0 4px 20px var(--study-glow); transform: translateY(-1px); }
.zone-arcade:hover { border-color: var(--arcade-primary); box-shadow: 0 4px 20px var(--arcade-glow); transform: translateY(-1px); }
.zone-ref:hover    { border-color: var(--qr-primary); box-shadow: 0 4px 20px var(--qr-glow); transform: translateY(-1px); }

.zone-icon {
    font-size: 28px;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.zone-text {
    flex: 1;
    min-width: 0;
}

.zone-title {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.2px;
}

.zone-sub {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.zone-go {
    font-size: 22px;
    font-weight: 300;
    flex-shrink: 0;
    transition: transform 0.3s var(--ease-out), color 0.3s;
}

.zone-study .zone-go  { color: rgba(245, 158, 11, 0.3); }
.zone-arcade .zone-go { color: rgba(168, 85, 247, 0.3); }
.zone-ref .zone-go    { color: rgba(0, 204, 255, 0.3); }

.zone-card:hover .zone-go {
    transform: translateX(4px);
}
.zone-study:hover .zone-go  { color: var(--study-primary); }
.zone-arcade:hover .zone-go { color: var(--arcade-primary); }
.zone-ref:hover .zone-go    { color: var(--qr-primary); }

/* ─── Quick Stats ─── */
.quick-stats {
    display: flex;
    gap: 10px;
}

.qs-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 4px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.qs-item:hover {
    border-color: rgba(255, 255, 255, 0.08);
}

.qs-val {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
    background: var(--lexicon-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.qs-lbl {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 5px;
}

/* ═══ Zone Views ══════════════════════════════════════════ */
.zone-view {
    animation: fadeSlideUp 0.4s var(--ease-out);
}

.zone-header {
    text-align: center;
    padding: 28px 0 24px;
}

.zone-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
}

.zone-header p {
    font-size: 13px;
    color: var(--text-muted);
}

.study-lounge-header h2 { color: var(--study-primary); }
.arcade-header h2 { color: var(--arcade-primary); }
.quick-ref-header h2 { color: var(--qr-primary); }
.quick-ref-header {
    padding: 12px 0 6px;
}
.quick-ref-header p {
    margin-bottom: 10px;
}

.zone-stats {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
}

.zone-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    min-width: 80px;
}

.zone-stat-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.zone-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.zone-activities {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.activity-card {
    padding: 22px 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
}

.activity-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.activity-icon { font-size: 36px; margin-bottom: 10px; }
.activity-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.activity-card p { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }

.coming-badge {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    font-size: 10px;
    color: var(--text-muted);
}

/* ═══ CARNIVAL ARCADE 🎪🎡 ═════════════════════════════════════════════════ */

.carnival-arcade {
    position: relative;
    overflow: hidden;
}

/* Rainbow light strip at top */
.carnival-arcade::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3, #54a0ff, #5f27cd, #00d2d3, #ff6b6b);
    background-size: 200% 100%;
    animation: carnival-sweep 3s linear infinite;
}

@keyframes carnival-sweep {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

/* Marquee blinking lights */
.arcade-marquee {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-top: 8px;
}

.marquee-light {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: blink-bulb 0.5s ease-in-out infinite alternate;
}

.marquee-light:nth-child(1) { background: #ff6b6b; animation-delay: 0s; }
.marquee-light:nth-child(2) { background: #feca57; animation-delay: 0.05s; }
.marquee-light:nth-child(3) { background: #48dbfb; animation-delay: 0.1s; }
.marquee-light:nth-child(4) { background: #ff9ff3; animation-delay: 0.15s; }
.marquee-light:nth-child(5) { background: #54a0ff; animation-delay: 0.2s; }
.marquee-light:nth-child(6) { background: #5f27cd; animation-delay: 0.25s; }
.marquee-light:nth-child(7) { background: #00d2d3; animation-delay: 0.3s; }
.marquee-light:nth-child(8) { background: #ff6b6b; animation-delay: 0.35s; }
.marquee-light:nth-child(9) { background: #feca57; animation-delay: 0.4s; }
.marquee-light:nth-child(10) { background: #48dbfb; animation-delay: 0.45s; }

@keyframes blink-bulb {
    0% { opacity: 0.3; transform: scale(0.8); box-shadow: none; }
    100% { opacity: 1; transform: scale(1.1); box-shadow: 0 0 8px currentColor; }
}

/* Arcade title rainbow */
.arcade-header .arcade-title {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3, #54a0ff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbow-shift 4s ease infinite;
}

@keyframes rainbow-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Games grid */
.arcade-games-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 16px;
}

@media (min-width: 600px) {
    .arcade-games-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .arcade-games-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Individual carnival tile */
.carnival-tile {
    position: relative;
    background: linear-gradient(145deg, #1e1e3f, #2a2a5a, #1a1a4a);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    min-height: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Animated gradient border */
.carnival-tile::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: linear-gradient(45deg, var(--tile-c1), var(--tile-c2), var(--tile-c1));
    background-size: 200% 200%;
    border-radius: 18px;
    z-index: -1;
    animation: border-pulse 3s ease infinite;
    opacity: 0.5;
}

.carnival-tile:hover::before {
    opacity: 1;
    animation-duration: 1.5s;
}

@keyframes border-pulse {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.carnival-tile:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0,0,0,0.3), 0 0 20px var(--tile-c1, rgba(0,204,255,0.3));
}

/* Corner lights */
.tile-corner {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tile-c1);
    animation: corner-glow 1s ease-in-out infinite alternate;
}

.tile-corner.tl { top: 8px; left: 8px; }
.tile-corner.tr { top: 8px; right: 8px; animation-delay: 0.25s; }
.tile-corner.bl { bottom: 8px; left: 8px; animation-delay: 0.5s; }
.tile-corner.br { bottom: 8px; right: 8px; animation-delay: 0.75s; }

@keyframes corner-glow {
    0% { opacity: 0.4; box-shadow: none; }
    100% { opacity: 1; box-shadow: 0 0 6px var(--tile-c1); }
}

/* Badge */
.tile-badge {
    position: absolute;
    top: 8px;
    right: 14px;
    padding: 3px 10px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    border-radius: 6px;
    animation: badge-bob 1s ease-in-out infinite;
}

.tile-badge.hot { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.tile-badge.popular { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.tile-badge.new { background: linear-gradient(135deg, #22c55e, #16a34a); color: white; }

@keyframes badge-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

/* Lexi in tile */
.tile-lexi {
    margin-bottom: 12px;
    animation: lexi-float 2s ease-in-out infinite;
}

.carnival-tile:hover .tile-lexi {
    animation: lexi-bounce 0.4s ease-in-out infinite;
}

@keyframes lexi-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes lexi-bounce {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-8px) rotate(2deg); }
}

/* Tile content */
.carnival-tile .tile-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.carnival-tile .tile-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    margin: 0 0 6px 0;
}

.carnival-tile .tile-desc {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
    margin: 0 0 12px 0;
}

.tile-score {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1a2e;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 12px;
    animation: score-glow 2s ease infinite;
}

@keyframes score-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(251, 191, 36, 0.5); }
    50% { box-shadow: 0 0 12px rgba(251, 191, 36, 0.8); }
}

/* Play button — desktop only */
.tile-play-btn {
    margin-top: auto;
    padding: 10px 24px;
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--tile-c1), var(--tile-c2));
    border: none;
    border-radius: 24px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tile-play-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.carnival-tile:hover .tile-play-btn::before {
    left: 100%;
}

.tile-play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px var(--tile-c1);
}

/* Tile go chevron — visible on mobile horizontal layout */
.tile-go {
    display: none;
    font-size: 1.8rem;
    font-weight: 300;
    color: rgba(255,255,255,0.4);
    align-self: center;
    flex-shrink: 0;
    margin-left: auto;
    padding-left: 8px;
    transition: color 0.2s ease;
}

/* ─── Mobile Compact Arcade Layout ─────────────────────────── */
@media (max-width: 599px) {
    /* Compact the header */
    .arcade-header .arcade-title {
        font-size: 1.3rem;
    }
    .arcade-header p {
        font-size: 0.8rem;
        margin: 0;
    }
    .arcade-marquee {
        margin-bottom: 8px;
    }
    .arcade-games-grid {
        gap: 10px;
        margin-top: 8px;
    }

    /* Switch tiles to horizontal */
    .carnival-tile {
        flex-direction: row;
        align-items: center;
        text-align: left;
        min-height: auto;
        padding: 14px 16px;
        gap: 14px;
    }

    /* Lexi compact */
    .tile-lexi {
        margin-bottom: 0;
        flex-shrink: 0;
        animation: none;
    }
    .tile-lexi svg {
        width: 50px;
        height: 60px;
    }

    /* Content flows right */
    .carnival-tile .tile-content {
        align-items: flex-start;
        min-width: 0;
    }
    .carnival-tile .tile-title {
        font-size: 1.05rem;
        margin: 0 0 2px 0;
    }
    .carnival-tile .tile-desc {
        font-size: 0.78rem;
        margin: 0;
    }

    /* Score inline */
    .tile-score {
        margin-top: 6px;
        margin-bottom: 0;
        font-size: 0.7rem;
        padding: 2px 8px;
    }

    /* Show chevron, hide play button */
    .tile-go {
        display: flex;
    }
    .tile-play-btn {
        display: none;
    }

    /* Badge inside tile for horizontal layout */
    .tile-badge {
        top: 8px;
        right: 10px;
        font-size: 8px;
        padding: 2px 8px;
        border-radius: 6px;
    }

    /* Corner lights smaller */
    .tile-corner {
        width: 4px;
        height: 4px;
    }
}

/* ═══ END CARNIVAL ARCADE ══════════════════════════════════════════════════ */

.curriculum-current {
    text-align: center;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
}

.curriculum-current p {
    font-size: 15px;
    margin-bottom: 10px;
}

/* ═══ Quick Reference View ════════════════════════════════ */
.mobile-search { margin-bottom: 10px; }

.mobile-search input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    transition: all 0.3s;
}

.mobile-search input:focus {
    border-color: var(--brand-cyan);
    box-shadow: 0 0 16px rgba(0, 204, 255, 0.1);
}

.mobile-search input::placeholder { color: var(--text-muted); }

.mobile-alpha {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 16px;
    justify-content: center;
}

@media (min-width: 768px) {
    .mobile-search, .mobile-alpha { display: none; }
}

.alpha-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}

.alpha-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.alpha-btn.active {
    background: rgba(0, 204, 255, 0.08);
    border-color: var(--brand-cyan);
    color: var(--brand-cyan);
    box-shadow: 0 0 8px rgba(0, 204, 255, 0.12);
}

.qr-term-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.qr-term-item {
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.qr-term-item:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.qr-term-item h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.qr-term-item p { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.qr-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ─── Quick Reference: Mastery Filter — Option A (dots inside search bar) ─── */
.qr-search-bar {
    display: flex;
    align-items: center;
    margin: 0 0 10px;
    background: var(--bg-card);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    transition: border-color 0.3s, box-shadow 0.3s;
    overflow: hidden;
}
.qr-search-bar input {
    flex: 1;
    padding: 12px 14px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px; /* must be ≥16px to prevent iOS Safari auto-zoom on focus */
    outline: none;
    min-width: 0;
}
.qr-search-bar input::placeholder { color: var(--text-muted); }
.qr-search-bar input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.qr-clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    margin-right: 6px;
    transition: background 0.2s, color 0.2s;
}
.qr-clear-btn:hover, .qr-clear-btn:active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}
.qr-search-bar:focus-within {
    border-color: var(--brand-cyan);
    box-shadow: 0 0 16px rgba(0, 204, 255, 0.1);
}
.qr-bar-filters {
    display: flex;
    align-items: center;
    gap: 2px;
    padding-right: 8px;
    flex-shrink: 0;
}
.qr-bf {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px 7px;
    background: transparent;
    border: 1.5px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}
.qr-bf:hover:not(.empty) {
    background: rgba(255, 255, 255, 0.06);
}
.qr-bf-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.qr-bf-count {
    font-size: 11px;
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-muted);
    transition: color 0.2s;
}
.qr-bf.mastered .qr-bf-dot { background: var(--mastery-mastered); }
.qr-bf.familiar .qr-bf-dot { background: var(--mastery-familiar); }
.qr-bf.learning .qr-bf-dot { background: var(--mastery-missed); }
.qr-bf.mastered.active { border-color: var(--mastery-mastered); background: rgba(34, 197, 94, 0.1); }
.qr-bf.mastered.active .qr-bf-count { color: var(--mastery-mastered); }
.qr-bf.familiar.active { border-color: var(--mastery-familiar); background: rgba(245, 158, 11, 0.1); }
.qr-bf.familiar.active .qr-bf-count { color: var(--mastery-familiar); }
.qr-bf.learning.active { border-color: var(--mastery-missed); background: rgba(239, 68, 68, 0.1); }
.qr-bf.learning.active .qr-bf-count { color: var(--mastery-missed); }
.qr-bf.empty { opacity: 0.3; cursor: default; pointer-events: none; }

/* Search bar border tint when filter active */
.qr-search-bar.filter-green { border-color: rgba(34, 197, 94, 0.4); box-shadow: 0 0 12px rgba(34, 197, 94, 0.08); }
.qr-search-bar.filter-orange { border-color: rgba(245, 158, 11, 0.4); box-shadow: 0 0 12px rgba(245, 158, 11, 0.08); }
.qr-search-bar.filter-red { border-color: rgba(239, 68, 68, 0.4); box-shadow: 0 0 12px rgba(239, 68, 68, 0.08); }
.qr-search-bar.filter-multi { border-color: rgba(168, 85, 247, 0.4); box-shadow: 0 0 12px rgba(168, 85, 247, 0.08); }

/* ─── Quick Reference: Mastery Filter — Option B (unified strip) ────────── */
.qr-unified-strip {
    display: flex;
    align-items: center;
    margin: 0 0 10px;
    background: var(--bg-card);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    transition: border-color 0.3s, box-shadow 0.3s;
    overflow: hidden;
}
.qr-unified-strip:focus-within {
    border-color: var(--brand-cyan);
    box-shadow: 0 0 16px rgba(0, 204, 255, 0.1);
}
.qr-us-search { flex: 1; min-width: 0; }
.qr-us-search input {
    width: 100%;
    padding: 12px 14px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
}
.qr-us-search input::placeholder { color: var(--text-muted); }
.qr-us-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}
.qr-us-filters {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 10px;
    flex-shrink: 0;
}
.qr-uf {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    background: transparent;
    border: 1.5px solid transparent;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}
.qr-uf:hover:not(.empty) { background: rgba(255, 255, 255, 0.06); }
.qr-uf-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.qr-uf.mastered .qr-uf-dot { background: var(--mastery-mastered); }
.qr-uf.familiar .qr-uf-dot { background: var(--mastery-familiar); }
.qr-uf.learning .qr-uf-dot { background: var(--mastery-missed); }
.qr-uf.mastered.active { border-color: var(--mastery-mastered); background: rgba(34, 197, 94, 0.1); color: var(--mastery-mastered); }
.qr-uf.familiar.active { border-color: var(--mastery-familiar); background: rgba(245, 158, 11, 0.1); color: var(--mastery-familiar); }
.qr-uf.learning.active { border-color: var(--mastery-missed); background: rgba(239, 68, 68, 0.1); color: var(--mastery-missed); }
.qr-uf.empty { opacity: 0.3; cursor: default; pointer-events: none; }
.qr-unified-strip.filter-green { border-color: rgba(34, 197, 94, 0.4); box-shadow: 0 0 12px rgba(34, 197, 94, 0.08); }
.qr-unified-strip.filter-orange { border-color: rgba(245, 158, 11, 0.4); box-shadow: 0 0 12px rgba(245, 158, 11, 0.08); }
.qr-unified-strip.filter-red { border-color: rgba(239, 68, 68, 0.4); box-shadow: 0 0 12px rgba(239, 68, 68, 0.08); }
.qr-unified-strip.filter-multi { border-color: rgba(168, 85, 247, 0.4); box-shadow: 0 0 12px rgba(168, 85, 247, 0.08); }

/* Recent lookups chips */
.qr-recents {
    margin-bottom: 16px;
}

.qr-recents-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.qr-recents-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.qr-recent-chip {
    padding: 5px 12px;
    background: var(--bg-card);
    border: 1px solid rgba(0, 204, 255, 0.1);
    border-radius: 16px;
    font-size: 12px;
    color: var(--qr-primary);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.qr-recent-chip:hover {
    background: rgba(0, 204, 255, 0.08);
    border-color: rgba(0, 204, 255, 0.2);
}

/* ═══ Term Detail View ════════════════════════════════════ */
.term-detail-view { 
    animation: fadeSlideUp 0.4s var(--ease-out);
}

.detail-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
    transition: all 0.2s;
}

.detail-back:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.detail-header { margin-bottom: 20px; }

.detail-term-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 10px;
    background: var(--lexicon-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; }

.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-klevel { background: rgba(0, 204, 255, 0.1); color: var(--brand-cyan); border: 1px solid rgba(0, 204, 255, 0.2); }
.badge-abbr { background: rgba(168, 85, 247, 0.1); color: #a855f7; border: 1px solid rgba(168, 85, 247, 0.2); }
.badge-chapter { background: rgba(107, 114, 128, 0.15); color: var(--text-muted); border: 1px solid rgba(107, 114, 128, 0.25); font-size: 10px; }

.badge-mastery { border: 1px solid; }
.badge-mastery.not-seen { background: rgba(58, 68, 88, 0.3); color: #8b95a8; border-color: rgba(58, 68, 88, 0.5); }
.badge-mastery.learning { background: rgba(239, 68, 68, 0.1); color: #ef4444; border-color: rgba(239, 68, 68, 0.2); }
.badge-mastery.familiar { background: rgba(245, 158, 11, 0.1); color: #f59e0b; border-color: rgba(245, 158, 11, 0.2); }
.badge-mastery.mastered { background: rgba(34, 197, 94, 0.1); color: #22c55e; border-color: rgba(34, 197, 94, 0.2); }

.detail-definition {
    padding: 24px;
    background: rgb(15, 18, 22);  /* V2's darker card background */
    border: 1px solid rgb(51, 51, 51);  /* V2's visible border */
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.detail-definition p { font-size: 17px; line-height: 1.8; }

.detail-meta { margin-bottom: 18px; }

.detail-chapter {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 7px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.detail-section { margin-bottom: 18px; }

.detail-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.rel-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.rel-chip {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.rel-chip:hover {
    border-color: var(--brand-cyan);
    color: var(--brand-cyan);
    box-shadow: 0 0 10px rgba(0, 204, 255, 0.1);
}

.tribal-section {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.04), rgba(168, 85, 247, 0.04));
    border: 1px solid rgba(245, 158, 11, 0.1);
    border-radius: var(--radius-md);
    padding: 16px;
}

.tribal-fact, .tribal-note, .tribal-aliases {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.tribal-fact:last-child, .tribal-note:last-child, .tribal-aliases:last-child { margin-bottom: 0; }
.tribal-aliases { font-size: 12px; color: var(--text-muted); font-style: italic; }

/* Layman Definitions (Plain English) */
.layman-section {
    background: linear-gradient(135deg, rgba(0, 204, 255, 0.04), rgba(56, 189, 248, 0.04));
    border: 1px solid rgba(0, 204, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 16px;
}

.layman-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.layman-item {
    position: relative;
    padding-left: 20px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.layman-item:last-child { margin-bottom: 0; }

.layman-item::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--brand-cyan);
    opacity: 0.7;
}

/* ═══ Loading & Error ═════════════════════════════════════ */
.loading-view, .error-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    gap: 14px;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--bg-elevated);
    border-top-color: var(--brand-cyan);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    filter: drop-shadow(0 0 8px rgba(0, 204, 255, 0.2));
}

.error-icon { font-size: 40px; }

.error-view button {
    padding: 10px 24px;
    background: var(--mai-gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 600;
    font-size: 14px;
    transition: opacity 0.2s;
}

.error-view button:hover { opacity: 0.9; }

/* ═══ Desktop Sidebar ═════════════════════════════════════ */
.desktop-sidebar {
    display: none;
    background: var(--bg-surface);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    overflow-y: auto;
    padding: 0; /* Desktop Pro Mode controls all padding */
}

/* Note: .desktop-sidebar styles are fully defined in Desktop Pro Mode (768px+) */

.sidebar-search input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: all 0.3s;
}

.sidebar-search input:focus {
    border-color: var(--brand-cyan);
    box-shadow: 0 0 12px rgba(0, 204, 255, 0.1);
}

.sidebar-search input::placeholder { color: var(--text-muted); }

.sidebar-alpha {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.sidebar-terms {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    overflow-y: auto;
}

.sidebar-term {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.sidebar-term:hover {
    background: var(--bg-card);
}

.term-mastery-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.term-mastery-dot.not-seen { background: var(--mastery-notseen); }
.term-mastery-dot.learning { background: var(--mastery-missed); box-shadow: 0 0 4px rgba(239, 68, 68, 0.4); }
.term-mastery-dot.familiar { background: var(--mastery-familiar); box-shadow: 0 0 4px rgba(245, 158, 11, 0.4); }
.term-mastery-dot.mastered { background: var(--mastery-mastered); box-shadow: 0 0 4px rgba(34, 197, 94, 0.4); }

.term-name {
    font-size: 13px;
    color: var(--text-secondary);
}

.sidebar-term:hover .term-name { color: var(--text-primary); }

/* ═══ Desktop Enhancements ════════════════════════════════ */
@media (min-width: 768px) {
    .view-container {
        padding: 28px 28px 48px;
    }

    .readiness-left {
        padding: 20px 24px;
        min-width: 100px;
    }

    .readiness-pct {
        font-size: 42px;
    }

    .readiness-center {
        padding: 18px 20px;
    }

    .zone-nav {
        flex-direction: row;
        gap: 14px;
    }

    .zone-card {
        flex: 1;
        flex-direction: column;
        text-align: center;
        padding: 24px 18px;
        gap: 12px;
    }

    .zone-go { display: none; }
    .zone-icon { font-size: 32px; }
    .ch-bar-track { width: 100px; }

    /* Desktop summary sizing */
    .fcs-stats { max-width: 500px; margin-left: auto; margin-right: auto; }
    .fcs-actions { max-width: 400px; margin-left: auto; margin-right: auto; }
}

/* ═══ Study Lounge Enhancements ═══════════════════════════ */

/* Deck config row */
.sl-deck-config {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 0 16px;
}

.sl-config-label {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ─── Study Setup: Range Slider ─────────────────────── */
.sl-slider-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sl-slider-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--study-primary);
    text-align: center;
    font-family: 'Space Grotesk', sans-serif;
    line-height: 1;
    margin-bottom: 2px;
}
.sl-range-input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}
.sl-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--study-primary);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
    cursor: grab;
    transition: box-shadow 0.2s;
}
.sl-range-input::-webkit-slider-thumb:hover {
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.7), 0 2px 8px rgba(0, 0, 0, 0.4);
}
.sl-range-input::-webkit-slider-thumb:active {
    cursor: grabbing;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.8), 0 2px 10px rgba(0, 0, 0, 0.5);
}
.sl-range-input::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: var(--study-primary);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
    cursor: grab;
}
.sl-slider-ticks {
    display: flex;
    justify-content: space-between;
    /* Offset by half the thumb width (22px/2 = 11px) to align ticks with thumb center */
    padding: 0 11px;
}
.sl-tick {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 9px;
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.2s;
    min-width: 0;
}
.sl-tick-mark {
    display: block;
    width: 1px;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 1px;
    transition: background 0.2s;
}
.sl-tick.active {
    color: var(--study-primary);
    font-weight: 700;
}
.sl-tick.active .sl-tick-mark {
    background: var(--study-primary);
    width: 2px;
    height: 8px;
}

/* ─── Study Setup: Segmented Controls ──────────────── */
.sl-segment-group {
    display: flex;
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}
.sl-segment {
    flex: 1;
    padding: 7px 6px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s var(--ease-out);
    white-space: nowrap;
    text-align: center;
}
.sl-segment:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}
.sl-segment.active {
    background: rgba(245, 158, 11, 0.15);
    color: var(--study-primary);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
/* Mastery focus colored active states */
.sl-segment.mastery-needs-work.active {
    background: rgba(245, 158, 11, 0.15);
    color: var(--mastery-familiar);
}
.sl-segment.mastery-missed.active {
    background: rgba(239, 68, 68, 0.15);
    color: var(--mastery-missed);
}
.sl-segment[disabled] {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* ─── Study Lounge: Mastery Strip ─────────────────────── */
.sl-mastery-strip {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    margin-bottom: 4px;
}
/* Mobile curriculum context row */
.sl-strip-context {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.sl-strip-mode {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}
.sl-strip-readiness {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-primary);
    margin-left: auto;
    white-space: nowrap;
}
.sl-strip-dots {
    display: flex;
    align-items: center;
    gap: 12px;
}
.sl-strip-dot {
    font-size: 13px;
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
    display: flex;
    align-items: center;
    gap: 3px;
}
.sl-strip-dot.green { color: var(--mastery-mastered); }
.sl-strip-dot.orange { color: var(--mastery-familiar); }
.sl-strip-dot.red { color: var(--mastery-missed); }
.sl-strip-dot.gray { color: var(--text-muted); }
.sl-dot-pip { font-size: 10px; }
.sl-strip-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sl-strip-accuracy {
    font-size: 12px;
    color: var(--text-muted);
}
.sl-strip-streak {
    font-size: 12px;
    color: var(--mastery-familiar);
}

/* ─── Study Lounge: Stacked Progress Bar ─────────────── */
.sl-progress-bar {
    display: flex;
    height: 4px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 16px 20px;
}
.sl-prog-fill {
    height: 100%;
    transition: width 0.6s var(--ease-out);
}
.sl-prog-fill.green { background: var(--mastery-mastered); }
.sl-prog-fill.orange { background: var(--mastery-familiar); }
.sl-prog-fill.red { background: var(--mastery-missed); }

/* ─── Study Lounge: Desktop Grid (Mobile-first) ───────── */
.sl-desktop-grid {
    display: block; /* Single column on mobile */
}
.sl-column-left {
    /* Default: full width on mobile */
}
.sl-column-right {
    display: none; /* Hidden on mobile - shown via media query */
}

/* ─── Study Lounge: Session Tuner Card ───────────────── */
.sl-tuner-card {
    margin: 0 16px 20px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
}
.sl-tuner-header {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.sl-tuner-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.sl-tuner-row:last-child { margin-bottom: 0; }
.sl-tuner-label {
    font-size: 12px;
    color: var(--text-muted);
    width: 68px;
    flex-shrink: 0;
    text-align: right;
}

/* ─── Study Lounge: Begin Study Session Button ──────── */
.sl-start-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 32px);
    margin: 0 16px;
    padding: 16px 24px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
    background: linear-gradient(135deg, var(--study-primary) 0%, #e67e00 50%, var(--accent) 100%);
    background-size: 200% 200%;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.25), 0 0 40px rgba(245, 158, 11, 0.08);
    transition: transform 0.2s var(--ease-out), box-shadow 0.3s var(--ease-out), background-position 0.4s;
    animation: sl-btn-shimmer 3s ease infinite;
}
@keyframes sl-btn-shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
.sl-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(245, 158, 11, 0.4), 0 0 50px rgba(245, 158, 11, 0.12);
}
.sl-start-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.2);
}
.sl-start-icon {
    font-size: 14px;
    filter: brightness(1.2);
}

/* Activity card "Start" button look */
.activity-go-btn {
    display: inline-block;
    padding: 5px 16px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--study-primary);
    letter-spacing: 0.3px;
}

/* Mastery breakdown in study menu */
.sl-mastery-breakdown {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
}

.sl-mastery-breakdown h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sl-mastery-bars { display: flex; flex-direction: column; gap: 10px; }

.sl-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sl-bar-label {
    font-size: 11px;
    font-weight: 500;
    width: 65px;
    text-align: right;
    flex-shrink: 0;
}
.sl-bar-label.mastered { color: var(--mastery-mastered); }
.sl-bar-label.familiar { color: var(--mastery-familiar); }
.sl-bar-label.missed { color: var(--mastery-missed); }
.sl-bar-label.unseen { color: var(--text-muted); }

.sl-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
    overflow: hidden;
}

.sl-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s var(--ease-out);
}
.sl-bar-fill.mastered { background: var(--mastery-mastered); }
.sl-bar-fill.familiar { background: var(--mastery-familiar); }
.sl-bar-fill.missed { background: var(--mastery-missed); }
.sl-bar-fill.unseen { background: var(--mastery-notseen); }

.sl-bar-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    width: 30px;
    text-align: right;
    font-family: 'Space Grotesk', sans-serif;
}


/* ═══ Session Summary (shared by Term Match) ════════════ */
.fcs-header { margin-bottom: 28px; }

.fcs-emoji {
    font-size: 52px;
    display: block;
    margin-bottom: 12px;
}

.fcs-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.fcs-message {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Stats grid */
.fcs-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.fcs-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 8px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
}

.fcs-stat-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.fcs-accuracy .fcs-stat-value {
    background: linear-gradient(135deg, var(--study-primary), #22c55e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 26px;
}

.fcs-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Extras (streak, time) */
.fcs-extras {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-bottom: 24px;
}

.fcs-streak, .fcs-time {
    font-size: 13px;
    color: var(--text-secondary);
}

.fcs-streak { color: var(--study-primary); font-weight: 600; }

/* ═══ Readiness Pulse - Signature Metric Control ══════════════════════════ */
.readiness-pulse {
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

/* Pulse header row: curriculum badge + score */
.pulse-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pulse-curriculum {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-primary);
    background: rgba(37, 99, 235, 0.15);
    padding: 4px 10px;
    border-radius: 4px;
}

.pulse-score {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.pulse-mastery-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    position: relative;
}

.pulse-mastery-row .mastery-pip {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pulse-mastery-row .mastery-pip i {
    font-style: normal;
}

/* Large gradient score for Session Complete (desktop) */
.pulse-score-large-inline {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    margin-left: auto;
}

.pulse-score-large-inline .score-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, var(--study-primary, #f59e0b), #22c55e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.pulse-score-large-inline .score-value .trend-up,
.pulse-score-large-inline .score-value .trend-down {
    -webkit-text-fill-color: initial;
    background: none;
}

.pulse-score-large-inline .score-value .trend-up {
    color: var(--mastery-mastered);
}

.pulse-score-large-inline .score-value .trend-down {
    color: var(--mastery-missed);
}

.pulse-score-large-inline .score-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (min-width: 768px) {
    .pulse-score-large-inline .score-value {
        font-size: 42px;
    }
    
    .pulse-score-large-inline .score-label {
        font-size: 13px;
    }
}

.pulse-accuracy {
    margin-left: auto;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.pulse-streak {
    font-size: 14px;
    padding: 4px 10px;
    background: rgba(245, 158, 11, 0.15);
    border-radius: 12px;
    color: var(--study-primary);
    font-weight: 600;
}

.pulse-delta {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 13px;
    color: var(--text-secondary);
}

/* Expand hint */
.pulse-expand-hint {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    padding-left: 12px;
}

.pulse-chart-icon {
    font-size: 16px;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
}

.pulse-chevron {
    font-size: 18px;
    color: var(--text-muted);
    opacity: 0.5;
    transition: transform 0.3s var(--ease-out), opacity 0.2s;
    font-weight: 300;
}

.readiness-pulse:hover .pulse-chart-icon {
    opacity: 1;
    transform: scale(1.1);
}

.readiness-pulse:hover .pulse-chevron {
    opacity: 0.8;
}

.readiness-pulse.expanded .pulse-chevron {
    transform: rotate(90deg);
    opacity: 0.8;
}

.readiness-pulse {
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.readiness-pulse:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

.readiness-pulse.expanded {
    background: rgba(255, 255, 255, 0.02);
}

.readiness-pulse.expanded .pulse-chart-icon {
    opacity: 1;
}

/* Expandable Detail Panel */
.pulse-detail-panel {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s var(--ease-out), opacity 0.3s, margin-top 0.3s;
    margin-top: 0;
}

.readiness-pulse.expanded .pulse-detail-panel {
    max-height: 400px;
    opacity: 1;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ═══ Stacked Mastery Bars Graph ═══ */
.pulse-graph {
    margin-bottom: 16px;
}

.pulse-graph-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.pulse-graph-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pulse-graph-best {
    font-size: 12px;
    color: var(--study-primary);
    font-weight: 600;
}

.pulse-graph-container {
    position: relative;
}

/* Stacked Mastery Bars */
.pulse-stacked-bars {
    display: flex;
    gap: 8px;
    height: 100px;
    align-items: flex-end;
}

.stacked-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.stacked-bar {
    width: 100%;
    max-width: 36px;
    height: 100%;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column-reverse; /* Stack from bottom up */
    background: rgba(255, 255, 255, 0.03);
    transition: transform 0.2s;
    cursor: pointer;
}

.stacked-bar-wrap:hover .stacked-bar {
    transform: scaleY(1.02);
}

.stacked-bar-wrap.latest .stacked-bar {
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.stack-segment {
    width: 100%;
    transition: height 0.5s var(--ease-out), filter 0.2s, transform 0.2s;
    cursor: pointer;
    position: relative;
}

/* Segment hover effect */
.stack-segment:hover {
    filter: brightness(1.2);
    transform: scaleX(1.1);
    z-index: 10;
}

/* 3-Color Session Breakdown */
.stack-segment.reinforced {
    background: linear-gradient(0deg, var(--mastery-mastered), rgba(34, 197, 94, 0.8));
}

.stack-segment.progress {
    background: linear-gradient(0deg, var(--mastery-familiar), rgba(245, 158, 11, 0.8));
}

.stack-segment.missed {
    background: linear-gradient(0deg, var(--mastery-missed), rgba(239, 68, 68, 0.8));
}

/* Legacy/fallback colors */
.stack-segment.correct {
    background: linear-gradient(0deg, var(--mastery-mastered), rgba(34, 197, 94, 0.8));
}

.stack-segment.wrong {
    background: linear-gradient(0deg, var(--mastery-missed), rgba(239, 68, 68, 0.8));
}

.stack-segment.mastered {
    background: linear-gradient(0deg, var(--mastery-mastered), rgba(34, 197, 94, 0.8));
}

.stack-segment.familiar {
    background: linear-gradient(0deg, var(--mastery-familiar), rgba(245, 158, 11, 0.8));
}

.stack-segment.learning {
    background: linear-gradient(0deg, var(--mastery-missed), rgba(239, 68, 68, 0.8));
}

.stack-segment.unseen {
    background: rgba(255, 255, 255, 0.08);
}

.stacked-bar-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 6px;
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
}

.stacked-bar-wrap.latest .stacked-bar-label {
    color: var(--study-primary);
    font-weight: 700;
}

.stacked-bar-day {
    font-size: 9px;
    color: var(--text-muted);
    opacity: 0.7;
    margin-top: 2px;
}

.stacked-bar-wrap.latest .stacked-bar-day {
    color: var(--study-primary);
    opacity: 1;
}

.stacked-bar-type {
    font-size: 10px;
    margin-top: 2px;
    opacity: 0.6;
}

/* Timeline indicator */
.pulse-timeline-indicator {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    padding: 0 4px;
}

.pulse-timeline-indicator span {
    font-size: 9px;
    color: var(--text-muted);
    opacity: 0.5;
    letter-spacing: 0.3px;
}

/* Oldest bar subtle indicator */
.stacked-bar-wrap.oldest .stacked-bar {
    opacity: 0.7;
}

.stacked-bar-wrap.oldest .stacked-bar-day {
    font-style: italic;
}

/* Mastery Legend */
.mastery-legend {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: var(--text-muted);
}

.legend-item i {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}

.legend-item i.reinforced,
.legend-item i.correct,
.legend-item i.mastered {
    background: var(--mastery-mastered);
}

.legend-item i.progress,
.legend-item i.familiar {
    background: var(--mastery-familiar);
}

.legend-item i.missed,
.legend-item i.wrong,
.legend-item i.learning {
    background: var(--mastery-missed);
}

.legend-item i.unseen {
    background: rgba(255, 255, 255, 0.15);
}

.legend-info {
    font-size: 14px;
    color: var(--text-muted);
    opacity: 0.6;
    cursor: help;
    margin-left: 12px;
    transition: opacity 0.2s, transform 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}

.legend-info:hover {
    opacity: 1;
    color: var(--brand-cyan);
    background: rgba(0, 204, 255, 0.1);
    transform: scale(1.1);
}

/* Better tooltip styling via title attribute - browsers style these natively */
/* For proper multi-line tooltips, the \n in the title gets rendered as newlines */

/* Mobile: Hide graph and info icon - keep summary clean */
@media (max-width: 600px) {
    .pulse-graph {
        display: none;
    }
    
    .legend-info {
        display: none;
    }
}

/* Stats Grid */
.pulse-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.pulse-stats-grid.enhanced {
    grid-template-columns: repeat(3, 1fr);
}

.pulse-stat {
    text-align: center;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    transition: background 0.2s, transform 0.2s;
}

.pulse-stat:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-1px);
}

.pulse-stat.highlight {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.pulse-stat.highlight .pulse-stat-value {
    color: var(--mastery-mastered);
}

.pulse-stat-value {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.pulse-stat-label {
    display: block;
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Mobile adjustments for stats grid */
@media (max-width: 480px) {
    .pulse-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pulse-stats-grid.enhanced {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pulse-graph-bars {
        height: 80px;
    }
    
    .pulse-bar-day,
    .pulse-bar-type {
        display: none;
    }
}

/* Trend Arrows & Comparisons */
.trend-arrow {
    font-size: 0.8em;
    margin-left: 4px;
    font-weight: 700;
}

.trend-up {
    color: var(--mastery-mastered);
}

.trend-down {
    color: var(--mastery-learning);
}

.trend-steady {
    color: var(--text-muted);
}

.fcs-stat-diff {
    display: block;
    font-size: 11px;
    font-weight: 500;
    margin-top: 4px;
}

.fcs-stat-diff.trend-up {
    color: var(--mastery-mastered);
}

.fcs-stat-diff.trend-down {
    color: var(--mastery-learning);
}

.fcs-stat-diff.trend-steady {
    color: var(--text-muted);
}

/* Coaching Hints */
.coaching-hint {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
}

.coaching-encouragement {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: var(--mastery-mastered);
}

.coaching-tip {
    background: rgba(0, 204, 255, 0.08);
    border: 1px solid rgba(0, 204, 255, 0.2);
    color: var(--brand-cyan);
}

.coaching-warning {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: var(--study-primary);
}

.coaching-celebration {
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.2);
    color: var(--brand-purple);
}

/* Action buttons */
.fcs-actions {
    display: flex;
    gap: 12px;
}

.fcs-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

.fcs-btn:active { transform: scale(0.97); }

.fcs-btn-primary {
    background: linear-gradient(135deg, var(--study-primary), #d97706);
    color: #000;
}

.fcs-btn-primary:hover {
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
}

.fcs-btn-secondary {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.fcs-btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* ═══ Scrollbar ═══════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.06); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.12); }

/* ═══ Safe Area (notched phones) ══════════════════════════ */
@supports (padding: env(safe-area-inset-bottom)) {
    .view-container {
        padding-bottom: calc(48px + env(safe-area-inset-bottom));
    }
}

/* ═══ v3.2.0 Additions ═══════════════════════════════════ */

/* ─── Home Button ──────────────────────────────────────── */
.header-home-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.25s ease;
    z-index: 10;
    flex-shrink: 0;
}
.header-home-btn:hover {
    background: rgba(0, 204, 255, 0.08);
    border-color: rgba(0, 204, 255, 0.25);
    transform: scale(1.05);
}
.header-home-btn:active { transform: scale(0.95); }
.smoke-wisp {
    animation: smokeFloat 3s ease-in-out infinite;
}
@keyframes smokeFloat {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50% { opacity: 0.6; transform: translateY(-2px); }
}

/* ─── Header Zone Name (centered) ──────────────────────── */
.header-zone-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* ─── Term Match ───────────────────────────────────────── */
.term-match-view {
    min-height: calc(100dvh - var(--header-height));
    display: flex;
    flex-direction: column;
    padding: 0;
}
.tm-progress-bar {
    margin: 8px 16px 0;
    height: 6px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    overflow: hidden;
}
.tm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #22c55e);
    transition: width 0.4s ease;
    border-radius: 3px;
}
.tm-topbar {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    font-size: 13px;
    gap: 12px;
    color: var(--text-muted);
}
.tm-counter { font-weight: 600; }
.tm-curriculum {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-primary);
    background: rgba(37, 99, 235, 0.15);
    padding: 3px 8px;
    border-radius: 4px;
}
.tm-score { margin-left: auto; }
.tm-incorrect { color: #ef4444; }
.tm-streak { color: var(--accent-amber); font-weight: 600; }
.tm-exit {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
    transition: all 0.2s;
}
.tm-exit:hover { background: var(--bg-card); color: var(--text-primary); }

.tm-question {
    padding: 8px 20px 6px;
}
.tm-def-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    font-weight: 600;
}
.tm-definition {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-primary);
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--study-primary);
}

.tm-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 6px 20px 14px;
}
.tm-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
    color: var(--text-primary);
    font-size: 15px;
}
.tm-option:hover:not(:disabled) {
    border-color: rgba(0, 204, 255, 0.3);
    background: rgba(0, 204, 255, 0.04);
}
.tm-option:active:not(:disabled) { transform: scale(0.98); }
.tm-option .opt-letter {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}
.tm-option .opt-term { flex: 1; }

.tm-option.correct {
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(34, 197, 94, 0.1);
}
.tm-option.correct .opt-letter { background: rgba(34, 197, 94, 0.3); color: #22c55e; }
.tm-option.incorrect {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.08);
}
.tm-option.incorrect .opt-letter { background: rgba(239, 68, 68, 0.3); color: #ef4444; }
.tm-option.dimmed { opacity: 0.4; }

.tm-feedback {
    display: none;
}

.tm-next-row {
    padding: 4px 16px 20px;
    display: flex;
    justify-content: center;
}
.tm-next-btn {
    width: 100%;
    padding: 15px 24px;
    color: #fff;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    letter-spacing: 0.2px;
}
.tm-next-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.tm-next-btn.result-correct {
    background: linear-gradient(135deg, #22c55e, #15803d);
    box-shadow: 0 2px 12px rgba(34, 197, 94, 0.3);
}
.tm-next-btn.result-incorrect {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    box-shadow: 0 2px 12px rgba(239, 68, 68, 0.3);
}

/* ─── Term Rush Arcade Game ────────────────────────────── */
.tr-screen { display: flex; flex-direction: column; align-items: center; padding: 20px; min-height: calc(100dvh - var(--header-height)); }
.tr-start, .tr-results { justify-content: center; text-align: center; }
.tr-title { margin-bottom: 24px; }
.tr-title .tr-icon { font-size: 48px; display: block; margin-bottom: 8px; }
.tr-title h2 { font-size: 28px; color: var(--text-primary); margin-bottom: 8px; }
.tr-title p { color: var(--text-secondary); font-size: 15px; }
.tr-rules { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.tr-rule { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-secondary); }
.tr-highscore { color: var(--accent-amber); font-weight: 600; margin-bottom: 16px; }

/* Term Rush Game */
.tr-game { padding: 0; width: 100%; }
.tr-hud {
    display: flex;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.tr-hud-item { text-align: center; }
.tr-hud-item .hud-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; display: block; }
.tr-hud-item .hud-value { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.tr-timer-val.urgent { color: #ef4444; animation: timerPulse 0.5s ease-in-out infinite; }
@keyframes timerPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.tr-definition {
    padding: 16px 20px;
    margin: 12px 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    border-left: 3px solid #a855f7;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
}
.tr-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 16px 16px;
}
.tr-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    min-height: 48px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    color: var(--text-primary);
    font-size: 15px;
    width: 100%;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.tr-option:hover:not(:disabled) { border-color: rgba(168, 85, 247, 0.3); background: rgba(168, 85, 247, 0.04); }
.tr-option:active:not(:disabled) { transform: scale(0.97); }
.tr-option .opt-letter {
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: rgba(255, 255, 255, 0.05); font-size: 13px; font-weight: 700; color: var(--text-muted); flex-shrink: 0;
}
.tr-option .opt-term { flex: 1; }
.tr-option.tr-correct { border-color: rgba(34, 197, 94, 0.5); background: rgba(34, 197, 94, 0.1); }
.tr-option.tr-correct .opt-letter { background: rgba(34, 197, 94, 0.3); color: #22c55e; }
.tr-option.tr-incorrect { border-color: rgba(239, 68, 68, 0.5); background: rgba(239, 68, 68, 0.08); }
.tr-option.tr-incorrect .opt-letter { background: rgba(239, 68, 68, 0.3); color: #ef4444; }

/* ─── QR Search Highlight ──────────────────────────────── */
mark {
    background: rgba(251, 191, 36, 0.25);
    color: var(--text-primary);
    padding: 1px 3px;
    border-radius: 2px;
}
.qr-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

/* ═══ v3.3.0 Additions ═══════════════════════════════════ */

/* ─── Home Button Polish ──────────────────────────────── */
/* Add "Home" label text + persistent glow for discoverability */
.header-home-btn {
    gap: 5px;
    width: auto;
    padding: 0 12px;
    border-color: rgba(0, 204, 255, 0.15);
    background: rgba(0, 204, 255, 0.04);
}
.header-home-btn::after {
    content: 'Home';
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    transition: color 0.2s;
}
.header-home-btn:hover::after { color: var(--accent); }
.home-icon-svg {
    filter: drop-shadow(0 1px 6px rgba(0, 204, 255, 0.3));
}

/* ─── Primary Study Card (Term Match promotion) ───────── */
.zone-activities-primary {
    display: block;
    margin-bottom: 12px;
}
.zone-activities-primary .primary-card {
    padding: 28px 20px;
    border: 1px solid rgba(0, 204, 255, 0.15);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(0, 204, 255, 0.04) 100%);
    position: relative;
    overflow: hidden;
}
.zone-activities-primary .primary-card::before {
    content: 'RECOMMENDED';
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--accent);
    opacity: 0.6;
}
.zone-activities-primary .primary-card .activity-icon { font-size: 42px; }
.zone-activities-primary .primary-card h3 { font-size: 18px; margin-bottom: 6px; }
.zone-activities-primary .primary-card p { font-size: 13px; max-width: 420px; margin-left: auto; margin-right: auto; }
.zone-activities-primary .primary-card .activity-go-btn {
    display: inline-block;
    margin-top: 6px;
    padding: 8px 22px;
    background: linear-gradient(135deg, var(--accent), var(--accent-purple));
    color: #fff;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}
.zone-activities-primary .primary-card:hover .activity-go-btn {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 204, 255, 0.25);
}

/* ─── Chapter Filter Pills ────────────────────────────── */
.sl-config-section { margin-bottom: 16px; }
.chapter-pill {
    font-size: 11px !important;
    padding: 4px 10px !important;
}

/* ─── Related Term Chips Polish ───────────────────────── */
.rel-chip {
    transition: all 0.2s ease;
    cursor: pointer;
}
.rel-chip:hover {
    border-color: var(--accent) !important;
    background: rgba(0, 204, 255, 0.12) !important;
    transform: translateY(-1px);
}

/* ─── Mobile Safe-Area (notched phones) ───────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
    .app-content { padding-bottom: env(safe-area-inset-bottom); }
    .app-header { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
}

/* ─── Mobile Home Button (smaller on small screens) ───── */
@media (max-width: 480px) {
    .header-home-btn { padding: 0 8px; height: 34px; }
    .header-home-btn::after { font-size: 10px; }
    .home-icon-svg { width: 22px; height: 22px; }
    .header-edition { margin-left: 6px; padding-left: 8px; gap: 4px; }
    .edition-name { font-size: 12px; }
    .edition-for { font-size: 10px; }
    .lexicon-logo-svg { height: 40px; }
    .zone-activities-primary .primary-card::before { font-size: 8px; }
    /* Arcade mobile adjustments */
    .tr-definition { padding: 10px 14px; }
    .tr-option { padding: 12px 14px; font-size: 14px; }
}

/* ─── Desktop adjustments ──────────────────────────────── */
@media (min-width: 768px) {
    .tm-definition { font-size: 17px; }
    .tm-options { max-width: 600px; margin: 0 auto; padding-left: 0; padding-right: 0; }
    .tm-question { max-width: 600px; margin: 0 auto; }
    .tm-next-row { max-width: 600px; margin: 0 auto; }
    .tm-curriculum { font-size: 12px; padding: 4px 10px; }
    .tr-definition { max-width: 600px; margin-left: auto; margin-right: auto; }
    .tr-options { max-width: 600px; margin-left: auto; margin-right: auto; }
    .zone-activities-primary .primary-card { padding: 32px 28px; }
    .zone-activities-primary .primary-card h3 { font-size: 20px; }
    .zone-activities-primary .primary-card p { font-size: 14px; }
}
/* ═══ Curriculum Selector ══════════════════════════════════ */
.curriculum-selector {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-base);
}

.curriculum-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--brand-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.curriculum-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 20px 20px;
    background: linear-gradient(135deg, rgba(0, 204, 255, 0.08), rgba(168, 85, 247, 0.08));
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.curriculum-header-icon {
    font-size: 40px;
}

.curriculum-header-text h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.curriculum-header-text p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.curriculum-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 100px;
}

.curriculum-level {
    margin-bottom: 24px;
}

.level-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    margin-bottom: 10px;
}

.level-icon {
    font-size: 20px;
}

.level-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.level-count {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
}

.curriculum-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.curriculum-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    background: var(--bg-card);
    border: 2px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.curriculum-card:active {
    transform: scale(0.98);
}

.curriculum-card.selected {
    background: rgba(var(--card-color-rgb, 76, 175, 80), 0.12);
    border-color: var(--card-color, #4CAF50);
}

.card-select {
    flex-shrink: 0;
}

.card-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.curriculum-card.selected .card-checkbox {
    background: var(--card-color, #4CAF50);
    border-color: var(--card-color, #4CAF50);
}

.card-checkbox svg {
    width: 16px;
    height: 16px;
    stroke: #fff;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s;
}

.curriculum-card.selected .card-checkbox svg {
    opacity: 1;
    transform: scale(1);
}

.card-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.card-info {
    flex: 1;
    min-width: 0;
}

.card-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 4px;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.card-code {
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.card-prereq {
    color: var(--brand-cyan);
    font-size: 12px;
}

/* Mini Mastery Indicator on Curriculum Cards */
.card-mastery {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.mini-mastery-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    max-width: 80px;
}

.mini-mastery-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--mastery-green), var(--mastery-green));
    border-radius: 2px;
    transition: width 0.3s ease;
}

.mini-mastery-pct {
    font-size: 10px;
    color: var(--text-muted);
    min-width: 28px;
}

/* Specialist subcategories */
.specialist-category {
    margin-left: 12px;
    margin-bottom: 16px;
    padding-left: 12px;
    border-left: 2px solid rgba(255, 255, 255, 0.06);
}

.category-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    margin-bottom: 8px;
}

.category-icon {
    font-size: 16px;
}

.category-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Footer */
.curriculum-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 20px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 50;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.curriculum-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.summary-counts {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 10px;
    background: linear-gradient(135deg, var(--brand-cyan), var(--brand-purple));
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 204, 255, 0.3);
}

.count-separator {
    margin: 0 4px;
    opacity: 0.3;
}

.count-terms {
    font-weight: 600;
    color: var(--text-primary);
}

.count-dedup {
    font-size: 11px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.35);
    font-style: italic;
}

.prereq-toggle {
    margin-top: 0;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
}

.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand-cyan);
    cursor: pointer;
}

.curriculum-actions {
    display: flex;
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.action-btn.secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--brand-cyan), var(--brand-purple));
    color: #fff;
    flex: 1.5;
    box-shadow: 0 4px 15px rgba(0, 204, 255, 0.25);
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 204, 255, 0.4);
}

.action-btn.primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.action-btn.primary svg {
    stroke: #fff;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .curriculum-header {
        padding: 20px 16px 16px;
    }
    .curriculum-header-icon {
        font-size: 32px;
    }
    .curriculum-header-text h1 {
        font-size: 18px;
    }
    .curriculum-body {
        padding: 12px 12px 100px;
    }
    .curriculum-card {
        padding: 12px 10px;
        gap: 10px;
    }
    .card-icon {
        font-size: 24px;
    }
    .card-name {
        font-size: 13px;
    }
}

/* Desktop adjustments */
@media (min-width: 600px) {
    .curriculum-body {
        max-width: 600px;
        margin: 0 auto;
    }
    .curriculum-footer {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 16px 16px 0 0;
    }
    .curriculum-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .curriculum-card {
        flex-direction: column;
        text-align: center;
        padding: 16px 12px;
    }
    .card-select {
        position: absolute;
        top: 8px;
        right: 8px;
    }
    .curriculum-card {
        position: relative;
    }
    .card-info {
        text-align: center;
    }
    .card-meta {
        justify-content: center;
    }
}

/* Desktop with sidebar - footer aligns with content area */
@media (min-width: 1024px) {
    .curriculum-footer {
        /* Sidebar is 300px, so offset the center calculation */
        left: calc(50% + 150px);
        transform: translateX(-50%);
    }
}

/* ═══ Share Panel Enhancements ════════════════════════════ */
.share-primary-btn {
    width: 100%;
    margin-bottom: 14px;
    padding: 16px 24px !important;
    font-size: 16px !important;
}

.share-buttons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

/* Mobile: hide secondary buttons, emphasize primary */
@media (max-width: 480px) {
    .share-buttons-grid {
        display: none;
    }
    .share-primary-btn {
        margin-bottom: 16px;
    }
}

/* ═══ Curriculum Credits (Vertical Movie Credits Style) ════ */
.curriculum-credits {
    margin-top: 8px;
    height: 52px;
    overflow: hidden;
    position: relative;
    mask-image: linear-gradient(to bottom, transparent, black 15%, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 15%, black 85%, transparent);
}

.credits-track {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: credits-scroll 10s linear infinite;
}

.credit-line {
    padding: 6px 0;
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    text-align: center;
    opacity: 0.85;
    line-height: 1;
}

.credit-separator {
    padding: 6px 0;
    font-size: 12px;
    opacity: 0.5;
    line-height: 1;
}

@keyframes credits-scroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

/* Pause on hover/touch for accessibility */
.curriculum-credits:hover .credits-track,
.curriculum-credits:active .credits-track {
    animation-play-state: paused;
}

/* ═══ Curriculum Marquee (Horizontal Scroll) ═══════════════ */
.curriculum-marquee {
    overflow: hidden;
    position: relative;
    flex: 1;
    min-width: 0;
    height: 20px;
    cursor: pointer;
    mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
}

.marquee-track {
    display: flex;
    align-items: center;
    gap: 16px;
    width: max-content;
    animation: marquee-scroll 20s linear infinite;
}

.marquee-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.marquee-separator {
    padding: 0 8px;
    font-size: 12px;
    opacity: 0.6;
}

@keyframes marquee-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Pause only on click/tap toggle - not on hover */
.curriculum-marquee.paused .marquee-track {
    animation-play-state: paused;
}

/* Marquee in different contexts - expanded widths */
.tm-topbar .curriculum-marquee {
    height: 18px;
    max-width: none;
    flex: 1;
}

.pulse-header-row .curriculum-marquee {
    max-width: none;
    flex: 1;
}

.sl-strip-context .curriculum-marquee {
    max-width: none;
    flex: 1;
}

@media (min-width: 768px) {
    .tm-topbar .curriculum-marquee {
        max-width: none;
    }
    
    .pulse-header-row .curriculum-marquee {
        max-width: none;
    }
    
    .curriculum-selector-row .curriculum-marquee {
        max-width: 300px;
    }
}

/* Footer without gear - center the banner more */
.footer-toolbar {
    justify-content: center;
}

.footer-toolbar .footer-banner {
    flex: 1;
    max-width: 500px;
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DESKTOP PRO MODE — 1024px+
   All styles below are additive and do not affect mobile layout.
   ═══════════════════════════════════════════════════════════════════════════ */

@media (min-width: 768px) {
    
    /* ═══════════════════════════════════════════════════════════════════════════
       DESKTOP PRO MODE — 768px+
       Overrides earlier rules and provides full desktop experience
       ═══════════════════════════════════════════════════════════════════════════ */
    
    /* ─── App Shell: Sidebar + Stage Layout ─────────────────────────────── */
    .lexicon-app {
        grid-template-columns: var(--sidebar-width-desktop, 300px) 1fr;
        grid-template-rows: var(--header-height) 1fr;
    }
    
    /* When footer is visible, add third row */
    .lexicon-app.has-fixed-footer {
        grid-template-rows: var(--header-height) 1fr auto;
    }
    
    .lexicon-app.sidebar-collapsed {
        grid-template-columns: 44px 1fr;
    }
    
    .app-header {
        grid-column: 1 / -1;
    }
    
    /* Desktop header delight - subtle animated gradient accent */
    .app-header::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 1px;
        background: linear-gradient(90deg, 
            transparent 0%, 
            rgba(0, 204, 255, 0.3) 20%, 
            rgba(168, 85, 247, 0.4) 50%, 
            rgba(0, 204, 255, 0.3) 80%, 
            transparent 100%);
        animation: headerGlow 8s ease-in-out infinite;
    }
    
    @keyframes headerGlow {
        0%, 100% { opacity: 0.5; transform: translateX(-10%); }
        50% { opacity: 1; transform: translateX(10%); }
    }
    
    /* Desktop header - more room for branding */
    .header-edition {
        margin-left: 20px;
        padding-left: 20px;
    }
    
    /* Hide back button on desktop - use header home button instead */
    .detail-back {
        display: none;
    }
    
    /* Footer in stage area only (column 2) */
    .app-footer {
        grid-column: 2;
        grid-row: 3;
    }
    
    /* ─── Desktop Footer ─────────────────────────────────────────────────── */
    .desktop-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    
    .footer-links {
        display: flex;
        align-items: center;
        gap: 4px;
        font-size: 13px;
    }
    
    .footer-links a {
        color: var(--brand-cyan);
        text-decoration: none;
        transition: color 0.2s ease;
    }
    
    .footer-links a:hover {
        color: var(--brand-purple);
        text-decoration: underline;
    }
    
    .footer-branding {
        font-size: 13px;
        color: var(--text-muted);
    }
    
    .footer-branding .mai-mark {
        background: linear-gradient(90deg, var(--brand-cyan), var(--brand-purple));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        font-weight: 600;
    }
    
    .footer-branding .missionwares-link {
        color: var(--brand-cyan);
        text-decoration: none;
        transition: color 0.2s ease;
    }
    
    .footer-branding .missionwares-link:hover {
        color: var(--brand-purple);
        text-decoration: underline;
    }
    
    .footer-right {
        display: flex;
        align-items: center;
        gap: 16px;
    }
    
    .footer-right .missionwares-link {
        color: var(--brand-cyan);
        text-decoration: none;
        font-size: 12px;
        transition: color 0.2s ease;
    }
    
    .footer-right .missionwares-link:hover {
        color: var(--brand-purple);
    }
    
    /* Desktop nav controls styling */
    .desktop-footer .qr-nav-controls {
        display: flex;
        align-items: center;
        gap: 16px;
    }
    
    .desktop-footer .qr-nav-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 18px;
        background: linear-gradient(135deg, rgba(30, 40, 60, 0.8), rgba(20, 30, 50, 0.8));
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        color: var(--text-secondary);
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
        white-space: nowrap;
        height: auto;
        width: auto;
    }
    
    .desktop-footer .qr-nav-btn:hover {
        background: linear-gradient(135deg, rgba(0, 204, 255, 0.15), rgba(168, 85, 247, 0.1));
        border-color: var(--brand-cyan);
        color: #fff;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 204, 255, 0.2);
    }
    
    .desktop-footer .qr-nav-btn:active {
        transform: translateY(0) scale(0.98);
    }
    
    .desktop-footer .qr-nav-counter {
        font-size: 14px;
        font-weight: 600;
        color: var(--text-primary);
        padding: 0 8px;
        font-family: 'Space Grotesk', sans-serif;
    }
    
    .desktop-footer .qr-nav-btn .nav-arrow {
        font-size: 16px;
        font-weight: 300;
        transition: transform 0.2s ease;
    }
    
    .desktop-footer .qr-nav-btn .nav-label {
        font-size: 13px;
    }
    
    .desktop-footer .qr-nav-btn.nav-prev:hover .nav-arrow {
        transform: translateX(-3px);
    }
    
    .desktop-footer .qr-nav-btn.nav-next:hover .nav-arrow {
        transform: translateX(3px);
    }
    
    /* ─── Desktop Sidebar ───────────────────────────────────────────────── */
    /* Override the 769px .visible styles - control display directly */
    .desktop-sidebar {
        display: flex !important;
        flex-direction: column;
        gap: 0;
        background: rgb(15, 18, 22);  /* V2's --docs-sidebar-bg */
        border-right: 1px solid rgba(255, 255, 255, 0.06);
        overflow: hidden;
        padding: 0;
        position: relative;
        transition: width 0.3s ease-out;
        width: 300px;
        min-width: 300px;
        /* Force sidebar to left column, row 2 only */
        grid-column: 1;
        grid-row: 2 / 3;
        /* Critical: min-height 0 allows flex children to shrink/grow properly in grid */
        min-height: 0;
    }
    
    /* When footer is visible, sidebar spans rows 2 and 3 to fill column 1 */
    .lexicon-app.has-fixed-footer .desktop-sidebar {
        grid-row: 2 / 4;
    }
    
    /* Force content to right column */
    .app-content {
        grid-column: 2;
        grid-row: 2 / 3;
        background: var(--bg-content);  /* V2's lighter stage background */
    }
    
    .lexicon-app.has-fixed-footer .app-content {
        grid-row: 2 / 3;
    }
    
    /* Sidebar Header */
    .sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 14px 10px 14px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        flex-shrink: 0;
    }
    
    .sidebar-title {
        font-family: 'Space Grotesk', sans-serif;
        font-size: 13px;
        font-weight: 600;
        color: var(--text-secondary);
        letter-spacing: 0.5px;
    }
    
    .sidebar-edition {
        font-size: 11px;
        color: rgb(128, 128, 128);
        letter-spacing: 0.3px;
        text-align: center;
        flex: 1;
    }
    
    /* Collapse button - sits at top left of sidebar content */
    .sidebar-collapse-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 6px;
        color: var(--text-muted);
        font-size: 12px;
        cursor: pointer;
        transition: all 0.2s ease;
        flex-shrink: 0;
    }
    
    .sidebar-collapse-btn:hover {
        background: rgba(0, 204, 255, 0.15);
        color: var(--brand-cyan);
        border-color: var(--brand-cyan);
    }
    
    .sidebar-collapse-btn .chevron {
        transition: transform 0.3s ease;
    }

    /* ═══════════════════════════════════════════════════════════════════════
       V2 DocsKit Sidebar Components - Ported Complete
       ═══════════════════════════════════════════════════════════════════════ */
    
    /* Search Container with Gradient Glow */
    .search-container { 
        position: relative;
        margin: 0 16px 16px 16px;
    }
    
    .search-container::before {
        content: '';
        position: absolute;
        top: -1px; left: -1px; right: -1px; bottom: -1px;
        background: linear-gradient(90deg, rgb(0, 204, 255), rgb(168, 85, 247), rgb(0, 204, 255));
        border-radius: 9px;
        opacity: 0.4;
        z-index: 0;
        transition: opacity 0.3s ease;
    }
    
    .search-container:hover::before,
    .search-container:focus-within::before {
        opacity: 0.8;
        animation: glowPulse 2s ease-in-out infinite;
    }
    
    @keyframes glowPulse {
        0%, 100% { opacity: 0.6; }
        50% { opacity: 1; }
    }
    
    .search-input {
        position: relative;
        z-index: 1;
        width: 100%;
        padding: 12px 36px 12px 40px;
        background: rgb(15, 18, 22);
        border: 1px solid transparent;
        border-radius: 8px;
        color: rgb(242, 242, 242);
        font-size: 14px;
        outline: none;
        transition: all 0.2s ease;
    }
    
    .search-input:focus {
        background: rgb(31, 33, 41);
    }
    
    .search-input::placeholder {
        color: rgb(128, 128, 128);
    }
    
    .search-icon {
        position: absolute;
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
        color: rgb(0, 204, 255);
        font-size: 15px;
        pointer-events: none;
        z-index: 2;
        transition: color 0.3s ease;
    }
    
    .search-container:focus-within .search-icon {
        color: rgb(168, 85, 247);
    }
    
    .search-hint {
        position: absolute;
        bottom: -20px;
        left: 4px;
        font-size: 10px;
        color: rgb(128, 128, 128);
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .search-container:hover .search-hint,
    .search-container:focus-within .search-hint {
        opacity: 1;
    }
    
    .search-clear {
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        width: 20px;
        height: 20px;
        background: rgb(51, 51, 51);
        border: none;
        border-radius: 50%;
        color: rgb(179, 179, 179);
        font-size: 12px;
        cursor: pointer;
        display: none;
        align-items: center;
        justify-content: center;
        z-index: 2;
    }
    
    .search-clear.visible {
        display: flex;
    }
    
    .search-clear:hover {
        background: rgb(168, 85, 247);
        color: white;
    }
    
    .search-stats {
        padding: 8px 16px;
        font-size: 11px;
        color: rgb(128, 128, 128);
        border-bottom: 1px solid rgb(51, 51, 51);
        display: none;
    }
    
    .search-stats.visible {
        display: block;
    }
    
    .search-stats strong {
        color: rgb(0, 204, 255);
    }
    
    /* Recent Terms */
    .recent-terms {
        padding: 12px 16px;
        border-bottom: 1px solid rgb(51, 51, 51);
        display: none;
    }
    
    .recent-terms.visible {
        display: block;
    }
    
    .recent-terms-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
    }
    
    .recent-terms-title {
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: rgb(128, 128, 128);
        font-weight: 600;
    }
    
    .recent-terms-clear {
        font-size: 10px;
        color: rgb(128, 128, 128);
        cursor: pointer;
        background: none;
        border: none;
    }
    
    .recent-terms-clear:hover {
        color: rgb(0, 204, 255);
    }
    
    .recent-terms-list {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    
    .recent-term-item {
        padding: 6px 10px;
        font-size: 12px;
        color: rgb(179, 179, 179);
        background: rgb(31, 33, 41);
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.2s ease;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .recent-term-item:hover {
        background: rgba(0, 204, 255, 0.15);
        color: rgb(0, 204, 255);
    }
    
    /* Sidebar Nav */
    .sidebar-nav {
        flex: 1;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }
    
    /* A-Z Index */
    .az-index {
        display: grid;
        grid-template-columns: repeat(8, 1fr);
        gap: 5px;
        padding: 12px 16px;
        border-bottom: 1px solid rgb(51, 51, 51);
        flex-shrink: 0;
    }
    
    .az-letter {
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        font-weight: 600;
        color: rgb(179, 179, 179);
        background: rgb(31, 33, 41);
        border: 1px solid rgb(51, 51, 51);
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .az-letter:hover {
        color: rgb(0, 204, 255);
        border-color: rgb(0, 204, 255);
        background: rgba(0, 204, 255, 0.15);
        transform: translateY(-2px);
    }
    
    .az-letter.active {
        color: white;
        background: linear-gradient(135deg, rgb(0, 204, 255), rgb(168, 85, 247));
        border-color: transparent;
        box-shadow: 0 2px 8px rgba(0, 204, 255, 0.3);
    }
    
    /* Count badge on hover */
    .az-letter-count {
        position: absolute;
        top: -6px;
        right: -6px;
        min-width: 16px;
        height: 16px;
        font-size: 9px;
        font-weight: 600;
        background: rgb(168, 85, 247);
        color: white;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 4px;
        opacity: 0;
        transform: scale(0.8);
        transition: all 0.2s ease;
    }
    
    .az-letter:hover .az-letter-count {
        opacity: 1;
        transform: scale(1);
    }
    
    /* Terms List */
    .terms-list {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }
    
    .terms-list::-webkit-scrollbar {
        width: 6px;
    }
    
    .terms-list::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .terms-list::-webkit-scrollbar-thumb {
        background: rgb(51, 51, 51);
        border-radius: 3px;
    }
    
    .nav-topic {
        padding: 8px 16px;
        font-size: 13px;
        color: rgb(179, 179, 179);
        cursor: pointer;
        transition: all 0.15s ease;
        border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    }
    
    .nav-topic:hover {
        background: rgba(255, 255, 255, 0.03);
        color: rgb(0, 204, 255);
    }
    
    .nav-topic.active {
        background: rgba(0, 204, 255, 0.15);
        color: rgb(0, 204, 255);
        border-left: 3px solid rgb(0, 204, 255);
        padding-left: 13px;
    }
    
    /* Terms list header */
    .terms-list-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 16px;
        font-size: 11px;
        color: rgb(128, 128, 128);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border-bottom: 1px solid rgb(51, 51, 51);
        background: rgba(0, 0, 0, 0.2);
    }
    
    .terms-list-count {
        color: rgb(0, 204, 255);
        font-weight: 600;
    }
    
    /* Search Results */
    .search-results {
        display: none;
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }
    
    .search-results.visible {
        display: block;
    }
    
    .search-results::-webkit-scrollbar {
        width: 6px;
    }
    
    .search-results::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .search-results::-webkit-scrollbar-thumb {
        background: rgb(51, 51, 51);
        border-radius: 3px;
    }
    
    .search-result-item {
        padding: 12px 16px;
        border-bottom: 1px solid rgb(51, 51, 51);
        cursor: pointer;
        transition: background 0.2s ease;
    }
    
    .search-result-item:hover {
        background: rgba(255, 255, 255, 0.03);
    }
    
    .search-result-item.active {
        background: rgba(0, 204, 255, 0.15);
    }
    
    .search-result-term {
        font-size: 13px;
        font-weight: 500;
        color: rgb(242, 242, 242);
        margin-bottom: 4px;
    }
    
    .search-result-context {
        font-size: 12px;
        color: rgb(128, 128, 128);
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    
    .search-result-context mark,
    .search-result-term mark {
        background: rgba(0, 204, 255, 0.35);
        color: rgb(255, 255, 255);
        padding: 1px 3px;
        border-radius: 2px;
    }

    /* Sidebar collapsed state */
    .lexicon-app.sidebar-collapsed .desktop-sidebar {
        width: 44px;
        min-width: 44px;
        padding: 14px 8px;
        border-right: none;
        align-items: center;
    }
    
    /* Hide sidebar content when collapsed, keep only collapse button */
    .lexicon-app.sidebar-collapsed .sidebar-header,
    .lexicon-app.sidebar-collapsed .search-container,
    .lexicon-app.sidebar-collapsed .search-stats,
    .lexicon-app.sidebar-collapsed .recent-terms,
    .lexicon-app.sidebar-collapsed .sidebar-nav,
    .lexicon-app.sidebar-collapsed .search-results {
        display: none;
    }
    
    /* Show the standalone collapse button when collapsed */
    .lexicon-app.sidebar-collapsed .sidebar-collapse-btn-standalone {
        display: flex;
    }
    
    /* Standalone button hidden when expanded (button is in header instead) */
    .sidebar-collapse-btn-standalone {
        display: none;
        width: 28px;
        height: 28px;
        background: rgba(0, 204, 255, 0.08);
        border: 1px solid rgba(0, 204, 255, 0.25);
        border-radius: 6px;
        color: var(--text-muted);
        font-size: 12px;
        cursor: pointer;
        transition: all 0.2s ease;
        align-items: center;
        justify-content: center;
    }
    
    .sidebar-collapse-btn-standalone:hover {
        background: rgba(0, 204, 255, 0.2);
        color: var(--brand-cyan);
        border-color: var(--brand-cyan);
    }
    
    /* Update grid for collapsed sidebar */
    .lexicon-app.sidebar-collapsed {
        grid-template-columns: 44px 1fr;
    }
    
    /* Remove old unused elements */
    .sidebar-collapsed-tab,
    .sidebar-toggle-strip {
        display: none !important;
    }
    
    /* Sidebar search area */
    .sidebar-search-area {
        padding: 0 14px;
        flex-shrink: 0;
    }
    
    .sidebar-search {
        margin-bottom: 10px;
    }
    
    /* Sidebar alphabet index */
    .sidebar-alpha {
        display: flex;
        flex-wrap: wrap;
        gap: 3px;
        padding: 0 14px 10px;
        flex-shrink: 0;
    }
    
    .sidebar-alpha .alpha-btn {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    
    /* Sidebar term list */
    .sidebar-terms {
        flex: 1 1 0;  /* Grow, shrink, basis 0 - fills remaining space */
        min-height: 0; /* Critical for flex item in nested flex/grid context */
        overflow-y: auto;
        padding: 0 10px 14px;
    }
    
    .sidebar-terms::-webkit-scrollbar {
        width: 6px;
    }
    
    .sidebar-terms::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .sidebar-terms::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 3px;
    }
    
    .sidebar-terms::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.2);
    }
    
    .sidebar-term {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 10px;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.15s ease;
        border: 1px solid transparent;
    }
    
    .sidebar-term:hover {
        background: var(--bg-card);
        border-color: rgba(255, 255, 255, 0.06);
    }
    
    .sidebar-term.active {
        background: rgba(0, 204, 255, 0.08);
        border-color: rgba(0, 204, 255, 0.2);
    }
    
    .sidebar-term.active .term-name {
        color: var(--brand-cyan);
    }
    
    .term-mastery-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        flex-shrink: 0;
    }
    
    .term-name {
        font-size: 13px;
        color: var(--text-secondary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .sidebar-term:hover .term-name {
        color: var(--text-primary);
    }
    
    /* Sidebar footer */
    .sidebar-footer {
        display: none; /* Hidden on desktop - main stage footer handles branding */
    }
    
    /* ─── Dashboard Desktop Enhancements ────────────────────────────────── */
    
    /* Zone cards: horizontal row, no arrows */
    .zone-nav {
        flex-direction: row;
        gap: 16px;
    }
    
    .zone-card {
        flex: 1;
        flex-direction: column;
        text-align: center;
        padding: 28px 20px;
        gap: 14px;
        min-height: 160px;
    }
    
    /* Hide the arrow on desktop - hover effect is the affordance */
    .zone-go {
        display: none;
    }
    
    .zone-icon {
        font-size: 36px;
    }
    
    .zone-title {
        font-size: 18px;
    }
    
    .zone-sub {
        font-size: 13px;
    }
    
    /* Enhanced hover states for zone cards */
    .zone-card:hover {
        transform: translateY(-4px);
    }
    
    .zone-study:hover {
        box-shadow: 0 8px 32px var(--study-glow), 0 0 0 1px var(--study-primary);
    }
    
    .zone-arcade:hover {
        box-shadow: 0 8px 32px var(--arcade-glow), 0 0 0 1px var(--arcade-primary);
    }
    
    .zone-ref:hover {
        box-shadow: 0 8px 32px var(--qr-glow), 0 0 0 1px var(--qr-primary);
    }
    
    /* ─── Did You Know? Trivia Card (Desktop Only) ──────────────────────── */
    .trivia-card {
        background: linear-gradient(135deg, rgba(168, 85, 247, 0.06), rgba(0, 204, 255, 0.06));
        border: 1px solid rgba(168, 85, 247, 0.15);
        border-radius: var(--radius-md);
        padding: 20px 24px;
        margin-top: 8px;
        position: relative;
        overflow: hidden;
    }
    
    .trivia-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, var(--brand-cyan), var(--brand-purple));
    }
    
    .trivia-header {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 12px;
    }
    
    .trivia-emoji {
        font-size: 24px;
    }
    
    .trivia-label {
        font-family: 'Space Grotesk', sans-serif;
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 1px;
        color: var(--brand-purple);
    }
    
    .trivia-content {
        font-size: 15px;
        line-height: 1.6;
        color: var(--text-secondary);
        margin-bottom: 14px;
    }
    
    .trivia-content strong {
        color: var(--text-primary);
    }
    
    .trivia-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .trivia-source {
        font-size: 11px;
        color: var(--text-muted);
        font-style: italic;
    }
    
    .trivia-next-btn {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 8px 14px;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        color: var(--text-secondary);
        font-size: 12px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .trivia-next-btn:hover {
        background: rgba(168, 85, 247, 0.1);
        border-color: var(--brand-purple);
        color: var(--brand-purple);
    }
    
    /* ─── Quick Stats Row (Desktop Only) ────────────────────────────────── */
    /* ─── Desktop Curriculum Selector (in readiness strip) ───────────────── */
    .desktop-curriculum-selector {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
        cursor: pointer;
        padding: 8px 12px;
        border-radius: var(--radius-sm);
        transition: all 0.2s ease;
    }
    
    .desktop-curriculum-selector:hover {
        background: rgba(255, 255, 255, 0.05);
    }
    
    .desktop-curriculum-selector .curriculum-tag {
        font-family: 'Space Grotesk', sans-serif;
        font-size: 14px;
        font-weight: 600;
        color: var(--brand-cyan);
    }
    
    .curriculum-change-btn {
        font-size: 12px;
        color: var(--text-secondary);
        transition: color 0.2s ease;
    }
    
    .desktop-curriculum-selector:hover .curriculum-change-btn {
        color: var(--brand-cyan);
    }
    
    /* Term count in mastery row */
    .mastery-pip.term-count {
        margin-left: auto;
        padding-left: 12px;
        border-left: 1px solid rgba(255, 255, 255, 0.1);
        color: var(--text-secondary);
    }
    
    /* ─── Content Area Breathing Room ───────────────────────────────────── */
    .view-container {
        padding: 32px 40px 48px;
        max-width: 900px;
    }
    
    /* Readiness strip wider on desktop */
    .readiness-strip {
        padding: 0;
    }
    
    .readiness-left {
        padding: 24px 28px;
        min-width: 110px;
    }
    
    .readiness-pct {
        font-size: 48px;
    }
    
    .readiness-center {
        padding: 20px 24px;
    }
    
    .readiness-mastery-row {
        gap: 16px;
    }
    
    .mastery-pip {
        font-size: 13px;
    }
    
    /* ─── Keyboard Shortcut Hint ────────────────────────────────────────── */
    .keyboard-hint {
        position: fixed;
        bottom: 20px;
        right: 20px;
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 14px;
        background: var(--bg-elevated);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        font-size: 11px;
        color: var(--text-muted);
        opacity: 0;
        transform: translateY(10px);
        transition: all 0.3s ease;
        pointer-events: none;
        z-index: 100;
    }
    
    .keyboard-hint.visible {
        opacity: 1;
        transform: translateY(0);
    }
    
    .keyboard-hint kbd {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 20px;
        height: 20px;
        padding: 0 6px;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 4px;
        font-family: 'Space Grotesk', monospace;
        font-size: 11px;
        font-weight: 600;
        color: var(--text-secondary);
    }
    
} /* End @media (min-width: 768px) - Desktop Pro Mode */

/* ═══ Modal Styles (Global) ═══════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-card, #151d2e);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    max-width: 520px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

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

.modal-content h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary, #e8ecf4);
    padding: 24px 24px 0;
    margin: 0;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-secondary, #8b95a8);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #e8ecf4);
}

.modal-body {
    padding: 20px 24px 24px;
    color: var(--text-secondary, #8b95a8);
    font-size: 14px;
    line-height: 1.6;
}

.modal-body h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #e8ecf4);
    margin: 20px 0 8px;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p {
    margin: 0 0 12px;
}

.modal-body ul {
    margin: 0 0 12px;
    padding-left: 20px;
}

.modal-body li {
    margin-bottom: 6px;
}

.modal-body a {
    color: var(--brand-cyan, #00ccff);
    text-decoration: none;
}

.modal-body a:hover {
    text-decoration: underline;
}

/* Shortcuts table */
.shortcuts-table {
    width: 100%;
    border-collapse: collapse;
}

.shortcuts-table tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.shortcuts-table td {
    padding: 10px 0;
}

.shortcuts-table td:first-child {
    width: 100px;
}

.shortcuts-table kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-family: 'Space Grotesk', monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #e8ecf4);
    margin-right: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PHASE 1 DESKTOP ENHANCEMENTS — Study Views
   These styles only apply at 768px+ and don't affect mobile
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Keyboard Hint Badges (hidden on mobile) ─────────────────────────────── */
.kbd-hint {
    display: none; /* Hidden by default (mobile) */
}

@media (min-width: 768px) {
    
    /* ─── 1. Max-Width Containers ─────────────────────────────────────────── */
    /* Keep study content centered and readable on wide screens */
    
    .study-lounge-view,
    .term-match-view,
    .term-match-summary {
        max-width: 800px;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
    }
    
    /* Slightly wider for Term Match to accommodate 2x2 grid */
    .term-match-view {
        max-width: 720px;
    }
    
    /* ─── 2. Term Match 2x2 Option Grid ───────────────────────────────────── */
    .tm-options {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        padding: 12px 24px 20px;
    }
    
    .tm-option {
        min-height: 72px;
        padding: 14px 16px;
        align-items: flex-start;
    }
    
    .tm-option .opt-term {
        line-height: 1.4;
    }
    
    /* Larger definition area on desktop */
    .tm-question {
        padding: 12px 24px 10px;
    }
    
    .tm-definition {
        font-size: 16px;
        padding: 16px 18px;
    }
    
    /* Next button with more breathing room */
    .tm-next-row {
        padding: 8px 24px 24px;
    }
    
    .tm-next-btn {
        max-width: 500px;
    }
    
    /* ─── 3. Keyboard Hints ───────────────────────────────────────────────── */
    /* Show keyboard shortcuts on desktop */
    
    .kbd-hint {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 22px;
        height: 22px;
        padding: 0 6px;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 4px;
        font-family: 'Space Grotesk', monospace;
        font-size: 11px;
        font-weight: 600;
        color: var(--text-muted);
        margin-left: auto;
        flex-shrink: 0;
        opacity: 0.7;
        transition: opacity 0.2s, background 0.2s;
    }
    
    /* Brighter on hover */
    .tm-option:hover .kbd-hint,
    .tm-next-btn:hover .kbd-hint {
        opacity: 1;
        background: rgba(255, 255, 255, 0.1);
    }
    
    /* Term Match option - letter already shown, kbd hint is subtle */
    .tm-option .opt-letter {
        /* Letter circle acts as keyboard hint */
        transition: all 0.2s;
    }
    
    .tm-option:hover .opt-letter {
        background: rgba(0, 204, 255, 0.15);
        color: var(--brand-cyan);
    }
    
    /* Next button keyboard hint */
    .tm-next-btn {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
    }
    
    .tm-next-btn .kbd-hint {
        background: rgba(255, 255, 255, 0.15);
        border-color: rgba(255, 255, 255, 0.25);
        color: rgba(255, 255, 255, 0.9);
        margin-left: 8px;
    }
    
    /* ─── Phase 2: Study Lounge 2-Column Layout ───────────────────────────── */
    
    /* Hide the top mastery strip on desktop - info is in the Pulse card */
    .sl-mastery-strip,
    .sl-progress-bar {
        display: none;
    }
    
    .sl-desktop-grid {
        display: grid;
        grid-template-columns: 1fr 280px;
        gap: 24px;
        padding: 0 16px;
    }
    
    .sl-column-left {
        display: flex;
        flex-direction: column;
    }
    
    .sl-column-right {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    
    /* Adjust tuner card for desktop column */
    .sl-desktop-grid .sl-tuner-card {
        margin: 0 0 16px 0;
    }
    
    /* Adjust start button for desktop column */
    .sl-desktop-grid .sl-start-btn {
        width: 100%;
        margin: 0;
    }
    
    /* ─── Readiness Pulse Card (Desktop Sidebar) ──────────────────────────── */
    .sl-pulse-card {
        background: var(--bg-card);
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: var(--radius-md);
        padding: 16px;
    }
    
    .sl-pulse-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
    }
    
    .sl-pulse-title {
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--text-muted);
    }
    
    .sl-pulse-pct {
        font-size: 28px;
        font-weight: 700;
        color: #00ccff;
    }
    
    .sl-pulse-breakdown {
        display: flex;
        flex-direction: column;
        gap: 10px;
        position: relative;
        min-height: 120px;
    }
    
    .sl-pulse-bar {
        display: flex;
        height: 8px;
        background: rgba(255, 255, 255, 0.06);
        border-radius: 4px;
        overflow: hidden;
    }
    
    .sl-pulse-seg {
        height: 100%;
        transition: width 0.3s ease;
    }
    
    .sl-pulse-seg.green { background: var(--mastery-mastered); }
    .sl-pulse-seg.orange { background: var(--mastery-familiar); }
    .sl-pulse-seg.red { background: var(--mastery-missed); }
    
    .sl-pulse-legend {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }
    
    .sl-pulse-legend span {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 12px;
        color: var(--text-secondary);
    }
    
    .sl-pulse-legend .dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        flex-shrink: 0;
    }
    
    .sl-pulse-legend .dot.green { background: var(--mastery-mastered); }
    .sl-pulse-legend .dot.orange { background: var(--mastery-familiar); }
    .sl-pulse-legend .dot.red { background: var(--mastery-missed); }
    .sl-pulse-legend .dot.gray { background: var(--text-muted); }
    
    /* Large mastery score in the empty space */
    .sl-pulse-score-inline {
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 2px;
    }
    
    .sl-pulse-score-inline .score-value {
        font-family: 'Space Grotesk', sans-serif;
        font-size: 48px;
        font-weight: 700;
        line-height: 1;
        background: linear-gradient(135deg, var(--study-primary), #22c55e);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .sl-pulse-score-inline .score-label {
        font-size: 13px;
        font-weight: 600;
        color: var(--text-secondary);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    /* Make legend container relative for positioning */
    .sl-pulse-legend {
        position: relative;
    }
    
    /* ─── Session History Card (Desktop Sidebar) ──────────────────────────── */
    .sl-history-card {
        background: var(--bg-card);
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: var(--radius-md);
        padding: 16px;
    }
    
    .sl-history-header {
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--text-muted);
        margin-bottom: 12px;
    }
    
    .sl-history-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .sl-history-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        background: rgba(255, 255, 255, 0.02);
        border-radius: 8px;
        transition: background 0.2s;
    }
    
    .sl-history-item:hover {
        background: rgba(255, 255, 255, 0.05);
    }
    
    .sl-hist-icon {
        font-size: 16px;
        flex-shrink: 0;
    }
    
    .sl-hist-info {
        flex: 1;
        font-size: 13px;
        color: var(--text-secondary);
    }
    
    .sl-hist-acc {
        font-weight: 600;
    }
    
    .sl-hist-acc.high { color: var(--mastery-mastered); }
    .sl-hist-acc.med { color: var(--mastery-familiar); }
    .sl-hist-acc.low { color: var(--mastery-learning); }
    
    .sl-hist-time {
        font-size: 11px;
        color: var(--text-muted);
        flex-shrink: 0;
    }
    
    .sl-history-empty {
        text-align: center;
    }
    
    .sl-empty-msg {
        font-size: 13px;
        color: var(--text-muted);
        margin: 0;
        padding: 12px 0;
    }
    
}