/* ==========================================================================
   Chapter 14 Simulation 04: Diode Rectification & Capacitor Filter Bench
   Theme: Academic Light Theme (Standards 1 to 24 Compliant)
   Color Palette:
     - Slate Base: #0f172a (Primary), #475569 (Secondary), #94a3b8 (Muted)
     - Surfaces: #f8fafc (App BG), #ffffff (Card Surface), #f1f5f9 (Subtle)
     - Borders: #e2e8f0 (Light), #cbd5e1 (Medium)
     - Gold/Amber Accent: #f59e0b (CH1 Input AC, Transformer, Attention)
     - Cyan/Teal Accent: #06b6d4, #0891b2 (CH2 Rectified DC, Filter Output)
     - Sky Accent: #0284c7 (Forward Conduction, Silicon Diode)
     - Emerald Accent: #059669 (Conduction Current, Efficiency)
     - Rose Accent: #dc2626 (Reverse Blocking, PIV)
   ========================================================================== */

:root {
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-subtle: #f8fafc;
    --bg-hover: #f1f5f9;
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --accent-sky: #0284c7;
    --accent-sky-dark: #0369a1;
    --accent-sky-light: #e0f2fe;

    --accent-emerald: #059669;
    --accent-emerald-dark: #047857;
    --accent-emerald-light: #d1fae5;

    --accent-amber: #d97706;
    --accent-amber-dark: #b45309;
    --accent-gold: #f59e0b;
    --accent-gold-light: #fef3c7;

    --accent-cyan: #0891b2;
    --accent-cyan-dark: #0e7490;
    --accent-cyan-light: #cffafe;

    --accent-rose: #dc2626;
    --accent-rose-dark: #b91c1c;
    --accent-rose-light: #fee2e2;

    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.03);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-full: 9999px;

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* --------------------------------------------------------------------------
   1. Universal Reset & Baseline
   -------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: 1.25rem 1rem 3rem;
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   2. Standard 4.1 Top Navigation Bar & Action Pill
   -------------------------------------------------------------------------- */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1.15rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.nav-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--accent-sky);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.15s ease;
}

.nav-home-btn:hover {
    color: var(--accent-sky-dark);
}

.nav-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-card-subtle);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-pill-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
}

.nav-dept-tag {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   3. Standard 22 Clean Header Architecture (Zero Badge Rows)
   -------------------------------------------------------------------------- */
.sim-header {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.75rem;
    box-shadow: var(--shadow-sm);
}

.sim-title {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 0.45rem;
}

.sim-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 1100px;
}

/* --------------------------------------------------------------------------
   4. Main Interactive Simulation Grid (Canvas-First)
   -------------------------------------------------------------------------- */
.sim-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(360px, 1fr);
    gap: 1.5rem;
    align-items: start;
    width: 100%;
}

.visualizer-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

/* Diagnostic Status Badge */
.status-banner {
    padding: 0.65rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.status-banner.conducting {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.status-banner.blocking {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.status-banner.filtering {
    background: #f0fdfa;
    border-color: #99f6e4;
    color: #115e59;
}

/* Telemetry Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow-sm);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}

/* Primary Canvas Viewport */
.viewport-wrapper {
    position: relative;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    aspect-ratio: 740 / 460;
    width: 100%;
}

#main-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: default;
}

/* Floating Viewport HUD Chips */
.viewport-hud-top {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    gap: 0.5rem;
}

.hud-chip {
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(4px);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
}

.hud-chip.mode-chip {
    background: rgba(15, 23, 42, 0.88);
    color: #ffffff;
    border-color: rgba(15, 23, 42, 0.95);
}

.hud-chip.status-indicator {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    border-left: 3px solid var(--accent-emerald);
}

/* Interactive Viewport Toolbar */
.viewport-toolbar {
    position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.4rem 0.65rem;
    box-shadow: var(--shadow-sm);
}

.tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.tool-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
}

.toolbar-divider {
    width: 1px;
    height: 18px;
    background: var(--border-medium);
}

.toolbar-caption {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   5. Dual-Trace Virtual Oscilloscope Panel
   -------------------------------------------------------------------------- */
.aux-visualizer-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.aux-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.aux-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.aux-icon {
    font-size: 1.1rem;
}

.aux-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.aux-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.legend-badge {
    font-size: 0.74rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
}

.legend-badge.ch1-badge {
    background: var(--accent-gold-light);
    color: var(--accent-amber-dark);
    border: 1px solid #fde68a;
}

.legend-badge.ch2-badge {
    background: var(--accent-cyan-light);
    color: var(--accent-cyan-dark);
    border: 1px solid #a5f3fc;
}

#aux-canvas {
    display: block;
    width: 100%;
    aspect-ratio: 740 / 180;
    height: auto;
    background: #0f172a;
    border-radius: var(--radius-md);
    touch-action: none;
}

/* --------------------------------------------------------------------------
   6. Predict-Observe-Explain (POE) Challenge Card
   -------------------------------------------------------------------------- */
.poe-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--accent-gold);
    border-radius: var(--radius-md);
    padding: 1.15rem 1.35rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.poe-badge {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-amber-dark);
    background: var(--accent-gold-light);
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    width: fit-content;
}

