[hidden] { display: none !important; }

/* ---------- Thèmes ---------- */
:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --card: #fffdf8;
  --field: #ffffff;
  --ink: #1f1d1a;
  --muted: #6f695f;
  --line: #e4ddd0;
  --accent: #2f5d8a;
  --accent-soft: #e8eff6;
  --win: #2e7d4f;
  --win-soft: #eaf5ee;
  --lose: #b04a4a;
  --gold-soft: #fbf4e0;
  --gold: #d9a520;
  --strong-bg: #1f1d1a;
  --strong-ink: #ffffff;
  /* Couleurs des joueurs (validées daltonisme + contraste sur --card) */
  --c-daoud: #257de0;
  --c-pierre-alexis: #f47230;
  font-family: Georgia, 'Times New Roman', serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #181715;
  --card: #23211e;
  --field: #2c2a26;
  --ink: #efebe4;
  --muted: #a59f94;
  --line: #3a3732;
  --accent: #7fb0e3;
  --accent-soft: #24313f;
  --win: #6cc58f;
  --win-soft: #1f3327;
  --lose: #e48787;
  --gold-soft: #3a321c;
  --gold: #d9a520;
  --strong-bg: #efebe4;
  --strong-ink: #181715;
  --c-daoud: #338ced;
  --c-pierre-alexis: #e76624;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #181715;
    --card: #23211e;
    --field: #2c2a26;
    --ink: #efebe4;
    --muted: #a59f94;
    --line: #3a3732;
    --accent: #7fb0e3;
    --accent-soft: #24313f;
    --win: #6cc58f;
    --win-soft: #1f3327;
    --lose: #e48787;
    --gold-soft: #3a321c;
    --gold: #d9a520;
    --strong-bg: #efebe4;
    --strong-ink: #181715;
    --c-daoud: #338ced;
    --c-pierre-alexis: #e76624;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
a { color: var(--accent); }
header { max-width: 640px; margin: 0 auto; padding: 24px 16px 8px; }
h1 { margin: 0; font-size: 28px; letter-spacing: -0.5px; }
h1 span { color: var(--accent); font-style: italic; }
h2 { margin: 0 0 14px; font-size: 18px; font-weight: normal; color: var(--muted); }
main { max-width: 640px; margin: 0 auto; padding: 8px 16px 48px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 0 rgba(0,0,0,.03);
}

