:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, 0.15);
  --green: #3fb950;
  --green-soft: rgba(63, 185, 80, 0.15);
  --gold: #d29922;
  --border: #30363d;
  --radius: 12px;
  --font: 'Outfit', -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

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

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  margin-bottom: 1.5rem;
}

.title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.title-emoji {
  font-size: 1.5rem;
  line-height: 1;
}

.variant-tabs {
  display: flex;
  gap: 0.5rem;
}

.tab {
  font: inherit;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}

.tab:hover {
  background: var(--surface2);
  border-color: var(--text-muted);
}

.tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.reset-btn {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: 0.65rem 1rem;
  min-height: 44px;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.reset-btn:hover {
  background: var(--surface2);
  border-color: var(--text-muted);
  color: var(--text);
}

.reset-btn:active {
  background: var(--border);
}

.main {
  flex: 1;
}

.section {
  margin-bottom: 2rem;
}

.section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.groups-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 480px) {
  .groups-grid {
    grid-template-columns: 1fr;
  }
}

.group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.group-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  color: var(--accent);
}

.group-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.group-card li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.group-card li:last-child {
  border-bottom: none;
}

.team-with-color {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.team-color-dot {
  display: inline-block;
  width: 0.75rem;
  min-width: 0.25rem;
  height: 1.1em;
  border-radius: 2px;
  flex-shrink: 0;
  vertical-align: middle;
}

.team-with-color .team-name {
  font-weight: inherit;
}

.group-card .slot {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 2rem;
}

.teams-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.teams-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-weight: 500;
}

.matches-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.match-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
}

.match-card .meta {
  grid-column: 1 / -1;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.match-card .team {
  font-weight: 600;
  text-align: right;
  min-width: 0;
  white-space: nowrap;
}

.match-card .team.right {
  text-align: left;
}

.match-card .score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 0;
  flex-shrink: 0;
}

.match-card input.score-input {
  width: 2.5rem;
  padding: 0.4rem;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  /* Hide number input spinner arrows */
  -moz-appearance: textfield;
  appearance: textfield;
}
.match-card input.score-input::-webkit-outer-spin-button,
.match-card input.score-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.match-card input.score-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.match-card .sep {
  color: var(--text-muted);
  font-weight: 400;
}

.match-card .slot-label {
  grid-column: 1 / -1;
  font-size: clamp(0.65rem, 2.8vw, 0.85rem);
  color: var(--gold);
  margin-bottom: 0.25rem;
  white-space: nowrap;
}

.finals-list .match-card {
  grid-template-columns: 1fr auto 1fr;
}

.finals-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: -0.5rem 0 0.75rem 0;
}

.group-standings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 560px) {
  .group-standings-grid {
    grid-template-columns: 1fr;
  }
}

.group-standing-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.group-standing-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  padding: 0.75rem 1rem;
  background: var(--surface2);
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}

.group-standing-wrap .standings-table-wrap {
  border: none;
  border-radius: 0;
}

.standings-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

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

.standings-table th {
  background: var(--surface2);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.standings-table th:nth-child(n+3),
.standings-table td:nth-child(n+3) {
  text-align: center;
}

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

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

.footer {
  margin-top: auto;
  padding-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer p {
  margin: 0;
}
