/* Shared shell for the landing page, admin console and scorekeeper app. */

:root {
  /* Brand red sampled from the club badge in /logo.png. */
  --brand: #b90f10;
  --brand-bright: #e01418;
  --brand-deep: #6d0809;

  --bg: #0a070a;
  --card: #171216;
  --card-2: #211a1f;
  --line: rgba(255, 255, 255, 0.11);
  --text: #f4f1f3;
  --dim: #9a8e95;
  --accent: var(--brand);
  --live: #2ee27a;
  --warn: #ffb020;
  --danger: #e0483c;
  --radius: 12px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #2a1013, var(--bg));
  min-height: 100vh;
  color: var(--text);
  font: 15px/1.45 "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--accent);
}

h1 {
  font-size: 22px;
  margin: 0;
  letter-spacing: 0.01em;
}

h2 {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--dim);
  margin: 0 0 12px;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 20px 64px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 3px solid var(--brand);
  background: rgba(12, 8, 11, 0.9);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-logo {
  height: 30px;
  width: auto;
  flex: none;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
}

.dot[data-status="live"] {
  background: var(--live);
  box-shadow: 0 0 8px var(--live);
}

.muted {
  color: var(--dim);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
}

.grid {
  display: grid;
  gap: 14px;
}

.cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.spread {
  justify-content: space-between;
}

/* ---------- controls ---------- */

button {
  font: inherit;
  font-weight: 700;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.06s ease;
  touch-action: manipulation;
}

button:hover {
  filter: brightness(1.18);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.primary {
  background: var(--brand);
  border-color: transparent;
}

button.primary:hover {
  background: var(--brand-bright);
}

button.good {
  background: #1c7f4c;
  border-color: transparent;
}

button.danger {
  background: transparent;
  border-color: var(--danger);
  color: #ff9c92;
}

button.danger:hover {
  background: rgba(224, 72, 60, 0.16);
}

button.ghost {
  background: transparent;
}

button.small {
  padding: 5px 9px;
  font-size: 13px;
  border-radius: 8px;
}

input,
select {
  font: inherit;
  color: var(--text);
  background: #100c0f;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  min-width: 0;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.code-input {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 22px;
  font-weight: 800;
  text-align: center;
}

input[type="color"] {
  padding: 2px;
  width: 44px;
  height: 38px;
}

label.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.1);
  color: var(--dim);
}

.pill[data-status="live"] {
  background: rgba(46, 226, 122, 0.16);
  color: var(--live);
}

.pill[data-status="final"] {
  background: rgba(255, 255, 255, 0.16);
  color: var(--text);
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 18px;
  border-radius: 3px;
  vertical-align: -3px;
  margin-right: 7px;
}

.update-bar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: var(--accent);
  border: none;
  color: #fff;
  font-weight: 700;
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 60;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: #24160f;
  border: 1px solid var(--warn);
  color: #ffd79a;
  padding: 11px 16px;
  border-radius: 10px;
  font-weight: 600;
  z-index: 50;
  max-width: 92vw;
}

.toast[hidden] {
  display: none;
}

/* ---------- landing ---------- */

.hero {
  text-align: center;
  padding: 40px 20px 8px;
}

.hero-logo {
  /* Red-on-white mark: it gets a light chip on the dark page, as on the board. */
  height: 108px;
  width: auto;
  margin-bottom: 14px;
  background: #fff;
  border-radius: 14px;
  padding: 10px 14px;
  box-sizing: content-box;
}

.hero h1 {
  font-size: 34px;
}

.tiles {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top: 26px;
}

.tile {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
}

.tile:hover {
  border-color: var(--accent);
}

.tile .icon {
  font-size: 26px;
}

.tile strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 17px;
}

/* ---------- admin: horn + import ---------- */

.sound-bar {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 176, 32, 0.07);
}


.horn-flash {
  animation: horn 0.6s ease-out;
}

@keyframes horn {
  0% {
    box-shadow: 0 0 0 3px var(--warn);
  }
  100% {
    box-shadow: 0 0 0 3px transparent;
  }
}

.report {
  margin: 14px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0d0a0d;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 320px;
  overflow: auto;
}

.report[hidden] {
  display: none;
}

/* ---------- admin: schedule day headings ---------- */

.day-row td {
  padding-top: 18px;
  border-bottom: 2px solid var(--brand);
}

.day-row .day-name {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.day-row .day-count {
  margin-left: 10px;
  font-size: 11px;
  color: var(--dim);
}

/* ---------- admin: big screen ---------- */

.screen-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.screen-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  text-align: left;
}

.screen-option[aria-pressed="true"] {
  border-color: var(--brand);
  background: rgba(185, 15, 16, 0.18);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.screen-option .live-tag {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-bright);
}

