/* =========================================================
   GAPS Replay — feuille de style unique
   Clair par défaut, sombre automatique (prefers-color-scheme)
   ========================================================= */

:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #efeeea;
  --text: #14151a;
  --muted: #6d6d73;
  --line: #e2e0db;
  --accent: #c8102e;
  --accent-soft: rgba(200, 16, 46, .09);
  --ink: #0f1013;
  --on-ink: #f7f6f3;
  --shadow: 0 1px 2px rgba(15, 16, 19, .05), 0 10px 30px rgba(15, 16, 19, .06);
  --radius: 14px;
  --font-display: "Barlow Condensed", "Archivo", system-ui, sans-serif;
  --font-body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0d0f;
    --surface: #17181c;
    --surface-2: #202126;
    --text: #f1f0ec;
    --muted: #9b9ba3;
    --line: #2a2b31;
    --accent: #ff3b52;
    --accent-soft: rgba(255, 59, 82, .14);
    --ink: #17181c;
    --on-ink: #f1f0ec;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .35);
  }
}

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

[hidden] { display: none !important; }

body.no-scroll { overflow: hidden; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

button, input { font-family: inherit; color: inherit; }
a { color: var(--accent); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* --------------------------- Marque --------------------------- */

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: 24px;
  border-radius: 8px;
  letter-spacing: .02em;
}

.brand-text {
  font-family: var(--font-display);
  font-weight: 700; font-size: 22px; line-height: 1;
  letter-spacing: .08em;
  color: var(--text);
}

.brand-text small {
  display: block;
  font-family: var(--font-body);
  font-size: 9px; font-weight: 600; letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

/* --------------------------- Boutons --------------------------- */

.btn {
  border: 0; cursor: pointer;
  font-weight: 700; font-size: 15px;
  letter-spacing: .02em;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 10px;
  transition: transform .12s ease, background .15s ease, opacity .15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .55; cursor: default; }

.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover:not(:disabled) { filter: brightness(1.08); }
.btn-block { display: block; width: 100%; min-height: 56px; font-size: 17px; }

.btn-ghost {
  background: transparent; color: var(--on-ink);
  border: 1px solid rgba(255, 255, 255, .28);
}
.btn-ghost:hover { background: rgba(255, 255, 255, .08); }
.btn-sm { min-height: 38px; padding: 8px 14px; font-size: 12.5px; border-radius: 8px; }

/* --------------------------- Écran d'accès --------------------------- */

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 18px 40px;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--accent-soft), transparent 60%),
    var(--bg);
}

.gate-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px 22px 24px;
  position: relative;
  overflow: hidden;
  animation: rise .35s ease both;
}

.gate-card::before {
  content: "";
  position: absolute; inset: 0 0 auto 0;
  height: 4px;
  background: var(--accent);
}

.gate h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 34px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .02em;
  margin: 26px 0 8px;
}

.gate-sub { color: var(--muted); font-size: 14.5px; margin-bottom: 22px; }

