/* TryTally web viewer. Colour tokens shared with the product plan. */
:root {
  --bg: #F2F5F3;
  --surface: #FFFFFF;
  --ink: #13231C;
  --muted: #56685F;
  --line: #D3DCD6;
  --input-bg: #F2F5F3;
  --accent: #1B7449;
  --accent-soft: #DCEDE3;
  --home: #1F4FA8;
  --away: #B3263A;
  --on-team: #FFFFFF;
  --warn-bg: #FFF4D6;
  --warn-ink: #5A4300;
  --warn-line: #E8CF86;
  --display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1613; --surface: #17211C; --ink: #E7EFEA; --muted: #9BADA3; --line: #2B3A33; --input-bg: #24332C;
    --accent: #56C18D; --accent-soft: #1B3329; --home: #86ABF4; --away: #F08A98; --on-team: #0F1613;
    --warn-bg: #33290F; --warn-ink: #F5DE9C; --warn-line: #5C4A1A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1613; --surface: #17211C; --ink: #E7EFEA; --muted: #9BADA3; --line: #2B3A33; --input-bg: #24332C;
  --accent: #56C18D; --accent-soft: #1B3329; --home: #86ABF4; --away: #F08A98; --on-team: #0F1613;
  --warn-bg: #33290F; --warn-ink: #F5DE9C; --warn-line: #5C4A1A;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.5;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
h1, h2 { font-family: var(--display); line-height: 1.1; margin: 0; font-weight: 700; }
h1 { font-size: 2.2rem; }
h2 { font-size: 1.5rem; }
p, ol { margin: 0; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.label { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.page {
  max-width: 36rem;
  margin-inline: auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex;
  flex-direction: column;
  gap: 20px;
}
main { display: flex; flex-direction: column; gap: 16px; flex: 1; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 4px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.5rem; color: var(--accent); text-decoration: none; letter-spacing: 0.01em; }
.code { font-family: var(--mono); font-size: 1rem; font-weight: 600; letter-spacing: 0.12em; color: var(--muted); }

/* banner */
.banner {
  background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line);
  border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: 1rem;
}
.banner.ended { background: var(--accent-soft); color: var(--ink); border-color: var(--line); }

/* panels */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px 18px; display: flex; flex-direction: column; gap: 14px;
}
.code-form { display: flex; flex-direction: column; gap: 10px; }
.code-form input {
  font-family: var(--mono); font-size: 2rem; font-weight: 600; letter-spacing: 0.25em;
  text-transform: uppercase; text-align: center;
  width: 100%; padding: 12px 8px; border-radius: 10px;
  border: 2px solid var(--line); background: var(--input-bg); color: var(--ink);
}
.code-form input:focus { border-color: var(--accent); outline: none; }
.error { color: var(--away); font-weight: 600; font-size: 0.95rem; }
.btn {
  display: inline-block; font: inherit; font-weight: 700; font-size: 1.1rem;
  background: var(--accent); color: var(--on-team); border: 0; border-radius: 12px;
  padding: 14px 20px; min-height: 52px; text-decoration: none; cursor: pointer; text-align: center;
}
.btn-link { margin-top: 6px; }

/* match */
#match { display: flex; flex-direction: column; gap: 18px; }
.state {
  font-family: var(--display); font-size: 1.6rem; font-weight: 700; text-align: center;
  line-height: 1.15;
}
.state.live { color: var(--accent); }

.board {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 12px 12px;
}
.team { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; text-align: center; }
.team-band {
  --team: var(--muted);
  --team-ink: #FFFFFF;
  width: 100%; max-width: 9rem; border-radius: 10px; padding: 6px 4px;
  background: var(--team); color: var(--team-ink);
  /* outline keeps a very dark or very light shirt colour visible against the page */
  box-shadow: inset 0 0 0 1px rgba(127, 127, 127, 0.45);
}
/* second shirt colour: a band along the bottom */
.team-band.two { box-shadow: inset 0 -8px 0 var(--team2), inset 0 0 0 1px rgba(127, 127, 127, 0.45); padding-bottom: 12px; }
#team-home .team-band { --team: var(--home); }
#team-away .team-band { --team: var(--away); }
.abbr { font-family: var(--display); font-weight: 700; font-size: 1.5rem; letter-spacing: 0.06em; line-height: 1.1; }
.team-name {
  font-weight: 600; font-size: 1rem; line-height: 1.25; max-width: 100%;
  overflow-wrap: anywhere; min-height: 2.5em;
}
.score {
  font-family: var(--display); font-weight: 700; line-height: 1;
  font-size: clamp(4.5rem, 24vw, 7.5rem); font-variant-numeric: tabular-nums;
}
.dash {
  font-family: var(--display); font-weight: 700; color: var(--muted);
  font-size: clamp(2.5rem, 12vw, 4rem); align-self: end; padding-bottom: 0.6em;
}
.score.bump { animation: bump 0.6s ease-out; }
@keyframes bump { 0% { transform: scale(1.18); color: var(--accent); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .score.bump { animation: none; } }

.last {
  background: var(--accent-soft); border-radius: 12px; padding: 12px 16px;
  display: flex; flex-direction: column; gap: 2px;
}
.last-text { font-size: 1.2rem; font-weight: 600; }

.events { display: flex; flex-direction: column; gap: 10px; }
.event-list {
  list-style: none; padding: 0; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.event {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center;
  gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line);
}
.event:first-child { border-top: 0; }
.ev-half {
  font-size: 0.8rem; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.05em; min-width: 2.2em;
}
.ev-swatch {
  width: 14px; height: 14px; border-radius: 4px; background: var(--team, var(--muted));
  box-shadow: inset 0 0 0 1px rgba(127, 127, 127, 0.45);
}
.ev-swatch.two { background: linear-gradient(135deg, var(--team) 50%, var(--team2) 50%); }
.ev-main { min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.ev-type { font-weight: 700; }
.ev-team { color: var(--muted); }
.ev-score { font-family: var(--display); font-weight: 700; font-size: 1.35rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* footer */
.foot {
  border-top: 1px solid var(--line); padding-top: 14px;
  display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 0.95rem;
}

/* privacy page */
.doc { display: flex; flex-direction: column; gap: 14px; }
.doc ul { padding-left: 1.25rem; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.doc h2 { margin-top: 8px; }

@media (min-width: 40rem) {
  .board { padding: 22px 18px 16px; gap: 14px; }
  .team-name { font-size: 1.15rem; }
}
