/****************************************************************************************************/
/* CVSL Tables — unified table system
 *
 * Base:     class="cvsl-table"
 * Modifiers: cvsl-table--fixed | --summary | --compact | --fixtures | --positions
 *
 * Examples:
 *   League / handicaps / high breaks  →  cvsl-table cvsl-table--fixed
 *   Player season stats               →  cvsl-table cvsl-table--summary
 *   Fixtures / competitions           →  cvsl-table cvsl-table--fixtures
 *   Match positions                   →  cvsl-table cvsl-table--positions
 *
 * Per-cell tweaks: use Tailwind utilities (py-3, text-center, w-8, etc.)
 * Footnotes below tables:             →  .cvsl-adjustments
 ****************************************************************************************************/

/* ==================================================================================================
   Design tokens
   ================================================================================================== */

.cvsl-table {
  --cvsl-table-bg: #ffffff;
  --cvsl-table-text: #111827;
  --cvsl-table-muted: #374151;
  --cvsl-table-header-bg: #f3f4f6;
  --cvsl-table-row-hover: #f9fafb;
  --cvsl-table-emerald-hover: #ecfdf5;
  --cvsl-table-red-hover: #fef2f2;
  --cvsl-table-border: #e5e7eb;
  --cvsl-table-border-strong: #d1d5db;
  --cvsl-table-focus: #10b981;
  --cvsl-indicator-win: #34d399;
  --cvsl-indicator-lost: #f87171;
  --cvsl-indicator-draw: #d1d5db;
  --cvsl-indicator-black: #000000;
  --cvsl-indicator-emerald: #059669;
  --cvsl-divider-green: #4ade80;
  --cvsl-divider-red: #f87171;
  --cvsl-negative: #ef4444;
  --cvsl-points-negative: #b91c1c;
  --cvsl-score-separator: #facc15;
  --cvsl-table-font-size: clamp(0.75rem, 2vw, 1.125rem);
  --cvsl-table-header-font-size: clamp(0.75rem, 2vw, 1.125rem);
  --cvsl-adjustments-font-size: clamp(0.8125rem, 2vw, 0.9375rem);

  width: 100%;
  min-width: 100%;
  color: var(--cvsl-table-text);
  font-size: var(--cvsl-table-font-size);
  background-color: var(--cvsl-table-bg);
  border-collapse: collapse;
  table-layout: auto;
}

/* ==================================================================================================
   Modifiers — layout variants
   ================================================================================================== */

/* League tables, handicaps, player lists, high breaks */
.cvsl-table--fixed,
.cvsl-table-fixed {
  table-layout: fixed;
}

