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

:root {
  --red: #e8003a;
  --pink: #f0006e;
  --gold: #f5c842;
  --gold-light: #fad96b;
  --court-bg: #f5c518;
  --gray-50: #f9f9f9;
  --gray-100: #f0f0f0;
  --gray-200: #e0e0e0;
  --gray-400: #aaa;
  --gray-600: #666;
  --gray-800: #222;
  --white: #fff;
  --font: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --radius: 6px;
}

body {
  font-family: var(--font);
  background: var(--white);
  color: var(--gray-800);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── TOP BAR ─────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: 56px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
}

.score-display {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  min-width: 120px;
}
.score-display .team-abbr { color: var(--gray-600); }
.score-display .score-num { font-size: 28px; font-weight: 800; color: var(--red); line-height: 1; }
.score-display .dash { color: var(--gray-400); font-size: 20px; font-weight: 300; }

.period-select {
  display: flex;
  align-items: center;
  gap: 6px;
}
.period-select select {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 13px;
  font-family: var(--font);
  background: var(--white);
  cursor: pointer;
  appearance: none;
  padding-right: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23aaa'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}

.clock-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  background: var(--white);
  font-weight: 600;
}
.clock-btn .play-icon { color: var(--gray-600); }

.tab-group {
  display: flex;
  gap: 2px;
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: 3px;
}
.tab-btn {
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
  color: var(--gray-600);
  transition: all 0.15s;
  position: relative;
}
.tab-btn.active {
  background: var(--gray-800);
  color: var(--white);
}
.tab-btn .badge {
  font-size: 10px;
  margin-left: 3px;
  opacity: 0.8;
}

.export-btn {
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  background: transparent;
  color: var(--gray-600);
}
.export-btn:hover { background: var(--gray-100); }

.spacer { flex: 1; }

.undo-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  background: var(--white);
  color: var(--gray-600);
}
.undo-btn:hover { background: var(--gray-100); }

/* ── MAIN LAYOUT ─────────────────────────────────────────────────── */
.main {
  display: flex;
  flex: 1;
  gap: 0;
  padding: 16px;
  gap: 10px;
  align-items: flex-start;
}

/* ── PANEL (bench / on-court) ────────────────────────────────────── */
.panel {
  background: var(--white);
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--gray-100);
}
.panel-accent {
  width: 3px;
  height: 18px;
  border-radius: 2px;
  background: var(--red);
  flex-shrink: 0;
}
.panel-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gray-600);
  text-transform: uppercase;
}
.panel-on-court { color: var(--red); }
.panel-team { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--gray-800); }

/* bench panel */
.bench-panel { flex: 1 1 0; min-width: 120px; }

.full-roster-btn {
  margin: 8px;
  padding: 6px;
  border: 1.5px dashed var(--gray-300, #ccc);
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500, #888);
  background: transparent;
  cursor: pointer;
  text-align: center;
  width: calc(100% - 16px);
}
.full-roster-btn:hover { background: var(--gray-50); }

.bench-list { padding: 4px 8px 8px; display: flex; flex-direction: column; gap: 2px; }

.bench-player {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.1s;
}
.bench-player:hover { background: var(--gray-50); }
.bench-player.selected { background: #fff0f5; }

.bench-pos {
  font-size: 10px;
  color: var(--gray-400);
  font-weight: 600;
  width: 20px;
  flex-shrink: 0;
}
.bench-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-800);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bench-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--pink);
  flex-shrink: 0;
}

.coach-row {
  margin: 4px 8px 8px;
  padding: 6px 8px;
  border: 1.5px dashed var(--gray-200);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.coach-row:hover { background: var(--gray-50); }
.coach-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--pink);
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.coach-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-600);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* on-court panel */
.oncourt-panel { flex: 1.2 1 0; min-width: 140px; }

.oncourt-list { padding: 4px 8px 8px; display: flex; flex-direction: column; gap: 2px; }

