/* ============================================================================
 *  pod-simulators.css — Apply-Mode simulator styles (Phase 1)
 *  Scoped to .pod-simulator-container so they can't bleed into other
 *  activity types. Visuals match pod-play.css's existing color tokens
 *  (sky-500 / sky-600 for the simulator chrome, indigo accents for water).
 * ========================================================================= */

.pod-simulator-container {
    max-width: 920px;
    margin: 0 auto;
    padding: 1rem 0 2rem;
}

/* ── Slide layout (Play) ────────────────────────────────────────────────────
 *  BuildSimulatorHtml wraps the sim in .sim-slide-layout: .sim-brief-col holds
 *  the reading (title, scenario, and the key-idea / how-to / directions panels
 *  pod-simulators.js appends there), .sim-work-col holds the task + the sim.
 *  Desktop puts them side by side like an informational slide rather than one
 *  long vertical read; below 1200px they stack, reading first. The editor
 *  preview builds its own container without these wrappers, so it is untouched.
 * ------------------------------------------------------------------------- */
.simulator-header { text-align: center; margin-bottom: 1rem; }
.simulator-title  { font-weight: 700; }
.simulator-scenario { max-width: 620px; margin: 0 auto; }

.sim-concept-panel { max-width: 680px; margin: 0 auto 16px; }

.simulator-question {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 12px;
    padding: 10px 16px;
    margin-bottom: 16px;
    text-align: center;
}
.simulator-question .activity-question { font-size: 1.15rem; margin-bottom: 0; }

@media (min-width: 1200px) {
    /* Not 992: at 992-1199 the sim column is ~500px, which forces the
       sims' own two-column grids to stack — a long read again, just in a
       narrower column. The player card is 1400px wide; the old 920px cap
       only made sense for a single centred column. */
    .pod-simulator-container.sim-slide { max-width: 1320px; }

    .sim-slide-layout {
        display: grid;
        grid-template-columns: minmax(260px, 0.8fr) minmax(0, 2fr);
        gap: 32px;
        align-items: start;
    }

    .sim-brief-col .simulator-header { text-align: left; }
    .sim-brief-col .simulator-title  { font-size: 1.6rem; }
    .sim-brief-col .simulator-scenario { max-width: none; margin: 0; }
    .sim-brief-col .sim-concept-panel { max-width: none; margin: 0 0 12px; }
    .sim-brief-col .sim-howto-panel   { max-width: none; margin-left: 0; margin-right: 0; }

    .sim-work-col .simulator-question { text-align: left; }

    /* The sims' own two-column grids (.mt-sim-layout: Osmosis, Enzyme) now
       sit inside a narrower column, so they collapse on the COLUMN's width,
       not the viewport's. */
    .sim-work-col { min-width: 0; container-type: inline-size; }
}

.mt-sim-layout {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(280px, 1.1fr);
    gap: 24px;
    align-items: start;
}

@media (max-width: 760px) {
    .mt-sim-layout { grid-template-columns: 1fr; }
}

/* After the base rule on purpose: @container adds no specificity. */
@container (max-width: 640px) {
    .mt-sim-layout { grid-template-columns: 1fr; }
}

.mt-sim-visual {
    background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 16px;
    padding: 12px 14px;
    border: 1px solid #bae6fd;
}

.mt-sim-svg {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    background: #e0f2fe;
}

.mt-sim-cell {
    /* `r` animates the cell swelling / shrinking once the answer is in. */
    transition: fill 0.2s ease, r 1.4s ease;
}
@media (prefers-reduced-motion: reduce) {
    .mt-sim-cell { transition: none; }
}

