:root {
  --bg: #0f1115;
  --bg-elev: #161a21;
  --bg-elev-2: #1c212a;
  --stroke: #262b35;
  --stroke-strong: #353c49;
  --text: #e6e8ec;
  --text-secondary: #9aa1ad;
  --text-tertiary: #6b7180;
  --accent: #6ea8ff;
  --accent-strong: #4d8ff0;
  --success: #5ec38a;
  --warning: #e0a96d;
  --danger: #e26a6a;
  --row-info: rgba(110, 168, 255, 0.08);
  --row-success: rgba(94, 195, 138, 0.08);
  --row-warning: rgba(224, 169, 109, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

body {
  min-height: 100vh;
  padding: 24px clamp(16px, 4vw, 48px) 80px;
}

main {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 1100px;
  margin: 0 auto;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.section-header h2 {
  margin: 0;
}

.section-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Collapsible sections — clickable header with leading chevron. */
.section-toggle {
  cursor: pointer;
  user-select: none;
}

.section-toggle:hover h2 {
  color: var(--accent);
}

.chevron {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  vertical-align: middle;
  color: var(--text-secondary);
  transition: transform 0.15s ease;
}

.chevron svg {
  display: block;
  width: 100%;
  height: 100%;
}

section.section-collapsed .chevron {
  transform: rotate(-90deg);
}

section.section-collapsed > *:not(.section-toggle) {
  display: none !important;
}

/* Closed market sections (admin toggle off): visible but greyed and
   un-clickable. Server-side validation also rejects bets on closed
   sections, so this is layered defense. */
.section-closed .section-header h2 {
  color: var(--text-secondary);
}

.section-closed .section-header h2::after {
  content: "Closed";
  margin-left: 10px;
  display: inline-block;
  vertical-align: middle;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-tertiary);
  border: 1px solid var(--stroke-strong);
}

.section-closed .table-wrap {
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}

/* Single closed columns inside an otherwise-open table (To Win or Top 3
   alone). Cells fade and stop responding to clicks. */
td.market-closed,
th.market-closed {
  opacity: 0.45;
  pointer-events: none;
}

th.market-closed::after {
  content: " · closed";
  font-weight: 400;
  font-size: 10px;
  text-transform: lowercase;
  color: var(--text-tertiary);
  letter-spacing: 0;
}

.devils-table .col-team {
  width: 110px;
  font-weight: 500;
}

.ryder-table .col-team {
  font-weight: 500;
}

.devils-table .col-members {
  font-size: 13px;
  color: var(--text-secondary);
}

.team-members {
  display: inline-block;
  line-height: 1.5;
}

.birdie-table .col-odds {
  width: 95px;
}

.frl-table .col-tee {
  width: 64px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.fourball-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.fourball-card {
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--bg-elev);
  overflow: hidden;
}

.fourball-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-elev-2);
  padding: 8px 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--stroke);
}

.fourball-round-pill {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--stroke-strong);
  color: var(--text-secondary);
  background: var(--bg);
}

.fourball-table {
  width: 100%;
  border-collapse: collapse;
}

.fourball-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--stroke);
}

.fourball-table tbody tr:last-child td {
  border-bottom: none;
}

.fourball-table .fb-name {
  font-weight: 500;
}

/* H2H matchup cards (Round 1 + Tournament). Shares the fourball-card chrome
 * but with two rows per card and a Cap badge under each player name. */
.h2h-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.h2h-card {
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--bg-elev);
  overflow: hidden;
}

.h2h-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-elev-2);
  padding: 8px 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--stroke);
  font-variant-numeric: tabular-nums;
}

.score-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--stroke-strong);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.score-pill.score-net {
  color: var(--text-secondary, #9aa3b2);
  background: rgba(120, 130, 150, 0.10);
}

.score-pill.score-gross {
  color: #f0c265;
  background: rgba(240, 194, 101, 0.12);
  border-color: rgba(240, 194, 101, 0.4);
}

.h2h-table {
  width: 100%;
  border-collapse: collapse;
}

.h2h-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--stroke);
}

.h2h-table tbody tr:last-child td {
  border-bottom: none;
}

.h2h-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-weight: 500;
}

.h2h-name-text {
  line-height: 1.15;
}

