:root {
  --bg: #0f172a; --card: #1e293b; --line: #334155; --text: #f1f5f9; --muted: #94a3b8;
  --accent: #f59e0b; --accent-text: #111827; --ok: #22c55e; --bad: #ef4444; --info: #38bdf8;
  --radius: 14px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f1f5f9; --card: #ffffff; --line: #cbd5e1; --text: #0f172a; --muted: #475569; color-scheme: light; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 640px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
h1 { font-size: 1.5rem; margin: .2em 0 .6em; }
h2 { font-size: 1.15rem; margin: 1.2em 0 .5em; }
.muted { color: var(--muted); }
.center { text-align: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.stack > * + * { margin-top: 10px; }
label { display: block; font-weight: 600; margin: 12px 0 6px; }
input, select, textarea {
  width: 100%; font: inherit; padding: 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text);
}
textarea { min-height: 80px; }
button, .btn {
  display: block; width: 100%; font: inherit; font-weight: 700; padding: 16px; min-height: 56px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
button.ok { background: var(--ok); color: #052e16; border-color: var(--ok); }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }
.list button { text-align: left; display: flex; justify-content: space-between; align-items: center; margin: 8px 0; }
.plate { font-family: ui-monospace, Menlo, monospace; font-size: 1.15rem; letter-spacing: .04em; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--line); }
.badge.ok { background: var(--ok); color: #052e16; } .badge.bad { background: var(--bad); color: #fff; }
.badge.info { background: var(--info); color: #082f49; }
.err { background: color-mix(in srgb, var(--bad) 18%, transparent); border: 1px solid var(--bad); padding: 12px; border-radius: 12px; }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: 0; }
.dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--line); flex: 0 0 28px; font-size: .85rem; }
.dot.done { background: var(--ok); color: #052e16; } .dot.miss { background: var(--bad); color: #fff; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.pinpad button { font-size: 1.4rem; }
.pindots { text-align: center; font-size: 2rem; letter-spacing: .4em; min-height: 1.5em; }

/* Recorder */
.rec { position: fixed; inset: 0; background: #000; z-index: 10; display: flex; flex-direction: column; color: #fff; }
.rec video { flex: 1; width: 100%; height: 100%; object-fit: cover; min-height: 0; }
.rec .top, .rec .bottom { position: absolute; left: 0; right: 0; padding: 14px 16px; }
.rec .top { top: 0; padding-top: max(14px, env(safe-area-inset-top)); background: linear-gradient(#000c, #0000); }
.rec .bottom { bottom: 0; padding-bottom: max(18px, env(safe-area-inset-bottom)); background: linear-gradient(#0000, #000d); }
.rec .title { font-size: 1.25rem; font-weight: 800; }
.rec .hint { font-size: .95rem; opacity: .9; }
.rec .timer { font: 700 1.1rem ui-monospace, monospace; }
.rec .recdot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--bad); margin-right: 6px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .rec .recdot { animation: none; } }
.recbtn { width: 84px; height: 84px; min-height: 0; border-radius: 50%; border: 6px solid #fff; background: var(--bad); margin: 10px auto 0; padding: 0; }
.recbtn.stop { border-radius: 22px; width: 76px; height: 76px; }
.progress { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.thumbs { display: flex; gap: 6px; overflow-x: auto; }
.thumbs img { height: 64px; border-radius: 6px; }

.seg { display: flex; gap: 6px; }
.seg button { flex: 1; padding: 12px 4px; min-height: 52px; }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.langbar { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin: 0 0 8px; }
.langbar button { width: auto; min-height: 36px; padding: 4px 10px; font-size: 14px; }
.langbar button[aria-pressed="true"] { background: #111827; color: #fff; border-color: #111827; }
