/* All design tokens live in theme.css — loaded before this file.
   No :root variable declarations here. */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-data);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 1rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
}
#tv-root { flex: 1; }

/* ── Header ── */
.tv-header {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.8rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}
/* Controls row: centered [page-selector-title] with [buttons] right-aligned.
   CSS Grid 1fr auto 1fr centres the selector perfectly. */
.tv-header-title-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.4rem;
}
.tv-title-center {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.1rem 0.5rem;
  width: 100%;
  text-align: center;
}
.tv-app-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  flex-shrink: 0;
}
.tv-tournament-name {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: var(--tracking-display);
  min-width: 0;
  margin: 0;
}
.tv-header-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  margin-bottom: 0.8rem;
}
.tv-title {
  flex: 1;
  min-width: 0;
}
.tv-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.tv-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  letter-spacing: 0.03em;
}
.tv-badge-phase {
  background: rgba(234, 179, 8, 0.18);
  border: 1px solid var(--yellow);
  color: var(--yellow);
}
.tv-badge-champion {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid var(--green);
  color: var(--green);
}
.refresh-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.refresh-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}
.refresh-dot.refreshing {
  background: var(--green);
  animation: none;
}

/* ── Section wrapper ── */
.tv-section {
  margin-bottom: 2rem;
}
.tv-section-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}
.tv-section-header h2 {
  font-size: var(--text-lg);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  letter-spacing: var(--tracking-display);
}

/* ── Court board ── */
.court-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.court-card {
  background: var(--court-bg);
  border: 2px solid var(--accent);
  border-radius: var(--radius-dialog);
  padding: 1rem 1.2rem;
  box-shadow: var(--shadow-md);
}
.court-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.7rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.court-name {
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.court-match {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}
.court-match-info { flex: 1; min-width: 0; }
/* Lifecycle panels (pending/submitted/dispute) always go on their own row below the teams */
.court-match .player-score-pending,
.court-match .player-score-submitted,
.court-match .player-score-dispute {
  flex-basis: 100%;
}
.court-match:last-child { border-bottom: none; }
.court-match-empty {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9rem;
}
.court-match-empty:last-child { border-bottom: none; }
.court-match-teams {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.4;
}
.court-match-vs {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
  margin: 0 0.3rem;
}
.court-match-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.no-courts {
  color: var(--text-muted);
  font-style: italic;
  font-size: 1rem;
}

/* ── Standings ── */
.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  table-layout: fixed;
}
/* GP group standings — class-based so column count can vary (with/without sets) */
.standings-table .col-hash { width: 3rem; }
.standings-table .col-player { width: auto; }
.standings-table .col-played,
.standings-table .col-w,
.standings-table .col-d,
.standings-table .col-l,
.standings-table .col-sw,
.standings-table .col-sl,
.standings-table .col-sd,
.standings-table .col-pf,
.standings-table .col-pa,
.standings-table .col-diff { width: 4.5rem; text-align: center; }

/* Mexicano standings — fixed 8 columns, no col-* classes on cells */
.standings-table[data-type="mex"] th:nth-child(1),
.standings-table[data-type="mex"] td:nth-child(1) { width: 3rem; }
.standings-table[data-type="mex"] th:nth-child(2),
.standings-table[data-type="mex"] td:nth-child(2) { width: auto; }
.standings-table[data-type="mex"] th:nth-child(n+3),
.standings-table[data-type="mex"] td:nth-child(n+3) { width: 4.5rem; text-align: center; }
.standings-table th {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: left;
  padding: 0.45rem 0.75rem;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
/* ── Sortable leaderboard columns (Mexicano TV) ── */
.tv-sortable-col {
  cursor: pointer;
  user-select: none;
  transition: color 0.12s;
}
.tv-sortable-col:hover {
  color: var(--accent);
}
.tv-sort-active {
  color: var(--accent);
}
.standings-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.standings-table tr:first-child td { padding-top: 0.65rem; }
.standings-table .rank-cell {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-muted);
  min-width: 32px;
}
.standings-table .player-cell { font-weight: 700; max-width: 240px; }
.elo-badge {
  font-size: 0.7em;
  font-weight: 500;
  color: var(--text-muted);
  opacity: 0.65;
  margin-left: 0.3em;
}
.standings-table .pts-cell {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--green);
  white-space: nowrap;
}
.standings-table tr:hover td { background: var(--color-hover-overlay); }
.standings-table tr.my-row td { background: var(--color-primary-highlight); }
.standings-table tr.my-row .player-cell { color: var(--accent); }
.group-block { margin-bottom: 1.4rem; }
.group-block h3 {
  font-size: 1rem;
  color: var(--yellow);
  margin-bottom: 0.5rem;
}

/* ── Past matches / history ── */
.round-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  margin-bottom: 0.6rem;
  overflow: hidden;
}
.round-summary {
  cursor: pointer;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
}
.round-summary::-webkit-details-marker { display: none; }
details[open] > .round-summary { color: var(--text); border-bottom: 1px solid var(--border); }
.round-summary .chevron { color: var(--text-muted); font-size: 0.9rem; transition: transform 0.2s; }
details.round-block[open] > .round-summary .chevron { transform: rotate(90deg); }
.round-body { padding: 0.5rem 0.75rem; }

