/* Hallmark · pre-emit critique: P4 H4 E4 S5 R4 V4
 * Genre: reading app · quiet · gold anchor · drum/sutra split with support below.
 * Component: sutra drum · Existing dark/gold theme, ivory reel surface.
 * States: default, hover, focus, active, disabled, loading, error, success.
 */
/* 祈りの車 — Linear ベースライン (ai-workflow/design/linear) を土台に、
   アクセントを経典の域に合う温かみのある金へ調整。 */

:root {
  --canvas: #010102;
  --surface-1: #0f1011;
  --surface-2: #141516;
  --surface-3: #18191a;
  --hairline: #23252a;
  --hairline-strong: #34343a;
  --ink: #f7f8f8;
  --ink-muted: #d0d6e0;
  --ink-subtle: #8a8f98;
  --ink-tertiary: #62666d;
  --accent: #c9a25f;
  --accent-hover: #e0bd85;
  --accent-soft: rgba(201, 162, 95, 0.14);
  --warn: #d68a6a;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --pill: 9999px;
  --font: -apple-system, "SF Pro Display", "Segoe UI", Roboto,
    "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP",
    "Yu Gothic UI", Meiryo, sans-serif;
  --font-reel: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
  --reel-paper: #f3eddf;
  --reel-ink: #28231b;
  --reel-metal: #796341;
  --reel-chassis-light: #2d2922;
  --reel-chassis-dark: #151412;
  --reel-edge: rgba(24, 21, 16, 0.84);
  --reel-shade: rgba(24, 21, 16, 0.22);
  --reel-clear: rgba(24, 21, 16, 0);
  --reel-highlight: rgba(255, 253, 245, 0.5);
  --reel-shadow: rgba(0, 0, 0, 0.6);
  --reel-face-height: 40.6px;
  --reel-radius: 310px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

.current-reading, .queue-label { color: var(--ink-subtle); font-size: 13px; }
.current-reading { min-height: 2.5em; }
.text-block { position: relative; }
.queue-label b { color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.btn { min-height: 44px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.stage[aria-disabled="true"] { opacity: 0.45; cursor: wait; }
.stage { touch-action: pan-x pinch-zoom; user-select: none; -webkit-user-select: none; }
.foot a { color: var(--ink-subtle); }

html, body { margin: 0; overflow-x: clip; }

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1160px;
  margin: 0 auto;
  padding: 40px 24px 56px;
}

/* ---------- Header ---------- */

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--ink-tertiary);
}

h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 10px 0 0;
  max-width: 56ch;
  font-size: 14.5px;
  color: var(--ink-subtle);
}

.voice-banner {
  margin: 18px 0 0;
  padding: 10px 14px;
  background: var(--surface-1);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--ink-muted);
}

/* ---------- Layout ---------- */

.grid {
  display: grid;
  grid-template-columns: minmax(320px, 460px) minmax(0, 1fr);
  gap: 20px;
  margin-top: 28px;
  align-items: start;
}

