/* ============================================================
   Quantum Lab — Artistic Indie Theme
   Dark cinematic mode with warm accents
   ============================================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Dark cosmic background */
body {
    background: var(--bg-primary);
}

.bg-cosmos {
    background: linear-gradient(180deg, rgba(11,13,20,0.9) 0%, rgba(19,21,30,0.8) 100%) !important;
    opacity: 1;
}

:root {
    /* ARTISTIC INDIE PALETTE — warm, cinematic, inviting */
    --bg-primary: #0B0D14;
    --bg-secondary: #13151E;
    --bg-card: #1A1B24;
    --bg-deep: #0A0B10;

    /* Warm accent colors */
    --coral: #E87979;
    --coral-soft: #F0A8A8;
    --gold: #D4A574;
    --gold-soft: #E8C9A0;
    --purple: #8B6BAE;
    --purple-soft: #A991C9;

    /* Accent mappings for compatibility */
    --quantum-blue: var(--coral);
    --quantum-purple: var(--purple);
    --quantum-cyan: var(--gold);
    --quantum-pink: var(--coral-soft);

    /* Status colors — warm variants */
    --success: #7BC47F;
    --warning: var(--gold);
    --error: #E87979;
    --offline: #5A5B66;

    /* Text — warm, readable on dark */
    --text-primary: #E6E2DC;
    --text-secondary: #A8A5A0;
    --text-tertiary: #6B6966;

    /* Borders & shadows — warm glow */
    --border-light: #2A2B34;
    --border-warm: linear-gradient(135deg, var(--coral), var(--purple));
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 30px rgba(232, 121, 121, 0.15);
    --shadow-glow-warm: 0 0 40px rgba(212, 165, 116, 0.2), 0 0 80px rgba(139, 107, 174, 0.1);

    /* Typography */
    --font-display: 'Inter', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.65;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
}

/* ── HEADER ─────────────────────────────────────────────── */
header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 64px;
    background: rgba(26, 27, 36, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-light);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--coral), var(--purple));
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    color: white;
    font-weight: 800;
}

.header-center {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.header-controls {
    display: flex;
    gap: var(--space-sm);
}

.toggle-btn {
    padding: 8px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.25s;
}

.toggle-btn:hover {
    border-color: var(--coral);
    color: var(--coral);
    box-shadow: 0 0 12px rgba(232, 121, 121, 0.2);
}

/* ── MAIN CONTENT ──────────────────────────────────────── */
main {
    padding-top: 64px;
    min-height: 100vh;
}

.page { display: none; }
.page.active { display: block; }

/* ── HOME / LAB ───────────────────────────────────────── */
.lab-home {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-3xl) var(--space-lg);
    text-align: center;
}

/* ── MISSION BRIEFING ────────────────────────────────── */
.mission-briefing {
    background: linear-gradient(135deg, rgba(232, 121, 121, 0.08) 0%, rgba(139, 107, 174, 0.08) 100%);
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    text-align: center;
    max-width: 700px;
    margin: 0 auto 40px;
    position: relative;
    box-shadow: var(--shadow-glow-warm);
}

.mission-briefing::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, var(--coral), var(--purple));
    border-radius: var(--radius-xl);
    z-index: -1;
    opacity: 0.5;
}

.mission-briefing::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    z-index: -1;
}

.mission-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--coral), var(--purple));
    color: white;
    padding: 10px 24px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 20px;
    text-transform: uppercase;
    box-shadow: 0 4px 16px rgba(232, 121, 121, 0.3);
}

.mission-badge-success {
    background: linear-gradient(135deg, var(--success), #5BA85E);
}

.mission-title {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.3;
}

.mission-narrative {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.8;
    max-width: 500px;
    margin: 0 auto 24px;
}

.mission-narrative strong {
    color: var(--coral);
}

.mission-progress-wrap {
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    border: 1px solid var(--border-light);
}

.mission-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.mission-progress-bar {
    height: 10px;
    background: var(--bg-secondary);
    border-radius: 5px;
    overflow: hidden;
}

.mission-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--coral), var(--purple));
    border-radius: 5px;
    transition: width 0.5s ease;
}