.oncourt-player {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 7px 6px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.1s;
}
.oncourt-player:hover { background: var(--gray-50); }
.oncourt-player.selected { background: #fff0f5; }

.oncourt-num {
  font-size: 15px;
  font-weight: 800;
  color: var(--red);
  width: 30px;
  flex-shrink: 0;
  line-height: 1.2;
}
.oncourt-info { flex: 1; min-width: 0; }
.oncourt-pos {
  font-size: 10px;
  color: var(--gray-400);
  font-weight: 600;
  display: inline;
}
.oncourt-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-800);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.oncourt-stats {
  font-size: 10px;
  color: var(--gray-400);
  margin-top: 1px;
  white-space: nowrap;
}
.oncourt-stats span { color: var(--gray-800); font-weight: 600; }

/* mirrored (BON side) on-court — number on right */
.oncourt-player.mirror {
  flex-direction: row-reverse;
  text-align: right;
}
.oncourt-player.mirror .oncourt-info { text-align: right; }

/* ── COURT ───────────────────────────────────────────────────────── */
.court-wrapper {
  flex: 3 1 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--court-bg);
  min-width: 280px;
  position: relative;
  aspect-ratio: 500 / 440;
}

.court-svg {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

.shot-dot {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-sizing: border-box;
}
/* Team A — blue */
.shot-dot.team-a.made { background: #1d4ed8; border: 2px solid #fff; }
.shot-dot.team-a.miss { background: transparent; border: 2.5px solid #1d4ed8; }
/* Team B — orange */
.shot-dot.team-b.made { background: #e87722; border: 2px solid #fff; }
.shot-dot.team-b.miss { background: transparent; border: 2.5px solid #e87722; }
/* Fade out after 5 subsequent actions */
.shot-dot { transition: opacity 0.3s; }
.shot-dot.dot-faded { opacity: 0; }

/* ── LOCATION PICKER ─────────────────────────────────────────────── */
.court-wrapper.awaiting-location {
  cursor: crosshair;
  outline: 3px solid var(--pink);
  outline-offset: -3px;
}

.location-overlay {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 10;
  pointer-events: none;
  white-space: nowrap;
}
.court-wrapper.awaiting-location .location-overlay { display: flex; }

.location-prompt {
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
}
.location-skip-btn {
  pointer-events: all;
  padding: 4px 14px;
  background: rgba(255,255,255,0.92);
  border: none;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
}
.location-skip-btn:hover { background: #fff; }

/* ── LIVE LOG ────────────────────────────────────────────────────── */
.log-panel {
  flex: 1.5 1 0;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.log-header { padding: 4px 0 8px; }
.log-title { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--gray-800); }
.log-sub { font-size: 11px; color: var(--gray-400); margin-top: 2px; }
.log-empty { font-size: 13px; color: var(--gray-400); padding: 16px 0; text-align: center; line-height: 1.5; }

.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid var(--gray-100);
}
.log-entry:hover { background: var(--gray-50); border-color: var(--gray-200); }
.log-time { font-size: 10px; color: var(--gray-400); font-weight: 600; flex-shrink: 0; width: 28px; }
.log-body { flex: 1; min-width: 0; }
.log-action { font-size: 12px; font-weight: 700; color: var(--gray-800); }
.log-detail { font-size: 11px; color: var(--gray-500, #888); }
.log-team { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px; flex-shrink: 0; }
.log-team.A { background: #ffe0e8; color: var(--red); }
.log-team.B { background: #e8e0ff; color: #6600cc; }

/* ── ACTION MODAL ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--white);
  border-radius: 12px;
  padding: 20px;
  min-width: 320px;
  max-width: 420px;
  width: 90vw;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  transform: translateY(8px);
  transition: transform 0.15s;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--gray-800);
}
.modal-sub {
  font-size: 12px;
  color: var(--gray-400);
  margin-bottom: 16px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.action-chip {
  padding: 10px 6px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-700, #444);
  background: var(--white);
  transition: all 0.1s;
  font-family: var(--font);
}
.action-chip:hover { border-color: var(--pink); color: var(--pink); background: #fff0f5; }
.action-chip.danger:hover { border-color: var(--red); color: var(--red); background: #fff0f0; }
.action-chip .chip-icon { font-size: 18px; display: block; margin-bottom: 3px; }

/* sub chip spans full row */
.sub-chip { grid-column: 1 / -1; }
.sub-chip:hover { border-color: #2563eb; color: #2563eb; background: #eff6ff; }

/* sub picker */
.sub-picker-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-600);
  margin-bottom: 10px;
}
.sub-picker-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 12px;
}
.sub-pick-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--white);
  transition: all 0.1s;
}
.sub-pick-row:hover { border-color: #2563eb; background: #eff6ff; }
.sub-pick-row .sp-num { font-size: 13px; font-weight: 800; color: var(--pink); width: 28px; flex-shrink: 0; }
.sub-pick-row .sp-pos { font-size: 10px; color: var(--gray-400); font-weight: 600; width: 22px; flex-shrink: 0; }
.sub-pick-row .sp-name { font-size: 13px; font-weight: 600; flex: 1; }
.sub-back-btn {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  background: var(--white);
  color: var(--gray-600);
  margin-bottom: 8px;
}
.sub-back-btn:hover { background: var(--gray-100); }

.modal-close {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  background: var(--white);
  color: var(--gray-600);
}
.modal-close:hover { background: var(--gray-100); }

/* ── ROSTER MODAL ────────────────────────────────────────────────── */
.roster-modal-body { max-height: 60vh; overflow-y: auto; }
.roster-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  border-radius: 4px;
}
.roster-row:hover { background: var(--gray-50); }
.roster-row:last-child { border-bottom: none; }
.roster-row .r-num { font-size: 14px; font-weight: 800; color: var(--pink); width: 28px; }
.roster-row .r-pos { font-size: 11px; color: var(--gray-400); font-weight: 600; width: 24px; }
.roster-row .r-name { flex: 1; font-size: 13px; font-weight: 600; }
.roster-row .r-status { font-size: 10px; padding: 2px 6px; border-radius: 3px; font-weight: 700; }
.roster-row .r-status.on { background: #ffe0e8; color: var(--red); }
.roster-row .r-status.bench { background: var(--gray-100); color: var(--gray-500, #888); }

/* ── BOX SCORE VIEW ──────────────────────────────────────────────── */
.box-view { display: none; flex-direction: column; gap: 20px; padding: 16px; }
.box-view.active { display: flex; }
.box-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.box-table th { text-align: left; padding: 6px 10px; font-size: 10px; font-weight: 700; letter-spacing: 0.05em; color: var(--gray-500, #888); border-bottom: 2px solid var(--gray-200); background: var(--gray-50); }
.box-table th:not(:first-child) { text-align: right; }
.box-table td { padding: 7px 10px; border-bottom: 1px solid var(--gray-100); }
.box-table td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.box-table tr:hover td { background: var(--gray-50); }
.box-table .team-header td { font-weight: 800; font-size: 11px; background: var(--gray-100); letter-spacing: 0.04em; }
.box-table .player-name { font-weight: 600; }
.box-table .highlight { font-weight: 800; color: var(--red); }

/* ── LOG VIEW ────────────────────────────────────────────────────── */
.log-view { display: none; flex-direction: column; padding: 16px; }
.log-view.active { display: flex; }
.log-list { display: flex; flex-direction: column; gap: 4px; max-width: 600px; }

/* ── RESPONSIVE ──────────────────────────────────────────────────── */
.court-view { display: flex; }
.court-view.hidden { display: none; }

/* ── SETUP SCREEN ────────────────────────────────────────────────── */
#setup-screen {
  position: fixed;
  inset: 0;
  background: var(--white);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  padding: 40px 20px 60px;
}
#setup-screen.hidden { display: none; }

.setup-header {
  text-align: center;
  margin-bottom: 36px;
}
.setup-header h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--gray-800);
  letter-spacing: -0.02em;
}
.setup-header p {
  font-size: 13px;
  color: var(--gray-400);
  margin-top: 4px;
}
.demo-btn {
  margin-top: 12px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font);
  border: 1.5px dashed var(--gray-300, #ccc);
  border-radius: var(--radius);
  cursor: pointer;
  background: transparent;
  color: var(--gray-400);
}
.demo-btn:hover { border-color: var(--gray-400); color: var(--gray-600); background: var(--gray-50); }
.setup-cancel-btn {
  margin-top: 8px;
  margin-left: 8px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font);
  border: 1.5px solid var(--gray-300, #ccc);
  border-radius: var(--radius);
  cursor: pointer;
  background: transparent;
  color: var(--gray-500);
}
.setup-cancel-btn:hover { background: var(--gray-100); }

.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 32px;
  width: 100%;
  max-width: 760px;
}

.setup-step {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.setup-step-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--gray-600);
  text-transform: uppercase;
}
.setup-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gray-800);
  color: var(--white);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.setup-step-num.done { background: #16a34a; }

/* file drop zone */
.drop-zone {
  border: 2px dashed var(--gray-200);
  border-radius: 10px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--pink);
  background: #fff0f5;
}
.drop-zone input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.drop-zone-icon { font-size: 28px; margin-bottom: 8px; }
.drop-zone-label { font-size: 14px; font-weight: 700; color: var(--gray-800); }
.drop-zone-sub { font-size: 12px; color: var(--gray-400); margin-top: 3px; }
.drop-zone.loaded { border-color: #16a34a; background: #f0fdf4; }
.drop-zone.loaded .drop-zone-icon { color: #16a34a; }

/* game info summary after load */
.game-info-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 14px 18px;
  display: none;
  gap: 24px;
  flex-wrap: wrap;
}
.game-info-card.visible { display: flex; }
.game-info-item { display: flex; flex-direction: column; gap: 2px; }
.game-info-label { font-size: 10px; font-weight: 700; color: var(--gray-400); letter-spacing: 0.06em; text-transform: uppercase; }
.game-info-value { font-size: 14px; font-weight: 700; color: var(--gray-800); }

/* matchup bar */
.matchup-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 16px 24px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
}
.matchup-team { text-align: center; }
.matchup-abbr { font-size: 22px; font-weight: 800; color: var(--red); }
.matchup-name { font-size: 11px; color: var(--gray-400); font-weight: 600; margin-top: 2px; }
.matchup-vs { font-size: 16px; color: var(--gray-300, #ccc); font-weight: 300; }

/* starters picker */
.starters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.starters-team-col { display: flex; flex-direction: column; gap: 8px; }
.starters-team-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gray-600);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}
.starters-count {
  font-size: 10px;
  background: var(--gray-100);
  color: var(--gray-600);
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
}
.starters-count.full { background: #dcfce7; color: #16a34a; }

.starter-pick-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.1s;
  background: var(--white);
}
.starter-pick-row:hover { border-color: var(--pink); background: #fff0f5; }
.starter-pick-row.selected { border-color: var(--red); background: #fff0f5; }
.starter-pick-row.selected .sp-num { color: var(--red); }
.starter-pick-row .sp-check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--gray-200);
  flex-shrink: 0;
  transition: all 0.1s;
}
.starter-pick-row.selected .sp-check {
  background: var(--red);
  border-color: var(--red);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3 3 7-7' stroke='white' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 8px;
}
.sp-num { font-size: 13px; font-weight: 800; color: var(--pink); width: 28px; flex-shrink: 0; }
.sp-pos { font-size: 10px; color: var(--gray-400); font-weight: 600; width: 22px; flex-shrink: 0; }
.sp-name { font-size: 13px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* start game button */
.start-game-btn {
  padding: 14px 40px;
  background: var(--gray-800);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  align-self: center;
  transition: opacity 0.15s;
}
.start-game-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.start-game-btn:not(:disabled):hover { background: #111; }

/* new game btn in topbar */
.new-game-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--white);
  color: var(--gray-600);
}
.new-game-btn:hover { background: var(--gray-100); }

.events-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--white);
  color: #6600cc;
}
.events-btn:hover { background: #f3e8ff; border-color: #c084fc; }

.install-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font);
  border: 1px solid #2563eb;
  border-radius: var(--radius);
  cursor: pointer;
  background: #eff6ff;
  color: #2563eb;
  align-items: center;
  gap: 4px;
}
.install-btn:hover { background: #dbeafe; }

.ios-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #eff6ff;
  border-bottom: 1px solid #bfdbfe;
  color: #1e40af;
  font-size: 13px;
  font-family: var(--font);
  padding: 8px 16px;
}
.ios-hint-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #1e40af;
  line-height: 1;
  padding: 0 4px;
}

