/* ============================================
   Hornets SE Division Bet Tracker
   Premium dark sports analytics dashboard
   ============================================ */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-body: #09090b;
  --bg-card: #111116;
  --bg-card-alt: #0d0d12;
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --text: #e4e4e7;
  --text-muted: #71717a;
  --text-dim: #52525b;
  --teal: #00788c;
  --teal-light: #00a3b4;
  --purple: #1d1160;
  --purple-deep: #0f0a2a;
  --white: #f4f4f5;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --gold: #DAA520;
  --gold-light: #FFD700;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
  --max-width: 900px;
  --radius: 8px;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-body);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* --- Layout --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

/* --- Header --- */
.site-header {
  text-align: center;
  padding: 1.25rem 1rem 0.75rem;
  background: linear-gradient(180deg, var(--purple-deep) 0%, var(--bg-body) 100%);
  border-bottom: 1px solid var(--border);
}

.header-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.crowned-logo {
  position: relative;
  width: 48px;
  height: 56px;
  flex-shrink: 0;
}

.crowned-logo .crown {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 34px;
  height: auto;
  z-index: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.crowned-logo .header-logo {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.site-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--white);
  margin-bottom: 0;
}

.site-header .tagline {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 0.25rem;
}

/* --- Nav --- */
.site-nav {
  border-bottom: 1px solid var(--border);
}

.site-nav .container {
  display: flex;
  gap: 0;
}

.nav-link {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.active {
  color: var(--teal-light);
  border-bottom-color: var(--teal);
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  margin-bottom: 1rem;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-header-row .card-title {
  margin-bottom: 0;
}

.toggle-group {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
}

.toggle-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 0.35rem 0.85rem;
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.toggle-btn:hover {
  color: var(--text);
}

.toggle-btn:focus-visible {
  outline: 2px solid var(--teal-light);
  outline-offset: -2px;
}

.toggle-btn.active {
  background: var(--teal);
  color: var(--white);
}

.chart-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}

/* --- Bet Summary --- */
.bet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.bet-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.bet-item .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.bet-item .value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  font-family: var(--font-mono);
}

.bet-item .value.payout {
  color: var(--green);
}

/* --- Current Odds --- */
.current-odds-display {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.big-odds {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 800;
  color: var(--teal-light);
  line-height: 1;
}

.odds-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.odds-meta span {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.odds-meta .probability {
  font-family: var(--font-mono);
  color: var(--white);
  font-weight: 600;
}

.cashout-estimate {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
  color: var(--text-muted);
}

.cashout-estimate .cashout-value {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--green);
  font-size: 1.15rem;
}

.awaiting-data {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.95rem;
}

/* --- Charts --- */
.chart-wrapper {
  position: relative;
  width: 100%;
}

.chart-wrapper canvas {
  width: 100% !important;
  max-height: 350px;
}

/* --- Standings Table --- */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  white-space: nowrap;
}

.standings-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-hover);
}

.standings-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.standings-table td.num {
  font-family: var(--font-mono);
  text-align: right;
}

.standings-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.standings-table .hornets-row {
  border-left: 3px solid var(--teal);
}

.standings-table .hornets-row td {
  color: var(--white);
  font-weight: 600;
}

.standings-table .hornets-row:hover {
  background: rgba(0, 120, 140, 0.06);
}

/* Clinch: gold row */
.standings-table .hornets-row.clinched {
  border-left-color: var(--gold-light);
  background: rgba(218, 165, 32, 0.08);
}

.standings-table .hornets-row.clinched:hover {
  background: rgba(218, 165, 32, 0.12);
}

.team-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.team-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

/* --- Footer --- */
.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

.site-footer p {
  margin-bottom: 0.25rem;
}

/* ============================================
   Scenario Builder
   ============================================ */

.instructions-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.action-btn {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-hover);
}

.action-btn:focus-visible {
  outline: 2px solid var(--teal-light);
  outline-offset: 2px;
}

.action-btn--teal {
  border-color: rgba(0, 120, 140, 0.4);
  color: var(--teal-light);
}

.action-btn--teal:hover {
  background: rgba(0, 120, 140, 0.12);
  border-color: var(--teal);
}

.action-btn--green {
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--green);
}

.action-btn--green:hover {
  background: rgba(34, 197, 94, 0.1);
  border-color: var(--green);
}

.action-btn--muted {
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.action-btn--muted:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.pick-progress {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-family: var(--font-mono);
}

/* --- Week Tabs --- */
.week-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.week-tab {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.6rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.week-tab:hover {
  color: var(--text);
}

.week-tab:focus-visible {
  outline: 2px solid var(--teal-light);
  outline-offset: -2px;
}

.week-tab.active {
  color: var(--teal-light);
  border-bottom-color: var(--teal);
}

.week-tab-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-left: 0.35rem;
}

.week-tab.active .week-tab-count {
  color: var(--teal);
}

/* --- Game Tiles Grid --- */
.game-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}

