/* ─── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  --bg-page:        #F2EFE9;
  --bg-card:        #FAFAF7;
  --bg-card-hover:  #F5F2EC;
  --bg-border:      #E2DDD5;
  --bg-surface:     #EDE9E1;

  --text-primary:   #2C2825;
  --text-secondary: #5F5751;
  --text-muted:     #665E58;
  --text-inverse:   #FAFAF7;

  --shadow-sm:  0 1px 3px rgba(44,40,37,0.08), 0 1px 2px rgba(44,40,37,0.06);
  --shadow-md:  0 4px 12px rgba(44,40,37,0.10), 0 2px 4px rgba(44,40,37,0.07);
  --shadow-lg:  0 12px 32px rgba(44,40,37,0.14), 0 4px 8px rgba(44,40,37,0.08);
  --shadow-panel: 0 0 0 1px rgba(44,40,37,0.08), -8px 0 32px rgba(44,40,37,0.14);

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow:   350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Division colors */
  --color-OE:    #2563EB; --bg-OE:    #DBEAFE; --text-OE:    #1E3A8A; --border-OE: #93C5FD;
  --color-OM:    #D97706; --bg-OM:    #FEF3C7; --text-OM:    #92400E; --border-OM: #FCD34D;
  --color-OW:    #7C3AED; --bg-OW:    #EDE9FE; --text-OW:    #4C1D95; --border-OW: #C4B5FD;
  --color-35W:   #059669; --bg-35W:   #D1FAE5; --text-35W:   #064E3B; --border-35W:#6EE7B7;
  --color-40M:   #DC2626; --bg-40M:   #FEE2E2; --text-40M:   #7F1D1D; --border-40M:#FCA5A5;

  /* Result colors */
  --color-win:  #059669;
  --color-loss: #DC2626;
  --color-tie:  #D97706;
  --bg-pending: #FEF9F0;
  --bg-final:   #F0FDF4;
}

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

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

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ─── Typography ─────────────────────────────────────────────────────────── */
.font-display {
  font-family: 'Georgia', 'Cambria', serif;
  letter-spacing: -0.02em;
}
.font-mono {
  font-family: ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  font-variant-numeric: tabular-nums;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
#app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(242, 239, 233, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bg-border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 10px;
  gap: 12px;
}

.tournament-name {
  font-family: 'Georgia', serif;
  font-size: 1.3rem;
  font-weight: normal;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.tournament-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 1px;
}

/* Day tabs */
.day-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
}

.day-tab {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}

.day-tab:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.day-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Division filter chips */
.division-chips {
  display: flex;
  gap: 6px;
  padding: 8px 0 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex-wrap: wrap;
}
.division-chips::-webkit-scrollbar { display: none; }

.div-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  background: var(--bg-surface);
  color: var(--text-secondary);
  user-select: none;
}

.div-chip:hover { background: var(--bg-card); color: var(--text-primary); }

.div-chip.active {
  background: var(--chip-bg, var(--bg-card));
  color: var(--chip-text, var(--text-primary));
  border-color: var(--chip-border, var(--bg-border));
}

.div-chip[data-div="all"].active {
  background: var(--text-primary);
  color: var(--text-inverse);
}

/* Nav tabs (Schedule / Divisions / Bracket) */
.nav-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--bg-border);
  position: relative;
}

.nav-tab {
  font-size: 0.85rem;
  font-weight: 500;
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: color var(--transition-fast);
}

.nav-tab:hover { color: var(--text-primary); }
.nav-tab.active { color: var(--text-primary); font-weight: 600; }

.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px 2px 0 0;
}

/* ─── Views ──────────────────────────────────────────────────────────────── */
#app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  min-height: calc(100vh - 120px);
}

.view {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 200ms ease, transform 200ms ease;
}

.view.view-hidden {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  position: absolute;
  left: -9999px;
}

/* ─── Game List ──────────────────────────────────────────────────────────── */
.game-list {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 680px;
  margin: 0 auto;
}

.gl-day {
  /* no card background — transparent, matches page */
}

.gl-day-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--text-primary);
  margin-bottom: 0;
}

.gl-day-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.gl-day-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ─── Time Slot grouping ─────────────────────────────────────────────────── */
.gl-slot {
  display: grid;
  grid-template-columns: 80px 1fr;
  border-bottom: 1px solid var(--bg-border);
}

.gl-slot:last-child { border-bottom: none; }

