:root {
  --bg: #0a0e17;
  --bg2: #111827;
  --panel: #141b2b;
  --panel2: #1b2438;
  --line: #2a3550;
  --text: #e6ebf5;
  --muted: #8b97b0;
  --accent: #f0b429;
  --accent2: #8b5cf6;
  --good: #34d399;
  --bad: #f87171;
  --me: #38bdf8;
  --opp: #fb7185;
  --cw: 84px;
  --ch: calc(var(--cw) * 1.4);
  --fury: #e0443e; --calm: #3fae5a; --mind: #3d8ee0; --body: #e8892f; --chaos: #9b59d0; --order: #e5c13a; --any: #cbd5e1;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: radial-gradient(1200px 600px at 50% -10%, #1a2340 0%, var(--bg) 60%); color: var(--text); font: 14px/1.4 Inter, system-ui, sans-serif; }
button { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: linear-gradient(180deg, #7c4dff, #5b34d6); border-color: #8b5cf6; font-weight: 700; }
button.warn { background: #3a2412; border-color: #b45309; }
button.big { width: 100%; padding: 12px; font-size: 16px; margin-top: 12px; }
input, select, textarea { font: inherit; color: var(--text); background: #0d1322; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }
textarea { width: 100%; min-height: 200px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.error { color: var(--bad); margin-top: 10px; white-space: pre-wrap; }
.row { display: flex; gap: 8px; margin-top: 8px; } .row input { flex: 1; }
[hidden] { display: none !important; }

/* Lobby */
.screen { min-height: 100%; }
#lobby { padding: 28px 32px; max-width: 1400px; margin: 0 auto; }
.lobby-head { display: flex; gap: 18px; align-items: center; margin-bottom: 22px; }
.logo { width: 64px; height: 64px; border-radius: 14px; background: linear-gradient(135deg, #f0b429, #b7791f); display: grid; place-items: center; font: 700 36px Rajdhani, sans-serif; color: #1a1205; box-shadow: 0 0 24px #f0b42955; }
.eyebrow { color: var(--me); letter-spacing: .2em; font-size: 11px; font-weight: 700; }
h1 { margin: 2px 0; font: 700 32px Rajdhani, sans-serif; }
h2 { margin: 0 0 12px; font: 700 18px Rajdhani, sans-serif; letter-spacing: .04em; }
.lobby-grid { display: grid; grid-template-columns: 340px 1fr 1fr; gap: 18px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.seg { display: flex; gap: 4px; background: #0d1322; padding: 4px; border-radius: 10px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: transparent; font-size: 12px; padding: 8px 4px; }
.seg button.on { background: var(--panel2); box-shadow: inset 0 0 0 1px var(--accent); }
.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; color: var(--muted); font-size: 12px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; margin: 8px 0; }
.deck-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 10px; }
.deck-item { display: flex; gap: 8px; align-items: center; padding: 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; }
.deck-item.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.deck-item img { width: 40px; height: 56px; object-fit: cover; border-radius: 4px; background: #000; }
.deck-item .dn { font-weight: 700; } .deck-item .dl { font-size: 11px; color: var(--muted); }
details summary { cursor: pointer; color: var(--muted); margin: 6px 0; }
.deck-check { font-size: 12px; margin-top: 6px; white-space: pre-wrap; }
.deck-check.ok { color: var(--good); } .deck-check.ko { color: var(--bad); }

/* Partie */
#game { display: flex; flex-direction: column; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 8px 14px; background: #0b1120cc; border-bottom: 1px solid var(--line); }
.turn-info { flex: 1; font-weight: 600; }
.turn-info .phase { color: var(--accent); }
.turn-info .who-me { color: var(--me); } .turn-info .who-opp { color: var(--opp); }
.scores { display: flex; gap: 10px; }
.score { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); font-weight: 700; }
.score .pips { display: flex; gap: 2px; } .score .pip { width: 8px; height: 14px; border-radius: 2px; background: #2a3550; } .score .pip.on { background: var(--accent); }
.score.me { border-color: var(--me); } .score.opp { border-color: var(--opp); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.speed { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; }
.table { flex: 1; display: grid; grid-template-columns: 1fr 340px; min-height: 0; }
.board { overflow: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.side { border-left: 1px solid var(--line); background: #0d1322; display: flex; flex-direction: column; min-height: 0; }

.prow { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; background: #0f1626aa; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.prow.me { border-color: #1e4b66; } .prow.opp { border-color: #5a2433; }
.prow.active { box-shadow: 0 0 0 1px var(--accent), 0 0 18px #f0b42922; }
.ident { display: flex; gap: 6px; }
.zone { position: relative; min-height: calc(var(--ch) + 6px); border-radius: 10px; border: 1px dashed #2a3550; padding: 3px; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.zone.drop { border-color: var(--good); background: #34d39911; cursor: pointer; }
.zone .zlabel { position: absolute; top: -9px; left: 8px; font-size: 10px; color: var(--muted); background: var(--bg2); padding: 0 4px; border-radius: 4px; letter-spacing: .08em; text-transform: uppercase; }
.piles { display: flex; gap: 6px; }
.pile { width: calc(var(--cw) * .8); height: calc(var(--ch) * .8); border-radius: 8px; border: 1px solid var(--line); background: repeating-linear-gradient(45deg, #1b2438, #1b2438 6px, #172036 6px, #172036 12px); display: grid; place-items: center; text-align: center; font-size: 11px; color: var(--muted); cursor: pointer; position: relative; overflow: hidden; }
.pile b { display: block; font-size: 18px; color: var(--text); }
.pile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .35; }
.pile span { position: relative; }
.runes { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.rune { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; cursor: pointer; border: 2px solid #0008; box-shadow: inset 0 0 0 2px #fff3; transition: transform .15s, opacity .15s; }
.rune.ex { opacity: .35; transform: rotate(90deg) scale(.9); }
.rune:hover { outline: 2px solid var(--accent); }
.pool { display: flex; gap: 6px; align-items: center; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #0d1322; border: 1px solid var(--line); }
.dom { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 10px; color: #111; font-weight: 800; }
.d-fury { background: var(--fury); } .d-calm { background: var(--calm); } .d-mind { background: var(--mind); } .d-body { background: var(--body); } .d-chaos { background: var(--chaos); } .d-order { background: var(--order); } .d-any { background: linear-gradient(135deg, var(--fury), var(--calm), var(--mind), var(--chaos)); }
.energy { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 50%; background: #e2e8f0; color: #111; font-size: 11px; font-weight: 800; padding: 0 4px; }
.subrow { display: flex; gap: 10px; align-items: center; margin-top: 6px; }

/* Champs de bataille */
.bfs { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; }
.bf { border-radius: 14px; border: 1px solid var(--line); background: linear-gradient(180deg, #2a0f1a33, #0b1120 45%, #0b1120 55%, #0f2a3a33); padding: 8px; display: grid; grid-template-rows: 1fr auto 1fr; gap: 6px; position: relative; }
.bf.ctl-me { box-shadow: inset 0 0 0 2px var(--me); } .bf.ctl-opp { box-shadow: inset 0 0 0 2px var(--opp); }
.bf.showdown { box-shadow: 0 0 0 2px var(--accent), 0 0 30px #f0b42944; }
.bf .mid { display: flex; align-items: center; gap: 10px; }
.bf .bfcard { width: calc(var(--cw) * 1.55); height: calc(var(--cw) * 1.1); border-radius: 8px; overflow: hidden; position: relative; border: 1px solid var(--line); cursor: pointer; flex-shrink: 0; background: #111; }
.bf .bfcard img { width: 100%; height: 100%; object-fit: cover; }
.bf .bfinfo { flex: 1; font-size: 12px; }
.bf .bfinfo .nm { font-weight: 700; font-size: 14px; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; margin-right: 4px; }
.b-me { background: #0c4a6e; color: #bae6fd; } .b-opp { background: #6b1d2e; color: #fecdd3; } .b-neutral { background: #334155; } .b-warn { background: #78350f; color: #fde68a; }
.facedowns { display: flex; gap: 4px; }
.might-sum { font-weight: 800; font-size: 13px; }

/* Cartes */
/* --ch recalculé sur chaque carte : une carte agrandie localement (--cw) garde ses proportions. */
.card, .stack { --ch: calc(var(--cw) * 1.4); }
.card { width: var(--cw); height: var(--ch); border-radius: 8px; position: relative; background: #151c2c; border: 1px solid #33405e; cursor: pointer; transition: transform .15s, box-shadow .15s, opacity .15s; flex-shrink: 0; user-select: none; }
.card img.art { width: 100%; height: 100%; object-fit: cover; border-radius: 7px; display: block; }
.card .fb { position: absolute; inset: 0; padding: 4px; font-size: 9px; overflow: hidden; display: flex; flex-direction: column; gap: 2px; border-radius: 7px; background: linear-gradient(180deg, #23304d, #121a2c); }
.card .fb .n { font-weight: 700; font-size: 10px; line-height: 1.1; }
.card .fb .t { color: var(--muted); font-size: 8px; line-height: 1.15; overflow: hidden; }
.card.has-img .fb { display: none; }
/* Carte traduite : illustration recadrée + nom et texte français (quand l'image n'existe qu'en anglais). */
.card.tr img.art { object-position: 50% 16%; }
.card.tr .trf { position: absolute; left: 0; right: 0; bottom: 0; top: 35%; border-radius: 0 0 7px 7px; padding: 3px 4px; background: linear-gradient(180deg, #0b1120cc, #0b1120f5 30%); display: flex; flex-direction: column; gap: 1px; overflow: hidden; pointer-events: none; }
.card.tr .tn { font-weight: 800; font-size: calc(var(--cw) * .105); line-height: 1.1; color: #f8fafc; }
.card.tr .tt { font-size: calc(var(--cw) * .078); line-height: 1.15; color: #cbd5e1; overflow: hidden; white-space: pre-line; }
.card.tr .tcost { position: absolute; right: 3px; top: -14px; display: flex; gap: 1px; transform: scale(.8); transform-origin: right; }
.card.mini.tr .tt, .opp-hand .card.tr .trf { display: none; }
.preview img.pv-art { height: 140px; object-fit: cover; object-position: 50% 6%; }
.card:hover { transform: translateY(-3px); box-shadow: 0 6px 18px #000a; z-index: 3; }
.card.ex { transform: rotate(12deg) scale(.94); opacity: .78; }
.card.ex:hover { transform: rotate(12deg) scale(.98); }
.card.sel { box-shadow: 0 0 0 3px var(--accent), 0 0 18px #f0b42988; }
.card.cand { box-shadow: 0 0 0 3px var(--good), 0 0 16px #34d39999; animation: pulse 1.2s infinite; }
.card.chosen { box-shadow: 0 0 0 3px #f472b6, 0 0 16px #f472b6aa; }
.card.playable { box-shadow: 0 0 0 2px #34d39988; }
.card.opp-own { border-color: #7f1d1d; } .card.me-own { border-color: #0e7490; }
/* Dos de carte officiel (public/card-back.svg) */
.card.back { background: #0d0d0f url(/card-back.svg) center / 100% 100% no-repeat; border-color: #5a4614; }
.card.mini { --cw: 60px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 3px var(--good), 0 0 4px #34d39955; } }
.card .mt { position: absolute; right: -6px; bottom: -6px; min-width: 26px; height: 26px; padding: 0 5px; border-radius: 13px; background: #0b1120; border: 2px solid #94a3b8; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.card .mt.up { border-color: var(--good); color: var(--good); } .card .mt.down { border-color: var(--bad); color: var(--bad); }
.card .dmg { position: absolute; left: -6px; bottom: -6px; min-width: 24px; height: 24px; border-radius: 12px; background: #b91c1c; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 12px; border: 2px solid #0b1120; z-index: 4; }
.card .dmg.lethal { background: #000; color: var(--bad); }
.card .tags { position: absolute; left: 2px; top: 2px; right: 2px; display: flex; flex-wrap: wrap; gap: 2px; }
.card .tag { font-size: 8px; font-weight: 800; padding: 1px 3px; border-radius: 3px; background: #000c; color: #fde68a; text-transform: uppercase; }
.card .tag.stun { background: #1d4ed8; color: #fff; } .card .tag.buff { background: #15803d; color: #fff; } .card .tag.att { background: #b91c1c; color: #fff; } .card .tag.def { background: #1e40af; color: #fff; }
.card .cost { position: absolute; left: -5px; top: -5px; width: 22px; height: 22px; border-radius: 50%; background: #e2e8f0; color: #111; font-weight: 800; font-size: 12px; display: grid; place-items: center; border: 2px solid #0b1120; }
.card .manual { position: absolute; right: 2px; top: 2px; font-size: 10px; }

.hand { position: sticky; bottom: -10px; z-index: 5; display: flex; gap: 6px; padding: 8px; border-radius: 12px; background: #0f1626f2; border: 1px solid var(--line); min-height: calc(var(--ch) + 20px); align-items: flex-end; flex-wrap: wrap; box-shadow: 0 -8px 24px #000a; }
.hand .card { --cw: 92px; }
.hand-label { font-size: 11px; color: var(--muted); }
.opp-hand { display: flex; gap: 3px; }
.opp-hand .card { --cw: 34px; }

/* Barre latérale */
.side section { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.side h3 { margin: 0 0 8px; font: 700 13px Rajdhani, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.side .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.side .actions button { flex: 1 1 auto; }
.chain-item { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border-radius: 8px; background: var(--panel2); border-left: 3px solid var(--line); margin-bottom: 6px; font-size: 12px; cursor: default; }
.chain-item.top { background: #1d2440; box-shadow: 0 0 0 1px var(--accent), 0 0 16px #f0b42933; animation: chainIn .25s ease-out; }
@keyframes chainIn { from { transform: translateX(14px); opacity: 0; } }
.chain-item .chain-card { width: 78px; height: 109px; flex-shrink: 0; cursor: zoom-in; }
.chain-item .chain-card.big { width: 132px; height: 185px; }
.chain-item .chain-card.tr .tn { font-size: 11px; }
.chain-item .chain-card.tr .tt { font-size: 8px; }
.chain-item .chain-card.big.tr .tn { font-size: 13px; }
.chain-item .chain-card.big.tr .tt { font-size: 9.5px; }
.chain-item .chain-card:hover { transform: none; }
.chain-info { flex: 1; min-width: 0; }
.chain-kind { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.chain-item.top .chain-kind { color: var(--accent); }
.chain-title { font-weight: 700; font-size: 13px; margin: 2px 0; }
.chain-ab { color: #cbd5e1; font-size: 11px; line-height: 1.3; }
.chain-tg { margin-top: 4px; font-size: 11px; color: #fda4af; }
.chain-item.me { border-left-color: var(--me); } .chain-item.opp { border-left-color: var(--opp); }
.chain-item.cand { box-shadow: 0 0 0 2px var(--good); cursor: pointer; }
.prompt { background: #1f1a0d; border: 1px solid #a16207; border-radius: 10px; padding: 10px; }
.prompt .title { font-weight: 700; margin-bottom: 6px; }
.prompt .text { font-style: italic; margin-bottom: 8px; color: #fde68a; }
.prompt .opts { display: flex; flex-wrap: wrap; gap: 6px; }
.dmg-targets { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.dmg-target { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.dmg-target.dead .card { outline: 2px solid #dc2626; }
.dmg-ctl { display: flex; align-items: center; gap: 6px; }
.dmg-ctl button { min-width: 28px; padding: 2px 6px; }
.dmg-ctl b { min-width: 16px; text-align: center; color: #fca5a5; }
.dmg-need { font-size: 11px; opacity: .8; }
.dmg-err { color: #fca5a5; font-size: 12.5px; }
.logbox { flex: 1; overflow: auto; font-size: 12px; padding: 8px 12px; }
.logbox div { padding: 2px 0; border-bottom: 1px solid #1a2236; }
.logbox .l-me { color: #bae6fd; } .logbox .l-opp { color: #fecdd3; } .logbox .l-sys { color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); }
.opt-line { display: flex; gap: 6px; align-items: center; margin: 4px 0; font-size: 12px; }
.waiting { color: var(--accent); font-weight: 600; }

/* Aperçu, menus, modales */
.preview { position: fixed; z-index: 78; width: 300px; pointer-events: none; background: #0b1120f2; border: 1px solid var(--line); border-radius: 14px; padding: 10px; box-shadow: 0 10px 40px #000c; }
.preview img { width: 100%; border-radius: 10px; display: block; margin-bottom: 8px; }
.preview .pn { font-weight: 700; font-size: 15px; }
.preview .pt { white-space: pre-wrap; font-size: 12px; color: #cbd5e1; margin-top: 6px; }
.preview .pm { font-size: 11px; color: var(--muted); margin-top: 6px; }
.ctx { position: fixed; z-index: 79; background: #0f172a; border: 1px solid var(--line); border-radius: 10px; padding: 6px; min-width: 200px; box-shadow: 0 10px 30px #000c; }
.ctx .h { font-size: 11px; color: var(--muted); padding: 4px 8px; text-transform: uppercase; letter-spacing: .06em; }
.ctx button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 6px 10px; border-radius: 6px; font-size: 13px; }
.ctx button:hover { background: var(--panel2); }
.ctx .sep { height: 1px; background: var(--line); margin: 4px 0; }
.lobby-sound { margin-left: auto; font-size: 20px; }
.sound-panel { width: 280px; padding: 10px; }
.snd-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; margin: 6px 0; }
.snd-row input[type=range] { width: 150px; accent-color: var(--accent); }
.snd-row.check { justify-content: flex-start; color: var(--muted); font-size: 12px; }
.snd-now { font-size: 12px; color: var(--accent); margin: 8px 0; }
.sound-panel .actions { display: flex; gap: 6px; }
.sound-panel .actions button { flex: 1; font-size: 12px; }
.modal { position: fixed; inset: 0; z-index: 70; background: #000a; display: grid; place-items: center; }
.modal .box { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; max-width: min(1000px, 94vw); max-height: 88vh; overflow: auto; }
.modal .cards { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.modal .cards .card { --cw: 120px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #7f1d1d; border: 1px solid #f87171; padding: 10px 16px; border-radius: 10px; z-index: 80; font-weight: 600; }
.toast.info { background: #0c4a6e; border-color: #38bdf8; }
.banner { padding: 8px 12px; border-radius: 10px; background: #2a1f05; border: 1px solid #a16207; font-weight: 600; text-align: center; }
.gameover { font: 700 28px Rajdhani; text-align: center; }

@media (max-height: 1100px) { :root { --cw: 72px; } .hand .card { --cw: 80px; } .bf .mid { gap: 6px; } .bf .bfcard { height: calc(var(--cw) * .95); } }
@media (max-height: 820px) { :root { --cw: 60px; } .hand .card { --cw: 68px; } }
@media (max-width: 1300px) { :root { --cw: 70px; } .lobby-grid { grid-template-columns: 1fr; } .table { grid-template-columns: 1fr 290px; } }
@media (max-width: 900px) { :root { --cw: 54px; } .table { grid-template-columns: 1fr; } .side { max-height: 45vh; } .bfs { grid-template-columns: 1fr; } }

/* Mise en place : choix du champ de bataille, premier joueur */
.bf-choices { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin: 16px 0 4px; }
.bf-choice { display: flex; flex-direction: column; align-items: center; gap: 8px; background: transparent; border: 2px solid var(--line); border-radius: 14px; padding: 10px; cursor: pointer; color: inherit; font: inherit; transition: transform .15s, border-color .15s; }
.bf-choice:hover { transform: translateY(-4px); border-color: var(--accent, #c8aa6e); }
.bf-choice small { max-width: var(--bw); font-size: 12px; line-height: 1.35; opacity: .85; text-align: center; }
/* Champs de bataille : images en paysage, cadre en paysage. */
.bf-choices { --bw: max(200px, min(280px, 26vw)); }
.bf-choice .card { width: var(--bw); height: calc(var(--bw) / 1.4); pointer-events: none; }
.first-info { margin: 6px 0 10px; padding: 8px 12px; border-radius: 10px; background: #ffffff10; }
.first-info .die { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 4px; border-radius: 7px; background: #f4ecd8; color: #222; font-weight: 700; margin: 0 2px; box-shadow: inset 0 -2px 0 #0003; }

/* Capacités activables et effets optionnels */
.card.activatable { box-shadow: 0 0 0 2px #a855f7, 0 0 14px #a855f799; cursor: pointer; }
.ability-btn { text-align: left; white-space: normal; line-height: 1.35; }
.ability-text { font-size: 12px; opacity: .85; margin: 4px 0 6px; }
.prompt.confirm { border-color: #c8aa6e; background: #2a2210; }
.prompt.confirm .text { font-size: 12.5px; margin: 6px 0; opacity: .9; }
.prompt.confirm .opts button:first-child { background: #c8aa6e; color: #1a1408; font-weight: 600; }

/* Équipements attachés : sous l'unité, décalés vers le bas (on lit leur texte) ; au survol ils passent devant. */
/* Équipements derrière leur unité, décalés vers la droite : seule une bande de 15 % de chaque carte dépasse. */
.stack { position: relative; flex-shrink: 0; isolation: isolate; width: calc(var(--cw) * (1 + .15 * var(--n))); }
.stack > .card { position: relative; z-index: 3; }
.stack .equip-slot { position: absolute; top: 0; left: calc(var(--cw) * .15 * var(--i)); z-index: calc(3 - var(--i)); }
.stack .equip-slot:hover { z-index: 6; }
.stack .equip-slot .card { box-shadow: 4px 0 10px #0008; }
.stack .equip-slot .card::after { content: '⚙'; position: absolute; right: 2px; bottom: 3px; font-size: 10px; background: #000c; border-radius: 3px; padding: 0 3px; }

/* Salons en ligne */
.online-box { margin: 10px 0; padding: 10px; border: 1px solid var(--accent); border-radius: 10px; }
.online-box #createRoomBtn { flex: 1; }
.room-box { margin: 10px 0; padding: 12px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--accent); }
.room-code { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 6px; }
.room-code b { font-family: Rajdhani, sans-serif; font-size: 34px; letter-spacing: 6px; }
.room-box .actions { margin-top: 8px; }

/* Mulligan : cartes en grand pour lire leur texte en entier (taille limitée par la largeur et la hauteur de l'écran). */
.modal .mull-box { max-width: 96vw; }
.modal .mull-cards { justify-content: center; gap: 14px; }
.modal .mull-cards .card { --cw: max(110px, min(240px, 19vw, calc((88vh - 260px) / 1.4))); }
.modal .mull-cards .card.chosen { transform: translateY(-6px); }

/* ===== Mobile (téléphone tenu à l'horizontale) : actif seulement avec html.mobile ===== */
.m-only, .drawer, .sheet, .rotate, .mhand, .bchip, .msum, .xn { display: none; }
.lp { position: fixed; inset: 0; z-index: 85; background: #000d; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 10px; }
.lp[hidden] { display: none; }
.lp-img img { height: 86dvh; max-width: 52vw; object-fit: contain; border-radius: 12px; display: block; }
.lp-img.land img { height: auto; width: min(58vw, 112dvh); max-width: none; }
.lp-txt { max-width: 36vw; font-size: 12px; line-height: 1.4; }
.lp-txt b { display: block; font-size: 15px; margin-bottom: 4px; }
.lp-txt .pt { white-space: pre-wrap; color: #cbd5e1; margin: 6px 0; }
.lp-txt .pm { color: var(--muted); font-size: 11px; }

html.mobile { --cw: clamp(28px, min(5vw, 9dvh), 48px); }
html.mobile .m-only { display: inline-flex; align-items: center; justify-content: center; }
html.mobile .d-only, html.mobile .lbl, html.mobile .score .pips, html.mobile .hand-label, html.mobile .zone .zlabel { display: none; }
html.mobile #game { height: 100dvh; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left); }
html.mobile #game img { -webkit-user-drag: none; }
html.mobile .card:hover { transform: none; box-shadow: none; }
html.mobile .card.ex:hover { transform: rotate(12deg) scale(.94); }

/* Barre du haut : une ligne fine */
html.mobile .topbar { gap: 5px; padding: 2px 4px; font-size: 11px; }
html.mobile .topbar button { padding: 0 8px; min-height: 32px; min-width: 36px; }
html.mobile .turn-info { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-weight: 600; }
html.mobile .scores { gap: 4px; }
html.mobile .score { padding: 1px 7px; font-size: 11px; gap: 4px; }
html.mobile .top-actions { gap: 4px; }

/* Plateau à gauche, colonne d'action à droite */
html.mobile .table { grid-template-columns: minmax(0, 1fr) min(25vw, 220px); }
html.mobile .board { padding: 3px; gap: 3px; overflow: hidden; }
html.mobile .banner { padding: 2px 6px; font-size: 11px; }

/* Ligne d'un joueur */
html.mobile .prow.m { display: flex; align-items: center; gap: 5px; padding: 3px 5px; border-radius: 10px; height: calc(var(--cw) * 1.4 + 10px); flex-shrink: 0; min-width: 0; }
html.mobile .prow.m .ident { gap: 3px; flex-shrink: 0; }
html.mobile .mpts { font: 700 18px Rajdhani, sans-serif; min-width: 18px; text-align: center; flex-shrink: 0; }
html.mobile .prow.me .mpts { color: var(--me); }
html.mobile .prow.opp .mpts { color: var(--opp); }
html.mobile .runes { flex-wrap: wrap; gap: 2px; max-width: 128px; flex-shrink: 0; }
html.mobile .rune { width: 20px; height: 20px; font-size: 9px; border-width: 1px; box-shadow: none; }
html.mobile .pool { padding: 1px 5px; font-size: 11px; gap: 3px; flex-shrink: 0; }
html.mobile .pool .energy { min-width: 16px; height: 16px; font-size: 10px; }
html.mobile .pool .dom { width: 14px; height: 14px; font-size: 8px; }
html.mobile .mhand { display: inline-block; flex-shrink: 0; padding: 1px 6px; border-radius: 8px; background: #2b1d4d; border: 1px solid #4c3a80; font-size: 11px; }
html.mobile .bchip { display: inline-flex; align-items: center; flex-shrink: 0; min-height: 34px; padding: 0 7px; font-size: 11px; border-radius: 9px; }
/* Base : bande qui prend la place libre et défile au doigt */
html.mobile .zone.bstrip { flex: 1; min-width: 0; min-height: 0; height: 100%; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; border: 0; padding: 2px 6px 2px 2px; gap: 4px; align-items: center; scrollbar-width: none; }
html.mobile .zone.bstrip::-webkit-scrollbar { display: none; }
html.mobile .zone.bstrip.drop { outline: 2px dashed var(--good); }
html.mobile .xn { display: block; position: absolute; left: -4px; top: -4px; padding: 0 4px; border-radius: 7px; background: var(--accent); color: #111; font-size: 9px; font-weight: 800; z-index: 2; }
html.mobile .piles { gap: 3px; flex-shrink: 0; }
html.mobile .pile { width: 26px; height: 36px; border-radius: 5px; }
html.mobile .pile b { font-size: 11px; }

/* Champs de bataille */
html.mobile .bfs { flex: 1; min-height: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-columns: none; gap: 3px; }
html.mobile .bf { padding: 2px; gap: 1px; grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr); border-radius: 10px; min-height: 0; min-width: 0; }
html.mobile .bf .zone { min-height: 0; border: 0; padding: 3px 2px; justify-content: center; align-items: center; flex-wrap: nowrap; overflow-x: auto; gap: 4px; scrollbar-width: none; }
html.mobile .bf .zone.drop { outline: 2px dashed var(--good); }
html.mobile .bf .mid { gap: 4px; min-width: 0; }
html.mobile .bf .bfcard { width: calc(var(--cw) * 1.15); height: calc(var(--cw) * .82); border-radius: 4px; }
html.mobile .bf .bfinfo { font-size: 10px; min-width: 0; display: flex; align-items: center; gap: 6px; }
html.mobile .bf .bfinfo .nm { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
html.mobile .bf .bfinfo > div:not(.nm):not(.msum) { display: none; }
html.mobile .msum { display: block; white-space: nowrap; font-size: 11px; font-weight: 700; }
html.mobile .msum .me { color: var(--me); }
html.mobile .msum .opp { color: var(--opp); }
html.mobile .facedowns .card { --cw: 20px; }

/* Cartes plus compactes */
html.mobile .card { border-radius: 5px; }
html.mobile .card .tags { display: none; }
html.mobile .card .mt { right: -4px; bottom: -4px; min-width: 17px; height: 17px; border-radius: 9px; font-size: 10px; padding: 0 3px; border-width: 1px; }
html.mobile .card .dmg { left: -4px; bottom: -4px; min-width: 16px; height: 16px; font-size: 9px; border-width: 1px; }
html.mobile .card .manual { display: none; }
html.mobile .card.sel { box-shadow: 0 0 0 2px var(--accent), 0 0 10px #f0b42988; }

/* Main en éventail */
html.mobile .hand { position: static; flex-shrink: 0; min-height: 0; padding: 0 4px; border: 0; background: none; box-shadow: none; flex-wrap: nowrap; justify-content: center; gap: 0; }
html.mobile .hand .card { --cw: clamp(44px, min(7vw, 19dvh), 70px); margin: 0 -5px; transition: transform .15s; }
html.mobile .hand .card.sel { transform: translateY(-28%) scale(1.12); z-index: 6; }

/* Colonne de droite : invite en haut, gros bouton d'action en bas */
html.mobile .side { overflow-y: auto; font-size: 11px; max-height: none; }
html.mobile .side section { padding: 5px 6px; }
html.mobile .side h3 { font-size: 11px; margin-bottom: 4px; }
html.mobile .side .m-main:empty { display: none; }
html.mobile .side .m-status { margin-top: auto; position: sticky; bottom: 0; background: #0d1322; border-bottom: 0; border-top: 1px solid var(--line); }
html.mobile #passBtn, html.mobile #endBtn { min-height: 48px; font-size: 14px; font-weight: 700; }
html.mobile .side button { min-height: 34px; }
html.mobile .prompt { padding: 6px; }
html.mobile .gameover { font-size: 18px; }
html.mobile .chain-item { font-size: 10px; padding: 4px; gap: 5px; }
html.mobile .chain-item .chain-card, html.mobile .chain-item .chain-card.big { width: 40px; height: 56px; }
html.mobile .chain-ab { font-size: 10px; }

/* Tiroir (journal, chaîne, outils) et feuille de la base */
html.mobile .drawer { display: flex; flex-direction: column; position: fixed; top: 0; right: 0; bottom: 0; width: min(50vw, 380px); background: #0f1626f7; border-left: 1px solid var(--line); z-index: 65; transform: translateX(105%); transition: transform .2s; overflow-y: auto; }
html.mobile .drawer.open { transform: none; }
html.mobile .drawer section { padding: 6px 8px; border-bottom: 1px solid var(--line); }
html.mobile .drawer .logbox { font-size: 11px; }
html.mobile .drawer h3 { margin: 0 0 4px; font: 700 11px Rajdhani, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
html.mobile .dh { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
html.mobile .dh b { flex: 1; }
html.mobile .dh button { min-height: 34px; }
html.mobile .sheet { display: flex; flex-direction: column; position: fixed; left: 0; right: min(25vw, 220px); bottom: 0; height: 62dvh; background: #0f1626f7; border-top: 1px solid var(--me); border-radius: 14px 14px 0 0; z-index: 64; transform: translateY(105%); transition: transform .2s; }
html.mobile .sheet.open { transform: none; }
html.mobile .sheet .dh .hint { font-size: 10px; }
html.mobile .sheet .zone.sheet-zone { flex: 1; overflow-y: auto; border: 0; padding: 10px; gap: 10px; align-content: flex-start; --cw: clamp(50px, 8vw, 80px); }

/* Fenêtres : mulligan, choix du champ de bataille */
html.mobile .modal .box { padding: 10px 12px; max-height: 96dvh; max-width: 96vw; }
html.mobile .modal h2 { font-size: 15px; margin: 0 0 4px; }
html.mobile .modal .cards { margin: 6px 0; gap: 8px; }
html.mobile .modal .mull-cards .card { --cw: min(15vw, calc((92dvh - 130px) / 1.4)); }
html.mobile .bf-choices { --bw: min(27vw, calc((92dvh - 170px) * 1.4)); margin: 6px 0; gap: 8px; }
html.mobile .bf-choice { padding: 6px; gap: 4px; }
html.mobile .bf-choice small { font-size: 10px; }
html.mobile .first-info { font-size: 12px; }
html.mobile .ctx button { min-height: 40px; font-size: 14px; }
html.mobile .toast { bottom: 8px; font-size: 12px; padding: 6px 12px; }

/* Téléphone tenu verticalement pendant une partie : demander de le tourner */
@media (orientation: portrait) {
  html.mobile #game:not([hidden]) .rotate { display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 95; background: var(--bg); align-items: center; justify-content: center; text-align: center; font-size: 18px; line-height: 1.6; padding: 20px; }
}

/* Lobby : options avancées repliées */
.adv { margin: 8px 0; }
.adv summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.adv[open] summary { margin-bottom: 6px; }

/* Match en 3 manches : score et écran entre les manches */
.mscore { padding: 1px 8px; border-radius: 999px; background: #2a1f05; border: 1px solid #a16207; color: #fde68a; font-size: 12px; margin-right: 6px; white-space: nowrap; }
.match-box { width: min(900px, 96vw); }
.match-box h3 { margin: 12px 0 6px; font: 700 13px Rajdhani, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.mx-bfs, .mx-champs { display: flex; flex-wrap: wrap; gap: 8px; }
.mx-bf { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 5px; border-radius: 10px; }
.mx-bf img { width: 150px; aspect-ratio: 1.4; object-fit: cover; border-radius: 6px; display: block; }
.mx-bf span { font-size: 12px; }
.mx-bf.on, .mx-champ.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.mx-champ { padding: 4px; border-radius: 10px; background: transparent; }
.mx-champ .mx-card { --cw: 90px; pointer-events: none; }
.mx-swap { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mx-list { display: flex; flex-direction: column; gap: 3px; max-height: 34vh; overflow-y: auto; padding-right: 4px; }
.mx-row { text-align: left; padding: 4px 8px; font-size: 12px; }
.mx-row.changed { border-color: var(--accent); color: #fde68a; }
.hint.bad { color: var(--bad); }
html.mobile .mx-bf img { width: 110px; }
html.mobile .mx-champ .mx-card { --cw: 60px; }
html.mobile .mx-list { max-height: 40dvh; }
html.mobile .mscore { font-size: 10px; padding: 0 5px; }

/* Comptes, decks personnels, statistiques */
.account-box { margin-left: auto; }
.account-box + .lobby-sound { margin-left: 8px; }
.my-decks { margin-bottom: 8px; }
.my-head { font-size: 12px; font-weight: 700; color: var(--accent); margin: 2px 0 6px; }
.deck-item.mine { position: relative; border-color: #a1620755; }
.mine-act { margin-left: auto; display: flex; gap: 4px; }
.mine-act button { padding: 2px 6px; font-size: 12px; }
.acc-box { width: min(440px, 94vw); }
.acc-box .seg { margin-bottom: 10px; }
.acc-menu { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.acc-menu button { text-align: left; }
button.danger { border-color: #7f1d1d; color: #fecaca; }
.rec-code { font: 700 28px Rajdhani, monospace; letter-spacing: 4px; text-align: center; padding: 10px; border: 1px dashed var(--accent); border-radius: 10px; margin: 8px 0; user-select: all; }
.stats-box { width: min(640px, 96vw); }
.stats-box h3 { margin: 12px 0 4px; font: 700 13px Rajdhani, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat-tiles { display: flex; gap: 8px; }
.stat-tiles div { flex: 1; text-align: center; padding: 8px; border-radius: 10px; background: var(--panel2); font-size: 12px; color: var(--muted); }
.stat-tiles b { display: block; font-size: 20px; color: var(--text); }
table.stats { width: 100%; border-collapse: collapse; font-size: 12px; }
table.stats td, table.stats th { padding: 3px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.stats .win { color: var(--good); } table.stats .loss { color: var(--bad); }

/* Lobby : titres des catégories de decks */
.deck-cat { grid-column: 1 / -1; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 8px 0 2px; }
.deck-cat:first-child { margin-top: 0; }

/* ===== Lobby : onglets Play / Decks ===== */
.lobby-tabs { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--line); }
.lobby-tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 18px; font: 700 16px Rajdhani, sans-serif; letter-spacing: .04em; color: var(--muted); }
.lobby-tabs button.on { color: var(--text); border-bottom-color: var(--accent); }

/* ===== Onglet Decks ===== */
.decks-tab { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; align-items: start; }
.decks-tab[hidden] { display: none; }
.dk-pick { display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 220px); overflow-y: auto; position: sticky; top: 10px; }
.dk-pick .deck-item { padding: 5px 8px; }
.dk-paste textarea { width: 100%; min-height: 140px; }
.dk-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.dk-head img { width: 54px; height: 54px; object-fit: cover; object-position: 50% 18%; border-radius: 10px; }
.dk-head h2 { margin: 0; }
.dk-view { margin-left: auto; width: auto; }
.dk-view button { padding: 6px 16px; }
.dk-acts { display: flex; gap: 6px; }

/* Vue liste */
.dv-list { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
.dv-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 18px; }
.dv-sec { margin-bottom: 14px; }
.dv-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; font: 700 12px Inter, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 4px 0 6px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.dv-row { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 3px 4px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: default; }
.dv-row:hover { background: var(--panel2); }
.dv-row img { width: 44px; height: 30px; object-fit: cover; object-position: 50% 22%; border-radius: 5px; flex-shrink: 0; }
.dv-n { color: var(--me); font-size: 13px; min-width: 22px; }
.dv-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dv-e { display: inline-grid; place-items: center; min-width: 18px; height: 18px; border-radius: 50%; background: #e2e8f0; color: #111; font-size: 11px; font-weight: 800; padding: 0 3px; flex-shrink: 0; }
.dv-row .dom { width: 16px; height: 16px; font-size: 9px; flex-shrink: 0; }
.dv-m { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* Vue stats */
.dv-tiles { display: flex; gap: 26px; flex-wrap: wrap; margin-bottom: 14px; }
.dv-tiles div { font-size: 12px; color: var(--muted); }
.dv-tiles b { display: block; font-size: 26px; color: var(--text); }
.dv-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px 26px; }
.dv-leg { font-size: 11px; text-transform: none; letter-spacing: 0; font-weight: 600; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.dv-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 0 2px 0 6px; vertical-align: middle; }
.dv-dot.unit { background: #38bdf8; } .dv-dot.spell { background: #a855f7; } .dv-dot.gear { background: #eab308; } .dv-dot.champ { background: none; border: 1px dashed #94a3b8; }
.dv-curve { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 18px; }
.dv-bar { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; background: none; border: 0; padding: 0; border-radius: 6px; }
.dv-bar:disabled { opacity: .5; cursor: default; }
.dv-bar.on { background: #ffffff0d; }
.dv-bn { font-size: 12px; font-weight: 700; min-height: 15px; }
.dv-stack { width: 70%; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.dv-seg { width: 100%; }
.dv-seg:first-child { border-radius: 4px 4px 0 0; }
.dv-seg.unit { background: #0e7490; } .dv-seg.spell { background: #7e22ce; } .dv-seg.gear { background: #ca8a04; }
.dv-bar.on .dv-seg.unit, .dv-bar:hover .dv-seg.unit { background: #38bdf8; }
.dv-bar.on .dv-seg.spell, .dv-bar:hover .dv-seg.spell { background: #a855f7; }
.dv-bar.on .dv-seg.gear, .dv-bar:hover .dv-seg.gear { background: #eab308; }
.dv-champ { position: absolute; bottom: 0; left: -4px; right: -4px; height: 12px; border: 1px dashed #94a3b8; border-radius: 4px; }
.dv-cost { font-size: 11px; font-weight: 700; background: var(--panel2); border-radius: 4px; padding: 1px 6px; }
.dv-bar.on .dv-cost { background: var(--text); color: var(--bg); }
.dv-detail { margin-top: 10px; font-size: 13px; }
.dv-dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; margin-top: 6px; }
.dv-dgrid > div { display: flex; align-items: center; gap: 4px; }
.dv-dgrid .dom { width: 15px; height: 15px; font-size: 8px; }
.dv-prow { display: grid; grid-template-columns: 80px 1fr; align-items: center; gap: 8px; margin: 6px 0; font-size: 12px; color: var(--muted); }
.dv-pbars { display: flex; gap: 3px; }
.dv-pbar { height: 22px; border-radius: 5px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #111; min-width: 32px; }
.dv-pbar.multi { background: repeating-linear-gradient(135deg, #3fae5a, #3fae5a 6px, #9b59d0 6px, #9b59d0 12px); color: #fff; }
.dv-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.dv-table th { text-align: right; color: var(--muted); font-weight: 600; font-size: 11px; padding: 4px 6px; }
.dv-table td { padding: 5px 6px; border-top: 1px solid var(--line); text-align: right; }
.dv-table td:first-child, .dv-table th:first-child { text-align: left; }
.dv-table .dom { width: 16px; height: 16px; font-size: 9px; }
.dv-pc { font-size: 12px; color: var(--muted); margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.dv-might { display: flex; align-items: flex-end; gap: 8px; height: 140px; padding-top: 18px; }
.dv-mbar { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; }
.dv-mbar div { width: 80%; background: #38bdf8; border-radius: 4px 4px 0 0; }
.dv-mbar span { font-size: 12px; font-weight: 700; min-height: 15px; }
.dv-mbar em { font-style: normal; font-size: 11px; color: var(--muted); }
.dv-kws { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.dv-kws b { color: var(--muted); font-weight: 600; margin-left: 2px; }

@media (max-width: 1000px) {
  .decks-tab { grid-template-columns: 1fr; }
  .dk-pick { position: static; max-height: 260px; }
  .dv-list, .dv-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .dv-pair { grid-template-columns: 1fr; }
  .dk-view { margin-left: 0; }
}

/* Analyse de deck : barres de puissance et mots-clés cliquables */
.dv-mbar { background: none; border: 0; padding: 0; border-radius: 6px; }
.dv-mbar:disabled { cursor: default; }
.dv-mbar div { background: #0e7490; }
.dv-mbar:not(:disabled):hover div, .dv-mbar.on div { background: #38bdf8; }
.dv-mbar.on { background: #ffffff0d; }
.dv-kw { padding: 3px 9px; border-radius: 999px; font-size: 13px; background: var(--panel2); }
.dv-kw.on { border-color: var(--accent); color: #fde68a; }

/* Analyse de deck : score de fit */
.dv-fit { margin-left: auto; flex-shrink: 0; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap; cursor: help; border: 1px solid transparent; }
.dv-fit b { font-weight: 800; margin-left: 2px; }
.dv-fit.motor { background: #78350f; color: #fde68a; border-color: #a16207; }
.dv-fit.syn { background: #14532d; color: #bbf7d0; border-color: #15803d; }
.dv-fit.safe { background: #1e3a5f; color: #bae6fd; border-color: #0369a1; }
.dv-fit.tech { background: #3b2a55; color: #e9d5ff; border-color: #7e22ce; }
.dv-fit.off { background: #3f1d1d; color: #fecaca; border-color: #b91c1c; }
.dv-fit.neutral { background: var(--panel2); color: var(--muted); border-color: var(--line); }
.dv-fithead { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: #0f1626; border: 1px solid var(--line); font-size: 13px; }
.dv-theme span:not(.muted) { display: inline-block; margin: 0 4px 2px 0; padding: 1px 8px; border-radius: 999px; background: var(--panel2); font-size: 12px; }
.dv-legendfit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.dv-legendfit .dv-fit { margin-left: 0; cursor: default; }
.dv-sugg span { display: inline-block; margin: 2px 6px 0 0; padding: 1px 8px; border-radius: 6px; background: var(--panel2); font-size: 12px; }
.dv-sugg i { color: var(--accent); font-style: normal; }
.dv-fit i { font-style: normal; }
@media (max-width: 1100px) { .dv-row .dv-fit i { display: none; } }

/* Analyse de deck : plan des 3 premiers tours */
.op h3 { margin: 18px 0 8px; font-size: 15px; }
.op h3 .muted { font-weight: 500; font-size: 12px; margin-left: 6px; }
.op-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 12px; }
.op-top .seg button { padding: 5px 12px; }
.op-line { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.op-turn { background: #0f1626; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.op-turn .dv-h span { text-transform: none; letter-spacing: 0; font-weight: 600; }
.op-foot { font-size: 12px; color: var(--muted); margin-top: 6px; }
.op-react { font-size: 12px; margin-top: 4px; color: #bae6fd; }
.op-none { padding: 6px 4px; font-size: 13px; }
.op-hide { font-size: 11px; font-weight: 700; color: #c4b5fd; text-transform: uppercase; }
.op-emp { font-size: 11px; font-weight: 700; color: #fcd34d; text-transform: uppercase; }
.op-alts { margin-top: 10px; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.op-freq { display: grid; grid-template-columns: minmax(0, 1fr) 70px 38px; gap: 8px; align-items: center; font-size: 13px; padding: 3px 0; }
.op-freq span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-freq b { text-align: right; font-size: 12px; }
.op-bar { height: 6px; border-radius: 3px; background: var(--panel2); overflow: hidden; }
.op-bar i { display: block; height: 100%; background: var(--accent); }
.op-note { font-size: 12px; margin-top: 14px; line-height: 1.5; }
@media (max-width: 760px) { .op-line { grid-template-columns: minmax(0, 1fr); } }

/* Analyse de deck : tirage d'une main (vue Draw) */
.dr h3 { margin: 18px 0 8px; font-size: 15px; }
.dr h3 .muted { font-weight: 500; font-size: 12px; margin-left: 6px; }
.dr-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.dr-card { position: relative; width: 150px; flex-shrink: 0; }
.dr-card img { width: 100%; aspect-ratio: 744 / 1039; object-fit: cover; border-radius: 9px; display: block; box-shadow: 0 4px 14px #0008; }
.dr-card .dv-fit { position: absolute; left: 6px; bottom: 6px; margin: 0; }
.dr-card.pick { cursor: pointer; transition: transform .12s, opacity .12s; }
.dr-card.pick:hover { transform: translateY(-4px); }
.dr-card.out img { opacity: .35; filter: grayscale(.7); }
.dr-tag { position: absolute; top: 6px; left: 6px; right: 6px; text-align: center; font-size: 11px; font-weight: 800; padding: 3px 4px; border-radius: 6px; }
.dr-tag.out { background: #b91c1c; color: #fff; }
.dr-tag.adv { background: #78350fdd; color: #fde68a; border: 1px solid #a16207; }
.dr-tag.new { background: #14532ddd; color: #bbf7d0; border: 1px solid #15803d; }
.dr-champ { margin-left: 18px; padding-left: 18px; border-left: 1px dashed var(--line); }
.dr-champ .dr-card { width: 120px; }
.dr-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.dr-turns { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.dr-turn { background: #0f1626; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.dr-turn .dv-h span { text-transform: none; letter-spacing: 0; font-weight: 600; }
.dr-turn .dr-card { width: 100%; max-width: 150px; margin: 4px auto 8px; }
.dr-plays { font-size: 13px; }
@media (max-width: 760px) { .dr-card { width: calc(50% - 6px); } .dr-champ { margin-left: 0; padding-left: 0; border-left: 0; width: 100%; } .dr-champ .dr-card { width: calc(50% - 6px); } }
.dr-why { margin-top: 12px; padding: 8px 12px; border-radius: 8px; background: #0f1626; border: 1px solid var(--line); font-size: 13px; }
.dr-why.warn { border-color: #a16207; background: #2a1d0a; }

/* Éditeur de deck (onglet Decks) : catalogue à gauche, deck en cours à droite */
#dkNew { width: 100%; margin-bottom: 6px; }
.decks-tab.editing { display: block; }
.decks-tab.editing > .dk-pick, .decks-tab.editing > .dk-main { display: none; }
.dk-edit[hidden] { display: none; }
.de-wrap { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(340px, 1fr); gap: 14px; align-items: start; }
.de-browser { min-width: 0; }
.de-tabs { flex-wrap: wrap; }
.de-tabs button { flex: 1 1 auto; white-space: nowrap; padding: 8px 10px; }
.de-tc { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: #0d1322; color: var(--muted); font-size: 11px; }
.de-tc.ok { color: var(--good); }
.de-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.de-filters input[type=search] { flex: 1 1 220px; min-width: 0; }
.de-filters select { width: auto; }
.de-doms, .de-costs { display: flex; gap: 3px; }
.de-dom { padding: 3px; border-radius: 50%; opacity: .45; background: transparent; border-color: transparent; }
.de-dom.on { opacity: 1; border-color: var(--accent); }
.de-dom .dom { width: 22px; height: 22px; font-size: 11px; }
.de-costs button { min-width: 30px; padding: 3px 6px; font-size: 12px; font-weight: 700; }
.de-costs button.on { border-color: var(--accent); color: var(--accent); }
.de-types { margin: 0; flex: 1 1 230px; }
.de-count { font-size: 12px; margin-bottom: 6px; }
.de-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; max-height: calc(100vh - 280px); min-height: 300px; overflow-y: auto; padding: 2px; }
.de-card { position: relative; padding: 0; border: 2px solid transparent; border-radius: 9px; background: none; aspect-ratio: 744 / 1039; overflow: hidden; }
.de-card img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 7px; }
.de-card:hover { border-color: var(--line); transform: translateY(-1px); }
.de-card.in { border-color: var(--accent); }
.de-card.no img { filter: grayscale(.8) brightness(.55); }
.de-n { position: absolute; top: 6px; right: 6px; min-width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #111; font-weight: 800; box-shadow: 0 2px 6px #0008; }
.de-manual { position: absolute; bottom: 6px; left: 6px; font-style: normal; font-size: 12px; background: #000a; border-radius: 6px; padding: 1px 4px; }
.de-work { position: sticky; top: 10px; max-height: calc(100vh - 20px); overflow-y: auto; }
.de-top { display: flex; gap: 6px; margin-bottom: 8px; }
.de-top input { flex: 1; min-width: 0; font-weight: 700; }
.de-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.de-acts .de-view { margin: 0 auto 0 0; width: auto; }
.de-acts .de-view button { padding: 5px 12px; }
.de-import textarea { width: 100%; min-height: 160px; }
.de-issues { margin: 6px 0; padding: 6px 10px; border-radius: 8px; font-size: 13px; }
.de-issues.ko { background: #f8717118; border: 1px solid #f8717155; }
.de-issues.ok { background: #34d39914; border: 1px solid #34d39955; color: var(--good); }
.de-issues summary { cursor: pointer; font-weight: 700; }
.de-issues ul { margin: 6px 0; padding-left: 18px; color: var(--text); }
.de-sugg { margin: 6px 0; font-size: 13px; }
.de-sugg summary { cursor: pointer; font-weight: 700; }
.de-sgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; margin-top: 6px; }
.de-srow { display: flex; align-items: center; gap: 6px; padding: 3px 6px; font-size: 12px; text-align: left; }
.de-srow img { width: 32px; height: 22px; object-fit: cover; object-position: 50% 22%; border-radius: 4px; }
.de-srow span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.de-srow i { color: var(--muted); font-style: normal; }
.de-sec { margin-top: 10px; border-radius: 8px; }
.de-sec.cur > .de-sh { color: var(--accent); }
.de-sh { display: flex; align-items: center; gap: 8px; padding: 4px 0 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; cursor: pointer; }
.de-sh span { flex: 1; }
.de-sh button { padding: 2px 8px; font-size: 11px; letter-spacing: 0; text-transform: none; }
.de-badge { padding: 2px 8px; border-radius: 6px; font-size: 12px; letter-spacing: 0; }
.de-badge.ko { background: #f0b42922; color: var(--accent); border: 1px solid #f0b42966; }
.de-badge.ok { background: #34d39922; color: var(--good); border: 1px solid #34d39966; }
.de-group { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 6px 0 2px; }
.de-row { display: flex; align-items: center; gap: 8px; padding: 2px 4px; border-radius: 6px; font-size: 14px; font-weight: 600; }
.de-row:hover { background: var(--panel2); }
.de-row img { width: 44px; height: 30px; object-fit: cover; object-position: 50% 22%; border-radius: 5px; flex-shrink: 0; }
.de-row .dom { width: 16px; height: 16px; font-size: 9px; flex-shrink: 0; }
.de-ctl { margin-left: auto; display: flex; gap: 3px; flex-shrink: 0; }
.de-ctl button { min-width: 26px; padding: 1px 6px; }
.de-empty { width: 100%; border-style: dashed; background: transparent; color: var(--muted); padding: 10px; }
@media (max-width: 1000px) {
  .de-wrap { grid-template-columns: 1fr; }
  .de-work { position: static; max-height: none; }
  .de-grid { max-height: 60vh; }
}
@media (max-width: 620px) {
  .de-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .de-tabs button { font-size: 11px; padding: 6px; }
}
/* Barres de défilement masquées (le défilement reste possible à la molette et au doigt). */
.de-grid, .de-work { scrollbar-width: none; }
.de-grid::-webkit-scrollbar, .de-work::-webkit-scrollbar { display: none; }
/* Éditeur : illustrations alternatives */
.de-arts { position: absolute; bottom: 6px; right: 6px; font-size: 11px; font-weight: 700; background: #000c; color: #fff; border-radius: 6px; padding: 2px 5px; cursor: pointer; }
.de-arts:hover { background: var(--accent); color: #111; }
.de-ctl .de-arts { position: static; margin-right: 4px; background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.de-artpick { position: fixed; inset: 0; z-index: 60; background: #000b; display: grid; place-items: center; padding: 16px; }
.de-artbox { width: min(1000px, 100%); max-height: 90vh; overflow-y: auto; scrollbar-width: none; }
.de-artbox::-webkit-scrollbar { display: none; }
.de-arthead { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.de-arthead button { margin-left: auto; }
.de-artgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.de-artopt { padding: 4px; display: flex; flex-direction: column; gap: 4px; border: 2px solid transparent; background: var(--panel2); }
.de-artopt img { width: 100%; aspect-ratio: 744 / 1039; object-fit: cover; border-radius: 7px; }
.de-artopt span { font-size: 11px; color: var(--muted); }
.de-artopt.on { border-color: var(--accent); }
#deSet { width: auto; max-width: 200px; }

/* Rejeu d'une partie : lecture, pause, pas à pas, position, temps entre deux actions */
.replay-bar { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.replay-bar button { padding: 2px 8px; }
.replay-bar input[type=range] { width: 160px; }
.replay-bar input[type=number] { width: 52px; }
.replay-bar .rp-count { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
@media (max-width: 620px) { .replay-bar input[type=range] { width: 70px; } .replay-bar #rpTurn, .replay-bar label { display: none; } }
.opp-hand.open { flex-wrap: wrap; }
.opp-hand.open .card { --cw: 64px; }
