/* ==========================================================================
   PlusPhysics: Higher Secondary Physics Simulation Suite
   Chapter 13 &bull; Simulation 01: Nuclear Size, Composition & Density Bench
   Department of Physics, D B Pampa College, Parumala
   ========================================================================== */

/* ==========================================================================
   1. Master Design Tokens & Core Variables
   ========================================================================== */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: rgba(37, 99, 235, 0.12);
    --secondary-color: #0284c7;
    --accent-color: #06b6d4;
    --accent-amber: #f59e0b;
    --accent-gold: #fbbf24;
    --accent-emerald: #10b981;
    --accent-rose: #f43f5e;
    --accent-purple: #8b5cf6;

    --proton-color: #ef4444;
    --neutron-color: #06b6d4;

    --bg-page: #0b0f19;
    --bg-card: #111827;
    --bg-surface: #1e293b;
    --bg-surface-elevated: #334155;
    --bg-canvas: #060911;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-medium: rgba(255, 255, 255, 0.16);
    --border-accent: rgba(37, 99, 235, 0.4);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 22px;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 24px rgba(37, 99, 235, 0.35);

    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'SF Mono', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}

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

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 1340px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem 3.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

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

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

.nav-home-btn:hover {
    color: #ffffff;
}

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

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

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

.nav-pill-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

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

/* ==========================================================================
   3. Series Modal Dialog (Standard 4.1 & 19: Viewport Fit & Option A Priority)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.modal-window {
    position: relative;
    z-index: 10000;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
    width: 100%;
    max-width: 680px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
}

.modal-close-btn:hover {
    color: #ffffff;
}

.modal-body {
    flex: 1 1 auto;
    padding: 1.15rem 1.4rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.modal-body p {
    color: #cbd5e1;
    font-size: 0.92rem;
    line-height: 1.5;
}

.modal-body .series-tagline {
    font-style: italic;
    color: #93c5fd;
    font-weight: 500;
    font-size: 0.96rem;
}

/* Modal Admission Card (Standard 19: Strict Anti-Squash & Compact) */
.modal-admission {
    flex-shrink: 0 !important;
    min-height: fit-content !important;
    height: auto !important;
    margin: 0.4rem 0 !important;
    padding: 0.85rem 1.15rem !important;
    gap: 0.55rem !important;
    box-shadow: 0 0 16px rgba(251, 191, 36, 0.35) !important;
}

.modal-admission .promo-kicker {
    font-size: 0.72rem;
}

.modal-admission .promo-lead {
    font-size: 0.9rem;
}

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

.modal-admission .program-grid {
    grid-template-columns: repeat(2, minmax(0, 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: #0f172a;
}

.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: Zero Header Badge Rows)
   ========================================================================== */
.sim-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sim-title {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
    line-height: 1.2;
}

.sim-subtitle {
    font-size: 0.98rem;
    color: var(--text-secondary);
    max-width: 1080px;
    line-height: 1.55;
}

/* ==========================================================================
   5. Mode Navigation Tabs (Standard 17)
   ========================================================================== */
.mode-tabs-wrapper {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
    background: var(--bg-card);
    padding: 0.45rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    min-width: 0;
}

.mode-tab {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.18s ease;
    user-select: none;
    min-width: 0;
}

.mode-tab:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.04);
}

.mode-tab.active {
    background: var(--bg-surface);
    border-color: var(--border-accent);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.tab-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    flex-shrink: 0;
}

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

.tab-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   6. Main Dual-Column Simulation Layout (Option A)
   ========================================================================== */
.sim-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(340px, 1fr);
    gap: 1.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: grab;
}

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

/* 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;
    pointer-events: none;
    z-index: 10;
}

.hud-chip {
    padding: 0.28rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.hud-chip.mode-indicator {
    background: rgba(15, 23, 42, 0.75);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.35);
}

.hud-chip.status-indicator {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.35);
}

/* Live Telemetry Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.9rem;
    min-width: 0;
}

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

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

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

.stat-value.highlight {
    color: #38bdf8;
}

.stat-value.highlight-emerald {
    color: #10b981;
}

/* Secondary Auxiliary Viewport */
.aux-viewport-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
}

.aux-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.aux-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.aux-badge {
    font-size: 0.70rem;
    font-family: var(--font-mono);
    padding: 0.15rem 0.45rem;
    background: var(--bg-surface);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 4px;
}

#aux-canvas {
    width: 100%;
    height: 130px;
    display: block;
    background: var(--bg-canvas);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 4px;
}

