/* Gold Hub announcer view · dark, readable at distance, 16:9 first. No inline styles anywhere. */
:root {
  --bg: #0a0f1a; --panel: #121a2a; --panel-2: #172238; --line: #24314a; --text: #f2f5fa; --muted: #9aa8c0;
  --blue: #2f6fde; --orange: #f08a24; --green: #2fa45a; --sky: #3aa9e0; --cyan: #22b3b3;
  --gold: #e7b53c; --warn: #f2b13a; --bad: #e5484d; --ok: #3fbf72;
}
* { box-sizing: border-box; }
html { font-size: clamp(11px, 0.9vw, 24px); background: var(--bg); color: var(--text); }
body { margin: 0; height: 100vh; overflow: hidden; display: grid; grid-template-rows: auto 1fr auto;
  font-family: "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif; background: var(--bg); }
[hidden] { display: none !important; }

/* top bar */
.topbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.5rem;
  padding: .55rem 1.2rem; background: #0d1422; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: .7rem; }
.brand-gold { font-weight: 800; letter-spacing: .12em; color: var(--gold); font-size: 1.25rem; }
.brand-sub { color: var(--muted); font-size: 1rem; text-transform: uppercase; letter-spacing: .1em; }
.demo-flag { background: var(--orange); color: #111; font-weight: 800; padding: .1rem .5rem; border-radius: .3rem; font-size: .85rem; }
.run { display: flex; align-items: baseline; gap: 1rem; min-width: 0; }
.run-label { font-size: 1.35rem; font-weight: 700; white-space: nowrap; }
.run-facts { color: var(--muted); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { display: flex; align-items: center; gap: 1rem; font-size: .95rem; color: var(--muted); }
.mode-badge { padding: .2rem .6rem; border-radius: 1rem; border: 1px solid var(--line); }
.mode-badge.course { color: #fff; background: #1d3f7a; border-color: var(--blue); }
.mode-badge.manual { border-style: dashed; border-color: var(--warn); }
.conn { display: inline-flex; align-items: center; gap: .4rem; }
.conn .dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--bad); }
.conn.on .dot { background: var(--ok); }
.clock-now { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.icon-button { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: .4rem;
  font-size: 1.1rem; padding: .1rem .5rem; cursor: pointer; }
.icon-button:hover, .icon-button:focus-visible { color: var(--text); border-color: var(--gold); }

/* stage */
.stage { display: grid; gap: .9rem; padding: .9rem 1.2rem; min-height: 0;
  grid-template-columns: 1fr 1fr; transition: grid-template-columns .35s ease; }
body.mode-course .stage { grid-template-columns: 1.85fr 1fr; }
.col { display: flex; flex-direction: column; gap: .9rem; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: .7rem; overflow: hidden;
  display: flex; flex-direction: column; min-height: 0; }
.panel-head { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .45rem 1rem; font-size: 1.05rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 800; color: #fff; }
.panel-blue .panel-head { background: var(--blue); }
.panel-orange .panel-head { background: var(--orange); color: #1b1206; }
.panel-green .panel-head { background: var(--green); }
.panel-sky .panel-head { background: var(--sky); color: #06121b; }
.panel-cyan .panel-head { background: var(--cyan); color: #04171a; }
.source { font-size: .75rem; letter-spacing: .04em; text-transform: none; font-weight: 600; opacity: .85; }
.source.warn { background: var(--warn); color: #1b1206; padding: .05rem .4rem; border-radius: .25rem; opacity: 1; }
.empty { color: var(--muted); padding: .8rem 1rem; font-size: 1.05rem; }

/* on course card */
.oncourse { flex: 1 1 auto; }
.badge { font-size: .9rem; padding: .15rem .6rem; border-radius: .3rem; background: rgba(0,0,0,.25); letter-spacing: .08em; }
.badge-course { background: var(--ok); color: #04210f; }
.badge-stopped, .badge-finished { background: var(--gold); color: #1d1503; }
.badge-dis { background: var(--bad); color: #fff; }
.badge-ready { background: rgba(255,255,255,.18); }
.team { display: grid; grid-template-columns: auto 1fr auto; gap: 1.2rem; align-items: center; padding: .9rem 1.1rem .7rem; }
.bib { font-size: 2.6rem; font-weight: 800; background: var(--panel-2); border: 2px solid var(--blue); border-radius: .6rem;
  padding: .2rem .8rem; min-width: 5.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.names { min-width: 0; }
.dog { font-size: 4.2rem; font-weight: 900; line-height: 1; text-transform: uppercase; letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.handler { font-size: 1.9rem; font-weight: 600; margin-top: .25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-extra { font-size: 1.1rem; color: var(--muted); margin-top: .15rem; }
.live { text-align: right; min-width: 11rem; }
.live-time { font-size: 3rem; font-weight: 800; font-variant-numeric: tabular-nums; color: #fff; }
.live-time.stopped, .live-time.official { color: var(--gold); }
.live-pen { font-size: 1.5rem; font-weight: 700; color: var(--muted); }
.live-pen.has-faults { color: var(--warn); }
.live-pen.dis { color: var(--bad); }
.live-place { font-size: 1.3rem; font-weight: 700; color: var(--gold); }
.waiting { padding: 2rem 1.2rem; font-size: 2rem; color: var(--muted); }

/* survey info inside the card */
.info-wrap { margin: 0 1.1rem .8rem; display: flex; gap: 1.2rem; align-items: flex-start; min-height: 0; flex: 0 1 auto; }
.info-wrap:has(> #info[hidden]) { display: none; }
.info { border-top: 1px solid var(--line); padding-top: .6rem; display: flex; flex-direction: column;
  min-height: 0; min-width: 0; max-height: 100%; overflow: hidden; flex: 0 1 auto; }
.info-head { display: flex; align-items: center; gap: .8rem; font-size: 1rem; color: var(--muted); }
.info-label { color: var(--orange); font-weight: 800; text-transform: uppercase; letter-spacing: .1em; font-size: 1.1rem; }
.match-tag { font-size: .85rem; padding: .05rem .5rem; border-radius: .25rem; }
.match-tag.status-confirmed { color: var(--ok); border: 1px solid rgba(63,191,114,.5); }
.match-tag.status-manual { color: var(--sky); border: 1px solid rgba(58,169,224,.5); }
.match-tag.status-uncertain { background: var(--warn); color: #1b1206; font-weight: 800; }
.info-pos { margin-left: auto; font-variant-numeric: tabular-nums; }
.info-body { overflow: hidden; margin-top: .4rem; flex: 0 1 auto; min-height: 0; line-height: 1.35; }
.info-text { margin: 0; white-space: pre-line; }
.info-body:has(.info-line) { display: grid; grid-template-columns: max-content 1fr; column-gap: 1em; row-gap: .2em; align-content: start; }
.info-line { display: contents; }
.info-line .k { color: var(--muted); font-size: .62em; padding-top: .45em; white-space: nowrap; text-transform: uppercase; letter-spacing: .06em; }
.info-line .v { white-space: pre-line; }
.info-form { font-size: .95rem; color: var(--muted); margin-top: .3rem; font-style: italic; }
.match-hint { margin: 0 1.1rem .7rem; font-size: 1.05rem; color: var(--muted); }
.match-hint.status-ambiguous { color: var(--warn); }
.note { margin: 0 1.1rem .9rem; border: 2px solid var(--warn); background: rgba(242,177,58,.12); border-radius: .5rem; padding: .45rem .8rem; }
.note strong { color: var(--warn); font-size: .9rem; text-transform: uppercase; letter-spacing: .06em; }
.note p { margin: .2rem 0 0; font-size: 1.15rem; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* text size by length and mode: info is the hero while the dog runs */
body.mode-course .info-body.len-s { font-size: 3rem; }
body.mode-course .info-body.len-m { font-size: 2.45rem; }
body.mode-course .info-body.len-l { font-size: 2.05rem; }
body.mode-course .info-body.len-xl { font-size: 1.8rem; }
body.mode-finished .info-body { font-size: 1.6rem; }
body.mode-finished .dog { font-size: 3.2rem; }
body.mode-finished .handler { font-size: 1.5rem; }

/* time to beat */
.ttb-body { padding: .7rem 1.1rem; display: grid; grid-template-columns: auto 1fr; column-gap: 1.2rem; align-items: center; }
.ttb-time { font-size: 2.8rem; font-weight: 900; color: var(--orange); grid-row: span 3; font-variant-numeric: tabular-nums; }
.ttb-who { font-size: 1.2rem; font-weight: 600; }
.ttb-hint { font-size: 1.2rem; color: var(--gold); }
.ttb-todo { font-size: .85rem; color: var(--muted); }
body.mode-course .ttb-time { font-size: 2.2rem; }

/* lists and tables */
.list { list-style: none; margin: 0; padding: .3rem 0; }
.next-row { display: grid; grid-template-columns: 4.5rem 1fr 1.2fr auto; gap: .8rem; align-items: baseline; padding: .5rem 1.1rem;
  border-bottom: 1px solid var(--line); font-size: 1.5rem; }
.next-row:last-child { border-bottom: 0; }
.next-row.first { background: rgba(47,164,90,.12); }
.bib-s { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.dog-s { font-weight: 800; text-transform: uppercase; }
.handler-s { color: #d7deea; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.country-s { color: var(--muted); }
body.mode-course .next-row { font-size: 1.1rem; padding: .3rem 1.1rem; }
body.mode-course .next { flex: 0 0 auto; }

.latest-body { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; padding: .8rem 1.1rem; }
.latest-place { font-size: 3.2rem; font-weight: 900; color: var(--gold); min-width: 4.5rem; text-align: center; }
.latest-place.dis { color: var(--bad); font-size: 2.2rem; }
.latest-dog { font-size: 2rem; font-weight: 800; text-transform: uppercase; }
.latest-handler { font-size: 1.2rem; color: var(--muted); }
.latest-res { text-align: right; }
.latest-time { font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.latest-pen { font-size: 1.15rem; color: var(--muted); }
body.mode-course .latest-place { font-size: 2rem; min-width: 3rem; }
body.mode-course .latest-dog { font-size: 1.3rem; }
body.mode-course .latest-time { font-size: 1.4rem; }
body.mode-course .latest-body { padding: .45rem 1rem; }

.table { width: 100%; border-collapse: collapse; font-size: 1.45rem; }
.table td { padding: .42rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table .c-place { font-weight: 900; color: var(--gold); width: 3.5rem; text-align: right; }
.table .c-bib { color: var(--muted); width: 3.5rem; font-variant-numeric: tabular-nums; }
.table .c-dog { font-weight: 800; text-transform: uppercase; }
.table .c-handler { color: #d7deea; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }
.table .c-pen { color: var(--muted); font-size: .8em; }
.table .c-time { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.table tr.hl td { background: rgba(231,181,60,.16); }
.table td.empty { color: var(--muted); }
body.mode-course .table { font-size: 1.05rem; }
body.mode-course .table td { padding: .28rem .5rem; }
body.mode-course .table .c-handler { display: none; }
.top { flex: 0 0 auto; }
.combined { flex: 0 1 auto; }

/* footer, watermark */
.foot { display: flex; justify-content: space-between; padding: .3rem 1.2rem .45rem; color: var(--muted); font-size: .85rem; }
.wd-watermark { position: fixed; right: 1.4rem; bottom: 2.2rem; width: 8rem; height: auto; opacity: .16; pointer-events: none;
  user-select: none; z-index: 0; filter: brightness(0) invert(1); }

/* dialogs */
.dialog { background: #121a2a; color: var(--text); border: 1px solid var(--line); border-radius: .8rem; width: min(46rem, 92vw); padding: 0; }
.dialog::backdrop { background: rgba(0,0,0,.6); }
.dialog-form { display: flex; flex-direction: column; gap: .7rem; padding: 1.2rem 1.4rem; font-size: 1rem; }
.dialog-form h2 { margin: 0 0 .3rem; }
.dialog-form label { display: flex; flex-direction: column; gap: .25rem; color: var(--muted); }
.dialog-form input, .dialog-form select { font: inherit; padding: .35rem .5rem; background: #0b1220; color: var(--text); border: 1px solid var(--line); border-radius: .35rem; }
.dialog-form fieldset { border: 1px solid var(--line); border-radius: .5rem; display: flex; flex-direction: column; gap: .6rem; }
.dialog-form a { color: var(--sky); }
.row-buttons { display: flex; gap: .6rem; flex-wrap: wrap; }
.row-buttons.end { justify-content: flex-end; }
.row-buttons button, .file-button { font: inherit; background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: .4rem; padding: .35rem .8rem; cursor: pointer; }
.file-button { flex-direction: row !important; }
.file-button input { display: none; }
.survey-status { color: var(--muted); margin: 0; }
.pick-list { min-height: 14rem; }
.pick-team { font-size: 1.2rem; font-weight: 700; margin: 0; }

/* no survey info for this team: card shrinks, the running order gets the room */
body:has(#info[hidden]) .oncourse { flex: 0 0 auto; }
body:has(#info[hidden]) .next { flex: 1 1 auto; }
body.mode-course:has(#info[hidden]) .next-row { font-size: 1.5rem; padding: .5rem 1.1rem; }

/* new leader: gold rain canvas and centre box (both themes) */
.gold-rain { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }
.lead-overlay { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 50; }
.lead-card { min-width: 34vw; max-width: 60vw; text-align: center; padding: 1.4rem 3rem 1.6rem; border-radius: 1.4rem;
  background: linear-gradient(160deg, #1d2a4d, #121a33); color: #fff8e6; border: .35rem solid #e8b923;
  box-shadow: 0 0 0 .3rem rgba(255,244,194,.55), 0 1.5rem 4rem rgba(20,16,4,.45); }
.lead-crown { color: #f7dc78; letter-spacing: .6em; font-size: 1.6rem; }
.lead-title { font-size: 4.2rem; font-weight: 900; line-height: 1.05; color: #f7dc78; text-transform: uppercase; letter-spacing: .03em; }
.lead-dog { font-size: 5.4rem; font-weight: 900; line-height: 1.05; text-transform: uppercase; margin-top: .4rem; }
.lead-handler { font-size: 2rem; font-weight: 600; color: #e9dfc4; }
.lead-time { display: inline-block; margin-top: .8rem; font-size: 3rem; font-weight: 900; font-variant-numeric: tabular-nums;
  color: #1a2340; background: linear-gradient(110deg, #b8860b, #e8b923 35%, #fff4c2 50%, #e8b923 65%, #b8860b);
  padding: .1rem 1.2rem; border-radius: 3rem; }
.lead-pen { font-size: 1.4rem; color: #e9dfc4; margin-top: .4rem; }
.lead-overlay.show .lead-card { animation: lead-in .6s cubic-bezier(.2,1.4,.4,1) both, lead-out .5s ease-in 3.7s both; }
@keyframes lead-in { from { transform: scale(.4) rotate(-4deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes lead-out { to { transform: scale(.9); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .lead-overlay.show .lead-card { animation: none; }
}

/* settings dialog: two columns so everything fits on a 16:9 screen without scrolling */
#settingsDialog { width: min(64rem, 94vw); max-height: 94vh; }
#settingsForm { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1.4rem; row-gap: .6rem; align-items: start; }
#settingsForm > h2, #settingsForm > fieldset, #settingsForm > p, #settingsForm > .row-buttons { grid-column: 1 / -1; }