.gl-slot-time {
  padding: 15px 0 15px 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: flex-start;
  padding-top: 17px;
  flex-shrink: 0;
}

.gl-slot-games {
  border-left: 1px solid var(--bg-border);
}

/* ─── Game rows ──────────────────────────────────────────────────────────── */
.gl-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--bg-border);
  cursor: pointer;
}

.gl-row:last-child { border-bottom: none; }

.gl-matchup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 8px 16px;
  border-radius: 8px;
  background: linear-gradient(
    to right,
    transparent 0%,
    color-mix(in srgb, var(--div-color) 13%, transparent) 18%,
    color-mix(in srgb, var(--div-color) 13%, transparent) 82%,
    transparent 100%
  );
  transition: background var(--transition-fast);
}

.gl-row:hover .gl-matchup {
  background: linear-gradient(
    to right,
    transparent 0%,
    color-mix(in srgb, var(--div-color) 22%, transparent) 18%,
    color-mix(in srgb, var(--div-color) 22%, transparent) 82%,
    transparent 100%
  );
}

.gl-team {
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--transition-fast);
  cursor: pointer;
}

.gl-team:hover { color: var(--div-color); text-decoration: underline; }

.gl-team-tbd {
  font-weight: 400;
  color: var(--text-muted);
  font-style: italic;
  cursor: default;
}
.gl-team-tbd:hover { color: var(--text-muted); text-decoration: none; }

.gl-vs {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
  flex-shrink: 0;
}

.gl-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-right: 4px;
}

.gl-score {
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.gl-score-win { color: var(--color-win); }


.gl-type-badge {
  font-size: 0.63rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--bg-border);
  border-radius: 99px;
  padding: 2px 7px;
}

.gl-court-badge {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-muted);
  white-space: nowrap;
}

/* keep .div-badge used in bracket/header */
.div-badge {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--div-color);
  color: white;
  flex-shrink: 0;
}

/* ─── Division View ──────────────────────────────────────────────────────── */
.division-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  background: none;
  border: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.back-btn:hover { background: var(--bg-surface); color: var(--text-primary); }

.division-title {
  font-family: 'Georgia', serif;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.division-badge-large {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 99px;
  letter-spacing: 0.06em;
}

/* Pool sections */
.pool-section {
  margin-bottom: 28px;
}

.pool-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pool-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--bg-border);
}

/* Standings table */
.standings-table {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--bg-border);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.standings-table table {
  width: 100%;
  border-collapse: collapse;
}

.standings-table th {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 14px;
  text-align: right;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--bg-border);
}

.standings-table th:first-child,
.standings-table th:nth-child(2) { text-align: left; }

.standings-table td {
  padding: 10px 14px;
  text-align: right;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--bg-border);
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
}

.standings-table tr:last-child td { border-bottom: none; }

.standings-table td:first-child { text-align: left; font-family: inherit; color: var(--text-muted); font-size: 0.7rem; font-weight: 600; }
.standings-table td:nth-child(2) {
  text-align: left;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}
.standings-table td:nth-child(2):hover { color: var(--div-color, var(--text-primary)); text-decoration: underline; }

.standings-pts {
  font-weight: 700 !important;
  color: var(--text-primary) !important;
}

.standings-row-highlight {
  background: var(--div-bg, var(--bg-card));
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--div-color, var(--bg-border));
  color: white;
}

/* Pool complete indicator */
.pool-complete-badge {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--color-win);
  background: #F0FDF4;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.04em;
  border: 1px solid #BBF7D0;
}

/* ─── Team Panel ─────────────────────────────────────────────────────────── */
#panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(44, 40, 37, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  z-index: 200;
}

#panel-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

#team-panel {
  position: fixed;
  top: 0;
  right: -100%;
  width: min(440px, 100vw);
  height: 100dvh;
  overflow-y: auto;
  background: var(--bg-card);
  box-shadow: var(--shadow-panel);
  z-index: 300;
  transition: right var(--transition-slow);
  display: flex;
  flex-direction: column;
}

#team-panel.open { right: 0; }

.panel-header {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--bg-border);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  z-index: 1;
}

.panel-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
  margin-top: 2px;
}

.panel-close:hover { background: var(--bg-border); color: var(--text-primary); }

