/* =========================================================
   Interference of Light & Young's Double Slit Experiment
   Styles & Layout Specification
   Adheres to Antigravity Engineering Guidelines & AGENTS.md
   Mobile-First Option A Architecture (Zero Horizontal Overflow)
   ========================================================= */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-cyan: #06b6d4;
    --accent-purple: #8b5cf6;
    --accent-rose: #ef4444;
    --bg-color: #f8fafc;
    --panel-bg: #ffffff;
    --text-color: #0f172a;
    --text-muted: #64748b;
    --border-color: #cbd5e1;
    --font-stack: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-stack);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    padding: 1.25rem;
}

@media (max-width: 680px) {
    body {
        padding: 0.65rem 0.5rem;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    width: 100%;
    box-sizing: border-box;
}

/* =========================================================
   TOP NAVIGATION & HEADER
   ========================================================= */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    padding: 0.65rem 1.15rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    width: 100%;
    box-sizing: border-box;
    gap: 0.75rem;
}

@media (max-width: 600px) {
    .top-nav {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }
    .nav-dept-tag {
        font-size: 0.75rem;
        text-align: right;
        line-height: 1.25;
    }
}

.nav-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #1e293b;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    transition: all 0.2s ease;
    touch-action: manipulation;
    flex-shrink: 0;
}

.nav-home-btn:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.nav-dept-tag {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

@media (max-width: 680px) {
    header h1 {
        font-size: 1.35rem;
    }
}

header p {
    font-size: 0.95rem;
    color: #475569;
    max-width: 960px;
    line-height: 1.55;
    word-break: break-word;
}

/* =========================================================
   SERIES CARD & POE CARD
   ========================================================= */
.series-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 10px;
    padding: 0.85rem 1.15rem;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.series-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.2rem;
}

.series-tagline {
    font-size: 0.82rem;
    font-style: italic;
    color: var(--primary-color);
    margin-bottom: 0.35rem;
}

.series-card p {
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.45;
}

.series-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.65rem;
}

.series-pill {
    font-size: 0.78rem;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    background: #f1f5f9;
    color: #475569;
    text-decoration: none;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.series-pill:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.series-pill.current {
    background: #eff6ff;
    color: var(--primary-color);
    border-color: #bfdbfe;
    font-weight: 600;
}

/* POE Card */
.poe-card {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 0.9rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: 100%;
    box-sizing: border-box;
}

.poe-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.poe-badge {
    background: var(--primary-color);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    letter-spacing: 0.04em;
}

.poe-topic {
    font-size: 0.78rem;
    font-weight: 600;
    color: #1d4ed8;
    background: #dbeafe;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
}

.poe-prompt {
    font-size: 0.9rem;
    color: #1e3a8a;
    line-height: 1.45;
    word-break: break-word;
}

.poe-options {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
}

.poe-btn {
    text-align: left;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1px solid #93c5fd;
    background: #ffffff;
    color: #1e3a8a;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.2s ease;
    min-height: 42px;
}

.poe-btn:hover {
    background: #dbeafe;
    border-color: #60a5fa;
}

.poe-btn.correct {
    background: #ecfdf5 !important;
    border-color: #10b981 !important;
    color: #065f46 !important;
    font-weight: 600;
}

.poe-btn.incorrect {
    background: #fef2f2 !important;
    border-color: #ef4444 !important;
    color: #991b1b !important;
}

.poe-explanation {
    background: #ffffff;
    border: 1px solid #93c5fd;
    border-radius: 8px;
    padding: 0.75rem 0.95rem;
    font-size: 0.84rem;
    color: #1e293b;
    line-height: 1.45;
}

/* =========================================================
   MAIN SIMULATION LAYOUT (Option A Responsive Standard)
   ========================================================= */
.sim-layout {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
    box-sizing: border-box;
}

.visualizer-panel {
    order: 1;
    width: 100%;
    box-sizing: border-box;
}

.controls-panel {
    order: 2;
    width: 100%;
    max-height: none;
    overflow-y: visible;
    box-sizing: border-box;
}

@media (min-width: 901px) {
    .sim-layout {
        display: grid;
        grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
        gap: 1.25rem;
        align-items: start;
    }
    .visualizer-panel {
        order: 2;
    }
    .controls-panel {
        order: 1;
    }
}

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 680px) {
    .panel {
        padding: 0.85rem 0.75rem;
        border-radius: 10px;
    }
}

