:root {
  --bg: #0f1115;
  --panel: #1a1d24;
  --key: #232733;
  --key-press: #2f3442;
  --text: #f2f3f5;
  --muted: #8b90a0;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --blue: #3b82f6;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column;
  user-select: none; -webkit-user-select: none;
  overflow: hidden;
}
.top { display: flex; justify-content: space-between; align-items: flex-start; padding: 24px 32px 0; }
.clock { font-size: clamp(48px, 9vw, 88px); font-weight: 700; letter-spacing: -2px; font-variant-numeric: tabular-nums; line-height: 1; }
.date { color: var(--muted); font-size: 20px; margin-top: 6px; }
.cam-wrap { position: relative; width: 132px; height: 99px; border-radius: 14px; overflow: hidden; background: #000; }
.cam-wrap video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam-dot { position: absolute; top: 8px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px rgba(239,68,68,.25); }

main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; }
.screen { display: none; width: 100%; max-width: 520px; text-align: center; }
.screen.active { display: block; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hint { color: var(--muted); font-size: 22px; margin: 0 0 18px; }
.dots { display: flex; gap: 18px; justify-content: center; height: 24px; }
.dots i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--muted); }
.dots i.on { background: var(--text); border-color: var(--text); }
.dots.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.error { color: var(--red); min-height: 28px; font-size: 18px; margin: 12px 0; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.keypad button {
  height: clamp(64px, 11vh, 96px); border: 0; border-radius: 18px;
  background: var(--key); color: var(--text); font-size: 34px; font-weight: 600; cursor: pointer;
}
.keypad button:active { background: var(--key-press); transform: scale(.97); }
.keypad .muted { color: var(--muted); }
.keypad .ok { background: var(--blue); }
.keypad .ok:active { background: #2563eb; }

.greet { font-size: clamp(30px, 5vw, 44px); margin: 0 0 8px; }
.status { color: var(--muted); font-size: 22px; margin: 0 0 28px; line-height: 1.4; }
.actions { display: grid; gap: 14px; }
.actions button {
  border: 0; border-radius: 20px; padding: 26px; font-size: 28px; font-weight: 700; color: #fff; cursor: pointer;
}
.actions button:active { filter: brightness(.9); transform: scale(.99); }
.actions button:disabled { opacity: .5; }
.btn-green { background: var(--green); }
.btn-amber { background: var(--amber); }
.btn-red { background: var(--red); }
.btn-blue { background: var(--blue); }
.cancel { margin-top: 22px; background: none; border: 0; color: var(--muted); font-size: 20px; padding: 12px 24px; cursor: pointer; }

.done-icon {
  width: 120px; height: 120px; margin: 0 auto 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 64px; color: #fff; background: var(--green);
}
.done-icon.err { background: var(--red); }