.history-match {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  font-size: 0.95rem;
}
.history-match:last-child { border-bottom: none; }
.history-teams { flex: 1; min-width: 200px; font-weight: 600; }
.history-vs { color: var(--text-muted); margin: 0 0.3rem; font-weight: 400; }
.history-score {
  font-weight: 800;
  color: var(--green);
  min-width: 70px;
  font-size: 1rem;
}
.history-score.sets-stack {
  display: inline-flex;
  flex-direction: column;
  gap: 0.05rem;
  line-height: 1.2;
}
.history-court {
  font-size: 0.82rem;
  color: var(--text-muted);
  min-width: 80px;
}
.history-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.badge-completed { background: var(--green); color: var(--color-on-success); }
.badge-scheduled { background: var(--border); color: var(--text); }

/* ── Score breakdown (nested) ── */
.breakdown-toggle {
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.breakdown-toggle:hover { color: var(--accent); }
.breakdown-toggle::-webkit-details-marker { display: none; }
details[open] > .breakdown-toggle { color: var(--accent); }
.breakdown-panel {
  margin-top: 0.4rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.82rem;
}
.breakdown-table { width: 100%; border-collapse: collapse; }
.breakdown-table th { font-size: 0.72rem; color: var(--text-muted); padding: 0.2rem 0.4rem; font-weight: 600; text-align: left; }
.breakdown-table td { padding: 0.25rem 0.4rem; border-bottom: 1px solid rgba(148, 163, 184, 0.1); }
.breakdown-table tr:last-child td { border-bottom: none; }

/* ── Bracket ── */
.bracket-scroll-wrapper { overflow: visible; }
.bracket-img {
  /* Fit-to-screen on all devices: never exceed container width nor a portion
     of the viewport height, preserving aspect ratio. Lightbox remains the path
     to full-resolution viewing. */
  max-width: 100%;
  max-height: 75vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  display: block;
  margin: 0 auto;
  cursor: zoom-in;
}
.bracket-tap-hint {
  display: none; /* shown only on mobile via media query */
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0.35rem 0 0;
}

/* ── Espejo dual-bracket layout ── */
.espejo-brackets-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.espejo-bracket-half {
  min-width: 0;
}
.espejo-bracket-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
@media (max-width: 600px) {
  .espejo-brackets-row { grid-template-columns: 1fr; }
}

/* ── Double-elimination explainer ── */
.double-elim-explainer {
  background: color-mix(in srgb, var(--accent, #f5a623) 8%, var(--bg-card, #fff));
  border: 1px solid color-mix(in srgb, var(--accent, #f5a623) 30%, transparent);
  border-radius: 8px;
  padding: 0.65rem 1rem;
  margin-bottom: 0.85rem;
  font-size: 0.85rem;
  line-height: 1.5;
}
.double-elim-explainer strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
  color: var(--text);
}
.double-elim-explainer ul {
  margin: 0 0 0.4rem 1.1rem;
  padding: 0;
}
.double-elim-explainer ul li {
  margin-bottom: 0.2rem;
  color: var(--text);
}
.double-elim-legend {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ── Bracket image lightbox ── */
#bracket-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 9995;
  touch-action: pan-x pan-y pinch-zoom;
}
#bracket-lightbox.open {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.bracket-lb-toolbar {
  position: fixed;
  top: 0.6rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(0,0,0,0.72);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 2rem;
  padding: 0.3rem 0.5rem;
  z-index: 9996;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
}
.bracket-lb-btn {
  background: transparent;
  border: none;
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
  line-height: 1;
  font-family: inherit;
  flex-shrink: 0;
}
.bracket-lb-btn:hover { background: rgba(255,255,255,0.18); }
.bracket-lb-zoom-lbl {
  width: auto;
  min-width: 3.2rem;
  padding: 0 0.4rem;
  border-radius: 0.75rem;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.bracket-lb-close-btn { margin-left: 0.25rem; }
.bracket-lightbox-scroll {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 3.5rem 1rem 1rem;
  -webkit-overflow-scrolling: touch;
}
.bracket-lightbox-scroll img {
  /* margin: auto centers when the image fits; collapses to 0 when it overflows,
     keeping the full scroll range (including left) accessible in all browsers. */
  margin: 0 auto;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  cursor: inherit;
  touch-action: pan-x pan-y pinch-zoom;
  user-select: none;
  -webkit-user-drag: none;
}

/* ── Error / empty states ── */
.tv-empty { color: var(--text-muted); font-style: italic; font-size: 0.95rem; padding: 0.5rem 0; }
.tv-error {
  padding: 1rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--red);
  border-radius: 8px;
  color: var(--red);
  font-size: 0.95rem;
}
.tv-loading { color: var(--text-muted); font-size: 1.1rem; padding: 2rem 0; text-align: center; }

/* ── Page selector dropdown ── */
.tv-page-selector {
  position: relative;
  display: inline-block;
  grid-column: 2;
  justify-self: center;
}
.tv-page-selector-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  font-size: 1.5rem;
  font-weight: 800;
  background: none;
  color: var(--text);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s;
  white-space: nowrap;
  font-family: inherit;
  letter-spacing: -0.01em;
}
.tv-page-selector-btn:hover { color: var(--accent); }
.tv-page-selector-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  z-index: 100;
  padding: 0.3rem 0;
  overflow: hidden;
}
.tv-page-selector.open .tv-page-selector-menu { display: block; }
.tv-page-selector-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.1s;
}
.tv-page-selector-item:hover { background: var(--bg); }
.tv-page-selector-item.active { color: var(--accent); font-weight: 600; }
.page-selector-divider { height: 1px; background: var(--border); margin: 0.3rem 0; }
.page-selector-pin-btn {
  display: flex; align-items: center; gap: 0.5rem;
  width: 100%; padding: 0.55rem 0.85rem; font-size: 0.8rem; font-weight: 500;
  color: var(--text-muted); background: none; border: none; cursor: pointer;
  font-family: inherit; transition: background 0.1s;
}
.page-selector-pin-btn:hover { background: var(--bg); color: var(--text); }

