/* ==========================================================================
   PlusPhysics: Higher Secondary Physics Simulation Suite
   Chapter 12, Simulation 04: De Broglie Matter Waves & Standing Atomic Orbits
   Department of Physics, D B Pampa College, Parumala
   ========================================================================== */

/* 1. Global Reset & Theme Variables */
:root {
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --bg-canvas: #070b14;
    --border-subtle: #e2e8f0;
    --border-strong: #cbd5e1;
    --text-main: #0f172a;
    --text-sub: #475569;
    --text-muted: #64748b;
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-violet: #8b5cf6;
    --accent-rose: #f43f5e;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
    background-color: var(--bg-page);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.container {
    max-width: 1380px;
    margin: 0 auto;
    padding: 1.5rem 2rem 4rem;
    min-width: 0;
}

/* ==========================================================================
   2. Top Navigation Bar (Standard 4.1)
   ========================================================================== */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.65rem 1.25rem;
    margin-bottom: 1.35rem;
    box-shadow: var(--shadow-sm);
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.92rem;
    text-decoration: none;
    transition: color 0.15s ease;
}

.nav-home-btn:hover {
    color: var(--primary-hover);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.nav-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #f1f5f9;
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    border-radius: 9999px;
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-pill-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.nav-dept-tag {
    font-size: 0.82rem;
    color: var(--text-sub);
    font-weight: 500;
}

/* ==========================================================================
   3. Series Modal Dialog (Standard 4.1 & 19: Viewport Fit & Isolation)
   ========================================================================== */
.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(4px);
}

.modal-window {
    position: relative;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
    max-width: 680px;
    width: 100%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
}

.modal-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    background: #f8fafc;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease;
}

.modal-close-btn:hover {
    color: var(--text-main);
    background: #e2e8f0;
}

.modal-body {
    flex: 1 1 auto;
    padding: 0.85rem 1.25rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    font-size: 0.85rem;
    color: var(--text-sub);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.series-tagline {
    font-weight: 700;
    color: var(--primary-color);
}

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

.modal-admission .promo-headline {
    font-size: 1.05rem;
    line-height: 1.2;
}

.modal-admission .program-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem;
}

.modal-admission .program-card {
    padding: 0.55rem 0.75rem;
    gap: 0.2rem;
    height: auto;
}

.modal-admission .program-card strong {
    font-size: 0.88rem;
}

.modal-admission .program-card span {
    font-size: 0.72rem;
}

.modal-admission .program-card small {
    font-size: 0.68rem;
}

.modal-admission .promo-actions {
    margin-top: 0.25rem;
    gap: 0.6rem;
}

.modal-admission .promo-button {
    padding: 0.45rem 1.15rem;
    font-size: 0.8rem;
}

.modal-footer {
    flex-shrink: 0;
    padding: 0.6rem 1.25rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    background: #f8fafc;
}

.btn-modal-dismiss {
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 0.45rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-modal-dismiss:hover {
    background: var(--primary-hover);
}

/* ==========================================================================
   4. Clean Simulation Header (Standard 22: Clean Header Architecture)
   ========================================================================== */
.sim-header {
    margin-bottom: 1.35rem;
}

.sim-title {
    font-size: clamp(1.5rem, 2.8vw, 2.15rem);
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.025em;
    line-height: 1.2;
    margin-bottom: 0.45rem;
}

.sim-subtitle {
    font-size: 0.95rem;
    color: var(--text-sub);
    line-height: 1.6;
    max-width: 1050px;
}

/* ==========================================================================
   5. Mode Navigation Tabs (Standard 17)
   ========================================================================== */
.mode-tabs-wrapper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.65rem;
    margin-bottom: 1.35rem;
}

.mode-tab {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    box-shadow: var(--shadow-sm);
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 52px;
}

.mode-tab:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.mode-tab.active {
    background: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2), var(--shadow-sm);
}

.tab-index {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
}

.mode-tab.active .tab-index {
    background: var(--primary-color);
    color: #ffffff;
}

.tab-title {
    font-weight: 700;
    font-size: 0.86rem;
    color: var(--text-main);
    line-height: 1.25;
}

/* ==========================================================================
   6. Main Dual-Column Simulation Layout (Option A)
   ========================================================================== */
