:root {
  --bg: #0b0f14;
  --card: #151b23;
  --line: #263040;
  --text: #e8eef6;
  --muted: #8a97a8;
  --accent: #22c55e;
  --red: #ef4444;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
main { max-width: 760px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-size: 28px; margin: 8px 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin: 16px 0;
}
button, .btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 600;
  background: var(--accent);
  color: #04130a;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
button.secondary { background: var(--line); color: var(--text); }
button.danger { background: var(--red); color: #fff; }
button:disabled { opacity: 0.4; cursor: default; }
.wide { width: 100%; }
input, select {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0e141b;
  color: var(--text);
  font: inherit;
}
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.code { font: 700 40px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 6px; }
.pin { font: 700 22px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 4px; color: var(--text); }
.qr { margin-top: 16px; display: inline-block; padding: 12px; background: #fff; border-radius: 12px; }
.qr img, .qr canvas { display: block; }
.url { font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 999px;
  background: #0e141b; border: 1px solid var(--line);
  color: var(--text); font-weight: 600;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.stat { background: #0e141b; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat .n { font-size: 28px; font-weight: 700; }
.stat .l { font-size: 13px; color: var(--muted); }
.big { font-size: 64px; font-weight: 800; line-height: 1; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
.hidden { display: none !important; }
.hit { color: var(--accent); }
.bad { color: var(--red); }

/* Result dashboard */
.dashboard h3 { font-size: 15px; margin: 20px 0 8px; }
.tiles { margin-top: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.insights { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.insights li { display: flex; gap: 10px; align-items: baseline; background: #0e141b; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.insights .ico { width: 16px; flex: none; text-align: center; color: var(--muted); font-weight: 700; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.key { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; }
.chart { position: relative; width: 100%; touch-action: pan-y; }
.chart svg { display: block; }
.tip {
  position: absolute; top: 0; transform: translateX(-50%);
  background: #0e141b; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; font-size: 13px; white-space: nowrap; pointer-events: none;
}
.podrow { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; margin: 6px 0; font-size: 14px; }
.podtrack { height: 12px; background: #0e141b; border-radius: 4px; overflow: hidden; }
.podbar { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.podval { font-variant-numeric: tabular-nums; }
.markhero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.marknum, .ranknum { font-size: 48px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.marknum .muted, .ranknum .muted { font-size: 18px; font-weight: 600; }
.markhero .l { font-size: 13px; color: var(--muted); margin-top: 4px; }
.rankbox { text-align: right; }
.check { display: flex; align-items: center; gap: 8px; margin: 14px 0; color: var(--text); font-size: 15px; }
.check input { width: 20px; height: 20px; }
.student { display: inline-flex; align-items: center; border-radius: 999px; background: #0e141b; border: 1px solid var(--line); }
.student button { background: none; color: var(--text); padding: 8px 4px 8px 14px; border-radius: 999px; font-weight: 600; }
.student button.x { padding: 8px 12px 8px 6px; color: var(--muted); font-weight: 400; }
table.ranking td:nth-child(3) { font-weight: 700; }
details { margin-top: 16px; }
summary { cursor: pointer; color: var(--muted); }
table.history tr.open { cursor: pointer; }
table.history tr.open:hover td { background: #0e141b; }

/* Pod screen */
body.pod { height: 100dvh; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
#pad {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #000;
}
#podNum { font: 800 min(42vw, 42vh)/1 system-ui, sans-serif; color: #1f2937; }
#podMsg { font: 800 min(16vw, 16vh)/1 system-ui, sans-serif; color: #fff; }
#podStatus { position: absolute; left: 0; right: 0; bottom: 16px; text-align: center; color: #4b5563; font-size: 14px; }
#overlay {
  position: fixed; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: rgba(11, 15, 20, 0.96); padding: 24px; text-align: center;
}