.poe-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.poe-prompt {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.poe-options {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin: 0.25rem 0;
}

.poe-option {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.85rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all 0.15s ease;
}

.poe-option:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
}

.poe-option input[type="radio"] {
    margin-top: 0.15rem;
    accent-color: var(--accent-amber);
    cursor: pointer;
}

.poe-actions {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.poe-btn {
    padding: 0.45rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
}

.poe-btn.check {
    background: var(--accent-amber);
    color: #ffffff;
}

.poe-btn.check:hover {
    background: var(--accent-amber-dark);
}

.poe-btn.reset {
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.poe-btn.reset:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.poe-feedback {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    line-height: 1.5;
}

.poe-feedback.correct {
    background: var(--accent-emerald-light);
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.poe-feedback.incorrect {
    background: var(--accent-rose-light);
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* --------------------------------------------------------------------------
   7. Right Column: Controls & Configuration Drawer
   -------------------------------------------------------------------------- */
.controls-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    min-width: 0;
}

.control-section {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1rem;
}

.control-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* Mode Tabs */
.mode-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.65rem;
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.tab-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-sky);
    border-color: var(--accent-sky);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.tab-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.08);
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.tab-btn.active .tab-num {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* Preset Pills */
.preset-pill-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
}

.preset-pill {
    padding: 0.45rem 0.55rem;
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.preset-pill:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.preset-pill.active {
    background: var(--accent-emerald-light);
    border-color: var(--accent-emerald);
    color: var(--accent-emerald-dark);
}

/* Slider Controls & Steppers */
.control-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.label-with-val {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.label-with-val label {
    font-weight: 600;
}

.val-display {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.stepper-composite {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.stepper-btn {
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.6rem;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    font-family: var(--font-mono);
}

.stepper-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

input[type="range"] {
    flex: 1;
    height: 6px;
    background: var(--border-light);
    border-radius: var(--radius-full);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-sky);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="range"]:focus-visible {
    outline: 2px solid var(--accent-sky);
    outline-offset: 2px;
}

/* Diode Model Pill Group */
.pill-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.choice-pill {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.55rem 0.75rem;
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.choice-pill:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
}

.choice-pill.active {
    background: #eff6ff;
    border-color: var(--accent-sky);
    box-shadow: var(--shadow-sm);
}

.choice-pill strong {
    font-size: 0.8rem;
    color: var(--text-primary);
}

.choice-pill small {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* Shunt Capacitor Toggle Switch */
.toggle-control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.65rem 0.85rem;
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}

.toggle-text-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.toggle-main-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.toggle-sub-label {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-switch {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-medium);
    transition: 0.25s;
    border-radius: 26px;
}

.slider-switch:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.25s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .slider-switch {
    background-color: var(--accent-emerald);
}

input:focus-visible + .slider-switch {
    outline: 2px solid var(--accent-sky);
    outline-offset: 2px;
}

input:checked + .slider-switch:before {
    transform: translateX(20px);
}

.tau-metric {
    font-size: 0.78rem;
    color: var(--text-secondary);
    padding: 0.35rem 0.6rem;
    background: var(--bg-card-subtle);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border-medium);
    margin-top: 0.25rem;
}

/* --------------------------------------------------------------------------
   8. Standard 7.4 Dedicated Full-Width Theory Section
   -------------------------------------------------------------------------- */
.concepts-box {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 2rem 2.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.section-heading {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.section-intro {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 1100px;
}

.theory-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.theory-card {
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.t-icon {
    font-size: 1.45rem;
}

.theory-card h3 {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary);
}

.theory-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.theory-points {
    padding-left: 1.15rem;
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.theory-points li {
    margin-bottom: 0.35rem;
}

.math-block {
    margin: 0.45rem 0;
    padding: 0.45rem 0.65rem;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.math-block mjx-container {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

/* --------------------------------------------------------------------------
   9. Standard 4.2 Series Overview Card
   -------------------------------------------------------------------------- */
.series-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.75rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.series-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.series-tagline {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--accent-sky-dark);
}

.series-card p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   10. Standard 4.3 Institutional Admission Callout Card
   -------------------------------------------------------------------------- */
.admission-card {
    background: linear-gradient(135deg, #1e3a8a, #0f172a);
    color: #ffffff;
    border-radius: var(--radius-lg);
    padding: 1.75rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(251, 191, 36, 0.4);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.attention-flash {
    animation: bannerGlowPulse 3s infinite ease-in-out;
}

@keyframes bannerGlowPulse {
    0% {
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        border-color: rgba(251, 191, 36, 0.3);
    }
    50% {
        box-shadow: 0 0 24px 6px rgba(251, 191, 36, 0.45);
        border-color: rgba(251, 191, 36, 0.85);
    }
    100% {
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        border-color: rgba(251, 191, 36, 0.3);
    }
}

.promo-kicker {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #fbbf24;
}

.promo-lead {
    font-size: 1.05rem;
    font-weight: 500;
    color: #e2e8f0;
}

.promo-headline {
    font-size: 1.45rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.25;
}

.program-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
}

.program-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    backdrop-filter: blur(4px);
}

.program-card strong {
    font-size: 1.05rem;
    color: #ffffff;
}

.program-card span {
    font-size: 0.82rem;
    color: #cbd5e1;
}

.program-card small {
    font-size: 0.74rem;
    color: #fbbf24;
    font-weight: 600;
}

.promo-actions {
    display: flex;
    gap: 0.85rem;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}

.promo-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.promo-button.main-cta {
    background: #fbbf24;
    color: #0f172a;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.35);
}

.promo-button.main-cta:hover {
    background: #f59e0b;
    transform: translateY(-1px);
}

.promo-button.sub-cta {
    background: transparent;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.promo-button.sub-cta:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* --------------------------------------------------------------------------
   11. Standard 4.4 Feedback & Suggestions Channel
   -------------------------------------------------------------------------- */
.feedback-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.feedback-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.feedback-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-sky-light);
    color: var(--accent-sky);
    flex-shrink: 0;
}

.feedback-text h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.feedback-text p {
    font-size: 0.84rem;
    color: var(--text-secondary);
}

.feedback-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-card-subtle);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    padding: 0.55rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.feedback-btn:hover {
    background: var(--accent-sky-light);
    border-color: var(--accent-sky);
    color: var(--accent-sky-dark);
}

/* --------------------------------------------------------------------------
   12. Standard 4.5 Standard Series Footer
   -------------------------------------------------------------------------- */
.series-footer {
    text-align: center;
    padding: 1.25rem 0.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    width: 100%;
    box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   13. Standard 4.2 & 19 Accessible Series Modal Dialog
   -------------------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.modal-window {
    position: relative;
    background: #ffffff;
    border-radius: var(--radius-lg);
    max-width: 760px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 10;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s ease;
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    flex: 1 1 auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Compact Admission Callout Card inside Modal (Standard 19: 100% visible) */
.modal-admission {
    flex-shrink: 0 !important;
    min-height: fit-content !important;
    height: auto !important;
    margin-top: 0.25rem;
    padding: 0.85rem 1.15rem !important;
    gap: 0.6rem !important;
    border-radius: var(--radius-md) !important;
}

.modal-admission .promo-copy {
    gap: 0.1rem;
}

.modal-admission .promo-kicker {
    font-size: 0.68rem;
    letter-spacing: 0.06em;
}

.modal-admission .promo-lead {
    font-size: 0.82rem;
    font-weight: 600;
}

.modal-admission .promo-headline {
    font-size: 1.05rem !important;
    line-height: 1.25 !important;
}

.modal-admission .program-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.55rem !important;
}

.modal-admission .program-card {
    padding: 0.5rem 0.75rem !important;
}

.modal-admission .program-card strong {
    font-size: 0.88rem !important;
}

.modal-admission .program-card span {
    font-size: 0.72rem !important;
}

.modal-admission .program-card small {
    font-size: 0.65rem !important;
}

.modal-admission .promo-actions {
    gap: 0.55rem !important;
    margin-top: 0.15rem !important;
}

.modal-admission .promo-button {
    padding: 0.4rem 1.1rem !important;
    font-size: 0.78rem !important;
}

.modal-series-card {
    padding: 0.85rem 1.15rem;
    gap: 0.45rem;
}

.modal-series-card h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-series-card p {
    font-size: 0.82rem;
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 0.85rem 1.5rem;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

.modal-dismiss-btn {
    padding: 0.45rem 1.25rem;
    border-radius: var(--radius-md);
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-medium);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal-dismiss-btn:hover {
    background: var(--bg-hover);
}

/* --------------------------------------------------------------------------
   14. Responsive Multi-Viewport Media Queries (Standard 17)
   -------------------------------------------------------------------------- */
/* Laptop Standard (max-width: 1300px) */
@media (max-width: 1300px) {
    .theory-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Tablet Screens (max-width: 960px) - Canvas First Ordering */
@media (max-width: 960px) {
    .sim-layout {
        grid-template-columns: 1fr;
    }

    .visualizer-panel {
        order: 1;
    }

    .controls-panel {
        order: 2;
    }

    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .mode-tabs {
        grid-template-columns: repeat(2, 1fr);
    }

    .theory-grid {
        grid-template-columns: 1fr;
    }

    .concepts-box {
        padding: 1.25rem 1.35rem;
    }
}

/* Mobile Screens (max-width: 600px) */
@media (max-width: 600px) {
    body {
        padding: 0.5rem 0.4rem 2rem;
    }

    .sim-header {
        padding: 1rem 1.15rem;
    }

    .sim-title {
        font-size: 1.45rem;
    }

    .mode-tabs {
        grid-template-columns: 1fr;
    }

    .tab-btn {
        padding: 0.5rem 0.35rem;
        font-size: 0.74rem;
    }

    /* Standard 21: Hide Mode Chip on Mobile */
    #hud-mode-chip {
        display: none !important;
    }

    .hud-chip.status-indicator {
        font-size: 0.68rem;
        padding: 0.2rem 0.55rem;
    }

    .top-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .nav-actions {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .stats-bar {
        grid-template-columns: 1fr 1fr;
        padding: 0.65rem 0.85rem;
        gap: 0.5rem;
    }

    .stat-value {
        font-size: 0.92rem;
    }

    .preset-pill-grid {
        grid-template-columns: 1fr;
    }

    .pill-group {
        grid-template-columns: 1fr;
    }

    .theory-grid {
        grid-template-columns: 1fr;
    }

    .concepts-box {
        padding: 1.25rem 1.15rem;
    }

    .program-grid {
        grid-template-columns: 1fr;
    }

    .admission-card {
        padding: 1.25rem 1.35rem;
    }

    /* Standard 19: Priority Admission in Modal on Mobile */
    .modal-overlay {
        padding: 0.65rem;
    }

    .modal-window {
        max-height: 90vh;
    }

    .modal-body {
        padding: 0.75rem 0.85rem;
        gap: 0.6rem;
    }

    .modal-admission {
        order: -1 !important;
        margin-top: 0 !important;
        margin-bottom: 0.5rem !important;
        padding: 0.75rem 0.85rem !important;
        gap: 0.45rem !important;
        height: auto !important;
        min-height: fit-content !important;
    }

    .modal-admission .program-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.35rem !important;
    }
}

/* Readouts, status lines and labels wrap instead of being cut off. */
.stat-label,
.stat-value {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

/* ==========================================================================
   2026-11 redesign: the controls' accent follows the hub's navy, as in the other labs (slider thumbs). Colour-coded
   readouts, curve keys and everything drawn on the canvases keep their colours.
   ========================================================================== */
input[type="range"]::-webkit-slider-thumb { background: #0B1329; }
input[type="range"]::-webkit-slider-thumb:hover { background: #1A2647; }
input[type="range"]::-moz-range-thumb { background: #0B1329; }


/* ==================== 3-MINUTE INVESTIGATION CARD (Standard 26) ==================== */
.c-mission-card {
  background: #ffffff;
  border: 1.5px solid #0284c7;
  border-radius: 16px;
  padding: 1rem 1.15rem;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.c-mission-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 50%, #f59e0b 100%);
}
.c-mission-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.c-mission-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.c-mission-icon { font-size: 1.1rem; }
.c-mission-title-wrap h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0b1329;
  margin: 0;
}
.c-mission-step-counter {
  font-size: 0.72rem;
  font-weight: 700;
  color: #0284c7;
  background: #e0f2fe;
  padding: 2px 7px;
  border-radius: 999px;
}
.c-mission-toggle-btn {
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.c-mission-toggle-btn:hover { background: #f1f5f9; color: #0b1329; }
.c-mission-card.is-collapsed .c-mission-chevron { transform: rotate(180deg); }
.c-mission-collapsed-summary {
  display: none;
  font-size: 0.82rem;
  color: #475569;
  cursor: pointer;
  padding: 0.2rem 0;
}
.c-mission-card.is-collapsed .c-mission-collapsed-summary { display: block; }
.c-mission-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.c-mission-card.is-collapsed .c-mission-body { display: none; }
.c-mission-steps-nav {
  display: flex;
  gap: 0.4rem;
  width: 100%;
}
.c-mission-step-btn {
  flex: 1;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 4px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.c-mission-step-btn.active {
  background: #e0f2fe;
  border-color: #0284c7;
  color: #0284c7;
}
.c-mission-step-btn.done {
  border-color: #10b981;
  color: #059669;
}
.c-step-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #fff;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.c-mission-step-btn.active .c-step-dot { background: #0284c7; }
.c-mission-step-btn.done .c-step-dot { background: #10b981; }
.c-mission-content-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.85rem;
}
.c-mission-meta-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}
.c-mission-type-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: #0284c7;
  text-transform: uppercase;
}
.c-mission-mode-indicator {
  font-size: 0.7rem;
  color: #64748b;
}
.c-mission-instruction {
  font-size: 0.84rem;
  line-height: 1.45;
  color: #1e293b;
  margin-bottom: 0.45rem;
}
.c-mission-observe {
  font-size: 0.82rem;
  line-height: 1.45;
  color: #475569;
  background: #ffffff;
  border-left: 3px solid #0284c7;
  padding: 0.45rem 0.65rem;
  border-radius: 0 6px 6px 0;
}
.c-mission-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.65rem;
}
.c-btn-mission-done {
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.c-btn-mission-done:hover { background: #0369a1; }
.c-mission-time-tag {
  font-size: 0.72rem;
  color: #94a3b8;
}
.c-mission-congrats {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}
.c-mission-congrats h4 {
  margin: 0 0 0.3rem 0;
  color: #065f46;
  font-size: 0.95rem;
}
.c-mission-congrats p {
  margin: 0 0 0.75rem 0;
  color: #047857;
  font-size: 0.82rem;
}
.c-btn-mission-restart {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}

/* ==================== PROGRESSIVE DISCLOSURE ACCORDIONS (Standard 27) ==================== */
.is-collapsible {
  background: #ffffff;
  border: 1px solid #E2E6EE;
  border-radius: 16px;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}
.is-collapsible:hover { border-color: #CBD5E1; }
.is-collapsible.is-open { box-shadow: 0 4px 14px rgba(11, 19, 41, 0.04); }
.accordion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.4rem;
  cursor: pointer;
  user-select: none;
  background: #ffffff;
  transition: background 0.15s;
}
.accordion-head:hover { background: #F8FAFC; }
.accordion-head-left {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}
.accordion-icon { font-size: 1.5rem; line-height: 1; flex: none; }
.accordion-title-wrap { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.accordion-head h2, .accordion-head h3 {
  font-family: var(--font-display, inherit);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-color, #0B1329);
  margin: 0;
  line-height: 1.25;
}
.accordion-subtext { font-size: 0.82rem; color: #64748B; display: block; }
.accordion-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  background: #F1F5F9;
  color: #334155;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  flex: none;
  pointer-events: none;
}
.accordion-head:hover .accordion-toggle-btn { background: #0B1329; color: #FFFFFF; border-color: #0B1329; }
.accordion-chevron { width: 16px; height: 16px; transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
.is-collapsible.is-open .accordion-chevron { transform: rotate(180deg); }
.accordion-content { padding: 1.25rem 1.4rem 1.4rem 1.4rem; border-top: 1px solid #F1F5F9; }
.accordion-content[hidden] { display: none !important; }
.poe-box { background: #F0F7FF; border-color: #BAE6FD; }
.poe-box .accordion-head { background: #F0F7FF; }
.poe-box .accordion-head:hover { background: #E0F2FE; }
.poe-box .accordion-head h3 { color: #0369A1; }
.poe-box .accordion-subtext { color: #0284C7; }
.poe-box .accordion-toggle-btn { background: #E0F2FE; color: #0369A1; border-color: #BAE6FD; }
.poe-box .accordion-head:hover .accordion-toggle-btn { background: #0284C7; color: #FFFFFF; border-color: #0284C7; }
