:root {
  --bg: #0d0b1a; --card: #1a1730; --line: #2e2a4d; --text: #f4f2ff; --dim: #9c97c2;
  --accent: #ff3d81; --accent2: #35e0c8; --ok: #5be37d; --warn: #ffc857;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #3a1d5c 0%, transparent 60%), var(--bg);
  color: var(--text); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent2); }
h1 { font-size: 2rem; margin: 0 0 .25em; letter-spacing: -.02em; }
h2 { font-size: 1.15rem; margin: 0 0 .6em; }
p { margin: .4em 0; }
.wrap { max-width: 920px; margin: 0 auto; padding: 28px 20px 60px; }
.narrow { max-width: 480px; }
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; gap: 12px; }
.brand { font-weight: 800; letter-spacing: -.02em; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.brand b { color: var(--accent); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-bottom: 16px; }
.dim { color: var(--dim); }
.small { font-size: .875rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
button, .btn {
  font: inherit; font-weight: 700; color: #fff; background: var(--accent); border: 0; border-radius: 12px;
  padding: 12px 20px; cursor: pointer; text-decoration: none; display: inline-block; text-align: center;
}
button:disabled { opacity: .4; cursor: not-allowed; }
button.ghost, .btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
button.small-btn { padding: 6px 12px; border-radius: 9px; font-size: .875rem; }
button.big { font-size: 1.4rem; padding: 20px 28px; width: 100%; border-radius: 18px; }
button.danger { background: transparent; border: 1px solid #70304a; color: #ff7da3; }
input[type=text], input[type=number] {
  font: inherit; color: var(--text); background: #100e20; border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 12px; width: 100%;
}
input[type=file] { color: var(--dim); max-width: 100%; }
label { display: block; font-size: .875rem; color: var(--dim); margin: 12px 0 6px; }
.pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: #2a2648; color: var(--dim); }
.pill.ok { background: #17402a; color: var(--ok); }
.pill.warn { background: #45371a; color: var(--warn); }
.step { display: flex; gap: 14px; }
.step > .num {
  flex: none; width: 32px; height: 32px; border-radius: 50%; background: #2a2648; display: grid; place-items: center; font-weight: 800;
}
.step.done > .num { background: var(--ok); color: #06260f; }
.qr { background: #fff; border-radius: 12px; padding: 8px; width: 180px; height: 180px; flex: none; }
.qr img { width: 100%; height: 100%; display: block; }
.err { color: #ff7da3; }
.center { text-align: center; }
.hidden { display: none !important; }
video { max-width: 100%; border-radius: 12px; background: #000; }
progress { width: 100%; }
.meter { height: 14px; background: #100e20; border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.meter > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .08s linear; }
.huge { font-size: 6rem; font-weight: 900; line-height: 1; letter-spacing: -.04em; }

/* host screen */
.stage { position: fixed; inset: 0; background: #000; display: flex; }
.stage video { flex: 1; min-width: 0; width: 100%; height: 100%; object-fit: contain; border-radius: 0; }
.board { width: 340px; flex: none; background: var(--bg); border-left: 1px solid var(--line); padding: 24px; overflow: auto; }
.board .p { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 1.3rem; font-weight: 700; }
.board .p.off { opacity: .4; }
.board .p span:last-child { color: var(--accent2); font-variant-numeric: tabular-nums; }
.count { position: fixed; inset: 0; display: grid; place-items: center; font-size: 22vw; font-weight: 900; color: #fff; text-shadow: 0 0 60px var(--accent); pointer-events: none; }
.lobby { display: grid; grid-template-columns: auto 1fr; gap: 40px; align-items: start; }
.lobby .qr { width: 320px; height: 320px; padding: 14px; }
.players { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 26px; min-height: 44px; }
.players span { background: #2a2648; padding: 8px 16px; border-radius: 99px; font-weight: 700; font-size: 1.1rem; }
.rank { display: flex; align-items: center; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 1.6rem; font-weight: 800; }
.rank .n { width: 48px; color: var(--dim); }
.rank .s { margin-left: auto; color: var(--accent2); font-size: 2.2rem; font-variant-numeric: tabular-nums; }
.rank:first-child .s { color: var(--accent); font-size: 3rem; }
@media (max-width: 760px) { .lobby { grid-template-columns: 1fr; } .board { width: 200px; padding: 14px; } }

/* recording studio (admin) */
.mirror { transform: scaleX(-1); }
.studio { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }
.cam { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; }
.cam video { width: 100%; height: 100%; object-fit: contain; border-radius: 0; display: block; }
.cam .over { position: absolute; inset: 0; display: grid; place-items: center; font-size: 7rem; font-weight: 900; text-shadow: 0 0 30px #000; pointer-events: none; }
.cam .rec { position: absolute; top: 10px; left: 12px; background: #d0153f; color: #fff; font-weight: 800; font-size: .8rem; padding: 3px 10px; border-radius: 99px; }
select { font: inherit; color: var(--text); background: #100e20; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; max-width: 100%; }
label.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 1rem; margin: 0; cursor: pointer; }
@media (max-width: 760px) { .studio { grid-template-columns: 1fr; } }

/* live accuracy gauge */
.gauge { height: 16px; background: #100e20; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.gauge > i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--dim); transition: width .5s ease-out, background-color .5s; }
.gauge[data-lv=low] > i { background: #ff5c6c; }
.gauge[data-lv=ok] > i { background: var(--warn); }
.gauge[data-lv=good] > i { background: var(--accent2); }
.gauge[data-lv=top] > i { background: var(--ok); }
.gauge.big { height: 34px; }
.word { font-size: 2.6rem; font-weight: 900; letter-spacing: -.02em; min-height: 1.3em; margin-bottom: 12px; }
.board .g { padding: 12px 0; border-bottom: 1px solid var(--line); }
.board .g.off { opacity: .4; }
.board .gn { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 1.25rem; font-weight: 700; }
.board .gn em { font-style: normal; font-size: .9rem; color: var(--dim); }

/* language switch */
.lang { position: fixed; right: 14px; bottom: 14px; z-index: 50; display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 3px; }
.lang button { background: transparent; color: var(--dim); padding: 5px 11px; border-radius: 99px; font-size: .8rem; font-weight: 800; }
.lang button.on { background: #2a2648; color: var(--text); }
body:has(#vStage:not(.hidden)) .lang { display: none; }
