/* ITG event platform: look and feel, v2. Loaded after event.css on every page; it only restyles, it changes no behaviour.
   Colours stay navy #14213D and gold #FCA311 (never gold text on a light background).
   Fonts: Manrope for headings and buttons, Inter for text, JetBrains Mono for numbers, timers and codes. Each falls back to a system font offline. */
:root {
  --font-head:"Manrope","Segoe UI",system-ui,-apple-system,Roboto,Arial,sans-serif;
  --font-body:"Inter","Segoe UI",system-ui,-apple-system,Roboto,Arial,sans-serif;
  --font-mono:"JetBrains Mono",ui-monospace,Menlo,Consolas,monospace;
  --font:var(--font-body);
  --ease:cubic-bezier(.2,.7,.2,1);
  --ink:#14213D; --ink-soft:#4A5470; --paper:#F4F6FB; --edge:#E3E7F0;
  --shadow:0 6px 18px rgba(17,23,41,.05);
  --shadow-up:0 10px 26px rgba(17,23,41,.10);
  --ring:0 0 0 3px rgba(252,163,17,.55);
}

/* ---- type ---- */
html { -webkit-text-size-adjust:100%; }
body { font-family:var(--font-body); font-size:16px; line-height:1.55; color:var(--ink);
  background:radial-gradient(1200px 520px at 85% -10%, rgba(252,163,17,.10), transparent 60%), radial-gradient(900px 480px at -10% 0%, rgba(20,33,61,.06), transparent 55%), var(--paper);
  background-attachment:fixed; -webkit-font-smoothing:antialiased; }
body.stage { background:var(--navy); }
h1, h2, h3, h4, .brand, button, .btn, th, .tabs button, .chip, .pill, .status { font-family:var(--font-head); }
h1, h2, h3 { font-\77 eight:800; letter-spacing:-.015em; }
.sec h2, .card > h2, section.card > h2, .pane-hd h2 { font-size:20px; font-\77 eight:800; line-height:1.25; }
h1 { font-size:clamp(24px, 3.2vw, 30px); }
.small, .muted.small, small { font-size:14px; }
.muted { color:var(--ink-soft); }
.lbl, label.lbl, th, .crit-score .max, .sh-team .lbl, .sh-round .lbl, .sh-event .lbl, .sh-judge .lbl { font-size:12.5px; letter-spacing:.06em; text-transform:uppercase; font-\77 eight:700; color:var(--ink-soft); }
th { font-size:12.5px; }
.crit-look, .desig, .rm-text, .plabel .small, .req, .crit-level-name, .saved { font-size:14px; }
/* numbers, timers and codes */
.crit-score, .rubric-total-val, .big-time b, #total, #timer, .timer, .clock, .num, code, .code, kbd, .path, td.num, .wcell input, input.sc, input.tw, .qno {
  font-family:var(--font-mono); font-\77 eight:700; font-variant-numeric:tabular-nums; letter-spacing:-.01em; }

