*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary: #002B1E;
  --bg-surface: #003D24;
  --bg-hover: rgba(255,255,255,0.03);
  --bg-expanded: #002517;
  --gold: #FFC72C;
  --gold-muted: #B8973A;
  --gold-dim: rgba(255,199,44,0.3);
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255,255,255,0.6);
  --text-dim: rgba(255,255,255,0.3);
  --score-under: #CE1141;
  --score-over: #AAAAAA;
  --score-even: #FFFFFF;
  --border-subtle: rgba(255,255,255,0.08);
  --border-header: rgba(255,255,255,0.15);
  --border-money: #FFC72C;
}

body {
  background: linear-gradient(180deg, #002B1E 0%, #003D24 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: 'Source Sans 3', -apple-system, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ===== ACCESS GATE ===== */
.gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.gate-inner {
  text-align: center;
  max-width: 320px;
  width: 100%;
}

.gate-brand {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--gold);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.gate-title {
  font-family: 'Source Sans 3', sans-serif;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 300;
  margin-bottom: 48px;
}

#gate-form input {
  width: 100%;
  padding: 12px 0;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 16px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--gold-muted);
  color: var(--text-primary);
  text-align: center;
  letter-spacing: 3px;
  outline: none;
  transition: border-color 0.2s;
}

#gate-form input::placeholder { color: var(--text-dim); letter-spacing: 1px; }
#gate-form input:focus { border-bottom-color: var(--gold); }
#gate-form input.shake-error { border-bottom-color: var(--score-under); }

#gate-form button {
  margin-top: 32px;
  padding: 12px 32px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
  cursor: pointer;
  transition: all 0.2s;
}

#gate-form button:hover { background: var(--gold); color: #002B1E; }

.gate-error {
  color: var(--score-under);
  margin-top: 12px;
  font-size: 13px;
  min-height: 18px;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.shake { animation: shake 0.3s ease-in-out; }

/* ===== GOLD TOP LINE ===== */
.gold-line { height: 2px; background: var(--gold); width: 100%; }

/* ===== HEADER ===== */
.header {
  text-align: center;
  padding: 40px 20px 20px;
}

.header h1 {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--gold);
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 4px;
}

.header-brand {
  color: var(--gold-muted);
  font-size: 13px;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.header-rule {
  width: 60px;
  height: 1px;
  background: var(--gold-muted);
  opacity: 0.3;
  margin: 0 auto 16px;
}

.header-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  justify-content: center;
  gap: 16px;
  align-items: center;
}

/* ===== VIEWER COUNT ===== */
.viewer-count { display: flex; align-items: center; gap: 5px; }

.viewer-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ===== REFRESH BAR ===== */
.refresh-bar {
  height: 2px;
  background: var(--bg-surface);
  width: 100%;
}

.refresh-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--gold);
  transition: width 1s linear;
}

/* ===== YOUR POSITION BANNER ===== */
.your-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface);
  border-left: 3px solid var(--gold);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
}

.your-banner #your-info { color: var(--text-primary); }
.banner-tap { font-size: 11px; color: var(--text-secondary); }

/* ===== TICKER ===== */
.ticker {
  overflow: hidden;
  background: var(--bg-expanded);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  height: 32px;
  line-height: 32px;
  font-size: 12px;
}

.ticker-track {
  display: flex;
  white-space: nowrap;
  animation: ticker-scroll 30s linear infinite;
}

.ticker-track:hover { animation-play-state: paused; }

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item { padding: 0 16px; }
.ticker-up { color: #51cf66; }
.ticker-down { color: var(--score-under); }
.ticker-holds { color: var(--gold); }

/* ===== SEARCH ===== */
.search-wrap {
  position: relative;
  padding: 0 16px;
  margin-bottom: 8px;
}

.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: 0.4;
}

.search-wrap input {
  width: 100%;
  padding: 10px 10px 10px 28px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--gold-muted);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

.search-wrap input::placeholder { color: var(--text-dim); }
.search-wrap input:focus { border-bottom-color: var(--gold); }

/* ===== LEADERBOARD TABLE ===== */
.table-wrap { padding: 0 16px; overflow: visible; max-width: 1100px; margin: 0 auto; }

.leaderboard { width: 100%; border-collapse: collapse; }

.leaderboard thead th {
  position: sticky;
  top: 0;
  z-index: 50;
}

.leaderboard thead tr { border-bottom: 1px solid var(--border-header); }

.leaderboard th {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold-muted);
  padding: 8px 6px;
  white-space: nowrap;
  text-align: right;
  background: var(--bg-primary);
}

.leaderboard th.col-player { text-align: left; }
.leaderboard th.col-pos { text-align: center; width: 52px; }

