/*
 * Nuclear Fission, Chain Reaction & Thermonuclear Fusion
 * PlusPhysics — Interactive Nuclear Physics Laboratory (Academic Light Theme)
 *
 * Department of Physics, D B Pampa College, Parumala
 * Dr. Ajith S Kumar (ajithsalimkumar@gmail.com)
 *
 * Standards Compliant: Standards 1 to 24 (Option A Responsive & Light Theme)
 */

/* ==========================================================================
   1. CSS VARIABLES & THEME DEFINITION (ACADEMIC LIGHT THEME)
   ========================================================================== */
:root {
    --bg-main: #f8fafc;           /* Clean soft light slate background */
    --bg-panel: #ffffff;          /* Crisp pure white panel */
    --bg-card: #f8fafc;           /* Subtle card background */
    --bg-card-hover: #f1f5f9;
    --bg-input: #ffffff;

    --border-subtle: #e2e8f0;      /* Soft elegant border */
    --border-focus: #0284c7;       /* Royal sky blue */
    --border-accent: #6366f1;

    --text-primary: #0f172a;       /* Deep slate / navy text */
    --text-secondary: #475569;     /* Medium slate text */
    --text-muted: #64748b;         /* Muted caption text */

    --accent-emerald: #059669;     /* Critical state emerald green */
    --accent-sky: #0284c7;         /* High-contrast royal sky */
    --accent-crimson: #dc2626;     /* Supercritical crimson / Coulomb barrier */
    --accent-amber: #d97706;       /* Fission energy amber */
    --accent-purple: #7c3aed;      /* Fusion & gamma violet */

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    --shadow-panel: 0 4px 20px rgba(15, 23, 42, 0.06);
    --shadow-card: 0 2px 10px rgba(15, 23, 42, 0.04);
}

/* ==========================================================================
   2. GLOBAL RESET & BASE STYLES
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* MathJax Dual-Rule Architecture (Standard 11) */
.math-display,
.formula-block {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    max-width: 100% !important;
    margin: 0.85rem 0;
    padding: 0.65rem 0.85rem;
    background: #f1f5f9;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    box-sizing: border-box;
}

.math-display mjx-container,
.formula-block mjx-container,
mjx-container[display="true"] {
    display: block !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    margin: 0.4rem auto !important;
    text-align: center;
}

mjx-container:not([display="true"]) {
    display: inline-block !important;
    max-width: 100% !important;
    overflow: visible !important;
    margin: 0 0.12em !important;
    vertical-align: -0.15em !important;
    line-height: 0;
    color: var(--text-primary);
}

mjx-container svg {
    max-width: 100% !important;
    height: auto !important;
    display: inline-block;
    vertical-align: middle;
}

mjx-assistive-mml {
    clip: rect(1px, 1px, 1px, 1px) !important;
    user-select: none !important;
    position: absolute !important;
    padding: 0 !important;
    border: 0 !important;
    height: 1px !important;
    width: 1px !important;
    max-width: 1px !important;
    overflow: hidden !important;
}

/* ==========================================================================
   3. TOP NAVIGATION BAR (STANDARD 4.1)
   ========================================================================== */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    gap: 1rem;
    box-shadow: var(--shadow-panel);
}

.nav-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-sky);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    transition: color 0.2s, transform 0.2s;
}

