/* Datashow — vue Classement, habillage « console » (même famille que platform/theme/securiday.css).
   Valeurs : design/tokens.css. Tailles en vw : la maquette fait 1920 px de large, donc 1 px de maquette = 100/1920 vw.

   Lisibilité à 8 m d'abord : texte blanc gras sur panneaux noirs opaques, rien d'animé en continu sur le texte,
   le sol quadrillé ne passe jamais derrière une ligne de classement.
   Salle très éclairée ou projecteur faible : ouvrir l'écran avec ?theme=clair (fond blanc, décision 0002). */
:root {
  --u: calc(100vw / 1920);
  color-scheme: dark;
  --bg: var(--sd-void);
  --panel: var(--sd-panel);
  --raised: var(--sd-panel-2);
  --fg: var(--sd-ink-on-black);
  --fg-2: var(--sd-ink-2-on-black);
  --rule: var(--sd-line-strong-on-black);
  --hair: var(--sd-line-on-black);
  --first-bg: var(--sd-ink-on-black);
  --first-fg: var(--sd-black);
  --alert: var(--sd-red-on-black);
  --alert-wash: var(--sd-red-wash);
  --t1: var(--sd-tier-1-on-black);
  --t2: var(--sd-tier-2-on-black);
  --t3: var(--sd-tier-3-on-black);
  --floor: 0.4;
}
:root[data-theme="clair"] {
  color-scheme: light;
  --bg: var(--sd-paper);
  --panel: var(--sd-paper);
  --raised: var(--sd-surface);
  --fg: var(--sd-ink);
  --fg-2: var(--sd-ink-2);
  --rule: var(--sd-black);
  --hair: var(--sd-line);
  --first-bg: var(--sd-black);
  --first-fg: var(--sd-ink-on-black);
  --alert: var(--sd-red-ink);
  --alert-wash: var(--sd-surface);
  --t1: var(--sd-tier-1);
  --t2: var(--sd-tier-2);
  --t3: var(--sd-tier-3);
  --floor: 0;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--fg);
  font-family: var(--sd-font-text);
  font-size: max(var(--sd-show-min), calc(24 * var(--u)));
  overflow: hidden;
}

/* Sol quadrillé : une surface CSS couchée en perspective, déplacée par transform (rien n'est repeint). */
body::before {
  content: "";
  position: fixed;
  z-index: -1;
  left: -60vw;
  right: -60vw;
  bottom: calc(-128 * var(--u));
  height: 46vh;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, rgba(var(--sd-red-rgb), 0.6) 0 calc(2 * var(--u)), transparent calc(2 * var(--u)) calc(128 * var(--u))),
    repeating-linear-gradient(0deg, rgba(var(--sd-red-rgb), 0.6) 0 calc(2 * var(--u)), transparent calc(2 * var(--u)) calc(128 * var(--u)));
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 90%);
  mask-image: linear-gradient(to top, #000 10%, transparent 90%);
  transform-origin: 50% 100%;
  transform: perspective(calc(600 * var(--u))) rotateX(66deg);
  animation: floor 4s linear infinite;
  opacity: var(--floor);
}

