:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Noto Sans", sans-serif;
  background: #0b1423;
  color: #eef4fb;
  --mint: #75efc3;
  --muted: #9baec3;
  --surface: #142237;
}
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 520px; margin: auto; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
.brand { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
h1 { font-size: 22px; font-weight: 850; letter-spacing: .04em; margin: 0; }
.eyebrow { font-size: 11px; color: var(--mint); letter-spacing: .24em; margin: 5px 0 0; }
.version { font-size: 10px; color: var(--muted); border: 1px solid #304158; padding: 6px 8px; border-radius: 6px; }
.preview { position: relative; height: clamp(190px, 38vh, 360px); height: clamp(190px, 38svh, 360px); background: #060d17; border: 1px solid #2b3c51; border-radius: 20px; overflow: hidden; }
video, canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform: scaleX(-1); }
#phase { position: absolute; top: 12px; left: 12px; max-width: calc(100% - 90px); padding: 7px 10px; background: #0b1423e8; border: 1px solid #34475a; border-radius: 20px; font-size: 12px; }
.exercise { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; color: #c4d3e4; font-size: 11px; text-shadow: 0 1px 5px #000; pointer-events: none; }
.camera-hint { position: absolute; inset: 40px 0 70px; display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--muted); text-align: center; font-size: 13px; }
.camera-icon { font-size: 32px; color: var(--mint); }
.camera-hint p { margin: 8px 0; line-height: 1.6; }
button { font: inherit; font-weight: 700; min-height: 44px; padding: 10px 16px; border: 0; border-radius: 12px; cursor: pointer; color: #09261d; background: var(--mint); touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }
.camera-open { position: absolute; bottom: 36px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 14px; }
.camera-close { position: absolute; right: 8px; top: 4px; background: #0b1423dd; color: #d0dcec; font-size: 12px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.metric { background: var(--surface); border: 1px solid #24354a; border-radius: 16px; padding: 12px; text-align: center; }
.metric h2 { font-size: 12px; color: var(--muted); font-weight: 500; margin: 0 0 3px; }
.metric p { margin: 0; line-height: 1.1; }
.metric strong { font-size: 52px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
#count { color: var(--mint); }
.metric span { font-size: 13px; color: var(--muted); margin-left: 6px; }
.recognition { display: flex; align-items: flex-start; gap: 9px; min-height: 48px; padding: 4px 2px; }
.status-dot { flex: 0 0 6px; height: 6px; border-radius: 50%; background: var(--mint); margin-top: 8px; }
#status { font-size: 13px; line-height: 1.6; margin: 0; overflow-wrap: anywhere; }
.sound-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; font-size: 12px; }
.sound-row label { display: flex; align-items: center; gap: 6px; margin: 0; min-height: 44px; }
.sound-row > span { color: var(--muted); }
.voice-status { color: #b7c8dc; font-size: 11px; line-height: 1.5; margin: 0 0 6px; overflow-wrap: anywhere; }
.action-dock { position: sticky; bottom: 0; z-index: 3; padding: 8px 0 max(10px, env(safe-area-inset-bottom)); background: #0b1423f5; }
.primary { width: 100%; min-height: 60px; font-size: 20px; box-shadow: 0 6px 22px #0002; }
.primary span { display: block; margin-top: 3px; font-size: 11px; font-weight: 500; }
.stop { background: #25384e; color: #fff; border: 1px solid #536a82; }
.card { border: 1px solid #26384d; border-radius: 14px; padding: 14px; margin-top: 8px; background: var(--surface); }
h2 { font-size: 16px; margin: 0 0 8px; }
p { line-height: 1.7; }
.card p, .card label, .card a { font-size: 13px; }
summary { cursor: pointer; font-size: 13px; font-weight: 600; min-height: 20px; }
.settings > summary { color: var(--muted); }
.settings section, .sub-settings { margin-top: 16px; padding-top: 14px; border-top: 1px solid #2a3c53; }
label { display: block; margin: 12px 0; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--mint); vertical-align: middle; }
input[type=number] { width: 76px; min-height: 44px; font: inherit; font-size: 16px; border: 1px solid #536a82; border-radius: 6px; padding: 6px; }
.secondary { background: #25384e; color: #eef4fb; font-size: 13px; }
pre { font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.note { color: var(--muted); }
a { color: var(--mint); }
[hidden] { display: none !important; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible { outline: 3px solid #ffda8b; outline-offset: 3px; }
#countdown { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; pointer-events: none; font-size: clamp(120px, 35vw, 240px); font-weight: 900; color: #fff; text-shadow: 0 4px 28px #000, 0 0 8px #000; font-variant-numeric: tabular-nums; }
@media (max-height: 700px) {
  main { padding-top: max(10px, env(safe-area-inset-top)); }
  .brand { margin-bottom: 10px; }
  .preview { height: 32vh; height: 32svh; min-height: 180px; }
  .camera-hint { inset: 38px 0 92px; }
  .camera-icon { display: none; }
  .camera-hint p { margin: 0; }
  .metric { padding: 9px; }
  .metric strong { font-size: 44px; }
  .stats { margin: 10px 0; }
}
