/* CardioView: Statura's Swiss structure (JetBrains Mono 700 in uppercase for titles, labels and controls
   at readable sizes, Helvetica for the numeral, the chamber names and sentences, square corners, no
   shadows, 4 px rules between regions, segmented controls in a tray) on a medical dark palette: clinical monitor surfaces, a monitor-green trace, cyan for the right heart, coral for the
   left, teal as the accent. */
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url(vendor/fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 600; font-style: normal; font-display: swap; src: url(vendor/fonts/jetbrains-mono-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 700; font-style: normal; font-display: swap; src: url(vendor/fonts/jetbrains-mono-latin-700-normal.woff2) format("woff2"); }

:root {
  /* ink and signal (Thomas, 2026-10-10 evening): the interface is neutral, color lives only in data (the
     trace, the chambers, the alert, Gemini's panel); the active state is white like a key on an instrument */
  --bg-0: #0A0A0C; --bg-1: #121214; --bg-2: #1A1A1D;
  --fg-0: #F2F2EF; --fg-1: #C9C9C4; --fg-2: #8C8C88;
  --teal: #2BD4BD; --teal-deep: #06211E;   /* kept for the record; the accent is the ink now */
  --green: #37E07E; --cyan: #4FC3F7; --coral: #FF6B6B; --red: #FF5252;

  --paper: var(--bg-0);             /* the stage */
  --card: var(--bg-1);              /* the instrument column */
  --header: #0E0E10;
  --ink: var(--fg-0);
  --ink-2: var(--fg-1);
  --muted: var(--fg-2);
  --line: rgba(242, 242, 239, 0.14);
  --line-2: rgba(242, 242, 239, 0.28);
  --line-strong: rgba(242, 242, 239, 0.45);
  --tray: rgba(242, 242, 239, 0.08);
  --rule-solid: #4A4A4E;   /* the rule color with nothing showing through, for frames over the stage */
  --accent: var(--fg-0);
  --on-accent: var(--bg-0);
  --alert: var(--red);

  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --gutter: clamp(16px, 1.6vw, 28px);
  --rule-w: 4px;     /* the rules between regions (Thomas: 2 px was still too thin) */
  --cell-w: 3px;     /* the rules between cells of a segmented control */
  --numeral: clamp(56px, 9.5vh, 112px);   /* the heart-rate numeral; the column beside it is sized for three digits */

  /* canvas and scene colors (six-digit hex only; the scripts derive their alphas) */
  --c-stage: #0A0A0C; --c-paper: #121214; --c-ink: #F2F2EF; --c-trace: #37E07E; --c-grid: #9A9A96; --c-rule: #F2F2EF;
  --c-dim: #8C8C88; --c-alert: #FF5252; --c-now: #F2F2EF;
  /* one color per chamber, plainly different (Thomas, 2026-10-10: blues and corals were too alike): blue, green, red, yellow */
  --c-ra: #4D8BFF; --c-rv: #7FE24B; --c-la: #FF4F4F; --c-lv: #FFC93C;
}

* { box-sizing: border-box; border-radius: 0; box-shadow: none; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.35;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
  display: flex; flex-direction: column; height: 100vh; overflow: hidden;
}

/* header: Statura's navy bar */
.top { flex: 0 0 92px; display: flex; align-items: center; justify-content: space-between; gap: clamp(16px, 2vw, 32px); padding: 0 var(--gutter); background: var(--header); color: var(--fg-0); border-bottom: var(--rule-w) solid var(--line-2); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: -0.015em; cursor: pointer; user-select: none; }   /* click: full screen on or off */
.brand-mark { height: 36px; width: auto; display: block; }   /* the heart mark from the logo (docs/logo.png), cut out with a transparent background */
/* the timeline: one tray holding the transport cells and, as its last cell, the strip of the last
   30 s with a playhead; drag the strip to scrub */
.top .toggle.timeline { flex: 1 1 auto; min-width: 0; display: flex; }   /* the one tray that grows */
#timeline-strip { flex: 1 1 auto; min-width: 0; height: 56px; display: block; cursor: ew-resize; touch-action: none; background: var(--header); }
.timeline button { display: flex; align-items: center; justify-content: center; padding: 12px 15px; }
.timeline svg { width: 12px; height: 12px; display: block; fill: currentColor; }
/* the status line (strap id, whose recording, which simulated rhythm) lives in the heart rate box, above the tray */
.status-line { grid-column: 2; grid-row: 1; align-self: baseline; text-align: center; font-family: var(--mono); font-size: clamp(14px, 1.9vh, 18px); line-height: 1.2; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }   /* a long name wraps to a second line instead of trailing off (Thomas, 2026-10-10 evening) */
.status-line.id { font-weight: 600; text-transform: none; }   /* the strap id is data, shown as the strap names itself */
.status-line:empty { display: none; }
.instrument.rate.gemini-open .status-line { display: none; }   /* the Gemini panel speaks for itself (Thomas, 2026-10-10 evening) */
.instrument.rate.gemini-open .rhythm-block { grid-row: 1 / 3; justify-content: center; }   /* and sits centered in the whole right side */

/* segmented controls: equal cells separated by rules, the accent fills the active one */
.toggle { display: inline-flex; flex-wrap: wrap; gap: var(--cell-w); padding: var(--cell-w); background: var(--line-2); }
.toggle button { background: var(--card); }
.top .toggle { flex: 0 0 auto; flex-wrap: nowrap; height: 62px; }   /* the header's trays never wrap or shrink, and share one height */
.top .toggle button { padding: 14px 20px; }   /* the header is 92 px tall (Thomas, 2026-10-10 evening: a little bigger), its cells fill it */
.top .toggle button { background: var(--header); }
.toggle button {
  border: 0; margin: 0; padding: 10px 18px; cursor: pointer;
  font-family: var(--mono); font-size: 14px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap;
}
.top .toggle button { color: var(--fg-1); }
.toggle button:hover { color: var(--ink); }
.top .toggle button:hover { color: var(--fg-0); }
.toggle button[aria-pressed="true"], .top .toggle button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.toggle button[aria-disabled="true"] { color: var(--muted); cursor: default; }   /* Exercise without the strap streaming */
.toggle button:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(242, 242, 239, 0.35); }
/* every cell lifts a touch under the pointer, like the dock's cells do (Thomas, 2026-10-10 evening: just slightly) */
.toggle button, .gemini-back, .describe button, .export-menu button { transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1); }
.toggle button:hover, .gemini-back:hover, .describe button:hover, .export-menu button:hover { transform: scale(1.04); position: relative; z-index: 2; }