.h2h-cap {
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* Round 1 Hole 1 props table */
.hole1-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.hole1-table th,
.hole1-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--stroke);
}
.hole1-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
.hole1-table .col-rank   { width: 36px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.hole1-table .col-player { font-weight: 500; min-width: 120px; }
.hole1-table .col-num    { width: 56px; text-align: right; font-variant-numeric: tabular-nums; }
.hole1-table .col-odds   { width: 88px; text-align: right; }

@media (max-width: 720px) {
  .hole1-table .col-rank,
  .hole1-table .col-player {
    position: sticky;
    background: var(--bg);
    z-index: 1;
  }
  .hole1-table .col-rank   { left: 0; }
  .hole1-table .col-player { left: 36px; border-right: 1px solid var(--stroke); }
}

/* Admin: head-to-head setup form */
.h2h-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.h2h-form select {
  background: var(--bg);
  border: 1px solid var(--stroke-strong);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  font-size: 13px;
  min-width: 160px;
}

.h2h-vs {
  color: var(--text-dim);
  font-weight: 500;
  padding: 0 2px;
}

/* Categorical 45-hole markets (Winning Net Score, Margin of Victory) */
.categorical-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.categorical-table th,
.categorical-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--stroke);
}
.categorical-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
.categorical-table .col-bucket {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.categorical-table .col-odds {
  width: 110px;
  text-align: right;
}

.h2h-odds-input {
  width: 70px;
  background: var(--bg);
  border: 1px solid var(--stroke-strong);
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--text);
  font-size: 13px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Parlay modal */
.modal-wide {
  max-width: 540px;
}

.parlay-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.parlay-group {
  border: 1px solid var(--stroke);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--bg-elev-2);
}

.parlay-group-closed {
  opacity: 0.55;
  pointer-events: none;
}

.parlay-group-closed .parlay-group-head {
  color: var(--text-tertiary);
}

.parlay-group-head {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.parlay-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.parlay-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--stroke-strong);
  border-radius: 4px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  text-align: left;
}

.parlay-option:hover:not(:disabled) {
  background: rgba(110, 168, 255, 0.08);
  border-color: var(--accent);
}

.parlay-option.selected {
  border-color: var(--accent);
  background: rgba(110, 168, 255, 0.16);
  color: var(--text);
}

.parlay-option:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.parlay-option.parlay-skip {
  justify-content: center;
  font-size: 12px;
  color: var(--text-tertiary);
}

.po-name {
  flex: 1;
  margin-right: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.po-odds {
  font-variant-numeric: tabular-nums;
}

.parlay-summary {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-elev-2);
  border: 1px solid var(--stroke);
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 14px;
}

.parlay-summary > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.parlay-summary .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

/* Parlay row in the bets table */
.parlay-bet {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.parlay-bet-head {
  font-weight: 500;
}

.parlay-bet-legs {
  margin: 0;
  padding-left: 16px;
  list-style: disc;
  font-size: 12px;
  color: var(--text-secondary);
}

.status-pill {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--stroke-strong);
  white-space: nowrap;
}

.status-pill.status-pending {
  color: var(--text-tertiary);
  border-color: var(--stroke-strong);
}

.status-pill.status-won {
  color: var(--success);
  border-color: rgba(94, 195, 138, 0.4);
}

.status-pill.status-lost {
  color: var(--danger);
  border-color: rgba(226, 106, 106, 0.4);
}

.status-pill.status-push {
  color: var(--text-secondary);
  border-color: var(--stroke-strong);
  background: rgba(180, 180, 180, 0.06);
}

.net-positive {
  color: var(--success);
  font-weight: 600;
}

.net-negative {
  color: var(--danger);
  font-weight: 600;
}

.standings-table .col-player {
  font-weight: 500;
}

.odds-off {
  display: inline-block;
  width: 100%;
  text-align: right;
  color: var(--text-tertiary);
  padding: 6px 10px;
  font-variant-numeric: tabular-nums;
}

.page-header {
  max-width: 1100px;
  margin: 0 auto 24px;
}

.header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h2 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.meta {
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.meta a {
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px dotted var(--stroke-strong);
}

.meta a:hover {
  color: var(--text);
  border-bottom-color: var(--text-secondary);
}

.tagline {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.table-wrap {
  border: 1px solid var(--stroke);
  border-radius: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-elev);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--stroke);
}