.mission-complete {
    text-align: center;
    margin-bottom: 40px;
}

.mission-complete-title {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-top: 16px;
}

@keyframes blink { 50% { opacity: 0.5; } }
/* Emergency alert pill — structured badge above the title */
.lab-alert {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-full);
    background: rgba(232, 121, 121, 0.10);
    border: 1px solid rgba(232, 121, 121, 0.35);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--coral);
    letter-spacing: 0.02em;
    margin-bottom: var(--space-xl);
    box-shadow: 0 0 24px rgba(232, 121, 121, 0.10);
}

.lab-alert-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--coral);
    box-shadow: 0 0 8px var(--coral);
    animation: blink 1s infinite;
}

.lab-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.lab-title-line2 {
    background: linear-gradient(135deg, var(--coral), var(--gold), var(--purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ── LEGACY SUBTITLE ──────────────────────────────────── */
.lab-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 640px;
    margin: 0 auto var(--space-2xl);
    line-height: 1.7;
}

/* STATION GRID — artistic indie cards */
.station-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
    width: 100%;
    margin: 0 auto var(--space-2xl);
    max-width: 1000px;
}

/* Station card — warm, artistic, with illustration backgrounds */
.station-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    cursor: pointer;
    text-align: left;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    /* Warm gradient border via pseudo-element */
    border: 1px solid var(--border-light);
}

/* Illustration background overlay */
.station-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.35;
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 0;
}

/* Station-specific illustration backgrounds */
.station-card[data-station="1"]::before {
    background-image: url('https://d8j0ntlcm91z4.cloudfront.net/user_3GoMLVnG8OtCKYFji8KiOMERBWu/hf_20260722_100048_8000a702-38cd-441e-96a2-18a6c376b438.png');
}

.station-card[data-station="2"]::before {
    background-image: url('https://d8j0ntlcm91z4.cloudfront.net/user_3GoMLVnG8OtCKYFji8KiOMERBWu/hf_20260722_100657_0a58bcc9-90c4-4837-b784-522841f7b96c.png');
}

.station-card[data-station="3"]::before {
    background-image: url('https://d8j0ntlcm91z4.cloudfront.net/user_3GoMLVnG8OtCKYFji8KiOMERBWu/hf_20260722_100946_a91231de-864a-4ddd-9011-b8a28f099d96.png');
}

.station-card[data-station="4"]::before {
    background-image: url('https://d8j0ntlcm91z4.cloudfront.net/user_3GoMLVnG8OtCKYFji8KiOMERBWu/hf_20260722_101232_7d1b42cf-500c-4425-993f-1102c0f2c19c.png');
}

.station-card[data-station="5"]::before {
    background-image: url('https://d8j0ntlcm91z4.cloudfront.net/user_3GoMLVnG8OtCKYFji8KiOMERBWu/hf_20260722_101532_1c7db88b-667b-4cd9-acad-c5c22a16e97d.png');
}

.station-card[data-station="6"]::before {
    background-image: url('https://d8j0ntlcm91z4.cloudfront.net/user_3GoMLVnG8OtCKYFji8KiOMERBWu/hf_20260722_101836_1eb4f70c-8f7e-4f3e-a029-fab45b072898.png');
}

.station-card[data-station="7"]::before {
    background-image: url('https://d8j0ntlcm91z4.cloudfront.net/user_3GoMLVnG8OtCKYFji8KiOMERBWu/hf_20260722_102133_8bcbef58-d72b-414d-bba0-cf960dde1255.png');
}

/* Warm gradient border effect */
.station-card::after {
    content: '';
    position: absolute;
    inset: -1px;
    background: linear-gradient(135deg, var(--coral), var(--gold), var(--purple));
    border-radius: var(--radius-lg);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Make content appear above overlay */
.station-card > * {
    position: relative;
    z-index: 1;
}

/* Stagger entrance animation — gentle, warm feel */
.station-card {
    opacity: 0;
    transform: translateY(24px);
    animation: card-reveal 700ms cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes card-reveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.station-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg), var(--shadow-glow-warm);
}