/* screen: a ruled grid, stage on paper, instruments on a lifted white column */
.screen { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 3fr 2fr; }
.stage { position: relative; overflow: hidden; border-right: var(--rule-w) solid var(--line-strong); }
#heart-view { position: absolute; inset: 0; z-index: 1; }
#heart-view canvas { display: block; width: 100%; height: 100%; }
.missing { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); z-index: 2; margin: 0; text-align: center; color: var(--muted); font-size: 14px; }

/* chamber labels */
.leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.leaders line, .leaders polyline { stroke: var(--ink); stroke-opacity: 0.5; stroke-width: 1.5; }
.leaders line.dim, .leaders polyline.dim { stroke-dasharray: 2 5; }
.leaders circle { fill: var(--ink); fill-opacity: 0.9; }
.leaders circle.dim { fill-opacity: 0.35; }
.label { position: absolute; z-index: 3; pointer-events: none; display: flex; flex-direction: column; line-height: 1.05; transition: left 0.35s ease, top 0.35s ease, opacity 0.25s ease; }
.label b { font-size: clamp(18px, 2.5vh, 26px); font-weight: 700; letter-spacing: -0.015em; white-space: nowrap; }   /* the full chamber name is the label (no RA / LA letters, Thomas, 2026-10-10) */
.label.side-left { text-align: right; align-items: flex-end; }
.label.side-right { text-align: left; align-items: flex-start; }
.label .spark { display: block; width: clamp(110px, 8vw, 150px); height: clamp(20px, 2.6vh, 26px); margin-top: 8px; }
.label.dim { opacity: 0.4; }

