/* ============================================================
   RinkDesk Live — standalone, read-only scoring page.
   Self-contained theme (light/dark); not layered on app.css.
   ============================================================ */

:root,
[data-theme="dark"] {
  --lv-bg: #0b1016;
  --lv-bg2: #111923;
  --lv-surface: #17202c;
  --lv-surface2: #1e2a39;
  --lv-line: #27374a;
  --lv-text: #e9eff6;
  --lv-muted: #a6b4c3;
  --lv-faint: #74869a;
  --lv-accent: #3b9df0;
  --lv-live: #ff5d6c;
  --lv-ok: #35c98a;
  --lv-played: #8a94a3;
  --lv-warmup: #f0b429;
  --lv-break: #7c9cff;
}

[data-theme="light"] {
  --lv-bg: #eef2f7;
  --lv-bg2: #ffffff;
  --lv-surface: #ffffff;
  --lv-surface2: #eef2f7;
  --lv-line: #d3dce6;
  --lv-text: #101923;
  --lv-muted: #4d5b6b;
  --lv-faint: #7b8899;
  --lv-accent: #1f74c9;
  --lv-live: #e0313f;
  --lv-ok: #1f9d63;
  --lv-played: #6b7686;
  --lv-warmup: #b7791f;
  --lv-break: #3b5bdb;
}

* { box-sizing: border-box; }

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--lv-bg);
  color: var(--lv-text);
  font-family: ui-sans-serif, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
}

#live,
.live-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ------------------------------------------------------------
   Slim control bar — the only chrome on the page.
   ------------------------------------------------------------ */
.live-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  background: var(--lv-bg2);
  border-bottom: 1px solid var(--lv-line);
}

.live-bar-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 0;
}

.live-bar-title strong {
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.live-bar-title .dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--lv-live);
  animation: lv-pulse 1.2s ease-in-out infinite;
}

.live-tournament {
  color: var(--lv-muted);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 0.55rem;
}

.ctl {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--lv-muted);
}

.ctl select {
  width: 11rem;
  min-width: 11rem;
  height: 2.1rem;
  min-height: 2.1rem;
  margin: 0;
  padding: 0 1.6rem 0 0.6rem;
  font-size: 0.85rem;
  text-align: center;
  text-align-last: center;
  color: var(--lv-text);
  background-color: var(--lv-surface2);
  border: 1px solid var(--lv-line);
  border-radius: 0.4rem;
}

/* Theme and language use the same button; the three languages are joined
   into one segmented group. */
.theme-btn,
.seg-btn {
  min-width: 2.1rem;
  height: 2.1rem;
  min-height: 2.1rem;
  margin: 0;
  padding: 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  color: var(--lv-text);
  background: var(--lv-surface2);
  border: 1px solid var(--lv-line);
  border-radius: 0.4rem;
  cursor: pointer;
}

.theme-btn {
  padding: 0;
  font-size: 0.95rem;
}

.langs {
  display: inline-flex;
  align-items: stretch;
}

.langs .seg-btn {
  width: 2.1rem;
  padding: 0;
  border-radius: 0;
  border-left-width: 0;
}

.langs .seg-btn:first-child {
  border-left-width: 1px;
  border-radius: 0.4rem 0 0 0.4rem;
}

.langs .seg-btn:last-child {
  border-radius: 0 0.4rem 0.4rem 0;
}

.langs .seg-btn:hover { color: var(--lv-accent); }

.langs .seg-btn.on {
  color: #fff;
  background: var(--lv-accent);
  border-color: var(--lv-accent);
}

/* ------------------------------------------------------------
   Panels
   ------------------------------------------------------------ */
.live-main {
  flex: 1;
  display: grid;
  gap: 0.9rem;
  padding: 0.9rem;
  align-items: start;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 1000px) {
  .live-main {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.panel {
  min-width: 0;
  background: var(--lv-surface);
  border: 1px solid var(--lv-line);
  border-radius: 0.6rem;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--lv-line);
}

.panel-head h2 {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--lv-muted);
}

.live-updated {
  margin-left: 0.35rem;
  font-size: 0.66rem;
  color: var(--lv-faint);
  opacity: 0.85;
  white-space: nowrap;
}

.empty {
  margin: 0;
  padding: 1rem 0.8rem;
  color: var(--lv-muted);
  font-size: 0.85rem;
}

.empty.small { padding: 0.3rem 0; }

.live-error {
  margin: 0;
  padding: 0.6rem 0.8rem;
  color: var(--lv-live);
  font-size: 0.85rem;
}

/* ------------------------------------------------------------
   Games list
   ------------------------------------------------------------ */
.games {
  list-style: none;
  margin: 0;
  padding: 0;
}

.game-item { border-bottom: 1px solid var(--lv-line); }
.game-item:last-child { border-bottom: none; }
.game-item.open { background: var(--lv-bg2); }

/* Whole row for a game in progress — subtle, and pulsing in step with the
   live dot in the table (same 1.2s ease-in-out). */
.game-item.live {
  background-color: rgba(224, 49, 63, 0.07);
  animation: lv-row-pulse 1.2s ease-in-out infinite;
}
.game-item.live .game:hover { background: rgba(224, 49, 63, 0.12); }

@keyframes lv-row-pulse {
  0%, 100% { background-color: rgba(224, 49, 63, 0.05); }
  50% { background-color: rgba(224, 49, 63, 0.15); }
}