/* ── Tournament picker ── */
.tv-picker {
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}
.tv-picker .subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}
.tv-picker-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 2rem;
}
.tv-picker-item {
  display: block;
  padding: 0.85rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.tv-picker-item:hover {
  border-color: var(--accent);
  background: var(--surface2);
}
.tv-picker-item .picker-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: 0.4rem;
  vertical-align: middle;
}
.picker-badge-sport { background: color-mix(in srgb, var(--color-sport-tennis) 22%, transparent); color: var(--color-sport-tennis); border: 1px solid color-mix(in srgb, var(--color-sport-tennis) 45%, transparent); }
.picker-badge-type { background: var(--color-warning-bg); color: var(--color-warning-text); border: 1px solid var(--color-warning-border); }
.picker-badge-phase { background: var(--yellow); color: var(--color-on-yellow); }
[data-theme="light"] .picker-badge-sport,
html[data-theme="light"] .picker-badge-sport { background: color-mix(in srgb, var(--color-sport-tennis) 15%, transparent); color: color-mix(in srgb, var(--color-sport-tennis) 85%, #000); border: 1px solid color-mix(in srgb, var(--color-sport-tennis) 35%, transparent); }
/* picker-badge-type light/dark handled by --color-warning-* tokens */
.tv-picker-item .picker-alias {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--accent);
  margin-left: 0.5rem;
}
.tv-picker-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}
.tv-picker-form input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.95rem;
}
.tv-picker-form input:focus {
  outline: none;
  border-color: var(--accent);
}
/* Accessible focus ring for keyboard navigation */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tv-picker-form button {
  padding: 0.6rem 1.2rem;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.tv-picker-form button:hover { opacity: 0.9; }

.tv-picker-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}
.tv-picker-archive-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  background: none;
  border: 1px dashed var(--border);
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  margin-bottom: 0.6rem;
  transition: border-color 0.15s, color 0.15s;
}
.tv-picker-archive-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}
.tv-picker-archive-icon { font-size: 0.7rem; }
.tv-picker-archive-count {
  margin-left: auto;
  background: var(--surface2);
  border-radius: 10px;
  padding: 0.05rem 0.5rem;
  font-size: 0.78rem;
}
.tv-picker-list--archive .tv-picker-item {
  opacity: 0.65;
  border-style: dashed;
}
.tv-picker-list--archive .tv-picker-item:hover {
  opacity: 1;
  border-style: solid;
}

