/* ==========================================================================
   PlusPhysics - Electric Flux, Dipole & Gauss's Law Laboratory (Styles)
   Compliant with Antigravity Engineering Guidelines (AGENTS.md)
   ========================================================================== */

:root {
    --bg-color: #f4f7f6;
    --panel-bg: #ffffff;
    --stage-bg: #0b1329;
    --stage-box-bg: #070d1e;
    --stage-border: #1a284e;
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #475569;
    --accent-color: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-gold: #fbbf24;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #cbd5e1;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08);
}

/* Universal box-sizing and font rules (preserving MathJax containers) */
*:not(mjx-container):not(mjx-container *) {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: 1.25rem 1rem 3rem;
    display: flex;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
}

.container {
    max-width: 1120px;
    width: 100%;
}

/* --------------------------------------------------------------------------
   Top Navigation Bar (Standard 4.1)
   -------------------------------------------------------------------------- */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1.15rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.nav-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: #0284c7;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.15s ease;
}

.nav-home-btn:hover {
    color: #0369a1;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.nav-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #f8fafc;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    border-radius: 9999px;
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.15s ease;
}

.nav-pill-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.nav-dept-tag {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   Header Architecture
   -------------------------------------------------------------------------- */
.sim-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 0.25rem 0;
}

.sim-title {
    font-size: 2.1rem;
    color: #0f172a;
    font-weight: 800;
    margin-bottom: 0.35rem;
    line-height: 1.25;
}

.sim-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.55;
    max-width: 920px;
    margin: 0 auto;
}

/* --------------------------------------------------------------------------
   Main Workspace Layout Grid (Desktop Side-by-Side, Mobile Visualizer First)
   -------------------------------------------------------------------------- */
.sim-layout {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 1.25rem;
    margin-bottom: 2rem;
    align-items: start;
    width: 100%;
}

.panel {
    background: var(--panel-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}

.visualizer-panel {
    min-width: 0;
}

.controls-panel {
    padding: 1.25rem;
    min-width: 0;
}

/* --------------------------------------------------------------------------
   The Dark Simulation Stage (pp-stage)
   -------------------------------------------------------------------------- */
.c-stage {
    background: var(--stage-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--stage-border);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    margin-bottom: 1.25rem;
}

/* Mode Switcher Tabs */
.mode-toggle-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    width: 100%;
}

.mode-btn {
    background: #142144;
    color: #94a3b8;
    border: 1px solid #233564;
    border-radius: 8px;
    padding: 0.65rem 0.6rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-align: center;
    line-height: 1.2;
}

.mode-btn .mode-num {
    background: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.mode-btn:hover {
    background: #1a2c5a;
    color: #f1f5f9;
    border-color: #3b82f6;
}

.mode-btn.is-active,
.mode-btn.active {
    background: #2563eb !important;
    color: #ffffff !important;
    border-color: #60a5fa !important;
    box-shadow: 0 0 12px rgba(96, 165, 250, 0.4) !important;
}

.mode-btn.is-active .mode-num,
.mode-btn.active .mode-num {
    background: #ffffff !important;
    color: #1e3a8a !important;
}

.mode-btn:not(.active):not(.is-active) {
    background: #142144 !important;
    color: #94a3b8 !important;
    border-color: #233564 !important;
}

.mode-btn:not(.active):not(.is-active) .mode-num {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #e2e8f0 !important;
}

/* Stage Action & Readout Bar */
.c-stage-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: #0f1c3d;
    border: 1px solid #1e3260;
    border-radius: 8px;
    padding: 0.65rem 0.95rem;
    flex-wrap: wrap;
}

.c-stage-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.c-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    border: none;
    min-height: 36px;
    transition: all 0.15s ease;
}

.c-btn-amber {
    background: #f59e0b;
    color: #0b1329;
}
.c-btn-amber:hover {
    background: #fbbf24;
}

.c-btn-ghost {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.c-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.c-shape-pills {
    display: flex;
    gap: 0.3rem;
}

.c-shape-btn {
    background: #15254d;
    color: #94a3b8;
    border: 1px solid #283e74;
    border-radius: 6px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    min-height: 36px;
    transition: all 0.15s ease;
}

.c-shape-btn:hover {
    color: #f1f5f9;
    border-color: #38bdf8;
}

.c-shape-btn.is-active {
    background: #0284c7;
    color: #ffffff;
    border-color: #38bdf8;
}

/* Stage Readout Display */
.c-readout {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
}

.c-readout-label {
    font-size: 0.72rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.c-readout-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.c-readout-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: #38bdf8;
    font-family: 'SF Mono', Consolas, Monaco, monospace;
}

.c-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    background: #1e293b;
    color: #cbd5e1;
    border: 1px solid #334155;
    white-space: nowrap;
}

.c-badge.is-positive {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.4);
}

.c-badge.is-negative {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.4);
}

.c-badge.is-neutral {
    background: rgba(148, 163, 184, 0.15);
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.4);
}

