:root {
  --felt: #0b5136;
  --felt-dark: #06331f;
  --gold: #ffb800;
  --gold-soft: #ffd75e;
  --ink: #10231a;
  --panel: rgba(0, 0, 0, .28);
  --line: rgba(255, 255, 255, .16);
  --red: #e74c3c;
  --green: #2ecc71;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 700px at 50% -10%, #127a4e, var(--felt) 55%, var(--felt-dark));
  color: #fff; min-height: 100vh; display: flex; flex-direction: column;
}
.hidden { display: none !important; }

header {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 20px; background: #faf6e9; border-bottom: 3px solid var(--gold);
  flex-wrap: wrap;
}
header h1 { margin: 0; font-size: clamp(20px, 3vw, 30px); color: var(--ink); }
.mini-card {
  display: inline-block; background: #fff; color: #111; border: 1px solid #ddd;
  border-radius: 5px; padding: 2px 7px 3px; font-size: 18px; font-weight: 900;
  box-shadow: 0 2px 5px rgba(0,0,0,.35); vertical-align: middle; margin-right: 4px;
}
.suits { letter-spacing: 3px; }
.suit-r { color: #d90429; }
.suit-n { color: #111; }
header nav .nav-btn { background: rgba(0,0,0,.07); color: var(--ink); border-color: rgba(0,0,0,.22); }
nav { display: flex; gap: 8px; }
.nav-btn {
  font-size: 16px; font-weight: 700; padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(255,255,255,.08); color: #fff; cursor: pointer;
}
.nav-btn.active { background: var(--gold); color: var(--ink); border-color: var(--gold); }

.view { padding: 16px 20px 24px; width: 100%; max-width: 1200px; margin: 0 auto; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 18px; margin-bottom: 16px;
}
.panel h2 { margin-top: 0; }
.panel h3 { margin: 14px 0 8px; }
.note { opacity: .85; font-size: 14px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.big-actions { margin-top: 16px; }

.btn {
  font-size: 16px; font-weight: 700; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(255,255,255,.1); color: #fff; cursor: pointer;
}
.btn:hover { background: rgba(255,255,255,.2); }
.btn.big { font-size: 18px; padding: 13px 20px; }
.btn.go { background: var(--green); color: #06331f; border-color: var(--green); }
.btn.gold { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.btn.danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn.speed-btn.selected { background: var(--gold); color: var(--ink); border-color: var(--gold); }

/* Joueurs en pastilles */
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  font-size: 17px; font-weight: 800; padding: 10px 16px; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--line); background: rgba(255,255,255,.06); color: #fff; user-select: none;
}
.chip.on { background: var(--gold); color: var(--ink); border-color: var(--gold-soft); }
.chip:active { transform: scale(.97); }
.big-chips .chip { font-size: 21px; padding: 14px 20px; }
.out-chips .chip { opacity: .55; text-decoration: line-through; cursor: default; background: rgba(0,0,0,.3); }

/* Tableau des scores */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 17px; }
th, td { padding: 8px 10px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: rgba(0,0,0,.4); }
td.name, th.name { text-align: left; font-weight: 800; }
td.total, th.total { font-weight: 900; background: rgba(255,184,0,.13); }
td.pos { color: #7dffb0; } td.neg { color: #ff9d94; }
tr.leader td.name::after { content: " 🥇"; }

/* ============ TIMER ============ */
#timer-live { max-width: 1200px; margin: 0 auto; padding: 2px 20px 12px; }
.timer-top { display: flex; gap: 14px; justify-content: space-between; margin-top: 2px; }
.t-box {
  flex: 1; background: rgba(0,0,0,.45); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 8px; text-align: center;
}
.t-box.wide { flex: 1.4; }
.t-label { font-size: clamp(13px, 1.6vw, 18px); text-transform: uppercase; letter-spacing: 1px; opacity: .8; }
.t-value { font-size: clamp(28px, 4.5vw, 52px); font-weight: 900; color: var(--gold-soft); }
#t-clock {
  text-align: center; font-weight: 900; font-variant-numeric: tabular-nums;
  font-size: clamp(90px, 17vw, 230px); line-height: 1.05; margin: 0;
  text-shadow: 0 6px 30px rgba(0,0,0,.6);
}
#t-clock.break { color: #8be0ff; }
#t-clock.low { color: #ff8a7a; }
.t-status { text-align: center; font-size: clamp(18px, 2.6vw, 28px); font-weight: 800; min-height: 1.4em; }
.timer-progress { height: 14px; background: rgba(0,0,0,.4); border-radius: 99px; overflow: hidden; margin: 6px 0; }
#t-progress { height: 100%; width: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); transition: width .3s linear; }
.timer-next { text-align: center; font-size: clamp(17px, 2.4vw, 26px); opacity: .95; }
.timer-controls { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
.elim-panel { margin-top: 2px; }
.elim-panel h3 { margin: 8px 0 6px; }

/* En plein écran : l'en-tête et le pied disparaissent pour que tout tienne sans scroller.
   Le bouton ⛶ reste visible pour sortir du plein écran. */
:fullscreen header, :fullscreen footer { display: none; }
:fullscreen #view-timer { padding-top: 2px; }

/* Modals */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.72); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 26px 12px;
}
.modal-card {
  background: #0d3b27; border: 2px solid var(--gold); border-radius: 18px;
  padding: 22px; width: min(680px, 96vw);
}
.modal-card textarea { width: 100%; }
.res-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 6px;
  border-bottom: 1px solid var(--line); font-size: 19px;
}
.res-place { font-weight: 900; width: 52px; color: var(--gold-soft); }
.res-name { flex: 1; font-weight: 800; }
.res-amt { font-weight: 900; width: 90px; text-align: right; }
.res-amt.pos { color: #7dffb0; } .res-amt.neg { color: #ff9d94; }
.res-move { display: flex; flex-direction: column; gap: 3px; }
.res-move button {
  font-size: 14px; padding: 3px 9px; border-radius: 7px; border: 1px solid var(--line);
  background: rgba(255,255,255,.12); color: #fff; cursor: pointer;
}

/* Paramètres */
.fld { display: block; margin: 10px 0; font-weight: 700; }
.fld input[type="number"] {
  display: block; margin-top: 5px; width: 220px; font-size: 18px; padding: 8px 10px;
  border-radius: 9px; border: 1px solid var(--line); background: rgba(0,0,0,.35); color: #fff;
}
.fld.check { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.fld-row { display: flex; gap: 22px; flex-wrap: wrap; }
.fld-row .fld input[type="number"] { width: 140px; }
textarea {
  width: 100%; font-size: 16px; padding: 10px; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(0,0,0,.35); color: #fff;
  font-family: ui-monospace, Consolas, monospace;
}
#chart-check div.ok { color: #7dffb0; }
#chart-check div.ko { color: #ffb3ab; }

footer { text-align: center; padding: 12px; font-size: 13px; opacity: .75; margin-top: auto; }

@media (max-width: 700px) {
  .timer-top { flex-direction: row; }
  .t-value { font-size: 24px; }
}