thead th {
  background: var(--bg-elev-2);
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom-color: var(--stroke-strong);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

.col-rank {
  width: 36px;
  color: var(--text-tertiary);
}

.col-num {
  width: 56px;
  text-align: right;
}

.col-num,
td.num,
th.num {
  text-align: right;
}

.col-net {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.col-odds {
  width: 110px;
  text-align: right;
}

.col-player {
  font-weight: 500;
}

.row-info { background-color: var(--row-info) !important; }
.row-success { background-color: var(--row-success) !important; }
.row-warning { background-color: var(--row-warning) !important; }
.row-push    { background-color: rgba(160, 160, 170, 0.05) !important; }

.manual-flag {
  margin-left: 6px;
  color: var(--warning);
  font-size: 11px;
}

/* Odds buttons */
.odds-btn {
  display: inline-block;
  width: 100%;
  padding: 6px 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--stroke-strong);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: right;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.odds-btn:hover {
  background: rgba(110, 168, 255, 0.12);
  border-color: var(--accent);
}

.odds-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.odds-btn.has-action {
  border-color: rgba(94, 195, 138, 0.5);
  color: var(--success);
}

.odds-btn.is-manual {
  border-style: dashed;
}

/* Bets */
.bets-section h2 {
  margin: 0;
}

.bets-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.bets-summary {
  font-size: 12px;
  color: var(--text-secondary);
}

.bets-search {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.bets-search input[type="search"] {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--stroke-strong);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font: inherit;
}

.bets-search input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
}

.bets-table .market-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--bg-elev-2);
  border: 1px solid var(--stroke-strong);
  color: var(--text-secondary);
}

.bets-table .market-pill.outright {
  color: var(--accent);
  border-color: rgba(110, 168, 255, 0.4);
}

.bets-table .market-pill.top3 {
  color: var(--success);
  border-color: rgba(94, 195, 138, 0.4);
}

.empty-row td {
  text-align: center;
  color: var(--text-tertiary);
  padding: 24px 12px;
}

.mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 14, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--bg-elev);
  border: 1px solid var(--stroke-strong);
  border-radius: 10px;
  width: 100%;
  max-width: 380px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--stroke);
  flex: 0 0 auto;
}

.modal form {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.icon-btn:hover {
  background: var(--bg-elev-2);
  color: var(--text);
}

#bet-form {
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 14px;
}

.bet-summary {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  padding: 12px 14px;
  background: var(--bg-elev-2);
  border: 1px solid var(--stroke);
  border-radius: 6px;
  font-size: 13px;
}

.bet-summary > div {
  display: contents;
}

.bet-summary .label,
.field .label,
.payout-line .label {
  color: var(--text-secondary);
  font-size: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field input {
  background: var(--bg);
  border: 1px solid var(--stroke-strong);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
}

.field input:invalid:not(:placeholder-shown) {
  border-color: var(--danger);
}

.payout-line {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid var(--stroke);
  font-size: 13px;
}

#bet-payout {
  font-size: 16px;
  font-weight: 600;
  color: var(--success);
}

.form-error {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--danger);
  background: rgba(226, 106, 106, 0.08);
  color: var(--danger);
  border-radius: 6px;
  font-size: 12px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.btn {
  border: 1px solid var(--stroke-strong);
  background: var(--bg-elev-2);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
}

.btn:hover:not(:disabled) {
  border-color: var(--accent);
}

.btn.primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #08101e;
  font-weight: 600;
}

.btn.primary:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
}

.btn.ghost {
  background: transparent;
  border-color: var(--stroke);
  color: var(--text-secondary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.danger {
  background: transparent;
  border-color: rgba(226, 106, 106, 0.5);
  color: var(--danger);
}

.btn.danger:hover:not(:disabled) {
  background: rgba(226, 106, 106, 0.12);
  border-color: var(--danger);
}

.btn.sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 5px;
}

/* Admin */
.meta-link {
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px solid var(--stroke-strong);
}

.meta-link:hover {
  color: var(--text);
  border-bottom-color: var(--text-secondary);
}

.login-card {
  max-width: 360px;
  margin: 24px auto;
  padding: 24px;
  background: var(--bg-elev);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-card h2 {
  margin: 0;
  font-size: 18px;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  margin-bottom: 16px;
}

.admin-toolbar .spacer {
  flex: 1;
}

#rebalance-status {
  color: var(--text-secondary);
  font-size: 12px;
}

.market-controls {
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--bg-elev);
  overflow: hidden;
}