.panel {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* ---------- Mechanical sutra drum ---------- */

.drum-heading, .drum-meter { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.drum-heading { margin-bottom: 18px; }
.drum-heading h2 { margin: 0; font-size: 16px; font-weight: 500; color: var(--ink); }
.drum-heading > span { font-size: 12px; color: var(--ink-subtle); }
.stage {
  position: relative;
  width: 100%;
  padding: 14px;
  margin: 0 auto;
  cursor: pointer;
  user-select: none;
  border: 2px solid var(--reel-metal);
  border-radius: 10px;
  background: linear-gradient(var(--reel-chassis-light), var(--reel-chassis-dark));
  box-shadow: inset 0 1px 0 var(--reel-highlight), 0 8px 18px var(--reel-shadow);
  -webkit-tap-highlight-color: transparent;
  transition: border-color 140ms;
}
.stage:hover, .stage.is-hover { border-color: var(--accent-hover); }
.stage:active, .stage.is-active { border-color: var(--accent); }
.stage.is-focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.stage[data-state="loading"] { border-color: var(--ink-subtle); }
.stage[data-state="paused"] { border-color: var(--ink-muted); }
.stage[data-state="error"] { border-color: var(--warn); }
.stage[aria-disabled="true"][data-state="error"] { opacity: 1; cursor: default; }
.stage[data-state="success"] { border-color: var(--accent-hover); }
.reel-window {
  position: relative;
  height: 340px;
  overflow: hidden;
  perspective: 1000px;
  border-radius: 4px;
  background: var(--reel-paper);
  box-shadow: inset 0 0 12px var(--reel-shadow);
}
.reel-window::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to bottom, var(--reel-edge), var(--reel-shade) 20%,
    var(--reel-clear) 37%, var(--reel-clear) 63%, var(--reel-shade) 80%, var(--reel-edge));
}
.reel-rotor {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: translateZ(calc(-1 * var(--reel-radius))) rotateX(var(--drum-turn, -7.5deg));
  will-change: transform;
}
.reel-rotor[data-moving="true"], .reel-rotor[data-settling="true"] {
  transition: transform 120ms linear;
}
.reel-face {
  position: absolute;
  top: 50%;
  left: 8%;
  width: 84%;
  height: var(--reel-face-height);
  margin-top: calc(-0.5 * var(--reel-face-height));
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow-wrap: anywhere;
  color: var(--reel-ink);
  background: var(--reel-paper);
  font-family: var(--font-reel);
  font-size: clamp(26px, 4vw, 30px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.04em;
  backface-visibility: hidden;
  transform: rotateX(var(--face-angle)) translateZ(var(--reel-radius));
}
.reel-face.is-selected { font-weight: 700; }
.reel-face.is-intro { font-size: 18px; letter-spacing: 0; white-space: nowrap; }
.reel-stop-line {
  position: absolute;
  top: 50%;
  left: 14px;
  right: 14px;
  height: var(--reel-face-height);
  transform: translateY(-50%);
  pointer-events: none;
}
.reel-stop-line::before, .reel-stop-line::after {
  content: '';
  position: absolute;
  top: calc(50% - 6px);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}
.reel-stop-line::before { left: -10px; border-left: 7px solid var(--accent); }
.reel-stop-line::after { right: -10px; border-right: 7px solid var(--accent); }
.drum-meter { margin-top: 16px; color: var(--ink-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.counter-label { font-size: 12px; color: var(--ink-subtle); }
.counter-label b { margin-left: 6px; color: var(--accent); font-size: 20px; font-weight: 500; }
.drum-selection { font-size: 12px; color: var(--ink-muted); margin: 12px 0 0; }
.reading-heading { font-size: 12px; color: var(--ink-subtle); margin: 24px 0 0; }

.stage-hint {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--ink-tertiary);
}

/* ---------- Status ---------- */

.statusline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}

.status-text { color: var(--ink-muted); }

.rounds {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--ink-tertiary);
}

.rounds b { color: var(--ink-muted); font-variant-numeric: tabular-nums; }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-tertiary);
  flex: 0 0 auto;
}

.dot.speaking { background: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
.dot.paused { background: var(--ink-subtle); }
.dot.busy { background: var(--accent-hover); }
.dot.warn { background: var(--warn); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 162, 95, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(201, 162, 95, 0); }
}

/* ---------- Current line & sutra text ---------- */

.current {
  margin: 18px 0;
  min-height: 40px;
  padding-left: 14px;
  border-left: 2px solid var(--accent);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.55;
  color: var(--ink);
}

.text-block {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 8px;
  font-size: 14px;
  line-height: 2;
  color: var(--ink-subtle);
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-strong) transparent;
}

.text-block::-webkit-scrollbar { width: 8px; }
.text-block::-webkit-scrollbar-thumb {
  background: var(--hairline-strong);
  border-radius: var(--pill);
}

.chunk { border-radius: 4px; }

.chunk.active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- Progress ---------- */

.progress {
  height: 4px;
  margin-top: 18px;
  background: var(--surface-3);
  border-radius: var(--pill);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 300ms ease;
}

.progress-label {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--ink-tertiary);
  font-variant-numeric: tabular-nums;
}

/* ---------- Controls ---------- */

.controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 24px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 180px;
  font-size: 12px;
  color: var(--ink-subtle);
}

.field b {
  color: var(--ink-muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  background: var(--surface-1);
  color: var(--ink-muted);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  padding: 9px 14px;
  font-family: var(--font);
  font-size: 13.5px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--ink-tertiary);
  color: var(--ink);
}

.btn:active { background: var(--surface-3); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #16100a;
  font-weight: 550;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #16100a;
}

select, input[type="range"] { width: 100%; }

