/* ==========================================================================
   Hydrogen Spectral Series & Energy Level Transitions — Stylesheet
   Chapter 12 Simulation 03 | PlusPhysics Suite
   Department of Physics, D B Pampa College, Parumala
   Option A Responsive Architecture, Standard Light Shell with Dark Viewports
   ========================================================================== */

/* --- 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. Simulation Header
   ========================================================================== */
.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: #f1f5f9;
    border-color: var(--primary-color);
    color: var(--text-main);
}

.mode-tab.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-hover);
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.tab-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: #e2e8f0;
    color: var(--text-main);
    font-size: 0.75rem;
    font-weight: 800;
    font-family: var(--font-mono);
    flex-shrink: 0;
}

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

.tab-title {
    font-size: 0.88rem;
    font-weight: 700;
}

/* ==========================================================================
   5. Main Simulation Layout (Option A Dual Column)
   ========================================================================== */
.sim-layout {
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* Visualizer Left Column */
.visualizer-panel {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

/* Pitch Dark Viewport Wrapper */
.viewport-wrapper {
    position: relative;
    background: var(--bg-dark);
    border-radius: var(--radius-lg);
    border: 1px solid #1e293b;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    width: 100%;
    aspect-ratio: 740 / 460;
    display: flex;
    align-items: center;
    justify-content: center;
}

#quantum-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

.viewport-hud-overlay {
    position: absolute;
    top: 0.75rem;
    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.3rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    backdrop-filter: blur(6px);
    letter-spacing: 0.02em;
}

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

.hud-chip.status-indicator {
    background: rgba(15, 23, 42, 0.85);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.4);
}

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

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

.stat-value {
    font-size: 1rem;
    color: var(--text-main);
    font-weight: 800;
    font-family: var(--font-mono);
}

/* Status Diagnostic Banner */
.status-badge {
    background: #f1f5f9;
    border-left: 4px solid var(--primary-color);
    padding: 0.65rem 1rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.84rem;
    color: var(--text-sub);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

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

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

.aux-header h4 {
    font-size: 0.94rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

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

.aux-badge {
    background: #ede9fe;
    color: #6d28d9;
    border: 1px solid #ddd6fe;
}

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

#spectrogram-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
}

/* POE Challenge Card */
.poe-card {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.15rem 1.35rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

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

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

.poe-titles h4 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
}

.poe-subtitle {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.poe-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

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

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

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

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

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

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

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

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

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

.btn-poe-reset {
    background: #e2e8f0;
    color: var(--text-main);
}

.btn-poe-reset:hover {
    background: #cbd5e1;
}

.poe-feedback {
    margin-top: 0.35rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    line-height: 1.5;
    background: #f8fafc;
    border: 1px solid var(--border-color);
}

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

.poe-feedback.incorrect {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.feedback-badge {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}

/* ==========================================================================
   6. Laboratory Controls Panel (Right Column)
   ========================================================================== */
.controls-panel {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.35rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

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

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

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

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

.group-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

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

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

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

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

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

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

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

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

.slider-stepper-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    background: var(--primary-hover);
}

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

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

/* Action Buttons */
.action-btn-row {
    margin-top: 0.35rem;
}

.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.18s ease;
    border: none;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 14px rgba(2, 132, 199, 0.4);
    transform: translateY(-1px);
}

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

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

/* Transition Summary Card (Mode 1) */
.transition-summary-card {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
}

.s-label {
    color: var(--text-muted);
    font-weight: 600;
}

.s-val {
    font-family: var(--font-mono);
    color: var(--text-main);
    font-weight: 700;
}

/* Series Select Buttons Stack (Mode 2) */
.series-btn-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.series-select-btn {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.series-select-btn:hover {
    background: #f1f5f9;
    border-color: var(--primary-color);
}

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

.btn-text-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-text-row strong {
    font-size: 0.86rem;
    color: var(--text-main);
}

.series-select-btn.active .btn-text-row strong {
    color: var(--primary-hover);
}

.series-select-btn small {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.band-tag {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 0.15rem 0.45rem;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.band-tag.uv {
    background: #f3e8ff;
    color: #7e22ce;
    border: 1px solid #e9d5ff;
}

.band-tag.vis {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.band-tag.ir {
    background: #ffedd5;
    color: #c2410c;
    border: 1px solid #fed7aa;
}

/* Toggle Switches */
.checkbox-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-sub);
    position: relative;
}

.toggle-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background-color: #cbd5e1;
    border-radius: 20px;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

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

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

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

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

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

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

/* Balmer Pill Row */
.balmer-pill-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.45rem;
}

.balmer-btn {
    padding: 0.45rem 0.35rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: #ffffff;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.balmer-btn.h-alpha { border-color: #ef4444; color: #b91c1c; }
.balmer-btn.h-beta  { border-color: #06b6d4; color: #0e7490; }
.balmer-btn.h-gamma { border-color: #3b82f6; color: #1d4ed8; }
.balmer-btn.h-delta { border-color: #8b5cf6; color: #6d28d9; }

.balmer-btn.h-alpha:hover { background: #fee2e2; }
.balmer-btn.h-beta:hover  { background: #cffafe; }
.balmer-btn.h-gamma:hover { background: #dbeafe; }
.balmer-btn.h-delta:hover { background: #ede9fe; }

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

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

.ion-btn:hover {
    background: #f1f5f9;
}

.ion-btn.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

.ion-sym {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
}

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

.control-hint {
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 0.2rem;
}

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

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
}

.m-label {
    color: var(--text-muted);
    font-weight: 600;
}

.m-val {
    font-family: var(--font-mono);
    color: var(--text-main);
    font-weight: 700;
}

/* ==========================================================================
   7. Full-Width In-Depth Concepts Box (Standard 7.4 Option A)
   ========================================================================== */
.concepts-box {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 2rem 2.2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

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

.section-badge {
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary-hover);
    background: var(--primary-light);
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    width: fit-content;
}

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

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

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

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

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

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

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

.theory-card ul, .theory-card ol {
    margin-left: 1.25rem;
    font-size: 0.86rem;
    color: var(--text-sub);
    line-height: 1.55;
    display: flex;
    flex-direction: column;
    gap: 0.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%;
    min-width: 440px;
    border-collapse: collapse;
    font-size: 0.8rem;
}

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

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

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

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

/* ==========================================================================
   9. 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);
}

/* ==========================================================================
   10. 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);
}

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

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

/* ==========================================================================
   13. Responsive Breakpoints (Option A Layout)
   ========================================================================== */
@media (max-width: 900px) {
    .container {
        padding: 1rem 1.15rem 3rem;
    }

    .sim-layout {
        grid-template-columns: 1fr;
    }

    .visualizer-panel {
        order: 1;
    }

    .controls-panel {
        order: 2;
    }

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

    .concepts-box {
        padding: 1.5rem 1.4rem;
    }

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

    .container {
        padding: 0.65rem 0.75rem 2.5rem;
    }

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

    .sim-subtitle {
        font-size: 0.84rem;
    }

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

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

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

    .viewport-hud-overlay {
        top: 0.35rem;
        left: 0.5rem;
        right: 0.5rem;
    }

    #hud-mode-chip {
        display: none !important;
    }

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

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

    .aux-panel {
        padding: 0.75rem 0.85rem;
    }

    .poe-card {
        padding: 0.85rem 0.95rem;
    }

    .controls-panel {
        padding: 0.85rem 0.95rem;
    }

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

    .balmer-pill-row {
        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;
    }

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

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

    .series-card {
        padding: 1.15rem 0.95rem;
    }

    .admission-card.attention-flash {
        padding: 1.25rem 0.95rem !important;
    }

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

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

    .promo-lead {
        font-size: 0.95rem;
    }

    .promo-button {
        width: 100%;
        text-align: center;
    }
}