.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    touch-action: pan-y;
}

.visualizer-panel {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

/* =========================================================
   CANVAS CONTAINER & BENCH DISPLAY
   ========================================================= */
.canvas-wrapper {
    display: flex;
    flex-direction: column;
    background: #060913;
    border-radius: 10px;
    border: 1px solid #1e293b;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.canvas-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.85rem;
    background: rgba(15, 23, 42, 0.9);
    border-bottom: 1px solid #1e293b;
    color: #f8fafc;
    font-size: 0.84rem;
    font-weight: 600;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.canvas-badge-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.canvas-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: #1e293b;
    color: #94a3b8;
    text-transform: uppercase;
}

.canvas-container {
    position: relative;
    width: 100%;
    background: #060913;
    overflow: hidden;
    touch-action: none;
}

#sim-canvas {
    width: 100%;
    height: auto;
    display: block;
    cursor: crosshair;
}

.canvas-instruction-overlay {
    position: absolute;
    bottom: 0.4rem;
    left: 0.6rem;
    right: 0.6rem;
    background: rgba(6, 9, 19, 0.75);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    color: #94a3b8;
    font-size: 0.75rem;
    text-align: center;
    pointer-events: none;
}

.viewport-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem 1.15rem;
    padding: 0.55rem 0.85rem;
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid #1e293b;
    font-size: 0.78rem;
    color: #cbd5e1;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* =========================================================
   DUAL AUXILIARY CANVASES (Curve + Phasor)
   ========================================================= */
.dual-canvas-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 680px) {
    .dual-canvas-grid {
        grid-template-columns: 1fr;
    }
}

.sub-canvas-card {
    display: flex;
    flex-direction: column;
    background: #060913;
    border: 1px solid #1e293b;
    border-radius: 10px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.sub-canvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: rgba(15, 23, 42, 0.9);
    border-bottom: 1px solid #1e293b;
    color: #e2e8f0;
    gap: 0.4rem;
}

.sub-canvas-title {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sub-canvas-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.mini-btn {
    padding: 0.15rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 4px;
    background: #1e293b;
    color: #94a3b8;
    border: 1px solid #334155;
    cursor: pointer;
    touch-action: manipulation;
}

.mini-btn:hover {
    background: #334155;
    color: #f8fafc;
}

.mini-btn.active {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

.phasor-phase-badge {
    font-size: 0.72rem;
    font-weight: 600;
    color: #10b981;
    background: rgba(16, 185, 129, 0.15);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

.sub-canvas-box {
    position: relative;
    width: 100%;
    background: #060913;
    touch-action: none;
}

#intensity-canvas,
#phasor-canvas {
    width: 100%;
    height: auto;
    display: block;
}

.graph-legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.75rem;
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid #1e293b;
    font-size: 0.74rem;
    color: #94a3b8;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.graph-tag {
    font-weight: 600;
}

.graph-tag.max-tag { color: #f59e0b; }
.graph-tag.zero-tag { color: #94a3b8; }
.graph-tag.pos-tag { color: #38bdf8; }

/* =========================================================
   TELEMETRY GRID
   ========================================================= */
.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 820px) {
    .telemetry-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 440px) {
    .telemetry-grid {
        grid-template-columns: 1fr;
    }
}

.telemetry-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.telemetry-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.telemetry-val {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-color);
    font-family: var(--font-mono);
}

.telemetry-sub {
    font-size: 0.72rem;
    color: #475569;
}

/* =========================================================
   DERIVATION CARD & CONCEPT CARD
   ========================================================= */
.derivation-card {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.85rem 1.15rem;
    width: 100%;
    box-sizing: border-box;
}

details.derivation-card summary.derivation-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

details.derivation-card summary.derivation-title::-webkit-details-marker {
    display: none;
}

details.derivation-card[open] summary.derivation-title {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed #cbd5e1;
}

.derivation-body {
    font-size: 0.86rem;
    color: #334155;
    line-height: 1.55;
    overflow-x: auto;
}

.derivation-step {
    margin-bottom: 0.5rem;
}

.derivation-step:last-child {
    margin-bottom: 0;
}

.concept-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-emerald);
    border-radius: 10px;
    padding: 1rem 1.15rem;
    width: 100%;
    box-sizing: border-box;
}