/* ── Collapsible sections ── */
details.tv-collapsible { margin-bottom: 1rem; }
summary.tv-collapsible-header {
  cursor: pointer;
  list-style: none;
  padding: 0.55rem 0;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
summary.tv-collapsible-header::-webkit-details-marker { display: none; }
summary.tv-collapsible-header h2 { font-size: var(--text-lg); font-family: var(--font-display); font-weight: 700; color: var(--text); letter-spacing: var(--tracking-display); }
summary.tv-collapsible-header .format-info-btn { margin-left: auto; }
summary.tv-collapsible-header .chevron { color: var(--text-muted); font-size: 0.9rem; transition: transform 0.2s; }
details.tv-collapsible[open] summary.tv-collapsible-header .chevron { transform: rotate(90deg); }

/* ── Champion banner ── */
.champion-banner {
  background: color-mix(in srgb, var(--color-success) 12%, var(--color-bg));
  border: 2px solid var(--green);
  border-radius: var(--radius-dialog);
  padding: 1rem 1.4rem;
  margin-bottom: 1.8rem;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--green);
  text-align: center;
  letter-spacing: -0.01em;
}
/* Espejo: two half-width champion banners side by side */
.champion-banner--half {
  display: inline-block;
  width: calc(50% - 0.5rem);
  font-size: 1.1rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.champion-banner--half:first-of-type { margin-right: 0.5rem; }
@media (max-width: 600px) {
  .champion-banner--half { display: block; width: 100%; margin-right: 0; }
}

/* ── Admin announcement banner ── */
.admin-banner {
  background: var(--color-surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1.4rem;
  margin: 0.4rem 0 1.2rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: pre-line;
}

/* ── Match comment ── */
.match-comment {
  font-size: 0.78rem;
  color: var(--accent);
  font-style: italic;
  margin-top: 0.15rem;
}

html[data-theme="light"] .court-card {
  box-shadow: var(--shadow-sm);
}
html[data-theme="light"] .court-card--yours {
  box-shadow: 0 0 14px color-mix(in srgb, var(--color-success) 22%, transparent);
}
/* standings hover uses --color-hover-overlay, already theme-aware */

/* ── Theme toggle button ── */
.theme-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  transition: border-color 0.15s, color 0.15s;
}
.theme-btn:hover { border-color: var(--accent); color: var(--text); }
.tv-lang-cell {
  display: flex;
  align-items: center;
  justify-self: start;
}
.tv-toggle-btns {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  grid-column: 3;
  justify-self: end;
}

/* ── Responsive ── */

/* Tablet (≤900px): scale stat columns down */
@media (max-width: 900px) {
  .standings-table { font-size: 0.88rem; }
  .standings-table th:nth-child(1),
  .standings-table td:nth-child(1) { width: 2.2rem; }
  .standings-table th:nth-child(3), .standings-table th:nth-child(4),
  .standings-table th:nth-child(5), .standings-table th:nth-child(6),
  .standings-table th:nth-child(7), .standings-table th:nth-child(8),
  .standings-table td:nth-child(3), .standings-table td:nth-child(4),
  .standings-table td:nth-child(5), .standings-table td:nth-child(6),
  .standings-table td:nth-child(7), .standings-table td:nth-child(8) { width: 3.2rem; }
}

@media (max-width: 600px) {
  body { padding: 0.7rem 0.75rem 1.5rem; }

  /* Page selector: bigger touch targets */
  .tv-page-selector-item { padding: 0.7rem 0.85rem; min-height: 44px; }

  /* Header: tighter, title wraps */
  .tv-header { margin-bottom: 1rem; padding-bottom: 0.6rem; gap: 0.3rem; }
  .tv-header-row { gap: 0.6rem; margin-top: 1rem; }
  .tv-tournament-name { font-size: 1.25rem; }
  .tv-meta { gap: 0.4rem; flex-wrap: wrap; }

  /* Court board: single column on phones */
  .court-board { grid-template-columns: 1fr; gap: 0.75rem; }
  .court-match-teams { font-size: 1rem; }

  /* Allow standing sections to scroll horizontally if needed */
  .tv-section { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Standings: natural column widths, no overflow */
  .standings-table { font-size: 0.78rem; table-layout: auto; width: 100%; }
  .standings-table th,
  .standings-table td { padding: 0.25rem 0.3rem; white-space: nowrap; }
  /* Name column can shrink/wrap */
  .standings-table th:nth-child(2),
  .standings-table td:nth-child(2) { white-space: normal; min-width: 5rem; }

  /* GP table on narrow screens: hide D, SL, PF, PA — keep #, Player, P, W, L, (SW, SD), Diff */
  .standings-table[data-type="gp"] .col-d,
  .standings-table[data-type="gp"] .col-sl,
  .standings-table[data-type="gp"] .col-pf,
  .standings-table[data-type="gp"] .col-pa { display: none; }

  /* Mex table (# | Player | Total Pts | Played | W | D | L | Avg Pts): hide Played, D, L */
  .standings-table[data-type="mex"] th:nth-child(4),
  .standings-table[data-type="mex"] td:nth-child(4),
  .standings-table[data-type="mex"] th:nth-child(6),
  .standings-table[data-type="mex"] td:nth-child(6),
  .standings-table[data-type="mex"] th:nth-child(7),
  .standings-table[data-type="mex"] td:nth-child(7) { display: none; }

  /* Picker: less wasted vertical space */
  .tv-picker { margin: 0 auto; padding: 0 0.5rem; }

  /* Selector title: slightly smaller on mobile */
  .tv-page-selector-btn { font-size: 1.1rem; min-height: 38px; }

  /* Touch targets */
  .theme-btn { min-height: 44px; min-width: 44px; }
  .tv-picker-form input,
  .tv-picker-form button { min-height: 44px; font-size: 1rem; }

  /* Bracket: fit the screen on mobile too (no forced horizontal scroll).
     The lightbox remains for full-resolution inspection via tap. */
  .bracket-scroll-wrapper { overflow: visible; }
  .bracket-scroll-wrapper .bracket-img {
    width: auto; max-width: 100%; min-width: 0; max-height: 60vh;
  }
  .bracket-tap-hint { display: block; }
}

/* ── Abbreviation info button ── */
.format-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Visual size is 18px; hit area is padded to 44×44px via padding */
  width: 18px;
  height: 18px;
  padding: 13px;
  margin: -13px;
  font-size: 0.72rem;
  font-weight: 800;
  font-style: italic;
  border: 1.5px solid var(--text-muted);
  border-radius: 50%;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
  transition: color 0.15s, border-color 0.15s;
}
.format-info-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── Abbreviation legend popup ── */
#abbrev-popup {
  display: none;
  position: fixed;
  z-index: 9995;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.82rem;
  pointer-events: none;
}
#abbrev-popup table { border-collapse: collapse; }
#abbrev-popup td {
  padding: 0.12rem 0.5rem 0.12rem 0;
  color: var(--text-muted);
  vertical-align: top;
}
#abbrev-popup td:first-child {
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

/* ─── Player auth bar ──────────────────────── */
.player-bar {
  display: flex; align-items: center; justify-content: center;
  gap: 0.5rem; padding: 0.45rem 1rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
  font-size: 0.82rem; flex-wrap: wrap;
}
.player-bar .player-name { font-weight: 700; color: var(--accent); }
.player-bar button {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 4px; padding: 0.35rem 0.75rem; cursor: pointer; font-size: 0.78rem;
  min-height: 2rem;
}
.player-bar button:hover { border-color: var(--accent); color: var(--accent); }