.mt-sim-labels {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.mt-sim-label-inside,
.mt-sim-label-outside {
    background: white;
    border: 1px solid #bae6fd;
    border-radius: 999px;
    padding: 4px 12px;
    color: #0c4a6e;
}

.mt-sim-label-key  { font-weight: 600; }
.mt-sim-label-val  { font-weight: 700; color: #0369a1; }

/* ── Control column ─────────────────────────────────────────────────────── */
.mt-sim-controls {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mt-sim-section-header {
    font-weight: 700;
    color: #0f172a;
    margin: 4px 0 12px;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mt-sim-section-header.mt-4 { margin-top: 1.5rem; }

/* ── Slider rows ───────────────────────────────────────────────────────── */
.mt-sim-slider-row {
    margin-bottom: 14px;
}

.mt-sim-slider-label {
    display: block;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.mt-sim-slider-bar {
    display: flex;
    gap: 10px;
    align-items: center;
}

.mt-sim-slider-bar input[type=range] {
    flex: 1;
    accent-color: #0ea5e9;
}

.mt-sim-slider-number {
    width: 72px;
    padding: 4px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-weight: 600;
    text-align: right;
}

.mt-sim-slider-number:disabled,
.mt-sim-slider-bar input[type=range]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── Toggle row ────────────────────────────────────────────────────────── */
.mt-sim-toggle-row {
    margin: 4px 0 6px;
}

.mt-sim-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
}

.mt-sim-toggle-label input[type=checkbox] {
    width: 18px;
    height: 18px;
    accent-color: #0ea5e9;
}

.mt-sim-toggle-label input[type=checkbox]:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.mt-sim-toggle-label input[type=checkbox]:disabled + span {
    color: #64748b;
}

/* ── Answer options ────────────────────────────────────────────────────── */
.mt-sim-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mt-sim-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    background: white;
}

.mt-sim-option:hover {
    border-color: #93c5fd;
    background: #f0f9ff;
}

.mt-sim-option input[type=radio] {
    width: 0;
    height: 0;
    opacity: 0;
    position: absolute;
}

.mt-sim-option-bullet {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 2px solid #94a3b8;
    flex: 0 0 18px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.mt-sim-option-selected {
    border-color: #0ea5e9;
    background: #e0f2fe;
}

.mt-sim-option-selected .mt-sim-option-bullet {
    border-color: #0ea5e9;
    background: radial-gradient(circle at center, #0ea5e9 0 6px, transparent 6px);
}

.mt-sim-option-text {
    font-weight: 600;
    color: #0f172a;
}

.mt-sim-option-correct {
    border-color: #10b981;
    background: #ecfdf5;
}

.mt-sim-option-incorrect {
    border-color: #ef4444;
    background: #fef2f2;
}

.mt-sim-option input[type=radio]:disabled + .mt-sim-option-bullet {
    opacity: 0.6;
}

/* ── Submit + feedback ─────────────────────────────────────────────────── */
.mt-sim-submit {
    margin-top: 16px;
    align-self: flex-start;
    /* sky-700 -> sky-800, not sky-500 -> sky-600. Its label is white at 20px
       non-bold, so it needs 4.5:1: the old gradient measured 2.9:1 at the light
       stop and 4.1:1 at the dark one. These give 5.9:1 and 7.5:1 across the
       whole sweep. */
    background: linear-gradient(135deg, #0369a1, #075985);
    border: none;
}

.mt-sim-submit:hover:not(:disabled) {
    background: linear-gradient(135deg, #0284c7, #0369a1);
}

.mt-sim-feedback {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 0.95rem;
    line-height: 1.5;
}

.mt-sim-feedback:empty {
    display: none;
}

.mt-sim-feedback-correct {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #064e3b;
}

.mt-sim-feedback-incorrect {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #7f1d1d;
}

.mt-sim-feedback-error {
    background: #fef9c3;
    border-color: #fde68a;
    color: #854d0e;
}

.mt-sim-feedback-headline {
    font-weight: 700;
    font-size: 1.05rem;
}

.mt-sim-feedback-note {
    margin-top: 6px;
    font-size: 0.875rem;
    opacity: 0.85;
}

/* ── Water-dot flow animation (used after submit) ──────────────────────── */
@keyframes mtSimWaterFlow {
    0%   { transform: translate(0, 0);                       opacity: 1; }
    80%  { transform: translate(var(--mt-flow-tx, 0), var(--mt-flow-ty, 0)); opacity: 1; }
    100% { transform: translate(var(--mt-flow-tx, 0), var(--mt-flow-ty, 0)); opacity: 0.1; }
}

.mt-sim-water-dot {
    animation: mtSimWaterFlow 1.6s ease-in-out infinite;
    transform-origin: center;
}

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
    .mt-sim-water-dot { animation: none; opacity: 0.7; }
}

/* ============================================================================
 *  Punnett-square grid (Cross simulator). Previously these visuals lived as
 *  inline styles in pod-simulators.js; they're classes now so dark mode can
 *  restyle them.
 * ========================================================================= */
.pn-sim-grid td {
    border: 2px solid #cbd5e1;
    text-align: center;
}

.pn-sim-corner,
.pn-sim-axis {
    padding: 8px 10px;
    font-weight: 700;
    min-width: 56px;
}

.pn-sim-corner { background: #e2e8f0; }   /* empty top-left cell */
.pn-sim-axis   { background: #f1f5f9; }   /* parent-allele headers */

.pn-sim-box { padding: 5px; }             /* offspring <select> cell */

/* Per-cell correctness tint — toggled by the renderer on each <select> change. */
.pn-sim-box-correct { background: #dcfce7; }
.pn-sim-box-wrong   { background: #fee2e2; }

/* Dihybrid (4×4) extras — its offspring cells hold the genotype as TEXT (the
   monohybrid cells hold a <select>) and are phenotype-colour-coded as the
   square fills in. */
/* slate-600, not slate-500: #64748b on the #e2e8f0 corner cell measured
   3.9:1. This is real text (the "♀ × ♂" axis label), so it needs 4.5:1. */
.pn-sim-corner { color: #475569; }
.pn-di-box { color: #1e293b; font-weight: 700; }
.pn-di-pheno-both { background: #dcfce7; }   /* both dominant   → green  */
.pn-di-pheno-dom1 { background: #dbeafe; }   /* dom gene 1 only → blue   */
.pn-di-pheno-dom2 { background: #fef9c3; }   /* dom gene 2 only → yellow */
.pn-di-pheno-rec  { background: #f1f5f9; }   /* both recessive  → grey   */

/* Allele emphasis. A capital "P" and lowercase "p" are nearly indistinguishable
   at the same size/weight, so cue dominant vs recessive apart by size + weight
   + color: dominant = large bold blue, recessive = smaller amber. */
.pn-sim-allele {
    display: inline-block;
    line-height: 1;
    font-family: Georgia, "Times New Roman", "Cambria Math", serif;
}
.pn-sim-allele-dom { font-size: 1.4rem; font-weight: 800; color: #1d4ed8; }
.pn-sim-allele-rec { font-size: 1rem;   font-weight: 600; color: #b45309; }

/* Genotype dropdowns — bold + a little tracking so PP / Pp / pp stay legible. */
.pn-sim-cell {
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ============================================================================
 *  Dark mode — match pod-play's cockpit palette ([data-theme="dark"]).
 *  The shared darkmode.css is NOT loaded on the pod-play view, so the
 *  simulator chrome (hard-coded light colors above) must opt into dark here.
 * ========================================================================= */
[data-theme="dark"] .mt-sim-section-header { color: var(--cockpit-text); }

/* Answer options (phenotype-ratio radios + osmosis choices). */
[data-theme="dark"] .mt-sim-option {
    background: var(--cockpit-bg);
    border-color: var(--cockpit-border);
}
[data-theme="dark"] .mt-sim-option:hover {
    border-color: var(--cockpit-accent);
    background: rgba(99, 102, 241, 0.10);
}
[data-theme="dark"] .mt-sim-option-text { color: var(--cockpit-text); }

[data-theme="dark"] .mt-sim-option-selected {
    border-color: var(--cockpit-accent);
    background: rgba(99, 102, 241, 0.18);
}
[data-theme="dark"] .mt-sim-option-selected .mt-sim-option-bullet {
    border-color: var(--cockpit-accent);
    background: radial-gradient(circle at center, var(--cockpit-accent) 0 6px, transparent 6px);
}
[data-theme="dark"] .mt-sim-option-correct {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.18);
}
[data-theme="dark"] .mt-sim-option-incorrect {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.18);
}

/* Punnett grid. */
[data-theme="dark"] .pn-sim-grid td { border-color: var(--cockpit-border); }
[data-theme="dark"] .pn-sim-corner  { background: var(--cockpit-surface-hover); }
[data-theme="dark"] .pn-sim-axis    { background: var(--cockpit-surface); }
[data-theme="dark"] .pn-sim-box     { background: var(--cockpit-bg); }
[data-theme="dark"] .pn-sim-box-correct { background: rgba(16, 185, 129, 0.28); }
[data-theme="dark"] .pn-sim-box-wrong   { background: rgba(239, 68, 68, 0.28); }

[data-theme="dark"] .pn-sim-allele-dom { color: #60a5fa; }   /* lighter blue  */
[data-theme="dark"] .pn-sim-allele-rec { color: #fbbf24; }   /* lighter amber */

/* Dihybrid offspring text + phenotype tints in dark mode. Translucent fills so
   the genotype text stays legible over the dark cell (defined after the
   .pn-sim-box dark bg above so these win on the shared cell). */
/* --cockpit-text-muted on the surface-hover corner cell measured 4.0:1.
   slate-300 clears the floor and still reads as a quiet axis label. */
[data-theme="dark"] .pn-sim-corner { color: #d6d6d6; }
[data-theme="dark"] .pn-di-box { color: var(--cockpit-text); }
[data-theme="dark"] .pn-di-pheno-both { background: rgba(34, 197, 94, 0.32); }
[data-theme="dark"] .pn-di-pheno-dom1 { background: rgba(59, 130, 246, 0.32); }
[data-theme="dark"] .pn-di-pheno-dom2 { background: rgba(234, 179, 8, 0.32); }
[data-theme="dark"] .pn-di-pheno-rec  { background: rgba(165, 165, 165, 0.26); }

/* Genotype dropdowns — scoped under .pn-sim-grid so this wins over any generic
   [data-theme="dark"] .form-select rule regardless of stylesheet order. */
[data-theme="dark"] .pn-sim-grid .pn-sim-cell {
    background-color: var(--cockpit-surface);
    color: var(--cockpit-text);
    border-color: var(--cockpit-border);
    /* Light caret so the dropdown affordance stays visible on a dark control.
       Pin repeat/position/size too — the SVG has only a viewBox (no intrinsic
       size), so without an explicit background-size it balloons to fill the box. */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23cbd5e1' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}
[data-theme="dark"] .pn-sim-grid .pn-sim-cell option {
    background-color: var(--cockpit-surface);
    color: var(--cockpit-text);
}

/* Submit button — follow the app-wide cockpit-accent primary instead of the
   light sky gradient. */
[data-theme="dark"] .mt-sim-submit {
    /* indigo-600, one step down from --cockpit-accent's indigo-500. White on
       the raw token measured 4.45:1 — a hair under the 4.5:1 needed for this
       20px non-bold label; this gives 6.3:1. Scoped to .mt-sim-submit, so the
       app-wide accent token is untouched. */
    background: #4f46e5;
    border: none;
}
[data-theme="dark"] .mt-sim-submit:hover:not(:disabled) {
    background: #4f46e5;
    filter: brightness(1.12);
}

/* Feedback banner. */
[data-theme="dark"] .mt-sim-feedback-correct {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.35);
    color: #6ee7b7;
}
[data-theme="dark"] .mt-sim-feedback-incorrect {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}
[data-theme="dark"] .mt-sim-feedback-error {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.35);
    color: #fcd34d;
}

/* ============================================================================
 *  Dihybrid gamete picker — two side-by-side selects per gamete (one allele
 *  from each gene). The selects carry .pn-sim-cell so they inherit the shared
 *  dark-mode dropdown styling above.
 * ========================================================================= */
.pn-di-gamete-pick {
    display: flex;
    gap: 3px;
    align-items: center;
    justify-content: center;
}

/* ============================================================================
 *  "Show me how to fill it in" worked-example panel (practice run only).
 * ========================================================================= */
.sim-howto-panel {
    max-width: 680px;
    margin: 0 auto 16px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #f0f9ff;
    padding: 2px 16px;
}
.sim-howto-summary {
    cursor: pointer;
    font-weight: 700;
    color: #075985;
    padding: 9px 0;
    list-style: none;
}
.sim-howto-summary::-webkit-details-marker { display: none; }
.sim-howto-summary::before { content: "\25B8\00a0"; }      /* ▸ */
.sim-howto-panel[open] > .sim-howto-summary::before { content: "\25BE\00a0"; }  /* ▾ */
.sim-howto-body { padding: 2px 0 12px; }

/* Mini example squares reuse .pn-sim-grid / .pn-di-box / .pn-di-pheno-* so they
   match the live grid and inherit dark mode; only sizing is tuned here. */
.sim-howto-cell {
    font-family: monospace;
    font-weight: 700;
    padding: 4px 6px;
    min-width: 42px;
    text-align: center;
}
.sim-howto-gam-axis {
    font-family: monospace;
    font-size: 12px;
    padding: 4px 7px !important;
    min-width: 0;
}

/* Gamete-building grid cells — neutral tint so this step doesn't read as a
   phenotype-coloured answer square. */
.sim-howto-gamete-cell { background: #f8fafc; }

/* Row of the four resulting gametes (chips). */
.sim-howto-foil {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 6px 0 2px;
}
.sim-howto-gamete {
    font-family: monospace;
    font-weight: 700;
    padding: 2px 7px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
}

/* Phenotype-colour legend under each mini grid. */
.sim-howto-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    font-size: 0.78rem;
    color: #475569;
    margin-top: 8px;
}
.sim-howto-legend-item { display: inline-flex; align-items: center; gap: 4px; }
.sim-howto-swatch {
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 1px solid #cbd5e1;
    border-radius: 2px;
    vertical-align: middle;
}

/* Monohybrid worked box: top + side = genotype. */
.sim-howto-combo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 6px 0 4px;
}
.sim-howto-combo-term {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.sim-howto-combo-label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.sim-howto-combo-op { font-size: 1.2rem; font-weight: 700; opacity: 0.6; }
.sim-howto-result {
    display: inline-block;
    border: 2px solid #cbd5e1;
    border-radius: 3px;
}

/* Flow connector: ties one block to the next ("↓ these become …"). */
.sim-howto-connector {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 6px 0 2px;
    line-height: 1.1;
}
.sim-howto-connector-arrow { font-size: 1.3rem; color: #0ea5e9; }
.sim-howto-connector-text { font-size: 0.76rem; color: #475569; }

[data-theme="dark"] .sim-howto-panel {
    background: rgba(56, 189, 248, 0.08);
    border-color: var(--cockpit-border);
}
/* Task box above the sim (slide layout). Translucent fill so the question
   keeps the themed text colour it already had. */
[data-theme="dark"] .simulator-question {
    background: rgba(56, 189, 248, 0.08);
    border-color: rgba(56, 189, 248, 0.28);
}
/* Panel heading, not a fill: --cockpit-accent as text measures ~3.5:1 on
   this panel. indigo-300 keeps the hue and clears 4.5:1. */
[data-theme="dark"] .sim-howto-summary { color: #a5b4fc; }
[data-theme="dark"] .sim-howto-body { color: var(--cockpit-text); }
[data-theme="dark"] .sim-howto-gamete {
    background: var(--cockpit-surface);
    border-color: var(--cockpit-border);
    color: var(--cockpit-text);
}
[data-theme="dark"] .sim-howto-legend { color: var(--cockpit-text-muted); }
[data-theme="dark"] .sim-howto-swatch { border-color: var(--cockpit-border); }
[data-theme="dark"] .sim-howto-gamete-cell { background: var(--cockpit-surface); }
[data-theme="dark"] .sim-howto-combo-label { color: var(--cockpit-text-muted); }
[data-theme="dark"] .sim-howto-result { border-color: var(--cockpit-border); }
[data-theme="dark"] .sim-howto-connector-arrow { color: var(--cockpit-accent); }
[data-theme="dark"] .sim-howto-connector-text { color: var(--cockpit-text-muted); }

/* ============================================================================
 *  Mutation sim — highlighted base + "Show me how this works" codon visuals.
 *  (The Mutation renderer is otherwise styled inline in pod-simulators.js.)
 * ========================================================================= */

/* Highlighted (changed) base — used by the live sim AND its how-to. Dark ink on
   the amber stays readable in BOTH themes; the old inline style set no colour,
   so in dark mode the light inherited text vanished against the yellow. */
.mu-sim-base-highlight {
    background: #fde68a;
    color: #1e293b;
    font-weight: 700;
    border-radius: 3px;
    padding: 0 2px;
}
[data-theme="dark"] .mu-sim-base-highlight { background: #fbbf24; }

/* "Resulting mRNA" sequence colour — lighter blue in dark mode for contrast. */
/* sky-700, not sky-600: at 1.2rem non-bold this is normal-size text, and
   #0284c7 on white measured 4.1:1 — just under the 4.5:1 floor. */
.mu-sim-seq-mutated { color: #0369a1; }
[data-theme="dark"] .mu-sim-seq-mutated { color: #60a5fa; }

/* ============================================================================
 *  Enzyme sim — live lock-and-key scene + on-submit reaction animation.
 *  Reuses .mt-sim-layout / .mt-sim-visual / .mt-sim-svg from MembraneTransport;
 *  only the enzyme-specific bits live here. The SVG is a light scene in both
 *  themes (same as the membrane visual), so it needs no dark-mode override.
 * ========================================================================= */
.ez-sim-labels { justify-content: center; flex-wrap: wrap; }
.ez-sim-enzyme { transition: fill 0.2s ease, stroke 0.2s ease; }
.ez-sim-warm   { transition: opacity 0.2s ease; }
.ez-sim-fit    { transition: fill 0.2s ease, opacity 0.2s ease; }

/* Substrate docking into the active site (plays on submit). */
@keyframes ezSimDock {
    0%   { transform: translate(0, 0); opacity: 1; }
    70%  { transform: translate(var(--ez-tx, 0), var(--ez-ty, 0)); opacity: 1; }
    100% { transform: translate(var(--ez-tx, 0), var(--ez-ty, 0)); opacity: 0; }
}
.ez-sim-react-dot { animation: ezSimDock 1s ease-in infinite; transform-origin: center; }

/* Product leaving the enzyme (plays on submit). */
@keyframes ezSimProduct {
    0%   { transform: translate(0, 0); opacity: 0; }
    30%  { opacity: 1; }
    100% { transform: translate(var(--ez-px, 0), 26px); opacity: 0; }
}
.ez-sim-product-dot { animation: ezSimProduct 1s ease-out infinite; transform-origin: center; }

@media (prefers-reduced-motion: reduce) {
    .ez-sim-react-dot, .ez-sim-product-dot { animation: none; opacity: 0.85; }
}

/* Sketch graphs shown with the enzyme result (rate vs temperature, rate vs pH).
   Colours come from classes, not inline attributes, so dark mode can restyle. */
.ez-chart { margin-top: 10px; }
.ez-chart-svg { width: 100%; height: auto; display: block; }
.ez-chart-axis { stroke: #64748b; stroke-width: 1; }
.ez-chart-curve { stroke: #0f766e; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ez-chart-drop { stroke: #b45309; stroke-width: 1; stroke-dasharray: 3 2; }
.ez-chart-you { fill: #f59e0b; stroke: #78350f; stroke-width: 1.5; }
.ez-chart-text { fill: #334155; }
[data-theme="dark"] .ez-chart-axis { stroke: var(--cockpit-text-muted); }
[data-theme="dark"] .ez-chart-curve { stroke: #5eead4; }
[data-theme="dark"] .ez-chart-drop { stroke: #fbbf24; }
[data-theme="dark"] .ez-chart-text { fill: var(--cockpit-text); }

/* ============================================================================
 *  Cell Builder — organelle icons in the palette + as stickers inside the cell.
 * ========================================================================= */
.cb-part-btn { display: inline-flex; align-items: center; gap: 6px; }
.cb-icon { flex: 0 0 auto; vertical-align: middle; }
.cb-cell-part {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 3px 8px;
    margin: 2px;
    font-size: 12px;
    color: #1e293b;
}

/* The palette uses Bootstrap btn-outline-secondary, whose grey text is too low
   contrast on the dark cockpit background — lighten it in dark mode. (Active
   parts use btn-info, which is already legible.) The in-cell stickers keep their
   white background in both themes, so their dark text stays readable. */
[data-theme="dark"] .cb-part-btn.btn-outline-secondary {
    color: var(--cockpit-text);
    border-color: var(--cockpit-border);
    background: var(--cockpit-surface);
}
[data-theme="dark"] .cb-part-btn.btn-outline-secondary:hover {
    background: var(--cockpit-surface-hover);
    color: var(--cockpit-text);
}

/* Codon strips (letters over the amino acid) + the four-effects before→after demos. */
.mu-howto-strip,
.mu-howto-outcome-demo {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    margin: 6px 0;
}
.mu-howto-codon { text-align: center; font-family: monospace; }
.mu-howto-codon-letters { font-size: 1.1rem; font-weight: 700; letter-spacing: 1px; }
.mu-howto-codon-aa {
    font-size: 0.72rem;
    color: #475569;
    margin-top: 2px;
    border-top: 1px solid #cbd5e1;
    padding-top: 1px;
}
.mu-howto-base { padding: 0 1px; }
.mu-howto-outcome { margin-bottom: 10px; }
.mu-howto-tag { font-weight: 700; }
[data-theme="dark"] .mu-howto-codon-aa { color: var(--cockpit-text-muted); border-top-color: var(--cockpit-border); }

/* Before/after protein chains shown with the mutation result. */
.mu-protein-compare { margin-top: 10px; }
.mu-protein-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 4px; }
.mu-protein-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.mu-protein-label { font-size: 0.8rem; font-weight: 600; min-width: 64px; }
.mu-protein-chain { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.mu-protein-aa {
    font-family: monospace;
    font-size: 0.8rem;
    padding: 1px 6px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #1e293b;
}
/* Same amber as .mu-sim-base-highlight: dark ink stays readable in both themes. */
.mu-protein-stop {
    font-family: monospace;
    font-size: 0.75rem;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px dashed #b91c1c;
    color: #b91c1c;
    background: #fff;
}
.mu-protein-aa-changed { background: #fde68a; border-color: #d97706; font-weight: 700; color: #1e293b; }
[data-theme="dark"] .mu-protein-aa-changed { background: #fbbf24; }

/* ============================================================================
 *  A4 — THEME COVERAGE COMPLETED, plus styling for the elements the Apply-Mode
 *  audit fixes introduced.
 *
 *  Two things to know before editing anything below.
 *
 *  1. --cockpit-* IS NOT ALWAYS DEFINED. The tokens exist on Play (pod-play.css)
 *     and Present (an inline :root block in Present.cshtml). The TEACHER EDITOR
 *     (Views/Pods/Edit.cshtml) loads this stylesheet and mounts the same
 *     renderer in preview mode, but defines no cockpit tokens at all — so a bare
 *     `var(--cockpit-text)` there is invalid at computed-value time, which makes
 *     `color` fall back to inherited and `background` fall back to transparent.
 *     That is why every token reference in this block carries a literal
 *     fallback: var(--cockpit-text, #f1f5f9). The pre-existing rules further up
 *     have no fallbacks; they are left as they are rather than churned, but
 *     ANYTHING NEW MUST CARRY ONE.
 *
 *  2. SOME PANELS ARE DELIBERATELY LIGHT IN BOTH THEMES. .mt-sim-visual keeps
 *     its pale sky gradient in dark mode (a cell diagram reads better on light),
 *     and the Cell Builder cell box is drawn on #f0fdf4 / #f0f9ff by inline
 *     style. Text sitting on those surfaces must stay DARK in dark mode. So this
 *     block never does `[data-theme="dark"] .pod-simulator-container * { color:
 *     light }` — a blanket override would black out exactly the labels that sit
 *     on the light diagrams. Each rule names the element it means, and the
 *     keys drawn onto the light visual panel are pinned dark below.
 * ========================================================================= */

/* ── Slider + toggle labels ──────────────────────────────────────────────────
   These hard-coded #1e293b and had no dark rule at all, so on the dark cockpit
   background every control was labelled in near-black on near-black: the
   sliders worked but you could not read what they controlled. */
[data-theme="dark"] .mt-sim-slider-label,
[data-theme="dark"] .mt-sim-toggle-label {
    color: var(--cockpit-text, #f5f5f5);
}
[data-theme="dark"] .mt-sim-toggle-label input[type=checkbox]:disabled + span {
    color: var(--cockpit-text-muted, #a5a5a5);
}

/* Numeric companion input beside each slider — it had only a light border and
   inherited its background, so it rendered as a white box in dark mode. */
[data-theme="dark"] .mt-sim-slider-number {
    background: var(--cockpit-surface, #2b2b2b);
    color: var(--cockpit-text, #f5f5f5);
    border-color: var(--cockpit-border, #434343);
}
[data-theme="dark"] .mt-sim-slider-number:disabled {
    background: var(--cockpit-bg, #1b1b1b);
    color: var(--cockpit-text-muted, #a5a5a5);
}

/* ── Muted helper text ───────────────────────────────────────────────────────
   The hints, trait labels and grid-status lines ("0 of 4 boxes correct", "Fill
   all eight gametes to build the square", "Cross: Pp x Pp") all use Bootstrap's
   .text-muted, whose #6c757d measured 3.8:1 on the dark cockpit background and
   4.4:1 on the pale panels in light mode — both under the 4.5:1 floor for
   normal-size text.

   Scoped to the container and then EXCLUDED from the two surfaces that stay
   light in both themes (point 2 of the header note): .mt-sim-visual's gradient
   and the Cell Builder cell box, whose inline background is a pale green/blue.
   Those two get dark muted text in BOTH themes. A blanket
   `[data-theme="dark"] ... .text-muted { light }` would have blacked out
   exactly the "Empty — click parts on the right to add them." placeholder
   sitting inside the pale cell. */
.pod-simulator-container .text-muted {
    color: #475569 !important;   /* slate-600: 7.5:1 on white, 7:1 on #f0f9ff */
}
[data-theme="dark"] .pod-simulator-container .text-muted {
    color: #a8b3c4 !important;   /* 7.6:1 on #1b1b1b */
}
/* Deliberately-light surfaces keep dark muted text in dark mode. */
[data-theme="dark"] .mt-sim-visual .text-muted,
[data-theme="dark"] .cb-cell-box .text-muted {
    color: #575757 !important;
}

/* Keyboard focus. The options are <label>s wrapping a radio, so without this
   the focus ring landed on a visually hidden input and a keyboard user had no
   idea where they were. Applies in both themes. */
.mt-sim-option:focus-within {
    outline: 3px solid #0ea5e9;
    outline-offset: 2px;
}
[data-theme="dark"] .mt-sim-option:focus-within {
    outline-color: var(--cockpit-accent, #6366f1);
}
.mt-sim-slider-bar input[type=range]:focus-visible,
.mt-sim-slider-number:focus-visible,
.cb-part-btn:focus-visible,
.mt-sim-submit:focus-visible,
.sim-howto-summary:focus-visible {
    outline: 3px solid #0ea5e9;
    outline-offset: 2px;
}
[data-theme="dark"] .mt-sim-slider-bar input[type=range]:focus-visible,
[data-theme="dark"] .mt-sim-slider-number:focus-visible,
[data-theme="dark"] .cb-part-btn:focus-visible,
[data-theme="dark"] .mt-sim-submit:focus-visible,
[data-theme="dark"] .sim-howto-summary:focus-visible {
    outline-color: var(--cockpit-accent, #6366f1);
}

/* Disabled option rows: a submitted or teacher-locked choice should read as
   inactive without becoming unreadable. */
.mt-sim-option input[type=radio]:disabled ~ .mt-sim-option-text {
    opacity: 0.75;
}
[data-theme="dark"] .mt-sim-option input[type=radio]:disabled ~ .mt-sim-option-text {
    color: var(--cockpit-text-muted, #a5a5a5);
}

/* Mutation type / base buttons — Bootstrap outline buttons whose default
   foreground is a dark slate. */
[data-theme="dark"] .mu-sim-btn-row .btn-outline-secondary,
[data-theme="dark"] .mu-sim-btn-row .btn-outline-primary {
    color: var(--cockpit-text, #f5f5f5);
    border-color: var(--cockpit-border, #434343);
    background: var(--cockpit-surface, #2b2b2b);
}
[data-theme="dark"] .mu-sim-btn-row .btn-outline-secondary.active,
[data-theme="dark"] .mu-sim-btn-row .btn-outline-primary.active {
    /* indigo-600 for the same reason as .mt-sim-submit above: white on
       indigo-500 measures 4.45:1, just under the floor. */
    background: #4f46e5;
    border-color: #4f46e5;
    color: #fff;
}

/* ── Keys drawn on the DELIBERATELY LIGHT visual panel ───────────────────────
   Point 2 of the header note. These sit inside .mt-sim-visual, which stays pale
   in dark mode, so their text is pinned dark in BOTH themes rather than
   following the theme. */
.mt-sim-key,
.ez-sim-key {
    color: #475569 !important;
    line-height: 1.35;
}
[data-theme="dark"] .mt-sim-key,
[data-theme="dark"] .ez-sim-key {
    color: #575757 !important;
}

/* ── Prediction status line (A7) ─────────────────────────────────────────── */
.mt-sim-pred-status {
    line-height: 1.35;
}
.mt-sim-pred-status-warn {
    color: #b45309;
    font-weight: 600;
}
[data-theme="dark"] .mt-sim-pred-status-warn {
    color: #fcd34d;
}

/* ── Locked graded case: the setup is there to read, not to move ─────────── */
.mt-sim-lock-note {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 6px 10px;
    color: #1e3a8a;
}
[data-theme="dark"] .mt-sim-lock-note {
    background: var(--cockpit-surface);
    border-color: var(--cockpit-border);
    color: var(--cockpit-text);
}

/* ── Recovery / re-run button rows (A1, A6) ──────────────────────────────── */
.mt-sim-recovery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

/* These buttons sit INSIDE a tinted .mt-sim-feedback panel, so Bootstrap's
   stock colours are measured against amber/green/red rather than the page:
   .btn-outline-secondary's #6c757d came out at 2.9:1 on the amber error panel
   in dark mode, and .btn-primary's #0d6efd at 3.6:1. Both are pinned here so
   they do not depend on whatever .btn-primary resolves to on the host page —
   pod-play.css, darkmode.css and the cyberpunk sheet all touch it. */
.mt-sim-recovery .btn-primary {
    background: #0369a1;
    border-color: #0369a1;
    color: #fff;
}
.mt-sim-recovery .btn-outline-secondary {
    color: #475569;
    border-color: #94a3b8;
}
.mt-sim-recovery .btn-outline-primary {
    color: #0369a1;
    border-color: #0369a1;
}
[data-theme="dark"] .mt-sim-recovery .btn-primary {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #fff;
}
[data-theme="dark"] .mt-sim-recovery .btn-outline-secondary {
    color: #e9e9e9;
    border-color: rgba(255, 255, 255, 0.4);
    background: transparent;
}
[data-theme="dark"] .mt-sim-recovery .btn-outline-primary {
    color: #a5b4fc;
    border-color: #a5b4fc;
    background: transparent;
}

/* ── "Practice run" banner shown by _startExplore (A6) ───────────────────── */
.mt-sim-explore-banner {
    max-width: 680px;
    margin: 0 auto 14px;
    line-height: 1.4;
}
[data-theme="dark"] .mt-sim-explore-banner {
    background: var(--cockpit-surface, #2b2b2b);
    border-color: var(--cockpit-border, #434343);
    color: var(--cockpit-text, #f5f5f5);
}

/* ── Unavailable-activity notice (A11) ───────────────────────────────────── */
.mt-sim-unavailable {
    max-width: 620px;
    margin: 0 auto;
    line-height: 1.45;
}
[data-theme="dark"] .mt-sim-unavailable {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.35);
    color: var(--cockpit-text, #f5f5f5);
}

/* ── Directions panel (A10) ──────────────────────────────────────────────────
   Reuses .sim-howto-panel chrome (and therefore its existing dark rules); only
   the list needs styling of its own. */
.sim-directions-list {
    margin: 0;
    padding-left: 1.25rem;
    line-height: 1.5;
    font-size: 0.9rem;
}
.sim-directions-list li + li { margin-top: 6px; }

/* ── Enzyme reference values (A10) ───────────────────────────────────────── */
.ez-sim-ref {
    border: 1px solid #bae6fd;
    background: #f0f9ff;
    border-radius: 10px;
    padding: 8px 12px;
    margin: 0 0 14px;
    font-size: 0.85rem;
}
.ez-sim-ref-title {
    font-weight: 700;
    color: #0c4a6e;
    margin-bottom: 4px;
}
.ez-sim-ref-list {
    margin: 0;
    padding-left: 1.1rem;
    line-height: 1.45;
    color: #1e293b;
}
/* This one IS a control-column panel, so it does follow the theme. */
[data-theme="dark"] .ez-sim-ref {
    background: rgba(56, 189, 248, 0.08);
    border-color: var(--cockpit-border, #434343);
}
[data-theme="dark"] .ez-sim-ref-title { color: #a5b4fc; }   /* see .sim-howto-summary */
[data-theme="dark"] .ez-sim-ref-list  { color: var(--cockpit-text, #f5f5f5); }

/* ── Codon reference (A10) ───────────────────────────────────────────────── */
.mu-codon-ref-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(96px, 1fr));
    gap: 10px;
    /* 64 codons: on a phone this scrolls sideways inside its own box rather
       than pushing the page wider. */
    overflow-x: auto;
}
@media (max-width: 560px) {
    .mu-codon-ref-grid { grid-template-columns: repeat(2, minmax(96px, 1fr)); }
}
.mu-codon-ref-head {
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #0369a1;
    margin-bottom: 2px;
}
.mu-codon-ref-cell {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    font-family: monospace;
    font-size: 0.8rem;
    padding: 1px 0;
}
.mu-codon-ref-codon { font-weight: 700; letter-spacing: 0.5px; }
.mu-codon-ref-aa    { color: #475569; }
[data-theme="dark"] .mu-codon-ref-head { color: #a5b4fc; }  /* see .sim-howto-summary */
[data-theme="dark"] .mu-codon-ref-cell { color: var(--cockpit-text, #f5f5f5); }
[data-theme="dark"] .mu-codon-ref-aa   { color: var(--cockpit-text-muted, #a5a5a5); }
