:root {
  --primary: #F21F50;
  --secondary: #C104D6;
  --green: #22C55E;
  --gold: #FFD700;
  --silver: #C0C0C0;
  --bronze: #CD7F32;
  --bg: #0D1B2A;
  --surface: #1A2E45;
  --border: rgba(248, 250, 252, 0.1);
  --text: #F8FAFC;
  --muted: #94A3B8;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  margin: 0;
  padding-bottom: 72px;
}

h1, h2, h3, .brand { font-family: 'Baloo 2', cursive; }

.app-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-header h1 { margin: 0; font-size: 1.25rem; font-weight: 700; color: #fff; }

.container { max-width: 640px; margin: 0 auto; padding: 1rem 1rem 1.5rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.match-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  transition: border-color 0.2s ease;
}
.match-card.tipped  { border-color: var(--green); }
.match-card.locked  { opacity: 0.6; }

.team-block { flex: 1; min-width: 0; }
.team-row   { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.2rem; }
.team-flag  { width: 24px; height: 18px; border-radius: 2px; flex-shrink: 0; }
.team-name  { font-size: 0.875rem; font-weight: 500; white-space: nowrap;
              overflow: hidden; text-overflow: ellipsis; }
.match-time { font-size: 0.75rem; color: var(--muted); margin-top: 0.25rem; }

.score-inputs { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.score-inputs input[type="number"] {
  width: 48px; height: 48px;
  text-align: center; font-size: 1.1rem; font-weight: 700;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  -moz-appearance: textfield;
}
.score-inputs input[type="number"]::-webkit-inner-spin-button,
.score-inputs input[type="number"]::-webkit-outer-spin-button { display: none; }
.score-inputs .sep { font-size: 1.1rem; font-weight: 700; color: var(--muted); }
.score-inputs button {
  height: 48px; min-width: 44px; padding: 0 0.75rem;
  background: var(--primary); color: #fff;
  border: none; border-radius: 8px;
  font-weight: 700; cursor: pointer;
  transition: opacity 0.2s ease;
}
.score-inputs button:hover { opacity: 0.85; }

.locked-score {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 1rem; font-weight: 700; color: var(--muted);
}

.pts-badge {
  display: inline-block;
  font-size: 0.7rem; font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 99px; white-space: nowrap; margin-top: 0.25rem;
}
.pts-badge.p5 { background: var(--green); color: #fff; }
.pts-badge.p3 { background: #3B82F6; color: #fff; }
.pts-badge.p1 { background: #64748B; color: #fff; }
.pts-badge.p0 { background: #374151; color: var(--muted); }

.stage-header {
  font-family: 'Baloo 2', cursive;
  font-size: 1rem; font-weight: 700;
  color: var(--primary);
  margin: 1.25rem 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid var(--primary);
}

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around;
  padding: 0.4rem 0 env(safe-area-inset-bottom);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center;
  font-size: 0.65rem; color: var(--muted);
  text-decoration: none;
  min-width: 48px; min-height: 48px;
  padding: 0.25rem;
  cursor: pointer;
  transition: color 0.2s ease;
}
.bottom-nav a.active, .bottom-nav a:hover { color: var(--primary); }
.bottom-nav svg { width: 22px; height: 22px; margin-bottom: 2px; }

.desktop-nav { display: none; }

.podium-row { display: flex; gap: 0.75rem; margin-bottom: 1rem; }
.podium-card {
  flex: 1; border-radius: 12px; padding: 1rem 0.5rem;
  text-align: center; font-weight: 700;
}
.podium-card.gold   { background: linear-gradient(135deg, #FFD700, #FFA500); color: #1a1a1a; }
.podium-card.silver { background: linear-gradient(135deg, #C0C0C0, #A0A0A0); color: #1a1a1a; }
.podium-card.bronze { background: linear-gradient(135deg, #CD7F32, #8B4513); color: #fff; }
.podium-medal { font-size: 1.5rem; }
.podium-name  { font-size: 0.85rem; margin: 0.2rem 0; overflow: hidden;
                text-overflow: ellipsis; white-space: nowrap; }
.podium-pts   { font-size: 1rem; }

.rank-row {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 0.75rem; border-radius: 8px; margin-bottom: 0.25rem;
}
.rank-row.me { background: rgba(242,31,80,0.12); border: 1px solid var(--primary); }
.rank-num  { width: 28px; text-align: right; font-weight: 700; color: var(--muted); }
.rank-name { flex: 1; font-weight: 500; }
.rank-correct { font-size: 0.8rem; color: var(--muted); }
.rank-pts  { font-weight: 700; color: var(--primary); }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.875rem; color: var(--muted); margin-bottom: 0.3rem; }
.form-group input, .form-group select {
  width: 100%; padding: 0.75rem;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 1rem; font-family: inherit; min-height: 48px;
}
.form-group input:focus, .form-group select:focus {
  outline: 2px solid var(--primary); outline-offset: 1px;
}
.form-group select option { background: var(--bg); }

.btn-primary {
  display: block; width: 100%; padding: 0.875rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff; font-family: 'Baloo 2', cursive;
  font-size: 1rem; font-weight: 700;
  border: none; border-radius: 8px;
  cursor: pointer; min-height: 48px;
  transition: opacity 0.2s ease;
}
.btn-primary:hover { opacity: 0.9; }

.error-box {
  background: rgba(242,31,80,0.12);
  border: 1px solid var(--primary);
  border-radius: 8px; padding: 0.75rem 1rem;
  color: #FCA5A5; margin-bottom: 1rem; font-size: 0.9rem;
}

.bonus-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 1.25rem; margin-bottom: 1rem;
}
.bonus-card h3 {
  font-family: 'Baloo 2', cursive;
  margin: 0 0 0.75rem; font-size: 1rem; color: var(--text);
}
.bonus-locked-val {
  font-weight: 600; color: var(--green);
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}

@media (min-width: 640px) {
  body { padding-bottom: 0; }
  .bottom-nav { display: none; }
  .desktop-nav {
    display: flex; gap: 1.25rem; align-items: center;
  }
  .desktop-nav a {
    color: rgba(255,255,255,0.85); text-decoration: none;
    font-weight: 600; font-size: 0.9rem;
    cursor: pointer; transition: color 0.2s;
  }
  .desktop-nav a:hover { color: #fff; }
}

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