/* ==========================================================================
   p-n Junction Formation & Equilibrium Depletion Layer — Academic Light Theme
   Department of Physics, D B Pampa College, Parumala
   PlusTwo Physics Simulation Suite — Standards 1 through 24
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties & Academic Palette
   -------------------------------------------------------------------------- */
:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-subtle: #f1f5f9;
    --bg-hover: #e2e8f0;

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-inverse: #ffffff;

    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-strong: #94a3b8;

    --accent-sky: #0284c7;
    --accent-sky-dark: #0369a1;
    --accent-sky-light: rgba(2, 132, 199, 0.08);

    --accent-emerald: #059669;
    --accent-emerald-light: rgba(5, 150, 105, 0.08);

    --accent-amber: #d97706;
    --accent-amber-light: rgba(217, 119, 6, 0.08);

    --accent-rose: #dc2626;
    --accent-rose-light: rgba(220, 38, 38, 0.08);

    --accent-indigo: #4f46e5;

    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.1), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.05);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* --------------------------------------------------------------------------
   Reset & Base Layout
   -------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    padding: 0.75rem 0.75rem 2.5rem;
    min-height: 100vh;
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   2. Standard 4.1 Top Navigation Bar (With Right-Aligned nav-actions)
   -------------------------------------------------------------------------- */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1.15rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.nav-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--accent-sky);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.15s ease;
}

.nav-home-btn:hover {
    color: var(--accent-sky-dark);
}

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

.nav-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-card-subtle);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    padding: 0.35rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-pill-btn:hover {
    background: var(--accent-sky-light);
    border-color: var(--accent-sky);
    color: var(--accent-sky-dark);
}

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

/* --------------------------------------------------------------------------
   3. Standard 22 Clean Header Architecture (Zero Badge Rows)
   -------------------------------------------------------------------------- */
.sim-header {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.75rem;
    box-shadow: var(--shadow-sm);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.sim-title {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    line-height: 1.25;
    margin-bottom: 0.45rem;
}

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

/* --------------------------------------------------------------------------
   4. Main Interactive Simulation Layout (Grid / Flex)
   -------------------------------------------------------------------------- */
.sim-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(360px, 1fr);
    gap: 1.25rem;
    align-items: start;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   5. Visualizer Panel (Left Column)
   -------------------------------------------------------------------------- */
.visualizer-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Mode Selection Tabs */
.mode-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.tab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    text-align: center;
}

.tab-btn:hover {
    background: var(--bg-card-subtle);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-sky);
    border-color: var(--accent-sky-dark);
    color: var(--text-inverse);
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.3);
}

.tab-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.08);
    font-size: 0.72rem;
    font-weight: 700;
}

.tab-btn.active .tab-num {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   6. Viewport Wrapper & Main 2D Canvas
   -------------------------------------------------------------------------- */
.viewport-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 740 / 460;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    min-width: 0;
    box-sizing: border-box;
}

#main-canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

/* Viewport HUD Overlays */
.viewport-hud-top {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
    z-index: 5;
}

.hud-chip {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-full);
    padding: 0.3rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    backdrop-filter: blur(4px);
    box-shadow: var(--shadow-sm);
}

.hud-chip.status-indicator {
    background: rgba(2, 132, 199, 0.92);
    color: #ffffff;
    border-color: var(--accent-sky-dark);
}

/* Viewport Floating Toolbar */
.viewport-toolbar {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    display: flex;
    gap: 0.45rem;
    z-index: 5;
}

.v-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(4px);
    transition: all 0.15s ease;
}

.v-tool-btn:hover {
    background: #ffffff;
    border-color: var(--accent-sky);
    color: var(--accent-sky-dark);
}

.v-tool-btn.paused {
    background: rgba(217, 119, 6, 0.12);
    border-color: var(--accent-amber);
    color: var(--accent-amber);
}

/* --------------------------------------------------------------------------
   7. Live Telemetry Stats Bar
   -------------------------------------------------------------------------- */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.15rem;
    box-shadow: var(--shadow-sm);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.stat-label {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-value {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.highlight-sky { color: var(--accent-sky); }
.highlight-emerald { color: var(--accent-emerald); }
.highlight-amber { color: var(--accent-amber); }
.highlight-rose { color: var(--accent-rose); }

/* --------------------------------------------------------------------------
   8. Auxiliary Graph Panel
   -------------------------------------------------------------------------- */
.aux-graph-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.15rem 1rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

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

.aux-title {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-primary);
}

.aux-badge {
    font-size: 0.74rem;
    font-weight: 600;
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-light);
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    color: var(--text-muted);
}

#aux-canvas {
    width: 100%;
    height: 180px;
    display: block;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   9. Pedagogical Predict-Observe-Explain (POE) Card
   -------------------------------------------------------------------------- */