/* Opponents section within the player bar */
.player-opponents-details {
  width: 100%; border: 1px solid var(--border); border-radius: 6px;
  margin-top: 0.3rem; background: var(--surface2, var(--surface));
  font-size: 0.82rem;
}
.player-opponents-summary {
  cursor: pointer; padding: 0.3rem 0.6rem; font-weight: 600;
  user-select: none; list-style: none;
}
.player-opponents-summary::-webkit-details-marker { display: none; }
.player-opponents-body {
  padding: 0.25rem 0.6rem 0.4rem;
  display: flex; flex-wrap: wrap; gap: 0.4rem;
}
.player-opponents-group {
  flex: 1 1 160px;
  min-width: 140px;
  background: var(--surface2, var(--surface));
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.55rem 0.35rem;
}
.player-opponents-round {
  display: inline-block;
  font-size: 0.68rem; color: var(--accent); font-weight: 600;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 999px; padding: 0.05rem 0.5rem;
  margin-bottom: 0.25rem;
}
.player-opponents-row {
  display: flex; gap: 0.3rem 0.5rem; align-items: baseline;
  padding: 0.1rem 0; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.player-opponents-row:last-child { border-bottom: none; }
.player-opponents-name { font-weight: 600; }
.player-opponents-contact {
  color: var(--accent); word-break: break-all;
  cursor: pointer; border-radius: 3px;
  transition: opacity 0.15s;
}
.player-opponents-contact:hover { opacity: 0.75; }
.player-opponents-contact--copied {
  color: var(--text-muted); font-style: italic; cursor: default;
}
.player-opponents-no-contact { color: var(--text-muted); font-style: italic; }
.player-opponents-empty { color: var(--text-muted); font-size: 0.8rem; padding: 0.3rem 0; }

.player-login-btn {
  background: var(--accent); color: #fff; border: none;
  border-radius: 999px; padding: 0.3rem 0.9rem;
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.3rem;
  transition: opacity 0.15s;
}
.player-login-btn:hover { opacity: 0.85; }

/* ─── Hub CTA banner ─────────────────────────── */
.hub-cta-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.5rem 0.5rem 0 auto;
  padding: 0.4rem 0.55rem 0.4rem 0.75rem;
  background: var(--color-primary-highlight);
  border: 1px solid color-mix(in srgb, var(--color-primary) 30%, var(--border));
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--text);
  max-width: min(560px, 100%);
  width: max-content;
  box-sizing: border-box;
  flex-wrap: nowrap;
}
.hub-cta-banner-text {
  flex: 1 1 auto;
  min-width: 0;
}
.hub-cta-banner-action {
  flex: 0 0 auto;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
}
.hub-cta-banner-action:hover { opacity: 0.85; }
.hub-cta-banner-dismiss {
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1;
  padding: 0.2rem 0.35rem;
  cursor: pointer;
  border-radius: 4px;
}
.hub-cta-banner-dismiss:hover { color: var(--text); background: var(--border); }
@media (max-width: 560px) {
  .hub-cta-banner {
    width: auto;
    max-width: calc(100% - 1rem);
    margin-left: 0.5rem;
    margin-right: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    gap: 0.4rem 0.5rem;
    font-size: 0.8rem;
    padding: 0.4rem 0.5rem;
  }
  .hub-cta-banner-text {
    flex: 1 1 100%;
    text-align: center;
  }
  .hub-cta-banner-action {
    font-size: 0.78rem;
    padding: 0.28rem 0.7rem;
  }
  .hub-cta-banner-dismiss {
    position: absolute;
    top: 2px;
    right: 4px;
  }
  .hub-cta-banner { position: relative; }
}

