/* Lotolab : papier de billet, encre, boules de tirage. Espacements en multiples de 8 px. */
:root {
  --bg: #f4efe4;
  --surface: #fbf8f1;
  --surface-2: #efe8da;
  --ink: #1d1b16;
  --ink-2: #4a463d;
  --ink-3: #777164;
  --line: rgba(29, 27, 22, 0.12);
  --line-strong: rgba(29, 27, 22, 0.24);
  --max: #0f6b5c;
  --max-soft: rgba(15, 107, 92, 0.12);
  --six: #b3352b;
  --six-soft: rgba(179, 53, 43, 0.1);
  --good: #2f7d32;
  --warn: #9a5b00;
  --radius-s: 8px;
  --radius-m: 16px;
  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-num: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15140f;
    --surface: #1d1c16;
    --surface-2: #26241d;
    --ink: #efe9dc;
    --ink-2: #c4bdad;
    --ink-3: #8e877a;
    --line: rgba(239, 233, 220, 0.1);
    --line-strong: rgba(239, 233, 220, 0.22);
    --max: #4fb3a1;
    --max-soft: rgba(79, 179, 161, 0.14);
    --six: #e0766c;
    --six-soft: rgba(224, 118, 108, 0.14);
    --good: #7cc47f;
    --warn: #e0a040;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
}
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 32px; font-weight: 700; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.soft { color: var(--ink-2); }
.small { font-size: 14px; }
.stack > * + * { margin-top: 16px; }
.stack-l > * + * { margin-top: 32px; }

/* Structure */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 24px; border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-family: var(--font-display); font-weight: 800; font-size: 20px; text-decoration: none; display: flex; gap: 8px; align-items: center; }
.brand-dot { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff8 0 20%, transparent 21%), var(--max); }
.nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nav a, .linkbtn {
  text-decoration: none; padding: 8px 16px; border-radius: var(--radius-s); color: var(--ink-2);
  font: inherit; font-size: 15px; background: none; border: 0; cursor: pointer;
  transition: background 150ms, color 150ms;
}
.nav a:hover, .linkbtn:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--surface-2); color: var(--ink); font-weight: 600; }
main { max-width: 1120px; margin: 0 auto; padding: 32px 24px 64px; }
@media (max-width: 640px) {
  .top { padding: 8px 16px; }
  main { padding: 24px 16px 48px; }
  h1 { font-size: 28px; }
}

/* Surfaces */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 24px;
}
.card-max { border-top: 4px solid var(--max); }
.card-649 { border-top: 4px solid var(--six); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: 24px; }
.row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 16px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.kicker { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }

/* Boules : l'élément signature */
.balls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ball {
  --c: var(--max);
  width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center;
  font: 600 16px var(--font-num); color: #fff;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.45) 0 14%, transparent 15%), var(--c);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.18);
}
.ball-sm { width: 32px; height: 32px; font-size: 14px; }
.t-649 .ball { --c: var(--six); }
.ball-bonus { --c: var(--ink-3) !important; }
.plus { color: var(--ink-3); font-weight: 600; }

/* Verdict */
.verdict { border-radius: var(--radius-s); padding: 16px; display: flex; gap: 16px; align-items: flex-start; background: var(--surface-2); }
.verdict-mark { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--ink-3); margin-top: 2px; }
.verdict.ok { background: rgba(47, 125, 50, 0.12); }
.verdict.ok .verdict-mark { border-color: var(--good); background: var(--good); }

/* Tableaux */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: 13px; padding: 8px; border-bottom: 1px solid var(--line-strong); }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.r, th.r { text-align: right; }
tr.lead td { font-weight: 600; }
.bar { height: 8px; border-radius: 4px; background: var(--surface-2); position: relative; overflow: hidden; min-width: 64px; }
.bar > span { position: absolute; inset: 0 auto 0 0; background: var(--max); border-radius: 4px; }
.t-649 .bar > span { background: var(--six); }
.pill { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 13px; background: var(--surface-2); color: var(--ink-2); }
.pill.good { background: rgba(47, 125, 50, 0.14); color: var(--good); }
.pill.warn { background: rgba(154, 91, 0, 0.12); color: var(--warn); }
.scroll-x { overflow-x: auto; }