.leaderboard td {
  padding: 0 6px;
  height: 28px;
  vertical-align: middle;
  text-align: right;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  font-family: 'IBM Plex Mono', 'SF Mono', monospace;
  font-size: 13px;
}

.leaderboard td.col-pos {
  text-align: center;
  font-family: 'Source Sans 3', sans-serif;
  color: var(--text-secondary);
  width: 52px;
  vertical-align: middle;
}

.pos-num { display: block; font-size: 13px; }

.movement {
  display: block;
  font-size: 10px;
  line-height: 1;
}

.mov-up { color: #51cf66; }
.mov-down { color: var(--score-under); }
.mov-flat { color: var(--text-dim); }

.leaderboard td.col-player {
  text-align: left;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  width: 200px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-round { width: 44px; }
.col-tot { width: 50px; }
.col-payout { width: 70px; }
.col-tb { width: 40px; }

/* Row styles */
.leaderboard-row {
  user-select: none;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.6s ease-out;
  min-height: 40px;
}

.leaderboard-row:hover { background: var(--bg-hover); }

/* Money positions */
.leaderboard-row.in-money { border-left: 3px solid var(--border-money); }

/* Leader */
.leader-diamond { color: var(--gold); font-size: 10px; margin-right: 4px; }

/* Your row */
.leaderboard-row.your-row {
  border-left: 3px solid var(--gold);
  background: rgba(255, 199, 44, 0.05);
}

/* Score colors */
.score-neg { color: var(--score-under); }
.score-pos { color: var(--score-over); }
.score-even { color: var(--score-even); }

.payout-badge { color: var(--gold); font-size: 13px; }

/* ===== SCORE CHANGE ANIMATIONS ===== */
@keyframes flash-improve {
  0% { background-color: rgba(81,207,102,0.3); }
  100% { background-color: transparent; }
}
@keyframes flash-worsen {
  0% { background-color: rgba(206,17,65,0.3); }
  100% { background-color: transparent; }
}
.score-improved { animation: flash-improve 1.5s ease-out; }
.score-worsened { animation: flash-worsen 1.5s ease-out; }

/* ===== MONEY LINE ===== */
.money-line-row td {
  border: none !important;
  padding: 0 !important;
  height: auto !important;
}

.money-line {
  position: relative;
  border-bottom: 2px dashed var(--gold-muted);
  margin: 4px 0;
}

.money-line-label {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-primary);
  padding: 0 12px;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--gold-muted);
  text-transform: uppercase;
  font-family: 'Source Sans 3', sans-serif;
  white-space: nowrap;
}

/* ===== EXPANDED DETAIL ===== */
.expanded-detail {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  background: var(--bg-expanded);
}

.expanded-detail.open {
  max-height: 1200px;
  opacity: 1;
}

.expanded-inner { padding: 12px 16px 12px 24px; max-width: 600px; }

.expanded-header {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* What You Need calculator */
.what-you-need {
  border: 1px solid var(--gold-muted);
  border-radius: 2px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--gold);
  font-family: 'Source Sans 3', sans-serif;
  line-height: 1.6;
}

.expanded-round { margin-bottom: 12px; }

.expanded-round-title {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}

.expanded-round-title span {
  float: right;
  font-weight: 400;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0;
}