.panel-team-name {
  font-family: 'Georgia', serif;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.panel-team-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.panel-body { padding: 20px; flex: 1; }

/* Record summary */
.record-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.record-stat {
  text-align: center;
  flex: 1;
}

.record-value {
  font-family: 'Georgia', serif;
  font-size: 1.5rem;
  font-weight: normal;
  color: var(--text-primary);
  line-height: 1;
}

.record-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 3px;
}

.record-divider {
  width: 1px;
  height: 32px;
  background: var(--bg-border);
}

/* Next game card */
.next-game-card {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 20px;
  border: 1.5px solid var(--div-border, var(--bg-border));
  background: var(--div-bg, var(--bg-card));
}

.next-game-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--div-text, var(--text-muted));
  margin-bottom: 8px;
}

.next-game-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.next-game-court {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.next-game-vs {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 6px;
}

/* Team schedule list */
.schedule-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.team-game-list { display: flex; flex-direction: column; gap: 8px; }

.team-game-item {
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-border);
  padding: 12px 14px;
  background: var(--bg-card);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 8px;
  align-items: center;
}

.team-game-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--div-color, var(--bg-border));
}

.team-game-item.is-final { background: var(--bg-final); }

.tgi-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.tgi-day {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.tgi-matchup {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.tgi-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.tgi-result {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: right;
  line-height: 1.4;
}

.result-W { color: var(--color-win); }
.result-L { color: var(--color-loss); }
.result-T { color: var(--color-tie); }

/* ─── Score Modal ────────────────────────────────────────────────────────── */
#score-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(44, 40, 37, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  padding: 20px;
}

#score-modal-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.score-modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(8px);
  transition: transform var(--transition-slow);
}

#score-modal-backdrop.visible .score-modal {
  transform: scale(1) translateY(0);
}

.modal-title {
  font-family: 'Georgia', serif;
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.modal-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.score-inputs {
  display: grid;
  grid-template-columns: 1fr 40px 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
}

.score-team-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 6px;
  line-height: 1.2;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-input-wrap { text-align: center; }

.score-input {
  width: 100%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  padding: 12px 8px;
  border: 2px solid var(--bg-border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: border-color var(--transition-fast);
  outline: none;
}

.score-input:focus { border-color: var(--text-primary); background: var(--bg-card); }

.score-divider {
  font-size: 1.2rem;
  font-weight: 300;
  color: var(--text-muted);
  text-align: center;
  padding-top: 22px;
}

.modal-actions {
  display: flex;
  gap: 8px;
}

.btn-primary {
  flex: 1;
  padding: 11px 20px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--text-primary);
  color: var(--text-inverse);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.btn-primary:hover { background: #1a1510; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  padding: 11px 20px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--bg-border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.btn-secondary:hover { background: var(--bg-surface); color: var(--text-primary); }

.btn-danger {
  width: 100%;
  padding: 9px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-border);
  background: transparent;
  color: var(--color-loss);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  margin-top: 8px;
  transition: background var(--transition-fast);
}

.btn-danger:hover { background: #FEE2E2; }

/* ─── Section: No Games ──────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 2rem; margin-bottom: 10px; }
.empty-state-text { font-size: 0.9rem; }

/* ─── Division cards (Division overview) ─────────────────────────────────── */
.division-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.division-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--bg-border);
  padding: 20px;
  cursor: pointer;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.division-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--div-color, var(--bg-border));
}

.division-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--div-color, var(--bg-border));
}

.division-card-title {
  font-family: 'Georgia', serif;
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.division-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.division-card-stats {
  display: flex;
  gap: 12px;
}

.division-stat {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.division-stat strong {
  font-weight: 700;
  color: var(--text-primary);
}

/* ─── Bracket View ────────────────────────────────────────────────────────── */
.bracket-container {
  overflow-x: auto;
  padding-bottom: 8px;
}

.bracket-grid {
  display: flex;
  gap: 0;
  min-width: fit-content;
  align-items: stretch;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  min-width: 180px;
  padding: 0 8px;
  position: relative;
}

.bracket-round-title {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--bg-border);
  margin-bottom: 8px;
}

.bracket-game {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-border);
  overflow: hidden;
  transition: box-shadow var(--transition-fast);
  margin: 4px 0;
}

.bracket-game:hover { box-shadow: var(--shadow-sm); }

.bracket-game.is-championship {
  border-width: 2px;
  border-color: var(--color-OM);
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.15);
}

.bracket-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  gap: 8px;
}

.bracket-slot:not(:last-child) { border-bottom: 1px solid var(--bg-border); }