.game {
  display: grid;
  grid-template-columns: 4.4rem minmax(0, 1fr) 6.2rem;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.8rem;
  text-align: left;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 0;
  cursor: pointer;
}

.game:hover { background: var(--lv-surface2); }

.game-when {
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.game-date { font-size: 0.68rem; color: var(--lv-faint); }
.game-time { font-weight: 700; font-size: 0.92rem; }

.game-tournament {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.6rem;
  line-height: 1.15;
  color: var(--lv-faint);
}

/* Strict, independent columns: name | logo | score | logo | name. The status
   lives in its own fixed column of .game, so it can never shift these. */
.game-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1.5rem minmax(3.6rem, auto) 1.5rem minmax(0, 1fr);
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.g-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.g-name.home { text-align: right; }
.g-name.away { text-align: left; }

.g-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.crest {
  width: 20px;
  height: 20px;
  flex: none;
  object-fit: contain;
}

.score {
  width: 100%;
  text-align: center;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.score.pending { color: var(--lv-faint); font-weight: 600; }

.dec-sup {
  margin-left: 0.15rem;
  font-size: 0.62em;
  font-weight: 800;
  vertical-align: super;
  color: var(--lv-accent);
  letter-spacing: 0.02em;
}

.badge {
  justify-self: stretch;
  align-self: center;
  width: 100%;
  padding: 0.14rem 0.42rem;
  text-align: center;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.st-pending { background: rgba(138, 148, 163, 0.18); color: var(--lv-played); }
.st-in_progress { background: rgba(255, 93, 108, 0.16); color: var(--lv-live); }
.st-played { background: rgba(53, 201, 138, 0.14); color: var(--lv-ok); }
.st-walkover { background: rgba(240, 106, 106, 0.16); color: #f06a6a; }
.st-warmup { background: rgba(240, 180, 41, 0.18); color: var(--lv-warmup); }
.st-break { background: rgba(124, 156, 255, 0.18); color: var(--lv-break); }
.st-overtime { background: rgba(240, 180, 41, 0.18); color: var(--lv-warmup); }
.st-shootout { background: rgba(124, 156, 255, 0.18); color: var(--lv-break); }

.goal-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.02rem 0.28rem;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 800;
  background: var(--lv-surface2);
  color: var(--lv-accent);
  border: 1px solid var(--lv-line);
}

.game-detail {
  padding: 0.35rem 0.8rem 0.7rem 0.8rem;
  background: var(--lv-bg2);
}

.game-walkover {
  margin: 0.1rem 0 0.45rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--lv-live);
}

.goals-scroll { overflow-x: auto; }

.goals-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.goals-table th {
  padding: 0.2rem 0.35rem;
  text-align: left;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--lv-muted);
  border-bottom: 1px solid var(--lv-line);
}

.goals-table td {
  padding: 0.22rem 0.35rem;
  border-bottom: 1px solid var(--lv-line);
  vertical-align: top;
}

.goals-table tr:last-child td { border-bottom: none; }

/* Left stripe marks which team scored. */
.goals-table tr.home td:first-child { box-shadow: inset 3px 0 0 var(--lv-accent); }
.goals-table tr.away td:first-child { box-shadow: inset 3px 0 0 var(--lv-live); }

.g-time {
  color: var(--lv-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.g-player { min-width: 7rem; }

.jersey {
  display: inline-block;
  min-width: 1.5rem;
  margin-right: 0.3rem;
  text-align: right;
  font-weight: 700;
  color: var(--lv-muted);
  font-variant-numeric: tabular-nums;
}

.g-empty { color: var(--lv-faint); }

/* ------------------------------------------------------------
   Table
   ------------------------------------------------------------ */
.table-scroll { overflow: auto; }

.live-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.live-table th,
.live-table td {
  padding: 0.3rem 0.35rem;
  text-align: center;
  border-bottom: 1px solid var(--lv-line);
  white-space: nowrap;
}

.live-table th {
  position: sticky;
  top: 0;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--lv-muted);
  background: var(--lv-surface);
}

.live-table td.col-team,
.live-table th.col-team {
  text-align: left;
  max-width: 0;
  width: 100%;
  padding-left: 0.6rem;
}

.live-table .col-rank { width: 2rem; }
.live-table .pts { font-weight: 800; }

.live-table .crest {
  width: 18px;
  height: 18px;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.team-name {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

tr.is-live { background: rgba(255, 93, 108, 0.1); }
tr.is-live td { font-weight: 600; }

.live-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.45rem;
  vertical-align: middle;
}

.live-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--lv-live);
  animation: lv-pulse 1.2s ease-in-out infinite;
}

.live-label {
  font-size: 0.56rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--lv-live);
  white-space: nowrap;
}

@keyframes lv-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ------------------------------------------------------------
   Copyright footer
   ------------------------------------------------------------ */
.live-footer {
  padding: 0.6rem 0.9rem 1.1rem;
  text-align: center;
  font-size: 0.68rem;
  color: var(--lv-faint);
  opacity: 0.8;
}

/* ------------------------------------------------------------
   Narrow screens
   ------------------------------------------------------------ */
@media (max-width: 600px) {
  .live-bar { padding: 0.4rem 0.55rem; }
  .live-main { padding: 0.55rem; gap: 0.55rem; }
  .ctl select { width: 9rem; min-width: 9rem; }
  .game { grid-template-columns: 3.4rem minmax(0, 1fr); padding: 0.45rem 0.55rem; }
  .game-date { display: none; }
  .game-detail { padding-left: 0.55rem; }
  .badge { display: none; }
}
