/* Projector screen: dark, large type, Tamil first. */
:root {
  --bg: #0b1020;
  --panel: #151c33;
  --line: #2a3459;
  --fg: #f4f6fb;
  --muted: #9aa5c4;
  --accent: #ffb703;
  --good: #06d6a0;
  --bad: #ef476f;
  /* Installed fonts, not web fonts: Anjal InaiMathi New comes with Murasu Anjal
     (so on any presenting laptop with Anjal installed), Tamil Sangam MN with
     macOS, and Noto Sans Tamil is loaded by the page as the last resort. */
  --tamil: "Anjal InaiMathi New", "Tamil Sangam MN", "Noto Sans Tamil", system-ui, sans-serif;
  /* The event title: Anjal Thadagam has matching Latin, so it sets the Malay too. */
  --title: "Anjal Thadagam", var(--tamil);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(circle at 50% 0%, #1a2550, var(--bg) 70%);
  color: var(--fg);
  font-family: var(--tamil);
  overflow: hidden;
}

/* ── Controls ─────────────────────────────────────────────────────────────── */
.controls {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 16px;
  background: rgba(8, 12, 26, .92); border-bottom: 1px solid var(--line);
  transition: transform .25s ease, opacity .25s ease;
}
.controls.hidden { transform: translateY(-100%); opacity: 0; pointer-events: none; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav button {
  font: 600 14px/1 system-ui, sans-serif; color: var(--fg);
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 12px; cursor: pointer;
}
.nav button.on { border-color: var(--accent); color: var(--accent); }
.nav button.open { background: var(--good); color: #052119; border-color: var(--good); }
.nav button.closed { opacity: .55; }
.quiz-controls { display: flex; align-items: center; gap: 10px; margin-left: auto; font: 14px system-ui, sans-serif; }
.quiz-controls select { font: inherit; padding: 6px; border-radius: 6px; }
.btn { font: 700 15px system-ui, sans-serif; border: 0; border-radius: 6px; padding: 9px 16px; cursor: pointer; }
.btn.go { background: var(--good); color: #052119; }
.btn.stop { background: var(--bad); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
#toggle-points { background: var(--panel); color: var(--fg); border: 1px solid var(--line); }
.conn { color: var(--good); font-size: 14px; }
.conn.down { color: var(--bad); }

/* ── Screens ──────────────────────────────────────────────────────────────── */
main {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  /* --bar: the control bar's height, kept up to date by present.js (0 when hidden with C) */
  padding: calc(4vh + var(--bar, 56px)) 5vw 4vh; text-align: center; gap: 3vh;
}
.kicker { color: var(--accent); font-weight: 800; letter-spacing: .08em; font-size: 2.6vh; }
.muted { color: var(--muted); }
/* Capitals in Latin script stand taller than Tamil at the same size; this evens them out. */
.latin { font-size: .78em; }

.home h1 { font-size: 9vh; margin: 0; font-weight: 800; line-height: 1.2; font-family: var(--title); }
.home .sub.ms { font-family: var(--title); }
/* Thadagam has one weight: use it as drawn, never a browser-faked bold. */
.home h1, .home .sub.ms { font-synthesis: none; }
.home .sub { font-size: 3.4vh; color: var(--muted); margin: 0; }
.home .cta { margin-top: 4vh; font-size: 3.2vh; }
.home .cta b { color: var(--accent); }
.backdrop { max-width: 100%; max-height: 82vh; object-fit: contain; border-radius: 8px; }

.question { font-size: 6vh; font-weight: 800; line-height: 1.35; max-width: 90vw; margin: 0; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 2vh 2vw; width: min(90vw, 1500px); }
.option {
  display: flex; align-items: center; gap: 1.6vw; text-align: left;
  background: var(--panel); border: 2px solid var(--line); border-radius: 12px;
  padding: 2.2vh 2vw; font-size: 4.2vh; font-weight: 600;
}
.option .letter {
  flex: none; width: 7vh; height: 7vh; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #1d1500; font-weight: 800; font-family: system-ui, sans-serif;
}
.option.right { border-color: var(--good); background: rgba(6, 214, 160, .14); }
.option.right .letter { background: var(--good); color: #052119; }
.option.dim { opacity: .45; }
.typed-hint { font-size: 3.4vh; color: var(--muted); }
.how { font-size: 3vh; color: var(--muted); }
.how code { font-family: inherit; color: var(--fg); background: var(--panel); padding: .2em .5em; border-radius: 6px; }

.live-row { display: flex; gap: 5vw; align-items: center; justify-content: center; }
.countdown { font: 800 14vh/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.countdown.warn { color: var(--bad); }
.stat { min-width: 14vw; }
.stat .n { font: 800 8vh/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 2.6vh; color: var(--muted); }

.result { font-size: 4.4vh; }
.result b { color: var(--good); }
.fastest { display: flex; gap: 3vw; justify-content: center; font-size: 3.6vh; }
.fastest span::before { content: attr(data-medal) " "; }

.ring {
  width: 44vh; height: 44vh; border-radius: 50%; display: grid; place-items: center;
}
.ring .hole {
  width: 74%; height: 74%; border-radius: 50%; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring .big { font: 800 10vh/1 system-ui, sans-serif; }
.ring .muted { font: 600 4vh/1.4 system-ui, sans-serif; }

/* Check-in: the ring beside a QR that opens WhatsApp, with the two steps. */
.title-art { height: 10vh; max-width: 90vw; object-fit: contain; display: block; }
.title-text { font: 9vh/1.2 var(--title); margin: 0; color: var(--accent); font-synthesis: none; }
.checkin-row { display: flex; align-items: center; justify-content: center; gap: 6vw; }
.qr-card { display: flex; flex-direction: column; align-items: center; gap: 2vh;
           background: #fff; color: #111; border-radius: 16px; padding: 3vh 2.5vw; }
.qr-card img { width: 34vh; height: 34vh; display: block; }
.qr-steps { display: flex; flex-direction: column; gap: 1.2vh; font-size: 3vh; text-align: left; }
.qr-steps code { font-family: inherit; font-weight: 600; background: #eef0f4; color: #111; padding: .1em .45em; border-radius: 6px; }
.qr-steps .step { display: inline-grid; place-items: center; width: 4vh; height: 4vh; margin-right: 1vw; border-radius: 50%;
                  background: var(--accent); color: #1d1500; font: 800 2.4vh/1 system-ui, sans-serif; }
.qr-number { font: 700 2.6vh/1 system-ui, sans-serif; color: #444; letter-spacing: .04em; }

.list { width: min(92vw, 1500px); display: flex; flex-direction: column; gap: 1.6vh; text-align: left; max-height: 76vh; overflow: hidden; }

/* Asks: header pinned at the top, the list fills the rest and scrolls on its own. */
main.screen-asks { justify-content: flex-start; padding-top: calc(6vh + var(--bar, 56px)); }
main.screen-asks .pinned { flex: none; display: flex; flex-direction: column; align-items: center; gap: 1.6vh; }
main.screen-asks .list.scroll { flex: 1; min-height: 0; max-height: none; overflow-y: auto; padding-right: 8px; }
.item { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1.8vh 1.6vw; }
.item .who { color: var(--accent); font-size: 2.4vh; font-weight: 600; }
.item .what { font-size: 3.4vh; margin-top: .6vh; }
.board .item { display: flex; align-items: center; gap: 2vw; font-size: 4vh; }
.board .rank { min-width: 8vh; white-space: nowrap; color: var(--accent); font-weight: 800; font-family: system-ui, sans-serif; }
/* Past six rows: two columns, filled down the first, then the second. */
.board.two { display: grid; grid-auto-flow: column; grid-template-columns: 1fr 1fr;
             grid-template-rows: repeat(var(--rows), auto); column-gap: 2vw; row-gap: 1.6vh; }
.board.dense .item { font-size: 3vh; padding: 1.2vh 1.4vw; }
/* Reveal: hidden places hold their slot; the place just revealed lights up. */
.board .item.slot { opacity: .3; }
.board .item.latest { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 0 4vh rgba(255, 183, 3, .35);
                      animation: reveal .6s ease-out; }
@keyframes reveal { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.board .pts { margin-left: auto; font-family: system-ui, sans-serif; font-weight: 800; }

/* ── Toast and gate ───────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20;
  background: #3a1220; border: 1px solid var(--bad); color: #fff;
  font: 15px system-ui, sans-serif; padding: 10px 16px; border-radius: 8px;
}
.gate { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: var(--bg); }
.gate form { display: flex; flex-direction: column; gap: 12px; width: min(360px, 90vw); font-family: system-ui, sans-serif; }
.gate h1 { font-size: 22px; margin: 0 0 8px; }
.gate input { font: 16px system-ui, sans-serif; padding: 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); }
.gate-err { color: var(--bad); min-height: 1.2em; margin: 0; }
.gate-help { color: var(--muted); margin: 0; line-height: 1.5; }
.gate input { text-align: center; letter-spacing: .3em; font-size: 22px; }
[hidden] { display: none !important; }
.board .item { min-width: 0; }
.board .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trophy { font-size: 16vh; line-height: 1.3; margin-top: 2vh; }