/* Competition standings: keep name dominant and stat columns compact */
.cvsl-table--competition-standings {
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

.cvsl-table--competition-standings th:nth-child(1),
.cvsl-table--competition-standings td:nth-child(1) {
  width: 11%;
}

.cvsl-table--competition-standings th:nth-child(2),
.cvsl-table--competition-standings td:nth-child(2) {
  width: 40%;
}

.cvsl-table--competition-standings th:nth-child(3),
.cvsl-table--competition-standings td:nth-child(3),
.cvsl-table--competition-standings th:nth-child(4),
.cvsl-table--competition-standings td:nth-child(4),
.cvsl-table--competition-standings th:nth-child(5),
.cvsl-table--competition-standings td:nth-child(5) {
  width: 15%;
}

.cvsl-table--competition-standings th:nth-child(6),
.cvsl-table--competition-standings td:nth-child(6) {
  width: 4%;
  text-align: right;
}

.cvsl-table--competition-standings th,
.cvsl-table--competition-standings td {
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

@media (min-width: 1024px) {
  .cvsl-table--competition-standings th:nth-child(1),
  .cvsl-table--competition-standings td:nth-child(1) {
    width: 13%;
    padding-right: 0.9rem;
  }

  .cvsl-table--competition-standings th:nth-child(2),
  .cvsl-table--competition-standings td:nth-child(2) {
    width: 38%;
    padding-left: 0.75rem;
  }
}

/* League standings: keep position + chevron stable, let middle stats flow. */
.cvsl-table--league {
  table-layout: auto;
}

.cvsl-table--league th:first-child,
.cvsl-table--league td:first-child {
  width: 3rem;
  min-width: 3rem;
  text-align: center;
  white-space: nowrap;
}

.cvsl-table--league th:nth-child(2),
.cvsl-table--league td:nth-child(2) {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Handicaps tables */
.cvsl-table--handicaps {
  table-layout: auto;
}

.cvsl-table--handicaps thead th {
  white-space: nowrap;
}

.cvsl-table--handicaps thead tr {
  letter-spacing: 0.02em;
}

.cvsl-table.cvsl-table--handicaps th.cvsl-col-player:first-child {
  width: clamp(8.5rem, 32vw, 14rem);
  text-align: left;
}

.cvsl-table--handicaps td.cvsl-cell-player {
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.cvsl-table--handicaps th:nth-child(2),
.cvsl-table--handicaps td:nth-child(2),
.cvsl-table--handicaps th:nth-child(3),
.cvsl-table--handicaps td:nth-child(3) {
  width: clamp(5.25rem, 11vw, 7.25rem);
}

@media (min-width: 1024px) {
  .cvsl-table--handicaps {
    table-layout: fixed;
  }

  .cvsl-table--handicaps th:first-child,
  .cvsl-table--handicaps td:first-child {
    width: 34%;
  }

  .cvsl-table--handicaps th:nth-child(2),
  .cvsl-table--handicaps td:nth-child(2),
  .cvsl-table--handicaps th:nth-child(3),
  .cvsl-table--handicaps td:nth-child(3),
  .cvsl-table--handicaps th:nth-child(4),
  .cvsl-table--handicaps td:nth-child(4),
  .cvsl-table--handicaps th:nth-child(5),
  .cvsl-table--handicaps td:nth-child(5) {
    width: 15%;
  }

  .cvsl-table--handicaps th:nth-child(6),
  .cvsl-table--handicaps td:nth-child(6) {
    width: 6%;
    text-align: center;
  }
}

@media (max-width: 720px) {
  .cvsl-table--handicaps thead tr {
    letter-spacing: 0.01em;
    font-size: 0.92em;
  }

  .cvsl-table--handicaps th:nth-child(2),
  .cvsl-table--handicaps td:nth-child(2),
  .cvsl-table--handicaps th:nth-child(3),
  .cvsl-table--handicaps td:nth-child(3) {
    width: clamp(4.6rem, 15vw, 5.5rem);
  }
}

/* Player season stats: keep Season + Handicap readable and stable */
.cvsl-table--season-stats {
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

.cvsl-table--season-stats th:first-child,
.cvsl-table--season-stats td:first-child {
  width: 34%;
  text-align: left;
  white-space: nowrap;
}

.cvsl-table--season-stats th:nth-child(2),
.cvsl-table--season-stats td:nth-child(2) {
  width: 18%;
  white-space: nowrap;
}

.cvsl-table--season-stats th:nth-child(3),
.cvsl-table--season-stats td:nth-child(3),
.cvsl-table--season-stats th:nth-child(4),
.cvsl-table--season-stats td:nth-child(4),
.cvsl-table--season-stats th:nth-child(5),
.cvsl-table--season-stats td:nth-child(5) {
  width: 13%;
}

.cvsl-table--season-stats th:nth-child(6),
.cvsl-table--season-stats td:nth-child(6) {
  width: 9%;
  text-align: center;
}

@media (max-width: 720px) {
  .cvsl-table--season-stats thead tr {
    letter-spacing: 0.01em;
    font-size: 0.92em;
  }

  .cvsl-table--season-stats th:first-child,
  .cvsl-table--season-stats td:first-child {
    width: 30%;
  }

  .cvsl-table--season-stats th:nth-child(2),
  .cvsl-table--season-stats td:nth-child(2) {
    width: 20%;
  }

  .cvsl-table--season-stats th:nth-child(3),
  .cvsl-table--season-stats td:nth-child(3),
  .cvsl-table--season-stats th:nth-child(4),
  .cvsl-table--season-stats td:nth-child(4),
  .cvsl-table--season-stats th:nth-child(5),
  .cvsl-table--season-stats td:nth-child(5) {
    width: 14%;
  }

  .cvsl-table--season-stats th:nth-child(6),
  .cvsl-table--season-stats td:nth-child(6) {
    width: 8%;
  }
}

/* Season stats / compact stat grids */
.cvsl-table--summary,
.cvsl-table--compact {
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

/* Match positions grids */
.cvsl-table--positions {
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

.cvsl-table--positions th,
.cvsl-table--positions td {
  text-align: center;
  white-space: nowrap;
  width: 25%;
}

.cvsl-table--summary th,
.cvsl-table--summary td,
.cvsl-table--compact th,
.cvsl-table--compact td {
  padding: 0.55rem 0.35rem;
  text-align: center;
  white-space: nowrap;
}

.cvsl-table--summary th,
.cvsl-table--compact th {
  font-weight: 700;
}

.cvsl-table--summary abbr,
.cvsl-table--compact abbr {
  text-decoration: none;
  cursor: help;
}

.cvsl-table--summary td:first-child,
.cvsl-table--compact td:first-child {
  font-weight: 600;
}

.cvsl-table--summary th:first-child,
.cvsl-table--summary td:first-child {
  width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.cvsl-table--summary th:last-child,
.cvsl-table--summary td:last-child {
  width: 2rem;
  padding-right: 0.25rem;
  padding-left: 0.25rem;
}

.cvsl-table--summary svg {
  display: inline-block;
  vertical-align: middle;
}

/* Fixtures / competitions — 3-column home | centre | away */
.cvsl-table--fixtures {
  table-layout: fixed;
}

.cvsl-table--fixtures td {
  text-align: left;
  vertical-align: middle;
  padding: 0.5rem;
  white-space: nowrap;
}

.cvsl-table--fixtures .cvsl-cell--center {
  text-align: center !important;
}

.cvsl-table--fixtures .cvsl-cell--left {
  text-align: right !important;
  position: relative;
}

.cvsl-table--fixtures .cvsl-cell--right {
  text-align: left !important;
}

.cvsl-table--fixtures .cvsl-cell--with-arrow {
  padding-right: 2rem;
}

.cvsl-table--fixtures .cvsl-profile-arrow {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
}

/* Left accent bar in fixture cells */
.cvsl-table--fixtures .cvsl-cell--left > span:is(
  .cvsl-accent,
  .indicator,
  .bg-win,
  .bg-lost,
  .bg-draw,
  .bg-gray,
  .bg-black,
  .bg-emerald
) {
  position: absolute;
  top: 0;
  right: auto;
  bottom: 0;
  left: 0;
  z-index: 0;
  width: 0.25rem;
}

.cvsl-table--fixtures .cvsl-accent {
  background-color: var(--cvsl-indicator-draw);
}

.cvsl-table--fixtures .cvsl-accent--win {
  background-color: var(--cvsl-indicator-win);
}

/* Fixture rows */
.cvsl-table--fixtures .cvsl-row {
  position: relative;
  border-top: 1px solid var(--cvsl-table-border);
  border-bottom: 1px solid var(--cvsl-table-border);
  transition: background-color 150ms ease;
}

.cvsl-table--fixtures .cvsl-row:hover {
  background-color: var(--cvsl-table-row-hover);
}

.cvsl-table--fixtures .cvsl-row--clickable {
  cursor: pointer;
}

.cvsl-table--fixtures .cvsl-row--clickable:active {
  background-color: var(--cvsl-table-header-bg);
}

.cvsl-table--fixtures .cvsl-row--clickable:focus-visible {
  outline: 2px solid var(--cvsl-indicator-emerald);
  outline-offset: 2px;
}

.cvsl-table--fixtures .cvsl-spacer {
  height: 0.15rem;
  padding: 0;
  background-color: var(--cvsl-table-row-hover);
}

.cvsl-table--fixtures .cvsl-spacer--lg {
  height: 0.5rem;
}

/* Score display (fixtures with results) */
.cvsl-table--fixtures .cvsl-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  line-height: 1;
}

.cvsl-table--fixtures .cvsl-score-separator {
  width: 0.25rem;
  height: 1.2em;
  background-color: var(--cvsl-score-separator);
  border-radius: 2px;
  display: inline-block;
}

/* ==================================================================================================
   Header
   ================================================================================================== */

.cvsl-table thead tr {
  color: var(--cvsl-table-text);
  background-color: var(--cvsl-table-header-bg);
  border-bottom: 1px solid var(--cvsl-table-border-strong);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: var(--cvsl-table-header-font-size);
}

.cvsl-table th {
  vertical-align: middle;
  font-weight: 600;
}

@media (min-width: 1024px) {
  .cvsl-table--competition-standings thead th:nth-child(1) {
    padding-right: 1.25rem;
  }

  .cvsl-table--competition-standings thead th:nth-child(2) {
    padding-left: 1rem;
  }
}

.cvsl-table th:first-child:not([class*="w-"]) {
  width: 2.5rem;
}

.cvsl-table .rank-col,
.cvsl-table .indicator-col {
  width: 2.5rem;
}

/* ==================================================================================================
   Body
   ================================================================================================== */

.cvsl-table:not(.cvsl-table--fixtures) tbody {
  color: var(--cvsl-table-text);
  line-height: 1.25;
}

.cvsl-table:not(.cvsl-table--fixtures) tbody tr {
  position: relative;
  border-bottom: 1px solid var(--cvsl-table-border);
  cursor: default;
  transition: background-color 150ms ease;
}

.cvsl-table:not(.cvsl-table--fixtures) tbody tr:hover {
  background-color: var(--cvsl-table-row-hover);
}

.cvsl-table tbody tr.hover-emerald:hover {
  background-color: var(--cvsl-table-emerald-hover);
}

.cvsl-table tbody tr.hover-red:hover {
  background-color: var(--cvsl-table-red-hover);
}

.cvsl-table tbody tr.cursor-pointer,
.cvsl-table tbody tr[onclick] {
  cursor: pointer;
}

.cvsl-table tbody tr:focus-visible,
.cvsl-table a:focus-visible {
  outline: 3px solid var(--cvsl-table-focus);
  outline-offset: -3px;
}

.cvsl-table th:last-child,
.cvsl-table td:last-child {
  width: 2rem;
  text-align: right;
  padding-right: 0.5rem;
}

/* ==================================================================================================
   Cells — default padding when Tailwind classes are absent
   ================================================================================================== */

.cvsl-table:not(.cvsl-table--fixtures) th,
.cvsl-table:not(.cvsl-table--fixtures) td {
  vertical-align: middle;
}

.cvsl-table:not(.cvsl-table--summary):not(.cvsl-table--compact):not(.cvsl-table--fixtures) th:not([class*="py-"]),
.cvsl-table:not(.cvsl-table--summary):not(.cvsl-table--compact):not(.cvsl-table--fixtures) td:not([class*="py-"]) {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.cvsl-table:not(.cvsl-table--summary):not(.cvsl-table--compact):not(.cvsl-table--fixtures) th:not([class*="px-"]):not([class*="pl-"]),
.cvsl-table:not(.cvsl-table--summary):not(.cvsl-table--compact):not(.cvsl-table--fixtures) td:not([class*="px-"]):not([class*="pl-"]) {
  padding-left: 0.5rem;
}

.cvsl-table:not(.cvsl-table--summary):not(.cvsl-table--compact):not(.cvsl-table--fixtures) th:not([class*="px-"]):not([class*="pr-"]),
.cvsl-table:not(.cvsl-table--summary):not(.cvsl-table--compact):not(.cvsl-table--fixtures) td:not([class*="px-"]):not([class*="pr-"]) {
  padding-right: 0.5rem;
}

/* Rank / indicator column */
.cvsl-table td:first-child,
.cvsl-table td.w-8 {
  position: relative;
}

.cvsl-table td.w-8 {
  width: 2rem;
}

/* Left indicator bar — data-grid tables */
.cvsl-table:not(.cvsl-table--fixtures) td:first-child > span:is(
  .indicator,
  .bg-win,
  .bg-lost,
  .bg-draw,
  .bg-gray,
  .bg-black,
  .bg-emerald
),
.cvsl-table:not(.cvsl-table--fixtures) td.w-8 > span:is(
  .indicator,
  .bg-win,
  .bg-lost,
  .bg-draw,
  .bg-gray,
  .bg-black,
  .bg-emerald
) {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  width: 0.25rem;
}

.cvsl-table:not(.cvsl-table--fixtures) td:first-child > span:is(
  .indicator,
  .bg-win,
  .bg-lost,
  .bg-draw,
  .bg-gray,
  .bg-black,
  .bg-emerald
) + *,
.cvsl-table:not(.cvsl-table--fixtures) td.w-8 > span:is(
  .indicator,
  .bg-win,
  .bg-lost,
  .bg-draw,
  .bg-gray,
  .bg-black,
  .bg-emerald
) + * {
  position: relative;
  z-index: 1;
}

/* ==================================================================================================
   Indicator colours (shared across all table types)
   ================================================================================================== */

.cvsl-table .bg-win {
  background-color: var(--cvsl-indicator-win);
}

.cvsl-table .bg-lost {
  background-color: var(--cvsl-indicator-lost);
}

.cvsl-table .bg-draw,
.cvsl-table .bg-gray {
  background-color: var(--cvsl-indicator-draw);
}

.cvsl-table .bg-black {
  background-color: var(--cvsl-indicator-black);
}

.cvsl-table .bg-emerald {
  background-color: var(--cvsl-indicator-emerald);
}

/* ==================================================================================================
   Divider rows (promotion / relegation zones)
   ================================================================================================== */

.cvsl-table .divider-green,
.cvsl-table .divider-red {
  width: 100%;
  height: 2px;
  margin: 0;
}

.cvsl-table:not(.cvsl-table--summary):not(.cvsl-table--compact):not(.cvsl-table--fixtures) tbody tr.cvsl-divider-row td {
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}

.cvsl-table .divider-green {
  background-color: var(--cvsl-divider-green);
}

.cvsl-table .divider-red {
  background-color: var(--cvsl-divider-red);
}

/* ==================================================================================================
   Scoped utilities — prefer Tailwind on new markup; kept for legacy HTML
   ================================================================================================== */

.cvsl-table .text-left {
  text-align: left;
}

.cvsl-table .text-center {
  text-align: center;
}

.cvsl-table .font-semibold {
  font-weight: 600;
}

.cvsl-table .text-red,
.cvsl-table .cvsl-negative {
  color: var(--cvsl-negative);
}

.cvsl-table .text-muted {
  color: var(--cvsl-table-muted);
}

.cvsl-table .whitespace-nowrap {
  white-space: nowrap;
}

.cvsl-table .overflow-hidden {
  overflow: hidden;
}

.cvsl-table .text-ellipsis {
  text-overflow: ellipsis;
}

.cvsl-table .max-w-48 {
  max-width: 12rem;
}

/* ==================================================================================================
   Adjustments / footnotes below tables
   ================================================================================================== */

.cvsl-adjustments {
  margin-top: 0.25rem;
  padding-top: 0.75rem;
}

.cvsl-adjustments ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.cvsl-adjustments li {
  color: var(--cvsl-table-muted);
  font-size: var(--cvsl-adjustments-font-size);
  font-style: italic;
  line-height: 1.35;
  margin-bottom: 0.25rem;
}

.cvsl-adjustments .team-name {
  font-weight: 700;
  font-style: normal;
}

.cvsl-adjustments .points {
  color: var(--cvsl-points-negative);
  font-weight: 600;
  font-style: normal;
}

/* ==================================================================================================
   Result badges (fixture result pages)
   ================================================================================================== */

.cvsl-result {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.35rem auto 0;
  line-height: 1;
}

.cvsl-result-win,
.cvsl-result-loss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
}

.cvsl-result-win {
  background-color: #16a34a;
}

.cvsl-result-loss {
  background-color: #dc2626;
}

.cvsl-result-score {
  font-weight: 700;
  white-space: nowrap;
}

/* ==================================================================================================
   Motion
   ================================================================================================== */

@media (prefers-reduced-motion: reduce) {
  .cvsl-table tbody tr,
  .cvsl-table--fixtures .cvsl-row {
    transition: none;
  }
}

/* ==================================================================================================
   Legacy aliases — remove once HTML is migrated
   ================================================================================================== */

/* Data-grid tables: leaguetable, players, handicaps, highbreaks, competitionplayers */
.leaguetable,
.players,
.handicaps,
.highbreaks,
.competitionplayers {
  --cvsl-table-bg: #ffffff;
  --cvsl-table-text: #111827;
  --cvsl-table-muted: #374151;
  --cvsl-table-header-bg: #f3f4f6;
  --cvsl-table-row-hover: #f9fafb;
  --cvsl-table-emerald-hover: #ecfdf5;
  --cvsl-table-red-hover: #fef2f2;
  --cvsl-table-border: #e5e7eb;
  --cvsl-table-border-strong: #d1d5db;
  --cvsl-table-focus: #10b981;
  --cvsl-indicator-win: #34d399;
  --cvsl-indicator-lost: #f87171;
  --cvsl-indicator-draw: #d1d5db;
  --cvsl-indicator-black: #000000;
  --cvsl-indicator-emerald: #059669;
  --cvsl-divider-green: #4ade80;
  --cvsl-divider-red: #f87171;
  --cvsl-negative: #ef4444;
  --cvsl-table-font-size: clamp(0.75rem, 2vw, 1.125rem);
  --cvsl-table-header-font-size: clamp(0.75rem, 2vw, 1.125rem);

  width: 100%;
  min-width: 100%;
  color: var(--cvsl-table-text);
  font-size: var(--cvsl-table-font-size);
  background-color: var(--cvsl-table-bg);
  border-collapse: collapse;
  table-layout: fixed;
}

.leaguetable thead tr,
.players thead tr,
.handicaps thead tr,
.highbreaks thead tr,
.competitionplayers thead tr {
  color: var(--cvsl-table-text);
  background-color: var(--cvsl-table-header-bg);
  border-bottom: 1px solid var(--cvsl-table-border-strong);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: var(--cvsl-table-header-font-size);
}

.leaguetable th,
.players th,
.handicaps th,
.highbreaks th,
.competitionplayers th {
  vertical-align: middle;
  font-weight: 600;
}

.leaguetable tbody,
.players tbody,
.handicaps tbody,
.highbreaks tbody,
.competitionplayers tbody {
  color: var(--cvsl-table-text);
  line-height: 1.25;
}

.leaguetable tbody tr,
.players tbody tr,
.handicaps tbody tr,
.highbreaks tbody tr,
.competitionplayers tbody tr {
  position: relative;
  border-bottom: 1px solid var(--cvsl-table-border);
  cursor: default;
  transition: background-color 150ms ease;
}

.leaguetable tbody tr:hover,
.players tbody tr:hover,
.handicaps tbody tr:hover,
.highbreaks tbody tr:hover,
.competitionplayers tbody tr:hover {
  background-color: var(--cvsl-table-row-hover);
}

.leaguetable tbody tr.hover-emerald:hover,
.players tbody tr.hover-emerald:hover,
.handicaps tbody tr.hover-emerald:hover,
.highbreaks tbody tr.hover-emerald:hover,
.competitionplayers tbody tr.hover-emerald:hover {
  background-color: var(--cvsl-table-emerald-hover);
}

.leaguetable tbody tr.hover-red:hover,
.players tbody tr.hover-red:hover,
.handicaps tbody tr.hover-red:hover,
.highbreaks tbody tr.hover-red:hover,
.competitionplayers tbody tr.hover-red:hover {
  background-color: var(--cvsl-table-red-hover);
}

.leaguetable tbody tr.cursor-pointer,
.players tbody tr.cursor-pointer,
.handicaps tbody tr.cursor-pointer,
.leaguetable tbody tr[onclick],
.players tbody tr[onclick],
.handicaps tbody tr[onclick] {
  cursor: pointer;
}

.leaguetable th,
.leaguetable td,
.players th,
.players td,
.handicaps th,
.handicaps td,
.highbreaks th,
.highbreaks td,
.competitionplayers th,
.competitionplayers td {
  vertical-align: middle;
}

.leaguetable td:first-child,
.leaguetable td.w-8,
.players td:first-child,
.players td.w-8,
.handicaps td:first-child,
.handicaps td.w-8,
.highbreaks td.w-8,
.competitionplayers td.w-8 {
  position: relative;
}

.leaguetable td.w-8,
.players td.w-8,
.handicaps td.w-8,
.highbreaks td.w-8,
.competitionplayers td.w-8 {
  width: 2rem;
}

.leaguetable td:first-child > span:is(.indicator, .bg-win, .bg-lost, .bg-draw, .bg-gray, .bg-black, .bg-emerald),
.leaguetable td.w-8 > span:is(.indicator, .bg-win, .bg-lost, .bg-draw, .bg-gray, .bg-black, .bg-emerald),
.players td:first-child > span:is(.indicator, .bg-win, .bg-lost, .bg-draw, .bg-gray, .bg-black, .bg-emerald),
.handicaps td:first-child > span:is(.indicator, .bg-win, .bg-lost, .bg-draw, .bg-gray, .bg-black, .bg-emerald),
.leaguetable td span,
.highbreaks td span,
.competitionplayers td span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  width: 0.25rem;
}

.leaguetable .bg-win,
.players .bg-win,
.handicaps .bg-win,
.highbreaks .bg-win,
.competitionplayers .bg-win,
.fixtures-table .bg-win,
.competitions-table .bg-win { background-color: #34d399; }

.leaguetable .bg-lost,
.players .bg-lost,
.handicaps .bg-lost,
.highbreaks .bg-lost,
.competitionplayers .bg-lost,
.fixtures-table .bg-lost,
.competitions-table .bg-lost { background-color: #f87171; }

.leaguetable .bg-draw,
.leaguetable .bg-gray,
.players .bg-draw,
.players .bg-gray,
.handicaps .bg-draw,
.handicaps .bg-gray,
.highbreaks .bg-draw,
.highbreaks .bg-gray,
.competitionplayers .bg-draw,
.competitionplayers .bg-gray,
.fixtures-table .bg-draw,
.fixtures-table .bg-gray,
.competitions-table .bg-draw,
.competitions-table .bg-gray { background-color: #d1d5db; }

.leaguetable .bg-black,
.players .bg-black,
.handicaps .bg-black,
.highbreaks .bg-black,
.competitionplayers .bg-black,
.fixtures-table .bg-black,
.competitions-table .bg-black { background-color: #000; }

.leaguetable .bg-emerald,
.players .bg-emerald,
.handicaps .bg-emerald,
.highbreaks .bg-emerald,
.competitionplayers .bg-emerald,
.fixtures-table .bg-emerald,
.competitions-table .bg-emerald { background-color: #059669; }

.leaguetable .divider-green,
.players .divider-green,
.handicaps .divider-green,
.highbreaks .divider-green {
  width: 100%;
  height: 2px;
  margin: 0.25rem 0;
  background-color: #4ade80;
}

.leaguetable .divider-red,
.players .divider-red,
.handicaps .divider-red,
.highbreaks .divider-red {
  width: 100%;
  height: 2px;
  margin: 0.25rem 0;
  background-color: #f87171;
}

.leaguetable .text-red,
.players .text-red,
.handicaps .text-red,
.highbreaks .text-red { color: #ef4444; }

/* players--summary / players--compact */
.players--summary,
.players--compact {
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

.players--summary th,
.players--summary td,
.players--compact th,
.players--compact td {
  padding: 0.55rem 0.35rem;
  text-align: center;
  white-space: nowrap;
}

.players--summary th,
.players--compact th { font-weight: 700; }

.players--summary abbr,
.players--compact abbr {
  text-decoration: none;
  cursor: help;
}

.players--summary td:first-child,
.players--compact td:first-child { font-weight: 600; }

.players--summary th:first-child,
.players--summary td:first-child {
  width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.players--summary th:last-child,
.players--summary td:last-child {
  width: 2rem;
  padding-right: 0.25rem;
  padding-left: 0.25rem;
}

.players--summary svg {
  display: inline-block;
  vertical-align: middle;
}

/* Adjustments legacy class names */
.leaguetable-adjustments,
.players-adjustments,
.handicaps-adjustments,
.highbreaks-adjustments {
  margin-top: 0.25rem;
  padding-top: 0.75rem;
}

.leaguetable-adjustments ul,
.players-adjustments ul,
.handicaps-adjustments ul,
.highbreaks-adjustments ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.leaguetable-adjustments li,
.players-adjustments li,
.handicaps-adjustments li,
.highbreaks-adjustments li {
  font-style: italic;
  color: #374151;
  line-height: 1.35;
  margin-bottom: 0.25rem;
  font-size: clamp(0.8125rem, 2vw, 0.9375rem);
}

.leaguetable-adjustments .team-name,
.players-adjustments .team-name,
.handicaps-adjustments .team-name,
.highbreaks-adjustments .team-name {
  font-weight: 700;
  font-style: normal;
}

.leaguetable-adjustments .points,
.players-adjustments .points,
.handicaps-adjustments .points,
.highbreaks-adjustments .points {
  font-weight: 600;
  font-style: normal;
  color: #b91c1c;
}

/* Fixtures / competitions legacy */
.fixtures-table,
.competitions-table {
  width: 100%;
  background: #ffffff;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: clamp(0.75rem, 2vw, 1.125rem);
  color: #111827;
}

.fixtures-table td,
.competitions-table td {
  text-align: left;
  vertical-align: middle;
  padding: 0.5rem;
  white-space: nowrap;
}

.fixture-cell--center,
.competitions-cell--center { text-align: center !important; }

.fixture-cell--left,
.competitions-cell--left {
  text-align: right !important;
  position: relative;
}

.fixture-cell--right,
.competitions-cell--right { text-align: left !important; }

/* Keep competition content centered while pinning the arrow column to the far right */
.competitions-table th:nth-child(-n+3),
.competitions-table td:nth-child(-n+3) {
  width: calc((100% - 2.5rem) / 3);
  text-align: center !important;
}

.competitions-table th:last-child,
.competitions-table td:last-child {
  width: 2.5rem;
  text-align: right !important;
  padding-right: 0.25rem;
}

.competitions-table td:first-child {
  position: relative;
}

.fixture-score,
.competitions-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  line-height: 1;
}

.fixture-score-separator,
.competitions-score-separator {
  width: 0.25rem;
  height: 1.2em;
  background-color: #facc15;
  border-radius: 2px;
  display: inline-block;
}

.competitions-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0.25rem;
  background-color: #d1d5db;
}

.competitions-accent--win { background-color: #34d399; }

.fixture-row,
.competitions-row {
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  transition: background-color 150ms ease;
}

.fixture-row:hover,
.competitions-row:hover { background-color: #f9fafb; }

.fixture-row--clickable,
.competitions-row--clickable { cursor: pointer; }

.fixture-row--clickable:active,
.competitions-row--clickable:active { background-color: #f3f4f6; }

.fixture-row--clickable:focus-visible,
.competitions-row--clickable:focus-visible {
  outline: 2px solid #059669;
  outline-offset: 2px;
}

.fixture-spacer { height: 0.15rem; background-color: #f9fafb; }
.competitions-spacer { height: 0.5rem; background-color: #f9fafb; }

.fixtures-table td > span {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0.25rem;
  z-index: 0;
}

/* Result badges legacy names */
.result-container { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin: 0.35rem auto 0; line-height: 1; }
.result-win, .result-loss { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 4px; color: #fff; font-size: 16px; font-weight: 700; }
.result-win { background-color: #16a34a; }
.result-loss { background-color: #dc2626; }
.result-score { font-weight: 700; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .leaguetable tbody tr,
  .players tbody tr,
  .handicaps tbody tr,
  .highbreaks tbody tr,
  .competitionplayers tbody tr,
  .fixture-row,
  .competitions-row {
    transition: none;
  }
}