/* ============================================================
   Tour Events — live Masters-style leaderboard + bottom-left
   scorebug. Modelled on the Masters manual board / TV graphic:
   deep green board, Fraunces serif names, RED numerals under
   par, GREEN over par, brass highlight for the "me" row.
   ============================================================ */

:root {
  --tour-board-bg:  #0a2417;         /* deep Masters green board */
  --tour-board-bg2: #0e2c1c;
  --tour-line:      rgba(207, 168, 94, 0.22);  /* brass hairline */
  --tp-over:        #6fae5a;         /* over par — green numerals */
}

/* To-par numerals: base colors live in css/base.css (.tp-under/over/even).
   The board + scorebug sit on a dark Masters-green panel, so override over/even
   here for contrast (green over-par, muted even). Under-par red is shared. */
#tour-board .tp-over, #tour-bug .tp-over { color: var(--tp-over); }
#tour-board .tp-even, #tour-bug .tp-even { color: var(--text-muted); }

/* ---- Full-screen board ------------------------------------ */
#tour-board {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet-low);
  display: flex;
  align-items: stretch;
  justify-content: center;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(46,125,79,0.18), transparent 60%),
    var(--green-900);
  padding: max(var(--sat), 8px) 0 max(var(--sab), 0px);
}
#tour-board.hidden { display: none; }

.tb-box {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--tour-board-bg2), var(--tour-board-bg));
  border-left: var(--border-hair);
  border-right: var(--border-hair);
  overflow: hidden;
}

.tb-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-3) var(--s-2);
  border-bottom: 1px solid var(--tour-line);
}
.tb-event {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.2px;
  color: var(--brass-400);
  line-height: 1.1;
}
.tb-round {
  margin-top: 3px;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--w-70);
}
.tb-coursename { margin-top: 2px; font-size: 12px; color: var(--text-faint); }
.tb-x {
  flex: none;
  width: 34px; height: 34px;
  border: 1px solid var(--tour-line);
  border-radius: var(--r-md);
  background: transparent;
  color: var(--w-70);
  font-size: 15px;
  cursor: pointer;
}
.tb-x:active { background: var(--w-08); }

/* Pane toggle: these single-class element rules out-order the base .hidden, so
   spell out the hidden state specifically or the leaderboard table / actions /
   back arrow leak onto the schedule pane. */
#tour-board .tb-table-wrap.hidden,
#tour-board .tb-actions.hidden,
#tour-board .tb-rounds.hidden,
#tour-board .tb-card.hidden,
#tb-back.hidden { display: none; }

.tb-table-wrap { flex: 1; overflow-y: auto; overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* table-layout:fixed so the declared numeric column widths are honored and the
   PLAYER cell takes the remainder + ellipsizes, instead of the name growing to
   full content and shoving the table past a phone's width (clipping TOTAL). */
.tb-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.tb-table thead th {
  position: sticky; top: 0;
  background: var(--tour-board-bg);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--brass-600);
  font-weight: 700;
  text-align: right;
  padding: 8px 10px;
  border-bottom: 1px solid var(--tour-line);
}
.tb-table thead th.tb-name { text-align: left; }
.tb-table thead th.tb-pos  { text-align: center; }

