:root {
  --bg: #f4f5f7; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --accent: #2f5bea; --accent-soft: #e8eefe; --ok: #138a52; --ok-soft: #e3f5ec;
  --ok-strong: #0f7a47; /* white text on it, and small green text on the page: 4.5:1 and up */
  --warn: #b45309; --warn-soft: #fdf1e1; --danger: #c62828; --danger-soft: #fdecec;
  --nav-bg: #1d2330; --nav-text: #c3c9d5; --nav-line: #343b4b; --nav-w: 232px; --topbar-h: 52px;
  /* the installed app on an iPhone (index.html: viewport-fit=cover, status bar black-translucent) runs under the status bar,
     the notch and the home bar: these keep clear of them (0 everywhere else) */
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text);
  padding-top: var(--safe-t); }
/* behind the status bar (clock, battery) of the installed app on an iPhone: the menu's dark navy */
body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; z-index: 40; height: var(--safe-t); background: var(--nav-bg); pointer-events: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; border-radius: 8px; padding: 9px 14px; background: var(--accent); color: #fff; font-weight: 600; }
button.ghost { background: transparent; color: inherit; border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--danger); border: 1px solid #f0c8c8; }
button.small { padding: 5px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); }
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
h1 { font-size: 22px; margin: 0 0 14px; } h2 { font-size: 18px; margin: 0 0 10px; } h3 { font-size: 15px; margin: 0 0 6px; }
.muted { color: var(--muted); } .small-text { font-size: 13px; }