.bracket-team-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.bracket-team-name:hover { color: var(--div-color, var(--text-primary)); text-decoration: underline; }
.bracket-team-name.is-placeholder { color: var(--text-muted); font-weight: 400; font-style: italic; }
.bracket-team-name.is-winner { color: var(--color-win); font-weight: 700; }

.bracket-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 20px;
  text-align: right;
}

.bracket-score.is-winner { color: var(--color-win); }

/* ─── Standings panel (mobile slide-up) ─────────────────────────────────── */
#standings-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 80vh;
  background: var(--bg-card);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 32px rgba(0,0,0,0.12);
  transform: translateY(100%);
  transition: transform var(--transition-slow);
  z-index: 300;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#standings-panel.open { transform: translateY(0); }

.standings-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--bg-border);
  flex-shrink: 0;
}
.standings-panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.standings-panel-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  flex: 1;
}

/* Standings button — hidden on desktop */
.standings-mobile-btn {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.standings-mobile-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .schedule-layout {
    grid-template-columns: 1fr;
  }
  /* Hide sidebar — accessed via the Standings button instead */
  .schedule-layout > .pools-sidebar { display: none !important; }
  .standings-mobile-btn { display: flex; }
}

@media (max-width: 768px) {
  #app-main { padding: 12px; }
  .tournament-name { font-size: 1.1rem; }
  #team-panel { width: 100vw; }
  .gl-slot { grid-template-columns: 64px 1fr; }
  .gl-slot-time { font-size: 0.76rem; padding-top: 15px; }
  .gl-row { padding: 8px 0; }
  .gl-team { font-size: 0.85rem; }
  .standings-table td { padding: 8px 10px; font-size: 0.75rem; }
  .standings-table th { padding: 8px 10px; }
}

@media (max-width: 480px) {
  .record-card { gap: 8px; }
  .record-value { font-size: 1.2rem; }

  .score-inputs { grid-template-columns: 1fr 28px 1fr; }
  .score-input { font-size: 1.5rem; }
}

/* ─── Schedule + Sidebar Layout ─────────────────────────────────────────── */
.schedule-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}

.schedule-main { min-width: 0; }

