/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold:    #FFD700;
  --gold-dk: #C9A900;
  --blue:    #0085C7;
  --blue-dk: #005f8f;
  --red:     #DF0024;
  --green:   #009F6B;
  --black:   #1a1a1a;
  --white:   #ffffff;
  --grey-1:  #f5f5f5;
  --grey-2:  #e8e8e8;
  --grey-3:  #999;
  --radius:  12px;
  --shadow:  0 2px 12px rgba(0,0,0,.12);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--grey-1);
  color: var(--black);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.site-header {
  background: var(--black);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}

.header-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-link {
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: .4rem;
}

.logo-text {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--gold);
  letter-spacing: .04em;
}

.logo-year {
  font-family: 'Cinzel', serif;
  font-size: .75rem;
  color: var(--grey-3);
}

.main-nav {
  display: flex;
  gap: 1rem;
}

.nav-link {
  color: var(--grey-3);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  padding: .25rem .5rem;
  border-radius: 6px;
  transition: color .2s, background .2s;
}

.nav-link:hover, .nav-link.active {
  color: var(--gold);
  background: rgba(255,215,0,.08);
}

/* ── Main content ── */
.main-content {
  flex: 1;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
}

/* ── Hero ── */
.hero { margin-bottom: 1.5rem; }

.hero-banner {
  background: linear-gradient(135deg, var(--black) 0%, #2a1f00 100%);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.hero-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,215,0,.15) 0%, transparent 60%);
  pointer-events: none;
}

.olympic-torch {
  font-size: 2.5rem;
  margin-bottom: .5rem;
  animation: flicker 2s ease-in-out infinite alternate;
}

@keyframes flicker {
  from { transform: scale(1) rotate(-2deg); }
  to   { transform: scale(1.05) rotate(2deg); }
}

.hero-title {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: 2.75rem;
  color: var(--gold);
  letter-spacing: .06em;
  text-shadow: 0 0 30px rgba(255,215,0,.4);
  line-height: 1;
}

.hero-subtitle {
  font-family: 'Cinzel', serif;
  color: var(--grey-3);
  font-size: .95rem;
  letter-spacing: .2em;
  margin-top: .25rem;
}

.herald {
  margin-top: 1.25rem;
  border-top: 1px solid rgba(255,215,0,.2);
  padding-top: 1rem;
}

.herald-text {
  color: rgba(255,255,255,.8);
  font-size: .9rem;
  line-height: 1.6;
  font-style: italic;
}

/* ── Sections ── */
.section {
  margin-bottom: 1.5rem;
}

.section-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--black);
  letter-spacing: .04em;
  margin-bottom: .75rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--gold);
}

/* ── Teams list ── */
.teams-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.team-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  box-shadow: var(--shadow);
  transition: transform .15s;
}

.team-card:hover { transform: translateX(3px); }

.team-flag { font-size: 1.25rem; }
.team-name { flex: 1; font-weight: 500; }
.team-points { font-weight: 700; color: var(--blue); font-size: .95rem; }

/* ── Events preview (index) ── */
.events-preview {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.event-preview-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--grey-2);
}

.event-preview-item.status-ongoing  { border-left-color: var(--gold); }
.event-preview-item.status-finished { border-left-color: var(--green); }

