/* Cue Camp camera-validation demo — mobile-first, dark, thumb-reachable.
   No build step, no external fonts/assets: everything inline-friendly. */

:root {
  --bg: #0b1020;
  --surface: #151b30;
  --surface-2: #1e2740;
  --border: #2b3350;
  --fg: #eef1fb;
  --fg-muted: #9aa3c4;
  --primary: #6ea8fe;
  --danger: #ff6b6b;
  --warning: #ffc94d;
  --success: #46d18a;
  --radius: 14px;
  --radius-lg: 20px;
  --space: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100dvh; }

.screen { min-height: 100dvh; }

/* ── Start / status screens ── */
.start-card {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  padding: 28px 22px calc(28px + env(safe-area-inset-bottom));
  max-width: 34rem;
  margin: 0 auto;
}
.logo { font-size: 68px; line-height: 1; }
h1 { font-size: 1.7rem; margin: 0; font-weight: 800; }
.lede { color: var(--fg); margin: 0; line-height: 1.5; }
.privacy { color: var(--fg-muted); font-size: 0.85rem; margin: 0; line-height: 1.5; }
.privacy.small { font-size: 0.72rem; text-align: center; padding: 4px 0 calc(10px + env(safe-area-inset-bottom)); }
.hint { color: var(--fg-muted); font-size: 0.8rem; margin: 0; }

/* ── Buttons ── */
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  padding: 11px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #06122b; border-color: transparent; }
.btn-secondary { background: var(--surface-2); }
.btn-ghost { background: transparent; }
.btn-lg { padding: 15px 26px; font-size: 1.05rem; border-radius: var(--radius-lg); }
.btn-sm { padding: 7px 11px; font-size: 0.82rem; }

/* ── Main app layout ── */
#app {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 32rem;
  margin: 0 auto;
  padding: 8px 12px calc(16px + env(safe-area-inset-bottom));
}

.topbar { display: flex; align-items: center; justify-content: space-between; }
.seg { display: inline-flex; background: var(--surface); border-radius: 999px; padding: 4px; gap: 4px; }
.seg-btn {
  appearance: none; border: 0; background: transparent; color: var(--fg-muted);
  font: inherit; font-weight: 700; padding: 8px 18px; border-radius: 999px; cursor: pointer;
}
.seg-btn.is-active { background: var(--primary); color: #06122b; }
.tag {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--fg-muted); background: var(--surface); padding: 5px 10px; border-radius: 999px;
}

/* ── Camera stage ── */
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--border);
}
#video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.frame-banner {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  background: rgba(0,0,0,0.62); color: #fff; padding: 7px 14px; border-radius: 999px;
  font-size: 0.85rem; font-weight: 600; backdrop-filter: blur(3px); max-width: 90%; text-align: center;
}

/* ── Panels ── */
.panel { background: var(--surface); border-radius: var(--radius-lg); padding: 14px; }

.readouts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.readout { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.readout-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg-muted); font-weight: 700; }
.readout-value { font-size: 1.55rem; font-weight: 800; line-height: 1.1; }
.readout-sub { font-size: 0.8rem; color: var(--fg-muted); min-height: 1.1em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.meter-fill { height: 100%; width: 0%; background: var(--primary); transition: width 90ms linear; }

.move-chip {
  margin-top: 12px; text-align: center; font-weight: 700; padding: 9px; border-radius: var(--radius);
  background: var(--surface-2); color: var(--primary);
}

/* ── Practice ── */
.progress-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.target-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 14px; border-radius: var(--radius); border: 2px solid var(--tone-color, var(--danger));
}
.target-card[data-tone="danger"] { --tone-color: var(--danger); }
.target-card[data-tone="warning"] { --tone-color: var(--warning); }
.target-card[data-tone="success"] { --tone-color: var(--success); }
.target-kicker { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg-muted); font-weight: 700; }
.target-phoneme { font-size: 2.4rem; font-weight: 800; color: var(--primary); line-height: 1; }
.target-desc { font-size: 1rem; font-weight: 600; }
.light-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.light { width: 16px; height: 16px; border-radius: 50%; background: var(--tone-color, var(--danger)); box-shadow: 0 0 10px var(--tone-color, var(--danger)); flex: 0 0 auto; }
.light-msg { font-weight: 600; font-size: 0.92rem; }
.hold-bar { width: 100%; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.hold-fill { height: 100%; width: 0%; background: var(--success); transition: width 60ms linear; }

.summary { text-align: center; }
.summary h2 { margin: 4px 0 12px; }
.summary-list { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.summary-list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; background: var(--surface-2); border-radius: var(--radius); font-size: 0.9rem; }
.summary-list .ok { color: var(--success); font-weight: 700; }
.summary-list .skip { color: var(--warning); font-weight: 700; }

/* ── Controls / knobs ── */
.controls { display: flex; gap: 10px; }
.controls .btn { flex: 1; }
.rec-on { background: var(--danger) !important; color: #fff !important; border-color: transparent !important; }

.knobs { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border-radius: var(--radius); padding: 12px 14px; }
.knob { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--fg-muted); }
.knob span b { color: var(--fg); }
.knob input[type="range"] { width: 100%; accent-color: var(--primary); }
.knob-step { flex-direction: row; align-items: center; justify-content: space-between; }
.stepper { display: inline-flex; gap: 6px; }

/* ── Debug ── */
.debug { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; font-size: 0.8rem; }
.chk { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--fg-muted); }
.debug-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.debug h3 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-muted); margin: 10px 0 5px; }
.debug h3:first-child { margin-top: 0; }
.kv, .cand { list-style: none; padding: 0; margin: 0; }
.kv li, .cand li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; font-variant-numeric: tabular-nums; }
.cand { counter-reset: c; }
.cand li b { font-weight: 700; }
.yes { color: var(--success); font-weight: 700; }
.no { color: var(--fg-muted); }
.cand .top { color: var(--primary); }

@media (max-width: 360px) {
  .debug-grid { grid-template-columns: 1fr; }
}
