/* GoClock guard app — dark, high-contrast, thumb-sized targets. */
:root {
  --bg: #0b1220;
  --card: #131c2e;
  --line: #23304a;
  --text: #e8eef9;
  --muted: #8ea0bd;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --blue: #3b82f6;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  min-height: 100dvh;
}
.view { max-width: 520px; margin: 0 auto; padding: 24px 18px calc(32px + env(safe-area-inset-bottom)); }
h1 { font-size: 22px; margin: 4px 0 18px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
.muted { color: var(--muted); }

.brand { font-size: 28px; font-weight: 800; letter-spacing: .02em; margin-bottom: 6px; }
.brand-mini { font-weight: 800; letter-spacing: .02em; }

/* login */
#form-login label { display: block; margin-bottom: 14px; font-size: 14px; color: var(--muted); }
#form-login input:not([type=checkbox]) {
  display: block; width: 100%; margin-top: 6px;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  padding: 14px; border-radius: 12px; font-size: 18px;
}
.check { display: flex !important; align-items: center; gap: 10px; color: var(--text) !important; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.error { margin-top: 12px; background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.5);
         color: #fca5a5; padding: 10px 12px; border-radius: 10px; font-size: 15px; }
.hint { color: var(--muted); font-size: 14px; }

button { font: inherit; cursor: pointer; border-radius: 14px; }
.primary {
  width: 100%; border: 0; background: var(--blue); color: white;
  padding: 14px; font-weight: 700; margin-top: 8px;
}
.primary.big { padding: 18px; font-size: 19px; }
.ghost { width: 100%; border: 1px solid var(--line); background: transparent; color: var(--text); padding: 13px; margin-top: 8px; }
.ghost.danger { color: #fca5a5; border-color: rgba(239,68,68,.4); }

/* topbar */
#topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: 12px calc(16px + env(safe-area-inset-left));
  background: rgba(11,18,32,.86); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.iconbtn { margin-left: auto; background: transparent; border: 1px solid var(--line);
           color: var(--text); width: 40px; height: 40px; font-size: 18px; border-radius: 10px; }
.chip { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.chip.ok { color: #bbf7d0; border-color: rgba(34,197,94,.45); }
.chip.off { color: #fecaca; border-color: rgba(239,68,68,.55); }

/* home */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-top: 16px; }
.me-name { font-size: 21px; font-weight: 700; }
.me-code { color: var(--muted); font-size: 14px; margin-top: 2px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 0; }
.stats > div { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.stats dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stats dd { margin: 4px 0 0; font-size: 16px; font-weight: 700; }

.kinds { display: flex; gap: 8px; margin-top: 16px; }
.kind { flex: 1; padding: 11px 4px; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-size: 14px; font-weight: 600; }
.kind.active { background: rgba(59,130,246,.18); border-color: var(--blue); color: #bfdbfe; }

.scanbtn {
  width: 100%; margin-top: 14px; padding: 26px 10px;
  font-size: 22px; font-weight: 800; letter-spacing: .02em;
  border: 0; border-radius: 20px; color: #052e16;
  background: linear-gradient(180deg, #34d399, #22c55e);
  box-shadow: 0 10px 30px rgba(34,197,94,.25);
}
.scanbtn:active { transform: scale(.985); }

.log { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; }
.log li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
.log li:last-child { border-bottom: 0; }
.log .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; align-self: center; }
.tag.in { background: rgba(59,130,246,.16); color: #bfdbfe; }
.tag.out { background: rgba(245,158,11,.15); color: #fcd34d; }
.tag.cp { background: rgba(139,148,166,.15); color: var(--muted); }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(4,8,16,.66);
           display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 520px; background: var(--card);
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: 20px 20px 0 0; padding: 20px 18px calc(24px + env(safe-area-inset-bottom));
}
.sheet h2 { color: var(--text); text-transform: none; font-size: 19px; letter-spacing: 0; }
.cpname { font-size: 20px; font-weight: 700; margin: 4px 0 2px; }

#scan-overlay {
  position: fixed; inset: 0; z-index: 50; background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
#cam {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  background: #000;
}
.scan-frame {
  position: relative; width: min(78vw, 340px); aspect-ratio: 1;
  border: 3px solid rgba(255,255,255,.9); border-radius: 22px;
  box-shadow: 0 0 0 200vmax rgba(0,0,0,.55);
  pointer-events: none;
}
#scan-status {
  position: relative; z-index: 2; margin-top: 18px; color: white;
  background: rgba(0,0,0,.7); padding: 8px 16px; border-radius: 999px; font-size: 15px;
  text-align: center; max-width: 90vw;
}
.scan-actions { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); left: 0; right: 0;
                display: flex; gap: 10px; justify-content: center; z-index: 2; }
.scan-actions .ghost { width: auto; min-width: 120px; background: rgba(19,28,46,.9); }

#result-overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(4,8,16,.78);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
#result-card {
  width: 100%; max-width: 380px; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 28px 22px;
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#result-icon { font-size: 54px; line-height: 1; margin-bottom: 10px; }
#result-card.ok #result-icon { color: var(--green); }
#result-card.err #result-icon { color: var(--red); }
#result-card.dup #result-icon { color: var(--amber); }
#result-title { margin: 0 0 6px; font-size: 21px; }
#result-sub { color: var(--muted); margin: 0; font-size: 15px; }

@media (min-width: 700px) { body { font-size: 18px; } .view { padding-top: 48px; } }
