@font-face {
  font-family: "Oswald";
  src: url("./display.ttf") format("truetype");
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}
:root {
  color-scheme: light;
  --sand: #f5e6ca;
  --cobalt: #0047ab;
  --preview: #ead8b9;
  --secondary-ink: #345779;
  --line: #a6b1b7;
  --camera-dark: #0c2340;
  --on-camera: #fff6e6;
  font-family: Arial, sans-serif;
  color: var(--cobalt);
  background: var(--sand);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, select { font: inherit; }
button, a, select, summary { -webkit-tap-highlight-color: transparent; }
button, select, summary { cursor: pointer; }
button { border: 0; }
button:disabled { cursor: wait; opacity: .55; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
p { line-height: 1.5; }
a { color: inherit; }
::selection { color: var(--sand); background: var(--cobalt); }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 5px; }
.app {
  max-width: 1160px;
  margin: auto;
  padding: max(32px, env(safe-area-inset-top)) max(36px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(36px, env(safe-area-inset-left));
}
header { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: 36px; }
header h1 { font: 600 clamp(48px, 6.4vw, 80px)/1.05 "Oswald", sans-serif; text-transform: uppercase; letter-spacing: -.025em; }
.brand { text-decoration: none; }
.mode { font-size: 14px; flex-shrink: 0; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 48px; align-items: start; }
.stage { position: relative; aspect-ratio: 4/3; overflow: hidden; background: var(--preview); }
video, canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
video.mirrored, canvas.mirrored { transform: scaleX(-1); }
.placeholder { position: absolute; inset: 0; display: grid; place-items: center; padding: 36px; }
.placeholder p { font: 400 clamp(34px, 4vw, 52px)/1.12 "Oswald", sans-serif; text-align: center; }
.frame-corner { position: absolute; width: 25px; height: 25px; border-color: var(--cobalt); border-style: solid; border-width: 0; }
.top-left { top: 18px; left: 18px; border-top-width: 2px; border-left-width: 2px; }
.top-right { top: 18px; right: 18px; border-top-width: 2px; border-right-width: 2px; }
.bottom-left { bottom: 18px; left: 18px; border-bottom-width: 2px; border-left-width: 2px; }
.bottom-right { bottom: 18px; right: 18px; border-bottom-width: 2px; border-right-width: 2px; }
.hud { position: absolute; left: 14px; top: 14px; display: flex; align-items: baseline; gap: 8px; color: var(--sand); background: var(--cobalt); padding: 8px 16px 12px; }
#count { font: 500 clamp(52px, 7vw, 80px)/1 "Oswald", sans-serif; font-variant-numeric: tabular-nums; }
.hud > span:last-child { font-size: 13px; }
.timer { position: absolute; right: 14px; top: 14px; color: var(--on-camera); background: var(--camera-dark); padding: 9px 12px; font-variant-numeric: tabular-nums; }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; font: 500 96px/1 "Oswald", sans-serif; color: var(--on-camera); background: #0c234099; }
.feedback { display: flex; align-items: flex-start; gap: 10px; min-height: 58px; padding-top: 16px; }
.feedback p { font-size: 14px; }
.status-dot { flex: none; width: 6px; height: 6px; margin-top: 7px; background: var(--cobalt); }
.status-dot.good { background: var(--cobalt); }
.status-dot.warning { background: var(--cobalt); transform: rotate(45deg); }
.controls { padding-top: 2px; }
.controls h2 { font: 500 30px/1.2 "Oswald", sans-serif; }
.intro { font-size: 16px; margin-top: 16px; }
.start-controls { margin-top: 26px; }
.camera-choice { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 14px; }
select { max-width: 70%; color: var(--cobalt); border: 1px solid var(--cobalt); border-radius: 0; background: var(--sand); padding: 10px 28px 10px 10px; }
.primary, .secondary { width: 100%; min-height: 56px; border-radius: 0; padding: 16px 18px; font-size: 17px; font-weight: 600; }
.primary { color: var(--sand); background: var(--cobalt); }
.primary:hover { background: #003989; }
.primary:active { transform: translateY(1px); }
.secondary { color: var(--cobalt); border: 1px solid currentColor; background: transparent; margin-top: 24px; }
.secondary:hover { background: var(--preview); }
.setup-note { font-size: 14px; margin-top: 20px; }
.text-button { display: block; min-height: 48px; padding: 14px 0; margin-top: 14px; color: var(--cobalt); background: transparent; text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; font-size: 15px; text-align: left; }
.text-button:hover { text-decoration-thickness: 2px; }
.session-info { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 14px; color: var(--secondary-ink); font-size: 13px; line-height: 1.5; }
.session-info summary { padding: 8px 0; min-height: 44px; }
.session-info p { margin-top: 12px; }
.small { color: var(--secondary-ink); font-size: 13px; margin-top: 12px; }
.result { min-height: 430px; padding: 30px 0; border-top: 2px solid var(--cobalt); border-bottom: 2px solid var(--cobalt); }
.result-check { font: 400 26px/1.2 "Oswald", sans-serif; }
.record-choice { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.record-choice input { width: 20px; height: 20px; accent-color: var(--cobalt); }
#record-note { margin: 8px 0 16px; }
.reported-count { display: flex; align-items: center; gap: 16px; margin-top: 18px; font-size: 14px; }
.reported-count input { width: 90px; padding: 10px; color: var(--cobalt); background: var(--sand); border: 1px solid var(--cobalt); font: inherit; }
.review-panel { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 20px; }
.app.active .record-choice, .app.active #record-note { display: none; }
.result-total { display: flex; align-items: baseline; gap: 16px; margin-top: 30px; font-weight: 400; }
#result-count { color: var(--cobalt); font: 500 96px/1 "Oswald", sans-serif; }
#result-label { font-size: 22px; }
#result-time { font-variant-numeric: tabular-nums; margin-top: 22px; }
#result-note { color: var(--secondary-ink); font-size: 14px; max-width: 38ch; margin-top: 20px; }
footer { display: flex; justify-content: space-between; gap: 24px; font-size: 12px; margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--secondary-ink); }
.app.active .stage { background: var(--camera-dark); }
.app.active .intro, .app.active .setup-note { display: none; }
.app.active .start-controls { margin-top: 20px; }
.app.completed .controls h2, .app.completed .intro, .app.completed .setup-note { display: none; }
.app.completed .start-controls { margin-top: 0; }
@media (max-width: 740px) {
  .app { padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
  header { margin-bottom: 24px; gap: 12px; }
  header h1 { font-size: clamp(36px, 10.6vw, 54px); }
  .mode { font-size: 11px; max-width: 65px; text-align: right; }
  .workspace { display: flex; flex-direction: column; gap: 14px; }
  .view, .controls { width: 100%; }
  .stage { aspect-ratio: 4/3; }
  .placeholder p { font-size: 36px; }
  .feedback { min-height: 46px; padding-top: 12px; }
  .feedback p { font-size: 13px; }
  .controls h2 { font-size: 26px; }
  .intro { font-size: 14px; margin-top: 12px; }
  .start-controls { margin-top: 20px; }
  .setup-note { margin-top: 16px; }
  .session-info { margin-top: 16px; }
  footer { margin-top: 32px; }
  .app.active header { margin-bottom: 16px; }
  .app.active header h1 { font-size: 32px; }
  .app.active .stage { aspect-ratio: 3/4; max-height: 54svh; }
  .app.active .controls h2, .app.active .session-info, .app.active footer { display: none; }
  .app.active .workspace { gap: 6px; }
  .app.active .start-controls { margin-top: 8px; }
  .app.active .text-button { margin-top: 4px; }
  .result { min-height: 310px; padding: 24px 0; }
}
@media (max-width: 360px) {
  .app { padding-left: 16px; padding-right: 16px; }
  header { margin-bottom: 16px; }
  .stage { aspect-ratio: 16/10; }
  .start-controls { margin-top: 16px; }
}
@media (prefers-reduced-motion: no-preference) {
  .primary, .secondary { transition: background .15s ease-out; }
  .hud.bump { animation: count-pulse .2s ease-out; }
  @keyframes count-pulse { 50% { transform: scale(1.05); } }
}