/* 6B. Controls Column */
.controls-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.controls-header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

.control-badge {
    align-self: flex-start;
    font-size: 0.68rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--primary-light);
    color: #60a5fa;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-weight: 600;
}

.controls-header h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
}

.mode-control-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

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

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.val-display {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: #38bdf8;
    font-weight: 600;
}

/* Stepper Slider Layout (Standard 12) */
.stepper-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step-btn {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

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

.step-btn:active {
    transform: scale(0.95);
}

input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--bg-surface);
    border-radius: 4px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #38bdf8;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
    transition: transform 0.1s ease;
}

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

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: #38bdf8;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

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

.preset-pill {
    padding: 0.4rem 0.6rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preset-pill:hover {
    background: var(--bg-surface-elevated);
    color: #ffffff;
    border-color: var(--border-medium);
}

.preset-pill.active {
    background: var(--primary-light);
    color: #60a5fa;
    border-color: var(--primary-color);
    font-weight: 600;
}

/* Visual Layer Toggles Grid */
.toggles-grid {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.65rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.toggle-chip {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.toggle-chip input[type="checkbox"] {
    accent-color: var(--primary-color);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.toggle-chip span {
    font-weight: 500;
}

/* Physics Cards */
.physics-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-width: 0;
}

.p-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: #ffffff;
}

.p-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem 0.65rem;
    border-radius: var(--radius-sm);
}

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

.p-label {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.p-val {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: #38bdf8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.p-val.highlight-emerald {
    color: #10b981;
}

.p-verdict {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

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

/* Invariant Density Banner Box (Mode 3) */
.density-badge-box {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    text-align: center;
}

.density-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #10b981;
}

.density-stat {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 800;
    color: #a7f3d0;
}

.density-sub {
    font-size: 0.72rem;
    color: #cbd5e1;
}

/* Global Runtime Controls */
.global-runtime-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
}

.runtime-buttons-row {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 0.5rem;
}

.btn-runtime {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

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

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

.btn-runtime.secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.btn-runtime.secondary:hover {
    background: var(--bg-surface-elevated);
}

.speed-control-row {
    gap: 0.25rem;
}

/* ==========================================================================
   7. Predict-Observe-Explain (POE) Pedagogical Card (Standard 12)
   ========================================================================== */
.poe-card {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-width: 0;
}

.poe-header {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.poe-badge {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    border: 1px solid rgba(139, 92, 246, 0.4);
}

.poe-header h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
}

.poe-question {
    font-size: 0.86rem;
    color: #e2e8f0;
    line-height: 1.5;
}

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

.poe-option {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.55rem 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.poe-option:hover {
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.08);
}

.poe-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.poe-radio-custom {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 2px solid var(--text-muted);
    margin-top: 0.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.poe-option input[type="radio"]:checked + .poe-radio-custom {
    border-color: #a78bfa;
    background: #a78bfa;
    box-shadow: 0 0 6px #8b5cf6;
}

.poe-option-text {
    font-size: 0.80rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.poe-option input[type="radio"]:checked ~ .poe-option-text {
    color: #ffffff;
}

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

.poe-check-btn, .poe-reset-btn {
    padding: 0.45rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}

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

.poe-check-btn:hover {
    background: #7c3aed;
}

.poe-reset-btn {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}

.poe-feedback {
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    line-height: 1.5;
    background: rgba(0, 0, 0, 0.4);
    border-left: 3px solid transparent;
}

.poe-feedback.correct {
    border-color: #10b981;
    color: #a7f3d0;
}

.poe-feedback.incorrect {
    border-color: #f43f5e;
    color: #fecdd3;
}

/* ==========================================================================
   8. Deep Pedagogical Theory Cards (6 Foundation Cards)
   ========================================================================== */
.theory-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    min-width: 0;
}

.theory-header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.section-badge {
    align-self: flex-start;
    font-size: 0.70rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--primary-light);
    color: #60a5fa;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-weight: 600;
}

.theory-header h2 {
    font-size: 1.45rem;
    font-weight: 800;
    color: #ffffff;
}

.theory-header p {
    font-size: 0.92rem;
    color: var(--text-secondary);
}

.theory-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    min-width: 0;
    max-width: 100%;
}

.theory-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
    min-width: 0;
    max-width: 100%;
    overflow-wrap: break-word;
    box-sizing: border-box;
}

.card-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.theory-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
}