/* ─── Pools Sidebar ──────────────────────────────────────────────────────── */
.pools-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ─── Division Groups (collapsible) ─────────────────────────────────────── */
.div-group {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--bg-border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.div-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: color-mix(in srgb, var(--div-color, #ddd) 8%, var(--bg-card));
  border-bottom: 1px solid transparent;
  transition: background var(--transition-fast);
}

.div-group-header::-webkit-details-marker { display: none; }
.div-group-header::marker { display: none; }
.div-group-header:hover { background: color-mix(in srgb, var(--div-color, #ddd) 14%, var(--bg-card)); }

details[open] .div-group-header {
  border-bottom-color: color-mix(in srgb, var(--div-color, #ddd) 20%, transparent);
}

.div-group-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.div-group-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--div-color, var(--text-primary));
  flex: 1;
  font-family: 'Georgia', serif;
}

.div-group-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: var(--div-color, var(--text-muted));
  opacity: 0.7;
  font-weight: 500;
}

.div-group-chevron {
  color: var(--div-color, var(--text-muted));
  opacity: 0.6;
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

details[open] .div-group-chevron { transform: rotate(180deg); }

.div-group-pools {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.div-group-pools .pool-card {
  border-radius: 0;
  border: none;
  border-top: 1px solid var(--bg-border);
  box-shadow: none;
}

.div-group-pools .pool-card:first-child { border-top: none; }

/* ─── Pool Card ──────────────────────────────────────────────────────────── */
.pool-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--bg-border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.pool-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--div-color, #ddd) 10%, var(--bg-card));
  border-bottom: 1px solid color-mix(in srgb, var(--div-color, #ddd) 20%, transparent);
}

.pool-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--div-color, var(--text-primary));
  font-family: 'Georgia', serif;
  letter-spacing: -0.01em;
}

.pool-card-dates {
  font-size: 0.72rem;
  color: var(--div-color, var(--text-muted));
  font-weight: 600;
  opacity: 0.75;
}

.pool-card-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 14px 4px;
}

/* Pool games list */
.pc-games { padding: 0 0 4px; }

.pc-game-row {
  display: grid;
  grid-template-columns: 60px 1fr auto 1fr auto;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--bg-border);
  cursor: pointer;
  transition: background var(--transition-fast);
  font-size: 0.78rem;
}

.pc-game-row:last-child { border-bottom: none; }
.pc-game-row:hover { background: var(--bg-surface); }

.pc-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.3;
  white-space: pre-line;
}

.pc-team1 {
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-vs {
  color: var(--text-muted);
  font-size: 0.68rem;
  text-align: center;
  flex-shrink: 0;
}

.pc-team2 {
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  margin-left: 6px;
}

.pc-empty {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 6px 14px;
  font-style: italic;
}

/* Pool standings table */
.pc-standings {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.pc-standings thead th {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 5px 14px;
  text-align: right;
  background: var(--bg-surface);
  border-top: 1px solid var(--bg-border);
}

.pc-standings thead th:first-child,
.pc-standings thead th:nth-child(2) { text-align: left; }

.pc-standings tbody tr { border-top: 1px solid var(--bg-border); }
.pc-standings tbody tr:last-child { border-bottom: none; }

.pc-standings td {
  padding: 7px 14px;
  text-align: right;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
}

.pc-rank {
  text-align: left !important;
  font-family: inherit !important;
  color: var(--text-muted) !important;
  font-size: 0.68rem !important;
  width: 20px;
}

.pc-sname {
  text-align: left !important;
  font-family: inherit !important;
  font-weight: 600;
  color: var(--text-primary) !important;
  font-size: 0.8rem !important;
  cursor: pointer;
}

.pc-sname:hover { color: var(--div-color, var(--text-primary)) !important; text-decoration: underline; }

.pc-pts {
  font-weight: 700 !important;
  color: var(--text-primary) !important;
}

/* ─── Bracket (March Madness style) ─────────────────────────────────────── */
.bracket-scroll {
  overflow-x: auto;
  padding-bottom: 16px;
}

.bk-bracket {
  display: flex;
  gap: 0;
  min-width: fit-content;
  align-items: flex-start;
  padding: 16px 0;
}

.bk-round {
  display: flex;
  flex-direction: column;
  min-width: 190px;
  padding: 0 4px;
  position: relative;
}

.bk-round-final {
  min-width: 220px;
}

.bk-round-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  padding: 6px 8px 10px;
  white-space: nowrap;
}

.bk-round-games {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: space-around;
  flex: 1;
  position: relative;
}

/* Connector lines between rounds */
.bk-round:not(:last-child) .bk-round-games::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  right: -4px;
  width: 1px;
  background: var(--bg-border);
}

.bk-game {
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
  position: relative;
}

.bk-game::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 3px;
  background: var(--div-color, var(--bg-border));
}

.bk-game:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--div-color, var(--bg-border));
}

.bk-game-final {
  border-width: 2px;
  border-color: var(--div-color, var(--bg-border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--div-color, #ccc) 15%, transparent);
}

.bk-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 13px;
  gap: 6px;
  min-height: 34px;
  transition: background var(--transition-fast);
}

.bk-slot:not(:last-child) { border-bottom: 1px solid var(--bg-border); }

.bk-slot.bk-winner {
  background: color-mix(in srgb, var(--div-color, #059669) 8%, transparent);
}

.bk-slot.bk-tbd {
  opacity: 0.55;
}

.bk-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.bk-tbd .bk-name {
  font-weight: 400;
  font-style: italic;
  color: var(--text-muted);
}

.bk-winner .bk-name {
  color: var(--color-win);
  font-weight: 700;
}

.bk-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 22px;
  text-align: right;
  flex-shrink: 0;
}

.bk-score-win {
  color: var(--color-win);
  font-weight: 700;
}

/* Championship game styling */
.bk-game-final .bk-slot {
  padding: 10px 12px 10px 15px;
  min-height: 40px;
}

.bk-game-final .bk-name {
  font-size: 0.85rem;
}

/* ─── Print styles ───────────────────────────────────────────────────────── */
@media print {
  #app-header, #team-panel, #panel-backdrop, #score-modal-backdrop { display: none !important; }
  body { background: white; color: black; }
  #app-main { padding: 0; max-width: none; }
  .game-card { break-inside: avoid; border: 1px solid #ccc !important; background: white !important; }
  .view.view-hidden { display: none !important; }
}

/* ─── Utility ────────────────────────────────────────────────────────────── */
.flex-center { display: flex; align-items: center; justify-content: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.animate-in {
  animation: fadeSlideIn 300ms ease forwards;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}


.shimmer {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-border) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