.event-num {
  width: 1.5rem;
  height: 1.5rem;
  background: var(--grey-2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.event-name { flex: 1; font-weight: 500; }

/* ── Badges ── */
.event-badge {
  font-size: .7rem;
  font-weight: 600;
  padding: .2rem .55rem;
  border-radius: 99px;
  white-space: nowrap;
}

.badge-upcoming  { background: var(--grey-2);  color: var(--grey-3); }
.badge-ongoing   { background: #fff3cd;        color: #856404; }
.badge-finished  { background: #d4edda;        color: #155724; }

/* ── CTA row ── */
.cta-row {
  display: flex;
  gap: .75rem;
  margin-bottom: 1.5rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .7rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
}

.btn:active { transform: scale(.97); }
.btn:hover  { opacity: .9; }

.btn-gold    { background: var(--gold);  color: var(--black); flex: 1; }
.btn-outline { background: transparent; color: var(--blue); border: 2px solid var(--blue); flex: 1; }
.btn-blue    { background: var(--blue);  color: var(--white); }
.btn-danger  { background: var(--red);   color: var(--white); }
.btn-full    { width: 100%; }
.btn-sm      { padding: .35rem .75rem; font-size: .8rem; }
.btn-ghost   { background: transparent; color: var(--grey-3); border: 1.5px solid var(--grey-2); }
.btn-ghost:hover { color: var(--black); border-color: var(--grey-3); opacity: 1; }

.theme-picker { margin-top: .75rem; }
.theme-drawn {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--blue);
  background: #f0f7ff;
  border: 2px solid var(--blue);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  text-align: center;
  min-height: 3rem;
  letter-spacing: .02em;
}

/* ── Ranking page ── */
.tournament-finished {
  background: linear-gradient(135deg, #fff3cd, #ffeeba);
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 1.25rem;
  color: #856404;
}

/* Podium */
.podium-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: .5rem;
  margin-bottom: 1.5rem;
  min-height: 160px;
}

.podium-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 160px;
}

.podium-medal { font-size: 1.75rem; margin-bottom: .25rem; }

.podium-name {
  font-size: .8rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: .25rem;
  line-height: 1.2;
}

.podium-pts {
  font-size: .75rem;
  color: var(--grey-3);
  margin-bottom: .25rem;
}

.podium-block {
  width: 100%;
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: 1.5rem;
  color: rgba(255,255,255,.7);
}

.block-1 { height: 90px; background: linear-gradient(180deg, #FFD700, #C9A900); color: var(--black); }
.block-2 { height: 70px; background: linear-gradient(180deg, #C0C0C0, #a0a0a0); }
.block-3 { height: 55px; background: linear-gradient(180deg, #CD7F32, #a05f20); }

/* Ranking table */
.ranking-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.ranking-table th {
  background: var(--black);
  color: var(--gold);
  font-family: 'Cinzel', serif;
  font-size: .8rem;
  letter-spacing: .05em;
  padding: .6rem .75rem;
  text-align: left;
}

.ranking-table td {
  padding: .65rem .75rem;
  border-bottom: 1px solid var(--grey-2);
}

.rank-row { transition: background .4s; }
.rank-row.changed { animation: highlight .6s ease; }

@keyframes highlight {
  0%   { background: rgba(255, 215, 0, .35); }
  100% { background: transparent; }
}

.rank-gold   td { background: rgba(255,215,0,.08); }
.rank-silver td { background: rgba(192,192,192,.08); }
.rank-bronze td { background: rgba(205,127,50,.08); }

.rank-num { font-size: 1.1rem; width: 2.5rem; }
.rank-name { font-weight: 600; }
.rank-pts  { font-weight: 700; color: var(--blue); text-align: right; }

/* ── Events page ── */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.event-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--grey-2);
}

.event-card.status-ongoing  { border-left-color: var(--gold); }
.event-card.status-finished { border-left-color: var(--green); }

.event-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .35rem;
}

.event-order {
  font-size: .75rem;
  color: var(--grey-3);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.event-card-name {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

.event-rule {
  font-size: .8rem;
  color: var(--grey-3);
  margin-bottom: .75rem;
}
.event-rule strong {
  color: var(--black);
}

.event-live-notice {
  font-size: .85rem;
  color: #856404;
  background: #fff3cd;
  border-radius: 8px;
  padding: .4rem .65rem;
  margin-top: .25rem;
}

.event-results {
  margin-top: .75rem;
}

.event-results summary {
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  color: var(--blue);
  padding: .3rem 0;
  user-select: none;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: .5rem;
  font-size: .85rem;
}

.results-table th {
  text-align: left;
  font-weight: 600;
  padding: .3rem .5rem;
  border-bottom: 1px solid var(--grey-2);
  color: var(--grey-3);
  font-size: .75rem;
  text-transform: uppercase;
}

.results-table td {
  padding: .35rem .5rem;
  border-bottom: 1px solid var(--grey-2);
}

/* ── Footer ── */
.site-footer {
  text-align: center;
  padding: 1.5rem 1rem;
  background: var(--black);
}

/* ── Login / Admin shared ── */
.admin-body {
  background: #0f0f0f;
  min-height: 100vh;
}

.login-card {
  max-width: 360px;
  margin: 4rem auto 0;
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
  text-align: center;
}

.login-logo { font-size: 2.5rem; margin-bottom: .5rem; }

.login-title {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: .25rem;
}

.login-subtitle {
  color: var(--grey-3);
  font-size: .85rem;
  margin-bottom: 1.5rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  text-align: left;
}

/* ── Forms ── */
.form-label {
  font-size: .85rem;
  font-weight: 600;
  display: block;
  margin-bottom: .25rem;
}

.form-input, .form-select {
  width: 100%;
  padding: .6rem .75rem;
  border: 1.5px solid var(--grey-2);
  border-radius: 8px;
  font-size: .9rem;
  font-family: inherit;
  background: var(--white);
  transition: border-color .2s;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--blue);
}

.form-hint {
  font-size: .8rem;
  color: var(--grey-3);
  margin-bottom: .5rem;
}

/* ── Alerts ── */
.alert {
  padding: .75rem 1rem;
  border-radius: 8px;
  font-size: .875rem;
  margin-bottom: 1rem;
}

.alert-error {
  background: #fde8e8;
  color: #9b1c1c;
  border: 1px solid #f5c6c6;
}

/* ── Confetti placeholder ── */
#confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

/* ── Responsive ── */
@media (max-width: 400px) {
  .hero-title { font-size: 2.1rem; }
  .podium-name { font-size: .72rem; }
  .cta-row { flex-direction: column; }
}

/* ── Nav team link ── */
.nav-link-team { color: var(--gold) !important; }

/* ── Section title small ── */
.section-title-sm {
  font-family: 'Cinzel', serif;
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: .6rem;
  color: var(--black);
  letter-spacing: .03em;
}

/* ── Team selector (Mon équipe) ── */
.team-selector {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .25rem;
}

.team-btn {
  display: inline-block;
  padding: .55rem .9rem;
  border-radius: var(--radius);
  background: var(--white);
  border: 2px solid var(--grey-2);
  color: var(--black);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .15s, background .15s;
}

.team-btn:hover { border-color: var(--blue); }
.team-btn.selected { background: var(--blue); color: var(--white); border-color: var(--blue); }

/* ── Now block ── */
.now-block {
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  margin-bottom: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.now-play   { background: linear-gradient(135deg, #0085C7, #005f8f); color: var(--white); }
.now-rest   { background: linear-gradient(135deg, #2a2a2a, #444); color: var(--white); }
.now-jury   { background: linear-gradient(135deg, #1a3a0a, #2d6018); color: var(--white); }

.now-icon   { font-size: 2.5rem; margin-bottom: .4rem; }
.now-label  { font-family: 'Cinzel', serif; font-size: 1.1rem; font-weight: 700; margin-bottom: .4rem; }
.now-detail { font-size: 1rem; opacity: .9; margin-bottom: .25rem; }
.now-zone   { font-size: .85rem; opacity: .7; margin-top: .25rem; }

/* ── Jury voting form ── */
.jury-form { margin-top: 1rem; text-align: left; }

.jury-team-section {
  background: rgba(255,255,255,.1);
  border-radius: 8px;
  padding: .75rem;
  margin-bottom: .75rem;
}

.jury-team-name { font-size: .9rem; font-weight: 700; margin-bottom: .5rem; }

.jury-criteria {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.jury-criteria label {
  font-size: .8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.jury-criteria input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
}

.score-val { font-weight: 700; min-width: 1.5rem; text-align: right; }

/* ── Upcoming / Done lists ── */
.upcoming-list, .done-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.upcoming-item {
  background: var(--white);
  border-radius: 8px;
  padding: .6rem .9rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .875rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.upcoming-icon { font-size: 1rem; }
.upcoming-empty { color: var(--grey-3); font-style: italic; }

.done-item {
  background: var(--white);
  border-radius: 8px;
  padding: .6rem .9rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .875rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.done-event { flex: 1; font-weight: 500; }
.done-rank  { font-size: 1.1rem; }
.done-pts   { font-weight: 700; color: var(--blue); }

.team-total-pts {
  margin-top: .75rem;
  text-align: right;
  font-size: .95rem;
  color: var(--black);
}

/* ── Event detail ── */
.event-final-results {
  margin-top: .5rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.result-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .875rem;
  padding: .3rem 0;
  border-bottom: 1px solid var(--grey-2);
}

.pts-badge {
  margin-left: auto;
  font-weight: 700;
  color: var(--blue);
  font-size: .8rem;
}

.event-detail { margin-top: .75rem; }
.event-detail summary {
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  color: var(--blue);
  padding: .3rem 0;
  user-select: none;
}

.pool-block { margin-top: .75rem; }
.pool-title {
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: .4rem;
  color: var(--blue);
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  margin-bottom: .5rem;
}
.mini-table th {
  text-align: left;
  font-weight: 600;
  color: var(--grey-3);
  font-size: .72rem;
  text-transform: uppercase;
  padding: .25rem .4rem;
  border-bottom: 1px solid var(--grey-2);
}
.mini-table td { padding: .3rem .4rem; border-bottom: 1px solid var(--grey-2); }

.match-list { display: flex; flex-direction: column; gap: .25rem; margin-top: .4rem; }

.match-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  padding: .25rem .4rem;
  background: var(--grey-1);
  border-radius: 6px;
}
.match-done { background: #d4edda; }
.match-type-label { font-size: .7rem; font-weight: 700; color: var(--grey-3); }

.score { font-weight: 700; padding: 0 .3rem; }
.score.pending { color: var(--grey-3); font-weight: 400; }

.finals-block { margin-top: .75rem; border-top: 1px solid var(--grey-2); padding-top: .5rem; }

.roles-line { font-size: .8rem; color: var(--grey-3); margin-bottom: .4rem; line-height: 1.6; }
.no-data { font-size: .8rem; color: var(--grey-3); font-style: italic; }

/* ── Olympic rings footer ── */
.olympic-rings {
  display: block;
  margin: 0 auto;
  width: 110px;
  height: auto;
  opacity: .6;
}

/* ── Responsive header ── */
.nav-link {
  white-space: nowrap;
}

@media (max-width: 560px) {
  .logo-year {
    display: none;
  }
  .header-inner {
    flex-wrap: wrap;
    padding: .5rem .85rem .4rem;
    row-gap: .35rem;
  }
  .main-nav {
    flex: 0 0 100%;
    justify-content: space-around;
    gap: 0;
    padding-top: .35rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
  }
  .nav-link {
    font-size: .82rem;
    padding: .15rem .25rem;
  }
}
