:root {
  --bg-1: #eef6ff;
  --bg-2: #fffaf1;
  --ink: #172133;
  --ink-soft: #52607a;
  --card: #ffffffcc;
  --line: #d4dbea;
  --accent: #ff6f3c;
  --accent-ink: #ffffff;
  --shadow: 0 14px 30px rgba(16, 31, 64, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 15%, #dceeff 0%, transparent 32%),
    radial-gradient(circle at 85% 8%, #ffe9d5 0%, transparent 28%),
    linear-gradient(140deg, var(--bg-1), var(--bg-2));
}

.page {
  width: min(1100px, calc(100% - 2rem));
  margin: 2rem auto 3rem;
  display: grid;
  gap: 1rem;
}

.hero h1,
h2 {
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.03em;
  margin: 0;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.etat {
  margin: 0.6rem 0 0;
  color: var(--ink-soft);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
}

.btn-principal {
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.2rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--accent-ink);
  background: linear-gradient(130deg, #fe8d4e, var(--accent));
  box-shadow: var(--shadow);
  transition: transform 140ms ease;
}

.btn-principal:hover {
  transform: translateY(-2px);
}

.btn-principal:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}

.source {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.carte {
  background: var(--card);
  backdrop-filter: blur(3px);
  border: 1px solid #fff;
  border-radius: 18px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.classement-visuel {
  display: grid;
  gap: 0.95rem;
}

.podium-stage {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  align-items: end;
}

.podium-card {
  border: 1px solid #e3e9f7;
  border-radius: 14px;
  padding: 0.85rem;
  background: linear-gradient(180deg, #ffffff, #f8faff);
  box-shadow: inset 0 5px 0 var(--team);
  display: flex;
  flex-direction: column;
  height: var(--podium-height, 160px);
}

.podium-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  min-width: 0;
}

.podium-text {
  min-width: 0;
}

.podium-avatar-wrap {
  margin-top: 0;
  flex-shrink: 0;
}

.podium-rang {
  display: inline-block;
  border-radius: 999px;
  padding: 0.14rem 0.48rem;
  background: #eef3ff;
  font-weight: 700;
  font-size: 0.78rem;
}

.podium-card h3 {
  margin: 0.22rem 0 0;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.34rem;
  line-height: 1.04;
  overflow-wrap: anywhere;
}

.podium-participants {
  margin: 0.08rem 0 0.45rem;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.podium-card strong {
  font-size: 1.2rem;
  margin-top: auto;
}

.podium-flags {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.24rem;
}

.podium-first {
  --podium-height: 228px;
}

.podium-second {
  --podium-height: 196px;
}

.podium-third {
  --podium-height: 174px;
}

.peloton h3 {
  margin: 0 0 0.6rem;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.24rem;
}

.peloton-row {
  display: grid;
  grid-template-columns: minmax(190px, 285px) 1fr auto;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid #e9eff9;
  border-radius: 12px;
  padding: 0.5rem 0.65rem;
  background: #fff;
  margin-bottom: 0.45rem;
}

.peloton-nom {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.5rem;
  min-width: 0;
}

.peloton-text {
  min-width: 0;
}

.peloton-text-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.peloton-text-top strong {
  overflow-wrap: anywhere;
}

.rang-chip {
  display: inline-block;
  border-radius: 999px;
  padding: 0.14rem 0.48rem;
  background: #f1f5ff;
  font-weight: 700;
  font-size: 0.78rem;
}

.peloton-participants {
  display: block;
  margin-top: 0.15rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.peloton-bar {
  height: 10px;
  border-radius: 999px;
  background: #edf2fb;
  overflow: hidden;
}

.peloton-bar div {
  height: 100%;
  border-radius: 999px;
}

.points-chip {
  font-size: 0.84rem;
  font-weight: 700;
  background: #1e2a46;
  color: #fff;
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  white-space: nowrap;
}

.team-avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid #d8e2f3;
  background: #f7f9fe;
  box-shadow: 0 2px 8px rgba(23, 39, 77, 0.12);
}

.team-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #27334f;
}

.team-avatar-podium {
  width: 54px;
  height: 54px;
}

.team-avatar-detail {
  width: 44px;
  height: 44px;
}

.flag-mini {
  width: 18px;
  height: 13px;
  border-radius: 2px;
  border: 1px solid #d5deef;
  object-fit: cover;
}

.flag-mini-fallback {
  width: 18px;
  height: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  border-radius: 2px;
  border: 1px solid #d5deef;
  background: #f6f8fd;
}

.grid-equipes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.equipe {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  background: #ffffffdd;
  display: grid;
  gap: 0.7rem;
}

.equipe-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.7rem;
}

.equipe-meta {
  min-width: 0;
}

.equipe h3 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  overflow-wrap: anywhere;
}

.equipe-participants {
  margin: 0.1rem 0 0;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.puce {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
  margin-right: 0.45rem;
  vertical-align: baseline;
}

.equipe-total {
  margin: 0;
  font-size: 1.03rem;
  color: var(--ink-soft);
}

.equipe-total strong {
  font-size: 1.35rem;
  color: var(--ink);
}

.liste-pays {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.pays-ligne {
  border: 1px solid #e6ebf6;
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  background: #ffffff;
}

.pays-entete {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.drapeau {
  width: 22px;
  height: 16px;
  border-radius: 3px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f5f7fb;
  border: 1px solid #d9e1f0;
}

.drapeau-svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.drapeau-fallback {
  font-size: 0.85rem;
  line-height: 1;
}

.pays-nom {
  font-weight: 700;
}

.pays-points {
  margin-left: auto;
  font-weight: 700;
  color: var(--ink);
}

.pays-medailles {
  margin-top: 0.25rem;
  font-size: 0.86rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.medaille {
  display: inline-block;
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.medaille-or {
  color: #8a5a00;
  background: #fff2c6;
}

.medaille-argent {
  color: #4f596c;
  background: #e8edf5;
}

.medaille-bronze {
  color: #7a3f1c;
  background: #f5dfd3;
}

@media (max-width: 720px) {
  .page {
    width: min(1100px, calc(100% - 1rem));
    margin-top: 1rem;
  }

  .carte {
    padding: 0.8rem;
  }

  .podium-stage {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }

  .peloton-row {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }
}
