/*
 * 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(4, minmax(0, 1fr));
    gap: 0.75rem;
    background: var(--bg-panel);
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
}

.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: #e0f2fe;
    border-color: #0284c7;
    color: #0369a1;
    font-weight: 700;
}

/* 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;
    }
}