.screen-option small {
  display: block;
  font-weight: 500;
  font-size: 11px;
  color: var(--dim);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- admin: set of games ---------- */

.set-label {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.set-hint {
  margin: 10px 0 0;
  font-size: 12px;
}

.set-preview {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.set-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-2);
  font-size: 14px;
}

.set-row[data-role="next"] {
  background: transparent;
  border-style: dashed;
  color: var(--dim);
}

.set-row .rink-tag {
  flex: none;
  min-width: 74px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

.set-row .fixture {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.set-row .set-score {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

/* ---------- admin: rink cards ---------- */

.rink-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.rink-card .score-line {
  font-size: 30px;
  font-weight: 900;
  margin: 6px 0;
}

.qr {
  display: block;
  width: 148px;
  height: 148px;
  border-radius: 10px;
  background: #fff;
  padding: 6px;
}

.scorer-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.scorer-card .body {
  flex: 1;
  min-width: 0;
}

.token {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  color: var(--dim);
  word-break: break-all;
}

/* ---------- scorekeeper app ---------- */

.score-app {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 14px 48px;
}

/* Who is at this table. First card on the page, because a name typed once is
   what puts a name on every goal after it. */
.who {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.who-list {
  font-size: 12px;
  line-height: 1.4;
}

.rink-people {
  margin: 0;
  font-size: 12px;
  color: var(--dim);
}

/* What happened on this rink, newest first, with who registered it. */
.rink-log {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.log-by {
  color: var(--text);
  font-weight: 700;
}

/* Someone is holding a phone at this rink. Worth a colour: the line an
   organiser is scanning for is the one that says nobody is. */
.rink-people[data-live="true"],
.live-now {
  color: var(--live);
  font-weight: 700;
}

/* Nobody on a rink that has a game on it: that is the one worth shouting. */
.rink-people[data-alarm="true"] {
  color: var(--warn, #ffb020);
  font-weight: 800;
}

.rink-who {
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.rink-ping {
  flex: none;
}

.clock-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
}


.big-clock {
  font-size: 60px;
  font-weight: 900;
  line-height: 1;
}

.big-clock[data-running="true"] {
  color: var(--live);
}

.period-label {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
}

button.xl {
  font-size: 19px;
  padding: 18px 22px;
  border-radius: 14px;
  min-width: 132px;
}

.teams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.team-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}

.team-panel .tname {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-height: 2.6em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.team-panel .tscore {
  font-size: 78px;
  font-weight: 900;
  line-height: 1;
  margin: 4px 0 10px;
}

button.goal {
  width: 100%;
  font-size: 30px;
  padding: 26px 20px;
  border-radius: 14px;
  background: #1c7f4c;
  border-color: transparent;
}

.waiting {
  text-align: center;
  padding: 28px 16px;
}

.waiting-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

button.minus {
  width: 100%;
  font-size: 22px;
  padding: 16px 20px;
  border-radius: 14px;
  margin-top: 10px;
  background: #33202c;
  border-color: rgba(255, 255, 255, 0.14);
}





dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  padding: 18px;
  width: min(360px, 92vw);
}

dialog::backdrop {
  background: rgba(3, 5, 10, 0.72);
}


/* ---------- parent tournament tracker ---------- */

.parent-app {
  max-width: 720px;
}

.parent-game {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-2);
  margin-bottom: 8px;
}

.parent-game .fixture {
  flex: 1;
  min-width: 160px;
  font-weight: 700;
  color: var(--text);
}

.parent-scorekeeper {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.parent-scoreboard {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}

.parent-clock {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 3em;
  color: var(--dim);
}

.parent-clock[data-running="true"] {
  color: var(--live);
}

.parent-score {
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
}

.parent-goal-controls {
  flex-basis: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.parent-team-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.parent-team-controls .parent-player-select,
.parent-team-controls .parent-player-new {
  flex: 1;
  min-width: 140px;
}

.parent-goals {
  flex-basis: 100%;
  list-style: none;
  margin: 0;
  padding: 8px 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 4px;
  font-size: 13px;
}

/* time into the game | score it made | who | time since the goal before */
.parent-goal {
  display: grid;
  grid-template-columns: 3.4em 3.4em 1fr auto;
  gap: 8px;
  align-items: baseline;
}

.parent-goal .goal-time,
.parent-goal .goal-score,
.parent-goal .goal-gap {
  font-variant-numeric: tabular-nums;
}

.parent-goal .goal-time {
  color: var(--dim);
}

.parent-goal .goal-score {
  font-weight: 700;
  color: var(--text);
}

.parent-goal .goal-gap {
  color: var(--dim);
  font-size: 12px;
}

.parent-final {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--dim);
}

.parent-finish {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  font-size: 13px;
}

/* A finished game reads as done: quieter, nothing to tap but Edit. */
.parent-game.finished {
  opacity: 0.85;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.chip {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

/* The chosen team is filled with the brand colour; the rest stay outlined. */
.chip.on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 700;
}

.import-game {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.import-game.guess {
  border-left: 3px solid var(--brand);
  padding-left: 8px;
}

.import-note {
  font-size: 12px;
  color: var(--brand-bright);
}

.import-game.dim {
  opacity: 0.6;
}

.import-teams {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.import-team {
  flex: 1;
  min-width: 0;
}

.import-when {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.import-when input[type='date'],
.import-when input[type='time'] {
  width: auto;
}

.import-field {
  flex: 1;
  min-width: 90px;
}

.parent-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.parent-result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.parent-result .result-teams {
  font-weight: 600;
  color: var(--text);
}

.parent-result .result-score {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.parent-result .result-where {
  grid-column: 1 / -1;
  font-size: 12px;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-2);
}

.recent-item a {
  flex: 1;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-count {
  font-size: 13px;
  white-space: nowrap;
}

.recent-item a:hover {
  text-decoration: underline;
}

.parent-top-scorers {
  flex-basis: 100%;
  font-size: 13px;
}

.chat-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-message {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-2);
}

.chat-who {
  font-weight: 700;
  color: var(--text);
}

.chat-text {
  flex-basis: 100%;
  margin: 0;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 560px) {
  /* The brand already names the rink; two toggles matter more than repeating it. */
  .topbar #scorerName {
    display: none;
  }

  .topbar {
    gap: 8px;
    padding: 10px 12px;
  }

  .big-clock {
    font-size: 46px;
  }

  .team-panel .tscore {
    font-size: 60px;
  }

  button.xl {
    min-width: 104px;
    padding: 15px 14px;
  }
}