.station-card:hover::before {
    opacity: 0.5;
    transform: scale(1.05);
}

.station-card:hover::after {
    opacity: 0.6;
}

.station-card:active {
    transform: scale(0.98);
    transition: transform 100ms cubic-bezier(0.23, 1, 0.32, 1);
}

.station-card.online {
    border-color: var(--success);
}

.station-card.online::after {
    background: linear-gradient(135deg, var(--success), #5BA85E);
    opacity: 0.5;
}

.station-card.online:hover {
    border-color: transparent;
}

/* Card header */
.station-number {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.station-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--offline);
}

.station-card.online .station-status-dot {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.station-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
}

.station-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.station-tagline {
    font-size: 1.02rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-md);
}

/* Play affordance — warm gradient */
.station-play {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--coral), var(--purple));
    color: #fff;
    transition: transform 0.2s, box-shadow 0.2s;
}

.station-card:hover .station-play {
    transform: translateX(3px);
    box-shadow: 0 4px 14px rgba(232, 121, 121, 0.35);
}

.station-card.online .station-play {
    background: linear-gradient(135deg, var(--success), #5BA85E);
    color: white;
    border: none;
}

/* Done ring */
.station-done-ring {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s;
}

.station-card.online .station-done-ring {
    opacity: 1;
    transform: scale(1);
}

/* ── QUANTUM CORE PANEL ──────────────────────────────── */
.quantum-core-panel {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    cursor: pointer;
    transition: all 0.3s;
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

/* Core illustration background */
.quantum-core-panel::before {
    content: '';
    position: absolute;
    right: -50px;
    top: 50%;
    transform: translateY(-50%);
    width: 250px;
    height: 250px;
    background-image: url('https://d8j0ntlcm91z4.cloudfront.net/user_3GoMLVnG8OtCKYFji8KiOMERBWu/hf_20260722_100242_f63c22ab-d800-4a9a-b8fc-cbb262bd39e8.png');
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.15;
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 0;
}

.quantum-core-panel:hover::before {
    opacity: 0.25;
    transform: translateY(-50%) scale(1.1);
}

.quantum-core-panel::after {
    content: '';
    position: absolute;
    inset: -1px;
    background: linear-gradient(135deg, var(--gold), var(--purple));
    border-radius: var(--radius-xl);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.quantum-core-panel > * {
    position: relative;
    z-index: 1;
}

.quantum-core-panel:hover {
    box-shadow: var(--shadow-glow-warm);
    transform: scale(1.01);
}

.quantum-core-panel:hover::after {
    opacity: 0.6;
}

.quantum-core-panel.unlocked {
    border-color: transparent;
}

.quantum-core-panel.unlocked::after {
    background: linear-gradient(135deg, var(--coral), var(--purple));
    opacity: 1;
}

.quantum-core-panel.unlocked .core-title,
.quantum-core-panel.unlocked .core-desc {
    color: white;
}

.core-lock-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--coral), var(--purple));
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(232, 121, 121, 0.3);
}

.quantum-core-panel.unlocked .core-lock-icon {
    background: rgba(255,255,255,0.2);
    color: white;
    animation: spin 8s linear infinite;
}

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

.core-content { flex: 1; }

.core-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
}

.core-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.core-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.core-progress {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.core-progress-bar-wrap {
    flex: 1;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.core-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--coral), var(--gold), var(--purple));
    border-radius: var(--radius-full);
    transition: width 0.5s;
}

.core-progress-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.core-cta {
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--coral), var(--purple));
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(232, 121, 121, 0.3);
}

.core-cta:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(232, 121, 121, 0.4);
}

/* ── STATION EXPLAINER VIDEO ─────────────────────────── */
.station-video-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: 0 0 24px rgba(232, 121, 121, 0.08);
}

.station-video-label {
    font-family: var(--font-mono, monospace);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--gold);
    margin-bottom: var(--space-md);
    text-transform: uppercase;
}