.bar {
  flex: none;
  height: calc(120 * var(--u));
  padding: 0 calc(64 * var(--u));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: calc(2 * var(--u)) solid var(--sd-red);
  background: var(--sd-black);
  color: var(--sd-ink-on-black);
}
.bar-left, .bar-right { display: flex; align-items: center; gap: calc(40 * var(--u)); }
.bar-right { align-items: baseline; gap: calc(16 * var(--u)); }
.logo {
  font-family: var(--sd-font-display);
  font-weight: 900;
  font-size: calc(56 * var(--u));
  letter-spacing: -0.03em;
  color: var(--sd-red-on-black);
}
.live {
  display: inline-flex;
  align-items: center;
  gap: calc(14 * var(--u));
  font-family: var(--sd-font-display);
  font-weight: 800;
  font-size: calc(32 * var(--u));
}
.live-dot {
  width: calc(18 * var(--u));
  height: calc(18 * var(--u));
  border-radius: 50%;
  background: var(--sd-red-on-black);
  animation: pulse 1.6s var(--sd-ease-in-out) infinite;
}
.muted { color: var(--sd-ink-2-on-black); }
.countdown {
  font-family: var(--sd-font-display);
  font-weight: 900;
  font-size: calc(72 * var(--u));
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.countdown.urgent { color: var(--sd-red-on-black); animation: pulse 1s var(--sd-ease-in-out) infinite; }

.grid {
  flex: 1;
  padding: calc(36 * var(--u)) calc(64 * var(--u)) calc(44 * var(--u));
  display: grid;
  grid-template-columns: minmax(0, 2fr) calc(520 * var(--u));
  gap: calc(40 * var(--u));
  min-height: 0;
}
.brackets {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: calc(40 * var(--u));
  min-width: 0;
  perspective: calc(1800 * var(--u));
}
/* Chaque classement et le fil des flags : un panneau opaque posé devant le sol. */
.brackets > section, .feed {
  min-width: 0;
  padding: calc(20 * var(--u)) calc(24 * var(--u)) calc(16 * var(--u));
  border: calc(2 * var(--u)) solid var(--hair);
  border-radius: var(--sd-radius);
  background: var(--panel);
  overflow: hidden;
}
h2 {
  margin: 0 0 calc(10 * var(--u));
  padding-bottom: calc(12 * var(--u));
  border-bottom: calc(4 * var(--u)) solid var(--rule);
  font-family: var(--sd-font-display);
  font-weight: 900;
  font-size: calc(44 * var(--u));
  line-height: 1.1;
}
ol { margin: 0; padding: 0; list-style: none; }
.row {
  position: relative;
  display: grid;
  grid-template-columns: calc(64 * var(--u)) minmax(0, 1fr) auto;
  align-items: center;
  gap: calc(16 * var(--u));
  height: calc(84 * var(--u));
  padding: 0 calc(16 * var(--u));
  border-bottom: 1px solid var(--hair);
  border-radius: var(--sd-radius-sm);
}
.row:last-child { border-bottom: 0; }
/* Le premier : inversé (le plus fort contraste de l'écran) et avancé vers la salle. */
.row.first {
  margin-bottom: calc(6 * var(--u));
  border-bottom: 0;
  background: var(--first-bg);
  color: var(--first-fg);
  transform: translateZ(calc(40 * var(--u)));
}
.rank, .score { font-family: var(--sd-font-display); font-variant-numeric: tabular-nums; }
.rank { font-weight: 900; font-size: calc(40 * var(--u)); }
.team { font-weight: 700; font-size: calc(34 * var(--u)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score { font-weight: 800; font-size: calc(40 * var(--u)); }
/* Une équipe vient de monter : un reflet traverse sa ligne, une fois. */
.row.up::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(100deg, transparent 30%, rgba(var(--sd-red-on-black-rgb), 0.45) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: sweep 1.4s var(--sd-ease-in-out) 1;
  pointer-events: none;
}

/* Le fil ne montre que des flags entiers : ce qui ne tient pas passe dans une colonne suivante, hors du cadre. */
.feed { display: flex; flex-direction: column; }
.feed ol {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-flow: column wrap;
  gap: calc(8 * var(--u)) calc(48 * var(--u));
  overflow: hidden;
}
.feed .item { width: 100%; }
.item {
  display: flex;
  flex-direction: column;
  gap: calc(4 * var(--u));
  padding: calc(12 * var(--u)) calc(18 * var(--u));
  border: calc(2 * var(--u)) solid transparent;
  border-radius: var(--sd-radius-sm);
  background: var(--raised);
}
.item.new { animation: drop var(--sd-dur-slow) var(--sd-ease) backwards; }
.item.blood { border-color: var(--alert); background: var(--alert-wash); }
.item-top { display: flex; justify-content: space-between; gap: calc(12 * var(--u)); align-items: baseline; }
.item-team { font-weight: 700; font-size: calc(28 * var(--u)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-time { font-family: var(--sd-font-mono); color: var(--fg-2); }
.item-chall { display: inline-flex; align-items: center; gap: calc(10 * var(--u)); color: var(--fg-2); min-width: 0; }
.dot { width: calc(14 * var(--u)); height: calc(14 * var(--u)); border-radius: 50%; flex: none; }
.dot.t1 { background: var(--t1); }
.dot.t2 { background: var(--t2); }
.dot.t3 { background: var(--t3); }
.blood-label { font-family: var(--sd-font-display); font-weight: 900; letter-spacing: 0.08em; color: var(--alert); }

.status {
  position: fixed;
  bottom: calc(16 * var(--u));
  right: calc(24 * var(--u));
  margin: 0;
  padding: calc(8 * var(--u)) calc(14 * var(--u));
  border: calc(2 * var(--u)) solid var(--alert);
  border-radius: var(--sd-radius-sm);
  background: var(--panel);
  color: var(--alert);
  font-weight: 700;
}

@keyframes floor { to { transform: perspective(calc(600 * var(--u))) rotateX(66deg) translateY(calc(128 * var(--u))); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
@keyframes sweep { to { transform: translateX(100%); } }
@keyframes drop { from { opacity: 0; transform: translateY(calc(-28 * var(--u))) scale(0.96); } }

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

/* Logo de l'affiche : SÉCURI en blanc, DAY en rouge lumineux. */
.logo { color: var(--sd-ink-on-black); text-transform: uppercase; }
.logo b { font-weight: inherit; color: var(--sd-red); text-shadow: 0 0 0.6em rgba(var(--sd-red-rgb), 0.7); }