.poe-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--accent-amber);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.35rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

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

.poe-badge {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-amber);
}

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

.poe-prompt {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

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

.poe-option {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.6rem 0.85rem;
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.84rem;
    color: var(--text-primary);
    transition: all 0.15s ease;
}

.poe-option:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
}

.poe-option input[type="radio"] {
    margin-top: 0.25rem;
    cursor: pointer;
}

.option-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--border-medium);
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-primary);
    flex-shrink: 0;
}

.poe-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}

.poe-btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.poe-btn.primary {
    background: var(--accent-amber);
    color: #ffffff;
    border: 1px solid #b45309;
}

.poe-btn.primary:hover {
    background: #b45309;
}

.poe-btn.secondary {
    background: var(--bg-card-subtle);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.poe-btn.secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

.feedback-correct {
    background: rgba(5, 150, 105, 0.1);
    border: 1px solid var(--accent-emerald);
    color: #065f46;
}

.feedback-incorrect {
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid var(--accent-rose);
    color: #991b1b;
}

/* --------------------------------------------------------------------------
   10. Controls Panel (Right Column)
   -------------------------------------------------------------------------- */
.controls-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

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

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

.group-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.control-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

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

.control-label {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.label-with-val {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.val-display {
    color: var(--accent-sky);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Stepper Composite Layout */
.stepper-composite {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stepper-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.stepper-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
}

input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--border-light);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    background: var(--accent-sky);
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: transform 0.1s ease;
}

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

/* Pill Selection Groups */
.pill-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
}

.preset-pill {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.55rem 0.75rem;
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
}

.preset-pill strong {
    font-size: 0.82rem;
    color: var(--text-primary);
}

.preset-pill small {
    font-size: 0.72rem;
    color: var(--text-muted);
}

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

.preset-pill.active {
    background: rgba(2, 132, 199, 0.08);
    border-color: var(--accent-sky);
}

.preset-pill.active strong {
    color: var(--accent-sky-dark);
}

/* Physics Insight Card inside Controls */
.physics-card {
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.p-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.84rem;
    color: var(--text-primary);
}

.p-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

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

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

.p-val {
    font-size: 0.92rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.p-verdict {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
    border-top: 1px solid var(--border-light);
    padding-top: 0.5rem;
}

/* --------------------------------------------------------------------------
   11. Standard 7.4 Dedicated Full-Width Theory Section (Option A Layout)
   -------------------------------------------------------------------------- */
.concepts-box {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.75rem 2rem;
    box-shadow: var(--shadow-sm);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.section-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--accent-sky);
    padding-bottom: 0.45rem;
    display: inline-block;
}

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

.theory-card {
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

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

.theory-card h3 {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary);
}

.theory-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.theory-points {
    padding-left: 1.15rem;
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.theory-points li {
    margin-bottom: 0.35rem;
}

.math-block {
    margin: 0.45rem 0;
    padding: 0.45rem 0.65rem;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.math-block mjx-container {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

/* --------------------------------------------------------------------------
   12. Standard 4.2 Series Overview Card
   -------------------------------------------------------------------------- */
.series-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.75rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.series-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.series-tagline {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--accent-sky-dark);
}

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

/* --------------------------------------------------------------------------
   13. Standard 4.3 Institutional Admission Callout Card
   -------------------------------------------------------------------------- */
.admission-card {
    background: linear-gradient(135deg, #1e3a8a, #0f172a);
    color: #ffffff;
    border-radius: var(--radius-lg);
    padding: 1.75rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(251, 191, 36, 0.4);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

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

@keyframes bannerGlowPulse {
    0% {
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        border-color: rgba(251, 191, 36, 0.3);
    }
    50% {
        box-shadow: 0 0 24px 6px rgba(251, 191, 36, 0.45);
        border-color: rgba(251, 191, 36, 0.85);
    }
    100% {
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        border-color: rgba(251, 191, 36, 0.3);
    }
}

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

.promo-lead {
    font-size: 1.05rem;
    font-weight: 500;
    color: #e2e8f0;
}

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

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

.program-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    backdrop-filter: blur(4px);
}

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

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

.program-card small {
    font-size: 0.74rem;
    color: #fbbf24;
    font-weight: 600;
}

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

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

.promo-button.main-cta {
    background: #fbbf24;
    color: #0f172a;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.promo-button.main-cta:hover {
    background: #f59e0b;
    transform: translateY(-1px);
}

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

.promo-button.sub-cta:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   14. Standard 4.4 Feedback Channel & Standard 4.5 Footer
   -------------------------------------------------------------------------- */
.feedback-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.15rem;
    box-shadow: var(--shadow-sm);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.feedback-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
}

.feedback-content h3 {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.feedback-content p {
    font-size: 0.84rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.feedback-link {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--accent-sky);
    text-decoration: none;
}

.feedback-link:hover {
    text-decoration: underline;
}

.sim-footer {
    text-align: center;
    padding: 1.25rem 0.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   15. Standard 11 MathJax Dynamic Lifecycle & Dual-Rule CSS
   -------------------------------------------------------------------------- */
.math-display,
.mjx-chtml[display="true"],
mjx-container[display="true"] {
    overflow-x: auto !important;
    max-width: 100% !important;
    display: block !important;
    padding: 0.2rem 0;
}

.mjx-chtml:not([display="true"]),
mjx-container:not([display="true"]) {
    white-space: nowrap !important;
}

/* --------------------------------------------------------------------------
   16. Standard 4.2 & 19 Accessible Series Modal Dialog (Anti-Squash Rules)
   -------------------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.modal-window {
    position: relative;
    background: #ffffff;
    border-radius: var(--radius-lg);
    max-width: 760px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 10;
    overflow: hidden;
}

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

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

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

.modal-close-btn:hover {
    color: var(--text-primary);
}

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

/* Compact Admission Callout Card inside Modal (Standard 19: 100% visible) */
.modal-admission {
    flex-shrink: 0 !important;
    min-height: fit-content !important;
    height: auto !important;
    margin-top: 0.25rem;
    padding: 0.85rem 1.15rem !important;
    gap: 0.6rem !important;
    border-radius: var(--radius-md) !important;
}

.modal-admission .promo-copy {
    gap: 0.1rem;
}

.modal-admission .promo-kicker {
    font-size: 0.68rem;
    letter-spacing: 0.06em;
}

.modal-admission .promo-lead {
    font-size: 0.82rem;
    font-weight: 600;
}

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

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

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

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

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

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

.modal-admission .promo-button {
    padding: 0.4rem 1.1rem !important;
    font-size: 0.8rem !important;
}

.modal-series-card {
    box-shadow: none !important;
    border: 1px solid var(--border-light) !important;
    padding: 1.15rem 1.35rem !important;
    background: var(--bg-card-subtle);
    border-radius: var(--radius-md);
}

.modal-series-card h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 0.85rem 1.5rem;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
    background: var(--bg-card-subtle);
}

.modal-dismiss-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.45rem 1.15rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

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

/* --------------------------------------------------------------------------
   17. Responsive Multi-Viewport Media Queries
   -------------------------------------------------------------------------- */
/* Laptop Standard (max-width: 1300px) */
@media (max-width: 1300px) {
    .theory-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Tablet Screens (max-width: 900px) - Canvas First Ordering */
@media (max-width: 900px) {
    .sim-layout {
        grid-template-columns: 1fr;
    }

    .visualizer-panel {
        order: 1;
    }

    .controls-panel {
        order: 2;
    }

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

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

    .theory-grid {
        grid-template-columns: 1fr;
    }

    .concepts-box {
        padding: 1.25rem 1.35rem;
    }
}

/* Mobile Screens (max-width: 600px) */
@media (max-width: 600px) {
    body {
        padding: 0.5rem 0.4rem 2rem;
    }

    .sim-header {
        padding: 1rem 1.15rem;
    }

    .sim-title {
        font-size: 1.45rem;
    }

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

    .tab-btn {
        padding: 0.5rem 0.35rem;
        font-size: 0.74rem;
    }

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

    .hud-chip.status-indicator {
        font-size: 0.68rem;
        padding: 0.2rem 0.55rem;
    }

    .top-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .nav-actions {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .stats-bar {
        grid-template-columns: 1fr 1fr;
        padding: 0.65rem 0.85rem;
        gap: 0.5rem;
    }

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

    .pill-group {
        grid-template-columns: 1fr;
    }

    .p-metrics {
        grid-template-columns: 1fr;
    }

    .theory-grid {
        grid-template-columns: 1fr;
    }

    .concepts-box {
        padding: 1.25rem 1.15rem;
    }

    .program-grid {
        grid-template-columns: 1fr;
    }

    .admission-card {
        padding: 1.25rem 1.35rem;
    }

    /* Standard 19: Priority Admission in Modal on Mobile */
    .modal-overlay {
        padding: 0.65rem;
    }

    .modal-window {
        max-height: 90vh;
    }

    .modal-body {
        padding: 0.75rem 0.85rem;
        gap: 0.6rem;
    }

    .modal-admission {
        order: -1 !important;
        margin-top: 0 !important;
        margin-bottom: 0.5rem !important;
        padding: 0.75rem 0.85rem !important;
        gap: 0.45rem !important;
        height: auto !important;
        min-height: fit-content !important;
    }

    .modal-admission .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;
    }
}