.station-video {
    width: 100%;
    max-height: 460px;
    display: block;
    border-radius: var(--radius-md);
    background: #000;
    border: 1px solid var(--border-light);
}

/* ── PUZZLE GOAL STRIP ─────────────────────────────── */
.puzzle-goal-strip {
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.1), rgba(232, 121, 121, 0.1));
    border: 1px solid rgba(212, 165, 116, 0.3);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.puzzle-goal-icon {
    font-size: 1.75rem;
}

.puzzle-goal-text { flex: 1; }

.puzzle-goal-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.puzzle-goal-desc {
    font-size: 1.12rem;
    color: var(--text-primary);
    font-weight: 600;
}

.puzzle-goal-status {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--success);
    padding: 6px 12px;
    background: rgba(123, 196, 127, 0.15);
    border-radius: var(--radius-full);
}

/* ── SIMULATION CONTAINER ───────────────────────────── */
.simulation-container {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-md);
}

/* Controls panel */
.controls-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-light);
    margin-top: var(--space-lg);
}

.control-group { }

.control-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.control-value {
    font-family: var(--font-mono);
    color: var(--coral);
    font-weight: 600;
}

.slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--coral), var(--purple));
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(232, 121, 121, 0.4);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--coral), var(--purple));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(232, 121, 121, 0.4);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--coral);
    color: var(--coral);
}

/* Stats */
.stats-panel {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-light);
}

.stat-item {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    text-align: center;
    min-width: 100px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--coral);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* Quiz section */
.quiz-section {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.quiz-question {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.quiz-option {
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    font-size: 1rem;
    transition: all 0.2s;
}

.quiz-option:hover {
    border-color: var(--coral);
    background: rgba(232, 121, 121, 0.1);
}

.quiz-option.correct {
    border-color: var(--success);
    background: rgba(123, 196, 127, 0.15);
}

.quiz-option.incorrect {
    border-color: var(--error);
    background: rgba(232, 121, 121, 0.1);
}

/* Back button */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    margin-bottom: var(--space-lg);
    transition: all 0.2s;
}

.back-btn:hover {
    border-color: var(--coral);
    color: var(--coral);
}

/* Topic header */
.topic-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.topic-header-number {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--purple);
    letter-spacing: 2px;
    margin-bottom: var(--space-sm);
}

.topic-header-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.topic-header-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.7;
}

/* Canvas wrap */
.sim-canvas-wrap {
    width: 100%;
    height: 400px;
    background: var(--bg-deep);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--space-md);
    border: 1px solid var(--border-light);
}

/* ── FOOTER ─────────────────────────────────────────── */
footer {
    background: var(--bg-secondary);
    padding: var(--space-2xl) var(--space-lg);
    text-align: center;
    margin-top: var(--space-3xl);
    border-top: 1px solid var(--border-light);
}

.credits-logo {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-md);
}

.credits-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.credits-list {
    list-style: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.credits-note {
    margin-top: var(--space-md);
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* ── PUZZLE OVERLAY ─────────────────────────────── */
.puzzle-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 13, 20, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    animation: fadeIn 0.3s;
    backdrop-filter: blur(8px);
}

.puzzle-overlay.hidden {
    display: none;
}

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

.puzzle-inner {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    max-width: 520px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg), 0 0 60px rgba(232, 121, 121, 0.15);
    border: 1px solid var(--border-light);
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
    from { transform: translateY(40px) scale(0.95); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

.puzzle-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
}

.puzzle-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--success);
    margin-bottom: var(--space-sm);
}

.puzzle-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-xl);
}

.puzzle-btn {
    display: block;
    width: 100%;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    margin-top: var(--space-sm);
    transition: all 0.2s;
}

.puzzle-btn-primary {
    background: linear-gradient(135deg, var(--coral), var(--purple));
    color: white;
}

.puzzle-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(232, 121, 121, 0.4);
}

.puzzle-btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.puzzle-btn-secondary:hover {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
}

/* ── SUMMARY SCREEN ─────────────────────────────── */
.summary-screen {
    max-width: 550px;
}

.summary-icon {
    font-size: 5rem;
    margin-bottom: 16px;
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.summary-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--success);
    margin-bottom: 8px;
}