/* lost signal */
.alert {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; pointer-events: none;
  padding: 28px 56px; background: radial-gradient(closest-side, rgba(10, 17, 21, 0.95), rgba(10, 17, 21, 0.8) 60%, rgba(10, 17, 21, 0));
}
.alert b { font-size: 32px; font-weight: 700; letter-spacing: -0.015em; color: var(--alert); }
.alert span { color: var(--ink-2); font-size: 15px; }
.alert span:empty { display: none; }
body.lost #heart-view { opacity: 0; }
.glitch { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; display: none; }
body.lost .glitch { display: block; }
body.lost .stage { background: #1D1216; }
body.lost .label, body.lost .leaders { opacity: 0.3; }
body.lost #trace { opacity: 0.5; }
body.lost .bpm { opacity: 0.35; }

/* the dock: the heart's view controls at the bottom of the stage, cells that grow toward the
   pointer (dock.js), a mono label above the hovered one, toggles pressed in the accent */
.dock { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 3; display: flex; align-items: flex-end; }
.dock-item { position: relative; display: flex; align-items: flex-end; padding: var(--cell-w); background: var(--rule-solid); }   /* each cell frames itself, so a grown cell does not stretch the tray */
.dock-item + .dock-item { margin-left: calc(-1 * var(--cell-w)); }
.dock button { width: 48px; height: 48px; border: 0; margin: 0; padding: 0; background: var(--card); color: var(--ink-2); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.dock button:hover { color: var(--ink); }
.dock button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.dock button:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(242, 242, 239, 0.35); }
.dock button svg { width: 46%; height: 46%; display: block; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: square; stroke-linejoin: miter; }
.dock button::after { content: attr(data-label); position: absolute; left: 50%; bottom: calc(100% + 12px); transform: translateX(-50%); padding: 6px 10px; background: var(--card); border: 2px solid var(--line-2); font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; line-height: 1; color: var(--ink); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.12s; }
.dock-item:hover button::after, .dock button:focus-visible::after { opacity: 1; }
.dock-item.has-pop button::after { display: none; }
/* the opacity slider in a popover above its cell: square accent thumb, 2 px track */
.opacity-pop { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); display: none; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border: 2px solid var(--line-2); }
.dock-item:hover .opacity-pop, .dock-item:focus-within .opacity-pop { display: flex; }
.opacity-pop span { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.opacity-pop input { -webkit-appearance: none; appearance: none; width: 160px; height: 18px; margin: 0; background: transparent; cursor: pointer; }
.opacity-pop input::-webkit-slider-runnable-track { height: 2px; background: var(--line-2); }
.opacity-pop input::-moz-range-track { height: 2px; background: var(--line-2); }
.opacity-pop input::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; margin-top: -6px; background: var(--accent); border: 0; }
.opacity-pop input::-moz-range-thumb { width: 14px; height: 14px; background: var(--accent); border: 0; border-radius: 0; }
.opacity-pop input:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(242, 242, 239, 0.35); }

.dock button[disabled] { opacity: 0.45; cursor: default; }   /* Rotate under reduced motion */


/* instrument column: white card with navy rules, three instruments sharing the height */
.column { position: relative; min-height: 0; background: var(--card); padding: 0; display: grid; grid-template-rows: auto minmax(0, 1.15fr) minmax(0, 1fr); }
.instrument { min-height: 0; display: flex; flex-direction: column; padding: clamp(12px, 1.8vh, 20px) var(--gutter) clamp(10px, 1.6vh, 16px); border-bottom: var(--rule-w) solid var(--line-2); }
.instrument.chambers { border-bottom: 0; }
/* ECG and Chambers: the title sits in its own band with a rule under it, and
   the graph fills the rest of the box edge to edge (Thomas, 2026-10-10) */
.instrument.ecg, .instrument.chambers { padding: 0; }
.instrument.ecg h2, .instrument.chambers h2 { padding: clamp(3px, 0.5vh, 5px) var(--gutter); align-items: center; border-bottom: var(--rule-w) solid var(--line-2); }
.instrument.ecg canvas, .instrument.chambers canvas { margin-top: 0; }
/* instrument titles: Statura's mono kicker, but white, bold and at a size that reads across a room */
.instrument h2 { margin: 0; display: flex; gap: 14px; align-items: baseline; font-family: var(--mono); font-size: clamp(15px, 1.9vh, 19px); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; line-height: 1.1; color: var(--ink); }
.readout { display: flex; align-items: baseline; gap: 10px; margin-top: 2px; }
.bpm { font-family: var(--sans); font-weight: 700; font-size: var(--numeral); line-height: 0.95; letter-spacing: -0.04em; color: var(--ink); }
.unit { font-size: 20px; color: var(--ink-2); }
/* heart rate band: a 2 by 2 grid, titles on the first row, the numeral and the rhythm tray on the
   second, so the tray is exactly the numeral's height and runs flush to the right edge */