.theory-card p {
    font-size: 0.88rem;
    color: #cbd5e1;
    line-height: 1.6;
    overflow-wrap: break-word;
}

.theory-card ul {
    margin-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.88rem;
    color: #cbd5e1;
}

.math-display {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    margin: 0.35rem 0;
    text-align: center;
    overflow-x: auto;
    max-width: 100%;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   9. Series Card (Standard 4.2: Full Static Context)
   ========================================================================== */
.series-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-width: 0;
}

.series-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
}

.series-tagline {
    font-style: italic;
    color: #93c5fd;
    font-size: 0.95rem;
    font-weight: 500;
}

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

/* ==========================================================================
   10. Institutional Admission Card (Standard 4.3: High-Contrast Dark Gradient)
   ========================================================================== */
.admission-card {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.attention-flash {
    animation: bannerGlowPulse 3s infinite ease-in-out;
}

@keyframes bannerGlowPulse {
    0% {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
        border-color: rgba(251, 191, 36, 0.3);
    }
    50% {
        box-shadow: 0 0 22px 5px rgba(251, 191, 36, 0.45);
        border-color: rgba(251, 191, 36, 0.7);
    }
    100% {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
        border-color: rgba(251, 191, 36, 0.3);
    }
}

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

.promo-kicker {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fbbf24;
}

.promo-lead {
    font-size: 0.95rem;
    color: #93c5fd;
    font-weight: 500;
}

.promo-headline {
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
}

.program-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.program-card {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

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

.program-card span {
    font-size: 0.76rem;
    color: #cbd5e1;
}

.program-card small {
    font-size: 0.72rem;
    color: #fde68a;
    font-weight: 500;
}

.promo-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

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

.promo-button.main-cta {
    background: #fbbf24;
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
}

.promo-button.main-cta:hover {
    background: #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-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
    min-width: 0;
}

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

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

.feedback-text h4 {
    font-size: 0.96rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.15rem;
}

.feedback-text p {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.feedback-btn {
    padding: 0.55rem 1.15rem;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.15s ease;
}

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

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

/* ==========================================================================
   13. MathJax Dual-Rule Architecture (Standard 11: No Line-Jumping)
   ========================================================================== */
mjx-container:not([display="true"]) {
    display: inline-block !important;
    margin: 0 0.15em !important;
    vertical-align: -0.15em !important;
    line-height: 0 !important;
}

mjx-container[display="true"] {
    display: block !important;
    margin: 0.5em 0 !important;
    text-align: center !important;
    overflow-x: auto !important;
    max-width: 100% !important;
}

/* ==========================================================================
   14. Responsive Breakpoints & Option A Mobile Layout
   ========================================================================== */
@media (max-width: 1080px) {
    .mode-tabs-wrapper {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .sim-layout {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    /* Option A Mobile Visualizer Priority */
    .visualizer-panel {
        order: 1;
        min-width: 0;
    }

    .controls-panel {
        order: 2;
        min-width: 0;
    }

    .theory-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        min-width: 0;
    }

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

    .feedback-btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 0.75rem 0.85rem 2.5rem;
        gap: 1.15rem;
        min-width: 0;
        max-width: 100%;
        overflow-x: hidden;
    }

    .sim-title {
        font-size: 1.45rem;
        overflow-wrap: break-word;
    }

    .sim-subtitle {
        font-size: 0.88rem;
        overflow-wrap: break-word;
    }

    .mode-tabs-wrapper {
        grid-template-columns: minmax(0, 1fr);
        padding: 0.35rem;
        gap: 0.4rem;
        min-width: 0;
    }

    .mode-tab {
        padding: 0.5rem 0.65rem;
        font-size: 0.82rem;
        min-width: 0;
    }

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

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

    .stats-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.55rem;
    }

    .stat-label {
        font-size: 0.68rem;
    }

    .stat-value {
        font-size: 0.88rem;
    }

    /* Standard 19: Modal Option A Mobile Priority */
    .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, minmax(0, 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;
    }

    .program-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .promo-actions {
        flex-direction: column;
        width: 100%;
    }

    .promo-button {
        width: 100%;
    }
}

@media (max-width: 360px) {
    .container {
        padding: 0.5rem;
    }

    .nav-dept-tag {
        display: none;
    }

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

    .p-metrics {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Readouts, status lines and labels wrap instead of being cut off. */
.stat-label,
.stat-value,
.preset-pill,
.p-val {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}
.preset-pill { line-height: 1.25; height: auto; }