.summary-station {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.summary-learned {
    background: rgba(123, 196, 127, 0.1);
    border: 2px solid rgba(123, 196, 127, 0.3);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    text-align: left;
}

.summary-learned-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--success);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-learned p {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.7;
}

.summary-visual {
    margin-bottom: 20px;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.summary-theory-img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.summary-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.summary-btn-theory {
    background: linear-gradient(135deg, var(--coral), var(--purple));
    color: white;
    border: none;
}

.summary-btn-theory:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(232, 121, 121, 0.4);
}

/* ── THEORY PANEL ─────────────────────────────── */
.theory-panel {
    position: fixed;
    inset: 0;
    background: rgba(11, 13, 20, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    padding: 24px;
    backdrop-filter: blur(8px);
}

.theory-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid var(--border-light);
}

.theory-header {
    background: linear-gradient(135deg, var(--coral), var(--purple));
    color: white;
    padding: 20px 24px;
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.theory-title {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.theory-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.theory-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.theory-body {
    padding: 28px;
}

.theory-section {
    margin-bottom: 28px;
}

.theory-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.theory-section p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Theory visual image */
.theory-visual {
    margin: 20px 0;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.theory-img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

/* Equation box */
.theory-equation {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    margin: 20px 0;
    border: 1px solid var(--border-light);
}

.theory-equation code {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    color: var(--coral);
    display: block;
}

.theory-equation span {
    display: block;
    font-size: 0.9rem;
    color: var(--text-tertiary);
    margin-top: 8px;
}

/* Diagram placeholder */
.theory-diagram {
    background: linear-gradient(135deg, rgba(139, 107, 174, 0.1), rgba(212, 165, 116, 0.1));
    border-radius: var(--radius-md);
    padding: 28px;
    text-align: center;
    margin: 20px 0;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(139, 107, 174, 0.2);
}

.theory-diagram-placeholder {
    color: var(--purple);
    font-size: 0.95rem;
}

/* Applications list */
.theory-applications {
    background: rgba(123, 196, 127, 0.1);
    border: 1px solid rgba(123, 196, 127, 0.3);
    border-radius: var(--radius-md);
    padding: 20px;
}

.theory-applications h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.theory-applications ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.theory-applications li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.theory-applications li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 700;
}

/* ── GROVER / QUANTUM CORE PAGE ─────────────────── */
.core-page {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg);
}

.core-phase {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
}

.core-phase-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--purple);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: var(--space-md);
    text-align: center;
}

.grover-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.grover-item {
    background: var(--bg-secondary);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-lg) var(--space-md);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.grover-item:hover {
    border-color: var(--coral);
    transform: translateY(-2px);
}

.grover-item.target-selected,
.grover-item.target {
    border-color: var(--purple);
    background: rgba(139, 107, 174, 0.1);
}

.grover-item.winner,
.grover-item.found {
    border-color: var(--success);
    background: rgba(123, 196, 127, 0.15);
}

.grover-item.searched-classical {
    border-color: var(--offline);
    background: var(--bg-secondary);
    opacity: 0.75;
}

.grover-amp-bar {
    height: 80px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin-bottom: var(--space-sm);
}

.grover-amp-fill {
    width: 32px;
    background: linear-gradient(180deg, var(--coral), var(--purple));
    border-radius: 4px 4px 0 0;
    transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.grover-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.grover-vs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.grover-algo-box {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-xl);
    text-align: center;
    flex: 1;
    max-width: 180px;
    border: 1px solid var(--border-light);
}

.grover-algo-box.quantum {
    border-color: var(--coral);
    background: rgba(232, 121, 121, 0.1);
}

.grover-algo-box.classical {
    border-color: var(--offline);
}

.grover-algo-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.grover-algo-count {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
}

.grover-algo-unit {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.grover-vs-divider {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-tertiary);
}

/* Core insights */
.core-insight {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

.core-insight-item {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    opacity: 0.4;
    transition: all 0.3s;
}

.core-insight-item.lit {
    opacity: 1;
    background: rgba(139, 107, 174, 0.1);
    border-left: 3px solid var(--coral);
}

.core-insight-num {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--coral);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    padding-top: 2px;
}