.game-tile {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}

.game-tile:hover {
  border-color: var(--border-hover);
}

.game-tile--div {
  border-top: 2px solid var(--teal);
}

.game-tile-date {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  padding: 0.15rem 0.4rem;
  white-space: nowrap;
}

.game-tile-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0.25rem 0.35rem;
  min-width: 40px;
  flex-shrink: 0;
}

.game-tile-at {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 0.9rem;
}

.game-tile-div-badge {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--teal-light);
  margin-top: 0.15rem;
}

.game-tile-side {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 48px;
}

.game-tile-side:hover {
  background: rgba(255, 255, 255, 0.03);
}

.game-tile-side:focus-visible {
  outline: 2px solid var(--teal-light);
  outline-offset: -2px;
}

.game-tile-side.picked {
  background: rgba(0, 120, 140, 0.1);
  color: var(--white);
  font-weight: 600;
}

.game-tile-side.picked--cha {
  background: rgba(0, 120, 140, 0.18);
}

.game-tile-side--away {
  justify-content: flex-end;
  text-align: right;
}

.game-tile-side--home {
  justify-content: flex-start;
}

.game-tile-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.game-tile-abbr {
  font-weight: 600;
}

/* --- Legacy game-row (keep for compatibility) --- */
.week-group {
  margin-bottom: 1.5rem;
}

.week-group:last-child {
  margin-bottom: 0;
}

.week-header {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.game-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.game-row {
  display: grid;
  grid-template-columns: 60px 1fr 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  background: var(--bg-card-alt);
  border: 1px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}

.game-row:hover {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.game-date {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  white-space: nowrap;
}

.game-pick-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.65rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  min-width: 0;
}

.game-pick-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-hover);
}

.game-pick-btn:focus-visible {
  outline: 2px solid var(--teal-light);
  outline-offset: 2px;
}

.game-pick-btn.picked {
  background: rgba(0, 120, 140, 0.1);
  border-color: var(--teal);
  color: var(--white);
  font-weight: 600;
}

.game-pick-btn.picked--cha {
  background: rgba(0, 120, 140, 0.18);
  border-color: var(--teal-light);
}

.pick-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.pick-team-name {
  font-weight: 600;
}

.pick-team-abbr {
  font-weight: 500;
}

.pick-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-left: auto;
}

.se-div-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--teal-light);
  background: rgba(0, 120, 140, 0.1);
  border: 1px solid rgba(0, 120, 140, 0.2);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  white-space: nowrap;
}

/* --- Bet Impact --- */
.bet-impact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.bet-impact-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.bet-impact-item .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.bet-impact-item .value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  font-family: var(--font-mono);
}

.bet-impact-item .value.payout {
  color: var(--green);
}

.bet-impact-verdict {
  margin-top: 1rem;
}

.verdict {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  line-height: 1.5;
}

.verdict--win {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: var(--green);
}

.verdict--champs {
  background: rgba(218, 165, 32, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.3);
  color: var(--gold-light);
}

.verdict--alive {
  background: rgba(0, 163, 180, 0.08);
  border: 1px solid rgba(0, 163, 180, 0.2);
  color: var(--teal-light);
}

.verdict--close {
  background: rgba(234, 179, 8, 0.08);
  border: 1px solid rgba(234, 179, 8, 0.2);
  color: var(--yellow);
}

.verdict--behind {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--red);
}

.verdict--eliminated {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--red);
}

.status-champs {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gold-light);
}

.status-elim {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--red);
}

.status-alive {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--teal-light);
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .site-header h1 {
    font-size: 1.15rem;
  }

  .big-odds {
    font-size: 2.25rem;
  }

  .bet-grid {
    grid-template-columns: 1fr 1fr;
  }

  .card {
    padding: 1.15rem;
  }

  .game-tiles {
    grid-template-columns: 1fr;
  }

  .game-row {
    grid-template-columns: 50px 1fr 1fr auto;
    gap: 0.35rem;
    padding: 0.35rem;
  }

  .game-pick-btn {
    padding: 0.35rem 0.45rem;
    font-size: 0.75rem;
  }

  .pick-logo {
    width: 16px;
    height: 16px;
  }

  .quick-actions {
    flex-direction: column;
  }

  .action-btn {
    width: 100%;
    text-align: center;
  }

  .bet-impact-grid {
    grid-template-columns: 1fr 1fr;
  }

  .week-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .card-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .toggle-btn {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
  }

  .chart-wrapper canvas {
    max-height: none;
  }

  .chart-subtitle {
    font-size: 0.7rem;
  }

  .header-brand {
    gap: 0.5rem;
  }

  .crowned-logo {
    width: 40px;
    height: 48px;
  }

  .crowned-logo .header-logo {
    width: 38px;
    height: 38px;
  }

  .crowned-logo .crown {
    width: 30px;
  }

  .tagline {
    font-size: 0.8rem;
  }

  .nav-link {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
  }
}