.concept-card-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #065f46;
    margin-bottom: 0.4rem;
}

.concept-card-body {
    font-size: 0.85rem;
    color: #334155;
    line-height: 1.5;
}

/* =========================================================
   CONTROLS PANEL ELEMENTS
   ========================================================= */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid #f1f5f9;
    width: 100%;
    box-sizing: border-box;
}

.control-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.group-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.control-group-hint {
    font-size: 0.76rem;
    color: #64748b;
    margin-top: -0.25rem;
    margin-bottom: 0.35rem;
    line-height: 1.35;
}

.station-telemetry-badge {
    margin-top: 0.5rem;
    padding: 0.45rem 0.75rem;
    background: #0f172a;
    color: #38bdf8;
    border: 1px solid #1e293b;
    border-radius: 6px;
    font-family: var(--font-mono), monospace;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.mode-toggle-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    color: #1e293b;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
}

.mode-btn small {
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.mode-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.mode-btn.active {
    background: #eff6ff;
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.mode-btn.active small {
    color: #1d4ed8;
}

.mode-goal-banner {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-left: 4px solid var(--accent-emerald);
    border-radius: 6px;
    padding: 0.65rem 0.85rem;
    font-size: 0.82rem;
    color: #166534;
    line-height: 1.45;
    width: 100%;
    box-sizing: border-box;
    word-break: break-word;
}

/* Preset Buttons Grid */
.preset-btn-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 440px) {
    .preset-btn-grid {
        grid-template-columns: 1fr;
    }
}

.preset-btn {
    padding: 0.55rem 0.65rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    color: #334155;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 40px;
}

.preset-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.preset-btn.active {
    background: #eff6ff;
    border-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 700;
}

/* =========================================================
   COMPOSITE SLIDERS & STEPPERS (Min 40x40 Touch Target)
   ========================================================= */
.slider-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.6rem;
    width: 100%;
    box-sizing: border-box;
}

.slider-row:last-child {
    margin-bottom: 0;
}

.slider-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.slider-header-row label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
}

.stat-badge {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary-color);
    background: #eff6ff;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #bfdbfe;
    font-family: var(--font-mono);
    white-space: nowrap;
}

.stepper-container {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
}

.step-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    color: #1e293b;
    font-size: 1.15rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.15s ease;
    user-select: none;
    flex-shrink: 0;
}

.step-btn:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.step-btn:active {
    background: #cbd5e1;
    transform: scale(0.96);
}

.stepper-container input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
    cursor: pointer;
    touch-action: manipulation;
}

.stepper-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease;
}

.stepper-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

/* Snap Buttons Grid */
.snap-btn-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.35rem;
    width: 100%;
    box-sizing: border-box;
}

.snap-btn {
    font-size: 0.72rem;
    padding: 0.45rem 0.25rem;
    min-height: 38px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 520px) {
    .snap-btn-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Action Buttons Grid */
.action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 440px) {
    .action-grid {
        grid-template-columns: 1fr;
    }
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--primary-color);
    background: var(--primary-color);
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.2s ease;
    min-height: 42px;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.action-btn:hover {
    background: var(--primary-hover);
}