.sim-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(360px, 1fr);
    gap: 1.35rem;
    margin-bottom: 2.5rem;
    align-items: start;
}

/* 6A. Visualizer Column */
.visualizer-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.viewport-wrapper {
    position: relative;
    background: var(--bg-canvas);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    aspect-ratio: 740 / 460;
    width: 100%;
}

#main-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: default;
}

#main-canvas:active {
    cursor: default;
}

/* Standard 21: Floating HUD Chips & Overlay Container */
.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 {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.28rem 0.65rem;
    border-radius: 6px;
    backdrop-filter: blur(8px);
}

.hud-chip.mode-indicator {
    background: rgba(15, 23, 42, 0.78);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.hud-chip.status-indicator {
    background: rgba(15, 23, 42, 0.78);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Live Telemetry Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.65rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.95rem;
    box-shadow: var(--shadow-sm);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-value.highlight {
    color: var(--primary-color);
}

/* Secondary Auxiliary Viewport */
.aux-viewport-wrapper {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow-sm);
    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.78rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: 0.01em;
}

.aux-badge {
    font-size: 0.68rem;
    font-weight: 700;
    background: #f1f5f9;
    color: var(--text-muted);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

#aux-canvas {
    width: 100%;
    height: 120px;
    display: block;
    background: #090e17;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* 6B. Controls Column */
.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    min-width: 0;
}

.control-group {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.35rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.group-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.group-icon {
    font-size: 1.2rem;
}

.group-title h4 {
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--text-main);
}

.control-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.84rem;
}

.label-row label {
    font-weight: 700;
    color: var(--text-main);
}

.param-value {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.84rem;
    color: var(--primary-color);
}

.param-value.alert {
    color: var(--accent-rose);
}

/* Composite Slider & Stepper Container */
.slider-stepper-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stepper-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.15s ease;
}

.stepper-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.stepper-btn:active {
    transform: scale(0.96);
}

input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #e2e8f0;
    border-radius: 9999px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.18);
}

/* Preset Pills Grid */
.preset-pill-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem;
}

.preset-pill {
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.4rem;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-sub);
    cursor: pointer;
    text-align: center;
    touch-action: manipulation;
    transition: all 0.15s ease;
}

.preset-pill:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.preset-pill.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 800;
}

/* Checkbox Toggle Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-sub);
    cursor: pointer;
    user-select: none;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkbox-indicator {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border-strong);
    border-radius: 4px;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.custom-checkbox input:checked ~ .checkbox-indicator {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.custom-checkbox input:checked ~ .checkbox-indicator::after {
    content: "✓";
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 800;
}

.control-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
}

/* Coherence Meter Box */
.coherence-meter-box {
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem 0.95rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.meter-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.meter-title {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-main);
}

.meter-value {
    font-family: var(--font-mono);
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--accent-rose);
}

.meter-track {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 9999px;
    overflow: hidden;
}

.meter-bar {
    height: 100%;
    background: linear-gradient(90deg, #f43f5e, #10b981);
    transition: width 0.2s ease, background 0.2s ease;
}

.meter-verdict {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--accent-rose);
    line-height: 1.35;
}

/* Uncertainty Principle Card */
.uncertainty-card {
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem 0.95rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.u-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: var(--text-main);
}

.u-metrics {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.u-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
}

.u-label {
    color: var(--text-sub);
    font-weight: 600;
}

.u-val {
    font-family: var(--font-mono);
    font-weight: 800;
    color: var(--primary-color);
}

/* Global Runtime Buttons */
.action-buttons {
    display: flex;
    gap: 0.65rem;
}

.btn-primary, .btn-secondary {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.15s ease;
    border: none;
}

