/* FRC 6059 pit display.
   Built to be read from across a pit on a 1080p TV. The palette is the field itself:
   carpet grey, alliance red and blue, and caution yellow for anything time-critical. */

@font-face { font-family: "Barlow"; src: url(/fonts/barlow-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url(/fonts/barlow-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow"; src: url(/fonts/barlow-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url(/fonts/barlow-condensed-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url(/fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url(/fonts/barlow-condensed-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url(/fonts/barlow-condensed-latin-800-normal.woff2) format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --carpet: #1b1e23;
  --panel: #23272e;
  --panel-2: #2b3038;
  --line: #3a404a;
  --ink: #eef0f3;
  --muted: #949caa;
  --red: #d7263d;
  --red-deep: #5c1019;
  --red-tint: #3a161c;
  --blue: #1f66dd;
  --blue-deep: #0e275a;
  --blue-tint: #172540;
  --caution: #f5c518;
  --caution-ink: #1b1e23;
  --cond: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html {
  /* 1 rem ≈ 17 px on a 1920×1080 screen, scaling with whichever dimension is tighter. */
  font-size: calc(min(1vw, 1.7778vh) * 0.9);
}
body {
  margin: 0;
  background: var(--carpet);
  color: var(--ink);
  font-family: var(--body);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
h1, h2, h3 { margin: 0; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--caution); outline-offset: 2px; }

/* ---------- display layout ---------- */
.display { height: 100vh; overflow: hidden; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }

.top {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 2.4rem;
  padding: 1rem 1.6rem;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 0.8rem; }
.brand-num { font-family: var(--cond); font-weight: 800; font-size: 3rem; line-height: 1; letter-spacing: 0.01em; }
.brand-name { font-size: 1.35rem; color: var(--muted); font-weight: 500; }
.event { font-family: var(--cond); font-size: 2rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event small { font-family: var(--body); font-size: 1.1rem; color: var(--muted); font-weight: 400; margin-left: 0.8rem; }
.standing { display: flex; gap: 1.6rem; }
.stat { display: flex; flex-direction: column; align-items: flex-end; }
.stat b { font-family: var(--cond); font-size: 2.3rem; font-weight: 700; line-height: 1; }
.stat b small { font-size: 1.3rem; color: var(--muted); font-weight: 600; }
.stat span { font-size: 0.95rem; color: var(--muted); }
.clock-wrap { text-align: right; min-width: 9rem; }
.clock { font-family: var(--cond); font-size: 2.6rem; font-weight: 600; line-height: 1; }
.fresh { font-size: 0.9rem; color: var(--muted); margin-top: 0.2rem; white-space: nowrap; }
.fresh.bad { color: var(--caution); font-weight: 600; }

.grid {
  display: grid;
  grid-template-columns: 37fr 30fr 33fr;
  gap: 1rem;
  padding: 1rem 1.2rem;
  min-height: 0;
}
.col { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 1rem; min-height: 0; }
.panel { background: var(--panel); border-radius: 0.6rem; padding: 1rem 1.2rem; min-height: 0; overflow: hidden; }
.panel h2 { font-family: var(--cond); font-size: 1.6rem; font-weight: 600; color: var(--muted); margin-bottom: 0.6rem; }

/* ---------- next match: the bumper slab ---------- */
.next {
  position: relative;
  border-radius: 0.6rem;
  padding: 1.4rem 1.6rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
  border: 0.3rem solid transparent;
}
.next.red { background: var(--red-deep); }
.next.blue { background: var(--blue-deep); }
.next.urgent { border-color: var(--caution); animation: urgent 1.6s ease-in-out infinite; }
@keyframes urgent { 50% { border-color: rgba(245, 197, 24, 0.25); } }
@media (prefers-reduced-motion: reduce) { .next.urgent { animation: none; } }

.next-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; }
.next-label { font-size: 1.3rem; color: rgba(255,255,255,0.7); }
.match-name { font-family: var(--cond); font-weight: 800; font-size: 7.2rem; line-height: 0.85; letter-spacing: -0.01em; }
.next-when { text-align: right; }
.next-when .at { font-family: var(--cond); font-size: 2rem; font-weight: 600; }
.next-when .sub { font-size: 1.05rem; color: rgba(255,255,255,0.7); }

/* The bumper: a literal stripe of fabric in our alliance colour with white numbers. */
.bumper {
  display: flex; align-items: center; justify-content: space-between;
  border-radius: 1.6rem;
  padding: 0.5rem 2rem;
  box-shadow: inset 0 -0.35rem 0 rgba(0,0,0,0.25), inset 0 0.25rem 0 rgba(255,255,255,0.12);
}
.red .bumper { background: var(--red); }
.blue .bumper { background: var(--blue); }
.bumper-num { font-family: var(--cond); font-weight: 800; font-size: 5.6rem; line-height: 1; color: #fff; }
.bumper-text { text-align: right; color: #fff; }
.bumper-text b { display: block; font-family: var(--cond); font-weight: 700; font-size: 2.6rem; line-height: 1; }
.bumper-text span { font-size: 1.25rem; opacity: 0.9; }

.queue {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1rem;
  background: rgba(0,0,0,0.25); border-radius: 0.5rem; padding: 0.8rem 1.1rem;
}
.queue.go { background: var(--caution); color: var(--caution-ink); }
.queue-status { font-family: var(--cond); font-weight: 700; font-size: 2.6rem; line-height: 1; }
.queue-detail { font-size: 1.1rem; opacity: 0.85; margin-top: 0.25rem; display: flex; flex-wrap: wrap; gap: 0 1.2rem; }
.queue-count { font-family: var(--cond); font-weight: 700; font-size: 4rem; line-height: 1; }

.lineup { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin-top: auto; }
.side { border-radius: 0.5rem; padding: 0.7rem 0.9rem; background: rgba(0,0,0,0.25); }
.side.red { box-shadow: inset 0.35rem 0 0 var(--red); }
.side.blue { box-shadow: inset 0.35rem 0 0 var(--blue); }
.side h3 { font-size: 1.05rem; color: rgba(255,255,255,0.7); font-weight: 500; margin-bottom: 0.3rem; }
.side-sum { float: right; }
.tm { display: grid; grid-template-columns: 4.6rem 1fr auto; column-gap: 0.6rem; align-items: baseline; padding: 0.3rem 0; border-top: 1px solid rgba(255,255,255,0.08); }
.tm:first-of-type { border-top: 0; }
.tm-num { font-family: var(--cond); font-weight: 700; font-size: 2rem; line-height: 1.1; }
.tm.us .tm-num { text-decoration: underline; text-decoration-thickness: 0.15rem; text-underline-offset: 0.25rem; }
.tm-meta { display: flex; gap: 0.8rem; font-size: 1rem; color: rgba(255,255,255,0.72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-pit { font-family: var(--cond); font-size: 1.3rem; font-weight: 600; color: rgba(255,255,255,0.85); }

.odds { display: grid; gap: 0.35rem; }
.odds-bar { display: flex; height: 0.7rem; border-radius: 0.35rem; overflow: hidden; background: var(--red); }
.odds-bar i { display: block; background: var(--blue); }
.odds-text { font-size: 1.05rem; color: rgba(255,255,255,0.8); }

.idle { margin: auto 0; }
.idle h1 { font-family: var(--cond); font-weight: 800; font-size: 4.4rem; line-height: 1; margin-bottom: 0.8rem; }
.idle p { font-size: 1.4rem; color: var(--muted); margin: 0.3rem 0; max-width: 34rem; }
.idle .big { color: var(--ink); font-size: 1.8rem; }

/* ---------- our matches ---------- */
.matches { display: flex; flex-direction: column; }
.match-list { list-style: none; margin: 0; padding: 0; overflow: hidden; flex: 1; min-height: 0; }
.mr {
  display: grid; grid-template-columns: 4.2rem 7.4rem 1fr auto; align-items: center; gap: 0.6rem;
  padding: 0.38rem 0.6rem; border-radius: 0.35rem; font-size: 1.15rem;
  box-shadow: inset 0.3rem 0 0 var(--line);
}
.mr + .mr { margin-top: 0.22rem; }
.mr.red { box-shadow: inset 0.3rem 0 0 var(--red); }
.mr.blue { box-shadow: inset 0.3rem 0 0 var(--blue); }
.mr.is-next { background: var(--panel-2); outline: 2px solid var(--caution); outline-offset: -2px; }
.mr.done { color: var(--muted); }
.mr-id { font-family: var(--cond); font-weight: 700; font-size: 1.5rem; color: var(--ink); padding-left: 0.4rem; }
.mr-when { white-space: nowrap; }
.mr-with { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mr-res { font-family: var(--cond); font-size: 1.4rem; font-weight: 600; white-space: nowrap; color: var(--ink); text-align: right; }
.mr-res .w { font-weight: 800; }
.mr-res .l { color: var(--muted); }
.rp { font-family: var(--body); font-size: 0.9rem; font-weight: 600; color: var(--muted); margin-left: 0.4rem; }
.vid { cursor: pointer; background: none; border: 1px solid var(--line); border-radius: 0.3rem; padding: 0 0.4rem; font-size: 0.85rem; margin-left: 0.4rem; color: var(--muted); }
.vid:hover { color: var(--ink); border-color: var(--muted); }

/* ---------- last match recap ---------- */
.recap h2 { display: flex; justify-content: space-between; }
.recap h2 b { color: var(--ink); }
.recap-row { display: grid; grid-template-columns: 7rem 1fr 3rem 3rem; gap: 0.6rem; align-items: center; font-size: 1.1rem; padding: 0.15rem 0; }
.recap-row.head { color: var(--muted); font-size: 0.95rem; }
.recap-row .n { text-align: right; font-family: var(--cond); font-size: 1.35rem; font-weight: 600; }
.recap-bar { height: 0.55rem; background: var(--panel-2); border-radius: 0.3rem; position: relative; overflow: hidden; }
.recap-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0.3rem; }
.recap-bar i.red { background: var(--red); }
.recap-bar i.blue { background: var(--blue); }
.recap-empty { color: var(--muted); font-size: 1.15rem; }

/* ---------- rankings ---------- */
.rankings { display: flex; flex-direction: column; }
.rank-wrap { flex: 1; min-height: 0; overflow: hidden; }
.rank-table { width: 100%; border-collapse: collapse; font-size: 1.15rem; }
.rank-table th { text-align: right; font-weight: 500; color: var(--muted); font-size: 0.95rem; padding: 0 0.5rem 0.3rem; }
.rank-table th:nth-child(2) { text-align: left; }
.rank-table td { text-align: right; padding: 0.26rem 0.5rem; border-top: 1px solid var(--line); }
.rank-table td:nth-child(1) { font-family: var(--cond); font-weight: 600; font-size: 1.3rem; color: var(--muted); }
.rank-table td:nth-child(2) { text-align: left; font-family: var(--cond); font-weight: 700; font-size: 1.4rem; }
.rank-table td:nth-child(2) small { font-family: var(--body); font-weight: 400; font-size: 0.95rem; color: var(--muted); margin-left: 0.5rem; }
.rank-table tr.us td { background: var(--caution); color: var(--caution-ink); border-top-color: transparent; }
.rank-table tr.us td small { color: var(--caution-ink); }
.rank-table tr.ally td:nth-child(2) { color: #9cc0ff; }
.rank-table tr.gap td { border: 0; text-align: center; color: var(--muted); padding: 0; line-height: 0.9; }

/* ---------- media ---------- */
.media { padding: 0.6rem; }
.media[hidden] { display: none; }
.media-frame { aspect-ratio: 16 / 9; background: #000; border-radius: 0.4rem; overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: 1.1rem; text-align: center; padding: 0; }
.media-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.media-caption { font-size: 1rem; color: var(--muted); padding: 0.45rem 0.3rem 0; display: flex; justify-content: space-between; gap: 1rem; }

/* ---------- ticker ---------- */
.ticker { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: stretch; padding: 0 1.2rem 0.9rem; min-height: 3.6rem; }
.ticker-pin { background: var(--caution); color: var(--caution-ink); font-weight: 600; font-size: 1.35rem; padding: 0.6rem 1.1rem; border-radius: 0.5rem; display: flex; align-items: center; max-width: 60rem; }
.ticker-pin[hidden] { display: none; }
.ticker-feed { display: flex; align-items: center; gap: 2rem; font-size: 1.25rem; overflow: hidden; white-space: nowrap; min-width: 0; }
.feed-item { overflow: hidden; text-overflow: ellipsis; }
.feed-item b { color: var(--muted); font-weight: 500; margin-right: 0.5rem; }
.ticker-credit { align-self: center; font-size: 0.85rem; color: var(--muted); white-space: nowrap; }

.corner { position: fixed; right: 0.6rem; bottom: 0.4rem; display: flex; gap: 0.6rem; opacity: 0; transition: opacity 0.2s; }
.corner:hover, .corner:focus-within { opacity: 1; }
.corner a, .corner button { font-size: 0.85rem; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 0.3rem; padding: 0.2rem 0.6rem; text-decoration: none; cursor: pointer; }

/* ---------- small screens: stack and scroll ---------- */
@media (max-width: 900px) {
  html { font-size: 14px; }
  .col { grid-template-rows: auto auto; }
  .display { height: auto; overflow: auto; }
  .top { grid-template-columns: 1fr auto; gap: 0.8rem 1.2rem; }
  .event { grid-column: 1 / -1; order: 3; white-space: normal; }
  .standing { grid-column: 1 / -1; order: 4; flex-wrap: wrap; }
  .grid { grid-template-columns: 1fr; padding: 0.8rem; }
  .match-name { font-size: 4.6rem; }
  .bumper-num { font-size: 3.6rem; }
  .lineup { grid-template-columns: 1fr; }
  .ticker { grid-template-columns: 1fr; }
  .ticker-feed { white-space: normal; flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .corner { position: static; opacity: 1; padding: 0 0.8rem 1rem; }
}

/* ---------- login + settings pages ---------- */
html.form-root { font-size: 16px; }
.page { min-height: 100vh; }
.page .wrap { max-width: 40rem; margin: 0 auto; padding: 3rem 1.25rem 4rem; }
.page h1 { font-family: var(--cond); font-weight: 800; font-size: 2.6rem; line-height: 1.05; margin-bottom: 0.4rem; }
.page .lede { color: var(--muted); margin: 0 0 2rem; }
.login-card { max-width: 24rem; margin: 18vh auto 0; padding: 0 1.25rem; }
.login-card .bumper { margin-bottom: 1.6rem; background: var(--blue); }
.login-card .bumper-num { font-size: 3.4rem; }
.field { display: grid; gap: 0.35rem; margin-bottom: 1.25rem; }
.field label { font-weight: 600; }
.field .hint { color: var(--muted); font-size: 0.9rem; }
.field input, .field select, .field textarea {
  background: var(--panel); border: 1px solid var(--line); border-radius: 0.4rem; padding: 0.65rem 0.75rem; width: 100%;
}
.field textarea { min-height: 7rem; resize: vertical; line-height: 1.4; }
.radios { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.radios label { font-weight: 500; background: var(--panel); border: 1px solid var(--line); border-radius: 0.4rem; padding: 0.45rem 0.8rem; cursor: pointer; display: flex; gap: 0.45rem; align-items: center; }
.field .radios input { width: auto; padding: 0; accent-color: var(--caution); }
fieldset { border: 0; padding: 0; margin: 0 0 2rem; }
legend { font-family: var(--cond); font-size: 1.5rem; font-weight: 700; margin-bottom: 0.9rem; padding: 0; }
.btn { background: var(--caution); color: var(--caution-ink); border: 0; border-radius: 0.4rem; padding: 0.7rem 1.4rem; font-weight: 600; cursor: pointer; }
.btn.quiet { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; padding: 1rem 0; border-top: 1px solid var(--line); }
.msg { min-height: 1.4em; }
.msg.err { color: #ff8a8a; }
.msg.ok { color: var(--caution); }
.toplinks { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.toplinks a { color: var(--muted); }
.error-text { color: #ff8a8a; margin: -0.5rem 0 1rem; min-height: 1.3em; }