.action-btn.secondary {
    background: #f8fafc;
    color: #1e293b;
    border-color: var(--border-color);
}

.action-btn.secondary:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.action-btn.paused {
    background: #059669;
    border-color: #047857;
}

/* Checkbox Toggles */
.toggle-option-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0.4rem;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 440px) {
    .toggle-option-grid {
        grid-template-columns: 1fr;
    }
}

.toggle-check-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.78rem;
    color: #334155;
    cursor: pointer;
    user-select: none;
}

.toggle-check-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

/* =========================================================
   INSTITUTIONAL ADMISSION CALLOUT & PROMO CARD
   ========================================================= */
.admission-card { 
    background: linear-gradient(135deg, #1e3a8a, #0f172a); 
    color: #ffffff; 
    border-radius: 12px; 
    padding: 1.25rem 1.5rem; 
    margin-top: 1.25rem; 
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); 
    display: flex; 
    flex-direction: column; 
    gap: 1.25rem; 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    width: 100%;
    box-sizing: border-box;
} 

.admission-card.attention-flash { 
    animation: bannerGlowPulse 4s infinite ease-in-out; 
} 

@keyframes bannerGlowPulse { 
    0% { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); border-color: rgba(255, 255, 255, 0.1); } 
    50% { box-shadow: 0 0 20px 4px rgba(251, 191, 36, 0.35); border-color: rgba(251, 191, 36, 0.5); } 
    100% { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); border-color: rgba(255, 255, 255, 0.1); } 
} 

@media (prefers-reduced-motion: reduce) {
    .admission-card.attention-flash {
        animation: none;
    }
}