main { max-width: 1100px; margin: 0 auto; padding: 16px max(16px, var(--safe-r)) 16px max(16px, var(--safe-l)); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* the menu ("menu" in app.js): a sidebar from 900px wide; narrower, a top bar whose ☰ opens it as a drawer from the left */
.topbar { position: sticky; top: var(--safe-t); z-index: 5; display: flex; align-items: center; gap: 10px; min-height: var(--topbar-h);
  padding: 4px calc(14px + var(--safe-r)) 4px calc(4px + var(--safe-l)); background: var(--nav-bg); color: #fff; }
.topbar .brand { font-weight: 700; white-space: nowrap; }
.topbar-page { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--nav-text);
  padding-left: 10px; border-left: 1px solid var(--nav-line); }
.topbar-page:empty { display: none; }
.nav-toggle, .nav-close { flex: none; width: 44px; height: 44px; padding: 0; background: transparent; color: #fff; font-size: 22px; line-height: 1; }
.nav-close { font-size: 18px; }
.nav-toggle:hover, .nav-close:hover { background: rgba(255,255,255,.08); }
.sidenav { position: fixed; top: 0; bottom: 0; left: 0; z-index: 6; width: calc(var(--nav-w) + var(--safe-l)); display: flex; flex-direction: column;
  padding: var(--safe-t) 0 var(--safe-b) var(--safe-l); background: var(--nav-bg); color: #fff; overflow-y: auto; overscroll-behavior: contain; }
.sidenav-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 56px; padding: 6px 6px 6px 22px; }
.sidenav-head .brand { font-weight: 700; font-size: 16px; }
.nav-links { flex: 1; padding: 4px 10px 12px; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-list + .nav-list { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--nav-line); }
.nav-item { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--nav-text);
  font-weight: 600; text-align: left; text-decoration: none; line-height: 1.35; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.on { background: var(--accent); color: #fff; }
.nav-hint { display: block; font-size: 12px; font-weight: 500; opacity: .8; }
.nav-item.on .nav-hint { opacity: 1; } /* readable on the accent too (white: 5.5:1) */
.nav-item:focus-visible, .nav-toggle:focus-visible, .nav-close:focus-visible { outline: 2px solid #8fa8ff; outline-offset: 1px; }
.sidenav-foot { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-top: 1px solid var(--nav-line); }
.nav-who { display: flex; flex-direction: column; padding: 2px 12px 8px; overflow-wrap: anywhere; }
.nav-who span { font-size: 12px; color: var(--nav-text); }
.nav-overlay { position: fixed; inset: 0; z-index: 15; background: rgba(15,20,30,.45); }
@media (min-width: 900px) {
  body.has-nav { padding-left: calc(var(--nav-w) + var(--safe-l)); }
  body.has-nav main { padding-left: 16px; } /* (the notch is beside the sidebar) */
  .topbar, .nav-close, .nav-overlay { display: none !important; }
  /* messages centred over the page, not over the sidebar */
  body.has-nav:not(.present-open) .toast, body.has-nav:not(.present-open) .notice { left: calc(50% + var(--nav-w) / 2); }
  body.has-nav:not(.present-open) .notice { width: min(640px, calc(100% - var(--nav-w) - 16px)); }
}
@media (max-width: 899.98px) {
  /* closed: off screen and out of reach (visibility); open: over the page, which doesn't scroll meanwhile */
  .sidenav { z-index: 16; width: calc(min(300px, 86vw) + var(--safe-l)); transform: translateX(-100%); visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s; }
  body.nav-open .sidenav { transform: none; visibility: visible; transition: transform .22s ease; box-shadow: 8px 0 28px rgba(0,0,0,.28); }
  body.nav-open { overflow: hidden; }
  /* an error message sits under the top bar, and while the drawer is open behind it with the page (dimmed) */
  body.has-nav:not(.present-open) .notice { top: calc(var(--safe-t) + var(--topbar-h) + 8px); }
  body.nav-open .notice { z-index: 14; }
}
@media (prefers-reduced-motion: reduce) { .sidenav, body.nav-open .sidenav { transition: none; } }
/* the results screen (projector): full screen, no menu */
body.present-open .topbar, body.present-open .sidenav, body.present-open .nav-overlay { display: none !important; }
body.present-open.has-nav { padding-left: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 160px; }
.spacer { flex: 1; }
.banner { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; background: var(--warn-soft); color: var(--warn); font-weight: 600; }

/* login */
.login { max-width: 360px; margin: 10vh auto; }
.login button { width: 100%; margin-top: 16px; padding: 11px; }
.login-logo { display: block; width: 220px; max-width: 80%; height: auto; margin: 2px auto 14px; }
.error { color: var(--danger); font-size: 14px; margin-top: 10px; min-height: 1em; }

/* chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.chip { padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--text); font-weight: 500; font-size: 13px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* participant list (judge) */
.plist { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.pcard { text-align: left; background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-weight: 400; }
.pcard:hover { border-color: var(--accent); }
.pcard .code { font-size: 20px; font-weight: 800; }
.pcard.scored { border-left: 4px solid var(--ok); }
.pcard.rescore { border-left: 4px solid var(--danger); }
/* the judge's choice of view ("how the list of entries looks" in app.js): the bar above the list */
.view-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 12px; }
.view-bar label { margin: 0; }
.seg { display: inline-flex; gap: 2px; margin: 0; padding: 2px; min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.seg label { position: relative; display: flex; color: var(--text); font-size: 14px; }
/* the radio button covers its label: a tap anywhere picks it, and it keeps the keyboard focus (arrow keys) */
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 36px; padding: 6px 12px;
  border-radius: 8px; font-weight: 600; white-space: nowrap; }
.seg label:hover span { background: var(--accent-soft); }
.seg input:checked + span { background: var(--accent); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.view-bar .switch { min-height: 40px; font-size: 14px; cursor: pointer; }
.view-bar .switch input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.view-bar .vb-order { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; font-size: 13px; color: var(--muted); }
.vb-order select { width: auto; min-height: 40px; padding: 6px 8px; color: var(--text); }
@media (pointer: coarse), (max-width: 899.98px) { .seg span { min-height: 40px; } }
@media (max-width: 640px) {
  .view-bar .seg { flex: 1 1 100%; }
  .seg label { flex: 1 1 0; min-width: 0; }
  .seg span { padding: 6px 8px; }
}
/* List: one row per entry; the badges go under the status when the row is too narrow */
.plist.view-list { display: flex; flex-direction: column; gap: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.prow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; width: 100%; min-height: 52px; padding: 8px 14px;
  border-radius: 0; border-top: 1px solid var(--line); background: #fff; color: var(--text); text-align: left; font-weight: 400; }
.prow:first-child { border-top: 0; }
.prow:nth-child(even) { background: #fafbfc; }
.prow:hover { background: var(--accent-soft); }
.prow:focus-visible, .ptile:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ptile:focus-visible { outline-offset: 2px; }
.prow.scored { box-shadow: inset 4px 0 var(--ok); }
.prow.rescore { box-shadow: inset 4px 0 var(--danger); }
.prow .code { flex: none; min-width: 4.2em; max-width: 100%; font-size: 19px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.prow .cat { flex: 1 1 6em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--muted); }
.prow .st { display: flex; flex-direction: row-reverse; flex-wrap: wrap; gap: 4px; margin-left: auto; }
/* Compact: a tile per entry, only its code; the colour is the status (the legend above says which) */
.plist.view-compact { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
@media (min-width: 641px) { .plist.view-compact { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; } }
.ptile { position: relative; min-height: 48px; padding: 8px 4px; border: 2px solid var(--warn); border-radius: 10px; background: #fff; color: var(--text);
  font-size: 15px; font-weight: 800; line-height: 1.15; text-align: center; overflow-wrap: anywhere; }
.ptile:hover { box-shadow: 0 0 0 2px var(--accent-soft); }
.ptile.scored { background: var(--ok-strong); border-color: var(--ok-strong); color: #fff; }
.ptile.rescore { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
/* besides the colour, a mark: ✓ scored, ! needs re-scoring; a dot: unsaved marks (blue), not sent yet (orange);
   a dashed border: not counted (the gaps show the page, also on a filled tile); a flag at the foot: reported */
.ptile.scored::after, .ptile.rescore::after { position: absolute; top: 1px; right: 5px; font-size: 11px; line-height: 1.3; }
.ptile.scored::after { content: "✓"; }
.ptile.rescore::after { content: "!"; }
.ptile.unsaved::before, .ptile.queued::before { content: ""; position: absolute; top: 4px; left: 4px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px #fff; }
.ptile.queued::before { background: var(--warn); }
.ptile.nc { border-style: dashed; background-clip: padding-box; }
.ptile .pt-flag { position: absolute; right: 4px; bottom: 3px; display: flex; line-height: 0; }
.tile-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 10px; color: var(--muted); }
.tile-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; flex: none; width: 16px; height: 16px; border-radius: 4px; }
.lg-todo { border: 2px solid var(--warn); background: #fff; }
.lg-scored { background: var(--ok-strong); }
.lg-rescore { border: 2px solid var(--danger); background: var(--danger-soft); }
.lg-unsaved, .lg-queued { width: 10px; height: 10px; margin: 0 3px; border-radius: 50%; background: var(--accent); }
.lg-queued { background: var(--warn); }
.lg-nc { border: 2px dashed var(--muted); background: #fff; }
.lg-reported { display: inline-flex; align-items: center; justify-content: center; color: var(--text); }
/* Group by category: a heading per category, with how many are still to do there */
.pgroup + .pgroup { margin-top: 18px; }
.pgroup-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 8px; font-size: 16px; }
.pgroup-count { font-size: 13px; font-weight: 600; color: var(--warn); }
.pgroup-count.done { color: var(--ok-strong); }
.pgroup-head .badge { align-self: center; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

/* scoring form */
.crit { padding: 14px 0; border-top: 1px solid var(--line); }
.crit:first-of-type { border-top: 0; }
.crit-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.crit-head .val { font-size: 22px; font-weight: 800; min-width: 3ch; text-align: right; }
.scale { display: grid; grid-template-columns: repeat(auto-fit, minmax(38px, 1fr)); gap: 6px; margin-top: 8px; }
.scale button { padding: 10px 0; background: #fff; color: var(--text); border: 1px solid var(--line); font-weight: 700; }
.scale button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.half { margin-top: 6px; font-size: 13px; }
.half label { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); }
.half input { width: auto; }
/* (above the home bar of an iPhone with the app installed: --safe-b) */
.totalbar { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 10px 16px calc(10px + var(--safe-b)); margin: 0 -16px -16px;
  display: flex; flex-direction: column; gap: 8px; border-radius: 0 0 12px 12px; box-shadow: 0 -6px 14px rgba(20,30,50,.06); }
.totalbar .t { font-size: 20px; font-weight: 800; }
.tb-row { display: flex; align-items: center; gap: 8px; }
/* row 1 never wraps: the save state (Unsaved / Sending… / Saved ✓) and the total always keep their width;
   the position ("12/30") gives way first, and a very long entry number is cut at 30% of the bar */
.tb-code { font-size: 17px; flex: none; max-width: 30%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-pos { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#saveState { flex: none; white-space: nowrap; font-size: 12px; }
.tb-total { flex: none; margin-left: auto; white-space: nowrap; }
@media (max-width: 359px) { .tb-label { display: none; } }
.totalbar button { padding: 9px 12px; }
.totalbar button.navbtn { min-width: 42px; padding: 9px 0; font-size: 16px; line-height: 1.2; }
.st-ok { color: var(--ok); font-weight: 600; }
.st-warn { color: var(--warn); font-weight: 600; }
/* criterion still to mark (highlighted after Save, or added since the judge scored), or whose points changed */
.crit.need, .crit.flag { background: var(--warn-soft); margin: 0 -16px; padding: 14px 16px; }
.crit-note { color: var(--warn); font-weight: 600; font-size: 13px; margin-top: 6px; }
.banner.info { background: var(--accent-soft); color: var(--accent); }
.report { border-top: 1px solid var(--line); padding: 8px 0; }
.report:first-of-type { border-top: 0; }

/* tables */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfc; }
/* sortable column headers: the whole label is the button */
th.sortable { padding: 0; }
.sort-btn { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 4px; width: 100%; padding: 8px 10px;
  cursor: pointer; font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit; white-space: nowrap; }
th.num .sort-btn { justify-content: flex-end; }
.sort-btn:hover, .sort-btn.on { color: var(--text); }
.sort-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
.sort-ind { font-size: 10px; opacity: .45; }
.sort-btn.on .sort-ind { opacity: 1; color: var(--accent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; } tr.click:hover td { background: #f7f9ff; }
.rank { font-weight: 800; }
.rank-1 { color: #b8860b; } .rank-2 { color: #7a7f87; } .rank-3 { color: #a0522d; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; min-width: 120px; }
.progress > div { height: 100%; background: var(--ok); }

/* criteria editor */
.crit-edit { display: grid; grid-template-columns: 1fr 1.6fr 80px auto; gap: 6px; margin-bottom: 6px; align-items: center; }
@media (max-width: 640px) { .crit-edit { grid-template-columns: 1fr 70px auto; } .crit-edit .desc { grid-column: 1 / -1; order: 5; } }
.crit-total { padding: 5px 12px; border-radius: 8px; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.crit-total.ok { background: var(--ok-soft); color: var(--ok); }
.crit-total.under { background: var(--warn-soft); color: var(--warn); }
.crit-total.over { background: var(--danger-soft); color: var(--danger); }

/* modal & toast */
.modal { position: fixed; inset: 0; background: rgba(15,20,30,.45); display: flex; align-items: flex-start; justify-content: center;
  padding: calc(6vh + var(--safe-t)) 12px calc(6vh + var(--safe-b)); z-index: 20; overflow-y: auto; }
.modal-box { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 760px; }
.modal-box:focus { outline: none; } /* focused itself when it opens (app.js openModal): Tab goes on to its first control */
.modal-box.narrow { max-width: 420px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast { position: fixed; bottom: calc(20px + var(--safe-b)); left: 50%; transform: translateX(-50%); background: #1d2330; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 30; }
.toast.err { background: var(--danger); }
.sheet-open .toast { bottom: calc(130px + var(--safe-b)); } /* above the marking sheet's bottom bar */
/* errors: stay until dismissed (under the phone's top bar: see the menu) */
.notice { position: fixed; top: calc(8px + var(--safe-t)); left: 50%; transform: translateX(-50%); width: min(640px, calc(100% - 16px)); z-index: 30;
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 10px 12px 16px; border-radius: 10px;
  background: var(--danger); color: #fff; font-weight: 600; box-shadow: 0 8px 28px rgba(15,20,30,.3); }
.notice span { flex: 1; }
.notice button { background: transparent; color: #fff; padding: 0 6px; font-size: 18px; line-height: 1.3; }
/* saves waiting to be sent (judges) */
.outbox { display: flex; gap: 10px; align-items: center; padding: 10px max(16px, var(--safe-r)) 10px max(16px, var(--safe-l)); background: var(--warn-soft); color: var(--warn);
  font-size: 14px; border-bottom: 1px solid #f1d6b0; }
.outbox span { flex: 1; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); }
.switch input { width: 18px; height: 18px; }

/* slider + number input for criteria worth more than 20 points */
.bigscore { display: flex; gap: 12px; align-items: center; margin-top: 10px; }
.bigscore input[type=range] { flex: 1; padding: 0; border: 0; accent-color: var(--accent); height: 32px; }
.bigscore input[type=range].unset { opacity: .35; }
.bigscore input[type=number] { width: 96px; flex: none; font-size: 22px; font-weight: 800; text-align: center; padding: 8px; }

/* results screen (projector) */
.present { position: fixed; inset: 0; z-index: 10; overflow-y: auto; display: flex; flex-direction: column; align-items: center;
  padding: calc(4vh + var(--safe-t)) 3vw 110px; color: #fff; background: radial-gradient(ellipse at top, #24304f 0%, #0d111c 70%); }
.present-head { text-align: center; margin-bottom: 4vh; }
.present-cat { font-size: clamp(32px, 6vw, 72px); font-weight: 900; letter-spacing: .01em; }
.present-sub { color: #9aa4bd; font-size: 16px; display: flex; gap: 10px; justify-content: center; align-items: center; min-height: 24px; }
.present-empty { color: #9aa4bd; font-size: 22px; }
/* one column per place held (2nd, 1st, 3rd); a shared place is one wider step with a card per entry */
.podium { display: flex; justify-content: center; gap: 2vw; align-items: flex-end; width: min(1200px, 100%); }
.pod { display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; }
.pod-cards { display: flex; gap: 8px; align-items: stretch; }
.pod-cards .pod-card { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
.pod-card { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: 18px 18px 0 0; padding: 3vh 1.5vw;
  text-align: center; min-height: 26vh; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; }
.pod.shown .pod-card { animation: pop .5s ease-out; background: rgba(255,255,255,.1); }
.pod-q { font-size: clamp(48px, 8vw, 110px); font-weight: 900; color: rgba(255,255,255,.18); }
.pod-medal { font-size: clamp(36px, 5vw, 72px); line-height: 1; }
.pod-code { font-size: clamp(30px, 4.5vw, 64px); font-weight: 900; }
.pod-name { font-size: clamp(16px, 1.8vw, 26px); font-weight: 700; }
.pod-title { font-size: clamp(14px, 1.4vw, 20px); color: #b9c2d8; }
.pod-score { font-size: clamp(20px, 2.4vw, 34px); font-weight: 800; color: #ffd76a; margin-top: 6px; }
.pod-score span { font-size: .55em; color: #9aa4bd; font-weight: 600; }
.pod-base { text-align: center; font-weight: 900; font-size: clamp(22px, 3vw, 40px); padding: 2vh 0; border-radius: 0 0 10px 10px; color: #1d2330; }
.pod-1 .pod-base { background: linear-gradient(#ffe08a, #d4a017); height: 22vh; }
.pod-2 .pod-base { background: linear-gradient(#eef1f5, #a9b0ba); height: 15vh; }
.pod-3 .pod-base { background: linear-gradient(#f0c39b, #b5703b); height: 10vh; }
.pod-1 .pod-card { min-height: 32vh; border-color: rgba(255,215,106,.5); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.present-all { width: min(900px, 100%); margin-top: 4vh; background: rgba(255,255,255,.05); border-radius: 14px; padding: 8px 16px; }
.present-all td { border-color: rgba(255,255,255,.1); font-size: 18px; color: #e6e9f0; }
.present-ctrl { position: fixed; bottom: 0; left: 0; right: 0; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 14px 14px calc(14px + var(--safe-b));
  background: rgba(13,17,28,.85); opacity: .35; transition: opacity .2s; }
.present-ctrl:hover, .present-ctrl:focus-within { opacity: 1; }
.present-ctrl button.ghost { color: #fff; border-color: #3b4560; }
.present-note { align-self: center; color: #9aa4bd; font-size: 13px; }
@media (max-width: 640px) { .podium { gap: 6px; } .pod-card { padding: 12px 4px; } }
#catPick .switch { display: flex; }
/* user editor: a category's tick, and next to it whether the judge leads it */
#catPick .cat-row { display: flex; align-items: center; gap: 12px; margin: 6px 0; }
#catPick .cat-row .switch { display: inline-flex; margin: 0; }
#catPick .cat-row .lead { margin-left: auto; font-weight: 500; color: var(--muted); }

/* score details */
.detail-head { align-items: flex-start; margin-bottom: 12px; }
.detail-code { font-size: 26px; font-weight: 800; }
.detail-stat { text-align: right; min-width: 80px; }
.detail-stat b { font-size: 20px; }
.jcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.jcard { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.jcard.pending { background: #fafbfc; border-style: dashed; }
.jcard.avg { background: var(--accent-soft); border-color: #cbd8fb; }
.jcard table td { padding: 5px 4px; border: 0; }
.jcard tr.total td { border-top: 1px solid var(--line); font-weight: 800; padding-top: 8px; }
.bar-cell { width: 40%; }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); }
.jcomment { margin: 8px 0 4px; font-size: 14px; white-space: pre-wrap; }
@media print {
  .topbar, .sidenav, .nav-overlay, .no-print, .toast, .update-bar { display: none !important; }
  body { background: #fff; padding-top: 0; }
  body::before { display: none; }
  body.has-nav { padding-left: 0; }
  main, body.has-nav main { padding: 0; max-width: none; }
  .card { border: 0; padding: 0 0 16px; break-inside: avoid; }
  .jcard { break-inside: avoid; }
  .bar > div { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
/* admin: statuses, warnings, results sections */
.badge.plain { background: #eef0f3; color: var(--muted); }
.banner.danger { background: var(--danger-soft); color: var(--danger); border: 1px solid #f0c8c8; font-weight: 500; }
.banner a { color: inherit; }
.ok-text { color: var(--ok); font-weight: 600; }
.bad-text { color: var(--danger); }
tr.section td { background: #fafbfc; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding-top: 14px; }
tr.inactive td { color: var(--muted); }
td.note { min-width: 170px; }
td.note .small-text { margin-top: 2px; }
td.note button { margin-top: 6px; }
td.actions, .nowrap { white-space: nowrap; }
td.actions button { margin-left: 4px; }
code { background: #f1f2f4; padding: 1px 5px; border-radius: 4px; font-size: .92em; word-break: break-all; }

/* admin: progress board */
.pg-totals { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 12px; }
.pg-totals div { display: flex; flex-direction: column; }
.pg-totals b { font-size: 20px; font-variant-numeric: tabular-nums; }
.pg-totals span { font-size: 12px; color: var(--muted); }
.pg-grid th.cell, .pg-grid td.cell { text-align: center; }
.pg-grid td.cell { padding: 6px; vertical-align: middle; }
/* the category column stays in view while the judges scroll sideways on a phone */
.pg-grid th:first-child, .pg-grid td:first-child { position: sticky; left: 0; z-index: 1; background: #fff; min-width: 150px; max-width: 220px; }
.pg-grid th:first-child { background: #fafbfc; }
.pg-cat { cursor: pointer; }
.pg-cat:hover b { color: var(--accent); }
.pg-flags { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
.pg-btn { width: 100%; min-width: 64px; padding: 8px 6px; font-variant-numeric: tabular-nums; background: var(--warn-soft); color: var(--warn); }
.pg-btn.ok { background: var(--ok-soft); color: var(--ok); }
.pg-btn.bad { background: var(--danger-soft); color: var(--danger); }
.pg-btn.none { background: #f1f2f4; color: var(--muted); }
.pg-btn.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
tr.empty td { color: var(--muted); }
tr.pg-total td { font-weight: 700; background: #fafbfc; }
.pg-detail { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.pg-detail:first-child { border-top: 0; margin-top: 0; }
.codes { margin: 4px 0; font-variant-numeric: tabular-nums; }

/* admin: judge consistency, closing checklist */
.cons-list { margin: 8px 0; padding-left: 20px; }
.cons-list li { margin: 4px 0; }
.cons-list li.flag { color: var(--warn); font-weight: 600; }
.check-sec { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.check-sec h3 { margin: 0; }
.check-sec p { margin: 2px 0 0; }
.check-sec ul { margin: 6px 0 0; padding-left: 20px; font-size: 14px; }

/* 16px stops iPhones zooming in when a field is tapped */
@media (pointer: coarse), (max-width: 640px) { input, select, textarea { font-size: 16px; } }

/* roles: chief judge, category leaders (badges), the leaders' panel and the marking sheet's "Other judges' marks" */
.banner.plain { background: #eef0f3; color: var(--text); font-weight: 500; }
.role-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
table.users td { vertical-align: middle; }
/* the role badges and categories keep a readable width (the table scrolls sideways on a phone instead) */
table.users td:nth-child(3) { min-width: 170px; }
table.users td:nth-child(4) { min-width: 180px; }
.role-badges .badge { border-radius: 6px; }
details > summary { cursor: pointer; padding: 2px 0; }
details > summary::marker { color: var(--muted); }
.panel-sheet th, .panel-sheet td, .panel-grid th, .panel-grid td { white-space: nowrap; }
.panel-sheet tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
/* criterion names, why a sheet doesn't count and when it was saved wrap, so the table stays narrow on a phone */
.panel-sheet td.why { white-space: normal; min-width: 84px; max-width: 130px; }
.panel-sheet td:first-child { white-space: normal; min-width: 120px; }
.panel-grid th.cell, .panel-grid td.cell { text-align: center; }
/* the entry column stays in view while the judges scroll sideways on a phone */
.panel-grid th:first-child, .panel-grid td:first-child { position: sticky; left: 0; z-index: 1; background: #fff; }
.panel-grid th:first-child { background: #fafbfc; }
.panel-grid th .small-text, .panel-sheet th .small-text { text-transform: none; letter-spacing: 0; font-weight: 500; }
/* an entry this judge stepped aside from: no marks, one line saying so (wraps instead of widening the table) */
.panel-grid tr.aside-row td + td { white-space: normal; font-style: italic; }

/* bulk add judges, and the login cards made for them (print: only the cards) */
.bulk-example { background: #f1f2f4; border-radius: 8px; padding: 8px 10px; font-size: 13px; overflow-x: auto; margin: 0 0 8px; }
.login-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; margin-top: 14px; }
.login-card { border: 1px dashed #9aa3b2; border-radius: 10px; padding: 14px 16px; break-inside: avoid; page-break-inside: avoid; background: #fff; }
.lc-site { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.lc-site b { color: var(--text); }
.lc-name { font-size: 20px; font-weight: 800; margin-top: 6px; }
.lc-creds { margin: 10px 0 6px; width: auto; }
.lc-creds td { border: 0; padding: 3px 12px 3px 0; vertical-align: middle; font-size: 14px; }
.lc-creds td:first-child { color: var(--muted); }
.lc-val { font: 700 19px/1.3 ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: .06em; }
.lc-cats { font-size: 14px; }
.lc-help { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
@media print {
  body.print-logins > :not(#modal) { display: none !important; }
  body.print-logins .modal { position: static; display: block; padding: 0; background: none; overflow: visible; }
  body.print-logins .modal-box { max-width: none; padding: 0; border-radius: 0; }
  body.print-logins .modal-box > :not(.login-cards) { display: none !important; }
  body.print-logins .login-cards { grid-template-columns: 1fr 1fr; margin: 0; }
  body.print-logins .lc-copy { display: none; }
}

/* installable app (PWA, "installable app" in app.js): a new version to reload, "Install app" and its steps */
.update-bar { display: flex; gap: 10px; align-items: center; padding: 8px max(16px, var(--safe-r)) 8px max(16px, var(--safe-l));
  background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 600; border-bottom: 1px solid #cbd8fb; }
.update-bar span { flex: 1; }
.nav-install { position: relative; overflow: hidden; margin-bottom: 6px; border: 1px solid var(--nav-line); }
.nav-install::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, #2ee6ff, #c83cff); } /* the NEX-T accent */
.login-install { margin: 14px 0 0; text-align: center; }
.login .link-btn, .link-btn { display: inline-flex; align-items: center; gap: 6px; width: auto; margin: 0; padding: 6px 8px; background: transparent;
  color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.link-btn svg { width: 18px; height: 18px; flex: none; }
.install-steps { list-style: none; counter-reset: step; margin: 14px 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.install-steps li { counter-increment: step; display: flex; align-items: center; gap: 12px; }
.install-steps li::before { content: counter(step); flex: none; width: 16px; text-align: center; font-weight: 800; color: var(--muted); }
.install-ico { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 40px;
  border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 20px; }
.install-ico.word { font-size: 13px; font-weight: 700; }
/* not on the results screen (projector): there a "New version — reload" button in its controls instead */
body.present-open .update-bar, body.present-open #btnInstall { display: none !important; }
.present-ctrl button.present-update { color: #2ee6ff; border-color: #2ee6ff; }