.gate-input {
  width: 100%;
  height: 62px;
  padding: 0 16px;
  margin-bottom: 14px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .22em;
  font-size: 21px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.gate-input::placeholder { color: var(--muted); letter-spacing: .22em; opacity: .6; }
.gate-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.gate-error {
  background: var(--accent-soft);
  color: var(--accent);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 14px;
}

.gate-hint { color: var(--muted); font-size: 12.5px; margin-top: 18px; line-height: 1.45; }
.gate-noscript { margin-top: 16px; color: var(--accent); font-size: 14px; text-align: center; }

/* --------------------------- Barre haute --------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--on-ink);
  border-bottom: 3px solid var(--accent);
}

.brand-sm .brand-mark { width: 34px; height: 34px; font-size: 20px; border-radius: 7px; }
.brand-sm .brand-text { font-size: 18px; color: var(--on-ink); }
.brand-sm .brand-text small { color: rgba(255, 255, 255, .5); font-size: 8px; margin-top: 3px; }

/* --------------------------- Bandeau des jours --------------------------- */

.daybar {
  position: sticky; top: 57px; z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.day-strip {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding: 2px 16px 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.day-strip::-webkit-scrollbar { display: none; }

.day {
  flex: 0 0 auto;
  width: 62px;
  min-height: 74px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  padding: 6px 0 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
  -webkit-tap-highlight-color: transparent;
}

.day:hover { border-color: var(--muted); }
.day:active { transform: scale(.97); }
.day:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.day-wd {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted);
}

.day-num {
  font-family: var(--font-display);
  font-size: 25px; font-weight: 600; line-height: 1;
  color: var(--text);
}

.day-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: transparent;
}

.day.has-match .day-dot { background: var(--accent); }

.day.is-today .day-wd { color: var(--accent); }

.day[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
}
.day[aria-pressed="true"] .day-wd,
.day[aria-pressed="true"] .day-num { color: var(--on-ink); }
.day[aria-pressed="true"] .day-dot { background: var(--accent); }

/* --------------------------- Contenu --------------------------- */

.wrap { max-width: 980px; margin: 0 auto; padding: 20px 16px 40px; }

.block { margin-bottom: 34px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.block-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 14px;
}

.block-count { color: var(--muted); font-size: 13px; font-weight: 600; }

/* --------------------------- Cartes de match --------------------------- */

.match-list { display: grid; gap: 12px; }

.match {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.match-head {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.match-time {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 600;
  background: var(--surface-2);
  padding: 2px 10px;
  border-radius: 7px;
  letter-spacing: .03em;
}

.match-city {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--accent);
}

.match-teams {
  font-family: var(--font-display);
  font-size: 27px; font-weight: 600;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: .015em;
  margin-bottom: 10px;
}

.match-teams .vs { color: var(--muted); padding: 0 6px; font-weight: 500; }

.match-venue {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 44px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dashed var(--line);
}

.match-venue:hover { color: var(--accent); border-color: var(--accent); }

.todo {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 5px;
  padding: 0 5px;
  font-family: var(--font-body);
  font-size: .68em;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  vertical-align: middle;
}

.match-videos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.match-videos .btn { min-height: 46px; padding: 11px 18px; font-size: 14.5px; }

.match-note { margin-top: 12px; font-size: 13px; color: var(--muted); }

/* --------------------------- État vide --------------------------- */

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 34px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  background: var(--surface);
}

/* --------------------------- Replays --------------------------- */

.replay-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

@media (min-width: 620px) { .replay-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .replay-grid { grid-template-columns: repeat(3, 1fr); } }

.replay {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.replay-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  display: grid; place-items: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .04), transparent 60%),
    var(--ink);
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.replay-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }

.play {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  padding-left: 3px;
  transition: transform .15s ease;
}

.replay-thumb:hover .play { transform: scale(1.08); }

.thumb-dur {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(0, 0, 0, .72);
  color: #fff;
  font-size: 11.5px; font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
}

.thumb-soon {
  font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: rgba(255, 255, 255, .55);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 99px;
  padding: 5px 12px;
}

.replay-body { padding: 12px 14px 14px; }

.replay-body h3 {
  font-size: 15.5px; font-weight: 600; line-height: 1.3;
}

.replay-meta {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
  text-transform: capitalize;
}

/* --------------------------- Lecteur (modale) --------------------------- */

.player {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 14px;
  background: rgba(8, 9, 11, .88);
  backdrop-filter: blur(3px);
  animation: fade .18s ease both;
}

.player-card {
  width: 100%; max-width: 940px;
  background: var(--surface);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  animation: rise .22s ease both;
}

.player-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--line);
}

.player-bar strong { display: block; font-size: 14.5px; line-height: 1.3; }
.player-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

.player-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.player-close {
  flex: 0 0 auto;
  height: 44px;
  width: 44px;
  border: 0; border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-size: 17px;
}

.player-close:hover { background: var(--accent); color: #fff; }

.player-frame { background: #000; overflow: hidden; }

/* Sur la vidéo, le pincement est géré par app.js (pas par le zoom de page). */
.player-frame.has-video { touch-action: pan-x pan-y; }

.player-frame iframe,
.player-frame video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 78vh;
  border: 0;
  background: #000;
}

.player-frame video {
  transform-origin: center center;
  will-change: transform;
}

/* Téléphone : le lecteur occupe tout l'écran. Le plein écran natif est volontairement
   évité, car il empêche le zoom au doigt sur la vidéo. */
@media (max-width: 900px) {
  .player { padding: 0; }
  .player-card {
    width: 100%; height: 100%;
    max-width: none;
    border-radius: 0;
    display: flex; flex-direction: column;
  }
  .player-bar { padding-top: calc(10px + env(safe-area-inset-top)); }
  .player-frame { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; }
  .player-frame iframe,
  .player-frame video {
    width: 100%; height: 100%;
    max-height: none;
    aspect-ratio: auto;
    object-fit: contain;
  }
}

/* --------------------------- Pied --------------------------- */

.footer {
  padding: 22px 0 6px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* --------------------------- Animations --------------------------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

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

@media (max-width: 420px) {
  .gate h1 { font-size: 29px; }
  .match-teams { font-size: 23px; }
  .block-title { font-size: 23px; }
  .topbar { padding: 9px 12px; }
}