.nav-home-btn:hover {
    color: var(--text-primary);
    transform: translateX(-2px);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-pill-btn {
    background: rgba(2, 132, 199, 0.08);
    border: 1px solid rgba(2, 132, 199, 0.25);
    color: var(--accent-sky);
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.nav-pill-btn:hover {
    background: rgba(2, 132, 199, 0.16);
    border-color: var(--accent-sky);
    transform: translateY(-1px);
}

.nav-dept-tag {
    font-size: 0.82rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* ==========================================================================
   4. MODAL DIALOG & OPTION A ADMISSION CALLOUT (STANDARD 4.1 & 19)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(6px);
}

.modal-window {
    position: relative;
    z-index: 10000;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    max-width: 640px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
    font-size: 1.15rem;
    color: var(--text-primary);
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    touch-action: manipulation;
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.65;
}

.series-tagline {
    font-weight: 600;
    color: var(--accent-sky);
    font-size: 1.05rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
}

.btn-modal-dismiss {
    background: #0284c7;
    color: #ffffff;
    border: none;
    padding: 0.55rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.2s;
}

.btn-modal-dismiss:hover {
    background: #0369a1;
}

/* ==========================================================================
   5. SIMULATION HEADER (STANDARD 22: CLEAN HEADER ARCHITECTURE)
   ========================================================================== */
.sim-header {
    margin-bottom: 1.5rem;
}

.sim-title {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
    line-height: 1.25;
}

.sim-subtitle {
    font-size: 0.98rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 1080px;
}

/* ==========================================================================
   6. MASTER WORKSPACE CONTAINER & TABS (STANDARD 17)
   ========================================================================== */
.container, .sim-container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-sizing: border-box;
}

.mode-tabs-wrapper {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.65rem;
    background: var(--bg-panel);
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
}

@media (max-width: 1080px) {
    .mode-tabs-wrapper {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
@media (max-width: 768px) {
    .mode-tabs-wrapper {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 480px) {
    .mode-tabs-wrapper {
        grid-template-columns: 1fr;
    }
}

.fiss-preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
.fiss-stages-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.35rem;
}
.fiss-stages-grid button {
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 34px;
    padding: 0.35rem 0.2rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: #f8fafc;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}
.fiss-stages-grid button:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}
.fiss-stages-grid button.active {
    background: #e0f2fe;
    border-color: #0284c7;
    color: #0369a1;
    font-weight: 700;
}
@media (max-width: 768px) {
    .fiss-stages-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 480px) {
    .fiss-preset-grid {
        grid-template-columns: 1fr;
    }
    .fiss-stages-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.mode-tab {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 0.65rem 0.95rem;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: all 0.2s ease;
    touch-action: manipulation;
    min-height: 48px;
    min-width: 0;
}

.mode-tab:hover {
    background: #f1f5f9;
}

.mode-tab.active {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.tab-index {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    background: #e2e8f0;
    color: var(--text-secondary);
    padding: 0.2rem 0.45rem;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.mode-tab.active .tab-index {
    background: #0284c7;
    color: #ffffff;
}

.tab-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mode-tab.active .tab-title {
    color: var(--text-primary);
    font-weight: 700;
}

/* ==========================================================================
   5. DUAL-COLUMN LAYOUT & OPTION A RESPONSIVE GRID
   ========================================================================== */
.sim-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.visualizer-panel, .controls-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

/* ==========================================================================
   6. 3D WEBGL VIEWPORT & FLOATING HUD OVERLAYS
   ========================================================================== */
.viewport-wrapper {
    position: relative;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-panel);
    overflow: hidden;
    aspect-ratio: 740 / 460;
    width: 100%;
}

#webgl-canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    cursor: grab;
}

#webgl-canvas:active {
    cursor: grabbing;
}

.viewport-hud-overlay {
    position: absolute;
    top: 0.85rem;
    left: 0.85rem;
    right: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
    z-index: 10;
}

.hud-chip {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 0.35rem 0.8rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}

.hud-chip.mode-indicator {
    border-color: #bae6fd;
    color: #0369a1;
}

.hud-chip.status-indicator {
    border-color: #bbf7d0;
    color: #15803d;
}

.viewport-hint {
    position: absolute;
    bottom: 0.65rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(4px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 0.25rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    pointer-events: none;
    white-space: nowrap;
}

.viewport-toolbar {
    position: absolute;
    bottom: 0.65rem;
    right: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    z-index: 10;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
    transition: all 0.2s ease;
    touch-action: manipulation;
    min-height: 34px;
}

.toolbar-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.toolbar-btn:active {
    transform: translateY(0);
}

/* ==========================================================================
   7. LIVE INVARIANT TELEMETRY STATS BAR
   ========================================================================== */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem;
    box-shadow: var(--shadow-card);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.stat-value.highlight { color: #0284c7; }
.stat-value.highlight-emerald { color: #059669; }
.stat-value.highlight-amber { color: #d97706; }
.stat-value.highlight-crimson { color: #dc2626; }

/* ==========================================================================
   8. SECONDARY AUXILIARY VIEWPORT
   ========================================================================== */
.aux-viewport-wrapper {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.aux-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.aux-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
}

.aux-badge {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    background: #f1f5f9;
    border: 1px solid var(--border-subtle);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

#aux-canvas {
    width: 100%;
    height: 130px;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    display: block;
}

/* ==========================================================================
   9. INTERACTIVE CONTROLS & PHYSICS CARDS
   ========================================================================== */
.controls-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-panel);
}

.controls-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
}

.control-badge {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-sky);
}

.controls-header h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Control Row with Steppers */
.control-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.label-row label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.val-display {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: #0284c7;
}

.stepper-container {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.stepper-container input[type="range"] {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: var(--radius-full);
    outline: none;
    -webkit-appearance: none;
    accent-color: var(--accent-sky);
}

.step-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    background: #f1f5f9;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.step-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.step-btn:active {
    transform: scale(0.96);
}

/* Preset Pills Grid */
.preset-pill-grid, .fusion-step-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.preset-pill {
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.4rem;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    touch-action: manipulation;
    min-height: 40px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.25;
}

.preset-pill small {
    font-size: 0.72rem;
    opacity: 0.85;
}

.preset-pill:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.preset-pill.active {
    background: #0284c7;
    border-color: #0284c7;
    color: #ffffff;
    font-weight: 700;
}

.preset-pill.active span,
.preset-pill.active small {
    color: #ffffff !important;
}

/* Mode 2 Criticality Presets Distinct High-Contrast Colors */
[data-snap-k="subcritical"].active {
    background: #0284c7 !important;
    border-color: #0369a1 !important;
    color: #ffffff !important;
}
[data-snap-k="subcritical"].active span,
[data-snap-k="subcritical"].active small {
    color: #ffffff !important;
}

[data-snap-k="critical"].active {
    background: #16a34a !important;
    border-color: #15803d !important;
    color: #ffffff !important;
}
[data-snap-k="critical"].active span,
[data-snap-k="critical"].active small {
    color: #ffffff !important;
}

[data-snap-k="supercritical"].active {
    background: #dc2626 !important;
    border-color: #b91c1c !important;
    color: #ffffff !important;
}
[data-snap-k="supercritical"].active span,
[data-snap-k="supercritical"].active small {
    color: #ffffff !important;
}

/* Action Buttons */
.action-btn-row {
    margin-bottom: 1rem;
}

.btn-action {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.btn-action.primary {
    background: #0284c7;
    border: 1px solid #0369a1;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.2);
}

.btn-action.primary:hover {
    background: #0369a1;
    transform: translateY(-1px);
}

.btn-action.danger {
    background: #dc2626;
    border: 1px solid #b91c1c;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
    letter-spacing: 0.02em;
}

.btn-action.danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

/* Physics Cards */
.physics-card {
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.p-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.p-icon {
    font-size: 1.1rem;
}

.p-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem;
}

.p-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.82rem;
}

.p-label {
    color: var(--text-secondary);
}

.p-val {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--text-primary);
}

.p-verdict {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.55;
    border-top: 1px solid var(--border-subtle);
    padding-top: 0.65rem;
}

.control-hint {
    display: block;
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin-bottom: 1rem;
}

/* ==========================================================================
   10. GLOBAL SIMULATION RUNTIME CONTROLS
   ========================================================================== */
.global-runtime-controls {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 0.95rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.runtime-buttons-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 0.65rem;
}

.btn-runtime {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.btn-runtime.primary {
    background: #0f172a;
    border: 1px solid #0f172a;
    color: #ffffff;
}

.btn-runtime.primary:hover {
    background: #1e293b;
}

.btn-runtime.primary.paused {
    background: #0284c7;
    border-color: #0369a1;
}

.btn-runtime.secondary {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: var(--text-primary);
}

.btn-runtime.secondary:hover {
    background: #f8fafc;
}

/* ==========================================================================
   11. PREDICT-OBSERVE-EXPLAIN (POE) CHALLENGE CARD (STANDARD 12)
   ========================================================================== */
.poe-card {
    background: #ffffff;
    border: 1px solid #bae6fd;
    border-radius: var(--radius-md);
    padding: 1.15rem;
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.poe-header {
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
}

.poe-badge {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: #e0f2fe;
    color: #0369a1;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
}

.poe-header h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.poe-question {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.5;
}

.poe-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.poe-option {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.poe-option:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.poe-option input[type="radio"] {
    margin-top: 0.15rem;
    accent-color: var(--accent-sky);
}

.poe-option .opt-label strong {
    color: #0284c7;
    margin-right: 0.25rem;
}

.poe-btn-row {
    display: flex;
    gap: 0.65rem;
    margin-top: 0.25rem;
}

.btn-poe-check, .btn-poe-reset {
    min-height: 40px;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.btn-poe-check {
    background: #0284c7;
    border: 1px solid #0369a1;
    color: #ffffff;
    flex: 1;
}

.btn-poe-check:hover {
    background: #0369a1;
}

/* The POE card spans the full page width below </main>: keep the submit button button-sized on wide screens */
@media (min-width: 901px) {
    .btn-poe-check {
        flex: 0 1 auto;
        min-width: 220px;
    }
}

.btn-poe-reset {
    background: #f1f5f9;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.btn-poe-reset:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

.poe-feedback {
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    font-size: 0.82rem;
    line-height: 1.55;
    animation: fadeIn 0.25s ease-out;
}

.poe-feedback.feedback-correct {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.poe-feedback.feedback-incorrect {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.poe-feedback.feedback-neutral {
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   10. DEEP PEDAGOGICAL THEORY SECTION (STANDARD 7.4 OPTION A)
   ========================================================================== */
.concepts-box {
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    border-top: 1px solid var(--border-subtle);
    padding-top: 2rem;
}

.concepts-header {
    text-align: center;
    max-width: 820px;
    margin: 0 auto 2rem auto;
}

.concepts-header h2 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin: 0.4rem 0 0.6rem 0;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.concepts-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.theory-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    min-width: 0;
}

.theory-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: var(--shadow-panel);
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.card-icon {
    font-size: 1.8rem;
}

.theory-card h3 {
    font-size: 1.15rem;
    color: var(--text-primary);
    line-height: 1.35;
    font-weight: 700;
}

.theory-card p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.6;
}

.theory-card ul, .theory-card ol {
    padding-left: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.theory-card strong {
    color: var(--text-primary);
}

/* ==========================================================================
   11. SERIES CARD (STANDARD 4.2)
   ========================================================================== */
.series-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.4rem 1.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-panel);
}

.series-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.series-card p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

/* ==========================================================================
   12. INSTITUTIONAL ADMISSION CARD (STANDARD 4.3)
   ========================================================================== */
.admission-card {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1.5px solid #f59e0b;
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.15);
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.modal-admission {
    margin-bottom: 0.85rem;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.12);
}

.attention-flash {
    animation: bannerGlowPulse 3s infinite ease-in-out;
}

@keyframes bannerGlowPulse {
    0% {
        box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15);
        border-color: rgba(245, 158, 11, 0.4);
    }
    50% {
        box-shadow: 0 0 25px 6px rgba(245, 158, 11, 0.35);
        border-color: rgba(217, 119, 6, 0.85);
    }
    100% {
        box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15);
        border-color: rgba(245, 158, 11, 0.4);
    }
}

.promo-copy {
    display: flex;
    flex-direction: column;
}

.promo-kicker {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #b45309;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.promo-lead {
    font-size: 0.92rem;
    color: #78350f;
}

.promo-headline {
    font-size: 1.2rem;
    font-weight: 700;
    color: #451a03;
    margin-bottom: 0.85rem;
}

.program-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
    min-width: 0;
}

.program-card {
    background: #ffffff;
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    box-shadow: 0 1px 4px rgba(245, 158, 11, 0.08);
}

.program-card strong {
    color: #1e293b;
    font-size: 0.92rem;
}

.program-card span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.program-card small {
    font-size: 0.7rem;
    color: #d97706;
    font-weight: 600;
}

.promo-actions {
    display: flex;
    gap: 0.75rem;
}

.promo-button {
    flex: 1;
    text-align: center;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.promo-button.main-cta {
    background: #d97706;
    color: #ffffff;
}

.promo-button.main-cta:hover {
    background: #b45309;
    transform: translateY(-1px);
}

.promo-button.sub-cta {
    background: #ffffff;
    color: #92400e;
    border: 1px solid #d97706;
}

.promo-button.sub-cta:hover {
    background: #fef3c7;
}

/* ==========================================================================
   13. FEEDBACK CARD & FOOTER (STANDARD 4.4 & 4.5)
   ========================================================================== */
.feedback-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-panel);
}

.feedback-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.feedback-icon {
    color: var(--accent-sky);
    flex-shrink: 0;
}

.feedback-text h4 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.feedback-text p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.feedback-btn {
    background: rgba(2, 132, 199, 0.08);
    border: 1px solid rgba(2, 132, 199, 0.25);
    color: var(--accent-sky);
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.feedback-btn:hover {
    background: rgba(2, 132, 199, 0.18);
    border-color: var(--accent-sky);
}

.series-footer {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* ==========================================================================
   14. RESPONSIVE MEDIA QUERIES (OPTION A PRIORITY)
   ========================================================================== */
@media (max-width: 1200px) {
    .mode-tabs-wrapper {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* OPTION A: On screens <= 900px, visualizer first (order: 1), controls second (order: 2) */
@media (max-width: 900px) {
    .sim-layout {
        grid-template-columns: 1fr;
    }

    .visualizer-panel {
        order: 1;
    }

    .controls-panel {
        order: 2;
    }

    .theory-grid {
        grid-template-columns: 1fr;
    }

    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .feedback-card {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Standard 21: Mobile Mode Chip Hidden on Mobile Viewports */
@media (max-width: 768px) {
    .nav-dept-tag {
        display: none;
    }

    #hud-mode-chip {
        display: none !important;
    }

    .viewport-hint {
        display: none;
    }

    .preset-pill-grid, .fusion-step-grid {
        grid-template-columns: 1fr;
    }

    .runtime-buttons-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .container, .sim-container {
        padding: 0.85rem 0.85rem;
    }

    .sim-title {
        font-size: 1.6rem;
    }

    .sim-subtitle {
        font-size: 0.88rem;
    }

    .top-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }

    .nav-actions {
        width: 100%;
        justify-content: space-between;
    }

    .mode-tabs-wrapper {
        grid-template-columns: 1fr;
    }

    .stats-bar {
        grid-template-columns: 1fr;
    }

    /* Standard 19 Option A Mobile Modal Priority */
    .modal-admission {
        order: -1 !important;
        flex-shrink: 0 !important;
        min-height: fit-content !important;
        height: auto !important;
        margin-bottom: 0.75rem;
    }

    .program-grid {
        grid-template-columns: 1fr;
    }

    .promo-actions {
        flex-direction: column;
    }
}

/* ==========================================================================
   2026-11 redesign: the controls' accent follows the hub's navy, as in the other labs (the dialog button, the mode chip, the section label, the slider value, slider accent, the main action button, the resume button, the check-answer button). Colour-coded
   readouts, curve keys and everything drawn on the canvases keep their colours.
   ========================================================================== */
.btn-modal-dismiss { background: #0B1329; }
.btn-modal-dismiss:hover { background: #1A2647; }
.hud-chip.mode-indicator { color: #0B1329; }
.control-badge { color: #1A2647; }
.val-display { color: #0B1329; }
.stepper-container input[type="range"] { accent-color: #0B1329; }
.btn-action.primary { background: #0B1329; border: 1px solid #0B1329; box-shadow: 0 2px 8px rgba(11, 19, 41, 0.2); }
.btn-action.primary:hover { background: #1A2647; }
.btn-runtime.primary.paused { background: #0B1329; border-color: #0B1329; }
.btn-poe-check { background: #0B1329; border-color: #0B1329; }
.btn-poe-check:hover { background: #1A2647; }


/* ==================== 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; }
