/* SR Games : style « jouet », palette du dossier de conception */
:root {
  /* palette « la Brigade » : nappe de pique-nique, ketchup, moutarde */
  --bg: #fff6ec; --surface: #ffffff; --surface2: #fdeedd; --line: #f1dcc8;
  --ink: #3a2014; --muted: #8a6450; --row: #fbf1e4;
  --coral: #e0402e; --sun: #e9b21f; --teal: #2f9e8f; --violet: #7b5cd6; --green: #3fa34d;
  --display: "Baloo 2", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    linear-gradient(90deg, rgba(224,64,46,.07) 50%, transparent 50%) 0 0 / 64px 64px,
    linear-gradient(rgba(224,64,46,.07) 50%, transparent 50%) 0 0 / 64px 64px,
    var(--bg);
  color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.05; margin: 0; letter-spacing: .01em; }
button, input { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
[hidden] { display: none !important; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 20px 16px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; max-width: 1040px; margin: 0 auto; }
.logo { font-family: var(--display); font-weight: 800; font-size: 28px; color: var(--coral); cursor: pointer; }
.logo span { color: var(--ink); }

/* boutons « jouet » : relief et enfoncement */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  padding: 12px 18px; border-radius: 14px; font-weight: 800; font-size: 16px;
  background: var(--sun); color: #3a2014; box-shadow: 0 5px 0 #b4850c, 0 8px 16px #3a201422;
  transition: transform .06s, box-shadow .06s; user-select: none;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #b4850c, 0 3px 8px #3a201422; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.ghost { background: var(--surface); color: var(--ink); box-shadow: 0 5px 0 #e6cdb5, 0 8px 16px #3a201418; }
.btn.teal { background: var(--teal); color: #fff; box-shadow: 0 5px 0 #1f6e63, 0 8px 16px #3a201422; }
.btn.coral { background: var(--coral); color: #fff; box-shadow: 0 5px 0 #a82a1c, 0 8px 16px #3a201422; }
.btn.small { padding: 8px 12px; font-size: 14px; border-radius: 11px; }
.btn.block { width: 100%; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }

.input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff;
  font-size: 17px; font-weight: 600; outline: none;
}
.input:focus { border-color: var(--coral); }
.input.code { text-transform: uppercase; letter-spacing: .3em; font-family: var(--display); font-size: 24px; text-align: center; }

.card { background: var(--surface); border-radius: 22px; padding: 18px; border: 1px solid var(--line); box-shadow: 0 10px 30px #3a201412; }
.grid2 { align-items: start; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 18px; }
.stack { display: grid; gap: 12px; align-content: start; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* accueil */
.hero { text-align: center; padding: 40px 0 20px; display: grid; gap: 10px; justify-items: center; }
.hero h1 { font-size: clamp(48px, 10vw, 96px); line-height: .95; color: var(--coral); }
.hero h1 span { color: var(--ink); }
.hero p { color: var(--muted); font-size: 18px; max-width: 46ch; margin: 0; }
.toys { display: flex; gap: 14px; justify-content: center; margin: 10px 0; }
.toy { width: 44px; height: 44px; border-radius: 50%; animation: bob 2.4s ease-in-out infinite; }
.toy:nth-child(2) { animation-delay: .3s } .toy:nth-child(3) { animation-delay: .6s } .toy:nth-child(4) { animation-delay: .9s }
@keyframes bob { 50% { transform: translateY(-10px) rotate(8deg); } }
.home { max-width: 760px; margin: 0 auto; }

/* avatar « matcap » : bille brillante */
.av {
  --c: var(--sun); width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 800; color: #3a2014; font-size: 15px; object-fit: cover;
  background: radial-gradient(circle at 32% 28%, #fff9 0 8%, transparent 26%), radial-gradient(circle at 50% 60%, var(--c) 0 55%, color-mix(in srgb, var(--c) 55%, #000) 100%);
  box-shadow: 0 0 0 3px var(--c), 0 4px 10px #3a201425;
}
.av.big { width: 72px; height: 72px; font-size: 30px; }

/* salon */
.code-big { font-family: var(--display); font-size: clamp(44px, 9vw, 72px); letter-spacing: .14em; color: var(--coral); line-height: 1; }
.plist { display: grid; gap: 8px; }
.pl { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--row); font-weight: 700; }
.pl.off { opacity: .45; }
.tag { font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--surface2); color: var(--muted); }
.tag.ok { color: var(--green); }
.tag.host { color: var(--sun); }
.pl .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 70px; padding: 9px 8px; border-radius: 10px; border: 0; cursor: pointer; background: var(--surface2); font-weight: 700; font-size: 14px; }
.seg button.on { background: var(--ink); color: var(--bg); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { padding: 7px 11px; border-radius: 10px; border: 0; cursor: pointer; background: var(--teal); color: #fff; font-weight: 700; font-size: 14px; }
.chip.off { background: var(--surface2); color: var(--muted); text-decoration: line-through; }
.chip.na { opacity: .3; cursor: not-allowed; }
.chip.pick { background: var(--coral); color: #fff; }
.colors { display: flex; gap: 8px; flex-wrap: wrap; }
.colors button { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.colors button.on { border-color: var(--ink); }
.colors button:disabled { opacity: .2; cursor: not-allowed; }

/* scène de jeu */
.gamebar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border: 1px solid var(--line); border-top: 0; font-family: var(--mono); font-size: 13px; color: var(--muted); max-width: 1040px; margin: 0 auto; border-radius: 0 0 14px 14px; }
.gamebar b { color: var(--ink); }
.stage { max-width: 1040px; margin: 0 auto; padding: 20px 16px 40px; }
.center { display: grid; place-items: center; text-align: center; gap: 16px; }
.timer { font-family: var(--mono); color: var(--coral); font-weight: 700; }
.timebar { height: 8px; border-radius: 9px; background: var(--surface2); overflow: hidden; width: 100%; }
.timebar i { display: block; height: 100%; background: var(--coral); border-radius: 9px; transition: width .2s linear; }

/* tirage */
.wheel { font-family: var(--display); font-size: clamp(36px, 8vw, 72px); font-weight: 800; color: var(--coral); min-height: 1.3em; }
.wheel.land { animation: pop .5s ease-out; }
@keyframes pop { 0% { transform: scale(.6) } 60% { transform: scale(1.15) } 100% { transform: scale(1) } }
.howto { text-align: left; display: grid; gap: 8px; max-width: 560px; padding: 0; margin: 0; list-style: none; }
.howto li { background: var(--surface); border: 1px solid var(--line); padding: 10px 14px; border-radius: 12px; }
.countdown { font-family: var(--display); font-weight: 800; font-size: 64px; color: var(--coral); }

/* QCM */
.qprompt { font-weight: 800; font-size: clamp(20px, 3vw, 28px); line-height: 1.25; max-width: 720px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; width: 100%; max-width: 720px; }
.choice { padding: 16px; border-radius: 14px; border: 0; cursor: pointer; background: var(--surface); border: 2px solid var(--line); font-weight: 800; font-size: 18px; box-shadow: 0 5px 0 #e6cdb5; text-align: left; display: flex; gap: 10px; align-items: center; }
.choice .k { font-family: var(--mono); font-size: 12px; color: var(--muted); background: var(--surface2); padding: 2px 7px; border-radius: 6px; }
.choice.mine { outline: 3px solid var(--ink); }
.choice.good { background: var(--green); color: #fff; }
.choice.bad { background: var(--coral); color: #fff; }
.choice.gone { opacity: .2; pointer-events: none; }
.choice:disabled { cursor: default; }
.flag { width: min(320px, 70vw); aspect-ratio: 4/3; border-radius: 10px; box-shadow: 0 10px 30px #3a201430; object-fit: cover; background: #fff; }
.pchips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pchip { font-size: 13px; padding: 4px 9px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-weight: 700; display: inline-flex; gap: 5px; align-items: center; }
.pchip i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* Feu Vert */
.fv { position: fixed; inset: 0; display: grid; place-items: center; text-align: center; cursor: pointer; user-select: none; touch-action: manipulation; z-index: 5; }
.fv.red { background: #8c2230; } .fv.green { background: #2fbf63; color: #0b2a16; }
.fv.jaune { background: #e3b52a; color: #2a200b; } .fv.bleu { background: #2a59c9; }
.fv.wait { background: var(--bg); color: var(--ink); }
.fv.red, .fv.bleu { color: #fff; }
.fv .big { font-family: var(--display); font-size: clamp(48px, 12vw, 120px); line-height: 1; }
.fv .info { position: absolute; top: 14px; left: 0; right: 0; font-family: var(--mono); font-size: 13px; opacity: .85; }
.fv .res { margin-top: 14px; display: grid; gap: 4px; font-family: var(--mono); font-size: 15px; }

/* Cowboy */
.west { position: fixed; inset: 0; background: linear-gradient(#f2a65a 0%, #f6c27a 45%, #c98b4b 46%, #a8703a 100%); cursor: pointer; user-select: none; touch-action: manipulation; overflow: hidden; z-index: 5; color: #2a1608; }
.west .sun { position: absolute; left: 50%; top: 18%; width: 140px; height: 140px; margin-left: -70px; border-radius: 50%; background: #ffe6a0; box-shadow: 0 0 80px #fff3c0; }
.west svg.cb { position: absolute; bottom: 18%; width: min(22vw, 180px); height: auto; transition: transform .6s; }
.west svg.cb.left { left: 12%; } .west svg.cb.right { right: 12%; transform: scaleX(-1); }
.west svg.cb.left.dead { transform: rotate(-80deg) translateY(30%); }
.west svg.cb.right.dead { transform: scaleX(-1) rotate(-80deg) translateY(30%); }
.west .msg { position: absolute; top: 8%; left: 0; right: 0; text-align: center; font-family: var(--display); font-size: clamp(36px, 9vw, 90px); text-shadow: 0 4px 0 #fff6; }
.west .msg.fire { color: #b3121f; animation: pop .3s; }
.west .score { position: absolute; bottom: 4%; left: 0; right: 0; text-align: center; font-family: var(--mono); font-weight: 700; }
.west .names { position: absolute; bottom: 11%; left: 8%; right: 8%; display: flex; justify-content: space-between; font-weight: 800; }
.poster { background: #f1dfb6; color: #3a2210; border-radius: 6px; padding: 18px 22px; font-family: var(--display); text-align: center; box-shadow: 0 10px 30px #0008; transform: rotate(-2deg); display: inline-grid; gap: 4px; }
.poster .w { font-size: 40px; letter-spacing: .1em; }

/* Lettres */
.tiles { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.tile { width: clamp(36px, 8vw, 56px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; background: var(--sun); color: #3a2014; font-family: var(--display); font-weight: 800; font-size: clamp(20px, 4vw, 30px); box-shadow: 0 4px 0 #b4850c; border: 0; cursor: pointer; }
.tile.used { opacity: .25; }
.wordline { font-family: var(--display); font-size: clamp(28px, 6vw, 48px); letter-spacing: .14em; border-bottom: 3px solid var(--coral); min-width: 240px; font-weight: 800; min-height: 1.3em; padding: 0 10px; }

/* Frappe */
.typetext { font-family: var(--mono); font-size: clamp(16px, 2.4vw, 22px); line-height: 1.7; max-width: 820px; text-align: left; user-select: none; -webkit-user-select: none; }
.typetext .done { color: var(--green); } .typetext .err { background: var(--coral); color: #fff; } .typetext .todo { color: var(--muted); }
.typetext .cur { border-left: 2px solid var(--coral); }
.race { display: grid; grid-template-columns: 110px 1fr 60px; gap: 10px; align-items: center; font-size: 14px; font-weight: 700; width: 100%; max-width: 820px; }
.race .bar { height: 10px; border-radius: 9px; background: var(--surface2); overflow: hidden; }
.race .bar i { display: block; height: 100%; border-radius: 9px; transition: width .2s; }
.hiddeninput { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }

/* Calcul */
.calc { font-family: var(--display); font-weight: 800; font-size: clamp(40px, 9vw, 80px); line-height: 1; }
.dots { display: flex; gap: 6px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.dot.g { background: var(--green); } .dot.r { background: var(--coral); }
.numpad { display: grid; grid-template-columns: repeat(3, 70px); gap: 8px; }
.numpad button { padding: 14px 0; font-size: 22px; }

/* entracte / podium */
.rank { display: grid; gap: 8px; }
.rk { display: grid; grid-template-columns: 30px 34px 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 12px; background: var(--row); }
.rk .pos { font-family: var(--mono); color: var(--muted); font-weight: 700; }
.rk:first-child .pos { color: var(--coral); }
.rk .det { font-size: 13px; color: var(--muted); }
.gain { font-family: var(--mono); color: var(--green); font-weight: 700; white-space: nowrap; }
.quote { background: #fff0ec; border: 2px dashed var(--coral); border-radius: 16px; padding: 14px 16px; }
.quote .who { color: var(--coral); font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.quote .txt { font-weight: 800; font-size: 19px; }
.unlock { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: var(--surface); border: 2px solid var(--teal); }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 12px; margin: 20px 0; }
.pod { display: grid; justify-items: center; gap: 8px; }
.pod .blk { width: 90px; border-radius: 12px 12px 0 0; display: grid; place-items: center; font-family: var(--display); font-size: 30px; color: #13132a; box-shadow: inset 0 -8px 0 #0002; }
.crown { font-size: 34px; }

/* collection */
.coll { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.slot { aspect-ratio: 1; border-radius: 16px; background: #3a2014; display: grid; place-items: center; position: relative; border: 2px solid transparent; cursor: pointer; padding: 10px; }
.slot svg { width: 60%; height: 60%; }
.slot em { position: absolute; bottom: 6px; left: 4px; right: 4px; text-align: center; font-style: normal; font-size: 11px; color: var(--muted); font-weight: 700; line-height: 1.1; }
.r-commun { border-color: #7f86b3; } .r-rare { border-color: var(--teal); } .r-epique { border-color: var(--violet); }
.r-legendaire { border-color: var(--sun); box-shadow: 0 0 18px -4px var(--sun); }
.slot.lock { border-style: dashed; }
.slot.lock svg { filter: brightness(0) invert(.18); }
.rar-commun { color: #9a7b62 } .rar-rare { color: var(--teal) } .rar-epique { color: var(--violet) } .rar-legendaire { color: var(--sun) }

.modal { position: fixed; inset: 0; background: #3a201466; display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal .card { max-width: 820px; width: 100%; max-height: 90vh; overflow: auto; }

#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: min(92vw, 420px); }
.toast { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; font-weight: 700; box-shadow: 0 10px 30px #0008; animation: pop .3s; }
.toast.art { border: 2px solid var(--teal); }

@media (max-width: 560px) {
  .rk { grid-template-columns: 24px 30px 1fr; } .rk .gain { grid-column: 3; }
  .race { grid-template-columns: 80px 1fr 44px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* --- la Brigade : scènes 3D et Vestiaire --- */
.stagecard { position: relative; padding: 0; overflow: hidden; }
.lineup { width: 100%; height: clamp(200px, 32vw, 300px); }
.home .lineup { height: clamp(180px, 30vw, 280px); border-radius: 22px; overflow: hidden; margin-bottom: 14px; }
.podiumstage .lineup { height: clamp(240px, 38vw, 360px); }
.podnames { display: flex; justify-content: center; gap: clamp(20px, 8vw, 90px); padding: 8px 0 14px; font-family: var(--display); font-size: 18px; }
canvas.stage3d { display: block; width: 100% !important; height: 100% !important; }
.vest { max-width: 1040px !important; }
.vgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 12px; }
@media (max-width: 760px) { .vgrid { grid-template-columns: 1fr; } }
.vview { position: relative; aspect-ratio: 4 / 3.6; border-radius: 20px; overflow: hidden; background: #f3c99a; cursor: grab; touch-action: pan-y; }
.vview .nameplate { position: absolute; left: 12px; top: 10px; background: #ffffffe8; border-radius: 14px; padding: 6px 12px; display: grid; z-index: 1; }
.vview .nameplate b { font-family: var(--display); font-size: 22px; line-height: 1.1; }
.vview .nameplate span { font-size: 12.5px; color: var(--muted); }
.vview .hint { position: absolute; left: 12px; bottom: 10px; font-family: var(--mono); font-size: 11px; background: #ffffffcc; padding: 3px 9px; border-radius: 999px; pointer-events: none; }
.vpanel { display: grid; gap: 12px; align-content: start; }
.vgrp h3 { font-size: 18px; margin-bottom: 6px; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { font: 700 13.5px var(--body); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; padding: 7px 11px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.opt[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.opt:disabled { opacity: .55; cursor: not-allowed; }
.opt .lk { font-family: var(--mono); font-size: 10px; font-weight: 500; padding: 1px 6px; border-radius: 999px; background: var(--sun); color: #3a2014; }
img.av { background: var(--surface2); padding: 0; }
