/* Pause Tape: base look (spec.md > Look and Feel).
   Every color means something: red = recording, green = ready, gray = not yet time. */

@font-face {
  font-family: 'VT323';
  src: url('../assets/fonts/VT323-Regular.ttf') format('truetype');
  font-display: swap;
}

:root {
  --glass: #070b14;     /* background, CRT glass (blue-black) */
  --ink: #d9dee8;       /* normal text (faded white) */
  --rec: #ff3b3b;       /* ● REC only, plus required-field errors */
  --ready: #62ff8f;     /* READY, ▶ PLAY */
  --locked: #6b7280;    /* locked tapes */
  --vcr-blue: #1d2fb8;  /* blue VCR screen, "NO SIGNAL" */
  --overtime: #ffb020;  /* timer overtime */

  --bezel: #16181d;
  --line: rgba(217, 222, 232, 0.16);
  --ink-dim: rgba(217, 222, 232, 0.6);

  --font-osd: 'VT323', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --font-answer: ui-monospace, 'Cascadia Mono', Consolas, Menlo, monospace;

  --vhs: 0.5;           /* VHS strength per screen, set by js/app.js */
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

/* Dim scrollbars that sit quietly on the CRT glass. */
* {
  scrollbar-color: rgba(217, 222, 232, 0.25) transparent;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: grid;
  place-items: center;
  padding: clamp(8px, 3vw, 32px);
  background: radial-gradient(ellipse at 50% 35%, #1a1d24 0%, #0b0c0f 70%);
  color: var(--ink);
  font-family: var(--font-osd);
  font-size: 22px;
  line-height: 1.25;
  -webkit-font-smoothing: antialiased;
}

/* ── CRT TV frame ─────────────────────────────────────────────── */

/* Sized by the window's height too, so the whole TV fits on a laptop screen without scrolling. */
.tv {
  width: min(960px, 100%, calc((100dvh - 80px) * 4 / 3));
  padding: clamp(10px, 2.4vw, 26px);
  border-radius: 34px;
  background: linear-gradient(160deg, #26282e 0%, var(--bezel) 55%, #0c0d10 100%);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -2px 0 rgba(0, 0, 0, 0.6);
}

.tv__screen {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 26px / 30px;
  background: radial-gradient(ellipse at 50% 45%, #0b1222 0%, var(--glass) 70%);
  box-shadow:
    inset 0 0 70px rgba(0, 0, 0, 0.9),
    inset 0 0 14px rgba(98, 140, 255, 0.10);
}

/* The VHS overlay element; its effects are styled in css/vhs.css. */
.vhs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(14px, 3.2vw, 34px);
  gap: 14px;
}

/* ── On-screen display (OSD) bars ─────────────────────────────── */

.osd {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 0 6px rgba(217, 222, 232, 0.35);
}

.osd--bottom {
  justify-content: flex-start;
  margin-top: auto;
}

.osd__title {
  font-size: 1.15em;
}

.osd__stamp {
  color: var(--ink-dim);
}

.osd__rec {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  color: var(--rec);
  text-shadow: 0 0 8px rgba(255, 59, 59, 0.55);
}

/* ── Symbols drawn in CSS (VT323 has no ● ■ ▶ glyphs) ──────────── */

.ico {
  display: inline-block;
  flex: none;
  width: 0.62em;
  height: 0.62em;
}

.ico--rec {
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.osd__rec .ico--rec {
  animation: rec-blink 2s steps(1, end) infinite;
}

@keyframes rec-blink {
  50% {
    opacity: 0.25;
  }
}

/* The browser's "reduce motion" setting, or REDUCE MOTION in the room controls (html.reduce-motion,
   set by js/prefs.js), stops the blink; the dot stays lit. */
@media (prefers-reduced-motion: reduce) {
  .osd__rec .ico--rec {
    animation: none;
  }
}

.reduce-motion .osd__rec .ico--rec {
  animation: none;
}

.ico--stop {
  background: currentColor;
}

/* ── Buttons ──────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.3em 0.9em;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(217, 222, 232, 0.05);
  color: var(--ink);
  font: inherit;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.btn:hover {
  background: rgba(217, 222, 232, 0.12);
}

.btn:focus-visible,
.tape:focus-visible,
.field input:focus-visible,
.field textarea:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.btn--rec {
  color: var(--rec);
  border-color: rgba(255, 59, 59, 0.45);
}

.btn--stop {
  color: var(--ink);
}

.btn--quiet {
  border-color: transparent;
  background: transparent;
  color: var(--ink-dim);
}

/* ── Tape Shelf ───────────────────────────────────────────────── */

.shelf {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  align-content: start;
  gap: 16px;
  overflow-y: auto;
  padding: 4px 4px 18px;
  scrollbar-width: thin;
}

/* A VHS cassette: dark shell, paper label on top, two reels in a window below. */
.tape {
  --state: var(--locked);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 150px;
  padding: 12px 12px 14px;
  border: 1px solid #2a2e37;
  border-radius: 8px;
  background: linear-gradient(180deg, #171a21 0%, #101218 100%);
  box-shadow: inset 0 0 0 3px #0c0e12;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tape:hover {
  border-color: #3a3f4a;
}

.tape__label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px 8px;
  border-left: 4px solid var(--state);
  border-radius: 3px;
  background: #d3cdbd;
  color: #1a1a1e;
  letter-spacing: 0.04em;
}

.tape__project {
  overflow: hidden;
  font-size: 1.12em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.tape__date {
  color: #4a4a52;
}

/* Every state sits on a dark badge so the color reads clearly on the paper label. */
.tape__state {
  align-self: flex-start;
  margin-top: auto;
  padding: 1px 6px;
  background: #0b0e0c;
  color: var(--state);
  letter-spacing: 0.06em;
  text-shadow: 0 0 6px var(--state);
  white-space: nowrap;
}

.tape__window {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 44px;
  border-radius: 4px;
  background: #07080b;
}

.tape__reel {
  width: 30px;
  height: 30px;
  border: 5px dotted #4b505c;
  border-radius: 50%;
}

.tape--locked {
  --state: var(--locked);
}

/* Locked tapes get a dimmer paper instead of a faded label, so the day count stays readable. */
.tape--locked .tape__label {
  background: #a8a396;
}

.tape--ready {
  --state: var(--ready);
  border-color: rgba(98, 255, 143, 0.55);
  box-shadow:
    inset 0 0 0 3px #0c0e12,
    0 0 16px rgba(98, 255, 143, 0.25);
}

.tape--completed {
  --state: var(--ink-dim);
}

.tape--blank {
  align-items: center;
  justify-content: center;
  border-style: dashed;
  border-color: #3a3f4a;
  background: transparent;
  box-shadow: none;
  color: var(--ink-dim);
}

.tape__blank-text {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tape__blank-text .ico--rec {
  color: var(--rec);
}

/* ── Record Screen: camcorder viewfinder ──────────────────────── */

.viewfinder {
  position: absolute;
  inset: clamp(8px, 2vw, 18px);
  pointer-events: none;
}

.viewfinder__corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 0 solid rgba(217, 222, 232, 0.55);
}

.viewfinder__corner--tl { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.viewfinder__corner--tr { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.viewfinder__corner--bl { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.viewfinder__corner--br { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }

.record {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

/* The questions scroll if the screen is short; the STOP row below them always stays in view. */
.record__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 6px 4px;
  scrollbar-width: thin;
}

.record__group {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 10px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.record__group--label {
  grid-template-columns: 1fr minmax(170px, 0.6fr);
}

/* Two columns when there's room, so all four questions fit on one screen. */
.record__group--message {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-items: end;
}

.record__group legend {
  padding: 0 6px;
  color: var(--ink-dim);
  letter-spacing: 0.1em;
}

.field {
  display: grid;
  gap: 4px;
}

.field__name {
  letter-spacing: 0.06em;
}

.field__hint {
  color: var(--ink-dim);
  font-size: 0.85em;
}

/* The learner's own words use a clean monospace, so they're quick to read on return. */
.field input,
.field textarea {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(3, 6, 12, 0.7);
  color: var(--ink);
  font-family: var(--font-answer);
  font-size: 16px;
  line-height: 1.4;
}

.field textarea {
  resize: vertical;
}

.field textarea::placeholder {
  color: var(--ink-dim);
  opacity: 0.7;
}

.field input[type='date'] {
  font-family: var(--font-osd);
  font-size: 22px;
  padding: 2px 9px;
}

.field--missing .field__name {
  color: var(--rec);
}

.field--missing input,
.field--missing textarea {
  border-color: var(--rec);
  box-shadow: 0 0 0 1px var(--rec);
}

.record__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.record__error {
  margin: 0 auto 0 0;
  color: var(--rec);
  letter-spacing: 0.12em;
  text-shadow: 0 0 8px rgba(255, 59, 59, 0.6);
}

/* ── Shelf extras: stat line, sample badge, eject (erase), backup ── */

.shelf-stats {
  margin: 0 0 10px;
  color: var(--ready);
  letter-spacing: 0.08em;
  text-shadow: 0 0 6px rgba(98, 255, 143, 0.4);
}

.tape-slot {
  position: relative;
  display: grid;
  min-width: 0; /* a grid cell: let it shrink to the column, like the tapes did before */
}

.tape-slot > .tape {
  box-sizing: border-box;
  min-width: 0;
}

/* Eject: a small square button on the cassette's top-right corner. */
.tape__eject {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #3a3f4a;
  border-radius: 6px;
  background: #0c0e12;
  color: var(--ink-dim);
  cursor: pointer;
}

.tape__eject:hover,
.tape__eject:focus-visible {
  border-color: var(--rec);
  color: var(--rec);
  outline: none;
}

/* ⏏ drawn in CSS (VT323 has no eject glyph): a triangle over a bar. */
.ico--eject {
  position: relative;
  width: 14px;
  height: 13px;
}

.ico--eject::before,
.ico--eject::after {
  content: '';
  position: absolute;
  left: 0;
  width: 14px;
  background: currentColor;
}

.ico--eject::before {
  top: 0;
  height: 8px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.ico--eject::after {
  bottom: 0;
  height: 3px;
}

/* The label leaves room for the eject button. */
.tape-slot .tape__label {
  margin-right: 34px;
}

.tape__sample {
  align-self: flex-start;
  padding: 0 5px;
  background: #1a1a1e;
  color: #d3cdbd;
  font-size: 0.8em;
  letter-spacing: 0.12em;
}

.osd--shelf {
  align-items: center;
  gap: 10px;
}

.osd__spacer {
  flex: 1;
}

.backup-note {
  margin: 0;
  color: var(--ink-dim);
  letter-spacing: 0.06em;
}

/* ── Voice note: the Record Screen row and the playback row ── */

.voice {
  display: grid;
  grid-column: 1 / -1;
  gap: 6px;
}

.voice__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* The audio meter: 12 cells, green then amber then red, like a camcorder's level display. */
.vu {
  display: inline-grid;
  grid-template-columns: repeat(12, 7px);
  gap: 2px;
  align-items: end;
  height: 16px;
  padding: 2px 3px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #05070c;
}

.vu[hidden] {
  display: none;
}

.vu > span {
  height: 100%;
  background: rgba(98, 255, 143, 0.12);
}

.vu > span.is-on {
  background: var(--ready);
  box-shadow: 0 0 4px rgba(98, 255, 143, 0.6);
}

.vu > span:nth-child(n + 9) {
  background: rgba(255, 196, 60, 0.12);
}

.vu > span:nth-child(n + 9).is-on {
  background: #ffc43c;
  box-shadow: 0 0 4px rgba(255, 196, 60, 0.6);
}

.vu > span:nth-child(n + 11) {
  background: rgba(255, 59, 59, 0.14);
}

.vu > span:nth-child(n + 11).is-on {
  background: var(--rec);
  box-shadow: 0 0 4px rgba(255, 59, 59, 0.6);
}

/* Time used out of 40 s while recording, or how far LISTEN has got. */
.voice__bar {
  display: block;
  height: 4px;
  max-width: 420px;
  border: 1px solid var(--line);
}

.voice__bar[hidden] {
  display: none;
}

.voice__bar > span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--rec);
}

.btn.is-playing ~ .voice__clock,
[data-voice-listen].is-playing + .btn ~ .voice__clock {
  color: var(--ready);
}

.voice__clock {
  color: var(--ink-dim);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.voice__note {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.85em;
  letter-spacing: 0.04em;
}

.btn--rec.is-recording {
  background: rgba(255, 59, 59, 0.16);
}

.btn--rec.is-recording .ico--rec {
  animation: rec-blink 1s steps(1) infinite;
}

.reduce-motion .btn--rec.is-recording .ico--rec {
  animation: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.voice-play {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 6px 8px;
  padding: 2px 12px;
  border-left: 2px solid var(--ready);
}

.voice-play .btn {
  padding: 0.25em 0.6em;
}

/* Playing: the ▶ becomes ‖ (two bars drawn in CSS). */
.voice-play .btn.is-playing .ico--play {
  width: 0.5em;
  clip-path: polygon(0 0, 35% 0, 35% 100%, 0 100%, 0 0, 65% 0, 100% 0, 100% 100%, 65% 100%, 65% 0);
}

.voice-play__bar {
  flex: 1;
  max-width: 260px;
  height: 6px;
  border: 1px solid var(--line);
}

/* LISTEN in progress: the bar turns green (red is for recording). */
.voice:has([data-voice-listen].is-playing) .voice__bar > span {
  background: var(--ready);
}

.voice-play__bar > span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--ready);
}

/* A tape with a voice note: a small green dot on the label's corner. */
.tape--voice .tape__label {
  position: relative;
}

.tape--voice .tape__label::after {
  content: 'VOICE';
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 0 4px;
  background: #0b0e0c;
  color: var(--ready);
  font-size: 0.75em;
  letter-spacing: 0.1em;
}

/* ── Playback intro ── */

.intro {
  margin: 0 6px 8px;
  padding: 4px 12px;
  border-left: 2px solid var(--ready);
  color: var(--ready);
  letter-spacing: 0.1em;
  text-shadow: 0 0 6px rgba(98, 255, 143, 0.4);
}

/* ── Tape Saved Screen ────────────────────────────────────────── */

.saved {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}

.saved__title {
  margin: 0;
  font-size: 2.4em;
  letter-spacing: 0.18em;
  text-shadow: 0 0 10px rgba(217, 222, 232, 0.45);
}

.saved__label {
  margin: 0;
  color: var(--ink-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.saved__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

/* Keeps the PRD's exact button wording, "Add to calendar (.ics)". */
[data-action="add-calendar"] {
  text-transform: none;
  letter-spacing: 0.04em;
}

.saved__note {
  margin: 0;
  color: var(--ink-dim);
  letter-spacing: 0.06em;
}

/* ── ▶ and ▶▶ drawn in CSS ────────────────────────────────────── */

.ico--play {
  width: 0.56em;
  height: 0.64em;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.ico--ff {
  display: inline-flex;
  width: auto;
  height: auto;
}

/* ── Early Play Confirmation ──────────────────────────────────── */

.early__text {
  margin: 0;
  font-size: min(2em, 6vw);
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-shadow: 0 0 10px rgba(217, 222, 232, 0.45);
}

.early__line {
  display: block;
  white-space: nowrap;
}

.btn--play {
  color: var(--ready);
  border-color: rgba(98, 255, 143, 0.45);
}

/* ── Blue VCR Screen ──────────────────────────────────────────── */

.screen--blue {
  align-items: center;
  justify-content: center;
  background: var(--vcr-blue);
}

/* Read by screen readers, invisible on screen (the visible copy may be mid-animation). */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.blue__play {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  margin: 0;
  color: #ffffff;
  font-size: 1.6em;
  letter-spacing: 0.1em;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}

/* ── Playback Screen ──────────────────────────────────────────── */

.osd__play {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  color: var(--ready);
  text-shadow: 0 0 8px rgba(98, 255, 143, 0.5);
}

.answers {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  margin: 0;
  padding: 2px 6px;
  overflow-y: auto;
  list-style: none;
  scrollbar-width: thin;
}

.answer {
  display: grid;
  gap: 4px;
  padding: 6px 12px 8px;
  border-left: 2px solid var(--line);
}

.answer__label {
  color: var(--ink-dim);
  letter-spacing: 0.1em;
}

/* The learner's words, in the clean answer font. */
.answer__text,
.first__text {
  margin: 0;
  font-family: var(--font-answer);
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.answer__text {
  font-size: 18px;
}

/* An empty answer: a blue NO SIGNAL panel for a moment, then a dim line. */
.answer--nosignal .answer__text {
  color: var(--ink-dim);
  font-family: var(--font-osd);
  font-size: 1em;
  letter-spacing: 0.14em;
}

.answer--nosignal-flash {
  border-left-color: transparent;
  border-radius: 4px;
  background: var(--vcr-blue);
}

.answer--nosignal-flash .answer__label,
.answer--nosignal-flash .answer__text {
  color: #ffffff;
}

.answer--nosignal-flash .answer__text {
  font-size: 1.6em;
}

/* The first step comes last and matters most, so it gets its own box with the timer. */
.first {
  display: grid;
  gap: 6px;
  padding: 12px 14px 14px;
  border: 1px solid rgba(217, 222, 232, 0.35);
  border-radius: 6px;
  background: rgba(3, 6, 12, 0.6);
}

.first__text {
  font-size: 20px;
}

.first__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-top: 4px;
}

.timer {
  font-size: 2.4em;
  line-height: 1;
  letter-spacing: 0.08em;
  text-shadow: 0 0 10px rgba(217, 222, 232, 0.4);
}

.timer--over {
  color: var(--overtime);
  text-shadow: 0 0 10px rgba(255, 176, 32, 0.5);
}

/* Keeps the learner's exact wording, "I'm back on it", instead of uppercasing it. */
.btn--back {
  padding: 0.35em 1.1em;
  border-color: var(--ink);
  background: var(--ink);
  color: var(--glass);
  font-size: 1.1em;
  letter-spacing: 0.04em;
  text-transform: none;
}

.btn--back:hover {
  background: #ffffff;
}

.osd--controls {
  justify-content: space-between;
}

/* ── Small screens (judges on a phone) ────────────────────────── */

/* ── SOUND button: top left on every layout (js/app.js). A speaker drawn in CSS, waves when on, a red
   slash when off, and the words beside it, so it's clear at a glance. ── */

.sound-quick {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 44px;
  height: 44px;
  padding: 0 12px 0 8px;
  border: 1px solid rgba(217, 222, 232, 0.3);
  border-radius: 8px;
  background: rgba(5, 7, 12, 0.88);
  color: #e8ecf3;
  font: inherit;
  font-size: 20px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.sound-quick:hover,
.sound-quick:focus-visible {
  border-color: rgba(217, 222, 232, 0.7);
}

.sound-quick.is-on {
  border-color: rgba(120, 220, 140, 0.55);
}

.sound-quick__icon {
  position: relative;
  width: 26px;
  height: 26px;
}

.sound-quick__speaker {
  position: absolute;
  left: 3px;
  top: 8px;
  width: 9px;
  height: 10px;
  background: currentColor;
  clip-path: polygon(0 30%, 40% 30%, 100% 0, 100% 100%, 40% 70%, 0 70%);
}

.sound-quick__waves {
  position: absolute;
  left: 11px;
  top: 5px;
  width: 10px;
  height: 16px;
  border: 2px solid currentColor;
  border-color: transparent currentColor transparent transparent;
  border-radius: 50%;
  opacity: 0;
}

.sound-quick.is-on .sound-quick__waves {
  opacity: 1;
}

.sound-quick:not(.is-on) .sound-quick__icon::after {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  width: 26px;
  border-top: 2px solid var(--rec);
  transform: rotate(-40deg);
}

/* In the TV (room zoomed in) it steps back a little, but stays usable. */
.zoomed .sound-quick {
  opacity: 0.6;
}

.zoomed .sound-quick:hover,
.zoomed .sound-quick:focus-visible {
  opacity: 1;
}

/* A narrow screen: the icon only (the label is still read out), in a strip above the TV so it covers
   none of the TV's own text. */
@media (max-width: 640px) {
  .sound-quick {
    top: 4px;
    left: 6px;
    padding: 0 9px;
  }

  body {
    padding-top: 52px;
  }

  .sound-quick__text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}

/* Touch screens: every button and the tapes at least 44 px tall (Apple / WCAG target size). */
@media (pointer: coarse) {
  .btn,
  .tape {
    min-height: 44px;
  }

  .tape__eject {
    top: 2px;
    right: 2px;
    width: 44px;
    height: 44px;
  }

  .tape-slot .tape__label {
    margin-right: 42px;
  }
}

/* A phone on its side: a short, wide screen, so the TV goes full height and the text a little smaller. */
@media (max-height: 500px) and (orientation: landscape) {
  body {
    padding: 4px;
    font-size: 18px;
  }

  .tv {
    width: min(100%, calc((100dvh - 12px) * 4 / 3));
    padding: 6px;
    border-radius: 18px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 19px;
  }

  .btn {
    min-height: 44px;
  }

  .tv {
    border-radius: 22px;
  }

  .tv__screen {
    aspect-ratio: auto;
    height: calc(100dvh - 100px); /* room for the SOUND strip above the TV */
  }

  .record__group--label {
    grid-template-columns: 1fr;
  }
}

/* ── High contrast (HIGH CONTRAST in the room controls, or the system setting) ── */

.high-contrast {
  --ink: #ffffff;
  --ink-dim: rgba(255, 255, 255, 0.88);
  --line: rgba(255, 255, 255, 0.5);
  --locked: #b8c0cc;
  --vhs: 0.1 !important; /* calmer picture: fewer scanlines and less grain over the text */
}

.high-contrast .tv__screen {
  background: #000000;
}

.high-contrast .osd,
.high-contrast .answer__text,
.high-contrast .first__text {
  text-shadow: none;
}

.high-contrast input,
.high-contrast textarea {
  border-color: #ffffff !important;
  background: #000000 !important;
  color: #ffffff !important;
}

.high-contrast .btn {
  border-width: 2px;
}
