/* ==============================================================
   LeagueDay — design tokens
   Display: Oswald (condensed, scoreboard headers)
   Body: Inter
   Score digits: Roboto Mono (tabular numbers)
   ============================================================== */

:root {
  --ink: #14181F;          /* near-black navy, main dark surface */
  --ink-soft: #1D232D;
  --paper: #F7F8FA;         /* card/page background */
  --paper-dim: #ECEEF1;
  --slate: #5B6472;         /* secondary text */
  --amber: #F2B705;         /* live / score accent */
  --court: #2E7D5B;         /* success / completed */
  --line: #DEE2E7;

  --tennis: #B4D522;
  --pickleball: #17A398;
  --basketball: #F26430;
  --table_tennis: #E63946;
  --badminton: #6247AA;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(20,24,31,.08), 0 8px 24px rgba(20,24,31,.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}

h1, h2, h3, .display {
  font-family: 'Oswald', 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: .02em;
  font-weight: 600;
  margin: 0 0 .4em;
}

.score-digits {
  font-family: 'Roboto Mono', monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

a { color: inherit; }
img { max-width: 100%; display: block; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------------- Top bar ---------------- */
.topbar {
  background: var(--ink);
  color: var(--paper);
  padding: 16px 0;
  margin-bottom: 32px;
}
.topbar .container { display: flex; align-items: center; justify-content: space-between; }
.topbar .brand { font-family: 'Oswald', sans-serif; text-transform: uppercase; letter-spacing: .08em; font-size: 20px; font-weight: 700; }
.topbar .brand span { color: var(--amber); }
.topbar nav a { color: var(--paper); text-decoration: none; opacity: .8; font-size: 14px; margin-left: 18px; }
.topbar nav a:hover { opacity: 1; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 14px;
  padding: 10px 18px; border-radius: var(--radius); border: none;
  cursor: pointer; text-decoration: none;
  background: var(--ink); color: #fff;
  transition: transform .1s ease, opacity .15s ease;
}
.btn:hover { opacity: .88; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--amber); color: var(--ink); }
.btn.outline { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.danger { background: #C6303E; color: #fff; }
.btn.big { padding: 16px 24px; font-size: 16px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------------- Cards ---------------- */
.card {
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 20px;
}

.league-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px; margin-bottom: 40px;
}
.league-card {
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow);
  overflow: hidden; text-decoration: none; color: var(--ink); display: block;
  transition: transform .15s ease, box-shadow .15s ease;
}
.league-card:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgba(20,24,31,.1), 0 16px 32px rgba(20,24,31,.1); }
.league-card .banner {
  height: 90px; display: flex; align-items: center; justify-content: center;
  font-size: 40px; color: #fff;
}
.league-card .body { padding: 16px 18px; }
.league-card h3 { font-size: 17px; margin-bottom: 6px; }
.league-card .meta { font-size: 12.5px; color: var(--slate); text-transform: uppercase; letter-spacing: .04em; }
.status-pill {
  display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; padding: 3px 9px; border-radius: 20px; margin-top: 10px;
}
.status-pill.draft { background: var(--paper-dim); color: var(--slate); }
.status-pill.scheduled { background: #E4EEFF; color: #2557C7; }
.status-pill.in_progress { background: #FFF3D6; color: #A66A00; }
.status-pill.completed { background: #E1F3EA; color: var(--court); }

/* sport banner colors */
.sport-tennis { background: var(--tennis); }
.sport-pickleball { background: var(--pickleball); }
.sport-basketball { background: var(--basketball); }
.sport-table_tennis { background: var(--table_tennis); }
.sport-badminton { background: var(--badminton); }

/* ---------------- Forms ---------------- */
label { display: block; font-size: 13px; font-weight: 600; margin: 18px 0 6px; }
input[type=text], input[type=number], input[type=password], input[type=datetime-local], select, textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--radius); border: 1.5px solid var(--line);
  font-family: 'Inter', sans-serif; font-size: 14.5px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--amber); outline-offset: 1px; border-color: var(--amber); }
.field-hint { font-size: 12px; color: var(--slate); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
fieldset { border: 1.5px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; margin: 20px 0; }
legend { font-family: 'Oswald', sans-serif; text-transform: uppercase; font-size: 13px; padding: 0 8px; }

.sport-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.sport-option {
  border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 16px;
  cursor: pointer; text-align: center; font-size: 13px; font-weight: 600; flex: 1; min-width: 110px;
}
.sport-option .ic { font-size: 26px; display: block; margin-bottom: 4px; }
.sport-option.checked { border-color: var(--amber); background: #FFF9E8; }
.sport-option:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ---------------- Participants list ---------------- */
.participant-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.participant-row:last-child { border-bottom: none; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--paper-dim);
  display: flex; align-items: center; justify-content: center; font-weight: 700; overflow: hidden; flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.drag-handle { cursor: grab; color: var(--slate); }

/* ---------------- Standings table ---------------- */
table.standings { width: 100%; border-collapse: collapse; font-size: 14px; }
table.standings th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--slate); padding: 8px 10px; border-bottom: 2px solid var(--line); }
table.standings td { padding: 10px; border-bottom: 1px solid var(--line); }
table.standings tr:first-child td { font-weight: 700; }
.medal-icon { font-size: 18px; vertical-align: middle; }
.team-cell { display: flex; align-items: center; gap: 10px; }

/* ---------------- Bracket ---------------- */
.bracket-wrap { overflow-x: auto; padding: 20px 0; }
.bracket { display: flex; gap: 40px; align-items: center; min-width: max-content; }
.bracket-round { display: flex; flex-direction: column; justify-content: space-around; gap: 24px; min-width: 220px; }
.bracket-round h4 { font-size: 12px; color: var(--slate); text-align: center; margin-bottom: 10px; }
.match-box {
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden;
  text-decoration: none; color: var(--ink); display: block;
}
.match-box .slot { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; font-size: 13.5px; }
.match-box .slot:first-child { border-bottom: 1px solid var(--line); }
.match-box .slot.winner { font-weight: 700; background: #FFF9E8; }
.match-box .slot .nm { display: flex; align-items: center; gap: 8px; }
.match-box .slot .sc { font-family: 'Roboto Mono', monospace; font-weight: 700; }
.match-box .tbd { color: var(--slate); font-style: italic; }
.match-box .when { font-size: 11px; color: var(--slate); padding: 6px 12px; background: var(--paper-dim); }
.match-box.live { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(242,183,5,.25); }

/* ---------------- Schedule list ---------------- */
.schedule-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; margin-bottom: 10px;
}
.schedule-item .who { font-weight: 600; }
.schedule-item .when { font-size: 13px; color: var(--slate); }
.live-badge {
  background: #C6303E; color: #fff; font-size: 11px; font-weight: 700; text-transform: uppercase;
  padding: 3px 9px; border-radius: 20px; display: inline-flex; align-items: center; gap: 5px;
}
.live-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------------- LIVE SCOREBOARD (jumbotron) ---------------- */
.jumbotron {
  background: var(--ink); color: #fff; min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 30px 20px; text-align: center;
}
.jumbotron .sport-tag {
  color: var(--amber); text-transform: uppercase; letter-spacing: .1em; font-size: 26px; font-weight: 700;
  font-family: 'Oswald', sans-serif; margin-bottom: 8px;
}
.jumbotron .round-tag { color: rgba(255,255,255,.5); font-size: 14px; margin-bottom: 30px; }
.jt-teams { display: flex; align-items: center; gap: 40px; justify-content: center; flex-wrap: wrap; }
.jt-team { display: flex; flex-direction: column; align-items: center; gap: 14px; min-width: 220px; }
.jt-team .avatar { width: 76px; height: 76px; font-size: 26px; }
.jt-team h2 { font-size: 26px; margin: 0; }
.jt-score { font-size: 96px; line-height: 1; }
.jt-vs { color: rgba(255,255,255,.35); font-size: 22px; font-family: 'Oswald', sans-serif; }
.jt-sets { display: flex; gap: 8px; margin-top: 10px; }
.jt-sets span { background: rgba(255,255,255,.08); border-radius: 6px; padding: 4px 10px; font-family: 'Roboto Mono', monospace; font-size: 14px; }
.jt-sets span.won { background: var(--amber); color: var(--ink); font-weight: 700; }
.jt-game-clock {
  display: flex; align-items: center; gap: 16px; justify-content: center; margin-bottom: 24px;
}
.jt-game-clock #quarter-tag {
  font-family: 'Oswald', sans-serif; text-transform: uppercase; letter-spacing: .08em;
  background: rgba(255,255,255,.08); padding: 6px 14px; border-radius: 20px; font-size: 15px;
}
.jt-game-clock #clock-tag { font-size: 28px; color: var(--amber); }
.jt-live-flag { margin-top: 34px; }
.jt-final {
  margin-top: 24px; font-family: 'Oswald', sans-serif; text-transform: uppercase; letter-spacing: .08em;
  color: var(--court); font-size: 44px; font-weight: 700;
}

/* ---------------- Score entry (admin) ---------------- */
.score-panel { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; margin: 24px 0; }
.score-side { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 24px; text-align: center; min-width: 220px; }
.score-side h3 { margin-bottom: 14px; }
.score-side .big-score { font-size: 64px; margin: 10px 0; }
.score-side .tap-row { display: flex; gap: 10px; justify-content: center; }
.tap-btn {
  width: 56px; height: 56px; border-radius: 50%; border: none; font-size: 24px; font-weight: 700;
  cursor: pointer; background: var(--ink); color: #fff;
}
.tap-btn.minus { background: var(--paper-dim); color: var(--ink); }
.tap-btn:active { transform: scale(.92); }
.serve-btn.active { background: var(--amber); color: var(--ink); border-color: var(--amber); font-weight: 700; }
.serve-dot {
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 10px; vertical-align: middle;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.35));
  animation: serve-bounce 1s ease-in-out infinite;
}
.serve-dot svg { display: block; }
@keyframes serve-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.set-history { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.set-history span { background: var(--paper-dim); border-radius: 6px; padding: 4px 9px; font-size: 12.5px; font-family: 'Roboto Mono', monospace; }

/* ---------------- Alerts / empty states ---------------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--slate); }
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert.error { background: #FDEAEC; color: #A6293A; }
.alert.success { background: #E1F3EA; color: var(--court); }

/* ---------------- Login ---------------- */
.login-wrap { max-width: 380px; margin: 80px auto; }

/* ---------------- Utility ---------------- */
.flex { display: flex; align-items: center; gap: 10px; }
.flex.between { justify-content: space-between; }
.mt-0 { margin-top: 0; }
.text-slate { color: var(--slate); }
.badge-chip { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 3px 9px; border-radius: 20px; color: #fff; font-weight: 700; }

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .jt-teams { gap: 16px; }
  .jt-score { font-size: 64px; }
  .jt-team .avatar { width: 56px; height: 56px; font-size: 20px; }
  .bracket-round { min-width: 180px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------------- Confetti ---------------- */
.confetti-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 9999; overflow: hidden;
}
.confetti-piece {
  position: absolute; top: -20px; opacity: .95;
  animation-name: confetti-fall; animation-timing-function: ease-in; animation-fill-mode: forwards;
}
@keyframes confetti-fall {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--drift), 115vh) rotate(720deg); opacity: 0; }
}

/* ---------------- Winner banner (admin) ---------------- */
.winner-banner {
  text-align: center; font-family: 'Oswald', sans-serif; text-transform: uppercase;
  letter-spacing: .06em; font-size: 30px; font-weight: 700; color: var(--court);
  background: #E1F3EA; border-radius: var(--radius-lg); padding: 22px; margin: 20px 0;
}

/* ---------------- League name (bigger, both admin & public) ---------------- */
.league-title {
  font-family: 'Oswald', sans-serif; text-transform: uppercase; letter-spacing: .06em;
  font-size: 26px; font-weight: 700;
}

@media (max-width: 640px) {
  .winner-banner { font-size: 22px; padding: 16px; }
  .league-title { font-size: 20px; }
}
