:root {
  --bg: #08100d;
  --card: #101a16;
  --card-2: #15221d;
  --line: #1f2f28;
  --line-2: #2c4038;
  --text: #e9f1ec;
  --muted: #8ea198;
  --dim: #5f7269;
  --gold: #eab54a;
  --gold-2: #f6d684;
  --fold: #1d2925;
  --ok: #3ccf8e;
  --bad: #ff6b6b;
  --radius: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 600px at 85% -10%, rgba(34, 134, 90, 0.2), transparent 60%),
    radial-gradient(900px 500px at -10% 15%, rgba(234, 181, 74, 0.07), transparent 60%);
  background-attachment: fixed;
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: "Space Grotesk", "Inter", sans-serif; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: clamp(24px, 4vw, 34px); line-height: 1.15; }
h2 { font-size: 18px; }
h3 { font-size: 15px; margin-bottom: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; font-family: "Inter", sans-serif; }
kbd {
  display: inline-block; min-width: 20px; padding: 0 5px; border-radius: 5px;
  border: 1px solid var(--line-2); background: #0b1411; font: 600 11px/18px "Inter", sans-serif;
  text-align: center; color: var(--muted);
}
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(8, 16, 13, 0.82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 1240px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text);
  font: 500 20px "Space Grotesk", sans-serif;
}
.brand b { color: var(--gold); font-weight: 700; }
.logo {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(145deg, #1b6b47, #0d3a26); color: var(--gold); font-size: 19px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: transparent; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  color: var(--muted); font-weight: 600; white-space: nowrap; transition: background 0.15s, color 0.15s;
}
.tabs button:hover { color: var(--text); background: var(--card-2); }
.tabs button.on { color: #10170f; background: var(--gold); }

/* ---------- layout ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.tab { display: none; animation: fade 0.25s ease; }
.tab.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.intro { padding: 26px 0 18px; }
.intro p { margin: 6px 0 0; color: var(--muted); }
.layout { display: grid; grid-template-columns: minmax(300px, 410px) minmax(0, 1fr); gap: 18px; align-items: start; }
.col-left, .col-right { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; min-width: 0; }
@media (max-width: 920px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.card {
  background: linear-gradient(180deg, var(--card-2), var(--card) 140px);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.8);
}

/* ---------- contrôles ---------- */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: #0a1310; border: 1px solid var(--line); }
.seg button {
  flex: 1; border: 0; background: transparent; padding: 8px 6px; border-radius: 9px; cursor: pointer;
  color: var(--muted); font-weight: 600; font-size: 13.5px; transition: background 0.15s, color 0.15s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--card-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg.small button { padding: 5px 10px; font-size: 12.5px; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.chips-label { width: 100%; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.chip {
  border: 1px solid var(--line-2); background: #0c1612; padding: 5px 11px; border-radius: 999px; cursor: pointer;
  font-weight: 600; font-size: 13px; transition: all 0.15s;
}
.chip:hover:not(:disabled) { border-color: var(--gold); }
.chip.on { background: var(--gold); border-color: var(--gold); color: #10170f; }
.chip.villain.on { background: #e5484d; border-color: #e5484d; color: #fff; }
.chip:disabled { opacity: 0.3; cursor: not-allowed; }
.chip.toggle.on { background: #1d3b2e; border-color: var(--ok); color: var(--text); }
.btn {
  border: 1px solid var(--line-2); background: #0e1814; padding: 9px 16px; border-radius: 10px; cursor: pointer;
  font-weight: 600; transition: all 0.15s;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #10170f; }
.btn.primary:hover { background: var(--gold-2); }
.btn.ghost { background: transparent; }
.btn.full { width: 100%; margin-top: 12px; }
.btn-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.icon-btn {
  border: 1px solid var(--line-2); background: transparent; color: var(--muted); padding: 2px 8px;
  border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 600;
}
.icon-btn:hover { color: var(--text); border-color: var(--muted); }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.field input {
  font: 600 20px "Space Grotesk", sans-serif; color: var(--text); background: #0a1310; border: 1px solid var(--line-2);
  border-radius: 10px; padding: 10px 12px; outline: none; text-transform: none;
}
.field input:focus { border-color: var(--gold); }

/* ---------- table ---------- */
.table-wrap { margin-top: 12px; }
.poker-table { width: 100%; height: auto; display: block; overflow: visible; }
.poker-table .rail { fill: #2a1d12; stroke: #4a3420; stroke-width: 2; }
.poker-table .felt { stroke: rgba(255, 255, 255, 0.06); stroke-width: 2; }
.poker-table .pot-label { fill: rgba(255, 255, 255, 0.45); font: 700 10px "Inter", sans-serif; letter-spacing: 0.18em; text-anchor: middle; }
.poker-table .pot { fill: #fff; font: 700 17px "Space Grotesk", sans-serif; text-anchor: middle; }
.seat circle { fill: #15201c; stroke: #3a4d45; stroke-width: 2; transition: all 0.2s; }
.seat .seat-pos { fill: var(--text); font: 700 13px "Inter", sans-serif; text-anchor: middle; }
.seat .seat-role { fill: var(--muted); font: 600 9px "Inter", sans-serif; text-anchor: middle; text-transform: uppercase; letter-spacing: 0.05em; }
.seat.hero circle { fill: var(--gold); stroke: var(--gold-2); stroke-width: 3; filter: drop-shadow(0 0 10px rgba(234, 181, 74, 0.55)); }
.seat.hero .seat-pos, .seat.hero .seat-role { fill: #18200f; }
.seat.villain circle { fill: #3a1517; stroke: #e5484d; stroke-width: 3; filter: drop-shadow(0 0 8px rgba(229, 72, 77, 0.45)); }
.seat.villain .seat-role { fill: #ff9a9d; }
.seat.folded { opacity: 0.38; }
.seat.clickable { cursor: pointer; }
.seat.clickable:hover circle { stroke: #fff; }
.seat.clickable:hover { opacity: 1; }
.bet .chip-dot { fill: #d8d2c4; stroke: #8b1e22; stroke-width: 3; stroke-dasharray: 3 2.5; }
.bet text { fill: #fff; font: 700 11.5px "Inter", sans-serif; }
.dealer circle { fill: #fff; stroke: #c9c9c9; }
.dealer text { fill: #111; font: 800 10px "Inter", sans-serif; text-anchor: middle; }
.situation { margin: 10px 0 0; font-weight: 500; }
.situation.center { text-align: center; }
.tip { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }

/* ---------- grille ---------- */
.grid-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.sizing { font-size: 12.5px; color: var(--muted); border: 1px solid var(--line-2); padding: 3px 9px; border-radius: 999px; }
.grid {
  display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 2px;
  max-width: 640px; user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.grid.paint { touch-action: none; }
.cell {
  aspect-ratio: 1; border-radius: 4px; display: flex; align-items: center; justify-content: center;
  font: 650 clamp(8px, 1.45vw, 12.5px) "Inter", sans-serif; letter-spacing: -0.02em;
  color: #fff; background: var(--fold); cursor: pointer; position: relative;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
@media (max-width: 920px) { .cell { font-size: clamp(7.5px, 2.5vw, 12.5px); } }
.cell.fold { color: rgba(233, 241, 236, 0.33); text-shadow: none; }
.cell.off {
  background: repeating-linear-gradient(135deg, #111a17 0 4px, #0c1411 4px 8px); color: rgba(233, 241, 236, 0.13);
  cursor: default; text-shadow: none;
}
.cell.hidden { background: #16211d; color: rgba(233, 241, 236, 0.22); text-shadow: none; }
.cell:hover:not(.off) { transform: scale(1.14); z-index: 3; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6); }
.cell.hl { z-index: 4; box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(234, 181, 74, 0.7); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 2px var(--gold-2), 0 0 26px rgba(234, 181, 74, 0.95); } }
.cell.pop { animation: pop 0.38s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
@keyframes pop { from { opacity: 0; transform: scale(0.55); } to { opacity: 1; transform: none; } }
.cell.err { box-shadow: inset 0 0 0 2px #fff, 0 0 0 1px var(--bad); }
.cell.err::after {
  content: ""; position: absolute; top: 2px; right: 2px; width: 6px; height: 6px; border-radius: 50%; background: var(--bad);
}
.grid.small .cell { font-size: clamp(6px, 0.9vw, 9px); border-radius: 3px; }
.grid.picker .cell { background: #16211d; color: var(--muted); text-shadow: none; }
.grid.picker .cell.pair { background: #1b2a24; }
.grid.picker .cell.sel { background: var(--gold); color: #10170f; }
.grid.paint .cell { cursor: crosshair; }

/* ---------- légende / info ---------- */
.legend { margin-top: 14px; display: grid; gap: 8px; }
.lg-row { display: grid; grid-template-columns: 14px 54px minmax(40px, 1fr) 52px 86px 64px; gap: 10px; align-items: center; font-size: 13.5px; }
.sw { width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.lg-label { font-weight: 600; }
.lg-bar { height: 8px; border-radius: 99px; background: #0b1411; overflow: hidden; }
.lg-bar i { display: block; height: 100%; border-radius: 99px; transition: width 0.4s ease; }
.lg-num { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lg-combos { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.lg-note { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; }
@media (max-width: 520px) {
  .lg-row { grid-template-columns: 14px 46px minmax(24px, 1fr) 54px 58px; gap: 8px; }
  .tabs button { padding: 7px 10px; font-size: 13.5px; }
  .tabs .long { display: none; }
  .lg-combos { display: none; }
}
.info-empty { margin: 0; }
.info-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.info-name { font: 700 26px "Space Grotesk", sans-serif; }
.freq-row { display: grid; grid-template-columns: 56px 1fr 44px; gap: 10px; align-items: center; margin-top: 7px; font-size: 13.5px; }
.freq-row .lg-bar { height: 10px; }
.freq-row b { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- cartes ---------- */
.cards { display: flex; gap: 6px; }
.pcard {
  width: 40px; height: 56px; border-radius: 6px; background: #fbfaf6; position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  font-family: "Space Grotesk", sans-serif;
}
.pcard .r { font-size: 20px; font-weight: 700; }
.pcard .s { font-size: 17px; margin-top: 2px; }
.pcard.s0 { color: #161616; }
.pcard.s1 { color: #d3263a; }
.pcard.s2 { color: #1f63d6; }
.pcard.s3 { color: #148a40; }
.cards.big { justify-content: center; gap: 10px; }
.cards.big .pcard { width: 70px; height: 98px; border-radius: 9px; animation: deal 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
.cards.big .pcard:nth-child(2) { animation-delay: 0.08s; transform: rotate(4deg); }
.cards.big .pcard:first-child { transform: rotate(-4deg); }
.cards.big .pcard .r { font-size: 34px; }
.cards.big .pcard .s { font-size: 28px; }
@keyframes deal { from { opacity: 0; transform: translateY(-30px) rotate(-12deg) scale(0.8); } }
.hand-slot { margin-top: 6px; min-height: 104px; }

/* ---------- quiz ---------- */
.actions { display: flex; gap: 8px; margin-top: 14px; }
.act-btn {
  flex: 1; border: 1px solid color-mix(in srgb, var(--c) 70%, #fff 0%); background: color-mix(in srgb, var(--c) 22%, #0b1411);
  padding: 13px 8px; border-radius: 12px; cursor: pointer; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.15s;
}
.act-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--c) 45%, #0b1411); transform: translateY(-1px); }
.act-btn:disabled { cursor: default; opacity: 0.45; }
.act-btn.chosen { opacity: 1; box-shadow: 0 0 0 2px #fff; }
.act-btn.best { opacity: 1; background: var(--c); }
.act-btn kbd { background: rgba(0, 0, 0, 0.3); border-color: rgba(255, 255, 255, 0.15); color: rgba(255, 255, 255, 0.75); }
.feedback:empty { display: none; }
.feedback { margin-top: 14px; padding: 14px; border-radius: 12px; border: 1px solid var(--line-2); animation: fade 0.25s ease; }
.feedback.ok { border-color: rgba(60, 207, 142, 0.5); background: rgba(60, 207, 142, 0.08); }
.feedback.bad { border-color: rgba(255, 107, 107, 0.5); background: rgba(255, 107, 107, 0.08); }
.fb-title { font: 700 18px "Space Grotesk", sans-serif; }
.feedback.ok .fb-title { color: var(--ok); }
.feedback.bad .fb-title { color: var(--bad); }
.fb-sol { margin: 4px 0 10px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { text-align: center; padding: 8px 4px; border-radius: 10px; background: #0b1411; border: 1px solid var(--line); }
.stat b { display: block; font: 700 22px "Space Grotesk", sans-serif; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stats .reset { grid-column: 1 / -1; justify-self: end; }
.errors { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.errors li button {
  width: 100%; text-align: left; border: 1px solid var(--line); background: #0b1411; border-radius: 9px; padding: 8px 10px;
  cursor: pointer; font-size: 13.5px;
}
.errors li button:hover { border-color: var(--line-2); }
.errors .e-hand { font-weight: 700; color: var(--gold); margin-right: 6px; }

/* ---------- dessin ---------- */
.brushes { display: flex; gap: 8px; flex-wrap: wrap; }
.brush {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); background: #0b1411; padding: 8px 12px;
  border-radius: 10px; cursor: pointer; font-weight: 600;
}
.brush.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.score { margin-top: 14px; padding: 14px; border-radius: 12px; background: #0b1411; border: 1px solid var(--line); }
.score-big { font: 700 34px "Space Grotesk", sans-serif; }
.score ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 13.5px; }

/* ---------- ma main ---------- */
.lk-head { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; flex-wrap: wrap; }
.lk-head .info-name { font-size: 32px; }
.lk-section { margin-top: 18px; }
.mx-wrap { overflow-x: auto; }
.mx-table { border-collapse: separate; border-spacing: 3px; width: 100%; min-width: 420px; table-layout: fixed; }
.mx-table tr > :first-child { width: 72px; }
.mx-table th { font-size: 12px; color: var(--muted); font-weight: 600; padding: 2px; }
.mx-table th.corner { text-align: left; font-weight: 500; font-size: 11px; line-height: 1.2; }
.mx-table td { padding: 0; }
.mx {
  width: 100%; min-height: 40px; border: 0; border-radius: 7px; cursor: pointer; color: #fff; font-weight: 700; font-size: 12px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); padding: 4px 2px; line-height: 1.15; transition: transform 0.12s;
}
.mx:hover { transform: scale(1.06); }
.mx.fold { color: rgba(233, 241, 236, 0.45); text-shadow: none; }
.mx.off { background: repeating-linear-gradient(135deg, #111a17 0 4px, #0c1411 4px 8px); color: var(--dim); }
.na { background: transparent; }
.lk-summary { color: var(--muted); margin: 0; }

/* ---------- divers ---------- */
details.howto summary { cursor: pointer; font-weight: 600; }
details.howto ul { margin: 12px 0 0; padding-left: 18px; color: var(--muted); display: grid; gap: 6px; font-size: 14px; }
details.howto b { color: var(--text); }
.foot { max-width: 1240px; margin: 40px auto 0; padding: 20px 16px 40px; color: var(--dim); font-size: 13px; border-top: 1px solid var(--line); }
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--gold); color: #10170f; padding: 9px 16px; border-radius: 999px; font-weight: 700; font-size: 14px;
  transition: all 0.25s ease; z-index: 50; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.tabs .short { display: none; }
@media (max-width: 520px) { .tabs .short { display: inline; } }
.seg:empty { display: none; }