.core-insight-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ── MOBILE RESPONSIVENESS ─────────────────────────────── */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-height: 48px;
    min-width: 48px;
}

.btn:active {
    transform: scale(0.97);
    transition: transform 100ms var(--ease-out, ease-out);
}

.slider {
    width: 100%;
    height: 48px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    outline: none;
    display: flex;
    align-items: center;
}

.slider::-webkit-slider-runnable-track {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--coral), var(--purple));
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(232, 121, 121, 0.4);
    margin-top: -10px;
    transition: transform 0.15s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.slider::-webkit-slider-thumb:active {
    transform: scale(0.95);
}

/* Mobile responsive station grid */
.station-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
    width: 100%;
    margin: 0 auto var(--space-2xl);
    max-width: 1000px;
}

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

@media (min-width: 1024px) {
    .station-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-lg);
    }
}

/* Mobile: simulation canvas */
.sim-canvas-wrap {
    width: 100%;
    height: 300px;
    background: var(--bg-deep);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--space-md);
}

@media (min-width: 640px) {
    .sim-canvas-wrap {
        height: 400px;
    }
}

/* Mobile: controls panel */
.controls-panel {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-light);
    margin-top: var(--space-md);
}

@media (min-width: 640px) {
    .controls-panel {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .controls-panel {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* Mobile: quantum core panel */
.quantum-core-panel {
    flex-direction: column;
    text-align: center;
    gap: var(--space-md);
    padding: var(--space-lg);
}

@media (min-width: 768px) {
    .quantum-core-panel {
        flex-direction: row;
        text-align: left;
        padding: var(--space-xl);
    }
}

/* Mobile: puzzle goal strip */
@media (max-width: 640px) {
.puzzle-goal-strip {
    flex-direction: column;
    text-align: center;
    gap: var(--space-sm);
    padding: var(--space-md);
}
}

/* Mobile: stats panel */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

@media (min-width: 640px) {
    .stats-panel {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-md);
    }
}

/* Mobile: quiz options */
.quiz-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

@media (min-width: 640px) {
    .quiz-options {
        display: flex;
        flex-direction: column;
        gap: var(--space-sm);
    }
}

/* Mobile: grover grid */
.grover-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

@media (min-width: 768px) {
    .grover-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--space-md);
    }
}

/* Mobile: grover vs */
.grover-vs {
    flex-direction: column;
    gap: var(--space-sm);
}

@media (min-width: 768px) {
    .grover-vs {
        flex-direction: row;
        align-items: center;
        gap: var(--space-lg);
    }
}

.grover-algo-box {
    max-width: 100%;
    width: 100%;
}

/* Mobile: theory panel full screen */
@media (max-width: 640px) {
    .theory-panel {
        padding: 0;
    }

    .theory-content {
        max-height: 100vh;
        border-radius: 0;
        height: 100vh;
    }

    .theory-header {
        border-radius: 0;
    }

    .theory-body {
        padding: var(--space-lg);
    }
}

/* Mobile: summary screen */
@media (max-width: 640px) {
    .puzzle-inner {
        padding: var(--space-lg);
        width: 95%;
    }

    .summary-actions {
        gap: var(--space-sm);
    }
}

/* ── ACCESSIBILITY ──────────────────────────────────────── */
*:focus-visible {
    outline: 2px solid var(--coral);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: linear-gradient(135deg, var(--coral), var(--purple));
    color: white;
    padding: 8px 16px;
    z-index: 9999;
    transition: top 0.2s;
    text-decoration: none;
    font-weight: 600;
}

.skip-link:focus {
    top: 0;
}

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

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .summary-icon {
        animation: none;
    }

    .station-card {
        transform: none !important;
    }

    .mission-progress-fill {
        transition: none;
    }

    .core-progress-bar {
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-light: #4A4B56;
        --text-primary: #FFFFFF;
        --text-secondary: #CCCCCC;
    }
}