.tb-table tbody td {
  padding: 9px 10px;
  font-size: 15px;
  color: var(--text);
  border-bottom: 1px solid rgba(207,168,94,0.10);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tb-table td.tb-pos  { text-align: center; color: var(--w-55); font-size: 13px; width: 40px; }
.tb-table td.tb-name {
  text-align: left;
  font-family: var(--font-display);
  font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  overflow: hidden;                 /* clip the flex cell to its fixed-layout width */
}
/* the name text ellipsizes (flag stays put); min-width:0 lets it shrink in flex */
.tb-table td.tb-name .tb-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-table td.tb-total { font-weight: 700; }
.tb-table td.tb-today, .tb-table td.tb-thru { color: var(--text-muted); font-size: 13px; }
/* Column widths live on the HEADER row: with table-layout:fixed the browser
   derives every column's width from the first row (thead), so widths on the
   <td> alone are ignored and the columns split evenly (crushing PLAYER). */
.tb-table thead th.tb-pos { width: 40px; }
.tb-table thead th.tb-today, .tb-table thead th.tb-thru { width: 52px; }
.tb-table thead th.tb-total { width: 60px; }

.tb-flag { width: 20px; height: 14px; object-fit: cover; border-radius: 2px; flex: none; background: var(--w-08); }

/* "me" row — brass highlight, gold rail */
.tb-table tbody tr.tb-me td {
  background: rgba(207, 168, 94, 0.14);
  border-bottom-color: rgba(207,168,94,0.30);
}
.tb-table tbody tr.tb-me td.tb-pos { box-shadow: inset 3px 0 0 var(--brass-400); }
.tb-table tbody tr.tb-me td.tb-name { color: var(--brass-400); }

.tb-actions {
  display: flex; gap: var(--s-2);
  padding: var(--s-3);
  border-top: 1px solid var(--tour-line);
}
.tb-btn-ghost, .tb-btn-tee {
  flex: 1;
  padding: 12px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--tour-line);
}
.tb-btn-ghost { background: transparent; color: var(--w-70); }
.tb-btn-ghost:active { background: var(--w-08); }
.tb-btn-tee {
  background: var(--brass-600);
  border-color: var(--brass-400);
  color: #1c1408;
}
.tb-btn-tee:disabled { opacity: 0.5; }
.tb-btn-ghost.hidden, .tb-btn-tee.hidden { display: none; }
.tb-credit { padding: 0 var(--s-3) var(--s-3); margin: 0; font-size: 10px; color: var(--text-faint); text-align: center; }

/* ---- Finish result window (place + real payout) ----------- */
#tour-result, #daily-result {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);                 /* above the board */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(var(--sat), 16px) 16px max(var(--sab), 16px);
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(46,125,79,0.22), transparent 60%),
    rgba(4, 16, 10, 0.86);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
