@charset "UTF-8";
/* Clinical-instrument direction: neutral ground, large dark readouts, colour only for meaning.
   Blue = actionable, amber = demo / pending / draft, red = problem, green = confirmed. */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --ink: #14181f; --ink-2: #3d4654; --muted: #5b6472;
  --line: #dde1e7; --line-strong: #8a929e;
  --accent: #1f5fbf; --accent-ink: #ffffff; --accent-soft: #e8f0fb;
  --warn-bg: #fff4dc; --warn-ink: #6b4100; --warn-line: #e3b04b;
  --danger: #b42318; --danger-bg: #fdecea; --danger-line: #eba398;
  --ok-bg: #e7f4ec; --ok-ink: #1d5c34; --ok-line: #8cc7a2;
  --orange-bg: #fdeee2; --orange-ink: #8a3b00; --orange-line: #efb084;
  --shadow: 0 10px 32px rgba(15, 20, 28, .16);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116; --surface: #161a21; --ink: #e8ebf0; --ink-2: #c3c9d3; --muted: #9aa3b0;
    --line: #2a313c; --line-strong: #5d6675;
    --accent: #80b1ff; --accent-ink: #0e1116; --accent-soft: #1b2a42;
    --warn-bg: #33270f; --warn-ink: #ffd28a; --warn-line: #7a5a1e;
    --danger: #ff9d8f; --danger-bg: #3a1714; --danger-line: #7a2f27;
    --ok-bg: #12301f; --ok-ink: #9fe0b5; --ok-line: #2f6b45;
    --orange-bg: #3a220f; --orange-ink: #ffc28f; --orange-line: #7a4a22;
    --shadow: 0 10px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1116; --surface: #161a21; --ink: #e8ebf0; --ink-2: #c3c9d3; --muted: #9aa3b0;
  --line: #2a313c; --line-strong: #5d6675;
  --accent: #80b1ff; --accent-ink: #0e1116; --accent-soft: #1b2a42;
  --warn-bg: #33270f; --warn-ink: #ffd28a; --warn-line: #7a5a1e;
  --danger: #ff9d8f; --danger-bg: #3a1714; --danger-line: #7a2f27;
  --ok-bg: #12301f; --ok-ink: #9fe0b5; --ok-line: #2f6b45;
  --orange-bg: #3a220f; --orange-ink: #ffc28f; --orange-line: #7a4a22;
  --shadow: 0 10px 32px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px; line-height: 1.6;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip-link { position: fixed; top: -100px; left: 12px; z-index: 60; background: var(--surface); padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 6px; }
.skip-link:focus { top: 10px; }
/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 7px 14px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 600; line-height: 1.3; white-space: nowrap;
}
.button:hover:not(:disabled) { border-color: var(--ink-2); }
.button.small { min-height: 36px; padding: 5px 12px; font-size: 14px; }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button.primary:hover:not(:disabled) { filter: brightness(1.08); }
.button.ghost { background: transparent; border-color: transparent; }
.button.ghost:hover:not(:disabled) { background: var(--bg); border-color: var(--line); }
.button.icon-only { width: 40px; padding: 0; font-size: 20px; }
.text-button {
  background: none; border: 0; padding: 6px 2px; min-height: 36px;
  color: var(--accent); font-size: 14px; font-weight: 600; text-align: left;
}
.text-button:hover { text-decoration: underline; }
.count {
  display: inline-block; min-width: 24px; padding: 0 6px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line); font-size: 13px; font-variant-numeric: tabular-nums; text-align: center;
}

/* App bar */
.appbar {
  display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top); box-sizing: content-box;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 17px; font-weight: 700; white-space: nowrap; }
.brand img { border-radius: 7px; }
/* On the narrowest phones the title shortens with an ellipsis instead of pushing the header sideways. */
.brand { min-width: 0; } .brand img { flex: none; } .brand-text { overflow: hidden; text-overflow: ellipsis; }
.badge-trial {
  font-size: 13px; font-weight: 600; padding: 1px 8px; border-radius: 4px; white-space: nowrap;
  background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line);
}
.appbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }

main { min-width: 0; padding: 24px 32px 48px; max-width: 1240px; }
h1 { font-size: 26px; font-weight: 700; line-height: 1.35; margin: 2px 0 4px; }
.auto-remember { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 4px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.auto-remember input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }

.field { display: block; min-width: 0; }
.field-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.field-label small { font-size: 13px; font-weight: 400; color: var(--muted); }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .mobile-tool select {
  width: 100%; height: 48px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); font-size: 18px; font-variant-numeric: tabular-nums; min-width: 0;
}
.field select, .mobile-tool select { font-size: 16px; }
.field input::placeholder { color: var(--muted); font-size: 15px; opacity: 1; }
.field input:focus, .field select:focus, .search-box input:focus, .mobile-tool select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field [aria-invalid="true"] { border-color: var(--danger) !important; background: var(--danger-bg) !important; }
body.is-page .result-dock { display: none !important; }
/* 3D heart */
.h3d { margin-bottom: 24px; }
.h3d-topics { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.h3d-topics button { min-height: 40px; padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 600; }
.h3d-topics button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.h3d-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.h3d-stage { position: relative; height: min(68vh, 620px); min-height: 360px; border: 1px solid var(--line); border-top: 4px solid var(--ink); border-radius: 6px; background: radial-gradient(circle at 50% 40%, var(--surface), var(--bg)); overflow: hidden; }
.h3d-canvas, .h3d-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.h3d-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.h3d-label { position: absolute; left: 0; top: 0; padding: 1px 6px; border-radius: 4px; background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap; box-shadow: 0 1px 3px rgba(15, 20, 28, .18); }
.h3d-status { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; padding: 10px 14px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line-strong); font-size: 15px; color: var(--ink-2); text-align: center; max-width: 80%; }
.h3d-status.is-error { color: var(--danger); border-color: var(--danger-line); background: var(--danger-bg); }
/* Without WebGL only the message stays in the stage; topics, explanations and the structure list remain below. */
.h3d.is-text-only .h3d-stage { height: auto; min-height: 0; border-top-width: 1px; }
.h3d.is-text-only .h3d-status { position: static; transform: none; max-width: none; margin: 12px; }
.h3d-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; }
.h3d-views { display: flex; flex-wrap: wrap; gap: 6px; }
.h3d-range { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.h3d-range input { width: 140px; accent-color: var(--accent); }
.h3d-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 10px 0 0; font-size: 13px; color: var(--ink-2); }
.h3d-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--ink-2); }
.h3d-swatch.is-oxy { background: #c0453c; } .h3d-swatch.is-deoxy { background: #3f6fae; } .h3d-swatch.is-valve { background: #d8ae4f; }
.h3d-swatch.is-chamber-oxy { background: #d77a6f; } .h3d-swatch.is-chamber-deoxy { background: #7d9ccb; } .h3d-swatch.is-muscle { background: #9a8a80; }
.h3d-swatch.is-p-oxy { background: #ff5a4a; border-radius: 50%; } .h3d-swatch.is-p-deoxy { background: #4f8dff; border-radius: 50%; }
.h3d-swatch.is-p-mix { background: linear-gradient(90deg, #ff5a4a 50%, #4f8dff 50%); border-radius: 50%; }
.h3d-swatch.is-gas { background: #5e9e62; } .h3d-swatch.is-water { background: #3a9fae; }
.h3d-swatch.is-drain { background: #4f7fc4; } .h3d-swatch.is-ret { background: #d0453c; } .h3d-swatch.is-monitor { background: #e0a030; }
.h3d-swatch.is-mix { background: #9b6bd3; border-radius: 50%; } .h3d-swatch.is-artery { background: #d9a19b; } .h3d-swatch.is-vein { background: #9fb3d1; }
/* Variants: scenes of one topic, compared without moving the camera. */
.h3d-variants { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.h3d-variants-label { font-size: 14px; font-weight: 600; color: var(--ink-2); margin-right: 2px; }
.h3d-variants .button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.h3d-variant-text { margin: 8px 0 0; padding: 8px 10px; border-left: 3px solid var(--warn-line); background: var(--warn-bg); color: var(--ink); font-size: 15px; line-height: 1.7; }
.h3d-label.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.h3d-legend-note { color: var(--muted); margin-left: 6px; }
.h3d-key { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.h3d-info { position: sticky; top: 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.h3d-topic-title { margin: 0 0 6px; font-size: 18px; font-weight: 650; }
.h3d-topic-text p { margin: 0 0 8px; font-size: 15px; line-height: 1.7; color: var(--ink-2); }
.h3d-info .field { margin-top: 12px; }
.h3d-selected { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.h3d-selected.is-empty { margin: 0; padding: 0; border: 0; }
.h3d-sel-head strong { font-size: 17px; } .h3d-sel-head strong span { color: var(--muted); font-weight: 600; }
.h3d-sel-head small { display: block; font-size: 13px; color: var(--muted); }
.h3d-selected p { margin: 8px 0 0; font-size: 15px; line-height: 1.7; }
.h3d-cpb { padding: 8px 10px; border-left: 3px solid var(--accent); background: var(--accent-soft); }
.h3d-cpb b { display: block; font-size: 13px; color: var(--accent); }
.h3d-kind { display: block; margin-top: 8px; font-size: 13px; color: var(--muted); }
@media (max-width: 900px) {
  .h3d-layout { grid-template-columns: 1fr; }
  .h3d-info { position: static; }
  .h3d-stage { height: 58vh; min-height: 320px; }
}

h1:focus { outline: none; }
/* Formula details */
.formula-card { margin-top: 4px; border-top: 1px solid var(--line); }
.formula-card summary { padding: 12px 0; font-size: 15px; font-weight: 600; color: var(--accent); cursor: pointer; }
.formula-explanation { font-size: 14px; line-height: 1.8; color: var(--ink-2); }
.page-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding-top: 28px; font-size: 13px; color: var(--muted); }
/* Dialog */
dialog {
  width: min(600px, calc(100% - 32px)); max-height: 86dvh; padding: 0; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(15, 20, 28, .45); }
.warning-line { font-size: 14px; color: var(--danger); }
.no-script { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); padding: 20px; }

@media (max-width: 900px) {
  main { padding: 16px 16px 112px; }
  }
@media (max-width: 600px) {
  .appbar { padding-left: 12px; padding-right: 8px; gap: 8px; }
  .brand { font-size: 16px; }
  h1 { font-size: 24px; }
  }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- Teaching site ---------- */
.gate { display: grid; place-items: center; min-height: calc(100vh - 56px); padding: 24px 16px; }
.gate-card { width: min(420px, 100%); padding: 24px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--ink); border-radius: 6px; }
.gate-card h1 { font-size: 22px; margin: 0 0 6px; }
.gate-lead { margin: 0 0 16px; font-size: 15px; color: var(--ink-2); }
.gate-card .field input { font-size: 17px; }
.gate-card .auto-remember { margin: 10px 0 4px; }
.gate-card .button.primary { width: 100%; min-height: 44px; margin-top: 8px; }
.gate-card input:disabled { opacity: .6; }
.gate-lock, .gate-status { margin: 4px 0 0; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.gate-lock:empty, .gate-status:empty { display: none; }
.edu-main { max-width: 1320px; margin: 0 auto; padding: 18px 24px 40px; }
.modules { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.modules button { display: inline-flex; align-items: baseline; gap: 6px; min-height: 40px; padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 600; }
.modules button small { font-size: 13px; font-weight: 400; color: var(--muted); }
.modules button[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.modules button[aria-current="page"] small { color: inherit; }
.module-head h1 { margin: 0 0 4px; }
.module-head p { margin: 0 0 16px; font-size: 15px; color: var(--ink-2); max-width: 760px; }
.module-head h1:focus { outline: none; }
.coming { padding: 40px 20px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 6px; color: var(--ink-2); font-size: 15px; }
.ref-list { margin: 0 0 12px; padding-left: 20px; font-size: 14px; line-height: 1.8; color: var(--ink-2); }
.ref-list a { overflow-wrap: anywhere; }
@media (max-width: 600px) { .edu-main { padding: 14px 14px 32px; } }
/* Phones held sideways: leave room above and below the canvas for scrolling. */
@media (orientation: landscape) and (max-height: 520px) { .h3d-stage { height: 64vh; min-height: 220px; } }
/* Below 380 px the header has no room for the badge (it would push the theme button off screen); the footer keeps the teaching notice. */
@media (max-width: 380px) { .badge-trial { display: none; } }
/* 320 px phones (iPhone SE/mini with display zoom, folding phones): tighten the header so nothing scrolls sideways. */
@media (max-width: 360px) { .appbar { gap: 6px; padding-left: 10px; padding-right: 6px; } .brand { font-size: 15px; gap: 6px; } .appbar-actions { gap: 0; } .appbar-actions .button.ghost:not(.icon-only) { padding: 7px 4px; } }

/* Rhythm and ACLS module */
.h3d-topics.is-grouped { display: grid; gap: 8px; }
.h3d-topic-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.h3d-topic-group-label { flex: 0 0 9.5em; font-size: 13px; font-weight: 600; color: var(--muted); }
.h3d-topics.is-grouped button { min-height: 36px; padding: 4px 12px; font-size: 14px; }
.rhy-monitor { margin: 12px 0 16px; }
.rhy-screen { border-radius: 6px; overflow: hidden; background: #05090b; border: 1px solid var(--line-strong); }
.ecg-canvas { display: block; }
.rhy-twelve { margin: 12px 0 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: #fffaf8; }
.rhy-twelve canvas { display: block; }
.rhy-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 8px; }
.rhy-lead { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.rhy-lead select { min-height: 36px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); }
.rhy-phase { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 8px 0 0; padding: 0; list-style: none; }
.rhy-phase li { padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; font-size: 14px; font-weight: 600; color: var(--muted); background: var(--surface); }
.rhy-phase li small { display: block; font-size: 12px; font-weight: 400; }
.rhy-phase li.is-now { color: var(--ink); border-color: var(--ink); box-shadow: inset 0 -3px 0 var(--ink); }
.rhy-phase li.is-note { grid-column: 1 / -1; color: var(--ink); }
.rhy-stage { height: min(56vh, 520px); }
.h3d-swatch.is-conduction { background: #f2d13a; } .h3d-swatch.is-spark { background: #fff6b0; border-radius: 50%; }
.h3d-swatch.is-glow { background: #e8c56a; } .h3d-swatch.is-injury { background: #6b3a63; }
.rhy-card h3 { margin: 14px 0 4px; font-size: 15px; }
.rhy-card p, .rhy-card li { font-size: 15px; line-height: 1.7; color: var(--ink-2); }
.rhy-card p { margin: 0; } .rhy-card ul { margin: 0; padding-left: 20px; }
.rhy-card .rhy-en { font-size: 13px; color: var(--muted); }
.rhy-acls { margin-top: 10px; padding: 8px 10px; border: 1px solid var(--line-strong); border-left-width: 4px; border-radius: 4px; }
.rhy-card .rhy-acls-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; color: var(--ink); }
.rhy-acls-head b { font-size: 16px; } .rhy-acls-head span { font-weight: 600; }
.rhy-card .rhy-acls p + p { margin-top: 4px; font-size: 14px; }
.rhy-acls.is-arrest { background: var(--danger-bg); border-color: var(--danger-line); border-left-color: var(--danger); }
.rhy-acls.is-arrest b { color: var(--danger); }
.rhy-acls.is-assess, .rhy-acls.is-acs { background: var(--warn-bg); border-color: var(--warn-line); }
.rhy-criteria { margin: 0; display: grid; gap: 2px; }
.rhy-criteria div { display: grid; grid-template-columns: 5.5em 1fr; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--line); }
.rhy-criteria dt { font-size: 14px; font-weight: 600; color: var(--ink); } .rhy-criteria dd { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.rhy-card .rhy-later { margin-top: 12px; font-size: 13px; color: var(--muted); }
.rhy-treat div { grid-template-columns: 6.5em 1fr; }
@media (max-width: 600px) {
  .h3d-topic-group-label { flex-basis: 100%; }
  .rhy-phase li { font-size: 13px; padding: 4px 6px; }
}
.rhy-speed-note { font-size: 13px; color: var(--warn-ink); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 4px; padding: 2px 8px; }
.rhy-show { margin: 10px 0 0; padding: 6px 12px 8px; border: 1px solid var(--line); border-radius: 6px; }
.rhy-show legend { padding: 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.rhy-show-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; }
.rhy-show-label { flex: 0 0 4.5em; font-size: 13px; font-weight: 600; color: var(--ink-2); }
@media (max-width: 600px) { .rhy-show-label { flex-basis: 100%; } }
.rhy-view { display: flex; gap: 6px; margin-bottom: 8px; }
.rhy-view .button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.rhy-section { height: min(64vh, 600px); min-height: 360px; border: 1px solid var(--line); border-top: 4px solid var(--ink); border-radius: 6px; background: radial-gradient(circle at 50% 40%, var(--surface), var(--bg)); color: var(--ink); display: flex; align-items: center; justify-content: center; padding: 6px; }
.rhy-section .sec-svg { width: 100%; height: 100%; display: block; }
.h3d .is-off { display: none !important; }
@media (max-width: 600px) { .rhy-section { height: auto; min-height: 0; aspect-ratio: 554 / 470; } }
.sec-labels line { opacity: .55; }
.sec-labels text { paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
/* Labels inside the chambers: dark text with a light halo, readable on both blood colours in either theme. */
.sec-labels text.sec-in { fill: #10141a; stroke: rgba(255, 255, 255, .7); }
@media (max-width: 600px) { .sec-labels text { font-size: 17px; stroke-width: 4px; } .sec-labels text.sec-note { font-size: 13px; } }
@media (orientation: landscape) and (max-height: 520px) { .rhy-section { height: 64vh; min-height: 220px; } }
/* ACLS scenario practice */
.sim-pick { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.sim-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sim-group-label { flex: 0 0 5em; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.sim-group-note { font-size: 13px; color: var(--muted); }
.sim-pick .button[aria-pressed="true"], .sim-question .button[aria-pressed="true"], .sim-panel .button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.sim-case { margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--ink); border-radius: 6px; background: var(--surface); }
.sim-case h2 { margin: 0 0 6px; font-size: 18px; } .sim-case p { margin: 0 0 10px; line-height: 1.7; color: var(--ink-2); }
.sim-timers { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 0 0 8px; }
.sim-timers div { padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.sim-timers dt { font-size: 12px; color: var(--muted); } .sim-timers dd { margin: 0; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sim-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.sim-panel { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0; padding: 8px 12px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.sim-panel legend { padding: 0 4px; font-size: 14px; font-weight: 700; color: var(--ink); }
.sim-row { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: 100%; min-width: 0; }
.sim-panel select { min-height: 36px; max-width: 100%; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); }
.sim-state { flex-basis: 100%; margin: 0; font-size: 14px; color: var(--ink-2); }
.button.sim-shock:not(:disabled) { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.sim-questions { display: grid; gap: 8px; }
.sim-run:focus { outline: none; }
.sim-run.is-paused .sim-panels { opacity: .6; }
.sim-question { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 8px 12px; border: 1px solid var(--warn-line); border-radius: 6px; background: var(--warn-bg); }
.sim-question legend { padding: 0 4px; font-weight: 700; color: var(--warn-ink); }
.sim-log-title { margin: 16px 0 6px; font-size: 15px; }
.sim-log-title small { margin-left: 6px; font-size: 13px; font-weight: 400; color: var(--muted); }
.sim-log { max-height: 280px; overflow-y: auto; margin: 0 0 12px; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.sim-log.is-static { max-height: none; }
.sim-log li, .sim-checks li { display: flex; gap: 8px; align-items: baseline; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.sim-log time { flex: 0 0 3.2em; font-variant-numeric: tabular-nums; color: var(--muted); }
.sim-log small, .sim-checks small { color: var(--muted); }
.sim-checks small { display: block; }
.sim-tag { flex: 0 0 auto; padding: 0 6px; border-radius: 3px; font-size: 12px; font-weight: 700; border: 1px solid var(--line); }
li.is-ok .sim-tag { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-line); }
li.is-warn .sim-tag { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
li.is-error .sim-tag { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.sim-debrief { margin: 12px 0; padding: 12px 14px; border: 1px solid var(--line); border-top: 4px solid var(--ink); border-radius: 6px; background: var(--surface); }
.sim-debrief h3 { margin: 12px 0 6px; font-size: 16px; } .sim-debrief h3:first-child { margin-top: 0; }
.sim-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; margin: 0; }
.sim-summary div { padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; }
.sim-summary dt { font-size: 12px; color: var(--muted); } .sim-summary dd { margin: 0; font-weight: 700; }
.sim-checks { margin: 0; padding: 0; list-style: none; }
.sim-debrief ul:not(.sim-checks) { padding-left: 20px; line-height: 1.7; color: var(--ink-2); }
@media (max-width: 760px) { .sim-panels { grid-template-columns: 1fr; } .sim-timers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rhy-style { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
.rhy-style .button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.rhy-section > .rhy-sec { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.rhy-credit { margin: 6px 0 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
/* Style B is wider than A: its box follows the drawing's proportions at every width (no empty band on tablets). */
.rhy-section.is-b { height: auto; min-height: 0; aspect-ratio: 1100 / 640; }
/* A phone on its side: keep B within the screen height (the drawing is centred in the box). */
@media (orientation: landscape) and (max-height: 520px) { .rhy-section.is-b { height: 64vh; min-height: 220px; aspect-ratio: auto; } }
.rhy-style-status { font-size: 13px; color: var(--muted); }
/* Small screens, upright or on their side: larger label text so it stays readable once the drawing is scaled down. */
@media (max-width: 600px), (orientation: landscape) and (max-height: 520px) { .secb-labels text { font-size: 34px; } .secb-labels text.sec-in { font-size: 30px; } .secb-labels text.sec-note { font-size: 26px; } }
