/* ==========================================================================
   Bohr Atom & Planetary Orbit Radiative Instability — Stylesheet
   Chapter 12 Simulation 02 | PlusPhysics Suite
   Department of Physics, D B Pampa College, Parumala
   Option A Responsive Architecture, Standard Light Shell with Dark Viewport
   ========================================================================== */

/* --- CSS Root Variables & Design Tokens (Standard Light Shell) --- */
:root {
    --primary-color: #0284c7;
    --primary-hover: #0369a1;
    --primary-light: #e0f2fe;
    --primary-border: #bae6fd;
    --accent-color: #f59e0b;
    --accent-hover: #d97706;
    --accent-light: #fef3c7;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-dark: #040813;
    --text-main: #0f172a;
    --text-sub: #334155;
    --text-muted: #64748b;
    --border-color: #cbd5e1;
    --border-subtle: #e2e8f0;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.07);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.55;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Master Container */
.container {
    width: 100%;
    max-width: 1380px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem 3.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

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

.nav-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.92rem;
    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-sub);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 0.35rem 0.8rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
    touch-action: manipulation;
}

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

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

/* ==========================================================================
   2. Series Modal Dialog (Standard 4.1 & 19: Pure Overview & Compact Admit Card)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
}

.modal-window {
    position: relative;
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 760px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10001;
    animation: modalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

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

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

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    transition: all 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;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    font-size: 0.85rem;
    color: var(--text-sub);
    line-height: 1.5;
}

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

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

.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;
    display: flex;
    justify-content: flex-end;
    padding: 0.65rem 1.25rem;
    border-top: 1px solid var(--border-subtle);
    background: #f8fafc;
}

.btn-modal-dismiss {
    padding: 0.4rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-sub);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

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

/* ==========================================================================
   3. Header Section
   ========================================================================== */
.sim-header {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.header-badge-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
}

.chapter-badge {
    background: #e0f2fe;
    color: var(--primary-hover);
    border: 1px solid var(--primary-border);
}

.lab-badge {
    background: #fef3c7;
    color: var(--accent-hover);
    border: 1px solid #fde68a;
}

.status-pill {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.sim-title {
    font-size: clamp(1.45rem, 2.8vw, 2.2rem);
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
    letter-spacing: -0.015em;
}

.sim-subtitle {
    font-size: clamp(0.88rem, 1.4vw, 1.02rem);
    color: var(--text-sub);
    line-height: 1.55;
    max-width: 1050px;
}

/* ==========================================================================
   4. Mode Tabs Bar
   ========================================================================== */
.mode-tabs-wrapper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.65rem;
    width: 100%;
}

.mode-tab {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    color: var(--text-sub);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
    touch-action: manipulation;
}

.mode-tab:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: var(--text-main);
}

.mode-tab.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-hover);
    font-weight: 700;
    box-shadow: 0 0 0 1px var(--primary-color);
}

.tab-index {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--primary-color);
    background: #ffffff;
    padding: 0.18rem 0.45rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--primary-border);
}

.tab-title {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.25;
}

/* ==========================================================================
   5. Main Simulation Layout (Option A Dual Column)
   ========================================================================== */
.sim-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr);
    gap: 1.5rem;
    align-items: start;
    width: 100%;
    min-width: 0;
}

/* ==========================================================================
   6. Left Column: Visualizer Panel (Dark Viewport & Sharp Auxiliary Graphics)
   ========================================================================== */
.visualizer-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
    min-width: 0;
    align-items: stretch;
}

.viewport-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 740 / 460;
    background: #040813;
    border: 1px solid #1e293b;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

#orbital-canvas {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain;
}

.viewport-hud-overlay {
    position: absolute;
    top: 0.85rem;
    left: 0.85rem;
    right: 0.85rem;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 10;
}