#tour-result.hidden, #daily-result.hidden { display: none; }
.tr-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
  padding: var(--s-4) var(--s-4) var(--s-3);
  border-radius: var(--r-lg, 16px);
  border: 1px solid var(--tour-line);
  background: linear-gradient(180deg, var(--tour-board-bg2), var(--tour-board-bg));
  box-shadow: var(--shadow-3, 0 12px 48px rgba(0,0,0,0.5));
}
.tr-event {
  font-size: 13px;
  letter-spacing: 0.4px;
  color: var(--brass-400);
  text-transform: uppercase;
  margin-bottom: var(--s-3);
}
.tr-place-label { font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--w-55); }
.tr-place {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 64px;
  line-height: 1;
  color: var(--brass-400);
  margin: 4px 0 6px;
}
.tr-place-sub { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tr-money {
  margin: var(--s-3) 0;
  padding: var(--s-3) 0;
  border-top: 1px solid var(--tour-line);
  border-bottom: 1px solid var(--tour-line);
}
.tr-payout {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 34px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.tr-purse { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.tr-actions { display: flex; gap: var(--s-2); margin-top: var(--s-3); }

/* ---- My round list + hole-by-hole scorecard (panes 3 & 4) -----------
   Round rows borrow the .tb-sched-row geometry; the card reuses the .re-sc
   table SHAPE from modals.css but must restate colour, because that family is
   tuned for the light --surface-panel and lands dark-on-dark on this pine
   board (.re-cell-par is literally color: var(--text)). scoreClass() still
   supplies the cell classes, so the birdie/bogey mapping stays in one place. */
.tb-rounds, .tb-card { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tb-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3); width: 100%;
  padding: 14px var(--s-3);
  background: transparent; border: none;
  border-bottom: 1px solid rgba(207,168,94,0.10);
  text-align: left; cursor: pointer; color: var(--text);
}
.tb-row:active { background: var(--w-08); }
.tb-row[disabled] { cursor: default; opacity: 0.75; }
.tb-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tb-row-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.tb-row-sub { font-size: 11px; color: var(--text-faint); }
.tb-row-meta { display: flex; align-items: baseline; gap: 10px; flex: none; font-variant-numeric: tabular-nums; }
.tb-row-strokes { font-size: 17px; font-weight: 700; }
.tb-row-topar { font-size: 13px; min-width: 30px; text-align: right; }
.tb-rounds-tot {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 14px var(--s-3); margin-top: 4px;
  border-top: 1px solid var(--tour-line);
  font-family: var(--font-display); font-size: 15px; color: var(--brass-400);
}

.tb-card-head { padding: var(--s-3) var(--s-3) 0; }
.tb-card-name { font-family: var(--font-display); font-size: 18px; color: var(--brass-400); }
.tb-card-sub  { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.tb-card .seg { margin: var(--s-2) var(--s-3); }
.tb-card-note { padding: 18px var(--s-3); text-align: center; color: var(--text-dim); font-size: 13px; }
.tb-sc-wrap { padding: 0 var(--s-3) var(--s-3); overflow-x: auto; }
.tb-sc {
  width: 100%; border-collapse: collapse; margin-top: var(--s-2);
  font-variant-numeric: tabular-nums; font-size: 12px;
}
.tb-sc th, .tb-sc td { text-align: center; padding: 5px 2px; color: var(--w-70); }
.tb-sc thead th { font-size: 10px; letter-spacing: 0.5px; color: var(--brass-600); }
.tb-sc .re-label {
  text-align: left !important; padding-left: 2px !important;
  font-size: 10px; letter-spacing: 0.5px; color: var(--brass-600);
}
.tb-sc .re-sep { font-weight: 800; border-left: 1px solid var(--tour-line); padding-left: 6px !important; color: var(--text); }
/* Restate the score-cell palette for the dark board. These MUST be td-qualified:
   the generic `.tb-sc td` colour rule above is (0,1,1) and would otherwise beat a
   bare `.re-cell-*` class (0,1,0), which flattens the solid birdie/eagle chips to
   the same dim cream as every other cell. */
.tb-sc td.re-cell-eagle  { color: #1a1a1a; }
.tb-sc td.re-cell-birdie { color: #fff; }
.tb-sc td.re-cell-par    { color: var(--w-70); }
.tb-sc td.re-cell-bogey  { color: #e8b06a; }
.tb-sc td.re-cell-double { color: #e07a5f; font-weight: 700; }

/* ---- Season schedule list (front pane) ------------------- */
.tb-schedule {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.tb-schedule.hidden { display: none; }
.tb-sched-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  width: 100%;
  padding: 12px var(--s-3);
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(207,168,94,0.10);
  text-align: left;
  cursor: pointer;
  color: var(--text);
}
.tb-sched-row:active { background: var(--w-08); }
.tb-sched-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tb-sched-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-sched-date { font-size: 11px; color: var(--text-faint); }
.tb-sched-sub {
  font-size: 11px; color: var(--text-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-sched-meta { display: flex; align-items: center; gap: 8px; flex: none; }
.tb-sched-prog { font-size: 10px; color: var(--brass-400); font-variant-numeric: tabular-nums; }

/* Section headers grouping the season (Live / Ready to play / …) */
.tb-sched-group {
  position: sticky; top: 0;
  z-index: 1;
  display: flex; align-items: center; gap: 8px;
  padding: 10px var(--s-3) 5px;
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--brass-600);
  background: var(--tour-board-bg);
  border-bottom: 1px solid var(--tour-line);
}
.tb-sched-count {
  font-size: 9.5px; color: var(--text-faint);
  border: 1px solid var(--tour-line); border-radius: 999px;
  padding: 1px 6px; letter-spacing: 0.5px;
}

.tb-badge {
  font-size: 9.5px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: var(--r-sm, 6px);
  border: 1px solid var(--tour-line);
  white-space: nowrap;
}
.tb-badge-live { color: #ff5b5b; border-color: rgba(255,91,91,0.5); }
.tb-badge-final { color: var(--w-55); }
.tb-badge-up { color: var(--brass-400); border-color: var(--brass-600); }
.tb-badge-x { color: var(--text-faint); }
/* Playability chips */
.tb-chip-play  { color: #1c1408; background: var(--brass-600); border-color: var(--brass-400); }
.tb-chip-watch { color: var(--w-55); }
.tb-chip-lock  { color: var(--text-faint); border-style: dashed; }

/* ---- Bottom-left live scorebug (during gameplay) ---------- */
#tour-bug {
  position: fixed;
  left: calc(var(--sal) + 8px);
  bottom: calc(var(--sab) + 8px);
  z-index: 18;
  width: 210px;
  background: linear-gradient(180deg, rgba(14,44,28,0.94), rgba(10,36,23,0.94));
  border: 1px solid var(--tour-line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2, 0 4px 16px rgba(0,0,0,0.4));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  overflow: hidden;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
#tour-bug.hidden { display: none; }
.tbug-head {
  padding: 5px 8px;
  font-size: 9.5px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--brass-400);
  background: rgba(0,0,0,0.25);
  border-bottom: 1px solid var(--tour-line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tbug-row {
  display: flex; align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 12.5px;
  color: var(--text);
}
.tbug-pos { width: 18px; color: var(--w-45); font-size: 11px; text-align: right; }
.tbug-name {
  flex: 1;
  font-family: var(--font-display);
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tbug-thru { width: 20px; text-align: right; color: var(--text-faint); font-size: 10.5px; }
.tbug-total { width: 30px; text-align: right; font-weight: 700; }
.tbug-row.tbug-me { background: rgba(207,168,94,0.16); }
.tbug-row.tbug-me .tbug-name { color: var(--brass-400); }
.tbug-cut {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 8px;
  font-size: 10px; letter-spacing: 0.5px;
  color: var(--w-55);
  border-top: 1px solid var(--tour-line);
  background: rgba(0,0,0,0.2);
}
.tbug-cut.hidden { display: none; }
.tbug-cut b { color: var(--w-85); font-weight: 700; }
.tbug-cut .tbug-made   { color: var(--tp-over); font-weight: 700; }
.tbug-cut .tbug-missed { color: var(--status-under); font-weight: 700; }

/* Phones: thinner + hugging the left edge. */
@media (max-width: 640px) {
  #tour-bug {
    left: calc(var(--sal) + 2px);
    bottom: calc(var(--sab) + 6px);
    width: 156px;
    border-radius: var(--r-sm, 10px);
  }
  .tbug-head { padding: 4px 6px; font-size: 8.5px; letter-spacing: 0.3px; }
  .tbug-row { padding: 3px 6px; gap: 4px; font-size: 11px; }
  .tbug-pos { width: 14px; font-size: 9.5px; }
  .tbug-thru { width: 16px; font-size: 9px; }
  .tbug-total { width: 26px; }
  .tbug-cut { padding: 3px 6px; font-size: 8.5px; }

  /* Leaderboard board: tighten cells + trim the numeric columns so the PLAYER
     column keeps room on a ~390px phone (fixed layout ellipsizes the name). */
  .tb-table thead th { padding: 8px 6px; }
  .tb-table tbody td { padding: 9px 6px; font-size: 14px; }
  .tb-table thead th.tb-pos  { width: 32px; }
  .tb-table thead th.tb-today, .tb-table thead th.tb-thru { width: 42px; }
  .tb-table thead th.tb-total { width: 48px; }
}

/* ---- Round-end "next round / cut / results" note ---------- */
.re-tour-note { text-align: center; font-size: 13px; margin-bottom: 8px; color: var(--text-muted); }
.re-tour-note.made   { color: var(--tp-over); font-weight: 700; }
.re-tour-note.missed { color: var(--status-under); font-weight: 700; }