.market-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--stroke);
}

.market-row:last-child {
  border-bottom: none;
}

.market-label {
  font-weight: 500;
}

.market-status {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--stroke-strong);
}

.market-status.open {
  color: var(--success);
  border-color: rgba(94, 195, 138, 0.4);
}

.market-status.closed {
  color: var(--text-tertiary);
  border-color: var(--stroke-strong);
}

/* Admin grading panels */
.grade-card {
  border: 1px solid var(--stroke);
  background: var(--bg-elev);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.grade-head {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.grade-current {
  margin: 0 0 8px;
  color: var(--text-secondary);
  font-size: 12px;
}

.grade-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.grade-form select,
.grade-form input[type="text"],
.grade-form textarea {
  background: var(--bg);
  border: 1px solid var(--stroke-strong);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  font: inherit;
}

.grade-form textarea {
  resize: vertical;
  min-height: 90px;
  font-family: inherit;
}

.grade-tied {
  font-size: 12px;
}

.grade-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.grade-yesno {
  flex-direction: row;
  flex-wrap: wrap;
}

.grade-counts {
  max-height: 360px;
  overflow-y: auto;
}

.grade-count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}

.grade-count-input,
.scores-input {
  width: 64px;
  background: var(--bg);
  border: 1px solid var(--stroke-strong);
  border-radius: 4px;
  padding: 4px 6px;
  color: var(--text);
  font: inherit;
  text-align: right;
}

.scores-input {
  width: 60px;
}

@media (max-width: 640px) {
  body {
    padding: 16px 12px 60px;
  }

  th,
  td {
    padding: 7px 8px;
  }

  .col-odds {
    width: 90px;
  }

  /* Force wider tables to preserve their column widths so the wrapper
     scrolls horizontally instead of crushing everything together. */
  .bets-table,
  .standings-table {
    min-width: 620px;
  }

  .devils-table {
    min-width: 500px;
  }

  /* Constrain the Player column on mobile so the frozen region is tight to
     the name (matches what the birdie table feels like). Long names are
     truncated with ellipsis. */
  .odds-table .col-player,
  .birdie-table .col-player,
  .frl-table .col-player {
    width: 140px;
    min-width: 140px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Keep timestamps, odds, and money values on a single line on mobile —
     wrapping turns the bets table into a tall mess. */
  .bets-table td,
  .bets-table th {
    white-space: nowrap;
  }

  /* Freeze the player/team identifying columns so they stay visible while
     the rest of the table scrolls horizontally. We freeze the # + Player
     pair on tables that have a rank column, and just the Team column on
     Devil's Game. */
  .col-rank {
    width: 36px;
  }

  .odds-table .col-rank,
  .birdie-table .col-rank,
  .frl-table .col-rank,
  .odds-table .col-player,
  .birdie-table .col-player,
  .frl-table .col-player,
  .devils-table .col-team {
    position: sticky;
    z-index: 2;
    background: var(--bg-elev);
  }

  /* Header cells keep their darker thead tint when frozen. */
  .odds-table thead .col-rank,
  .birdie-table thead .col-rank,
  .frl-table thead .col-rank,
  .odds-table thead .col-player,
  .birdie-table thead .col-player,
  .frl-table thead .col-player,
  .devils-table thead .col-team {
    background: var(--bg-elev-2);
  }

  .odds-table .col-rank,
  .birdie-table .col-rank,
  .frl-table .col-rank,
  .devils-table .col-team {
    left: 0;
  }

  .odds-table .col-player,
  .birdie-table .col-player,
  .frl-table .col-player {
    left: 36px;
  }

  /* A subtle border marks the frozen edge so it's clear which side scrolls. */
  .odds-table .col-player,
  .birdie-table .col-player,
  .frl-table .col-player,
  .devils-table .col-team {
    border-right: 1px solid var(--stroke-strong);
  }
}
