:root {
  --green-deep: #0a3320;
  --green-mid: #145c39;
  --green-line: #1f7a4d;
  --gold: #f4c41b;
  --gold-deep: #d4a70f;
  --red: #ce1126;
  --white: #ffffff;
  --ink: #0c1f16;
  --ink-soft: #46594e;
  --paper: #f6f8f4;

  --font-display: 'Baloo 2', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

/* ---------- Topbar ---------- */

.topbar {
  background: linear-gradient(155deg, var(--green-deep) 0%, var(--green-mid) 65%, var(--green-line) 100%);
  color: var(--white);
  position: relative;
  overflow: hidden;
}

.topbar__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 34px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.brand__eyebrow {
  display: inline-block;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 999px;
  transform: rotate(-2deg);
  margin-bottom: 10px;
}

.brand__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(32px, 6vw, 52px);
  line-height: 1.02;
  margin: 0;
}

.brand__title span { color: var(--gold); }

.brand__org {
  max-width: 280px;
  font-size: 13px;
  line-height: 1.5;
  text-align: right;
  color: #d9e8dd;
}

.brand__org-sub { opacity: 0.75; }

.topbar__stripe {
  height: 6px;
  background: linear-gradient(90deg, var(--green-line) 0 33%, var(--gold) 33% 66%, var(--red) 66% 100%);
}

/* ---------- Hero ---------- */

.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 20px;
}

.hero__kicker {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--green-line);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 13px;
  margin: 0 0 8px;
}

.hero__kicker.closed { color: var(--red); }

.hero__headline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 4vw, 38px);
  margin: 0 0 12px;
  max-width: 520px;
}

.hero__sub {
  max-width: 480px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0;
}

.hero__sub strong { color: var(--ink); }

.hero__sub.voted { color: var(--green-line); font-weight: 600; }

/* ---------- Board / leaderboard ---------- */

.board {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 24px 64px;
}

.board__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
}

.board__header h3 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0;
}

.board__updated {
  font-size: 12px;
  color: var(--ink-soft);
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.loading { color: var(--ink-soft); padding: 40px 0; }

/* Carte joueur : deux blocs seulement — photo (gauche) + infos (droite, empilées) */

.player-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 2px 0 rgba(10, 51, 32, 0.06);
  border: 1px solid #e7ede6;
  position: relative;
}

.player-card--rank1 { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(244, 196, 27, 0.35); }

.player-card--voted { opacity: 0.55; }

/* Bloc 1 : photo, pleine largeur, en haut — image affichée en entier, sans crop */

.player-card__photo {
  position: relative;
  width: 100%;
  background: var(--green-mid);
}

.player-card__photo img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.player-card__photo-fallback {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  color: var(--white);
}

.player-card__rank {
  position: absolute;
  top: 8px;
  left: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--green-deep);
  color: var(--white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.player-card--rank1 .player-card__rank {
  background: var(--gold);
  color: var(--ink);
}

/* Bloc 2 : infos, empilées de haut en bas */

.player-card__body {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player-card__name {
  font-weight: 700;
  font-size: 15px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-card__team {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 0;
}

.player-card__votes {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--green-line);
  margin: 4px 0 10px;
}

.btn {
  font-family: var(--font-body);
  font-weight: 700;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: transform 0.08s ease, background 0.15s ease;
}

.btn:active { transform: scale(0.97); }

.btn:disabled { cursor: not-allowed; opacity: 0.6; }

.btn--primary {
  background: var(--gold);
  color: var(--ink);
  padding: 12px 18px;
}

.btn--primary:hover { background: var(--gold-deep); }

.btn--block { width: 100%; display: block; }

.player-card__vote-btn {
  margin-top: auto;
  background: var(--green-deep);
  color: var(--white);
  padding: 9px 16px;
  font-size: 13px;
  align-self: flex-start;
}

.player-card__vote-btn:hover { background: var(--green-mid); }

.player-card__voted-badge {
  margin-top: auto;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--green-line);
}

/* ---------- Footer ---------- */

.site-footer {
  text-align: center;
  padding: 24px;
  font-size: 12.5px;
  color: var(--ink-soft);
  border-top: 1px solid #e7ede6;
}

/* ---------- Modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

@media (min-width: 600px) {
  .modal { align-items: center; }
}

.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 51, 32, 0.55);
  backdrop-filter: blur(2px);
}

.modal__card {
  position: relative;
  background: var(--white);
  width: 100%;
  max-width: 420px;
  border-radius: 22px 22px 0 0;
  padding: 24px 22px 26px;
  z-index: 1;
}

@media (min-width: 600px) {
  .modal__card { border-radius: var(--radius-lg); }
}

.modal__close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1;
}

.modal__player {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.modal__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--green-mid);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--white);
}

.modal__avatar img { width: 100%; height: 100%; object-fit: cover; }

#modal-title {
  font-family: var(--font-display);
  font-size: 17px;
  margin: 0 0 2px;
}

.modal__team { font-size: 13px; color: var(--ink-soft); margin: 0; }

.modal__confirm-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 18px;
}

.modal__confirm-text strong { color: var(--ink); }

.modal__error {
  background: #fdecec;
  color: var(--red);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
}

/* Visible keyboard focus for accessibility */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--green-line);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}