/* Canvas Container */
.c-canvas {
    background: var(--stage-box-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--stage-border);
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    aspect-ratio: 480 / 260;
}

.c-canvas canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Stage Footer Legends & Hints */
.c-stage-foot {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    font-size: 0.78rem;
    color: #94a3b8;
    flex-wrap: wrap;
    padding-top: 0.25rem;
}

.c-key {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.c-key-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.c-key-dot.c-gold { background: #fbbf24; box-shadow: 0 0 6px #fbbf24; }
.c-key-dot.c-cyan { background: #38bdf8; box-shadow: 0 0 6px #38bdf8; }
.c-key-dot.c-shadow { background: #a78bfa; }
.c-key-dot.c-pos { background: #ef4444; }
.c-key-dot.c-neg { background: #3b82f6; }
.c-key-dot.c-magenta { background: #ec4899; box-shadow: 0 0 6px #ec4899; }
.c-key-dot.c-amber { background: #f59e0b; }
.c-key-dot.c-green { background: #10b981; box-shadow: 0 0 6px #10b981; }
.c-key-dot.c-red { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
.c-key-dot.c-dash { background: transparent; border: 1.5px dashed #38bdf8; }

.c-tip {
    margin-left: auto;
    font-style: italic;
    color: #64748b;
    font-size: 0.76rem;
}

/* --------------------------------------------------------------------------
   Analysis Cards Below Stage
   -------------------------------------------------------------------------- */
.c-cards {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.c-card {
    padding: 1.25rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.c-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.c-card-head h2 {
    font-size: 1.15rem;
    color: #0f172a;
    font-weight: 700;
}

.c-card-intro {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 1rem;
}

.c-grid-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;
}

.c-stat-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.c-stat-box h3 {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #3b82f6;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.35rem;
    font-weight: 700;
}

.c-stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: #475569;
}

.c-stat-row strong {
    color: #0f172a;
    font-weight: 700;
    font-family: 'SF Mono', Consolas, monospace;
}

.c-stat-row.highlight {
    background: #eff6ff;
    border-radius: 4px;
    padding: 0.3rem 0.45rem;
    margin: 0.15rem -0.25rem;
}

.c-stat-row.highlight strong {
    color: #1d4ed8;
}

/* --------------------------------------------------------------------------
   Controls Panel Elements
   -------------------------------------------------------------------------- */
.control-group {
    margin-bottom: 1.25rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid #f1f5f9;
}

.control-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.control-group h3 {
    font-size: 0.88rem;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

/* Preset Buttons Grid */
.preset-pill-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
}

.preset-pill {
    background: #f8fafc;
    color: #334155;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.5rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    min-height: 40px;
    line-height: 1.25;
    text-align: center;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preset-pill:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.preset-pill.is-active,
.preset-pill.active {
    background: #2563eb !important;
    color: #ffffff !important;
    border-color: #1d4ed8 !important;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}

/* Composite Slider & Stepper Row */
.c-slider {
    margin-bottom: 0.95rem;
}

.c-slider:last-child {
    margin-bottom: 0.35rem;
}

.c-slider-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}

.c-slider-head label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
}

.c-slider-head .c-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #2563eb;
    font-family: 'SF Mono', Consolas, monospace;
    background: #eff6ff;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #dbeafe;
}

.c-slider-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.c-step {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1.25rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.12s ease;
}

.c-step:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

.c-step:active {
    transform: scale(0.95);
    background: #e2e8f0;
}

input[type="range"] {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #e2e8f0;
    border-radius: 4px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #2563eb;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.c-range {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 0.25rem;
    padding: 0 2px;
}

/* Custom Checkbox Toggles */
.toggles-container {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #334155;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 18px;
    width: 18px;
    background-color: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: #94a3b8;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: #2563eb;
    border-color: #2563eb;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

/* --------------------------------------------------------------------------
   The Key Relation Card (Live Math)
   -------------------------------------------------------------------------- */
.c-relation {
    margin-top: 1.25rem;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.c-relation-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.c-relation-head h2 {
    font-size: 0.88rem;
    font-weight: 700;
    color: #1e3a8a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.c-relation-head span {
    font-size: 0.72rem;
    color: #64748b;
    font-style: italic;
}

.c-formula {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.65rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
}

.c-frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    gap: 0.15rem;
    padding: 0 0.15rem;
    font-size: 0.9em;
    line-height: 1.1;
}

.c-frac-bar {
    align-self: stretch;
    height: 1.5px;
    background: currentColor;
    margin: 1px 0;
}

.c-subst {
    font-size: 0.85rem;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
    padding: 0.25rem 0;
    line-height: 1.25;
}

.c-result {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-weight: 800;
    font-size: 1rem;
    color: #1d4ed8;
    font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
}

.c-note {
    font-size: 0.76rem;
    color: #64748b;
    line-height: 1.45;
}

/* --------------------------------------------------------------------------
   Predict-Observe-Explain Challenge Card (.poe-card)
   -------------------------------------------------------------------------- */
.poe-card {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 5px solid #f59e0b;
    border-radius: var(--radius-md);
    padding: 1.15rem 1.35rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.poe-badge {
    font-size: 0.72rem;
    font-weight: 800;
    color: #b45309;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.poe-text {
    font-size: 0.9rem;
    color: #78350f;
    line-height: 1.55;
}

/* --------------------------------------------------------------------------
   Series Overview Card (.series-card)
   -------------------------------------------------------------------------- */
.series-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.series-card h3 {
    font-size: 1rem;
    color: #1e3a8a;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.series-card p {
    font-size: 0.88rem;
    color: #4b5563;
    line-height: 1.55;
    margin-bottom: 0.5rem;
}

.series-card .series-tagline {
    font-weight: 700;
    color: #111827;
    font-style: italic;
}

/* --------------------------------------------------------------------------
   Admission Banner Card (.admission-card)
   -------------------------------------------------------------------------- */
.admission-card {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
    color: #ffffff;
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.75rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
}

.promo-copy .promo-kicker {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #93c5fd;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.promo-copy .promo-lead {
    font-size: 0.95rem;
    color: #cbd5e1;
    margin-bottom: 0.2rem;
}

.promo-copy .promo-headline {
    font-size: 1.45rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 1.15rem;
}

.program-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.program-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.program-card strong {
    font-size: 0.95rem;
    color: #ffffff;
}

.program-card span {
    font-size: 0.8rem;
    color: #93c5fd;
}

.program-card small {
    font-size: 0.72rem;
    color: #cbd5e1;
}

.promo-actions {
    display: flex;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.promo-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.35rem;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    touch-action: manipulation;
    min-height: 42px;
    transition: all 0.15s ease;
}

.promo-button.main-cta {
    background: #f59e0b;
    color: #0b1329;
}
.promo-button.main-cta:hover {
    background: #fbbf24;
}

.promo-button.sub-cta {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
}
.promo-button.sub-cta:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --------------------------------------------------------------------------
   Feedback Card (.feedback-card) & Footer
   -------------------------------------------------------------------------- */
.feedback-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.35rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.feedback-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.feedback-icon {
    color: #2563eb;
    background: #eff6ff;
    padding: 0.6rem;
    border-radius: 50%;
    display: flex;
}

.feedback-text h4 {
    font-size: 0.95rem;
    color: #0f172a;
    margin-bottom: 0.2rem;
}

.feedback-text p {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.feedback-btn {
    background: #f8fafc;
    color: #1e3a8a;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.55rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    touch-action: manipulation;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.feedback-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}

.series-footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 1.5rem 0 0.5rem;
    border-top: 1px solid #e2e8f0;
}

/* --------------------------------------------------------------------------
   Modal Dialog Styles (Standard 4.2 & 19)
   -------------------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
}

.modal-window {
    position: relative;
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    max-width: 680px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    z-index: 1001;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.15rem 1.35rem;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    font-size: 1.1rem;
    color: #0f172a;
    font-weight: 700;
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
    touch-action: manipulation;
    padding: 0.25rem;
}

.modal-body {
    padding: 1.35rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.modal-admission {
    margin: 0;
}

.modal-series-card {
    margin: 0;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.modal-footer {
    padding: 0.85rem 1.35rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
}

.modal-dismiss-btn {
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1.15rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
}

/* --------------------------------------------------------------------------
   Mobile Responsiveness (AGENTS.md Constraints)
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .sim-layout {
        display: flex;
        flex-direction: column;
        gap: 1.25rem;
    }

    /* Option A Standard: Visualizer & Canvas render first */
    .visualizer-panel {
        order: 1;
    }

    /* Controls unroll smoothly beneath without internal scroll trap */
    .controls-panel {
        order: 2;
        max-height: none;
        overflow-y: visible;
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
    }

    .c-grid-3col {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 680px) {
    body {
        padding: 0.75rem 0.5rem 2rem;
    }

    .sim-title {
        font-size: 1.6rem;
    }

    .sim-subtitle {
        font-size: 0.88rem;
    }

    /* Button groups responsive collapse */
    .mode-toggle-group {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }

    .mode-btn {
        min-height: 42px;
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }

    .c-stage-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .c-readout {
        align-items: flex-start;
    }

    .c-stage-actions {
        justify-content: space-between;
    }

    /* Composite Slider 2-Line Flex-Wrap Pattern */
    .c-slider {
        margin-bottom: 1rem;
    }

    .c-slider-head {
        margin-bottom: 0.4rem;
    }

    .c-slider-row {
        gap: 0.4rem;
    }

    .c-step {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        font-size: 1.35rem;
    }

    .preset-pill-grid {
        grid-template-columns: 1fr;
    }

    .program-grid {
        grid-template-columns: 1fr;
    }

    .c-grid-3col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .promo-actions {
        flex-direction: column;
        width: 100%;
    }

    .promo-button {
        width: 100%;
    }

    .feedback-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .feedback-btn {
        width: 100%;
        text-align: center;
    }
}


/* ==================== 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; }