.hud-chip {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.mode-indicator {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid #38bdf8;
    color: #38bdf8;
}

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

/* Mode 1 Collapse Banner Overlay */
.collapse-overlay {
    position: absolute;
    inset: 0;
    background: rgba(4, 8, 19, 0.88);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 20;
    animation: fadeIn 220ms ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.collapse-alert-card {
    background: linear-gradient(135deg, #090e17, #1e293b);
    border: 2px solid #ef4444;
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.75rem;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 16px 36px rgba(239, 68, 68, 0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
}

.alert-icon {
    font-size: 2.2rem;
}

.alert-content h4 {
    font-size: 1.18rem;
    font-weight: 800;
    color: #f87171;
    margin-bottom: 0.4rem;
}

.alert-content p {
    font-size: 0.86rem;
    color: #cbd5e1;
    line-height: 1.5;
}

.btn-banner-action {
    background: #ef4444;
    color: #ffffff;
    border: none;
    font-family: inherit;
    font-weight: 800;
    font-size: 0.86rem;
    padding: 0.55rem 1.4rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
    transition: transform 0.15s ease, background 0.15s ease;
}

.btn-banner-action:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

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

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

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

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

/* Status Diagnostic Badge */
.status-badge {
    width: 100%;
    min-height: 38px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.5rem 0.95rem;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-sub);
}

/* Auxiliary Telemetry Graph Panel */
.aux-panel {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow-sm);
}

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

.aux-icon {
    font-size: 1.05rem;
}

.aux-header h4 {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-main);
    flex: 1;
}

.aux-badge {
    background: var(--primary-light);
    color: var(--primary-hover);
    border: 1px solid var(--primary-border);
}

.aux-canvas-wrapper {
    width: 100%;
    aspect-ratio: 740 / 220;
    background: #060a16;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid #1e293b;
}

#aux-canvas {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain;
}

/* Predict-Observe-Explain (POE) Card */
.poe-card {
    background: #fffdf5;
    border: 1px solid #fde68a;
    border-left: 4px solid var(--accent-color);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    box-shadow: var(--shadow-sm);
}

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

.poe-icon {
    font-size: 1.35rem;
}

.poe-titles h4 {
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--accent-hover);
}

.poe-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

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

.poe-options-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.2rem 0;
}

.poe-option {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.6rem 0.85rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.poe-option:hover {
    background: #f8fafc;
    border-color: var(--primary-color);
}

.poe-option input[type="radio"] {
    margin-top: 0.2rem;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.option-text {
    font-size: 0.84rem;
    color: var(--text-sub);
    line-height: 1.45;
}

.option-text strong {
    color: var(--text-main);
}

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

.btn-poe-check, .btn-poe-reset {
    background: var(--accent-color);
    color: #ffffff;
    border: none;
    font-family: inherit;
    font-weight: 800;
    font-size: 0.82rem;
    padding: 0.5rem 1.15rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    touch-action: manipulation;
}

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

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

.poe-feedback {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.feedback-badge {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary-hover);
}

.poe-feedback p {
    font-size: 0.84rem;
    color: var(--text-sub);
    line-height: 1.5;
}

/* ==========================================================================
   7. Right Column: Controls Panel (Option A Unrolled Document Flow)
   ========================================================================== */
.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    width: 100%;
    min-width: 0;
}

.controls-panel-header {
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.75rem;
}

.controls-panel-header h3 {
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--text-main);
}

.controls-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.95rem;
}

.group-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.15rem;
}

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

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

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

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.label-row label, .control-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main);
}

.param-value {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--primary-hover);
}

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

.stepper-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 1.15rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    touch-action: manipulation;
}

.stepper-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-hover);
}

.slider-stepper-container input[type="range"] {
    flex: 1;
    height: 6px;
    background: #cbd5e1;
    border-radius: 9999px;
    accent-color: var(--primary-color);
    cursor: pointer;
    min-width: 80px;
}

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

/* Action Buttons */
.action-btn-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary, .btn-action-flash {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-family: inherit;
    font-weight: 800;
    font-size: 0.82rem;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    touch-action: manipulation;
    flex: 1;
    min-width: 130px;
}

.btn-primary {
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.45);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-sub);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #f1f5f9;
    color: var(--text-main);
    border-color: #94a3b8;
}

.btn-action-flash {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #0f172a;
    border: none;
    font-weight: 800;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35);
}

.btn-action-flash:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.45);
}

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

.preset-pill {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.55rem;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-sub);
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: all 0.15s ease;
}

.preset-pill:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: var(--text-main);
}

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