select {
  background: var(--surface-1);
  color: var(--ink);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 13.5px;
}

input[type="range"] {
  accent-color: var(--accent);
  margin-top: 6px;
}

/* ---------- Focus & footer ---------- */

:is(button, select, input, .stage, .support-link):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.foot {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
  font-size: 12.5px;
  color: var(--ink-tertiary);
}

.foot p { margin: 0; }
.support { margin-bottom: 18px; }
.support[hidden] { display: none; }
.foot .support-link {
  display: inline-block;
  max-width: 100%;
  margin-bottom: 8px;
  color: var(--accent);
  text-decoration: none;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: normal;
}
.support-external { font-size: 12px; }
.stage-hint, .progress-label, .counter-label, .foot { color: var(--ink-subtle); }

/* ---------- Reading space: drum, sutra, support ---------- */
.page { max-width: 800px; padding: 36px 32px 28px; }
.top { padding-bottom: 24px; border-bottom: 1px solid var(--hairline); }
.eyebrow { letter-spacing: .1em; color: var(--ink-subtle); }
h1 { font-family: var(--font-reel); font-size: 30px; font-weight: 500; letter-spacing: .12em; }
.tagline { margin-top: 4px; font-size: 13px; }
.grid { grid-template-columns: minmax(0, 190px) minmax(0, 1fr); gap: 44px; margin: 32px 0 28px; }
.stage-panel, .read-panel { min-width: 0; }
.stage { padding: 12px; }
.reel-stop-line { left: 12px; right: 12px; }
.drum-meter { justify-content: center; margin-top: 12px; font-size: 11px; color: var(--ink-subtle); }
.stage-hint { margin-top: 8px; font-size: 11px; color: var(--ink-subtle); }
.read-panel { display: flex; flex-direction: column; align-self: stretch; padding: 4px 0 0; }
.statusline { gap: 7px; min-height: 36px; align-items: flex-start; font-size: 12px; line-height: 1.6; }
.dot { width: 6px; height: 6px; margin-top: 6px; }
.reading-heading { margin: 20px 0 8px; font-size: 12px; letter-spacing: .15em; color: var(--accent); }
.current { border: 0; padding: 0; margin: 0; min-height: 3em; font-family: var(--font-reel); font-weight: 500; font-size: clamp(26px, 4vw, 36px); line-height: 1.65; letter-spacing: .08em; overflow-wrap: anywhere; }
.current.is-waiting { font-family: var(--font); font-size: 20px; letter-spacing: .02em; line-height: 1.9; color: var(--ink-muted); }
.current-reading { margin: 12px 0 20px; font-size: 12px; line-height: 1.9; overflow-wrap: anywhere; min-height: 0; }
.reading-bottom { margin-top: auto; }
.progress { height: 2px; margin-top: 12px; }
.reading-meta { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; }
.progress-label, .rounds { font-size: 11px; margin-left: 0; }
.controls { flex-direction: row; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.controls .btn { justify-content: center; flex: 1; padding: 9px 10px; font-size: 12px; white-space: nowrap; }
.support { padding: 22px 0 24px; margin: 0; border-top: 1px solid var(--hairline-strong); }
.support .support-link { display: flex; align-items: baseline; justify-content: center; gap: 14px; width: 100%; min-height: 68px; padding: 14px 20px; border: 1px solid var(--accent); background: var(--accent); color: var(--reel-ink); font-family: var(--font-reel); font-size: 26px; letter-spacing: .18em; text-decoration: none; border-radius: var(--radius-sm); }
.support .support-link:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--reel-ink); }
.support-external { font-family: var(--font); font-size: 11px; letter-spacing: 0; }
.support p { margin: 10px 0 0; color: var(--ink-subtle); font-size: 11px; line-height: 1.8; text-align: center; }
.secondary { border-top: 1px solid var(--hairline); }
.disclosure { border-bottom: 1px solid var(--hairline); }
.disclosure summary { cursor: pointer; min-height: 52px; padding: 15px 0; font-size: 13px; color: var(--ink-muted); }
.disclosure summary::marker { color: var(--accent); font-size: 11px; }
.disclosure summary > span { float: right; font-size: 11px; color: var(--ink-subtle); }
.disclosure summary:hover { color: var(--accent-hover); }
.disclosure summary:focus-visible, .text-block:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.text-block { margin: 4px 0 22px; max-height: 320px; font-family: var(--font-reel); font-size: 18px; line-height: 2.2; }
.settings-content { display: grid; gap: 18px; padding: 8px 0 24px; }
.settings-content .field { max-width: 360px; }
.settings-content > .btn { justify-self: start; }
.settings-content .stage-hint { text-align: left; line-height: 1.9; }
.settings-content .drum-selection { margin: 0; }
.session-meta { display: flex; flex-wrap: wrap; gap: 24px; align-items: baseline; }
.counter-label b { font-size: 14px; }
.foot { border: 0; margin: 24px 0 0; padding: 0; font-size: 10px; line-height: 1.9; }
.foot p + p { margin-top: 8px; }
.foot a { display: inline-block; white-space: nowrap; }
@media (max-width: 600px) {
  .page { padding: 22px 20px 24px; }
  .top { padding-bottom: 18px; }
  h1 { font-size: 26px; }
  .eyebrow { font-size: 10px; }
  .tagline { font-size: 12px; }
  .grid { grid-template-columns: minmax(0, 116px) minmax(0, 1fr); gap: 22px; margin: 24px 0; }
  .stage { padding: 9px; }
  .reel-stop-line { left: 9px; right: 9px; }
  .reel-face.is-intro { font-size: 12px; }
  .statusline { font-size: 11px; min-height: 48px; }
  .reading-heading { margin-top: 14px; font-size: 11px; }
  .current { font-size: 25px; line-height: 1.65; letter-spacing: .03em; }
  .current.is-waiting { font-size: 16px; }
  .current-reading { font-size: 11px; margin: 8px 0 14px; }
  .reading-meta { flex-wrap: wrap; gap: 0 8px; }
  .support { padding: 18px 0 20px; }
}
@media (max-width: 360px) {
  .page { padding-left: 16px; padding-right: 16px; }
  .grid { grid-template-columns: minmax(0, 100px) minmax(0, 1fr); gap: 16px; }
  .controls { gap: 6px; }
  .controls .btn { padding-inline: 7px; font-size: 11px; }
  .current { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  .stage, .progress-fill { transition: none; }
  .dot.speaking { animation: none; }
}

/* Support replaces the former back/pause controls in the reading column. */
.reading-bottom .support { margin-top: 14px; padding: 0; border: 0; }
.reading-bottom .support-link { min-height: 64px; padding: 12px; gap: 6px; font-size: 24px; white-space: nowrap; }
.reading-bottom .support-external { font-size: 9px; }
.reading-bottom .support p { text-align: left; font-size: 10px; line-height: 1.8; }
.controls:has(> button[hidden]:only-child) { display: none; }

/* Interpretive translation follows the currently voiced passage. */
.current-translation { margin: 0 0 20px; padding-top: 12px; border-top: 1px solid var(--hairline); }
.translation-label { margin: 0 0 6px; font-size: 10px; letter-spacing: .06em; color: var(--accent); }
#currentTranslation { margin: 0; font-size: 13px; line-height: 1.9; color: var(--ink-muted); overflow-wrap: anywhere; }
.translation-note { font-size: 11px; line-height: 1.8; color: var(--ink-subtle); }
@media (max-width: 600px) {
  .current-translation { margin-bottom: 14px; padding-top: 10px; }
  #currentTranslation { font-size: 12px; line-height: 1.85; }
}

.sutra-picker { display: flex; align-items: center; gap: 12px; max-width: 350px; margin-top: 18px; color: var(--ink-muted); font-size: 12px; }
.sutra-picker > span { flex-shrink: 0; }
.sutra-picker select { min-width: 0; min-height: 44px; font-size: 14px; }
.sutra-switch-hint { margin: 6px 0 0; color: var(--ink-subtle); font-size: 10px; }

/* Keep the wheel available while reading an auxiliary panel. */
.reader-app { height: 100vh; height: 100dvh; overflow: hidden; }
.reader-app .page { height: 100%; padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); display: flex; flex-direction: column; }
.reader-app .top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; flex-shrink: 0; }
.reader-app h1 { margin: 0; font-size: 24px; white-space: nowrap; }
.reader-app .sutra-picker { margin: 0; min-width: 0; }
.reader-app .sutra-picker > span { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
.reader-app .sutra-picker select { width: 100%; font-size: 12px; padding: 8px; }
.reader-app main { flex: 1; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.reader-app .grid { grid-template-columns: minmax(0, 1fr) minmax(0, 190px); align-items: stretch; min-height: 0; margin: 14px 0; gap: 28px; }
.reader-app .stage-panel { display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.reader-app .stage { flex: 1; min-height: 44px; max-height: 420px; }
.reader-app .reel-window { height: 100%; }
.reader-app .drum-meter { flex-shrink: 0; margin-top: 8px; }
.reader-app .stage-panel > .stage-hint { margin: 4px 0 0; }
.reader-app .read-panel { justify-content: center; min-height: 0; padding: 0; }
.reader-app .reading-copy { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 0 4px; }
.reader-app .reading-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.reader-app .statusline { min-height: 24px; }
.reader-app .reading-heading { margin-top: 6px; }
.reader-app .current { min-height: 0; }
.reader-app .current-reading { margin: 8px 0 12px; }
.reader-app .current-translation { margin-bottom: 8px; }
.reader-app .reading-bottom { flex-shrink: 0; margin-top: 12px; }
.reader-app .reading-bottom .support { margin-top: 8px; }
.reader-app .reading-bottom .support-link { min-height: 44px; padding: 6px; font-size: 22px; }
.reader-app .support p { margin-top: 4px; }
.reader-app .secondary { position: relative; height: 44px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.reader-app .secondary:has(details[open]) { height: clamp(160px, 30dvh, 260px); }
.reader-app .disclosure { min-width: 0; border: 0; }
.reader-app .disclosure summary { min-height: 44px; padding: 10px 8px; text-align: center; }
.reader-app .disclosure[open] summary { color: var(--accent); border-bottom: 2px solid var(--accent); }
.reader-app .drawer-content { position: absolute; inset: 46px 0 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 4px; scrollbar-width: thin; }
.reader-app #sutraDetails .drawer-content { display: flex; flex-direction: column; overflow: hidden; }
.reader-app .translation-note { flex-shrink: 0; margin: 0 0 8px; font-size: 10px; }
.reader-app .text-block { flex: 1; min-height: 0; max-height: none; margin: 0; font-size: 15px; line-height: 2; }
.reader-app .settings-content { display: block; }
.reader-app .settings-content > * { margin: 0 0 12px; }
.reader-app .foot { margin: 0; }
.reader-app .voice-banner:not([hidden]) { max-height: 18dvh; flex-shrink: 0; overflow-y: auto; margin: 8px 0; }
.reader-app #reloadBtn { flex-shrink: 0; }
@media (max-width: 600px) {
  .reader-app h1 { font-size: 20px; letter-spacing: .04em; }
  .reader-app .grid { gap: 14px; grid-template-columns: minmax(0, 1fr) minmax(0, 100px); }
  .reader-app .current { font-size: 22px; }
  .reader-app .drum-meter { font-size: 10px; }
}
@media (max-height: 500px) {
  .reader-app .page { padding-top: 6px; padding-bottom: 6px; }
  .reader-app .top { padding-bottom: 4px; }
  .reader-app .grid { margin: 8px 0; }
  .reader-app .secondary:has(details[open]) { height: 120px; }
  .reader-app .support-link { position: relative; }
  .reader-app .drum-meter, .reader-app .stage-panel > .stage-hint { display: none; }
  .reader-app .reading-meta { display: none; }
}

/* Preserve access under extreme viewport constraints and text enlargement. */
.reader-app.is-constrained { height: auto; min-height: 100dvh; overflow-y: auto; }
.reader-app.is-constrained .page { height: auto; min-height: 100dvh; }
.reader-app.is-constrained .top { flex-wrap: wrap; }
.reader-app.is-constrained main { flex: none; display: block; }
.reader-app.is-constrained .grid { height: auto; min-height: 300px; align-items: start; }
.reader-app.is-constrained .stage { flex: none; height: 300px; }
.reader-app.is-constrained .reading-copy { flex: none; overflow: visible; }
@media (max-height: 360px) {
  .reader-app { height: auto; min-height: 100dvh; overflow-y: auto; }
  .reader-app .page { height: auto; min-height: 100dvh; }
  .reader-app .top { flex-wrap: wrap; }
  .reader-app main { flex: none; display: block; }
  .reader-app .grid { height: auto; min-height: 300px; align-items: start; }
  .reader-app .stage { flex: none; height: 300px; }
  .reader-app .reading-copy { flex: none; overflow: visible; }
}