button, input { font: inherit; color: inherit; }
button {
  background: var(--accent); color: var(--card); border: 0; border-radius: 10px;
  padding: 12px 18px; font-size: 16px; cursor: pointer; width: 100%;
}
button:hover { filter: brightness(1.08); }
button.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.secondary:hover { background: var(--accent-soft); filter: none; }
button.danger { background: var(--lose); color: var(--card); }
button.link { background: none; color: var(--muted); width: auto; padding: 0; font-size: 14px; text-decoration: underline; }
button.link.small { font-size: 13px; }
input[type=password], input[type=number], input[type=date], input:not([type]) {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 18px; background: var(--field); margin-bottom: 12px;
}
input[type=number] { font-size: 32px; text-align: center; margin: 0; }
label[for=score] { display: block; margin-bottom: 8px; }
.row { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.row > input { margin: 0; }
.actions { margin-top: 12px; margin-bottom: 0; }
.actions button { font-size: 15px; padding: 10px 12px; }
.unit { color: var(--muted); }
.error { color: var(--lose); min-height: 1.2em; margin: 8px 0 0; font-size: 14px; }
.error:empty { min-height: 0; margin: 0; }
.ok-msg { color: var(--win); margin: 8px 0 0; font-size: 14px; }
.ok-msg:empty { margin: 0; }
.muted, .hint { color: var(--muted); font-size: 14px; }

/* ---------- Connexion ---------- */
.who { display: flex; gap: 10px; margin-bottom: 12px; }
.who label { flex: 1; }
.who input { display: none; }
.who span {
  display: block; text-align: center; padding: 14px; border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer;
}
.who input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* ---------- Onglets ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a {
  padding: 10px 14px; color: var(--muted); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a.right { margin-left: auto; }
.tabs a[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- Aujourd'hui ---------- */
.banner { background: var(--gold-soft); border-color: var(--gold); }
.banner p { margin: 0; font-size: 18px; text-align: center; }
.status { margin: 0 0 16px; }
.status.ok { color: var(--win); }
.big-mine { font-size: 20px; }
.waiting .dots::after { content: '⏳'; display: inline-block; animation: spin 2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.confirm p { font-size: 18px; }

.reveal-btn { font-size: 20px; padding: 18px; background: var(--strong-bg); color: var(--strong-ink); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.03); } }
.countdown { font-size: 96px; text-align: center; animation: beat .8s ease-out; }
@keyframes beat { from { transform: scale(1.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.duel { display: flex; align-items: center; justify-content: space-around; gap: 8px; }
.duel.pop { animation: beat .5s ease-out; }
.player { display: flex; flex-direction: column; align-items: center; padding: 14px 10px; border-radius: 12px; min-width: 120px; }
.pname { font-size: 15px; color: var(--muted); }
.pscore { font-size: 56px; line-height: 1.1; }
.pscore.gave { font-size: 44px; }
.player.winner { background: var(--win-soft); }
.player.winner .pscore { color: var(--win); }
.player.loser .pscore { color: var(--lose); opacity: .85; }
.vs { color: var(--muted); font-style: italic; }
.verdict { text-align: center; font-size: 22px; margin: 16px 0 0; }

.word-box { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); text-align: center; }
.word-box a { text-decoration: none; }
.word-box a strong { font-size: 20px; }
.word-form { display: flex; gap: 10px; }
.word-form input { margin: 0; font-size: 16px; }
.word-form button { width: auto; white-space: nowrap; }

/* Thèmes : pastilles à bascule */
.cat-box { margin-top: 14px; text-align: center; font-size: 14px; }
.cats { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.chip {
  display: inline-block; width: auto; padding: 3px 10px; border-radius: 999px; font-size: 13px; line-height: 1.5;
  background: transparent; color: var(--muted); border: 1px solid var(--line); white-space: nowrap;
  font-family: system-ui, sans-serif;
}
button.chip:hover { background: var(--accent-soft); filter: none; }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.chip.small { font-size: 12px; padding: 1px 8px; }
button.chips-btn { text-decoration: none; display: inline-flex; gap: 4px; flex-wrap: wrap; }
.days .cat-edit { flex-basis: 100%; padding-left: 80px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.days .cat-edit .cats { justify-content: flex-start; margin-top: 4px; }

/* ---------- Listes de jours ---------- */
.scoreboard { display: flex; gap: 10px; margin-bottom: 12px; }
.scoreboard div {
  flex: 1; display: flex; justify-content: space-between; align-items: baseline;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
}
.scoreboard strong { font-size: 28px; }
.scoreboard .lead { border-color: var(--gold); background: var(--gold-soft); }

.days { list-style: none; padding: 0; margin: 0; }
.days li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 15px; display: flex; gap: 4px 10px; flex-wrap: wrap; align-items: baseline; }
.days .d { width: 70px; color: var(--muted); flex-shrink: 0; }
.days .d.wide { width: 110px; }
.days .main { flex: 1; display: flex; gap: 6px; flex-wrap: wrap; }
.days .w { font-weight: bold; color: var(--win); }
.days .wline { flex-basis: 100%; padding-left: 80px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.days .word { font-style: italic; text-decoration: none; }
.tag { margin-left: auto; }
.cancelled { color: var(--lose); font-style: italic; }

details { border-top: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
details .days { margin-top: 8px; }

#absence-form { margin: 12px 0 0; }
#absence-form input { font-size: 15px; padding: 9px 12px; }
#absence-form button { width: auto; white-space: nowrap; font-size: 15px; padding: 10px 14px; }

/* ---------- Statistiques ---------- */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }
table.cmp { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.cmp th, .cmp td { padding: 8px 6px; border-top: 1px solid var(--line); text-align: right; }
.cmp thead th { border-top: 0; font-weight: normal; color: var(--muted); white-space: nowrap; }
.cmp thead tr.sub th { font-size: 12px; padding-top: 0; }
.cmp tbody th { text-align: left; font-weight: normal; }
.cmp tbody th small { color: var(--muted); }
.cmp td.best { font-weight: bold; }
.streak { font-size: 17px; margin: 0 0 12px; }
.strong-title { margin: 0 0 4px; font-size: 14px; }
.strengths { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 4px; }

.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.seg button { background: transparent; color: var(--muted); border-radius: 0; padding: 8px 6px; font-size: 14px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.seg.small { margin: 0; width: auto; }
.seg.small button { padding: 4px 10px; font-size: 13px; width: auto; }
.filters { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.legend { display: flex; gap: 16px; font-size: 14px; }
.chart-sub { margin: 6px 0 4px; }
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; touch-action: pan-y; }
.chart-wrap .grid { stroke: var(--line); stroke-width: 1; }
.chart-wrap .axis { fill: var(--muted); font-size: 11px; font-family: system-ui, sans-serif; }
.chart-wrap .dlabel { fill: var(--ink); font-size: 12px; font-family: system-ui, sans-serif; }
.chart-wrap .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-wrap .mark { stroke: var(--card); stroke-width: 2; }
.chart-wrap .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-wrap .band-hl { fill: var(--accent-soft); }
.tooltip {
  position: absolute; pointer-events: none; background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; box-shadow: 0 4px 12px rgba(0,0,0,.12);
  font-family: system-ui, sans-serif; white-space: nowrap; z-index: 2;
}
.tooltip div { margin-top: 2px; }

/* ---------- Réglages ---------- */
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 5px; width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- Confettis ---------- */
#confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#confetti i { position: absolute; top: -12px; width: 8px; height: 14px; animation: fall linear forwards; }
@keyframes fall { to { top: 105vh; transform: rotate(720deg); } }

/* "+ noter le mot" : discret, visible au survol de la ligne (ou au clavier) */
@media (hover: hover) {
  .days .add-word { opacity: 0; transition: opacity .15s; }
  .days li:hover .add-word, .days .add-word:focus { opacity: 1; }
}
