@font-face { font-family: "Geist"; font-style: normal; font-weight: 400; font-display: swap; src: url("../polices/geist-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Geist"; font-style: normal; font-weight: 500; font-display: swap; src: url("../polices/geist-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Geist"; font-style: normal; font-weight: 600; font-display: swap; src: url("../polices/geist-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Geist"; font-style: normal; font-weight: 700; font-display: swap; src: url("../polices/geist-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Geist Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../polices/geist-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Geist Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../polices/geist-mono-latin-500-normal.woff2") format("woff2"); }

/* Thème commun : épuré, papier et encre, un seul accent. Clair par défaut, sombre selon le système. */
:root {
  color-scheme: light;
  --bg: #e8e7e1;
  --surface: #ffffff;
  --soft: #dad9d2;
  --line: #b4b3aa;
  --ink: #0c0c0e;
  --muted: #4f4f49;
  --accent: #2340b5;
  --hot: #bf3a12;
  --ok: #19733f;
  --violet: #5a2fbf;
  --sans: "Geist", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", "Consolas", "Menlo", monospace;
  --r: 12px;
  --ombre: 0 1px 2px rgba(20, 20, 20, 0.08), 0 4px 16px rgba(20, 20, 20, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111112;
    --surface: #19191b;
    --soft: #29292d;
    --line: #3f3f45;
    --ink: #ececea;
    --muted: #a9a9a3;
    --accent: #7d93ff;
    --hot: #ff7a52;
    --ok: #4cc27f;
    --violet: #a68bff;
    --ombre: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111112;
  --surface: #19191b;
  --soft: #29292d;
  --line: #3f3f45;
  --ink: #ececea;
  --muted: #a9a9a3;
  --accent: #7d93ff;
  --hot: #ff7a52;
  --ok: #4cc27f;
  --violet: #a68bff;
  --ombre: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100vh; }
a { color: var(--accent); }
::selection { background: var(--accent); color: var(--surface); }

/* ---------- Pages de jeu ---------- */

.jeu {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 28px;
  gap: 18px;
}

.barre {
  width: 100%;
  max-width: 980px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  flex-wrap: wrap;
}

.retour {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 10px 6px 0;
  transition: color .15s;
}
.retour:hover, .retour:focus-visible { color: var(--ink); outline: none; }

.titre-jeu {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  flex: 1;
  white-space: nowrap;
}

.hud { display: flex; gap: 22px; flex-wrap: wrap; }

.stat { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.stat span { font-size: 12px; color: var(--muted); }
.stat b { font-family: var(--mono); font-size: 17px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }

.scene {
  position: relative;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--ombre);
  max-width: 100%;
}

canvas { display: block; max-width: 100%; touch-action: none; border-radius: 6px; }

.btn {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 13px;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.btn:hover { border-color: var(--muted); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.actif { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn:disabled { opacity: .4; cursor: default; }

.options { display: flex; flex-wrap: wrap; gap: 10px 22px; justify-content: center; max-width: 980px; }
.groupe { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.groupe > span { font-size: 12px; color: var(--muted); }
.segment { display: inline-flex; background: var(--soft); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segment .btn { border: 0; background: transparent; padding: 5px 11px; border-radius: 7px; color: var(--muted); }
.segment .btn:hover { color: var(--ink); }
.segment .btn.actif { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.aide {
  max-width: 980px;
  width: 100%;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  line-height: 1.9;
  margin: 0;
}
.aide kbd {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  background: var(--soft);
  border-radius: 4px;
  padding: 1px 5px;
}

/* Fenêtre superposée (début, pause, fin) */
.overlay {
  position: absolute;
  inset: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(3px);
  text-align: center;
  padding: 20px;
  z-index: 5;
  border-radius: 6px;
}
.overlay[hidden] { display: none; }
.overlay.plein { position: fixed; inset: 0; z-index: 50; background: var(--surface); backdrop-filter: none; border-radius: 0; justify-content: flex-start; overflow-y: auto; padding: 32px 20px; }
.overlay.plein > * { flex-shrink: 0; }
.overlay h2 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
.overlay p { margin: 0; color: var(--ink); font-size: 14px; line-height: 1.6; max-width: 34ch; }
.overlay .petit { color: var(--muted); font-size: 12.5px; }
.overlay .btn { background: var(--ink); border-color: var(--ink); color: var(--surface); padding: 9px 20px; }

/* Commandes tactiles (visibles seulement sur écran tactile) */
.tactile { display: none; gap: 10px; width: 100%; max-width: 480px; }
.tactile .btn { flex: 1; padding: 16px 0; font-size: 15px; user-select: none; -webkit-user-select: none; touch-action: none; }
@media (pointer: coarse) { .tactile { display: flex; } }

@media (max-width: 560px) {
  .jeu { padding: 14px 16px 20px; gap: 12px; }
  .hud { gap: 14px; width: 100%; justify-content: space-between; }
  .stat { align-items: flex-start; }
  .stat b { font-size: 15px; }
  .titre-jeu { font-size: 17px; }
}

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

/* ---------- Règles du jeu (texte sous la partie) ---------- */
.regles {
  width: 100%;
  max-width: 720px;
  margin-top: 18px;
  padding: 24px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
}
.regles h2 { margin: 0 0 6px; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.regles h3 { margin: 20px 0 4px; font-size: 15px; font-weight: 600; }
.regles p { margin: 0 0 10px; }
.regles ul { margin: 0 0 10px; padding-left: 20px; }
.regles li { margin: 3px 0; }
.regles kbd { font-family: var(--mono); font-size: 12px; background: var(--soft); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.regles .chapo { color: var(--muted); }
@media (max-width: 560px) { .regles { padding: 18px 16px; font-size: 14.5px; } }

/* Cibles tactiles confortables */
@media (pointer: coarse) {
  .btn { min-height: 40px; }
  .segment .btn { min-height: 36px; }
}

/* ---------- Pied de page commun (liens légaux) ---------- */
.pied-site { width: 100%; max-width: 980px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; }
.pied-site a { color: var(--muted); text-decoration: none; }
.pied-site a:hover, .pied-site a:focus-visible { color: var(--ink); text-decoration: underline; }