.instrument.rate { display: grid; grid-template-columns: calc(var(--numeral) * 1.65 + 56px) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); column-gap: 28px; row-gap: 10px; align-items: stretch; }
.instrument.rate h2 { grid-column: 1; grid-row: 1; align-self: baseline; }
.readout-block { grid-column: 1; grid-row: 2; }
/* the Exercise panel takes the tray's cell on the Exercise tab: a note, then Start (or Stop) and Voice */
/* the strap and Exercise panels: centered in the space right of the numeral, bigger than the trays (Thomas, 2026-10-10 evening) */
.exercise-panel { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: clamp(14px, 2vh, 20px); text-align: center; }
.exercise-note { margin: 0; max-width: 34ch; font-family: var(--mono); font-size: clamp(14px, 2vh, 18px); line-height: 1.35; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); text-align: center; }
.exercise-tray button { padding: clamp(14px, 2.2vh, 20px) clamp(26px, 2.4vw, 40px); font-size: clamp(15px, 2vh, 18px); }
#exercise-start:not([aria-disabled="true"]), #strap-connect:not([aria-disabled="true"]) { background: var(--accent); color: var(--on-accent); }
#exercise-stop { background: var(--alert); color: #FFFFFF; }
/* the demo's rhythms: one row of three cells (Normal, Heart attack, Gemini heart; Thomas, 2026-10-10 evening,
   who dropped the other four) and, under it, the Gemini heart's text box with its answer */