.action-chip.event-chip:hover { border-color: #6600cc; color: #6600cc; background: #f3e8ff; }

.log-team.GAME { background: #ede9fe; color: #6600cc; }

/* ── EDIT ACTION MODAL ───────────────────────────────────────────── */
.edit-field { margin-bottom: 14px; }
.edit-field-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gray-600);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.edit-select {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--white);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23aaa'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.edit-select:focus { outline: none; border-color: var(--pink); }
.edit-input {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  color: var(--gray-800);
}
.edit-input:focus { outline: none; border-color: var(--pink); }
.edit-meta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.edit-footer { display: flex; gap: 8px; margin-top: 16px; }
.edit-delete-btn {
  padding: 10px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  background: var(--white);
  color: var(--red);
}
.edit-delete-btn:hover { background: #fff0f0; border-color: var(--red); }
.edit-save-btn {
  flex: 1;
  padding: 10px;
  background: var(--gray-800);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
}
.edit-save-btn:hover { background: #111; }
/* selected chip state */
.action-chip.selected { border-color: var(--pink); color: var(--pink); background: #fff0f5; }
.action-chip.danger.selected { border-color: var(--red); color: var(--red); background: #fff0f0; }
.action-chip.event-chip.selected { border-color: #6600cc; color: #6600cc; background: #f3e8ff; }

/* ── LOGIN SCREEN ────────────────────────────────────────────────── */
#login-screen {
  position: fixed;
  inset: 0;
  background: #1a1a2e;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
#login-screen.login-hidden { display: none; }
.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 40px 36px;
  width: 360px;
  max-width: 90vw;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.login-logo { font-size: 44px; text-align: center; margin-bottom: 6px; }
.login-title {
  font-size: 26px; font-weight: 800; text-align: center;
  color: #1a1a2e; letter-spacing: -0.5px; margin-bottom: 4px;
}
.login-sub { text-align: center; color: var(--gray-400); font-size: 13px; margin-bottom: 28px; }
.login-field { margin-bottom: 12px; }
.login-input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--gray-200); border-radius: 8px;
  font-size: 14px; font-family: var(--font); outline: none;
  transition: border-color 0.15s;
}
.login-input:focus { border-color: #1d4ed8; }
.login-btn {
  width: 100%; padding: 11px;
  background: #1a1a2e; color: var(--white);
  border: none; border-radius: 8px;
  font-size: 14px; font-weight: 700; font-family: var(--font);
  cursor: pointer; margin-top: 4px; transition: background 0.15s;
}
.login-btn:hover:not(:disabled) { background: #2e2e50; }
.login-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.login-error {
  color: #dc2626; font-size: 13px; margin-top: 10px; text-align: center;
}
.login-offline-notice {
  margin-top: 18px; padding: 12px 14px;
  background: #fef3c7; border-radius: 8px;
  color: #92400e; font-size: 13px; text-align: center; line-height: 1.5;
}

/* ── FINALIZE ────────────────────────────────────────────────────── */
.finalize-btn {
  padding: 5px 12px; font-size: 12px; font-weight: 700; font-family: var(--font);
  border: 1px solid #16a34a; border-radius: var(--radius);
  cursor: pointer; background: #f0fdf4; color: #16a34a;
}
.finalize-btn:hover { background: #dcfce7; }
.finalize-steps {
  display: flex; flex-direction: column; gap: 6px;
  margin: 12px 0 4px; padding: 12px 14px;
  background: var(--gray-50); border-radius: var(--radius);
}
.finalize-step { font-size: 13px; color: var(--gray-600); }
.finalize-status { min-height: 20px; font-size: 13px; color: #1d4ed8; margin: 8px 0; font-weight: 600; }
.finalize-status.finalize-error { color: #dc2626; }
.finalize-confirm-btn {
  padding: 8px 18px; background: #16a34a; color: var(--white);
  border: none; border-radius: var(--radius);
  font-size: 13px; font-weight: 700; font-family: var(--font); cursor: pointer;
}
.finalize-confirm-btn:hover { background: #15803d; }
.finalize-confirm-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── USER BADGE ──────────────────────────────────────────────────── */
.user-badge {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--gray-600); font-family: var(--font); font-weight: 600;
}
.logout-btn {
  background: none; border: none; cursor: pointer;
  font-size: 14px; color: var(--gray-400); padding: 2px 4px; line-height: 1;
}
.logout-btn:hover { color: var(--gray-800); }

/* ── GAME ID LOADER ──────────────────────────────────────────────── */
.game-id-loader { margin-top: 16px; }
.game-id-divider {
  font-size: 11px; font-weight: 700; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: 0.06em;
  text-align: center; margin-bottom: 10px;
}
.game-id-row { display: flex; gap: 8px; }
.game-id-input {
  flex: 1; padding: 8px 12px; border: 1.5px solid var(--gray-200);
  border-radius: var(--radius); font-size: 13px; font-family: var(--font); outline: none;
}
.game-id-input:focus { border-color: #1d4ed8; }
.game-id-btn {
  padding: 8px 14px; background: #1a1a2e; color: var(--white);
  border: none; border-radius: var(--radius);
  font-size: 13px; font-weight: 700; font-family: var(--font); cursor: pointer;
}
.game-id-btn:hover:not(:disabled) { background: #2e2e50; }
.game-id-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.game-id-note { font-size: 11px; color: var(--gray-400); margin-top: 6px; text-align: center; }

/* ── AUSPEX WORLD LEAGUE: Ergaenzungen zum Prototyp ─────────────────────── */
.screen:not(.active) { display: none !important; }
#login-screen.active { display: flex; }
#games-screen.active, #setup-screen.active { display: block; }
#game-screen.active { display: flex; flex-direction: column; flex: 1; min-height: 100vh; }
#game-screen .main { flex: 1; }
.games-tools { display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 10px; }
.games-tools .user-badge { color: var(--gray-600); }
.games-list { max-width: 980px; margin: 16px auto; padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.game-row { display: flex; align-items: center; gap: 16px; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 12px 16px; background: var(--white); }
.game-date { font-size: 13px; font-weight: 700; min-width: 92px; color: var(--gray-800); } .game-date span { color: var(--gray-400); font-weight: 600; }
.game-teams { flex: 1; font-size: 15px; } .game-teams .vs { color: var(--gray-400); font-size: 12px; margin: 0 6px; } .game-meta { font-size: 12px; color: var(--gray-600); margin-top: 4px; }
.pill { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 10px; background: var(--gray-100); color: var(--gray-600); }
.pill.live { background: #ffe0e8; color: var(--red); } .pill.done { background: var(--gray-200); }
.setup-hint { font-size: 12px; color: var(--gray-400); font-weight: 500; margin-left: 8px; }
.starter-pick-row.dq { opacity: .45; } .starter-pick-row .sp-num { cursor: text; }
.period-pill { font-size: 13px; font-weight: 800; letter-spacing: .04em; color: var(--gray-800); background: var(--gray-100); border-radius: var(--radius); padding: 5px 10px; white-space: nowrap; }
.clock-btn.running { border-color: var(--red); color: var(--red); } .clock-btn:disabled { opacity: .5; cursor: default; }
.clock-edit-btn, .period-btn, .rejected-btn { border: 1px solid var(--gray-200); background: var(--white); border-radius: var(--radius); padding: 5px 10px; font-size: 13px; font-family: var(--font); cursor: pointer; }
.period-btn { font-weight: 700; color: var(--white); background: var(--red); border-color: var(--red); white-space: nowrap; } .period-btn:disabled { opacity: .5; cursor: default; }
.rejected-btn { color: #b45309; border-color: #fcd34d; background: #fffbeb; font-weight: 700; }
.net-pill { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--gray-600); white-space: nowrap; }
.net-pill .net-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gray-400); }
.net-pill.ok .net-dot { background: #16a34a; } .net-pill.busy .net-dot { background: #f59e0b; } .net-pill.off .net-dot { background: var(--red); }
.banner { background: #fffbeb; color: #92400e; border-bottom: 1px solid #fcd34d; font-size: 13px; font-weight: 600; padding: 6px 20px; text-align: center; }
.court-hint { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font-size: 12px; font-weight: 700; color: rgba(0,0,0,.55); pointer-events: none; }
.team-header { cursor: pointer; } .team-fouls.bonus .coach-name { color: var(--red); } .oncourt-stats .hot { color: var(--red); font-weight: 800; }
.bench-player.dq { opacity: .4; text-decoration: line-through; }
.sync { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: #f59e0b; } .sync.sent { background: #3b82f6; }
.action-grid.one { grid-template-columns: 1fr; } .action-grid.two { grid-template-columns: repeat(2, 1fr); } .action-grid.three { grid-template-columns: repeat(3, 1fr); } .action-grid.four { grid-template-columns: repeat(4, 1fr); }
.action-chip.hot { border-color: var(--red); box-shadow: 0 0 0 2px #ffe0e8 inset; }
.sub-pick-row.none .sp-name { color: var(--gray-600); font-style: italic; }
.modal-wide { max-width: 860px; width: 94vw; }
.timeline-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.tl-period { font-size: 12px; font-weight: 800; letter-spacing: .08em; color: var(--gray-400); margin: 14px 0 6px; }
.tl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-bottom: 1px solid var(--gray-100); } .tl-row .log-entry { flex: 1; min-width: 260px; border: none; }
.tl-btns { display: flex; gap: 4px; } .tl-btns button { border: 1px solid var(--gray-200); background: var(--white); border-radius: 4px; width: 32px; height: 28px; cursor: pointer; font-size: 13px; }
.tl-btns button:disabled { opacity: .3; cursor: default; } .tl-btns button.danger { color: var(--red); }
.rej-row .tl-btns button { width: auto; padding: 0 10px; }
.tl-issue { font-size: 12px; padding: 2px 8px; border-radius: 4px; margin: 2px 0; width: 100%; } .tl-issue.error { background: #fee2e2; color: #991b1b; } .tl-issue.warning { background: #fef3c7; color: #92400e; }
.edit-issues { margin-bottom: 10px; }
.rej-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--gray-100); font-size: 13px; }
.box-table tr.on td { background: #fff7f9; } .box-table tr.totals td { font-weight: 800; border-top: 2px solid var(--gray-200); } .box-table small { color: var(--gray-400); }
.toast-stack { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 1000; pointer-events: none; }
.toast { background: var(--gray-800); color: var(--white); padding: 8px 14px; border-radius: 6px; font-size: 13px; font-weight: 600; opacity: 0; transform: translateY(8px); transition: all .25s; max-width: 90vw; }
.toast.in { opacity: 1; transform: none; } .toast.error { background: #b91c1c; } .toast.warn { background: #b45309; } .toast.ok { background: #15803d; }