.promo-copy { display: flex; flex-direction: column; gap: 0.25rem; width: 100%; } 
.promo-kicker { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: #93c5fd; } 
.promo-lead { font-size: 1.25rem; font-weight: 700; color: #ffffff; line-height: 1.2; } 
.promo-headline { font-size: 1rem; color: #cbd5e1; font-weight: 500; } 

.program-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 0.85rem; 
    width: 100%;
    box-sizing: border-box;
} 

@media (max-width: 480px) {
    .program-grid {
        grid-template-columns: 1fr;
    }
}

.program-card { 
    background: rgba(255, 255, 255, 0.05); 
    padding: 0.75rem 1rem; 
    border-radius: 8px; 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    font-size: 0.85rem; 
    display: flex; 
    flex-direction: column; 
    gap: 0.2rem; 
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
} 

.program-card strong { color: #fcd34d; font-size: 0.95rem; } 
.program-card span { color: #e2e8f0; } 
.program-card small { color: #94a3b8; font-style: italic; } 

.promo-actions { 
    display: flex; 
    flex-direction: column; 
    gap: 0.5rem; 
    width: 100%;
    box-sizing: border-box;
} 

@media (min-width: 681px) {
    .promo-actions {
        flex-direction: row;
        width: auto;
    }
} 

.promo-button { 
    padding: 0.65rem 1.2rem; 
    border-radius: 6px; 
    font-weight: 700; 
    text-decoration: none; 
    transition: all 0.2s ease; 
    text-align: center; 
    font-size: 0.9rem; 
    min-height: 44px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    touch-action: manipulation; 
    box-sizing: border-box;
} 

.main-cta { background-color: #fbbf24; color: #0f172a; } 
.main-cta:hover { background-color: #f59e0b; transform: translateY(-1px); } 

.sub-cta { background-color: transparent; color: #e2e8f0; border: 1px solid rgba(255, 255, 255, 0.3); } 
.sub-cta:hover { background-color: rgba(255, 255, 255, 0.1); color: #fff; border-color: #fff; } 

/* =========================================================
   FEEDBACK & SUGGESTIONS CHANNEL
   ========================================================= */
.feedback-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-top: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 800px) {
    .feedback-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem 1.15rem;
    }
    .feedback-btn {
        width: 100%;
        text-align: center;
    }
}

.feedback-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.feedback-icon {
    color: var(--primary-color);
    flex-shrink: 0;
}

.feedback-text h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.2rem;
}

.feedback-text p {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.feedback-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.15rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--primary-color);
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 44px;
    touch-action: manipulation;
    flex-shrink: 0;
}

.feedback-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: var(--primary-hover);
}

/* =========================================================
   SERIES FOOTER & COPYRIGHT CARD
   ========================================================= */
.series-footer { 
    text-align: center; 
    padding: 1.25rem 0 0.5rem; 
    border-top: 1px solid #e5e7eb; 
    margin-top: 1.25rem; 
    width: 100%;
    box-sizing: border-box;
} 

.series-footer p { 
    font-size: 0.82rem; 
    color: var(--text-muted); 
    font-weight: 500; 
}

/* Readouts, status lines and labels wrap instead of being cut off. */
.sub-canvas-title,
.snap-btn {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}
.snap-btn { line-height: 1.25; height: auto; }


/* ==========================================================================
   Series Modal & Top Navigation Actions (Standard 4.1 & 19)
   ========================================================================== */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.nav-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--panel-bg, #ffffff);
    color: var(--text-color, #1f2937);
    border: 1px solid var(--border-color, #cbd5e1);
    padding: 0.4rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-pill-btn:hover {
    background: var(--primary-color, #3b82f6);
    border-color: var(--primary-color, #3b82f6);
    color: #ffffff;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.modal-window {
    position: relative;
    z-index: 10000;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
    width: 100%;
    max-width: 680px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    flex-shrink: 0;
    padding: 1rem 1.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #111827;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
}

.modal-close-btn:hover {
    color: #ffffff;
}

.modal-body {
    flex: 1 1 auto;
    padding: 1.15rem 1.4rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.modal-body p {
    color: #cbd5e1;
    font-size: 0.92rem;
    line-height: 1.5;
}

.modal-body .series-tagline {
    font-style: italic;
    color: #93c5fd;
    font-weight: 500;
    font-size: 0.96rem;
}

/* Modal Admission Card (Standard 19: Strict Anti-Squash & Compact) */
.modal-admission {
    flex-shrink: 0 !important;
    min-height: fit-content !important;
    height: auto !important;
    margin: 0.4rem 0 !important;
    padding: 0.85rem 1.15rem !important;
    gap: 0.55rem !important;
    box-shadow: 0 0 16px rgba(251, 191, 36, 0.35) !important;
}

.modal-admission .promo-kicker {
    font-size: 0.72rem;
}

.modal-admission .promo-lead {
    font-size: 0.9rem;
}

.modal-admission .promo-headline {
    font-size: 1.05rem;
    line-height: 1.2;
}

.modal-admission .program-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem;
}

.modal-admission .program-card {
    padding: 0.55rem 0.75rem;
    gap: 0.2rem;
    height: auto;
}

.modal-admission .program-card strong {
    font-size: 0.88rem;
}

.modal-admission .program-card span {
    font-size: 0.72rem;
}

.modal-admission .program-card small {
    font-size: 0.68rem;
}

.modal-admission .promo-actions {
    margin-top: 0.25rem;
    gap: 0.6rem;
}

.modal-admission .promo-button {
    padding: 0.45rem 1.15rem;
    font-size: 0.8rem;
}

.modal-footer {
    flex-shrink: 0;
    padding: 0.6rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: flex-end;
    background: #0f172a;
}

.btn-modal-dismiss {
    background: var(--primary-color, #3b82f6);
    color: #ffffff;
    border: none;
    padding: 0.45rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-modal-dismiss:hover {
    background: var(--primary-hover, #2563eb);
}

/* Standard 19: Modal Option A Mobile Priority */
@media (max-width: 600px) {
    .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;
    }

    .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;
    }
}


/* ==========================================================================
   Mobile Controls Drawer & Responsive Canvas Scaling (Standard 17 & 18)
   ========================================================================== */
.mobile-controls-bar {
    display: none;
}

#sim-canvas,
#wavefront-canvas,
#intensity-canvas,
#phasor-canvas,
.graph-canvas {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
}

.visualizer-panel .mode-toggle-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5rem;
    width: 100%;
}

@media (max-width: 900px) {
    .sim-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 1.25rem !important;
        width: 100% !important;
    }

    .visualizer-panel {
        order: 1 !important;
        width: 100% !important;
    }

    .mobile-controls-bar {
        display: block !important;
        order: 2 !important;
        width: 100% !important;
    }

    .mobile-controls-toggle {
        width: 100%;
        padding: 0.85rem 1.25rem;
        background: #f8fafc;
        border: 1.5px solid #cbd5e1;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
        font-family: inherit;
        font-size: 0.88rem;
        font-weight: 700;
        color: #1e293b;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        transition: all 0.2s ease;
        touch-action: manipulation;
        min-height: 48px;
        box-sizing: border-box;
    }

    .mobile-controls-toggle:hover {
        background: #f1f5f9;
        border-color: #94a3b8;
    }

    .mobile-controls-toggle .toggle-icon {
        font-size: 1.15rem;
        margin-right: 0.35rem;
    }

    .mobile-controls-toggle .toggle-text {
        flex: 1;
        text-align: left;
    }

    .mobile-controls-toggle .toggle-indicator {
        font-size: 0.72rem;
        color: #3b82f6;
        background: #eff6ff;
        padding: 0.2rem 0.55rem;
        border-radius: 9999px;
        margin-right: 0.45rem;
        font-weight: 700;
    }

    .mobile-controls-toggle .toggle-arrow {
        font-size: 0.75rem;
        color: #64748b;
        transition: transform 0.2s ease;
    }

    .mobile-controls-toggle.open .toggle-arrow {
        transform: rotate(180deg);
    }

    .controls-panel {
        order: 3 !important;
        display: none !important;
        width: 100% !important;
        border-top: 2px solid #3b82f6;
    }

    .controls-panel.mobile-open {
        display: flex !important;
        flex-direction: column !important;
        animation: slideDownControls 0.22s ease;
    }

    @keyframes slideDownControls {
        from { opacity: 0; transform: translateY(-6px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

@media (max-width: 600px) {
    .visualizer-panel .mode-toggle-group {
        display: flex;
        flex-direction: column;
        gap: 0.45rem;
    }
}

/* 2026-11: script.js sizes each buffer to the on-screen box, so the boxes keep their drawing's shape here
   (900 x 460 bench, 440 x 230 plots) rather than taking it from the buffer's rounded size */
#sim-canvas { aspect-ratio: 900 / 460; }
#intensity-canvas, #phasor-canvas { aspect-ratio: 440 / 230; }


/* ==================== 3-MINUTE INVESTIGATION CARD (Standard 26) ==================== */
.c-mission-card {
  background: #ffffff;
  border: 1.5px solid #0284c7;
  border-radius: 16px;
  padding: 1rem 1.15rem;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.c-mission-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 50%, #f59e0b 100%);
}
.c-mission-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.c-mission-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.c-mission-icon { font-size: 1.1rem; }
.c-mission-title-wrap h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0b1329;
  margin: 0;
}
.c-mission-step-counter {
  font-size: 0.72rem;
  font-weight: 700;
  color: #0284c7;
  background: #e0f2fe;
  padding: 2px 7px;
  border-radius: 999px;
}
.c-mission-toggle-btn {
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.c-mission-toggle-btn:hover { background: #f1f5f9; color: #0b1329; }
.c-mission-card.is-collapsed .c-mission-chevron { transform: rotate(180deg); }
.c-mission-collapsed-summary {
  display: none;
  font-size: 0.82rem;
  color: #475569;
  cursor: pointer;
  padding: 0.2rem 0;
}
.c-mission-card.is-collapsed .c-mission-collapsed-summary { display: block; }
.c-mission-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.c-mission-card.is-collapsed .c-mission-body { display: none; }
.c-mission-steps-nav {
  display: flex;
  gap: 0.4rem;
  width: 100%;
}
.c-mission-step-btn {
  flex: 1;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 4px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.c-mission-step-btn.active {
  background: #e0f2fe;
  border-color: #0284c7;
  color: #0284c7;
}
.c-mission-step-btn.done {
  border-color: #10b981;
  color: #059669;
}
.c-step-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #fff;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.c-mission-step-btn.active .c-step-dot { background: #0284c7; }
.c-mission-step-btn.done .c-step-dot { background: #10b981; }
.c-mission-content-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.85rem;
}
.c-mission-meta-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}
.c-mission-type-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: #0284c7;
  text-transform: uppercase;
}
.c-mission-mode-indicator {
  font-size: 0.7rem;
  color: #64748b;
}
.c-mission-instruction {
  font-size: 0.84rem;
  line-height: 1.45;
  color: #1e293b;
  margin-bottom: 0.45rem;
}
.c-mission-observe {
  font-size: 0.82rem;
  line-height: 1.45;
  color: #475569;
  background: #ffffff;
  border-left: 3px solid #0284c7;
  padding: 0.45rem 0.65rem;
  border-radius: 0 6px 6px 0;
}
.c-mission-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.65rem;
}
.c-btn-mission-done {
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.c-btn-mission-done:hover { background: #0369a1; }
.c-mission-time-tag {
  font-size: 0.72rem;
  color: #94a3b8;
}
.c-mission-congrats {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}
.c-mission-congrats h4 {
  margin: 0 0 0.3rem 0;
  color: #065f46;
  font-size: 0.95rem;
}
.c-mission-congrats p {
  margin: 0 0 0.75rem 0;
  color: #047857;
  font-size: 0.82rem;
}
.c-btn-mission-restart {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}

/* ==================== PROGRESSIVE DISCLOSURE ACCORDIONS (Standard 27) ==================== */
.is-collapsible {
  background: #ffffff;
  border: 1px solid #E2E6EE;
  border-radius: 16px;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}
.is-collapsible:hover { border-color: #CBD5E1; }
.is-collapsible.is-open { box-shadow: 0 4px 14px rgba(11, 19, 41, 0.04); }
.accordion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.4rem;
  cursor: pointer;
  user-select: none;
  background: #ffffff;
  transition: background 0.15s;
}
.accordion-head:hover { background: #F8FAFC; }
.accordion-head-left {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}
.accordion-icon { font-size: 1.5rem; line-height: 1; flex: none; }
.accordion-title-wrap { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.accordion-head h2, .accordion-head h3 {
  font-family: var(--font-display, inherit);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-color, #0B1329);
  margin: 0;
  line-height: 1.25;
}
.accordion-subtext { font-size: 0.82rem; color: #64748B; display: block; }
.accordion-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  background: #F1F5F9;
  color: #334155;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  flex: none;
  pointer-events: none;
}
.accordion-head:hover .accordion-toggle-btn { background: #0B1329; color: #FFFFFF; border-color: #0B1329; }
.accordion-chevron { width: 16px; height: 16px; transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
.is-collapsible.is-open .accordion-chevron { transform: rotate(180deg); }
.accordion-content { padding: 1.25rem 1.4rem 1.4rem 1.4rem; border-top: 1px solid #F1F5F9; }
.accordion-content[hidden] { display: none !important; }
.poe-box { background: #F0F7FF; border-color: #BAE6FD; }
.poe-box .accordion-head { background: #F0F7FF; }
.poe-box .accordion-head:hover { background: #E0F2FE; }
.poe-box .accordion-head h3 { color: #0369A1; }
.poe-box .accordion-subtext { color: #0284C7; }
.poe-box .accordion-toggle-btn { background: #E0F2FE; color: #0369A1; border-color: #BAE6FD; }
.poe-box .accordion-head:hover .accordion-toggle-btn { background: #0284C7; color: #FFFFFF; border-color: #0284C7; }
