:root {
  --blue: #254A8E;
  --blue-dark: #1b3868;
  --gold: #EFC93F;
  --ink: #14213d;
  --paper: #f6f7fb;
  --line: #e2e6ef;
  --ok: #1f9d55;
  --error: #c0392b;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(20, 33, 61, 0.10);
  font-family: "Hanken Grotesk", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); line-height: 1.5; }
.display, h1.display {
  font-family: "Anton", system-ui, sans-serif; font-weight: 400; letter-spacing: 0.5px;
  line-height: 1.05; color: var(--blue); text-transform: uppercase; margin: 0 0 .4rem;
}
h2 { color: var(--blue-dark); }
a { color: var(--blue); }
.muted { color: #6b7280; }
.small { font-size: .85rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; color: var(--gold); margin: 0 0 .25rem; }
body.student {
  display: grid; place-items: center; min-height: 100vh; padding: 1.25rem;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(37,74,142,.12), transparent), var(--paper);
}
.card { width: 100%; max-width: 440px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem 1.75rem; border-top: 6px solid var(--gold); }
label { display: block; font-weight: 500; margin: 0 0 1rem; }
label .muted { font-weight: 400; }
input, select { width: 100%; margin-top: .35rem; padding: .65rem .7rem; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; }
input:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,74,142,.15); }
.stack { display: grid; gap: .25rem; }
fieldset.row { border: 0; padding: 0; margin: 0 0 1rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
fieldset.row.gb { grid-template-columns: 2fr 1fr 1fr; gap: .6rem; margin-bottom: .6rem; }
ul.bonuses { list-style: none; padding: 0; margin: .5rem 0; }
ul.bonuses li { color: var(--blue-dark); }
.bonus-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0 1.5rem; }
.bonus-form input, .bonus-form select { width: auto; flex: 1; min-width: 130px; margin-top: 0; }
code { background: #eef1f7; padding: .05rem .3rem; border-radius: 5px; font-size: .85em; }
tr.champ td { background: #fff7da; font-weight: 700; box-shadow: inset 4px 0 0 var(--gold); }
.btn { display: inline-block; background: var(--blue); color: #fff; border: 0; border-radius: 10px; padding: .7rem 1.2rem; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--blue-dark); }
.btn.big { width: 100%; padding: .9rem; font-size: 1.05rem; }
.btn.ghost { background: #fff; color: var(--blue); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--blue); }
.btn.danger { background: var(--error); }
button.link { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }
.inline { display: inline; }
.flash { padding: .6rem .8rem; border-radius: 10px; margin: 0 0 1rem; font-weight: 500; }
.flash-error { background: #fdecea; color: var(--error); }
.flash-ok { background: #e9f7ef; color: var(--ok); }
.flashes { max-width: 1000px; margin: 1rem auto 0; padding: 0 1.25rem; }
.pill { display: inline-block; padding: .15rem .6rem; border-radius: 999px; background: #eef1f7; color: var(--blue-dark); font-size: .8rem; font-weight: 700; }
.pill.ok { background: #e9f7ef; color: var(--ok); }
.hero { text-align: center; padding: 1rem 0; }
.hero.ok .big-num, .big-num { font-family: "Anton", sans-serif; font-size: 4.5rem; color: var(--gold); line-height: 1; }
.hero.error .display { color: var(--error); }
.topnav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1.25rem; background: var(--blue); color: #fff; }
.topnav .brand { font-weight: 700; color: #fff; text-decoration: none; font-size: 1.1rem; }
.topnav nav { display: flex; align-items: center; gap: 1.1rem; }
.topnav nav a, .topnav nav button { color: #fff; text-decoration: none; }
.topnav nav a:hover { color: var(--gold); }
.admin-main { max-width: 1000px; margin: 1.5rem auto; padding: 0 1.25rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.page-head .actions, .actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.meta-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
table.grid { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.grid th, table.grid td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--line); }
table.grid th { background: #f0f3f9; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--blue-dark); }
table.grid tr:last-child td { border-bottom: 0; }
.split { display: grid; grid-template-columns: 280px 1fr; gap: 2rem; align-items: start; }
@media (max-width: 720px) { .split { grid-template-columns: 1fr; } fieldset.row { grid-template-columns: 1fr; } }
.qr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
body.display-screen { background: var(--blue); color: #fff; min-height: 100vh; display: grid; place-items: center; padding: min(2rem, 3vmin); overflow: hidden; }
.display-wrap { --s: 1; text-align: center; width: 100%; max-width: calc(1100px * var(--s)); }
.display-screen .muted.small { font-size: clamp(.5rem, 1.6vmin, .85rem); }
.display-screen .display { color: #fff; }
.display-screen .eyebrow { color: var(--gold); }
.huge { font-size: calc(clamp(1.25rem, 9vmin, 4.5rem) * var(--s)); line-height: 1.05; }
.display-grid { display: grid; grid-template-columns: 1fr 1fr; gap: min(3rem, 5vmin); align-items: center; margin-top: min(2rem, 3vmin); }
body.live { background: radial-gradient(1200px 600px at 50% -10%, rgba(37,74,142,.12), transparent), var(--paper); min-height: 100vh; }
.live-wrap { max-width: 640px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }
.live-group { margin: 1.75rem 0 0; }
.live-group h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--blue-dark); margin: 0 0 .6rem; }
ul.live-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.live-link { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); border-left: 6px solid var(--gold); padding: 1rem 1.1rem; text-decoration: none; color: var(--ink); font-size: 1.05rem; }
.live-link:hover { box-shadow: 0 8px 28px rgba(20,33,61,.16); }
.live-link .pill { margin-left: auto; }
.display-grid.solo { grid-template-columns: 1fr; }
code.screen-url { display: inline-block; max-width: 46ch; overflow-wrap: anywhere; font-size: .78rem; line-height: 1.35; }
/* Stack only on genuinely PORTRAIT viewports (a phone). A 504x288 video board is
   504px wide but landscape — a width breakpoint treated it as a phone, stacked the
   layout, and pushed the QR off the bottom of the board. Aspect ratio is the right
   test here, not width. */
@media (max-aspect-ratio: 4/5) { .display-grid { grid-template-columns: 1fr; } }
/* Short, wide boards (both gym displays) have very little vertical room, so tighten the
   spacing and keep the two columns side by side. min-aspect-ratio = landscape. */
@media (min-aspect-ratio: 1/1) and (max-height: 620px) {
  .display-grid { grid-template-columns: 1fr 1fr; gap: min(2rem, 4vmin); margin-top: min(1rem, 2vmin); }
  .display-screen .display { margin-bottom: 0; }
}
.display-screen .label { text-transform: uppercase; letter-spacing: .15em; color: var(--gold); font-weight: 700; font-size: calc(clamp(.7rem, 3vmin, 1.2rem) * var(--s)); margin: 0 0 .2em; }
.code { font-family: "Anton", sans-serif; font-size: calc(clamp(2rem, 20vmin, 9rem) * var(--s)); letter-spacing: .06em; line-height: 1; color: var(--gold); white-space: nowrap; }
.bar { height: calc(12px * var(--s)); background: rgba(255,255,255,.2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 100%; background: var(--gold); transition: width 1s linear; }
.big-qr { width: calc(clamp(110px, 45vmin, 360px) * var(--s)); height: auto; margin: 0 auto; }


/* Cafeteria TV boards (ScreenCloud, 1080p/4K, read from across a room). Everything is
   vmin-based so one stylesheet fits 1080p and 4K, times the ?scale= knob. */
body.board { background: var(--blue); color: #fff; min-height: 100vh; overflow: hidden; display: grid; place-items: center; }
.board-wrap { --s: 1; width: 100%; padding: min(5vmin, 70px) min(6vmin, 90px); }
.board .eyebrow { font-size: calc(clamp(.7rem, 1.8vmin, 1.6rem) * var(--s)); color: var(--gold); }
.board-title { font-family: "Anton", sans-serif; font-weight: 400; text-transform: uppercase;
  letter-spacing: .02em; line-height: 1; margin: 0 0 .3em;
  font-size: calc(clamp(1.5rem, 8.5vmin, 7rem) * var(--s)); }
.board-date { color: rgba(255,255,255,.72); margin: 0 0 min(4vmin, 44px);
  font-size: calc(clamp(.8rem, 2.8vmin, 2.4rem) * var(--s)); }
.board-grid { display: grid; grid-template-columns: 1fr 1fr; gap: min(6vmin, 90px); align-items: start; }
.board-grid.solo { grid-template-columns: minmax(0, 1fr); max-width: min(900px, 100%); margin: 0 auto; }
.board-event { font-family: "Anton", sans-serif; font-weight: 400; text-transform: uppercase;
  color: #fff; margin: 0 0 .1em; line-height: 1.05;
  font-size: calc(clamp(1rem, 4.4vmin, 3.6rem) * var(--s)); }
.board-panel .board-date { margin-bottom: min(2vmin, 22px); }
ol.board-list { list-style: none; margin: 0; padding: 0; }
.board-row { display: grid; grid-template-columns: 2.6em 1fr auto; align-items: baseline;
  gap: .5em; padding: calc(clamp(.15rem, .9vmin, .8rem) * var(--s)) 0;
  border-bottom: 1px solid rgba(255,255,255,.14);
  font-size: calc(clamp(.9rem, 4.6vmin, 3.4rem) * var(--s)); }
.board-row:last-child { border-bottom: 0; }
.board-rank { color: rgba(255,255,255,.5); font-weight: 700; }
.board-label { font-weight: 500; white-space: nowrap; }
.board-num { font-family: "Anton", sans-serif; color: var(--gold);
  font-size: calc(clamp(1.1rem, 6.5vmin, 5rem) * var(--s)); line-height: 1; }
/* Inline, not its own row: seven grades each needing two lines overflowed a 1080p
   screen and the hidden overflow silently cut off the bottom classes. */
.board-sub { color: rgba(255,255,255,.45); margin-left: .7em; font-weight: 400;
  font-size: calc(clamp(.6rem, 1.9vmin, 1.4rem) * var(--s)); }
.board-row.win { border-bottom-color: var(--gold); }
.board-row.win .board-label { color: var(--gold); font-weight: 700; }
.board-row.win .board-rank { color: var(--gold); }
.board-empty { color: rgba(255,255,255,.6); font-size: calc(clamp(.9rem, 2.6vmin, 2rem) * var(--s)); }
/* Scrolling list for the individual leaderboard. The inner element holds two copies of
   the list, so translating up by half its height loops seamlessly. */
.board-scroll { overflow: hidden; max-height: 64vh; }
.board-scroll.on .board-scroll-inner { animation: ep-marquee var(--dur, 60s) linear infinite; will-change: transform; }
@keyframes ep-marquee { from { transform: translateY(0); } to { transform: translateY(-50%); } }
/* Deliberately NOT gated on prefers-reduced-motion. This is unattended signage, and the
   scroll is how the list is read at all — a player that reports "reduce" would otherwise
   show a frozen partial list and look broken. The pace is slow (~1.7s per row). */

/* Portrait TV: one column. */
@media (max-aspect-ratio: 4/5) { .board-grid { grid-template-columns: 1fr; } }
