/* ============================================================
   Écran TV — Scoring de la cave  (cible : 1920×1080 en kiosque)
   Tailles en vmin → s'adapte à toute dalle 16:9 sans débordement.
   ============================================================ */

:root {
  --bg: #08090a;
  --panel: #101114;
  --panel-2: #131417;
  --line: #26272a;
  --cream: #f2ece1;
  --muted: #8d8d86;
  --faint: #5f6064;
  --red: #c8102e;
  --green: #1f7a4d;
  --green-lt: #7be0a8;
  --gold: #e0b64a;

  font-size: 1.48vmin;               /* 1rem ≈ 16px @ 1920×1080 */
}

* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }

html, body { height: 100%; overflow: hidden; }

body {
  background: radial-gradient(120vw 80vh at 50% -20%, #1c1d20 0%, #08090a 65%);
  color: var(--cream);
  font-family: 'Barlow', system-ui, sans-serif;
  cursor: none;
}

.view {
  position: absolute; inset: 0;
  padding: 3.4rem 4.5rem;
  display: flex; flex-direction: column; gap: 1.8rem;
  animation: fade .35s ease both;
  overflow: hidden;
}
.view > * { min-height: 0; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- typo ---------- */
.display { font-family: 'Anton', sans-serif; text-transform: uppercase; letter-spacing: .02em; line-height: 1; }
.display.lg   { font-size: 4.2rem; }
.display.xl   { font-size: 5rem; }
.display.mega { font-size: 15rem; line-height: .92; text-shadow: 0 0 6rem rgba(200,16,46,.5); }

.kicker {
  font-family: 'Barlow Condensed', sans-serif; text-transform: uppercase;
  letter-spacing: .2em; font-size: 2.1rem; color: var(--muted);
}
.kicker.gold { color: var(--gold); }
.kicker.faint { color: var(--faint); font-size: 1.7rem; }
.kicker.spread { letter-spacing: .5em; padding-left: .5em; font-size: 2.6rem; }

.v-head { display: flex; align-items: baseline; justify-content: space-between; gap: 2rem;
          padding-bottom: 1.6rem; border-bottom: 2px solid var(--line); flex: 0 0 auto; }
.v-head .kicker { letter-spacing: .18em; }

.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .4; } 50% { opacity: 1; } }

/* ---------- idle ---------- */
[data-view="idle"] { align-items: center; justify-content: center; }
.idle-wrap { text-align: center; display: flex; flex-direction: column; gap: 2.5rem; }