.golfer-line {
  display: flex;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
  font-family: 'Source Sans 3', sans-serif;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.golfer-line.counted { color: var(--text-primary); }
.golfer-line.benched { color: var(--text-dim); }

.golfer-line .g-name { flex: 1; }
.golfer-line .g-tier { width: 56px; text-align: center; font-size: 11px; color: var(--text-dim); }
.golfer-line .g-score { width: 36px; text-align: right; font-family: 'IBM Plex Mono', monospace; font-size: 12px; }

.g-status { width: 40px; text-align: center; font-size: 11px; color: var(--text-secondary); font-family: 'IBM Plex Mono', monospace; }
.g-status-cut { color: var(--score-over); }
.g-tourscore { width: 40px; text-align: right; font-family: 'IBM Plex Mono', monospace; font-size: 12px; }

.golfer-clickable { cursor: pointer; transition: background 0.15s; }
.golfer-clickable:hover { background: rgba(255,255,255,0.05); }

/* Combined golfer grid */
.golfer-grid-header {
  display: flex;
  align-items: center;
  padding: 2px 0;
  font-size: 10px;
  font-family: 'Source Sans 3', sans-serif;
  color: var(--gold-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border-header);
  margin-bottom: 2px;
}
.golfer-grid-header .g-ind { width: 16px; flex-shrink: 0; }
.golfer-grid-header .g-name { flex: 1; }
.golfer-grid-header .g-tier { width: 46px; text-align: center; }
.golfer-grid-header .g-rs { width: 32px; text-align: right; }

.golfer-grid-row {
  display: flex;
  align-items: center;
  padding: 3px 0;
  font-size: 12px;
  font-family: 'Source Sans 3', sans-serif;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background 0.15s;
}
.golfer-grid-row:hover { background: rgba(255,255,255,0.05); }
.golfer-grid-row.counted { color: var(--text-primary); }
.golfer-grid-row.benched { color: var(--text-dim); }
.golfer-grid-row .g-ind { width: 16px; flex-shrink: 0; text-align: center; }
.golfer-grid-row .g-name { flex: 1; font-size: 13px; }
.golfer-grid-row .g-tier { width: 46px; text-align: center; font-size: 10px; color: var(--text-dim); }
.golfer-grid-row .g-rs { width: 32px; text-align: right; font-family: 'IBM Plex Mono', monospace; font-size: 11px; }

.pool-info {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 4px;
}

/* ===== SCORECARD ===== */
.scorecard { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.scorecard-title { font-family: 'Source Sans 3', sans-serif; font-size: 13px; font-weight: 600; color: var(--gold); margin-bottom: 10px; }
.scorecard-round { margin-bottom: 12px; }
.scorecard-round-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--gold-muted); margin-bottom: 4px; }
.scorecard-grid { overflow-x: auto; font-family: 'IBM Plex Mono', monospace; font-size: 11px; }
.sc-row { display: flex; min-width: max-content; }
.sc-label { width: 36px; flex-shrink: 0; font-family: 'Source Sans 3', sans-serif; font-size: 10px; color: var(--text-dim); text-transform: uppercase; display: flex; align-items: center; }
.sc-cell { width: 24px; flex-shrink: 0; text-align: center; padding: 3px 0; color: var(--text-secondary); }
.sc-header .sc-cell { color: var(--text-dim); font-size: 10px; }
.sc-par .sc-cell { color: var(--text-dim); }
.sc-out, .sc-in { border-left: 1px solid var(--border-subtle); border-right: 1px solid var(--border-subtle); color: var(--text-secondary) !important; font-weight: 600; }
.sc-total { font-weight: 600; color: var(--text-primary) !important; border-left: 1px solid var(--border-subtle); }
.sc-birdie { color: var(--score-under) !important; font-weight: 600; }
.sc-bogey { color: var(--score-over) !important; }
.scorecard-loading, .scorecard-empty { font-size: 12px; color: var(--text-dim); padding: 12px 0; text-align: center; font-family: 'Source Sans 3', sans-serif; }

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 40px 20px;
  font-size: 12px;
  color: var(--text-dim);
  font-family: 'Source Sans 3', sans-serif;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--gold-muted); border-radius: 3px; }

/* ===== STALE DATA WARNING ===== */
.stale-warning {
  background: rgba(255, 199, 44, 0.1);
  border-bottom: 1px solid var(--gold-muted);
  color: var(--gold);
  font-size: 12px;
  text-align: center;
  padding: 6px 16px;
  font-family: 'Source Sans 3', sans-serif;
}

/* ===== BEST 4 OF 8 HEADER ===== */
.team-detail-header {
  color: var(--text-secondary);
  font-size: 11px;
  font-style: italic;
  margin-bottom: 10px;
  font-family: 'Source Sans 3', sans-serif;
}

/* ===== COUNTED/BENCHED INDICATORS ===== */
.g-check {
  color: #51cf66;
  font-size: 11px;
  width: 16px;
  flex-shrink: 0;
  text-align: center;
}

.g-bench {
  color: var(--text-dim);
  font-size: 11px;
  width: 16px;
  flex-shrink: 0;
  text-align: center;
}

.g-cut-badge {
  font-size: 9px;
  font-weight: 600;
  color: var(--score-under);
  background: rgba(206,17,65,0.15);
  padding: 1px 4px;
  border-radius: 2px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ===== LIVE INDICATOR ===== */
.score-live {
  font-style: italic;
}
.score-live::after {
  content: '\2022';
  font-size: 8px;
  vertical-align: super;
  margin-left: 1px;
  opacity: 0.6;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .header { padding: 24px 16px 16px; }
  .header h1 { font-size: 18px; letter-spacing: 2px; }
  .table-wrap { padding: 0 8px; }
  .leaderboard-row { min-height: 44px; }
  .leaderboard td { padding: 0 4px; height: 44px; }
  .leaderboard td.col-player { font-size: 11px; max-width: 90px; }
  .leaderboard th { font-size: 9px; letter-spacing: 1px; padding: 6px 3px; }
  .leaderboard td { padding: 0 3px; font-size: 11px; }
  .col-round { width: 28px; }
  .col-tb { width: 28px; }
  .col-tot { width: 34px; }
  .col-payout { width: 46px; }
  .col-pos { width: 36px; }
  .payout-badge { font-size: 10px; }
}