.rhythm-block { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.rhythm-tray { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(clamp(40px, 5.2vh, 60px), 1fr); gap: var(--cell-w); }   /* the cells keep a real height; the text box takes what it needs */
/* Gemini heart (Thomas, 2026-10-10 evening: the other cells go away and it must read as powered by
   Gemini): the panel takes the tray's place with the sparkle mark, the name in Gemini's gradient, a
   text box framed by that gradient (it sweeps slowly, and races while Gemini thinks), the Simulate
   cell in the same gradient, and a few sparkles twinkling behind. Everything still under reduced motion. */
:root { --gemini-a: #4285F4; --gemini-b: #9B72CB; --gemini-c: #D96570; --gemini: linear-gradient(90deg, var(--gemini-a), var(--gemini-b), var(--gemini-c)); }
.gemini { position: relative; display: flex; flex-direction: column; justify-content: center; gap: clamp(8px, 1.3vh, 14px); min-height: 0; overflow: hidden; animation: gemini-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
.gemini-head { position: relative; z-index: 1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; }
.gemini-head > .gemini-mark { grid-row: 1 / 3; width: clamp(22px, 3vh, 32px); height: clamp(22px, 3vh, 32px); }
.gemini-head .gemini-title { grid-column: 2; grid-row: 1; }
.gemini-head .gemini-powered { grid-column: 2; grid-row: 2; }
.gemini-head .gemini-back { grid-column: 3; grid-row: 1 / 3; }
/* the Gemini mark is Google's four-color spark (frontend/assets/gemini-mark.svg, from LobeHub's icon set, MIT; the
   mark and the wordmark are Google's) as an image; the Simulate cell and the sparkles behind use a plain spark */
.gemini-mark { display: inline-block; width: 22px; height: 22px; flex: 0 0 auto; }
.gemini-mark svg { display: block; width: 100%; height: 100%; }
.gemini-mark.small { width: clamp(13px, 1.7vh, 16px); height: clamp(13px, 1.7vh, 16px); margin-right: 8px; }
.gemini-mark.small svg path { fill: #FFFFFF; }
.gemini-wordmark { height: 0.95em; width: auto; vertical-align: -0.14em; margin-left: 0.35em; }
.gemini-title { flex: 0 0 auto; white-space: nowrap; font-family: var(--mono); font-size: clamp(16px, 2.3vh, 24px); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; background: var(--gemini); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gemini-powered { margin-top: 2px; white-space: nowrap; font-family: var(--mono); font-size: clamp(10px, 1.4vh, 13px); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.gemini-back { padding: clamp(6px, 1vh, 10px) clamp(12px, 1.2vw, 18px); border: 2px solid var(--line-2); margin: 0; background: var(--card); color: var(--ink-2); cursor: pointer; font-family: var(--mono); font-size: clamp(11px, 1.5vh, 14px); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.gemini-back:hover { border-color: var(--line-strong); color: var(--ink); }
.describe { position: relative; z-index: 1; display: flex; gap: var(--cell-w); flex: 0 0 auto; margin: 0; padding: var(--cell-w); background: linear-gradient(120deg, var(--gemini-a), var(--gemini-b), var(--gemini-c), var(--gemini-b), var(--gemini-a)); background-size: 300% 100%; animation: gemini-sweep 7s linear infinite; }
.gemini.busy .describe { animation-duration: 1.1s; }
.gemini.busy .gemini-head .gemini-mark { animation: gemini-think 1.1s ease-in-out infinite; }
.describe input {
  flex: 1 1 auto; min-width: 0; padding: clamp(10px, 1.7vh, 16px) 14px; border: 0; margin: 0; background: var(--card); color: var(--ink);
  font-family: var(--mono); font-size: clamp(12px, 0.8vw, 16px); font-weight: 600; letter-spacing: 0.03em;
}
.describe input::placeholder { color: var(--muted); font-size: 0.9em; }
.describe input:focus-visible { outline: 0; box-shadow: inset 0 0 0 2px var(--gemini-b); }
.describe button { display: inline-flex; align-items: center; flex: 0 0 auto; padding: 0 clamp(12px, 0.8vw, 16px); border: 0; margin: 0; cursor: pointer; background: var(--gemini); color: #FFFFFF; font-family: var(--mono); font-size: clamp(11px, 0.7vw, 14px); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.describe button[aria-disabled="true"] { opacity: 0.7; cursor: progress; }
.describe-note { position: relative; z-index: 1; margin: 0; flex: 0 1 auto; min-height: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; padding-left: 12px; border-left: 3px solid var(--gemini-b); border-image: linear-gradient(180deg, var(--gemini-a), var(--gemini-c)) 1; font-family: var(--sans); font-size: clamp(12px, 0.75vw, 15px); line-height: 1.35; color: var(--ink-2); animation: gemini-in 0.35s ease-out; }
.note-mark { display: inline-block; width: 0.9em; height: 0.9em; margin-right: 8px; vertical-align: -1px; }
.note-mark img { display: block; width: 100%; height: 100%; }
.gemini.busy .note-mark { animation: gemini-think 1.1s ease-in-out infinite; }
.note-name { margin-right: 8px; font-family: var(--mono); font-size: 0.9em; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; background: var(--gemini); -webkit-background-clip: text; background-clip: text; color: transparent; }
.note-text { color: var(--ink-2); }
/* the Gemini heart cell in the tray: the sparkle, the name in the gradient, a gradient frame that
   sweeps (faster on hover); pressed, it fills with the gradient (Thomas, 2026-10-10 evening: cooler) */
.rhythm-tray button.gemini-cell { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.gemini-cell .gemini-text { max-width: 8ch; }   /* "Gemini" over "heart" beside the sparkle when the cell is narrow */
.rhythm-tray button.gemini-cell::before { content: ""; position: absolute; inset: 0; padding: 2px; pointer-events: none; background: linear-gradient(120deg, var(--gemini-a), var(--gemini-b), var(--gemini-c), var(--gemini-b), var(--gemini-a)); background-size: 300% 100%; animation: gemini-sweep 7s linear infinite; -webkit-mask: linear-gradient(#FFF 0 0) content-box, linear-gradient(#FFF 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.rhythm-tray button.gemini-cell:hover::before { animation-duration: 2s; }
.gemini-cell .gemini-mark { width: clamp(15px, 1.1vw, 22px); height: clamp(15px, 1.1vw, 22px); }
.gemini-cell .gemini-text { background: var(--gemini); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* pressed, the face goes white like any other cell, the mark and the gradient name stay as they are (a gradient fill looked bad, Thomas, 2026-10-10 evening) */
.rhythm-tray button.gemini-cell[aria-pressed="true"] { background: var(--accent); }
/* five sparkles behind the panel, each on its own beat */
.gemini-stars { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.gemini-stars svg { position: absolute; width: 10px; height: 10px; opacity: 0; animation: gemini-twinkle 2.8s ease-in-out infinite; }
.gemini-stars svg path { fill: var(--gemini-b); }
.gemini-stars svg:nth-child(1) { left: 38%; top: 4%; animation-delay: 0s; }
.gemini-stars svg:nth-child(2) { left: 62%; top: 10%; width: 7px; height: 7px; animation-delay: 0.7s; }
.gemini-stars svg:nth-child(2) path { fill: var(--gemini-a); }
.gemini-stars svg:nth-child(3) { left: 50%; top: 0; width: 6px; height: 6px; animation-delay: 1.4s; }
.gemini-stars svg:nth-child(3) path { fill: var(--gemini-c); }
.gemini-stars svg:nth-child(4) { left: 3%; bottom: 6%; width: 8px; height: 8px; animation-delay: 1.9s; }
.gemini-stars svg:nth-child(5) { right: 4%; bottom: 2%; width: 12px; height: 12px; animation-delay: 2.3s; }
.gemini-stars svg:nth-child(5) path { fill: var(--gemini-a); }
@keyframes gemini-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes gemini-sweep { to { background-position: 300% 0; } }
@keyframes gemini-think { 50% { transform: rotate(90deg) scale(1.3); } }
@keyframes gemini-twinkle { 0%, 100% { opacity: 0; transform: scale(0.5) rotate(0deg); } 50% { opacity: 0.9; transform: scale(1) rotate(45deg); } }
@media (prefers-reduced-motion: reduce) {
  .gemini, .describe, .describe-note, .gemini.busy .gemini-head .gemini-mark, .gemini.busy .note-mark, .rhythm-tray button.gemini-cell::before { animation: none; }
  .gemini-stars svg { animation: none; opacity: 0.5; transform: none; }
}
.rhythm-tray button { position: relative; padding: 0 6px; text-align: center; white-space: normal; line-height: 1.15; font-size: clamp(13px, 0.95vw, 19px); letter-spacing: 0.06em; }   /* bigger (Thomas, 2026-10-10 evening); the badges and tips went the same evening */
.instrument > canvas { flex: 1 1 auto; min-height: 0; width: 100%; display: block; margin-top: 10px; }
.nowline { position: absolute; width: 0; border-left: 2px dashed var(--accent); pointer-events: none; z-index: 2; }
/* the Gemini heart cell's liquid-metal frame (metal.js): the mount's canvas is the cell's first child,
   a dark face sits 3 px inside it, the mark and the name above both; pressed, the gradient fills it */
.metal > canvas { position: absolute; inset: 0; margin: 0; width: 100% !important; height: 100% !important; z-index: 0; pointer-events: none; }
.metal > *:not(canvas) { position: relative; z-index: 1; }
.rhythm-tray button.gemini-cell.metal { background: transparent; }
.rhythm-tray button.gemini-cell.metal::before { display: none; }
.rhythm-tray button.gemini-cell.metal::after { content: ""; position: absolute; inset: 3px; z-index: 0; background: var(--card); }
.rhythm-tray button.gemini-cell.metal[aria-pressed="true"]::after { background: var(--accent); }   /* the metal rim stays around the white face */

@media (max-width: 760px) {
  :root { --gutter: 16px; }
  .timeline canvas { display: none; }
  body { height: auto; min-height: 100vh; overflow: auto; }
  .screen { display: flex; flex-direction: column; }
  .stage { height: 72vh; min-height: 480px; border-right: 0; border-bottom: var(--rule-w) solid var(--line-strong); }
  .column { display: flex; flex-direction: column; padding-bottom: 24px; }
  .instrument.ecg, .instrument.chambers { height: 260px; flex: 0 0 auto; }
  :root { --numeral: 72px; }
}
@media (prefers-reduced-motion: reduce) {
  .label { transition: none; }
  .toggle button, .gemini-back, .describe button, .export-menu button { transition: none; }
  .toggle button:hover, .gemini-back:hover, .describe button:hover, .export-menu button:hover { transform: none; }
  body.lost #heart-view { opacity: 1; filter: grayscale(1) sepia(1) saturate(6) hue-rotate(-64deg) contrast(1.35) brightness(0.66); }
  body.lost .glitch { display: none; }
}
[hidden] { display: none !important; }

/* the session report in an overlay over the live view, so nothing reloads when it opens or closes */
.report { position: fixed; inset: 0; z-index: 20; background: var(--paper); }
.report iframe { width: 100%; height: 100%; border: 0; display: block; }
/* the frame the PDF prints from: laid out at A4 landscape, never seen */
.print-frame { position: fixed; left: 0; top: 0; width: 1123px; height: 794px; border: 0; opacity: 0; pointer-events: none; z-index: -1; }

/* Export asks for the shape: a column of cells under the Export cell */
.export-item { position: relative; display: flex; }
.export-menu { position: absolute; top: calc(100% + var(--cell-w)); right: 0; z-index: 30; display: flex; flex-direction: column; gap: var(--cell-w); padding: var(--cell-w); background: var(--rule-solid); }
.export-menu button { text-align: left; white-space: nowrap; }
#export[aria-expanded="true"] { background: var(--accent); color: var(--on-accent); }
/* phones: the full chamber names are wider than the old letters, so they shrink to fit beside the heart */
@media (max-width: 760px) {
  .label b { font-size: 14px; }
  .label .spark { width: 84px; height: 16px; margin-top: 5px; }
}
