:root {
  --navy: #0a1e3d;
  --navy-light: #132d54;
  --navy-dark: #060f1f;
  --gold: #c9a84c;
  --gold-light: #e8d48b;
  --gold-dark: #a08030;
  --bg: #f4f5f9;
  --bg-card: #ffffff;
  --text: #374151;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f0f1f4;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --shadow-sm: 0 1px 3px rgba(10,30,61,0.06), 0 1px 2px rgba(10,30,61,0.04);
  --shadow-md: 0 4px 16px rgba(10,30,61,0.08), 0 2px 4px rgba(10,30,61,0.04);
  --shadow-lg: 0 10px 40px rgba(10,30,61,0.1), 0 4px 12px rgba(10,30,61,0.05);
  --shadow-gold: 0 4px 20px rgba(201,168,76,0.2);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3 {
  color: var(--navy);
  letter-spacing: -0.02em;
}

@font-face {
  font-family: 'Soccer Scoreboard';
  src: url('/fonts/soccer_scoreboard.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 { font-size: 1.5rem; font-weight: 700; }

/* ── Navigation ── */
nav {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 50%, var(--navy-light) 100%);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(10,30,61,0.3);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  height: 64px;
  gap: 2rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: #fff;
  font-family: 'Soccer Scoreboard';
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.nav-brand-icon {
  padding-bottom: 7px;
  font-size: 1.4rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.nav-brand-text .gold {
  color: var(--gold);
  text-shadow: 0 0 20px rgba(201,168,76,0.4);
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  margin-left: 1rem;
}

.nav-link {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.2s;
  letter-spacing: 0.01em;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.nav-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.nav-user-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--navy-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 2px 8px rgba(201,168,76,0.3);
}

.nav-user-name {
  color: rgba(255,255,255,0.9);
  font-weight: 500;
  font-size: 0.9rem;
}

.nav-logout {
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  transition: all 0.2s;
}

.nav-logout:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.08);
}

/* ── Container ── */
.container {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* ── Login Page ── */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 64px);
  padding: 2rem;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 3rem;
  box-shadow: var(--shadow-lg);
  max-width: 440px;
  width: 100%;
  text-align: center;
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-light), var(--gold), var(--gold-dark));
}

.login-card h1 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.login-card p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-card input {
  width: 100%;
  padding: 0.85rem 1.1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.2s;
  background: var(--bg);
}

.login-card input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(201,168,76,0.15);
  background: #fff;
}

.login-card button[type="submit"] {
  width: 100%;
  padding: 0.85rem;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  font-family: inherit;
  letter-spacing: 0.02em;
}

.login-card button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(10,30,61,0.3);
}

/* ── Groups / Accordion ── */
.groups-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.group-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  border: 1px solid var(--border-light);
  transition: box-shadow 0.3s;
}

.group-card:hover {
  box-shadow: var(--shadow-lg);
}

.group-header {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  font-family: 'Playfair Display', Georgia, serif;
  letter-spacing: 0.01em;
  transition: background 0.2s;
}

.group-header:hover {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
}

.group-header .arrow {
  font-size: 0.8rem;
  opacity: 0.7;
  width: 1.2rem;
  text-align: center;
  transition: transform 0.2s;
}

.group-header .group-title {
  flex: 1;
  font-family: 'Soccer Scoreboard';
}

.group-body {
  padding: 1.25rem;
}

.group-body.collapsed {
  display: none;
}

.group-body > .standings {
  margin-bottom: 1.25rem;
}

.group-body > .match-list {
  margin-bottom: 0;
}