/* ---- header ---- */
header.top { position:sticky; top:0; z-index:30; background:linear-gradient(180deg, #172647, var(--navy)); border-bottom:0;
  box-shadow:0 1px 0 rgba(255,255,255,.06) inset, 0 3px 0 var(--gold), 0 8px 24px rgba(17,23,41,.18); padding:12px 20px; backdrop-filter:saturate(1.2); }
header.top .brand { font-family:var(--font-head); font-\77 eight:800; font-size:17px; }
header.top .role { font-family:var(--font-head); font-\77 eight:800; font-size:12.5px; letter-spacing:.06em; text-transform:uppercase; background:rgba(252,163,17,.16); color:#FFD58A; border:1px solid rgba(252,163,17,.4); padding:4px 12px; }
header.top button.link, header.top a { transition:opacity 180ms var(--ease); }

/* ---- cards ---- */
.card { background:#fff; border:1px solid var(--edge); border-top:1px solid var(--edge); border-radius:16px; padding:18px 20px; box-shadow:var(--shadow);
  transition:box-shadow 220ms var(--ease), transform 220ms var(--ease), border-color 220ms var(--ease); position:relative; }
.card::before { content:""; position:absolute; left:18px; right:18px; top:-1px; height:3px; border-radius:0 0 4px 4px; background:linear-gradient(90deg, var(--gold), rgba(252,163,17,.25)); }
.card.narrow::before, .sheetgrid .card::before { opacity:1; }
article.card:hover, .links a:hover { box-shadow:var(--shadow-up); transform:translateY(-1px); }
.sheetgrid { gap:14px; }
.sec { margin-bottom:14px; }

/* ---- buttons and inputs ---- */
button, .btn { font-family:var(--font-head); font-\77 eight:800; font-size:15px; letter-spacing:.005em; min-height:48px; padding:10px 20px; border-radius:12px; border:2px solid var(--navy); background:var(--navy); color:#fff;
  transition:transform 150ms var(--ease), background-color 200ms var(--ease), box-shadow 200ms var(--ease), border-color 200ms var(--ease), color 200ms var(--ease), filter 200ms var(--ease); }
button:hover:not(:disabled), .btn:hover { background:var(--navy-2); filter:brightness(1.12); box-shadow:0 6px 16px rgba(20,33,61,.22); }
button:active:not(:disabled), .btn:active { transform:scale(.97); }
button.ghost, button.outline, .btn.ghost { background:#fff; color:var(--navy); border-color:#C9D0E0; }
button.ghost:hover:not(:disabled) { background:var(--gold-soft); border-color:var(--gold); filter:none; box-shadow:none; }
button.sm, .btn.sm { min-height:42px; padding:8px 14px; font-size:14px; }
button:disabled, .btn:disabled, button[disabled] { opacity:.4; cursor:not-allowed; filter:none; box-shadow:none; }
button.link { min-height:0; background:none; border:0; box-shadow:none; filter:none; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=search], input:not([type]), select, textarea {
  font-family:var(--font-body); font-size:16px; min-height:48px; padding:11px 14px; border:1.5px solid #CBD2E1; border-radius:12px; background:#fff;
  transition:border-color 180ms var(--ease), box-shadow 180ms var(--ease); }
textarea { min-height:84px; }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color:#9AA6C2; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline:none; box-shadow:var(--ring); border-color:var(--gold); }
button:focus-visible { box-shadow:0 0 0 3px #fff, 0 0 0 6px rgba(252,163,17,.9); }
form label { font-family:var(--font-head); font-\77 eight:700; font-size:14px; }

/* ---- tabs as a segmented control ---- */
.tabs { display:inline-flex; gap:4px; padding:4px; background:#E9EDF6; border-radius:14px; border:0; margin-bottom:14px; flex-wrap:wrap; }
.tabs button { min-height:42px; margin:0; padding:8px 16px; border:0; border-radius:10px; background:transparent; color:var(--ink-soft); font-size:14.5px; box-shadow:none; }
.tabs button:hover:not(:disabled) { background:rgba(255,255,255,.7); color:var(--ink); box-shadow:none; filter:none; }
.tabs button[aria-selected="true"], .tabs button.on, .tabs button.active { background:#fff; color:var(--ink); box-shadow:0 2px 8px rgba(17,23,41,.12); }

/* ---- pills and chips ---- */
.chip, .pill, .status, .badge, .tag, .stat, .wchip, [class*="pill-"] { border-radius:999px; font-family:var(--font-head); font-\77 eight:800; font-size:12.5px; letter-spacing:.05em; text-transform:uppercase; }
.status { padding:6px 12px; transition:background-color 220ms var(--ease), color 220ms var(--ease); }
.live-dot, .dot.live, .dot-live { animation:livepulse 1.6s var(--ease) infinite; }
@keyframes livepulse { 0% { box-shadow:0 0 0 0 rgba(252,163,17,.55); } 70% { box-shadow:0 0 0 9px rgba(252,163,17,0); } 100% { box-shadow:0 0 0 0 rgba(252,163,17,0); } }

/* ---- the scoring sheet ---- */
.crit { border-radius:12px; transition:background-color 220ms var(--ease), box-shadow 220ms var(--ease); }
.crit-name .qtext, .crit-name { font-family:var(--font-head); font-\77 eight:800; font-size:16px; }
.lvl { min-height:42px; font-family:var(--font-head); font-\77 eight:700; font-size:14px; border-radius:12px; background:#fff; color:var(--ink); border:1.5px solid #CBD2E1; box-shadow:none; margin:0;
  transition:transform 150ms var(--ease), background-color 200ms var(--ease), border-color 200ms var(--ease), color 200ms var(--ease); }
.lvl:hover:not(:disabled) { background:var(--gold-soft); border-color:var(--gold); filter:none; box-shadow:none; }
.lvl.on { background:var(--navy); color:#fff; border-color:var(--navy); }
.lvl.band:not(.on) { border-color:var(--gold); background:var(--gold-soft); }
.rubric-total { border-radius:14px; }
.rm-bar i { transition:width 380ms var(--ease); }
.star { transition:transform 150ms var(--ease), color 200ms var(--ease); }
.star:hover:not(:disabled) { transform:scale(1.12); }
.fbtn { min-height:0; }
.langsw button { min-height:32px; padding:4px 12px; font-size:13px; border-radius:0; border:0; }
footer.sticky { border-radius:16px; backdrop-filter:blur(6px); box-shadow:0 -4px 22px rgba(17,23,41,.18); }
.pen { min-height:0; }
.yn label { min-height:42px; display:inline-flex; align-items:center; border-radius:10px; transition:background-color 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease); }

/* ---- tables ---- */
table { border-collapse:separate; border-spacing:0; }
tbody tr { transition:background-color 160ms var(--ease); }
tbody tr:hover { background:#F7F9FD; }
td, th { padding-top:10px; padding-bottom:10px; }

/* ---- team cards, notices, toasts, dialogs ---- */
.notice, .alert { border-radius:12px; }
dialog { border:0; border-radius:18px; box-shadow:0 24px 60px rgba(17,23,41,.35); animation:dlgin 220ms var(--ease); }
dialog::backdrop { background:rgba(17,23,41,.55); backdrop-filter:blur(2px); }
@keyframes dlgin { from { opacity:0; transform:translateY(10px) scale(.98); } to { opacity:1; transform:none; } }
.toast, #toast { border-radius:14px; font-family:var(--font-head); font-\77 eight:700; box-shadow:0 12px 30px rgba(17,23,41,.3); transition:opacity 240ms var(--ease), transform 240ms var(--ease); }
details > summary { cursor:pointer; font-family:var(--font-head); font-\77 eight:700; }

/* ---- skeleton and empty states ---- */
.skeleton, .skel { position:relative; overflow:hidden; background:#E9EDF6; border-radius:12px; min-height:16px; }
.skeleton::after, .skel::after { content:""; position:absolute; inset:0; background:linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent); transform:translateX(-100%); animation:shimmer 1.4s infinite; }
@keyframes shimmer { to { transform:translateX(100%); } }
.empty { color:var(--ink-soft); text-align:center; padding:28px 12px; font-size:15px; }

/* ---- layout: roomier on wide screens, one column below 1100px ---- */
main { max-width:1180px; }
@container (max-width:520px) { .crit .cmid { grid-template-columns:1fr; } }
.card, .sec { container-type:inline-size; }
@media (max-width:1100px) {
  .sheetgrid, .sheetgrid.one { display:block; }
  .sheetgrid > .scol { width:100%; }
}
@media (max-height:760px) {
  button, .btn, input[type=text], input[type=password], input[type=number], input:not([type]), select { min-height:42px; }
  .lvl { min-height:36px; }
}

/* ---- motion preferences ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; scroll-behavior:auto !important; }
  .card:hover, .links a:hover, .star:hover { transform:none; }
}

/* ---- the scoring sheet fits one laptop window (no page scroll) ---- */
@media (min-width:1100px) and (max-height:1000px) {
  header.top { padding:6px 16px; }
  header.top .role { padding:2px 10px; }
  .tabs { margin-bottom:6px; padding:3px; }
  .tabs button { min-height:32px; padding:3px 14px; }
  #banner .notice, #banner .alert { padding:6px 12px; margin:0 0 6px; }
  #view.sheetmode .bar { margin-bottom:6px; }
  #view.sheetmode .bar button, #view.sheetmode .bar select { min-height:34px; padding-top:3px; padding-bottom:3px; }
  #view.sheetmode .shead { padding:3px 14px; margin-bottom:6px; }
  #view.sheetmode .card.sec { margin-bottom:8px; }
  #view.sheetmode .crit { padding:2px 8px; }
  #view.sheetmode .crit-name .qtext, #view.sheetmode .crit-name { font-size:15px; }
  #view.sheetmode .lvl { min-height:30px; padding:2px 4px; font-size:14px; }
  #view.sheetmode .rub .pane-hd { padding:5px 14px 3px; }
  #view.sheetmode .rubric-foot { padding:3px 14px 5px; }
  #view.sheetmode footer.sticky { padding:5px 14px; margin-top:6px; }
  #view.sheetmode footer.sticky button { min-height:36px; padding-top:2px; padding-bottom:2px; }
  main#app:has(#view.sheetmode) { padding-top:6px; padding-bottom:6px; }
}

/* tighter still for short laptop screens: the sheet is the only thing on screen, so the section tabs step aside (Back to teams is on the sheet) */
@media (min-width:1100px) and (max-height:1000px) {
  #app:has(#view.sheetmode) .tabs { display:none; }
  header.top { padding:4px 14px; }
  #app:has(#view.sheetmode) .strip { padding:3px 14px; margin-bottom:4px; }
  #view.sheetmode .bar { margin-bottom:4px; }
  #view.sheetmode .bar button, #view.sheetmode .bar select { min-height:32px; }
  #view.sheetmode .shead { gap:0 20px; padding:2px 14px; margin-bottom:4px; }
  #view.sheetmode .shead b, #view.sheetmode .shead .tname { font-size:14px; }
  #view.sheetmode .crit { padding:1px 8px; }
  #view.sheetmode .lvl { min-height:28px; padding:1px 4px; }
  #view.sheetmode .rub .pane-hd { padding:3px 14px 2px; }
  #view.sheetmode .rub .pane-hd h2 { font-size:16px; }
  #view.sheetmode .rubric-foot { padding:2px 14px 3px; }
  #view.sheetmode .card.sec { margin-bottom:6px; }
  #view.sheetmode footer.sticky { padding:4px 14px; margin-top:4px; }
  #view.sheetmode footer.sticky button { min-height:34px; }
  main#app:has(#view.sheetmode) { padding-top:4px; padding-bottom:4px; }
}

/* very short windows (a laptop browser is often 650px tall): the whole sheet shrinks a little, in steps, so it still fits without scrolling */
@media (min-width:1100px) and (max-height:790px) { main#app:has(#view.sheetmode) { zoom:.94; } }
@media (min-width:1100px) and (max-height:750px) { main#app:has(#view.sheetmode) { zoom:.88; } }
@media (min-width:1100px) and (max-height:710px) { main#app:has(#view.sheetmode) { zoom:.83; } }
@media (min-width:1100px) and (max-height:670px) { main#app:has(#view.sheetmode) { zoom:.77; } }
@media (min-width:1100px) and (max-height:630px) { main#app:has(#view.sheetmode) { zoom:.72; } }
@media (min-width:1100px) and (max-height:590px) { main#app:has(#view.sheetmode) { zoom:.67; } }

/* the small INTechGenius line under the sheet takes almost no room on short windows */
@media (min-width:1100px) and (max-height:1000px) {
  body:has(#view.sheetmode) footer.brandfoot { padding:2px 0; margin:0; min-height:0; line-height:1.2; font-size:12px; }
}

/* ---- other screens that should sit in one window ---- */
/* the judge's team list: three cards across, kept short, so fifteen teams take five low rows */
@media (min-width:1100px) and (max-height:1000px) {
  #app .teamgrid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin-top:6px; }
  #app .teamgrid .tcard { padding:5px 10px; gap:10px; }
  #app .teamgrid .tcard h2 { font-size:16px; line-height:1.2; }
  #app .teamgrid .tcard p { margin:0; line-height:1.25; font-size:14px; }
  #app .teamgrid .tcard > button { min-height:36px; padding:3px 16px; }
  #app .teamgrid .tcard .tno { font-size:20px; width:28px; }
  #app:has(.teamgrid) .tabs { margin-bottom:4px; }
  main#app:has(.teamgrid) { padding-top:6px; padding-bottom:6px; }
}
/* the portal page: four portals in one row, and a tighter top */
@media (min-width:1200px) and (max-height:1000px) {
  body.home .portals { grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
  body.home .wrap { max-width:1280px; padding-top:20px; padding-bottom:12px; }
  body.home .hero { margin-bottom:18px; }
  body.home .hero h1 { font-size:clamp(32px,5vh,46px); margin:8px 0; }
  body.home .portal { padding:16px; flex-direction:column; gap:10px; }
}
/* short windows: shrink in steps rather than scroll (the team list keeps its header and tabs in view and scrolls inside its own area) */
@media (min-width:1100px) and (max-height:760px) { body.home .wrap, main:has(.card.narrow) { zoom:.9; } }
@media (min-width:1100px) and (max-height:700px) { body.home .wrap, main:has(.card.narrow) { zoom:.82; } }
@media (min-width:1100px) and (max-height:640px) { body.home .wrap, main:has(.card.narrow) { zoom:.74; } }
@media (min-width:1100px) and (max-height:580px) { body.home .wrap, main:has(.card.narrow) { zoom:.66; } }

@media (min-width:1100px) and (max-height:1000px) {
  body:has(#app .teamgrid) { height:100dvh; overflow:hidden; display:flex; flex-direction:column; }
  body:has(#app .teamgrid) footer.brandfoot { display:none; }
  body:has(#app .teamgrid) main#app { flex:1; min-height:0; display:flex; flex-direction:column; padding-top:6px; padding-bottom:6px; }
  main#app:has(.teamgrid) #view { flex:1; min-height:0; display:flex; flex-direction:column; }
  main#app:has(.teamgrid) #view .teamgrid { flex:1; min-height:0; overflow:auto; align-content:start; padding-bottom:4px; }
}

/* ---- Admin: use the whole window width, control room in three columns, a clearer Teams table ---- */
main:has([aria-label="Admin sections"]) { max-width:min(1760px,98vw); }
@media (min-width:1100px) {
  .cpanes { grid-template-columns:minmax(0,1.08fr) minmax(0,1fr) minmax(0,1fr); gap:12px; }
}
@media (min-width:900px) and (max-width:1249px) {
  .cpanes { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
  .cpanes .ccol:nth-child(3) { grid-column:1 / -1; }
}
.cpanes .ccol { gap:12px; }


/* the control room is one screen: tighter cards, the two audience buttons side by side, a short scrolling history */
@media (min-width:1100px) {
  .cpanes .reactctl { display:flex; flex-wrap:nowrap; gap:8px; }
  .cpanes .reactctl .rbtn { flex:1 1 0; min-width:0; min-height:44px; padding:6px 10px; font-size:14px; }
  .cpanes .ctl .muted.small { font-size:14px; line-height:1.35; margin:2px 0 6px; }
  .cpanes section[aria-label="Paper backup"] { padding:12px 16px; }
  .cpanes section[aria-label="Paper backup"] h2 { margin:0 0 4px; font-size:16px; }
  .cpanes section[aria-label="Paper backup"] .ctlbtns button { min-height:38px; }
}

/* Admin Event tab on a short window: a slimmer top, no repeated status strip, and the whole control room shrinks in steps instead of scrolling */
@media (min-width:1100px) and (max-height:900px) {
  body:has(.cpanes) header.top { padding:3px 14px; }
  body:has(.cpanes) .tabs { margin-bottom:6px; padding:3px; }
  body:has(.cpanes) .tabs button { min-height:30px; padding:2px 12px; }
  main:has(.cpanes) { padding-top:6px; padding-bottom:6px; }
  main:has(.cpanes) #stripbox { display:none; }
}
@media (min-width:1100px) and (max-height:900px) { .cpanes { zoom:.96; } }
@media (min-width:1100px) and (max-height:840px) { .cpanes { zoom:.92; } }
@media (min-width:1100px) and (max-height:790px) { .cpanes { zoom:.88; } }
@media (min-width:1100px) and (max-height:740px) { .cpanes { zoom:.84; } }
@media (min-width:1100px) and (max-height:700px) { .cpanes { zoom:.8; } }
@media (min-width:1100px) and (max-height:660px) { .cpanes { zoom:.76; } }
@media (min-width:1100px) and (max-height:620px) { .cpanes { zoom:.72; } }
@media (min-width:1100px) and (max-height:580px) { .cpanes { zoom:.68; } }



/* Pitch control: the ring and the two recorded times stay inside their own column, so nothing sits over the buttons */
.cpanes .cwrap { grid-template-columns:168px minmax(0,1fr); gap:14px; align-items:start; }
.cpanes .cring { width:168px; min-width:0; }
.cpanes .recs { gap:6px; width:100%; margin-top:6px; }
.cpanes .recs > div { padding:6px 4px; min-width:0; }
.cpanes .recs b { font-size:17px; }
.cpanes .recs span { font-size:11px; letter-spacing:.04em; overflow-wrap:anywhere; }
.cpanes .cctl .ctlbtns { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:6px; }
.cpanes .cctl .ctlbtns button { margin:0; min-height:42px; padding:6px 8px; white-space:nowrap; }
.cpanes .cctl #why { margin:8px 0 0; }

/* Control room buttons never sit on top of each other: they wrap into as many columns as the card is wide, and a narrow card stacks the ring above them */
.cpanes .cctl .ctlbtns { grid-template-columns:repeat(auto-fit, minmax(96px, 1fr)); }
.cpanes .ctl .ctlbtns button, .cpanes .ctl .ctlbtns .narrow { min-width:0; }
.cpanes .ctl .ctlbtns button { font-size:14px; }
@container (max-width:440px) {
  .cpanes .cwrap { grid-template-columns:minmax(0,1fr); }
  .cpanes .cring { width:100%; }
  .cpanes .cctl { width:100%; }
}

/* ---- App shell: on a laptop or desktop the page itself never scrolls. The header and the tabs stay in view, and the content under them scrolls inside its own panel. ---- */
@media (min-width:900px) {
  body:has(#panel.panel), body:has(#app #view .cpanes) { height:100dvh; overflow:hidden; display:flex; flex-direction:column; }
  body:has(#panel.panel) footer.brandfoot, body:has(#app #view .cpanes) footer.brandfoot { display:none; }
  body:has(#panel.panel) main#app, body:has(#app #view .cpanes) main#app { flex:1; min-height:0; display:flex; flex-direction:column; padding-top:8px; padding-bottom:8px; }
  main#app > .tabs { flex:none; }
  main#app > #panel.panel { flex:1; min-height:0; overflow:auto; scrollbar-gutter:stable; }
  body:has(#app #view .cpanes) #view { flex:1; min-height:0; overflow:auto; scrollbar-gutter:stable; }
  main#app > #banner, main#app > .strip { flex:none; }
}
/* long words and links wrap instead of pushing the page sideways; tablets and phones never scroll sideways */
#panel.panel, #panel.panel p, #panel.panel li, #panel.panel .muted, #dlnote { overflow-wrap:anywhere; }
#panel.panel td, #panel.panel th { overflow-wrap:break-word; word-break:normal; }
@media (max-width:900px) { html, body { overflow-x:clip; } }

/* the control room is wide on every screen that shows it (the Panel Coordinator's too), so its three columns are never squeezed */
main#app:has(.cpanes) { max-width:min(1760px,98vw); }
.cpanes .reactctl .rbtn { white-space:normal; line-height:1.15; text-align:left; }
.cpanes .jlist li { flex-wrap:wrap; gap:4px 10px; }
@media (min-width:900px) {
  body:has(#panel.panel) main#app, body:has(#app #view .cpanes) main#app, body:has(#app .teamgrid) main#app { width:100%; }
}

/* the judge's team list: the whole window is used, names line up with their project, every card is the same height, and a status never splits across lines */
main#app:has(.teamgrid) { max-width:min(1760px,98vw); }
.teamgrid { grid-template-columns:repeat(auto-fill, minmax(360px, 1fr)); grid-auto-rows:minmax(100px, auto); align-content:start; }
.tcard { min-height:92px; }
.tcard .tbody { display:flex; flex-direction:column; justify-content:center; gap:2px; }
.tcard .tbody p { margin:0; display:flex; flex-wrap:wrap; gap:4px 6px; align-items:center; }
.tcard .chip { white-space:nowrap; }
.tcard h2 { line-height:1.2; }
.tcard > button { flex:none; }
@media (min-width:1500px) { #app .teamgrid { grid-template-columns:repeat(4, minmax(0, 1fr)); } }

/* ---- side space and card alignment on the other pages ---- */
/* the team queue (judge and Panel Coordinator): cards in as many columns as fit, each with its number, name, project and status in one tidy row */
main#app:has(.qlist) { max-width:min(1760px,98vw); }
.queue .qlist { display:grid; grid-template-columns:repeat(auto-fill, minmax(min(430px, 100%), 1fr)); gap:8px; }
.q-row { background:#fff; border:1px solid var(--edge); border-radius:12px; padding:10px 14px; min-height:68px; grid-template-columns:34px minmax(0,1fr) auto auto auto; }
.q-row.is-current { background:var(--gold-soft); border-color:var(--gold); }
.q-row .q-num { font-family:var(--font-mono); font-\77 eight:700; color:var(--ink-soft); text-align:center; }
.q-row .q-name b { display:block; line-height:1.2; }
.q-row .q-name small { display:block; color:var(--ink-soft); font-size:14px; }
.q-row .q-chip { justify-self:end; }
@media (min-width:1100px) and (max-height:1000px) { body:has(.qlist) .queue .qlist { max-height:calc(100dvh - 250px); overflow:auto; align-content:start; padding-right:4px; } }
/* the portal page and the sign-in and results screens use a wider column on big monitors */
@media (min-width:1500px) { body.home .wrap { max-width:1480px; } body.home .portals { gap:20px; } body.home .portal { padding:26px; } body.home .portal h2 { font-size:24px; } body.home .portal p { font-size:16px; } }
.queue .qlist { grid-auto-rows:minmax(76px, auto); }
.q-row .q-move { display:flex; flex-direction:row; gap:4px; margin:0; }
.q-row .q-move-btn { width:36px; height:36px; min-height:0; margin:0; padding:0; display:grid; place-items:center; }

/* Admin overview on a wide screen: the two download notices sit side by side instead of stretching across the whole window */
@media (min-width:1400px) {
  #panel:has(.kpis) { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:12px 14px; align-content:start; }
  #panel:has(.kpis) > * { grid-column:1 / -1; margin:0; }
  #panel:has(.kpis) > #paperpack, #panel:has(.kpis) > #offpdf { grid-column:auto; }
}

/* ================= Phones (and small tablets): easy to read, easy to tap, nothing sideways ================= */
@media (max-width:700px) {
  html { scroll-padding-top:64px; }
  body { font-size:16px; }
  main, main#app { padding-left:max(12px, env(safe-area-inset-left)); padding-right:max(12px, env(safe-area-inset-right)); padding-top:10px; padding-bottom:calc(24px + env(safe-area-inset-bottom)); }
  .card { padding:14px; border-radius:14px; }
  h1 { font-size:24px; }

  /* a slimmer header: name and location on top, the signed-in person and Sign out on one line below (the long job title is left out) */
  header.top { position:sticky; top:0; padding:8px max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); gap:4px 10px; }
  header.top .brand { font-size:16px; }
  header.top #who { margin-left:0; width:100%; justify-content:space-between; gap:8px; }
  header.top #who .desig { display:none; }
  header.top #who .whoname { font-size:14px; }
  header.top button.link { min-height:44px; padding:0 4px; display:inline-flex; align-items:center; }
  header.top .role { padding:2px 10px; }

  /* the sections of a screen sit in one swipeable row instead of wrapping onto three lines */
  .tabs { display:flex; flex-wrap:nowrap; overflow-x:auto; overscroll-behavior-x:contain; scroll-snap-type:x proximity; -webkit-overflow-scrolling:touch; scrollbar-width:none; margin-left:-2px; margin-right:-2px; }
  .tabs::-webkit-scrollbar { display:none; }
  .tabs button { flex:none; scroll-snap-align:start; min-height:44px; padding:8px 16px; white-space:nowrap; }

  /* every control is at least 44px to tap */
  button, .btn, input[type=text], input[type=password], input[type=number], input:not([type]), select { min-height:44px; }
  button.sm, .btn.sm { min-height:44px; padding:8px 14px; }
  .lvl { min-height:44px; }
  select, input, textarea { max-width:100%; }

  /* bars wrap, and the team switcher and other pickers take the full row */
  .bar { flex-wrap:wrap; gap:8px; }
  .bar select, #tswitch, .team-select { flex:1 1 100%; width:100%; }
  .bar .spacer { display:none; }
  .strip { padding:8px 12px; }

  /* the sticky submit bar keeps clear of the phone's home bar */
  footer.sticky { padding-bottom:calc(8px + env(safe-area-inset-bottom)); }
  dialog { width:calc(100vw - 24px); max-width:none; }

  /* Admin: the Teams table becomes one card per team */
  /* other Admin tables scroll sideways inside their own box, smoothly, instead of pushing the page */
  .scroll { overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .cpanes { gap:10px; }
}
@media (max-width:700px) {
  /* the five levels of a criterion: three across, then two, each a full-size button with its whole name showing */
  .lvls { grid-template-columns:repeat(3, minmax(0, 1fr)); gap:8px; max-width:none; }
  .lvl { min-height:46px; font-size:14px; padding:6px 4px; }
  .lvl span { white-space:normal; line-height:1.15; }
  .star { width:44px; height:44px; min-height:44px; }
  .stars { gap:2px; }
  .fbtn { width:44px; height:44px; min-height:44px; }
  .langsw button { min-height:40px; padding:6px 16px; }
  .pen { width:44px; height:44px; min-height:44px; }
  .crit { padding-top:8px; padding-bottom:8px; }
}
@media (max-width:700px) {
  /* the small links under the sign-in form are easy to hit */
  .card.narrow p a { display:inline-block; padding:12px 8px; margin:-6px 0; }
  .card.narrow { margin:16px auto; }
}

/* =====================================================================================================================
   Design system for the Teams table and the Scoring screens (Admin Teams, judge team list, judge scoring sheet).
   One set of sizes, so every button, badge and label matches:
     buttons  34px high (44px on touch screens), 10px corners, 13.5px text, never wrap
     badges   24px high, 12px caps text, never wrap
     rows     12px vertical padding, 14px horizontal padding
   ===================================================================================================================== */
:root { --btn-h:34px; --btn-r:10px; --badge-h:24px; --cell-x:14px; }

/* ---- buttons: same height, same text size, text always on one line ---- */
button.sm, .btn.sm, .teams-table button, .teamgrid .tcard > button, #view.sheetmode .bar button {
  min-height:var(--btn-h); height:var(--btn-h); padding:0 14px; font-size:13.5px; line-height:1; border-radius:var(--btn-r); white-space:nowrap; display:inline-flex; align-items:center; justify-content:center; margin:0;
}
.teams-table button:disabled { opacity:.45; }

/* ---- badges: one line, one size ---- */
.chip, .tstat { display:inline-flex; align-items:center; justify-content:center; min-height:var(--badge-h); padding:0 12px; line-height:1; white-space:nowrap; font-size:12px; letter-spacing:.05em; }

/* ---- Admin: Teams table ---- */
.teams-table { width:100%; border-collapse:separate; border-spacing:0; }
.teams-table thead th { position:sticky; top:0; z-index:1; background:#EEF1F8; padding:10px var(--cell-x); text-align:left; white-space:nowrap; border-bottom:1px solid var(--edge); }
.teams-table thead th:first-child { border-top-left-radius:12px; } .teams-table thead th:last-child { border-top-right-radius:12px; }
.teams-table td { padding:12px var(--cell-x); vertical-align:middle; border-bottom:1px solid var(--edge); }
.teams-table tbody tr:nth-child(even) { background:#FAFBFE; }
.teams-table tbody tr:hover { background:#F3F6FD; }
/* columns that hold a fixed-size thing keep that size and one line; the text columns (project, students) share what is left */
.teams-table .c-no, .teams-table .tno-cell { width:44px; white-space:nowrap; font-family:var(--font-mono); font-? eight:700; color:var(--ink-soft); }
.teams-table .c-team, .teams-table .tname-cell { white-space:nowrap; }
.teams-table .tname-cell b { font-family:var(--font-head); font-size:16px; font-? eight:800; }
.teams-table .tproj { min-width:140px; max-width:240px; color:var(--ink-soft); font-size:14.5px; line-height:1.35; }
.teams-table .tstud { min-width:150px; line-height:1; }
.teams-table .c-stat, .teams-table .tstat-cell, .teams-table .c-wt, .teams-table .wcell, .teams-table .c-act, .teams-table .acts { width:1%; white-space:nowrap; }
.teams-table .c-act, .teams-table .acts { text-align:right; }
.schip { display:inline-flex; align-items:center; min-height:26px; padding:0 10px; margin:2px 4px 2px 0; border-radius:999px; background:var(--soft); border:1px solid var(--edge); font-size:13.5px; line-height:1; white-space:nowrap; }
.tstat { border-radius:999px; font-family:var(--font-head); font-? eight:800; text-transform:uppercase; min-width:92px; background:var(--soft); border:1px solid var(--edge); color:var(--ink-soft); }
.tstat.s-Pitching, .tstat.s-Scoring { background:var(--gold-soft); border-color:var(--gold); color:var(--ink); }
.tstat.s-Locked { background:var(--navy); border-color:var(--navy); color:#fff; }
.tstat.s-Absent { background:#fff; border-color:#C9D0E0; color:#8A93AB; text-decoration:line-through; }
.teams-table .wcell > * { vertical-align:middle; }
.teams-table .wcell input.tw { display:inline-block; width:64px; height:var(--btn-h); min-height:var(--btn-h); padding:0 6px; text-align:center; font-size:14px; }
.teams-table .wcell button { margin-left:6px; }
/* the six action buttons sit in fixed columns, so Up, Down, Mark absent, Sheets, Edit and Delete line up in every row.
   Up to 1599px they make two rows of three (the text columns need the room); from 1600px they make one row. */
.teams-table .acts-in { display:grid; grid-template-columns:repeat(3, 96px); gap:6px; justify-content:end; align-items:center; }
.teams-table .acts-in button { width:100%; padding:0 4px; }
.teams-table .acts-in .aslot { display:block; }
@media (min-width:1600px) { .teams-table .acts-in { grid-template-columns:64px 64px 108px 72px 64px 72px; } }
/* the list scrolls inside the window with its header in view, instead of pushing the whole page */
@media (min-width:1180px) { main:has(.teams-table) .scroll { max-height:calc(100dvh - 232px); min-height:240px; overflow:auto; border-radius:12px; } }
@media (max-width:1399px) { .teams-table td, .teams-table thead th { padding-left:10px; padding-right:10px; } }
/* below 1180px each team is one card: name and status on top, then project, students, the team factor and a row of buttons */
@media (max-width:1179px) {
  main:has(.teams-table) .scroll { max-height:none; overflow:visible; }
  .teams-table, .teams-table tbody { display:block; width:auto; }
  .teams-table thead { position:absolute; left:-9999px; }
  .teams-table tr { display:grid; grid-template-columns:auto minmax(0,1fr) auto; grid-template-areas:"no name stat" "proj proj proj" "stud stud stud" "wt wt wt" "acts acts acts"; gap:6px 10px; align-items:center; border:1px solid var(--edge); border-radius:14px; padding:12px 14px; margin:0 0 12px; background:#fff; }
  .teams-table tbody tr:nth-child(even), .teams-table tbody tr:hover { background:#fff; }
  .teams-table td, .teams-table .acts, .teams-table .wcell, .teams-table .tstat-cell { display:block; width:auto; border:0; padding:0; }
  .teams-table .tno-cell { grid-area:no; width:auto; } .teams-table .tname-cell { grid-area:name; white-space:normal; } .teams-table .tstat-cell { grid-area:stat; }
  .teams-table .tproj { grid-area:proj; min-width:0; max-width:none; } .teams-table .tstud { grid-area:stud; min-width:0; }
  .teams-table .wcell { grid-area:wt; } .teams-table .acts { grid-area:acts; text-align:left; padding-top:6px; }
  .teams-table .acts-in { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-start; }
  .teams-table .acts-in button { width:auto; flex:1 1 92px; }
  .teams-table .acts-in .aslot { display:none; }
}
@media (max-width:700px) { .teams-table button, .teams-table .wcell input.tw { height:44px; min-height:44px; } }

/* ---- judge: team list cards ---- */
.teamgrid, #app .teamgrid { grid-auto-rows:auto; }
.teamgrid .tcard { display:grid; grid-template-columns:30px minmax(0,1fr) 78px; gap:12px; align-items:center; min-height:96px; padding:12px 14px; }
.teamgrid .tcard .tno { width:auto; text-align:center; }
.teamgrid .tcard .tbody { min-width:0; }
.teamgrid .tcard .tbody h2 { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.teamgrid .tcard .tbody p.muted { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.teamgrid .tcard .tbody p:last-child { display:flex; flex-wrap:wrap; gap:6px; margin:4px 0 0; }
.teamgrid .tcard > button { width:78px; padding:0; }
@media (max-width:700px) { .teamgrid { grid-template-columns:minmax(0,1fr); } .teamgrid .tcard > button { height:44px; min-height:44px; } }

/* ---- judge: scoring sheet ---- */
/* team strip: one row of label-over-value cells, all on the same baseline */
#view.sheetmode .shead, .shead { display:grid; grid-template-columns:minmax(0,2.4fr) repeat(4, minmax(0,auto)); gap:0 28px; align-items:start; padding:10px 18px; margin-bottom:10px; }
#view.sheetmode .shead > div, .shead > div { display:flex; flex-direction:column; gap:3px; min-width:0; }
#view.sheetmode .shead .lbl, .shead .lbl { display:block; font-size:11px; letter-spacing:.06em; line-height:1.2; white-space:nowrap; }
#view.sheetmode .shead b, .shead b { font-size:15px; line-height:1.25; white-space:nowrap; }
.shead .sh-team b { white-space:normal; }
.shead button.tname { min-height:0; height:auto; display:inline; line-height:1.25; }
.shead .sh-proj { font-size:13px; line-height:1.3; }
.shead .desig { font-size:12.5px; }
@media (max-width:1000px) { #view.sheetmode .shead, .shead { grid-template-columns:repeat(3, minmax(0,1fr)); gap:8px 20px; } .shead .sh-team { grid-column:1 / -1; } }
@media (max-width:700px) { #view.sheetmode .shead, .shead { grid-template-columns:repeat(2, minmax(0,1fr)); } .shead .sh-round, .shead .sh-event { display:none; } }

/* two columns: Section 1 (the rubric) gets the room it needs, Sections 2 and 3 share the rest */
@media (min-width:1001px) { .sheetgrid { grid-template-columns:minmax(0,1.5fr) minmax(0,1fr); gap:14px; } }
.sheetgrid .rub .pane-hd { display:flex; align-items:center; justify-content:space-between; gap:8px 12px; flex-wrap:wrap; padding:10px 16px; }
.sheetgrid .rub .pane-hd h2 { font-size:16px; white-space:nowrap; }

/* rubric rows: name | five level buttons | readout, identical in every row */
@media (min-width:701px) {
  .sheetgrid .rub .crit { grid-template-columns:minmax(150px,1fr) minmax(0,1.9fr) 104px; gap:4px 14px; padding:5px 10px; align-items:center; }
  .sheetgrid .rub .crit-name .qtext { white-space:nowrap; }
}
.sheetgrid .rub .lvls { gap:6px; max-width:none; margin:0; }
.sheetgrid .rub .lvl { min-height:34px; height:34px; padding:0 2px; font-size:12px; line-height:1; border-radius:var(--btn-r); display:flex; align-items:center; justify-content:center; }
.sheetgrid .rub .lvl span, .sheetgrid .rub .lvl { white-space:nowrap; }
.crit-readout { min-width:0; align-items:flex-end; text-align:right; }
.crit-level-name { white-space:nowrap; font-size:11px; }
.crit-score { white-space:nowrap; }
.rubric-foot { padding:8px 16px 10px; gap:10px 20px; }
.rubric-total { padding:6px 14px; }

/* Section 2: one row per student, nothing clipped, nothing wrapped */
.sheetgrid .scol + .scol .scroll { overflow-x:auto; }
.sheetgrid .scol + .scol table { width:100%; table-layout:auto; border-collapse:collapse; }
.sheetgrid .scol + .scol th { white-space:normal; line-height:1.2; vertical-align:bottom; padding:6px 8px; font-size:11.5px; }
.sheetgrid .scol + .scol td { padding:6px 8px; vertical-align:middle; white-space:nowrap; }
.sheetgrid .scol + .scol td:first-child { white-space:normal; min-width:84px; }
.sheetgrid .scol + .scol .stars .star svg { width:20px; height:20px; }
.sheetgrid .scol + .scol .stars { display:inline-flex; align-items:center; gap:2px; }
.sheetgrid .scol + .scol td .stars + .pen, .sheetgrid .scol + .scol td .pen { margin-left:6px; vertical-align:middle; }
fieldset.yn { display:inline-flex; gap:4px; }
fieldset.yn label, .yn label { min-height:32px; min-width:40px; padding:0 6px; font-size:13px; border-radius:var(--btn-r); justify-content:center; align-items:center; }

@media (min-width:1001px) and (max-width:1599px) {
  .sheetgrid { grid-template-columns:minmax(0,1.4fr) minmax(0,1fr); gap:12px; }
  .sheetgrid .scol + .scol .sec { padding-left:12px; padding-right:12px; }
  .sheetgrid .rub .crit { min-height:42px; }
  .sheetgrid .rub .crit { grid-template-columns:minmax(120px,.8fr) minmax(0,2fr) 92px; gap:4px 10px; }
  .sheetgrid .rub .lvls { gap:4px; }
  .sheetgrid .rub .lvl { font-size:11.5px; }
  .sheetgrid .rub .crit-name .qtext { font-size:14.5px; white-space:normal; line-height:1.2; }
  .sheetgrid .scol + .scol th, .sheetgrid .scol + .scol td { padding-left:5px; padding-right:5px; }
  fieldset.yn { gap:3px; } fieldset.yn label { min-width:34px; padding:0 4px; font-size:12.5px; }
  .sheetgrid .scol + .scol .stars .star svg { width:18px; height:18px; }
  .sheetgrid .scol + .scol td .pen { margin-left:3px; }
}
.sheetgrid .rub .pane-hd .muted.small { flex:1 1 240px; min-width:0; overflow:visible; text-overflow:clip; white-space:normal; }
.sheetgrid .rub .pane-hd { flex-wrap:nowrap; }
@media (max-width:700px) { .sheetgrid .rub .pane-hd { flex-wrap:wrap; } }

/* Section 3: comment boxes in matching columns */
.pgrid { grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:8px 14px; }
.plabel label { font-size:13.5px; }

/* bottom bar: status text on the left, Submit on the right, same height as every other button row */
footer.sticky { align-items:center; }
footer.sticky #submit { min-height:40px; height:40px; padding:0 20px; white-space:nowrap; }
@media (max-width:700px) {
  .sheetgrid .rub .lvl { height:44px; min-height:44px; }
  fieldset.yn label { min-height:44px; min-width:52px; }
  /* Section 2 on a phone: one block per student (name, stars, then each Yes/No pair under its label), so nothing scrolls sideways */
  .sheetgrid .scol + .scol .scroll { overflow-x:visible; }
  .sheetgrid .scol + .scol table, .sheetgrid .scol + .scol tbody { display:block; width:auto; }
  .sheetgrid .scol + .scol thead { position:absolute; left:-9999px; }
  .sheetgrid .scol + .scol tr { display:grid; grid-template-columns:1fr 1fr; gap:6px 12px; padding:10px 0; border-bottom:1px solid var(--edge); }
  .sheetgrid .scol + .scol td { display:block; padding:0; border:0; white-space:normal; }
  .sheetgrid .scol + .scol td:first-child, .sheetgrid .scol + .scol td.rate-cell { grid-column:1 / -1; }
  .sheetgrid .scol + .scol td.rate-cell { display:flex; align-items:center; gap:4px; white-space:nowrap; }
  .sheetgrid .scol + .scol td[data-label]::before { content:attr(data-label); display:block; margin-bottom:4px; font-size:11.5px; font-? eight:700; letter-spacing:.05em; text-transform:uppercase; color:var(--ink-soft); }
  .sheetgrid .scol + .scol .stars .star { width:40px; height:40px; min-height:40px; padding:6px; }
  .sheetgrid .scol + .scol .stars .star svg { width:28px; height:28px; }
}

/* ---------- audit fixes ---------- */
/* tables: a short cell (status, login, date, name) is never squeezed into a column of single letters; the table scrolls inside its box instead */
.scroll th, .scroll td { overflow-wrap:break-word; word-break:normal; }
.scroll td code, .scroll td .chip, .scroll td .pill, .scroll td .tstat { white-space:nowrap; }
.scroll td:not(.look):not(.details):not([class*="detail"]) { min-width:3.5em; }
.scroll td b { white-space:nowrap; }
/* touch screens and tablets: every control is 44px */
@media (pointer:coarse), (max-width:1024px) {
  button, .btn, select, input[type=text], input[type=password], input[type=number], input[type=email], input[type=search], input:not([type]) { min-height:44px; }
  button.sm, .btn.sm { min-height:44px; }
  .star, .fbtn, .pen { min-width:44px; min-height:44px; }
  .lvl { min-height:44px; }
}
/* the Admin sections fit on one row on a laptop */
@media (min-width:900px) { .tabs button { padding-left:12px; padding-right:12px; font-size:14px; } .tabs { gap:2px; } }
/* the last word on tap size for tablets and touch screens: it wins over the compact laptop rules above */
@media (pointer:coarse), (max-width:1024px) {
  #app .teamgrid .tcard > button, .teams-table .acts-in button, .teams-table .wcell button, .teams-table .wcell input.tw, .q-row .q-abs, .langsw button, header.top button.link { min-height:44px; }
  header.top button.link { display:inline-flex; align-items:center; padding:0 6px; }
  .tabs button { min-height:44px; }
}

/* ---------- audit round 2 ---------- */
/* the buttons in a table's Actions cell wrap onto a second line instead of making one 600px column that pushes the table sideways */
.scroll td.acts { white-space:normal; }
.scroll td.acts > button { margin:3px 6px 3px 0; }
/* tablets and touch screens: the last controls that were still under 44px */
@media (pointer:coarse), (max-width:1024px) {
  .sheetgrid .rub .lvl { min-height:44px; height:44px; }
  .q-move-btn { width:44px; height:44px; min-height:44px; }
  #back, button#back.ghost.sm { min-height:44px; }
}
@media (pointer:coarse) { button.tname { min-height:44px; display:inline-flex; align-items:center; } }
@media (pointer:coarse), (max-width:1024px) {
  .star { width:44px !important; height:44px !important; min-width:44px !important; min-height:44px !important; }
  .stars { gap:0; }
  .q-row .q-move-btn { width:44px; height:44px; min-height:44px; }
  .scroll td.acts { min-width:240px; }
}

/* Accounts filters: search and the three pickers share one row on a laptop, two per row on a tablet, one per row on a phone */
#flt { display:grid; grid-template-columns:minmax(200px,2fr) repeat(3, minmax(130px,1fr)); gap:10px; align-items:center; margin:8px 0 12px; }
#flt input, #flt select { width:100%; margin:0; }
@media (max-width:900px) { #flt { grid-template-columns:repeat(2, minmax(0,1fr)); } #flt #fq { grid-column:1 / -1; } }
@media (max-width:480px) { #flt { grid-template-columns:minmax(0,1fr); } }

/* ---------- Announcements and Final approval (senior judge) ---------- */
/* judge tabs: two per row on a phone so every name is fully readable, no hidden sideways strip */
@media (max-width:640px) {
  .navtabs { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); width:100%; }
  .navtabs .tab { white-space:normal; text-align:center; padding:8px 10px; }
  .navtabs .tab:last-child:nth-child(odd) { grid-column:1 / -1; }
}
/* announcement composer: label, box and Post button stack and fill the card */
#af.inline { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px 10px; align-items:center; }
#af.inline label { grid-column:1 / -1; margin:0; }
#af.inline input { width:100%; margin:0; }
#af.inline button { margin:0; min-height:44px; }
@media (max-width:520px) { #af.inline { grid-template-columns:minmax(0,1fr); } #af.inline button { width:100%; } }
/* announcement list: each message becomes its own block on a phone instead of a squeezed 4-column table */
@media (max-width:640px) {
  #panel .scroll table:has(td.acts), .card .scroll table:has(td.acts) { display:block; }
  .card .scroll table:has(td.acts) thead { display:none; }
  .card .scroll table:has(td.acts) tbody, .card .scroll table:has(td.acts) tr, .card .scroll table:has(td.acts) td { display:block; width:100%; }
  .card .scroll table:has(td.acts) tr { border:1px solid var(--line); border-radius:12px; padding:10px 12px; margin:0 0 10px; background:#fff; }
  .card .scroll table:has(td.acts) td { border:0; padding:3px 0; min-width:0; }
  .card .scroll table:has(td.acts) td.acts { min-width:0; padding-top:8px; }
}
/* final approval: checks, top three and the typed confirmation read cleanly at every width */
.card ul.checks li { align-items:center; }
.card ol.top3 { list-style:none; margin:6px 0 16px; padding:0; display:grid; gap:8px; counter-reset:place; }
.card ol.top3 li { margin:0; padding:10px 14px; border:1px solid var(--line); border-left:6px solid var(--gold); border-radius:12px; background:#fff; font-size:16px; overflow-wrap:break-word; }
.card #typed { width:100%; max-width:360px; letter-spacing:.12em; text-transform:uppercase; }
.card #why { width:100%; }
.card > .ctlbtns { margin:10px 0 16px; }
@media (max-width:520px) { .card > .ctlbtns button { width:100%; } .card #typed { max-width:none; } }

/* Control room: break presets, custom break and the extra-time buttons sit in an even grid with no ragged gaps */
.ctl .ctlbtns { display:grid; grid-template-columns:repeat(auto-fit, minmax(74px, 1fr)); gap:8px; align-items:stretch; margin-top:8px; }
.ctl .ctlbtns button, .ctl .ctlbtns input { margin:0; width:100%; min-width:0; min-height:44px; box-sizing:border-box; }
.ctl .ctlbtns:has(> input) { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
@media (max-width:420px) { .ctl .ctlbtns:has(> input) { grid-template-columns:minmax(0,1fr); } }
.ctl .ctlbtns:empty { display:none; }
.ctl .muted.small { margin:8px 0 0; }
/* judge tabs: a little smaller on narrow screens so the names do not wrap to three lines */
@media (max-width:640px) { .navtabs .tab { font-size:13.5px; line-height:1.2; min-height:44px; } }
.ctl #bidle, .ctl #brun { width:100%; min-width:0; }
.ctl[aria-label="Break"], .ctl[aria-label="Break"] > * { min-width:0; }
.ctl #bidle { display:grid; grid-template-columns:minmax(0,1fr); gap:0; }

/* Control room, wide screens: one even grid. Pitch | Audience | Judges on top, Break | Paper backup under them, Judges spanning both rows.
   Cards in the same row share one height, so there are no empty holes under the shorter columns. */
@media (min-width:1100px) {
  .cpanes { grid-template-columns:minmax(0,1.08fr) minmax(0,1fr) minmax(0,1fr); grid-template-areas:"pitch aud score" "brk paper score"; align-items:stretch; }
  .cpanes .ccol { display:contents; }
  .cpanes section[aria-label="Pitch control"] { grid-area:pitch; }
  .cpanes section[aria-label="Break"] { grid-area:brk; }
  .cpanes section[aria-label="Audience reactions"] { grid-area:aud; }
  .cpanes section[aria-label="Paper backup"] { grid-area:paper; }
  .cpanes section[aria-label="Scoring"] { grid-area:score; }
  .cpanes > .ccol > section, .cpanes section.card { margin:0; height:100%; box-sizing:border-box; }
  .cpanes section[aria-label="Audience reactions"] { display:flex; flex-direction:column; justify-content:flex-start; }
  .cpanes section[aria-label="Audience reactions"] .reactctl { margin-top:10px; flex:1 1 auto; max-height:150px; align-items:stretch; }
  .cpanes section[aria-label="Audience reactions"] .reactctl .rbtn { min-height:64px; font-size:16px; align-items:center; justify-content:center; text-align:center; }
  .cpanes section[aria-label="Paper backup"] { display:flex; flex-direction:column; }
}

/* Control room fills the whole window height: the grid stretches to the bottom, rows share the extra space, and the cards grow with it */
@media (min-width:1100px) {
  body:has(#app #view .cpanes) #view { display:flex; flex-direction:column; }
  body:has(#app #view .cpanes) #view > .cpanes { flex:1 1 auto; min-height:0; grid-template-rows:minmax(auto,1.1fr) minmax(auto,1fr); }
  .cpanes section[aria-label="Scoring"] { display:flex; flex-direction:column; justify-content:space-between; }
  .cpanes section[aria-label="Break"] .ctlbtns:has(> input) { margin-top:14px; }
  .cpanes section[aria-label="Pitch control"] .cwrap { align-items:start; }
  .cpanes section[aria-label="Audience reactions"] .reactctl { flex:1 1 auto; max-height:none; margin-bottom:6px; }
  .cpanes section[aria-label="Audience reactions"] .reactctl .rbtn { min-height:84px; font-size:18px; }
}

/* Section 3 comments: the two boxes are always the same size, cannot be dragged out of line, and stay inside the card */
.pgrid { grid-template-columns:repeat(2, minmax(0,1fr)); gap:6px 14px; align-items:stretch; width:100%; box-sizing:border-box; }
@media (max-width:520px) { .pgrid { grid-template-columns:minmax(0,1fr); } }
.pgrid .pbox { display:flex; flex-direction:column; min-width:0; }
.pgrid .pbox textarea, .sheetgrid .scol + .scol .pbox textarea { width:100%; box-sizing:border-box; resize:none; height:104px; min-height:104px; max-height:104px; margin:0; }
.pgrid .plabel { min-height:32px; }
/* judge sheet: both columns end on the same line, so no empty hole under the shorter one */
.sheetgrid { align-items:stretch; }
.sheetgrid > .scol { display:flex; flex-direction:column; gap:12px; min-width:0; }
.sheetgrid > .scol:first-child > * { flex:1 1 auto; }
.sheetgrid > .scol + .scol > section:last-child { flex:1 1 auto; }

/* Hover never hides a button: transparent or light buttons keep their own colours (the general navy hover is only for solid navy buttons) */
button.ghost:hover:not(:disabled), .btn.ghost:hover { color:var(--navy); }
.star:hover:not(:disabled), .star:focus-visible { background:transparent; box-shadow:none; filter:none; color:var(--gold); }
header.top button.link:hover:not(:disabled), header.top button.link:focus-visible { background:transparent; box-shadow:none; filter:none; color:#fff; text-decoration:underline; }
.langsw button:hover:not(:disabled) { background:var(--gold-soft); color:var(--navy); box-shadow:none; filter:none; }
.langsw button.on:hover:not(:disabled), .langsw button[aria-pressed="true"]:hover:not(:disabled) { background:var(--navy); color:#fff; }
.pen:hover:not(:disabled), .fbtn:hover:not(:disabled), .notebtn:hover:not(:disabled), .q-move-btn:hover:not(:disabled), .q-abs:hover:not(:disabled) { background:var(--gold-soft); color:var(--navy); border-color:var(--gold); box-shadow:none; filter:none; }
.tabs .tab:hover:not(:disabled), .tabs button:hover:not(:disabled) { color:var(--ink); }
button.chip:hover:not(:disabled), .chip button:hover:not(:disabled) { background:var(--gold-soft); color:var(--navy); box-shadow:none; filter:none; }

/* Control room, clear and roomy: bigger type, a header line on every pane, larger buttons, soft panels that use the whole window */
@media (min-width:1100px) {
  .cpanes { gap:16px; }
  .cpanes section.card { padding:18px 22px !important; border:1px solid #E1E6F2; border-radius:18px; background:#fff; box-shadow:0 1px 2px rgba(17,23,41,.04), 0 8px 24px rgba(17,23,41,.05); }
  .cpanes section.card > h2, .cpanes .pane-hd { font-size:19px; margin:0 0 14px; padding-bottom:12px; border-bottom:1px solid #E8ECF5; }
  .cpanes .pane-hd { display:flex; align-items:baseline; justify-content:space-between; gap:12px; }
  .cpanes .pane-hd h2 { margin:0; font-size:19px; }
  .cpanes .pane-hd span, .cpanes .pane-hd .muted { font-size:14px; color:var(--ink-soft); }
  .cpanes .ctl p, .cpanes .ctl .muted { font-size:14.5px; line-height:1.45; }
  .cpanes .ctl .muted.small { font-size:13.5px; }
  .cpanes .ctl label, .cpanes .ctl h3 { font-size:14.5px; margin:14px 0 6px; }
  .cpanes .ctl h3 { font-size:15px; }
  .cpanes .ctl .ctlbtns button, .cpanes .ctl .ctlbtns input { min-height:48px; font-size:15px; border-radius:12px; }
  .cpanes select, .cpanes input { min-height:48px; font-size:15px; }
  .cpanes #start { font-size:16px; }
  .cpanes .cwrap { grid-template-columns:190px minmax(0,1fr); gap:20px; }
  .cpanes .cring { width:190px; }
  .cpanes .big-ring, .cpanes .big-ring svg { width:150px; height:150px; }
  .cpanes .big-time b { font-size:30px; }
  .cpanes .recs b { font-size:20px; }
  .cpanes .recs span { font-size:12px; }
  .cpanes .jlist .jrow, .cpanes .jlist li { padding:8px 4px; font-size:15px; }
  .cpanes .jlist .chip, .cpanes .jlist .pill { font-size:12px; }
}
@media (min-width:1100px) { .cpanes #presets { grid-template-columns:repeat(3, minmax(0,1fr)); } }

/* ---------- Judge top area: a clean timer card and big full-width section buttons ---------- */
.strip { border-radius:18px; padding:14px 22px; border-width:3px; box-shadow:0 1px 2px rgba(17,23,41,.06), 0 10px 28px rgba(17,23,41,.10); }
.strip .s-main { font-size:17px; }
.strip .s-time { padding:2px 16px; border-radius:12px; background:rgba(255,255,255,.14); line-height:1.25; }
.strip.t-wrap .s-time, .strip.t-final .s-time, .strip.t-up .s-time, .strip.t-last10 .s-time { background:rgba(17,23,41,.08); }
.strip .s-label { padding:4px 12px; border-radius:99px; background:rgba(255,255,255,.14); font-size:13px; }
.strip.t-wrap .s-label, .strip.t-final .s-label, .strip.t-up .s-label, .strip.t-last10 .s-label { background:rgba(17,23,41,.08); }
@media (min-width:641px) {
  .navtabs { display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0,1fr); gap:10px; width:100%; padding:0; background:none; border-radius:0; margin:0 0 16px; }
  .navtabs .tab { min-height:56px; margin:0; border:1px solid #D9DFEE; border-radius:14px; background:#fff; color:var(--navy); font-size:16px; box-shadow:0 1px 2px rgba(17,23,41,.04); display:flex; align-items:center; justify-content:center; text-align:center; }
  .navtabs .tab:hover:not(:disabled) { background:var(--gold-soft); color:var(--navy); border-color:var(--gold); }
  .navtabs .tab.on, .navtabs .tab.on:hover:not(:disabled) { background:var(--navy); color:#fff; border-color:var(--navy); box-shadow:0 8px 20px rgba(20,33,61,.25); }
}

/* Judge pages use the whole window width (Announcements and Final approval were a half-width column) */
main#app:has(.navtabs) { max-width:min(1760px,98vw); width:100%; }
#app .card h2 { font-size:20px; }
#app .card > .muted { font-size:15px; }
#app #af.inline input { min-height:52px; font-size:16px; }
#app #af.inline button { min-height:52px; padding:0 28px; font-size:16px; }
@media (min-width:1100px) {
  /* Final approval: checks and top three on the left, the approval controls on the right */
  #view > section.card:has(ul.checks) { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:0 36px; align-items:start; }
  #view > section.card:has(ul.checks) > h2, #view > section.card:has(ul.checks) > .muted:first-of-type { grid-column:1 / -1; }
  #view > section.card:has(ul.checks) > ul.checks, #view > section.card:has(ul.checks) > p:not(.muted):not(.alert), #view > section.card:has(ul.checks) > h3:first-of-type, #view > section.card:has(ul.checks) > ol.top3 { grid-column:1; }
  #view > section.card:has(ul.checks) > label, #view > section.card:has(ul.checks) > input, #view > section.card:has(ul.checks) > textarea, #view > section.card:has(ul.checks) > .ctlbtns, #view > section.card:has(ul.checks) > h3:nth-of-type(2), #view > section.card:has(ul.checks) > .alert { grid-column:2; }
}

/* Timer strip arranged like the team header: team | ROUND | timer + status | EVENT, label over value */
.strip .s-round, .strip .s-event { display:none; }
@media (min-width:900px) {
  .strip { display:grid; grid-template-columns:minmax(0,1.5fr) auto auto minmax(0,1fr); grid-template-areas:"main round time event" "main round label event"; column-gap:34px; row-gap:2px; align-items:center; padding:14px 26px; }
  .strip .s-main { grid-area:main; font-size:19px; overflow-wrap:anywhere; }
  .strip .s-round, .strip .s-event { display:flex; flex-direction:column; gap:3px; min-width:0; }
  .strip .s-round { grid-area:round; text-align:center; }
  .strip .s-event { grid-area:event; text-align:right; }
  .strip .s-round i, .strip .s-event i { font-style:normal; font-size:12px; letter-spacing:.12em; text-transform:uppercase; opacity:.7; }
  .strip .s-round b, .strip .s-event b { font-size:17px; overflow-wrap:anywhere; }
  .strip .s-time { grid-area:time; justify-self:center; font-size:34px; padding:2px 22px; }
  .strip .s-label { grid-area:label; justify-self:center; }
  .strip .s-net { grid-area:label; justify-self:end; }
}

/* Switching judge tabs never shifts or resizes the page: the scrollbar space is always reserved, and every tab uses the same width */
html { scrollbar-gutter:stable; }
main#app:has(.navtabs) { max-width:min(1760px,98vw); width:100%; margin-left:auto; margin-right:auto; box-sizing:border-box; }
.navtabs { box-sizing:border-box; width:100%; }
/* the Control room's compact-window rules must not shrink the tab buttons: they stay the same size on every tab */
@media (min-width:641px) {
  body:has(.cpanes) .navtabs, body:has(.cpanes) .navtabs .tab { margin-bottom:16px; }
  body:has(.cpanes) .navtabs .tab, body:has(#app #view .cpanes) .navtabs button { min-height:56px; padding:8px 16px; font-size:16px; }
  body:has(.cpanes) .navtabs { padding:0; margin-bottom:16px; }
}
/* judge: the timer card and tabs stay in the same place on every tab (the Control room no longer hides the timer card) */
@media (min-width:1100px) { main:has(.cpanes):has(.navtabs) #stripbox { display:block; } }
@media (min-width:1100px) { main#app:has(.navtabs), main:has(.cpanes):has(.navtabs) { padding-top:20px; padding-bottom:20px; } }
@media (min-width:1100px) { #app .strip, #app:has(#view.sheetmode) .strip, main:has(.cpanes) .strip { margin-bottom:14px; padding:14px 26px; } }
@media (min-width:1100px) {
  body:has(#app #view .cpanes) main#app, body:has(#app #view .cpanes) main#app:has(.navtabs) { padding-top:20px; padding-bottom:20px; }
  .navtabs { grid-auto-rows:56px; height:auto; }
}
@media (min-width:1100px) { main#app:has(.navtabs) { padding-top:20px !important; padding-bottom:20px !important; } }

/* Judge "My scoresheet" list: the page scrolls normally. No small scroll box inside the page, so no card is ever cut at the top or bottom. */
body:has(#app .teamgrid) { height:auto; min-height:100dvh; overflow:visible; display:block; }
body:has(#app .teamgrid) footer.brandfoot { display:block; }
body:has(#app .teamgrid) main#app { display:block; flex:none; min-height:0; padding-top:20px; padding-bottom:20px; }
main#app:has(.teamgrid) #view { display:block; flex:none; }
main#app:has(.teamgrid) #view .teamgrid { overflow:visible; flex:none; min-height:0; align-content:start; padding-bottom:12px; }
.teamgrid .tcard { height:auto; align-items:center; }
.teamgrid .tcard .tbody p:last-child { margin-top:6px; }

/* The judge sheet never shows the share chips or the highlighted row, even from an old cached script */
.wchip, .crit .wchip { display:none !important; }
.crit.top { box-shadow:none !important; background:none !important; }
.annbar { display:none !important; }

/* ---------- Control room buttons: disabled ones stay readable (never look missing), same size, same alignment ---------- */
.ctl .ctlbtns button { box-sizing:border-box; min-width:0; white-space:nowrap; text-align:center; }
.ctl .ctlbtns button:disabled, .ctl .ctlbtns button.ghost:disabled { opacity:1; background:#F1F4FA; color:#7C86A3; border:2px dashed #C6CEE2; box-shadow:none; cursor:not-allowed; filter:none; }
.ctl .ctlbtns button#start:not(:disabled) { background:var(--navy); color:#fff; border:2px solid var(--navy); }
.cpanes .cctl .ctlbtns { grid-template-columns:repeat(3, minmax(0,1fr)); }
@media (max-width:420px) { .cpanes .cctl .ctlbtns { grid-template-columns:repeat(2, minmax(0,1fr)); } }

/* ---------- Judge sheet: level names always fit, rows fill the card, nothing hides under the Submit bar ---------- */
.sheetgrid .rub .lvls { gap:4px; }
.sheetgrid .rub .lvl { font-size:clamp(10px, .74vw, 12.5px); letter-spacing:0; padding:0 1px; white-space:nowrap; overflow:visible; text-overflow:clip; }
.sheetgrid .rub .lvl span { white-space:nowrap; }
.sheetgrid > .scol:first-child .rubric-list { flex:1 1 auto; justify-content:space-between; }
#view.sheetmode { padding-bottom:84px; }
#view.sheetmode footer.sticky { z-index:30; }
/* Pitch & Q&A buttons: two per row so every name (Start Q&A, Lock team ...) fits whole, all the same size */
.cpanes .cctl .ctlbtns, .cpanes .cctl .ctlbtns:has(button) { grid-template-columns:repeat(2, minmax(0,1fr)) !important; gap:8px; }
.cpanes .cctl .ctlbtns button { min-height:46px; font-size:15px; padding:6px 8px; overflow:visible; text-overflow:clip; }
@media (min-width:1100px) { .cpanes .cwrap { grid-template-columns:150px minmax(0,1fr); gap:16px; } .cpanes .cring { width:150px; } .cpanes .big-ring, .cpanes .big-ring svg { width:132px; height:132px; } .cpanes .big-time b { font-size:26px; } }
@media (min-width:1100px) { .cpanes .recs span { font-size:10px; letter-spacing:0; white-space:nowrap; overflow-wrap:normal; } .cpanes .recs > div { padding:6px 2px; } }

/* Admin tabs: all eleven stay on one row on a laptop or small desktop (900px to 1180px) instead of wrapping "Audit history" alone onto a second line */
@media (min-width:900px) and (max-width:1180px) {
  .tabs:not(.navtabs) { flex-wrap:nowrap; display:flex; width:100%; box-sizing:border-box; overflow-x:auto; scrollbar-width:none; }
  .tabs:not(.navtabs)::-webkit-scrollbar { display:none; }
  .tabs:not(.navtabs) button { flex:1 1 auto; padding:8px 8px; font-size:13px; white-space:nowrap; }
}

/* ---------- Control room: one break box, announcements inside Audience, Add 2 min under the extra-time controls ---------- */
.ctl .brkrow { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:8px; margin-top:6px; }
.ctl .brkrow input { min-height:48px; }
.ctl .brkrow button { min-height:48px; }
.ctl .brkrow button:not(:disabled) { background:var(--navy); color:#fff; border:2px solid var(--navy); }
.annmount { margin-top:14px; padding-top:12px; border-top:1px solid #E8ECF5; }
.annmount:empty { display:none; }
.annmount > .card { box-shadow:none; border:0; background:transparent; padding:0; margin:0; border-radius:0; }
.annmount > .card::before { display:none; }
.annmount h2 { font-size:17px; margin:0 0 6px; padding:0; border:0; }
.annmount .muted { font-size:13.5px; }
.annmount form.inline { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; align-items:center; }
.annmount form.inline label { grid-column:1 / -1; margin:0; }
.annmount form.inline input { min-height:46px; margin:0; }
.annmount form.inline button { min-height:46px; margin:0; }
.annmount .scroll { max-height:220px; overflow:auto; }
.annmount table th:nth-child(2), .annmount table td:nth-child(2) { display:none; }
.xplus { margin-top:10px; }
.xplus .x2 { width:100%; min-height:48px; font-size:16px; }
.xplus .x2:not(:disabled) { background:var(--navy); color:#fff; border:2px solid var(--navy); }
.xplus .muted { margin:6px 0 0; text-align:center; font-weight:600; }
.cpanes .annmount > section.card { box-shadow:none !important; border:0 !important; background:transparent !important; padding:0 !important; margin:0 !important; border-radius:0 !important; height:auto; }
.cpanes .annmount > section.card::before { display:none !important; }
.cpanes .annmount > section.card > h2 { font-size:17px; margin:0 0 6px; padding:0; border:0; }

/* Reopen a locked team: its own card just under Break, always in view */
.bcell { display:flex; flex-direction:column; gap:12px; min-width:0; }
.bcell > section.card { height:auto !important; flex:1 1 auto; }
@media (min-width:1100px) {
  .cpanes .bcell { grid-area:brk; }
  .cpanes .bcell > section[aria-label="Break"], .cpanes .bcell > section[aria-label="Reopen team"] { grid-area:auto; }
}
.ctl .reopenrow { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:8px; margin-top:8px; }
.ctl .reopenrow select { min-height:48px; margin:0; width:100%; }
.ctl .reopenrow button { min-height:48px; margin:0; }
.ctl .reopenrow button:not(:disabled) { background:var(--navy); color:#fff; border:2px solid var(--navy); }
@media (max-width:420px) { .ctl .reopenrow { grid-template-columns:minmax(0,1fr); } }

/* ---------- Scoring sheet: breathing room, tidy alignment, and the bottom space put to use ---------- */
.sheetgrid { gap:16px; }
.sheetgrid > .scol { gap:16px; }
/* team details strip: label over value, columns that wrap instead of overlapping */
#view.sheetmode .shead, .shead { display:grid !important; grid-template-columns:repeat(auto-fit, minmax(150px, 1fr)); gap:8px 24px; padding:12px 20px; margin-bottom:14px; align-items:start; }
.shead > div { display:block !important; min-width:0; }
.shead .lbl, #view.sheetmode .shead .lbl { display:block !important; margin-bottom:2px; }
.shead b { overflow-wrap:anywhere; }
@media (min-width:900px) { .shead .sh-team { grid-column:span 2; } }
/* Section 1 */
.sheetgrid .rub .pane-hd { padding:14px 20px 12px; gap:8px 14px; }
.sheetgrid .rub .rubric-list { padding:0 14px; }
.sheetgrid .rub .crit { padding:clamp(7px, 1.4vh, 13px) 8px; gap:6px 14px; }
.sheetgrid .rub .rubric-foot { padding:12px 20px 14px; }
/* Sections 2 and 3 */
.sheetgrid > .scol + .scol .sec { padding:16px 20px 18px; }
.sheetgrid > .scol + .scol .sec h2 { margin:0 0 6px; }
.sheetgrid > .scol + .scol .sec > p.muted { margin:0 0 12px; font-size:13px; line-height:1.4; }
.sheetgrid > .scol + .scol tbody td { padding-top:6px; padding-bottom:6px; }
/* the last card fills what is left of the column; the two comment boxes grow with it */
.sheetgrid > .scol + .scol > section:last-child { display:flex; flex-direction:column; }
.sheetgrid > .scol + .scol > section:last-child .pgrid { flex:1 1 auto; }
.pgrid { gap:8px 16px; }
.pgrid .pbox textarea, .sheetgrid .scol + .scol .pbox textarea { height:auto; max-height:none; min-height:104px; flex:1 1 auto; padding:10px 12px; }
.pgrid .pbox small, .pgrid .pbox .small { margin-top:6px; }
/* the Submit bar keeps its distance from the cards above it */
footer.sticky { margin-top:14px; }
@media (max-width:700px) { .sheetgrid, .sheetgrid > .scol { gap:12px; } .shead { padding:10px 14px; } .sheetgrid > .scol + .scol .sec { padding:14px 16px 16px; } }
/* rows keep their room even in the compact window rules; below 1320px the three sections stack (Section 1 full width, 2 and 3 side by side) so level names never squeeze */
#view.sheetmode .sheetgrid .rub .crit { padding:clamp(7px, 1.4vh, 13px) 8px; min-height:52px; }
@media (max-width:1319px) {
  .sheetgrid { grid-template-columns:minmax(0,1fr); }
  .sheetgrid > .scol + .scol { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:16px; align-items:stretch; }
  .sheetgrid > .scol + .scol > section:last-child { flex:none; }
}
@media (max-width:760px) { .sheetgrid > .scol + .scol { grid-template-columns:minmax(0,1fr); } #view.sheetmode .sheetgrid .rub .crit { min-height:0; } }
@media (max-width:700px) {
  .shead { grid-template-columns:minmax(0,1fr) minmax(0,1fr) !important; gap:6px 14px; }
  .shead .sh-team { grid-column:1 / -1; }
  .shead .sh-round, .shead .sh-event { display:none !important; }
  .shead .sh-judge { grid-column:1 / -1; }
}

/* Team queue: one vertical column, Team 1 on top, each team on its own full-width row; the page scrolls (no small box inside the page) */
.queue .qlist, body:has(.qlist) .queue .qlist { display:grid; grid-template-columns:minmax(0,1fr) !important; grid-auto-rows:auto; gap:8px; max-height:none !important; overflow:visible !important; padding-right:0; align-content:start; }
.queue .q-row { min-height:72px; padding:12px 18px; grid-template-columns:44px minmax(0,1fr) auto auto auto; gap:12px 16px; align-items:center; }
.queue .q-row .q-name { display:flex; flex-direction:column; gap:2px; min-width:0; }
.queue .q-row .q-name small { text-transform:uppercase; letter-spacing:.02em; }
.queue .q-row .q-chip { min-width:104px; text-align:center; }
@media (max-width:700px) { .queue .q-row { grid-template-columns:34px minmax(0,1fr) auto; padding:10px 12px; } }

/* =====================================================================================================================
   CONTROL ROOM: one smooth scroll (the page itself), three even columns of compact cards, no inner scroll boxes, no zoom steps, no holes.
   Left: Pitch & Q&A, Break, Reopen team.  Middle: Audience with Announcements, Paper backup.  Right: Judges and the Add 2 min button.
   ===================================================================================================================== */
body:has(#app #view .cpanes) { height:auto !important; min-height:100dvh; overflow:visible !important; display:block !important; }
body:has(#app #view .cpanes) footer.brandfoot { display:block !important; }
body:has(#app #view .cpanes) main#app { display:block !important; flex:none !important; padding-top:20px !important; padding-bottom:28px !important; }
body:has(#app #view .cpanes) #view, main#app:has(.cpanes) #view { display:block !important; flex:none !important; overflow:visible !important; height:auto !important; }
.cpanes { display:grid !important; grid-template-columns:minmax(0,1.05fr) minmax(0,1fr) minmax(0,1fr); grid-template-areas:none !important; grid-template-rows:none !important; gap:16px; align-items:start; zoom:1 !important; height:auto !important; }
.cpanes .ccol { display:flex !important; flex-direction:column; gap:16px; min-width:0; }
.cpanes .bcell { display:flex; flex-direction:column; gap:16px; grid-area:auto !important; }
.cpanes section.card, .cpanes .bcell > section.card { height:auto !important; grid-area:auto !important; margin:0 !important; padding:16px 18px !important; box-sizing:border-box; min-width:0; }
.cpanes section.card > h2, .cpanes .pane-hd { margin:0 0 10px !important; padding-bottom:10px; }
.cpanes .ctl h3 { margin:14px 0 6px; }
.cpanes section[aria-label="Audience reactions"], .cpanes section[aria-label="Paper backup"], .cpanes section[aria-label="Scoring"] { display:block !important; }
.cpanes section[aria-label="Audience reactions"] .reactctl { flex:none !important; max-height:none !important; margin:10px 0 0 !important; }
.cpanes section[aria-label="Audience reactions"] .reactctl .rbtn { min-height:64px !important; font-size:16px !important; }
.cpanes .annmount .scroll { max-height:none; overflow:visible; }
.cpanes #judges { max-height:none !important; overflow:visible !important; }
.cpanes .xplus { margin-top:12px; }
.cpanes .jlist .jrow { padding:8px 4px; }
/* the Q&A time is up: the ring is red and blinks while the Q&A keeps running */
.big-ring.state-over .arc { stroke:#C8202B; }
.big-ring.state-over .big-time b, .big-ring.state-over .big-time span { color:#C8202B; font-weight:800; }
@media (prefers-reduced-motion: reduce) { .big-ring.state-over { animation:none; } }
/* tablet: two columns, the third (Judges) spans underneath; phone: one column */
@media (max-width:1099px) { .cpanes { grid-template-columns:minmax(0,1fr) minmax(0,1fr); } .cpanes .ccol:nth-child(3) { grid-column:1 / -1; } }
@media (max-width:760px) { .cpanes { grid-template-columns:minmax(0,1fr); } .cpanes section.card { padding:14px 16px !important; } }

/* Print and download team reports (Admin, Teams tab) */
.rlist { max-height:min(46vh, 420px); overflow:auto; border:1px solid var(--line); border-radius:12px; padding:6px; margin:10px 0; }
.rlist .rrow { display:flex; align-items:center; gap:12px; padding:9px 10px; border-radius:9px; cursor:pointer; }
.rlist .rrow:hover { background:var(--gold-soft); }
.rlist .rrow input { width:20px; height:20px; margin:0; flex:none; }
.rlist .rrow .rno { width:28px; text-align:center; font-family:var(--font-mono); color:var(--ink-soft); flex:none; }
.rlist .rrow .rname { display:flex; flex-direction:column; min-width:0; flex:1; }
.rlist .rrow .rname small { color:var(--ink-soft); text-transform:uppercase; letter-spacing:.02em; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rbtns { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; }
.rbtns button { min-height:44px; margin:0; }
#rsmsg.bad { color:#B3261E; font-weight:600; }

/* Scoring sheet fits one screen on laptops and desktops: no page scroll, the rows share the card height, no empty space under the total.
   Only spacing changes. Phones and short windows keep the normal scrolling layout. */
@media (min-width:1001px) {
  #view.sheetmode { padding-bottom:64px; }
  #view.sheetmode .shead { padding:6px 16px; margin-bottom:6px; }
  #view.sheetmode .shead > div { gap:1px; }
  #view.sheetmode .banner, #view.sheetmode .alert { margin-top:0; margin-bottom:6px; padding-top:7px; padding-bottom:7px; }
  #view.sheetmode .sheetgrid { gap:10px; }
  #view.sheetmode .sheetgrid .rub { display:flex; flex-direction:column; }
  #view.sheetmode .sheetgrid .rub .pane-hd { padding:6px 16px; }
  #view.sheetmode .sheetgrid .rub .rubric-list { flex:1 1 auto; display:flex; flex-direction:column; }
  #view.sheetmode .sheetgrid .rub .crit { flex:1 1 0; min-height:40px; padding-top:3px; padding-bottom:3px; }
  #view.sheetmode .sheetgrid .rub .lvl { height:34px; min-height:34px; }
  #view.sheetmode .sheetgrid .rub .rubric-foot { padding-top:6px; padding-bottom:6px; }
  #view.sheetmode .sheetgrid .scol + .scol { display:flex; flex-direction:column; gap:10px; }
  #view.sheetmode .sheetgrid .scol + .scol .sec { margin:0; padding-top:8px; padding-bottom:8px; }
  #view.sheetmode .sheetgrid .scol + .scol .sec + .sec { flex:1 1 auto; display:flex; flex-direction:column; }
  #view.sheetmode .sheetgrid .scol + .scol th, #view.sheetmode .sheetgrid .scol + .scol td { padding-top:2px; padding-bottom:2px; }
  #view.sheetmode .sheetgrid .scol + .scol .stars .star svg { width:18px; height:18px; }
  #view.sheetmode .sheetgrid .scol + .scol .pbox textarea { height:auto; min-height:56px; max-height:none; padding:6px 10px; }
  #view.sheetmode .sheetgrid .scol + .scol .pgrid { flex:1 1 auto; }
}
@media (min-width:1001px) {
  #view.sheetmode .banner, #view.sheetmode .alert { padding-top:4px; padding-bottom:4px; }
  #view.sheetmode .sheetgrid .scol + .scol td .pen, #view.sheetmode .sheetgrid .scol + .scol td button { min-height:28px; height:28px; min-width:28px; width:28px; padding:0; }
  #view.sheetmode .sheetgrid .scol + .scol .stars .star { min-height:0; padding:0; }
  #view.sheetmode .sheetgrid .scol + .scol .stars .star svg { width:17px; height:17px; }
  #view.sheetmode .sheetgrid .scol + .scol .pbox textarea { min-height:44px; }
  #view.sheetmode .sheetgrid .scol + .scol .pbox small, #view.sheetmode .sheetgrid .scol + .scol .pbox .small { margin-top:2px; }
}
@media (min-width:1001px) {
  #view.sheetmode { padding-bottom:50px; }
  #app:has(#view.sheetmode) { padding-bottom:0; }
  #view.sheetmode .sheetgrid .scol + .scol td { padding-top:0; padding-bottom:0; }
}

/* Team attendance card in the control room */
.attlist { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; }
.attrow { display:grid; grid-template-columns:28px minmax(0,1fr) auto 118px; align-items:center; gap:8px; padding:6px 0; border-bottom:1px solid var(--line, #E3E8F2); min-height:44px; }
.attrow:last-child { border-bottom:0; }
.attno { font-family:var(--font-mono, monospace); color:var(--ink-soft); font-size:13px; }
.attname { font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.attrow.is-absent .attname { opacity:.6; text-decoration:line-through; }
.attchip { font-size:11.5px; font-weight:700; border-radius:999px; padding:2px 9px; background:#EEF1F8; color:var(--ink-soft); white-space:nowrap; }
.attchip.s-Upcoming { background:#E6F5EC; color:#17663A; }
.attchip.s-Absent { background:#FDE8E7; color:#B3261E; }
.attrow button { min-height:34px; padding:4px 8px; font-size:13px; width:100%; margin:0; }
.attslot { display:block; }
@media (max-width:520px) { .attrow { grid-template-columns:24px minmax(0,1fr) 108px; } .attrow .attchip { display:none; } }

/* Scoring sheet: keep the two columns side by side down to small laptop windows (the page is scaled to fit, so there is always room) */
@media (min-width:1001px) {
  #view.sheetmode .sheetgrid { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(0,1fr); gap:10px; }
  #view.sheetmode .sheetgrid > .scol { width:auto; }
}

/* Team attendance is a drop-down: closed it shows only the title and the present / absent count */
.attdrop > summary { list-style:none; cursor:pointer; display:flex; align-items:center; justify-content:space-between; gap:10px; margin:0; }
.attdrop > summary::-webkit-details-marker { display:none; }
.attdrop > summary h2 { margin:0; }
.attdrop .attcaret { width:10px; height:10px; border-right:3px solid var(--navy); border-bottom:3px solid var(--navy); transform:rotate(45deg); margin:0 4px 4px 2px; transition:transform .15s; flex:none; }
.attdrop[open] .attcaret { transform:rotate(-135deg); margin-bottom:-2px; }
.attdrop > summary:focus-visible { outline:3px solid var(--gold); outline-offset:4px; border-radius:8px; }
.attdrop[open] > summary { margin-bottom:8px; }

/* Judge scoring sheet: uses the full width of the screen, clear boxes with even spacing, and a clear team heading */
@media (min-width:1001px) {
  main#app:has(#view.sheetmode) { max-width:none; width:100%; box-sizing:border-box; padding-left:20px; padding-right:20px; }
  #view.sheetmode .sheetgrid { gap:14px; }
  #view.sheetmode .shead { padding:10px 18px; margin-bottom:10px; }
  #view.sheetmode .shead .sh-team button.tname, #view.sheetmode .shead .sh-team b { font-size:19px; }
  #view.sheetmode .shead .sh-proj { font-size:13px; letter-spacing:.04em; }
  #view.sheetmode .sheetgrid .rub .lvls { gap:8px; }
  #view.sheetmode .sheetgrid .scol + .scol { gap:14px; }
}

/* Judge Team queue: the page itself never scrolls; the list of teams scrolls inside its own box */
@media (min-width:1001px) {
  main#app:has(.navtabs) .queue .qlist { max-height:max(200px, calc(100dvh - 470px)) !important; overflow-y:auto !important; align-content:start; padding-right:4px; }
}

/* Opening the scoring guidance (the ? next to a criterion) pushes the rows below it down instead of floating over them */
#view.sheetmode .sheetgrid .rub .crit { flex:1 0 auto; }

/* Opening the attendance drop-down must not change the size of the screen: the list floats over the page (it scrolls inside its own box) instead of pushing everything down */
.attdrop { position:relative; }
.attdrop[open] .attbody { position:absolute; left:0; right:0; top:calc(100% + 6px); z-index:40; background:#fff; border:1px solid var(--line, #E3E8F2); border-radius:12px; box-shadow:0 16px 38px rgba(17,23,41,.28); padding:12px 14px; max-height:min(56vh, 440px); overflow-y:auto; }
.attdrop[open] > summary { margin-bottom:0; }

/* Small per-judge time button under the judge's name in the scoring progress list */
.jrow .j-mid { flex-wrap:wrap; }
.jrow .jtime { margin:4px 0 0; padding:2px 10px; min-height:0; height:26px; font-size:12px; align-self:flex-start; }

/* Time left and the minutes to give, for each judge in the scoring progress list */
.jrow .jleft { display:block; font-size:12px; font-\77 eight:700; margin-top:3px; font-variant-numeric:tabular-nums; }
.jrow .jleft.over { color:#B3261E; }
.jrow .jleft:empty { display:none; }
.jrow .jgive { display:inline-flex; align-items:center; gap:6px; margin-top:4px; }
.jrow .jgive .jmin { width:54px; height:26px; min-height:0; padding:0 6px; font-size:12px; text-align:center; margin:0; }
.jrow .jgive .jtime { margin:0; }

/* Control room: the "Pitch recorded" / "Q&A recorded" labels wrap inside their boxes instead of running out of them */
.cpanes .recs > div { overflow:hidden; }
.cpanes .recs span { white-space:normal; overflow-wrap:break-word; line-height:1.2; font-size:10.5px; letter-spacing:.02em; padding:0 2px; }

/* ===== Phones and small tablets: roomier touch targets, text that wraps instead of clipping, nothing running into its neighbour ===== */
@media (max-width:700px) {
  header.top { position:static; }                                         /* the three-line header scrolls away instead of covering a sixth of the screen */
  .strip .s-main { white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; }
  /* control room, judges list: one clear column per judge (name and status, the bar, time left, then the minutes + button, then Reopen sheet) */
  .jlist .jrow { grid-template-columns:34px minmax(0,1fr) auto; gap:6px 10px; align-items:center; }
  .jlist .jrow .j-mid { display:contents; }
  .jlist .jrow .j-ava { grid-column:1; grid-row:1; }
  .jlist .jrow .jn { grid-column:2; grid-row:1; min-width:0; }
  .jlist .jrow > .chip { grid-column:3; grid-row:1; }
  .jlist .jrow .j-bar { grid-column:1 / -1; grid-row:2; }
  .jlist .jrow .jleft { grid-column:1 / -1; grid-row:3; }
  .jlist .jrow .jgive { grid-column:1 / -1; grid-row:4; margin-top:2px; display:flex; }
  .jlist .jrow > [data-reopen] { grid-column:1 / -1; grid-row:5; justify-self:stretch; margin:0; min-height:40px; }
  .jrow .jgive .jmin { width:64px; height:42px; font-size:16px; }
  .jrow .jgive .jtime { flex:1; height:42px; font-size:14px; white-space:nowrap; padding:0 10px; }
}
@media (pointer:coarse), (max-width:900px) {
  button.tname { min-height:40px; display:inline-flex; align-items:center; }
  input[type=date], input[type=time], input[type=number] { min-height:44px; }
}

/* the status strip that stays at the top while scrolling must be solid, so text scrolling under it never shows through */
.stripbox { background:var(--bg, #F4F6FB); padding-bottom:6px; }
@media (pointer:coarse), (max-width:1000px) {
  .jrow .jgive .jmin { width:64px; height:42px; font-size:16px; }
  .jrow .jgive .jtime { height:42px; font-size:14px; white-space:nowrap; padding:0 12px; }
  .attname { white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; }
  .q-grip { width:40px; height:40px; }
  .langsw { overflow:visible; }
}