.btn-primary {
    background: var(--primary-color);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

/* ==========================================================================
   7. Predict-Observe-Explain (POE) Pedagogical Card
   ========================================================================== */
.poe-container {
    background: #ffffff;
    border: 1px solid #bfdbfe;
    border-top: 3.5px solid var(--primary-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.35rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.poe-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.poe-badge {
    align-self: flex-start;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-color);
    background: var(--primary-light);
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
}

.poe-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
}

.poe-question {
    font-size: 0.88rem;
    color: var(--text-main);
    line-height: 1.55;
    font-weight: 600;
}

.poe-options {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.poe-option {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.75rem;
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-main);
    transition: all 0.15s ease;
}

.poe-option:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.poe-option input {
    position: absolute;
    opacity: 0;
}

.poe-opt-indicator {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border-strong);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.poe-option input:checked ~ .poe-opt-indicator {
    border-color: var(--primary-color);
    background: var(--primary-color);
    box-shadow: inset 0 0 0 3px #ffffff;
}

.poe-actions {
    display: flex;
    gap: 0.65rem;
}

.btn-poe-check, .btn-poe-reset {
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.84rem;
    cursor: pointer;
    touch-action: manipulation;
    border: none;
    transition: all 0.15s ease;
}

.btn-poe-check {
    background: var(--primary-color);
    color: #ffffff;
}

.btn-poe-check:hover {
    background: var(--primary-hover);
}

.btn-poe-reset {
    background: #f1f5f9;
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
}

.poe-feedback {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    line-height: 1.55;
}

.poe-feedback.correct {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.poe-feedback.incorrect {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #9f1239;
}

/* ==========================================================================
   8. Deep Pedagogical Theory Cards (6 Foundation Cards)
   ========================================================================== */
.concepts-box {
    margin-top: 1rem;
    margin-bottom: 2.5rem;
}

.section-heading {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 1.15rem;
    letter-spacing: -0.015em;
}

.theory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 1.35rem;
    min-width: 0;
}

.theory-card {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.35rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
    min-width: 0;
    overflow-wrap: break-word;
}

.card-icon {
    font-size: 1.45rem;
}

.theory-card h3 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.3;
}

.theory-card p {
    font-size: 0.86rem;
    color: var(--text-sub);
    line-height: 1.58;
}