/* ── Standings Table ── */
.standings {
  width: 100%;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.standings th, .standings td {
  padding: 0.5rem 0.7rem;
  text-align: center;
}

.standings td:first-child, .standings th:first-child { text-align: center; width: 2rem; }
.standings td:nth-child(2), .standings th:nth-child(2) { text-align: left; }

.standings th {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid var(--border);
}

.standings td {
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

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

.standings tbody tr:hover {
  background: rgba(201,168,76,0.04);
}

.flag {
  height: 18px;
  max-width: 28px;
  vertical-align: middle;
  margin-right: 8px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ── Match List ── */
.match-list {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

/* ── Match Card ── */
.match-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
  min-height: 100px;
  border: 1px solid var(--border-light);
  transition: all 0.25s;
}

.match-card:hover {
  /*box-shadow: var(--shadow-md);*/
  /*transform: translateY(-1px);*/
}

/* ── Match Split Layout ── */
.match-split {
  display: flex;
  width: 100%;
  height: 100%;
  position: relative;
  background: #fff;
  margin: 0;
}

.match-half {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem 0.75rem 1.75rem;
  border: 2px solid #fff;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.match-half.selected {
  background: rgba(36,120,183, 0.3);
  border: 2px solid rgb(36, 120, 183, 0);
}

.match-half:hover:not(.finished) {
  background: rgba(36,120,183, 0.3);
  border: 2px solid rgba(36, 120, 183, 0.3)
}

.match-half.finished {
  cursor: default;
  opacity: 0.55;
  border: none;
}

.match-half.finished:first-of-type{
  flex-direction: row;
  gap: 100px
}

.match-half.finished:last-of-type{
  flex-direction: row-reverse;
  gap: 100px;
}

.match-half.finished.selected {
  background: rgb(197, 239, 178, 0.3);
}

.match-half.finished.loser {
  opacity: 0.3;
  background: #ffffff;
}

.match-half.finished.loser.selected {
  background: rgb(251, 198, 194, 0.3);
}

.match-half-flag {
  height: 40px;
  max-width: 60px;
  border-radius: 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transition: transform 0.2s;
}

.match-half:hover .match-half-flag {
  /*transform: scale(1.05);*/
}

.match-half-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.match-half-goals {
  background: var(--bg);
  color: var(--navy);
  padding: 0.25rem 0.7rem;
  border-radius: 6px;
  font-size: 1rem;
  min-width: 2rem;
  text-align: center;
  font-weight: 700;
  border: 1px solid var(--border);
}

/* ── Draw Button ── */
.match-draw {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  padding: 1rem 1.25rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.match-draw:hover:not(.finished) {
  color: #ffffff;
  background: rgba(36,120,183);
  border: 2px solid rgba(36,120,183);
  box-shadow: 0 4px 16px rgba(36,120,183, 0.3);
}

.match-draw.selected {
  background: rgba(36,120,183);
  color: #ffffff;
  border: none;
}

.match-draw.finished {
  cursor: default;
  opacity: 0.4;
  background-color: rgba(10, 30, 61, 0.3);
  border: none;
}

.match-draw.finished.selected.winner {
  background: rgb(197, 239, 178, 1);
}

.match-draw.finished.selected.loser {
  background: rgb(251, 198, 194, 1);
}

/* ── Match Time ── */
.match-time {
  position: absolute;
  bottom: 0.4rem;
  right: 0.75rem;
  color: var(--text-light);
  font-size: 0.7rem;
  font-weight: 400;
  z-index: 2;
  letter-spacing: 0.01em;
}

/* ── Match Card Result Highlights ── */
.match-card.card-correct {
  border-left: 4px solid var(--success);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(16,185,129,0.1);
}

.match-card.card-wrong {
  border-left: 4px solid var(--danger);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(239,68,68,0.1);
}

/* ── Goal Colours ── */
.goal-winner {
  background: var(--success-bg);
  color: #065f46;
  border-color: rgba(16,185,129,0.2);
}

.goal-loser {
  background: var(--danger-bg);
  color: #991b1b;
  border-color: rgba(239,68,68,0.2);
}

.goal-draw {
  background: var(--warning-bg);
  color: #92400e;
  border-color: rgba(245,158,11,0.2);
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* ── Generic Table ── */
.table-scroll table {
  min-width: 600px;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
  border: 1px solid var(--border-light);
}

th, td {
  padding: 0.9rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

th {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 100%);
  color: rgba(255,255,255,0.9);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

td {
  font-size: 0.95rem;
}

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

tbody tr {
  transition: background 0.15s;
}

tbody tr:hover {
  background: rgba(201,168,76,0.04);
}

/* ── Leaderboard ── */
.leaderboard-wrapper h1 {
  margin-bottom: 1.5rem;
}

.rank-cell {
  font-weight: 700;
  font-size: 1rem;
}

.rank-gold {
  color: var(--gold);
  font-size: 1.3rem;
}

.rank-silver {
  color: #94a3b8;
  font-size: 1.2rem;
}

.rank-bronze {
  color: #b45309;
  font-size: 1.2rem;
}

.user-cell {
  font-weight: 600;
}

.score-cell {
  font-weight: 700;
  color: var(--navy);
}

.accuracy-bar {
  display: inline-block;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* ── Forms & Buttons ── */
form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.5rem;
}

input, select, button {
  padding: 0.55rem 0.75rem;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}

button[type="submit"] {
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  /*padding: 1rem 1.25rem;
  border-radius: 8px;
  letter-spacing: 0.01em;*/
}

button[type="submit"]:hover {
  /*transform: translateY(-1px);*/
  box-shadow: 0 4px 16px rgba(10,30,61,0.25);
}

.btn {
  padding: 0.55rem 1.1rem;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
  transition: all 0.2s;
}

.btn:hover {
  background: var(--bg);
  border-color: var(--navy);
}

.btn.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.badge {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  font-size: 0.8rem;
  margin-top: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.correct { background: var(--success-bg); color: #065f46; }
.wrong { background: var(--danger-bg); color: #991b1b; }

.flash {
  background: var(--warning-bg);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  color: #92400e;
  border: 1px solid rgba(245,158,11,0.2);
  font-weight: 500;
}

small {
  color: var(--text-muted);
  font-weight: 400;
  margin-left: auto;
}

/* ── Admin ── */
.admin-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 0.75rem;
  transition: box-shadow 0.2s;
}

.admin-card:hover {
  box-shadow: var(--shadow-md);
}

.admin-card .teams {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

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

/* ── Footer ── */
.site-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--text-light);
  font-size: 0.8rem;
  border-top: 1px solid var(--border-light);
  margin-top: 3rem;
}

.site-footer .gold-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  margin: 0 0.5rem;
  vertical-align: middle;
}

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.group-card {
  animation: fadeInUp 0.4s ease-out both;
}

.group-card:nth-child(1) { animation-delay: 0.05s; }
.group-card:nth-child(2) { animation-delay: 0.1s; }
.group-card:nth-child(3) { animation-delay: 0.15s; }
.group-card:nth-child(4) { animation-delay: 0.2s; }
.group-card:nth-child(5) { animation-delay: 0.25s; }
.group-card:nth-child(6) { animation-delay: 0.3s; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-inner { padding: 0 1rem; gap: 0.75rem; }
  .nav-links { gap: 0; margin-left: 0.5rem; }
  .nav-link { padding: 0.4rem 0.6rem; font-size: 0.8rem; }
  .nav-user-name { display: none; }
  .container { padding: 0 1rem; margin: 1.25rem auto; }
  h1 { font-size: 1.6rem; }
  .group-header { padding: 0.85rem 1rem; font-size: 1rem; }
  .group-body { padding: 1rem; }

  .match-time {
    font-size: 0.5rem;
  }

  .match-half {
    padding: 1.25rem 3rem 1.5rem;
  }
  .match-half-name {
    font-size: 0.6rem;
    text-align: center;
  }
  .match-half-flag {
    height: 20px;

    max-width: 33px;
  }
  .login-card { padding: 2rem; }
  th, td { padding: 0.6rem 0.75rem; }

  .match-half.finished:first-of-type{
    gap: 10px;
  }

  .match-half.finished:last-of-type{
    gap: 10px;
  }

  .match-draw {
    font-size: 0.5rem;
    padding: 0.6rem 0.8rem;
  }

  .match-half-goals {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
  }
}

@media (max-width: 480px) {
  .nav-brand-text { display: none; }

  .match-time {
    font-size: 0.5rem;
  }

  .match-half-name {
    font-size: 0.6rem;
  }

  .match-half-flag {
    height: 20px;
    max-width: 33px;
  }

  .match-half.finished:first-of-type{
    gap: 10px;
  }

  .match-half.finished:last-of-type{
    gap: 10px;
  }

  .match-draw {
    font-size: 0.5rem;
    padding: 0.6rem 0.8rem;
  }

  .match-half-goals {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
  }
}