/* Formulaires */
label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 8px; }
.input {
  width: 100%; max-width: 240px; font: 600 18px var(--font-num); color: var(--ink);
  padding: 8px 16px; border-radius: var(--radius-s); border: 1px solid var(--line-strong);
  background: var(--surface-2); transition: border-color 150ms, box-shadow 150ms;
}
.input:focus { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 3px var(--line); }
.input-wide { max-width: 360px; font-family: var(--font-body); font-weight: 400; }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
  margin: 0; cursor: pointer; padding: 16px; border-radius: var(--radius-s); border: 1px solid var(--line-strong);
  background: var(--surface); font-weight: 400; transition: border-color 150ms, background 150ms;
}
.choice label strong { display: block; font-family: var(--font-display); font-size: 18px; }
.choice label:hover { border-color: var(--ink-3); }
.choice input:checked + label { border: 2px solid var(--ink); background: var(--surface-2); padding: 15px; }
.choice input:focus-visible + label { box-shadow: 0 0 0 3px var(--line-strong); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; font: 600 16px var(--font-body);
  padding: 8px 24px; min-height: 48px; border-radius: var(--radius-s); border: 1px solid var(--ink);
  background: var(--ink); color: var(--bg); cursor: pointer; text-decoration: none;
  transition: transform 150ms, opacity 150ms;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--line-strong); outline-offset: 2px; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-small { min-height: 40px; padding: 8px 16px; font-size: 14px; }
.btn-danger { background: transparent; color: var(--six); border-color: var(--six-soft); }

.play { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 16px; background: var(--surface); }
.play + .play { margin-top: 16px; }
.play-grids > * + * { margin-top: 8px; }
.grid-line { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.grid-line .label { width: 24px; color: var(--ink-3); font: 600 14px var(--font-num); }

.stat { font: 700 32px var(--font-num); letter-spacing: -0.02em; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.error { color: var(--six); font-weight: 600; }
.login { max-width: 400px; margin: 64px auto; }
details summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
details[open] summary { margin-bottom: 16px; }
.caption { text-align: left; padding-bottom: 8px; }
.note { margin-top: 8px; }
.bar > span.w-0 { width: 0%; }
.bar > span.w-5 { width: 5%; }
.bar > span.w-10 { width: 10%; }
.bar > span.w-15 { width: 15%; }
.bar > span.w-20 { width: 20%; }
.bar > span.w-25 { width: 25%; }
.bar > span.w-30 { width: 30%; }
.bar > span.w-35 { width: 35%; }
.bar > span.w-40 { width: 40%; }
.bar > span.w-45 { width: 45%; }
.bar > span.w-50 { width: 50%; }
.bar > span.w-55 { width: 55%; }
.bar > span.w-60 { width: 60%; }
.bar > span.w-65 { width: 65%; }
.bar > span.w-70 { width: 70%; }
.bar > span.w-75 { width: 75%; }
.bar > span.w-80 { width: 80%; }
.bar > span.w-85 { width: 85%; }
.bar > span.w-90 { width: 90%; }
.bar > span.w-95 { width: 95%; }
.bar > span.w-100 { width: 100%; }

/* Corrections après revue visuelle */
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.ball { background: radial-gradient(circle at 26% 22%, rgba(255,255,255,0.4) 0 7%, transparent 8%), var(--c); }
.confirm summary { list-style: none; }
.confirm summary::-webkit-details-marker { display: none; }
.confirm[open] summary { margin-bottom: 8px; }
@media (max-width: 640px) {
  .top { flex-wrap: wrap; gap: 8px; }
  .nav { width: 100%; flex-wrap: nowrap; overflow-x: auto; gap: 4px; margin: 0 -8px; }
  .nav a, .linkbtn { white-space: nowrap; padding: 8px; }
  .stat { font-size: 24px; }
}
@media (max-width: 640px) {
  .balls { gap: 4px; }
  .ball { width: 32px; height: 32px; font-size: 14px; }
  .grid-line { gap: 8px; }
}