.theory-card ul, .theory-card ol {
    margin-left: 1.25rem;
    font-size: 0.86rem;
    color: var(--text-sub);
    line-height: 1.55;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.math-display {
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    margin: 0.35rem 0;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    font-size: 0.92rem;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0.35rem 0;
}

.theory-table {
    width: 100%;
    min-width: 440px;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.theory-table th, .theory-table td {
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border-subtle);
    text-align: left;
}

.theory-table th {
    background: #f1f5f9;
    color: var(--text-main);
    font-weight: 800;
}

.theory-table td {
    color: var(--text-sub);
}

/* ==========================================================================
   9. Series Card (Standard 4.2: Full Static Context, No Simulation Links)
   ========================================================================== */
.series-card {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.75rem 2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.series-card h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
}

.series-card p {
    font-size: 0.92rem;
    color: var(--text-sub);
    line-height: 1.6;
}

/* ==========================================================================
   10. Institutional Admission Card (Standard 4.3: Dark Gradient & Pulsing Gold Border)
   ========================================================================== */
.admission-card.attention-flash {
    position: relative;
    border-radius: var(--radius-lg);
    padding: 2.2rem 2rem;
    background: radial-gradient(circle at 85% 15%, rgba(245, 158, 11, 0.18) 0%, transparent 45%),
                linear-gradient(135deg, #090e17 0%, #0f172a 50%, #1e293b 100%);
    color: #f8fafc;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow: hidden;
    animation: goldPulseBorder 3.5s infinite ease-in-out;
    margin-bottom: 2rem;
}

@keyframes goldPulseBorder {
    0%, 100% {
        border: 2px solid rgba(245, 158, 11, 0.45);
        box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.4), 0 0 15px rgba(245, 158, 11, 0.2);
    }
    50% {
        border: 2px solid rgba(245, 158, 11, 0.95);
        box-shadow: 0 15px 35px -5px rgba(15, 23, 42, 0.6), 0 0 25px rgba(245, 158, 11, 0.45);
    }
}

.promo-copy {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.promo-kicker {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #f59e0b;
}

.promo-lead {
    font-size: 1.1rem;
    font-weight: 600;
    color: #cbd5e1;
}

.promo-headline {
    font-size: clamp(1.4rem, 2.4vw, 1.85rem);
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.program-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.program-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.program-card strong {
    font-size: 1.05rem;
    color: #ffffff;
}

.program-card span {
    font-size: 0.82rem;
    color: #94a3b8;
}

.program-card small {
    font-size: 0.74rem;
    color: #f59e0b;
    font-weight: 700;
    margin-top: 0.25rem;
}

.promo-actions {
    display: flex;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.promo-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.45rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.15s ease;
}

.promo-button.main-cta {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #0f172a;
    font-weight: 800;
}

.promo-button.main-cta:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    transform: translateY(-1px);
}

.promo-button.sub-cta {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.promo-button.sub-cta:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* ==========================================================================
   11. Feedback Card (Standard 4.4)
   ========================================================================== */
.feedback-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.4rem 1.75rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.feedback-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 750px;
}

.feedback-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.feedback-text h4 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.feedback-text p {
    font-size: 0.86rem;
    color: var(--text-sub);
}

.feedback-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--bg-surface);
    color: var(--primary-color);
    border: 1.5px solid var(--primary-color);
    border-radius: var(--radius-sm);
    padding: 0.55rem 1.15rem;
    font-weight: 700;
    font-size: 0.86rem;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.feedback-btn:hover {
    background: var(--primary-light);
}

/* ==========================================================================
   12. Standard Series Footer (Standard 4.5)
   ========================================================================== */
.series-footer {
    padding: 1.75rem 0 1rem;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.84rem;
}

/* ==========================================================================
   13. MathJax Dual-Rule Architecture (Standard 11: No Line-Jumping)
   ========================================================================== */
.math-display mjx-container,
mjx-container[display="true"] {
    display: block !important;
    max-width: 100% !important;
    overflow-x: auto !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;
    vertical-align: -0.15em !important;
    line-height: 0;
}

mjx-container svg {
    max-width: 100% !important;
    height: auto !important;
    display: inline-block;
}

/* ==========================================================================
   14. Responsive Breakpoints & Option A Mobile Layout
   ========================================================================== */
@media (max-width: 1024px) {
    .sim-layout {
        grid-template-columns: 1fr;
    }

    .visualizer-panel {
        order: 1;
    }

    .controls-panel {
        order: 2;
    }

    .mode-tabs-wrapper {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1.25rem 1.25rem 3rem;
    }

    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .feedback-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .feedback-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Standard 21, 19, & 14 Mobile Protections */
@media (max-width: 600px) {
    /* Standard 19 Option A: Priority Admission Placement, Flexible Height & Smooth Modal Scroll */
    .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 .promo-kicker {
        font-size: 0.65rem !important;
    }

    .modal-admission .promo-lead {
        font-size: 0.82rem !important;
    }

    .modal-admission .promo-headline {
        font-size: 0.95rem !important;
        line-height: 1.2 !important;
    }

    .modal-admission .program-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.35rem !important;
    }

    .modal-admission .program-card {
        padding: 0.38rem 0.5rem !important;
        gap: 0.15rem !important;
        height: auto !important;
    }

    .modal-admission .program-card strong {
        font-size: 0.78rem !important;
    }

    .modal-admission .program-card span,
    .modal-admission .program-card small {
        font-size: 0.62rem !important;
        line-height: 1.25 !important;
    }

    .modal-admission .promo-actions {
        margin-top: 0.25rem !important;
        gap: 0.45rem !important;
    }

    .modal-admission .promo-button {
        padding: 0.38rem 0.85rem !important;
        font-size: 0.76rem !important;
    }

    /* Standard 21: Hide Redundant HUD Mode Chip on Mobile */
    #hud-mode-chip {
        display: none !important;
    }

    .hud-chip.status-indicator {
        font-size: 0.68rem;
        padding: 0.18rem 0.45rem;
        margin-left: auto;
    }

    .container {
        padding: 1.15rem 0.85rem;
    }

    .theory-card {
        padding: 1.1rem 0.95rem;
    }

    .mode-tabs-wrapper {
        grid-template-columns: 1fr;
    }

    .top-nav {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-actions {
        justify-content: space-between;
    }

    .stats-bar {
        grid-template-columns: 1fr;
    }

    .preset-pill-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .slider-stepper-container {
        flex-wrap: wrap;
    }

    .slider-stepper-container input[type="range"] {
        order: 3;
        width: 100%;
        flex: auto;
    }
}

/* Readouts, status lines and labels wrap instead of being cut off. */
.stat-label,
.stat-value {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}
