:root {
  --vert: #1a7a3f;
  --vert-clair: #eaf7ef;
  --vert-fonce: #0f5229;
  --or: #c8a000;
  --bg: #f7f7f5;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b6b68;
  --border: rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.07);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* HEADER */
header {
  background: var(--vert);
  color: white;
  text-align: center;
  padding: 2rem 1rem 1.5rem;
}
header .logo { font-size: 3rem; margin-bottom: 0.5rem; }
header h1 { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; }
header p { font-size: 0.875rem; opacity: 0.8; margin-top: 4px; }

/* NAV TABS */
.nav-tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 1rem;
  background: var(--vert-fonce);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-tab {
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.7);
  transition: all 0.2s;
}
.nav-tab:hover { color: white; background: rgba(255,255,255,0.1); }
.nav-tab.active { background: white; color: var(--vert); }

/* MAIN LAYOUT */
main { max-width: 700px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

.page { display: none; }
.page.active { display: block; }

/* CARDS */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* MATCH CARD */
.match-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  transition: box-shadow 0.2s;
}
.match-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.match-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.match-meta .groupe { color: var(--vert); font-weight: 600; }

.match-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 1rem;
}
.team { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.team-flag { font-size: 2rem; }
.team-name { font-size: 0.8rem; font-weight: 500; text-align: center; }
.vs { font-size: 0.8rem; color: var(--text-muted); }

/* SCORE INPUT */
.score-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 0.75rem;
}
.score-box {
  width: 48px;
  height: 48px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s;
}
.score-box:focus {
  outline: none;
  border-color: var(--vert);
  background: white;
}
.score-dash { font-size: 1.25rem; color: var(--text-muted); }

/* WINNER BUTTONS */
.winner-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.winner-btn {
  padding: 5px 12px;
  font-size: 0.75rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: white;
  color: var(--text-muted);
  transition: all 0.15s;
  font-weight: 500;
}
.winner-btn:hover { border-color: var(--vert); color: var(--vert); }
.winner-btn.selected-win { background: var(--vert); color: white; border-color: var(--vert); }
.winner-btn.selected-draw { background: var(--or); color: white; border-color: var(--or); }

/* SCORE REEL AFFICHÉ */
.score-reel-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--vert-clair);
  color: var(--vert);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* FORMULAIRE NOM */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 5px; }
.field input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  background: white;
  color: var(--text);
  transition: border-color 0.2s;
}
.field input:focus { outline: none; border-color: var(--vert); }

/* BOUTON PRINCIPAL */
.btn-primary {
  display: block;
  width: 100%;
  padding: 13px;
  background: var(--vert);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 0.5rem;
}
.btn-primary:hover { background: var(--vert-fonce); }
.btn-primary:active { transform: scale(0.98); }

/* CLASSEMENT */
.ranking-list { list-style: none; }
.ranking-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.ranking-row:last-child { border-bottom: none; }
.rank-pos { font-size: 1.1rem; text-align: center; }
.rank-name { font-size: 0.9rem; font-weight: 500; }
.rank-detail { font-size: 0.75rem; color: var(--text-muted); }
.pts-pill {
  background: var(--vert-clair);
  color: var(--vert);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

/* LEGENDE POINTS */
.legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.legend-badge {
  background: var(--vert);
  color: white;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 0.75rem;
  font-weight: 600;
}
.legend-badge.or { background: var(--or); }

/* TOAST */
#toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #222;
  color: white;
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 0.875rem;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.success { background: var(--vert); }

/* PAGE ADMIN */
.admin-login { max-width: 380px; margin: 2rem auto; }
.admin-section { display: none; }
.admin-section.visible { display: block; }

.result-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.result-row:last-child { border-bottom: none; }
.result-team { text-align: center; }
.result-score-input {
  width: 42px;
  height: 38px;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}
.result-score-input:focus { outline: none; border-color: var(--vert); }

/* INFO BANNER */
.info-banner {
  background: var(--vert-clair);
  border-left: 3px solid var(--vert);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--vert-fonce);
  margin-bottom: 1rem;
}

/* RESPONSIVE */
@media (max-width: 500px) {
  header h1 { font-size: 1.3rem; }
  .nav-tab { padding: 7px 14px; font-size: 0.8rem; }
  .team-flag { font-size: 1.6rem; }
  .team-name { font-size: 0.72rem; }
}