/* ---------- 301 ---------- */
.cards { flex: 1 1 auto; display: grid; gap: 2rem; }
.card {
  border: .3rem solid var(--line); background: var(--panel);
  border-radius: 2rem; padding: 2.6rem 2.4rem;
  display: flex; flex-direction: column; justify-content: space-between; gap: 1.4rem;
  min-height: 0;
}
.card .nm {
  font-family: 'Barlow Condensed', sans-serif; font-size: 3rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .sc { font-family: 'Anton', sans-serif; font-size: 9.5rem; line-height: .82; font-variant-numeric: tabular-nums; }
.card .darts { display: flex; gap: .8rem; flex-wrap: wrap; min-height: 3.4rem; }
.card .darts .chip {
  padding: .5rem 1.1rem; border-radius: .8rem;
  background: rgba(200,16,46,.18); border: .2rem solid var(--red);
  font-family: 'Barlow Condensed', sans-serif; font-size: 2rem; letter-spacing: .04em;
}
.card .co { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.card .co .co-k {
  font-family: 'Barlow Condensed', sans-serif; font-size: 1.6rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--gold);
}
.card .co .co-d {
  padding: .4rem 1rem; border-radius: .8rem;
  background: rgba(224,182,74,.16); border: .2rem solid var(--gold); color: var(--gold);
  font-family: 'Barlow Condensed', sans-serif; font-size: 1.9rem; letter-spacing: .04em;
}
.card.lead { border-color: var(--gold); background: rgba(224,182,74,.1); }
.card.lead .nm { color: var(--gold); }
.card.active { border-color: var(--red); background: rgba(200,16,46,.12); }
.card.active .nm { color: var(--cream); }

/* ---------- cricket ---------- */
.cricket { flex: 1 1 auto; display: grid; gap: .9rem; }
.cricket .hd {
  font-family: 'Barlow Condensed', sans-serif; font-size: 2.4rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); text-align: center; align-self: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cricket .hd.on { color: var(--gold); }
.cricket .cx svg { width: 2.8rem; height: 2.8rem; display: block; }
.cricket .rn { font-family: 'Anton', sans-serif; font-size: 3rem; color: var(--gold); align-self: center; text-align: center; }
.cricket .rn.done { color: var(--faint); }
.cricket .cx {
  display: flex; align-items: center; justify-content: center;
  border: .25rem solid var(--line); background: #1a1b1f; border-radius: 1rem;
  font-family: 'Anton', sans-serif; font-size: 3.4rem; color: var(--cream);
}
.cricket .cx.hit { border-color: var(--red); background: rgba(200,16,46,.16); }
.cricket .cx.closed { border-color: var(--green); background: rgba(31,122,77,.3); color: var(--green-lt); }
.cricket .pl { font-family: 'Barlow Condensed', sans-serif; font-size: 1.8rem; letter-spacing: .12em;
               text-transform: uppercase; color: var(--muted); align-self: center; text-align: center; }
.cricket .pv {
  text-align: center; padding: .6rem 0; border-radius: .9rem; background: var(--panel);
  font-family: 'Anton', sans-serif; font-size: 3.6rem; font-variant-numeric: tabular-nums;
}
.cricket .pv.low { color: var(--green-lt); }

/* ---------- manches ---------- */
.manche-rows { flex: 1 1 auto; display: flex; flex-direction: column; gap: 1.6rem; }
.manche-row {
  flex: 1 1 auto; display: flex; align-items: center; gap: 3rem; padding: 0 3.4rem;
  border: .3rem solid #303136; background: #15161a; border-radius: 1.8rem;
}
.manche-row .nm {
  flex: 0 0 34%; font-family: 'Anton', sans-serif; font-size: 5.2rem; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #a8a29a;
}
.manche-row .pips { flex: 1 1 auto; display: flex; gap: 1.2rem; flex-wrap: wrap; }
.manche-row .pip { width: 4.4rem; height: 4.4rem; border-radius: 50%; border: .35rem solid var(--faint); }
.manche-row .pip.on { border-color: var(--green); background: var(--green); }
.manche-row .wins { font-family: 'Anton', sans-serif; font-size: 7rem; font-variant-numeric: tabular-nums; }
.manche-row.lead { border-color: var(--green); background: rgba(31,122,77,.22); }
.manche-row.lead .nm { color: var(--cream); }
.manche-row.lead .wins { color: var(--green-lt); }
.manche-row .wins { color: var(--cream); }

/* ---------- victoire ---------- */
.view.victory { align-items: center; justify-content: center; overflow: hidden;
                background: radial-gradient(60vw 50vh at 50% 40%, #2a1114 0%, #08090a 70%); }
.victory-wrap { text-align: center; display: flex; flex-direction: column; gap: 1.4rem;
                animation: pop .7s cubic-bezier(.2,.9,.2,1) both; z-index: 2; }
@keyframes pop { 0% { transform: scale(.7); opacity: 0; } 60% { transform: scale(1.04); opacity: 1; } 100% { transform: scale(1); } }
#victory-countdown { padding-top: 2.4rem; letter-spacing: .24em; }

.fx { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.fx i {
  position: absolute; top: -6vh; width: .9rem; height: 1.8rem; border-radius: .2rem;
  animation: fall linear infinite;
}
@keyframes fall {
  0% { transform: translate3d(0,-8vh,0) rotate(0); opacity: 0; }
  8% { opacity: 1; }
  100% { transform: translate3d(var(--dx,0), 118vh, 0) rotate(var(--rot,540deg)); opacity: 1; }
}

/* ---------- tableau des scores ---------- */
.board-head .tabs { display: flex; gap: 1.4rem; }
.tab {
  font-family: 'Barlow Condensed', sans-serif; font-size: 2.4rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--faint);
  padding: .8rem 2.2rem; border: .28rem solid #3a3b3f; border-radius: 999px;
}
.tab.on { color: #0d0e10; background: var(--cream); border-color: var(--cream); }

.board { flex: 1 1 auto; display: flex; flex-direction: column; gap: 1.2rem; min-height: 0; }
.board-row {
  display: grid; grid-template-columns: 6rem 1fr 16rem 16rem 16rem; gap: 1.6rem; align-items: center;
  padding: 0 2.6rem; border-radius: 1.4rem;
}
.board-th { color: var(--muted); font-family: 'Barlow Condensed', sans-serif; font-size: 2.1rem;
            letter-spacing: .14em; text-transform: uppercase; padding-bottom: .4rem; }
.board-th .num, .board-row .num { text-align: right; }
#board-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 1.1rem; }
#board-body .board-row {
  flex: 1 1 auto; border: .28rem solid #303136; background: #15161a;
}
#board-body .rk { font-family: 'Anton', sans-serif; font-size: 4rem; color: var(--faint); font-variant-numeric: tabular-nums; }
#board-body .pnm { font-family: 'Anton', sans-serif; font-size: 4.8rem; text-transform: uppercase;
                   white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#board-body .num { font-family: 'Anton', sans-serif; font-size: 4.2rem; font-variant-numeric: tabular-nums; }
#board-body .col-played { color: var(--muted); }
#board-body .board-row.top { border-color: var(--gold); background: rgba(224,182,74,.16); }
#board-body .board-row.top .rk,
#board-body .board-row.top .col-pct { color: var(--gold); }

.board-foot { flex: 0 0 auto; font-family: 'Barlow Condensed', sans-serif; font-size: 1.9rem;
              letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }

/* ---------- offline ---------- */
#offline {
  position: absolute; top: 1.6rem; right: 2rem; z-index: 20;
  font-family: 'Barlow Condensed', sans-serif; font-size: 1.6rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--red);
}
#offline::before { content: "● "; }