/* Toggle Switches */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 38px;
    height: 20px;
    min-width: 38px;
    background: #cbd5e1;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    transition: all 0.15s ease;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: all 0.15s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary-color);
    border-color: var(--primary-hover);
}

.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(18px);
}

.toggle-label {
    font-size: 0.8rem;
    color: var(--text-sub);
    line-height: 1.35;
}

.checkbox-stack {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

/* Virial Breakdown Box */
.virial-breakdown-box {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

.virial-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0.55rem;
    border-radius: var(--radius-sm);
    background: #f8fafc;
}

.virial-item.highlight {
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
}

.v-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-main);
}

.v-value {
    font-family: var(--font-mono);
    font-size: 0.86rem;
    font-weight: 800;
}

.v-value.pos { color: #15803d; }
.v-value.neg { color: #b45309; }
.v-value.bound { color: var(--primary-hover); }

.v-sub {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Mode 4 Ion Grid */
.ion-button-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.ion-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.5rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.ion-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.ion-btn.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.ion-sym {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--primary-hover);
}

.ion-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.ion-btn.active .ion-desc {
    color: var(--text-sub);
}

.hydrogenic-metrics-card {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-sub);
}

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

/* ==========================================================================
   8. Full-Width Theory Section & Concept Cards
   ========================================================================== */
.concepts-box {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1rem;
    width: 100%;
}

.section-header {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.section-badge {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary-hover);
}

.section-header h2 {
    font-size: clamp(1.25rem, 2.2vw, 1.65rem);
    font-weight: 800;
    color: var(--text-main);
}

.section-lead {
    font-size: 0.92rem;
    color: var(--text-sub);
    max-width: 900px;
    line-height: 1.55;
}

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

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

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

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

.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.5rem;
}

.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%;
    border-collapse: collapse;
    font-size: 0.8rem;
    margin-top: 0.35rem;
}

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

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

@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 10px 25px -5px rgba(15, 23, 42, 0.4), 0 0 25px rgba(245, 158, 11, 0.45);
    }
}

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

.promo-kicker {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.promo-lead {
    font-size: 1.15rem;
    font-weight: 600;
    color: #e2e8f0;
}

.promo-headline {
    font-size: 1.75rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

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

.program-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    backdrop-filter: blur(4px);
    transition: transform 0.15s ease, background 0.15s ease;
}

.program-card:hover {
    background: rgba(255, 255, 255, 0.09);
    transform: translateY(-2px);
}

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

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

.program-card small {
    font-size: 0.78rem;
    color: #fde68a;
    font-weight: 600;
    margin-top: 0.2rem;
}

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

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

.promo-button.main-cta {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #0f172a;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.promo-button.main-cta:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.45);
}

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

.promo-button.sub-cta:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.35);
}

/* ==========================================================================
   11. Feedback & Suggestions Channel (Standard 4.4)
   ========================================================================== */
.feedback-card {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.6rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-sm);
}

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

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

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

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

.feedback-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.65rem 1.35rem;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s ease;
}

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

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

/* ==========================================================================
   13. MathJax Dual-Rule Architecture (No Line-Jumping & Responsive Scroll)
   ========================================================================== */
.math-display mjx-container,
mjx-container[display="true"] {
    display: block !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    margin: 0.4rem auto !important;
    text-align: center;
}

mjx-container:not([display="true"]) {
    display: inline-block !important;
    max-width: 100% !important;
    overflow: visible !important;
    margin: 0 0.12em !important;
    vertical-align: -0.15em !important;
    line-height: 0;
}

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

mjx-assistive-mml {
    clip: rect(1px, 1px, 1px, 1px) !important;
    user-select: none !important;
    position: absolute !important;
    padding: 0 !important;
    border: 0 !important;
    height: 1px !important;
    width: 1px !important;
    overflow: hidden !important;
}

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

    .visualizer-panel {
        order: 1;
    }

    .controls-panel {
        order: 2;
    }

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

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

    .admission-card {
        padding: 1.6rem 1.4rem;
    }

    .promo-headline {
        font-size: 1.45rem;
    }

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

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

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

@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;
    }

    #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);
    }

    .ion-button-grid {
        grid-template-columns: 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;
}