/* ─── Player Hub section inside the expand panel ────────── */
.player-hub-section {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 0.4rem 0.55rem;
}
.player-hub-section-title {
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em;
  margin-right: 0.15rem;
}
.player-hub-section-passphrase {
  font-family: var(--font-mono);
  font-size: 0.8rem; color: var(--accent);
  background: var(--bg-soft, rgba(0,0,0,0.04));
  padding: 0.1rem 0.4rem; border-radius: 4px;
  cursor: pointer; word-break: break-all;
  transition: opacity 0.15s;
}
.player-hub-section-passphrase:hover { opacity: 0.8; }
.player-hub-section-passphrase--copied {
  color: var(--text-muted); font-style: italic; cursor: default;
}
.player-hub-section-open {
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px; padding: 0.15rem 0.65rem;
  font-size: 0.74rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-left: auto;
}
.player-hub-section-open:hover { background: var(--accent); color: #fff; }
@media (max-width: 480px) {
  .player-hub-section-open { margin-left: 0; }
}

/* ─── Logged-in player session widget ────────── */
#player-login-slot { position: relative; }

.player-session-widget { display: inline-flex; align-items: center; }

/* Pill trigger */
.player-session-trigger {
  background: var(--accent); color: #fff; border: none;
  border-radius: 999px; padding: 0.3rem 0.9rem;
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.3rem;
  transition: opacity 0.15s; white-space: nowrap;
}
.player-session-trigger:hover,
.player-session-trigger--open { opacity: 0.85; }
.player-session-trigger .player-name { font-weight: 700; }
.player-session-chevron { font-size: 0.6rem; opacity: 0.75; }

/* Inline expand panel — new row inside .tv-header */
.player-expand-panel {
  display: flex; flex-direction: column; gap: 0;
  position: relative;
  padding: 0.6rem 0.75rem; margin-top: -0.2rem;
  background: var(--surface2, var(--surface));
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.82rem; animation: expandFadeIn 0.12s ease;
}
@keyframes expandFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.player-expand-inner {
  padding-right: 1.5rem;
}
.player-expand-title {
  display: block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.3rem;
}
.player-expand-footer {
  display: flex; justify-content: flex-end;
  padding-top: 0.45rem; margin-top: 0.45rem;
  border-top: 1px solid var(--border);
}
.player-expand-close {
  position: absolute; top: 0.4rem; right: 0.5rem;
  background: none; border: none; color: var(--text-muted);
  font-size: 0.9rem; cursor: pointer; padding: 0.1rem 0.25rem;
  border-radius: 4px; line-height: 1; transition: color 0.15s;
}
.player-expand-close:hover { color: var(--text); }

/* Opponents content inside expand panel */
.player-expand-panel .player-opponents-body { padding: 0; }
.player-expand-panel .player-opponents-empty { color: var(--text-muted); font-size: 0.8rem; padding: 0.2rem 0; }

/* Shared logout button */
.player-dropdown-footer {
  padding: 0.45rem 0.75rem;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end;
}
.player-dropdown-logout-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 4px; padding: 0.2rem 0.7rem; cursor: pointer; font-size: 0.78rem;
  transition: border-color 0.15s, color 0.15s;
}
.player-dropdown-logout-btn:hover { border-color: var(--red, #ef4444); color: var(--red, #ef4444); }

/* Push notification toggle */
.push-toggle-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 4px; padding: 0.2rem 0.7rem; cursor: pointer; font-size: 0.78rem;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  display: inline-flex; align-items: center; gap: 0.3rem; margin-right: auto;
}
.push-toggle-btn:hover { border-color: var(--accent); color: var(--accent); }
.push-toggle-btn--active { border-color: var(--accent); color: var(--accent); }
.push-toggle-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.push-toggle-icon { font-size: 0.9rem; line-height: 1; }

/* ─── Player login modal ───────────────────── */
.player-login-overlay {
  position: fixed; inset: 0; z-index: 9999; background: var(--color-overlay-backdrop);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.player-login-modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 1.5rem; max-width: 360px; width: 100%; text-align: center;
  position: relative;
}
.player-login-modal-close {
  position: absolute; top: 0.6rem; right: 0.7rem;
  background: none; border: none; color: var(--text-muted);
  font-size: 1rem; cursor: pointer; line-height: 1; padding: 0.1rem 0.3rem;
  border-radius: 4px; transition: color 0.15s;
}
.player-login-modal-close:hover { color: var(--text); }
.player-login-modal h3 { margin: 0 0 0.8rem; font-size: 1.1rem; }
.player-login-modal input {
  width: 100%; padding: 0.55rem 0.7rem; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg); color: var(--text); font-size: 0.95rem;
  margin-bottom: 0.6rem; text-align: center; font-family: var(--font-mono);
}
.player-login-modal .btn {
  display: inline-block; padding: 0.5rem 2rem; border-radius: 6px;
  border: none; cursor: pointer; font-size: 0.88rem; font-weight: 600;
}
.player-login-modal .btn-primary { background: var(--accent); color: #fff; }
.player-login-modal .login-error { color: var(--red); font-size: 0.8rem; min-height: 1.2rem; margin-bottom: 0.3rem; }
.login-passphrase-hint { font-size: 0.75rem; color: var(--text-muted); margin: 0.1rem 0 0.6rem; }

/* ─── Player login modal — separator & Player Hub ─── */
.player-login-separator {
  display: flex; align-items: center; gap: 0.8rem;
  margin: 0.7rem 0 0.6rem; color: var(--text-muted); font-size: 0.78rem;
}
.player-login-separator::before, .player-login-separator::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.btn-player-hub {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  width: 100%; padding: 0.5rem 1rem; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.btn-player-hub:hover { border-color: var(--accent); background: var(--color-primary-highlight); }
.player-hub-icon { font-size: 1rem; }

/* ─── Player score inputs on court cards ───── */
.player-score-form {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 0.25rem; margin-top: 0; flex-shrink: 0;
}
.score-toggle-btn {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.score-toggle-btn:hover {
  background: var(--accent);
  color: #fff;
}
.score-toggle-btn.active {
  background: var(--accent);
  color: #fff;
}
.score-form-body {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 0.25rem;
  animation: scoreFormSlide 0.15s ease;
}
@keyframes scoreFormSlide {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.score-inline-row {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end;
}
.player-score-form input[type="number"] {
  width: 52px; padding: 0.3rem 0.2rem; border: 1px solid var(--border);
  border-radius: 4px; background: var(--bg); color: var(--text);
  font-size: 0.95rem; text-align: center; -moz-appearance: textfield;
}
.player-score-form input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
.score-teams-row { display: flex; align-items: center; gap: 0.3rem; }
.score-dash { color: var(--text-muted); }
.score-error-msg { color: var(--red); font-size: 0.72rem; min-height: 0; text-align: right; }
.player-score-form .score-submit-btn {
  background: var(--green); color: #fff; border: none; border-radius: 6px;
  padding: 0.55rem 1rem; cursor: pointer; font-size: 0.88rem; font-weight: 700;
  min-height: 1.5rem; touch-action: manipulation;
}
.player-score-form .score-submit-btn:disabled {
  opacity: 0.4; cursor: not-allowed;
}
.player-score-mode-toggle {
  display: inline-flex; justify-content: center; gap: 0; margin-bottom: 0.2rem;
  border: 1px solid var(--border); border-radius: 4px; overflow: hidden;
}
.player-score-mode-toggle button {
  background: var(--surface); color: var(--text-muted); border: none;
  padding: 0.2rem 0.7rem; font-size: 0.75rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.player-score-mode-toggle button.active {
  background: var(--accent, #2563eb); color: #fff;
}
.player-score-form .player-sets-grid,
.correct-score-panel .player-sets-grid {
  display: flex; flex-direction: column; gap: 0.25rem; width: 100%;
}
.player-score-form .player-set-row,
.correct-score-panel .player-set-row {
  display: flex; align-items: center; justify-content: flex-end; gap: 0.3rem;
}
.player-score-form .player-set-label,
.correct-score-panel .player-set-label {
  font-size: 0.7rem; font-weight: 600; color: var(--text-muted); width: 22px; text-align: right;
}
.hidden { display: none !important; }

/* ── Score lifecycle UI ───────────────────────────────────────────────── */

/* Pending (submitted by this player, awaiting opponent / undo window) */
.player-score-submitted {
  align-items: flex-end; gap: 0.3rem;
  background: color-mix(in srgb, var(--accent, #2563eb) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent, #2563eb) 35%, transparent);
  border-radius: 6px; padding: 0.45rem 0.65rem;
}
.submitted-score-label { font-size: 0.7rem; color: var(--text-muted); }
.submitted-score-value { font-size: 1.1rem; font-weight: 700; }
.submitted-waiting { font-size: 0.7rem; color: var(--text-muted); font-style: italic; }
.correction-window-countdown { font-size: 0.68rem; color: var(--accent); font-style: italic; margin-top: 0.15rem; }
.correction-window-expired { font-size: 0.68rem; color: var(--text-muted); font-style: italic; margin-top: 0.15rem; }
.dispute-admin-help { font-size: 0.75rem; color: var(--text-muted); margin: 0.15rem 0 0.4rem; font-style: italic; }
.court-card--yours { border-color: var(--green); box-shadow: 0 0 18px color-mix(in srgb, var(--color-success) 25%, transparent); }
.court-card--yours .court-name { color: var(--green); }
.court-yours-badge { display: inline-block; background: var(--green); color: #fff; font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; padding: 0.1rem 0.45rem; border-radius: 999px; flex-shrink: 0; }
.token-expired-notice { font-size: 0.72rem; color: var(--yellow); margin-top: 0.3rem; text-align: center; max-width: 16rem; line-height: 1.3; }

/* Pending score from opponent — accept / correct */
.player-score-pending {
  align-items: flex-end; gap: 0.3rem;
  background: color-mix(in srgb, var(--green, #16a34a) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--green, #16a34a) 30%, transparent);
  border-radius: 6px; padding: 0.45rem 0.65rem;
}
.pending-score-label { font-size: 0.7rem; color: var(--text-muted); }
.pending-score-value { font-size: 1.1rem; font-weight: 700; }
.pending-score-actions { display: flex; gap: 0.4rem; margin-top: 0.2rem; }
.score-accept-btn {
  background: var(--green, #16a34a); color: #fff; border: none;
  border-radius: 6px; padding: 0.55rem 1rem; cursor: pointer;
  font-size: 0.88rem; font-weight: 700; transition: opacity 0.15s;
  min-height: 1.5rem; touch-action: manipulation; white-space: nowrap;
}
.score-accept-btn:hover { opacity: 0.85; }
.score-accept-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.score-correct-btn {
  background: var(--amber, #d97706); color: #fff; border: none;
  border-radius: 6px; padding: 0.55rem 1rem; cursor: pointer;
  font-size: 0.88rem; font-weight: 700; transition: opacity 0.15s;
  min-height: 1.5rem; touch-action: manipulation; white-space: nowrap;
}
.score-correct-btn:hover { opacity: 0.85; }
.correct-score-panel {
  margin-top: 0.4rem; padding-top: 0.4rem;
  border-top: 1px solid var(--border); width: 100%;
}
.correct-score-panel .score-submit-btn {
  background: var(--amber, #d97706); color: #fff; border: none; border-radius: 6px;
  padding: 0.55rem 1rem; cursor: pointer; font-size: 0.88rem; font-weight: 700;
  min-height: 1.5rem; touch-action: manipulation; width: 100%; margin-top: 0.4rem;
}
.correct-score-panel .score-submit-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.correct-score-inputs {
  display: flex; align-items: center; gap: 0.3rem; justify-content: flex-end;
}
.correct-score-inputs input[type="number"],
.correct-score-panel .player-sets-grid input[type="number"] {
  width: 48px; padding: 0.25rem 0.2rem; border: 1px solid var(--border);
  border-radius: 4px; background: var(--bg); color: var(--text);
  font-size: 0.9rem; text-align: center; -moz-appearance: textfield;
}
.correct-score-inputs input[type="number"]::-webkit-inner-spin-button,
.correct-score-panel .player-sets-grid input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
.correct-score-inputs .score-submit-btn {
  background: var(--amber, #d97706);
}

/* Disputed match */
.player-score-dispute {
  align-items: flex-start; gap: 0.25rem;
  background: color-mix(in srgb, var(--red, #dc2626) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--red, #dc2626) 35%, transparent);
  border-radius: 6px; padding: 0.45rem 0.65rem; width: 100%; box-sizing: border-box;
}
.dispute-header { font-size: 0.75rem; font-weight: 700; color: var(--red, #dc2626); }
.dispute-row {
  display: flex; gap: 0.5rem; align-items: baseline;
  font-size: 0.8rem;
}
.dispute-row span { color: var(--text-muted); }
.dispute-row strong { font-size: 1rem; }

/* Escalate / reject button */
.score-escalate-btn {
  background: var(--red, #dc2626); color: #fff; border: none;
  border-radius: 6px; padding: 0.55rem 1rem; cursor: pointer;
  font-size: 0.88rem; font-weight: 700; transition: opacity 0.15s;
  min-height: 1.5rem; touch-action: manipulation; white-space: nowrap;
}
.score-escalate-btn:hover { opacity: 0.85; }
.score-escalate-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* History match badges for pending/disputed */
.history-badge {
  display: inline-flex; align-items: center; margin-left: 0.3rem;
  font-size: 0.7rem; vertical-align: middle;
}
.history-badge-pending { opacity: 0.7; }
.history-badge-dispute { color: var(--amber, #d97706); }

/* Confirmation state on submit button */
.score-submit-confirm {
  background: var(--amber, #d97706) !important;
  animation: pulse-confirm 0.4s ease;
}
@keyframes pulse-confirm {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ── Score confirmation overlay (immediate mode) ─────────────────────── */
.score-confirm-overlay {
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  padding: 0.4rem 0;
  animation: fade-in-confirm 0.2s ease;
}
@keyframes fade-in-confirm {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.confirm-score-value {
  font-size: 1.25rem; font-weight: 700; letter-spacing: 0.02em;
}
.confirm-score-actions {
  display: flex; gap: 0.45rem; align-items: center;
}
.score-confirm-btn {
  background: var(--green, #16a34a); color: #fff; border: none;
  border-radius: 4px; padding: 0.32rem 0.9rem; cursor: pointer;
  font-size: 0.82rem; font-weight: 700; transition: opacity 0.15s;
}
.score-confirm-btn:hover { opacity: 0.85; }
.score-confirm-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.score-cancel-btn {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 4px; padding: 0.3rem 0.7rem; cursor: pointer;
  font-size: 0.78rem; font-weight: 600; transition: background 0.15s;
}
.score-cancel-btn:hover { background: var(--red); color: #fff; border-color: var(--red); }



/* Banner shown above pickers/landing pages when the page is loaded on a club
   subdomain (e.g. ``myclub.amistoso.club/tv`` or ``/register`` or
   ``/player``). Tells the visitor which club the listing is scoped to. */
.player-subdomain-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.5rem 0 1rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-dialog);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  font-size: 0.9rem;
  color: var(--text);
  flex-wrap: wrap;
}
.player-subdomain-logo {
  width: 28px; height: 28px; border-radius: 50%;
  object-fit: cover; flex: 0 0 auto;
}
.player-subdomain-text { flex: 1 1 auto; min-width: 0; }
.player-subdomain-clear {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.78rem; font-weight: 600;
  cursor: pointer;
}
.player-subdomain-clear:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); }

/* -------------------------------------------------------------------------
 * Tournament-scoped player mini-card (clickable name on standings)
 * ------------------------------------------------------------------------- */

.tv-name-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  border-radius: 4px;
}
.tv-name-btn:hover, .tv-name-btn:focus-visible {
  text-decoration: underline;
  color: var(--accent, #2563eb);
  outline: none;
}
.tv-name-btn:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 2px;
}

.tv-player-card-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.tv-player-card-overlay[hidden] { display: none; }

.tv-player-card {
  position: relative;
  background: var(--bg, #fff);
  color: var(--text, #0f172a);
  border-radius: var(--radius-dialog);
  padding: 1.25rem 1.25rem 1rem;
  max-width: min(640px, 95vw);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.tv-player-card-close {
  position: absolute;
  top: 0.4rem;
  right: 0.6rem;
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}
.tv-player-card-close:hover { background: var(--bg-muted, #f1f5f9); color: var(--text); }
.tv-player-card-loading,
.tv-player-card-error {
  text-align: center;
  padding: 2rem 0;
  color: var(--text-muted);
}
.tv-player-card-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1rem;
  text-align: center;
  padding: 0 2rem;
}
.tv-player-card-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.tv-player-stat {
  background: var(--bg-muted, #f8fafc);
  border-radius: 8px;
  padding: 0.5rem 0.5rem;
  text-align: center;
}
.tv-player-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.tv-player-stat-value {
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tv-player-delta-up { color: var(--green, #16a34a); }
.tv-player-delta-down { color: var(--red, #dc2626); }
.tv-player-delta-flat { color: var(--text-muted); }

.tv-player-recent {
  border-top: 1px solid var(--border, #e2e8f0);
  padding-top: 0.75rem;
}
.tv-player-recent > .elo-log {
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.tv-player-recent-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 0.75rem 0;
}

/* TV mini-card: emphasise the team line + score, like the club mini-card */
.tv-player-recent .elo-log-round {
  font-size: 0.74rem;
}
.tv-player-recent .elo-log-teams {
  font-size: 0.95rem;
  color: var(--text);
}
.tv-player-recent .elo-score-sep {
  font-size: 1rem;
}
.tv-player-recent .elo-vs-sep {
  font-size: 0.9rem;
}

/* Compact match log (shared with player history hub styling) */
.elo-log {
  display: flex;
  flex-direction: column;
}
.elo-log-row {
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.elo-log-row:last-child { border-bottom: none; }
.elo-log-row--inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.elo-log-row--inline > .elo-log-teams { flex: 1 1 auto; min-width: 0; margin-top: 0; }
.elo-log-row--inline > .elo-transition { margin-left: auto; }
.elo-log-row--nested { padding: 0; border-bottom: none; }
.elo-log-round {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-muted, #f1f5f9);
  border-radius: 4px;
  padding: 0.05rem 0.4rem;
  white-space: nowrap;
}
.elo-log-sub {
  margin-left: 0.3rem;
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.elo-log-main {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.elo-log-name {
  font-weight: 600;
  font-size: 0.84rem;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.elo-log-dim {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.elo-transition {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  background: var(--bg, #fff);
}
.elo-transition--gain {
  color: #22863a;
  border-color: rgba(34, 134, 58, 0.35);
  background: rgba(34, 134, 58, 0.1);
}
.elo-transition--loss {
  color: #cb2431;
  border-color: rgba(203, 36, 49, 0.35);
  background: rgba(203, 36, 49, 0.1);
}
.elo-transition--neutral {
  color: var(--text-muted);
}
.elo-log-teams {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 0.1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0.3rem;
  align-items: center;
}
.elo-team {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.elo-team--a { text-align: right; }
.elo-team--b { text-align: left; }
.elo-score-sep {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.elo-vs-sep {
  color: var(--text-muted);
  font-size: 0.82rem;
}

@media (max-width: 560px) {
  .tv-player-card { padding: 1rem 0.85rem 0.85rem; }
  .tv-player-card-stats { grid-template-columns: repeat(2, 1fr); }
  .tv-player-card-name { font-size: 1.1rem; }
}
