:root {
  --gold: #e8c170;
  --gold-dark: #8a6a2a;
  --red: #d8423b;
  --blue: #4aa3ff;
  --ink: #f3ead6;
  --card-w: 150px;
  --card-h: 212px;
  --title: 'Cinzel', Georgia, serif;
  --body: 'Alegreya Sans', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #08060c;
  color: var(--ink);
  font-family: var(--body);
  user-select: none;
  -webkit-user-select: none;
}

button { font-family: inherit; }
.hidden { display: none !important; }

/* ------------------------------------------------------------ décor */

#bg { position: fixed; inset: 0; z-index: 0; }
.bg-art { width: 100%; height: 100%; display: block; }
.bg-windows rect { animation: flicker 3s infinite alternate; }
.bg-windows rect:nth-child(2n) { animation-delay: -1.3s; }
.fog {
  position: absolute; left: -50%; right: -50%; bottom: 18%; height: 30%;
  background: radial-gradient(ellipse at 30% 50%, rgba(160, 110, 160, .16), transparent 60%),
              radial-gradient(ellipse at 70% 60%, rgba(200, 120, 120, .12), transparent 55%);
  animation: fogDrift 40s linear infinite alternate;
}
.vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 45%, transparent 45%, rgba(0, 0, 0, .75) 100%);
}
#embers { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
#fx { position: fixed; inset: 0; z-index: 60; pointer-events: none; }

#scene { position: fixed; inset: 0; z-index: 2; }
body.no-game #scene { visibility: hidden; }
#scene.shake-1 { animation: shake1 .35s; }
#scene.shake-2 { animation: shake2 .5s; }

/* ------------------------------------------------------------ barre du haut */

#topbar {
  position: absolute; top: 0; left: 0; right: 0; height: 56px; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
  background: linear-gradient(#1d1522f2, #120d16d9);
  border-bottom: 2px solid #5a4630;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .6);
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 18px; min-width: 220px; }
.tb-right { justify-content: flex-end; }
.hero-name { font-family: var(--title); font-weight: 800; font-size: 18px; color: var(--gold); letter-spacing: 1px; }
.tb-hp { font-weight: 800; font-size: 18px; }
.tb-hp .heart { color: #ff4a4a; text-shadow: 0 0 8px #ff2020; }
.icon-btn {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px; cursor: pointer;
  background: linear-gradient(#3a2c22, #241a14); color: var(--ink);
  border: 2px solid var(--gold-dark); border-radius: 8px; font-size: 15px; font-weight: 700;
  transition: transform .15s, border-color .15s;
}
.icon-btn:hover { transform: translateY(-2px); border-color: var(--gold); }
.icon-btn b { color: var(--gold); }

#floorMap { display: flex; align-items: center; }
#floorMap .node {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: #1a1218; border: 2px solid #4a3a2a; opacity: .55; transition: all .3s;
}
#floorMap .node svg { width: 22px; height: 22px; }
#floorMap .node.boss { width: 44px; height: 44px; }
#floorMap .node.boss svg { width: 28px; height: 28px; }
#floorMap .node.done { opacity: .9; border-color: #5a8a4a; filter: grayscale(.6); }
#floorMap .node.current {
  opacity: 1; border-color: var(--gold); transform: scale(1.15);
  box-shadow: 0 0 14px rgba(232, 193, 112, .8);
  animation: nodePulse 1.6s ease-in-out infinite;
}
#floorMap .link { width: 26px; height: 3px; background: repeating-linear-gradient(90deg, #6a5a40 0 5px, transparent 5px 9px); }

/* ------------------------------------------------------------ combattants */

#battlefield { position: absolute; inset: 56px 0 0 0; }

.fighter {
  position: absolute; bottom: calc(205px + 3vh);
  display: flex; flex-direction: column; align-items: center; width: 280px;
}
#enemy { right: 11%; }

.sprite-wrap { position: relative; z-index: 2; }
.sprite {
  width: min(230px, 27vh); aspect-ratio: 200 / 240;
  transform-origin: 50% 100%;
  animation: breathe 3.4s ease-in-out infinite;
}
#enemy.elite .sprite { width: min(260px, 31vh); aspect-ratio: 220 / 260; }
#enemy.boss .sprite { width: min(330px, 38vh); aspect-ratio: 260 / 280; }
.sprite svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 12px 16px rgba(0, 0, 0, .6)); transition: filter .2s; }
.sprite.flash svg { animation: hitFlash .32s; }
#enemy.targeted .sprite svg { filter: drop-shadow(0 0 14px #ff3030) drop-shadow(0 0 30px rgba(255, 60, 40, .6)); }
#enemy.targeted .sprite-wrap::after {
  content: ''; position: absolute; inset: 15% 10%; border: 3px dashed rgba(255, 90, 70, .9); border-radius: 50%;
  animation: spin 4s linear infinite; pointer-events: none;
}

.shadow {
  width: 190px; height: 28px; margin-top: -18px;
  background: radial-gradient(ellipse, rgba(0, 0, 0, .75), transparent 70%);
}
#enemy.boss .shadow { width: 280px; }

/* animations des sprites */
.hk-plume { transform-origin: 104px 30px; animation: sway 2.6s ease-in-out infinite; }
.hk-cape { transform-origin: 100px 86px; animation: capeWave 3.4s ease-in-out infinite; }
.hk-eye, .dk-eye { animation: eyeGlow 2.2s ease-in-out infinite; }
.sl-body { transform-origin: 100px 220px; animation: wobble 1.8s ease-in-out infinite; }
.sl-bubble { animation: bubble 3s ease-in infinite; }
.sl-bubble.b2 { animation-delay: -1s; }
.sl-bubble.b3 { animation-delay: -2s; }
.sl-drip { animation: drip 2.4s ease-in infinite; }
.sl-drip.d2 { animation-delay: -1.2s; }
.cu-orb { transform-origin: 37px 36px; animation: orbPulse 1.8s ease-in-out infinite; }
.cu-eye { animation: eyeGlow 1.4s ease-in-out infinite; }
.fu-cap { transform-origin: 100px 130px; animation: capBob 2.8s ease-in-out infinite; }
.fu-spores circle { animation: spore 4s linear infinite; }
.fu-spores circle:nth-child(2) { animation-delay: -1s; }
.fu-spores circle:nth-child(3) { animation-delay: -2s; }
.fu-spores circle:nth-child(4) { animation-delay: -3s; }
.fu-spores circle:nth-child(5) { animation-delay: -1.5s; }
.dk-cape { transform-origin: 110px 92px; animation: capeWave 4s ease-in-out infinite; }
.dk-sword { animation: none; }
.gu-core { transform-origin: 130px 146px; animation: corePulse 1.6s ease-in-out infinite; }
.gu-glow { transform-origin: 130px 146px; animation: corePulse 1.6s ease-in-out infinite; opacity: .8; }
.gu-ring { transform-origin: 130px 146px; animation: spin 3s linear infinite; }
.gu-eye { animation: eyeGlow 1.2s ease-in-out infinite; }
.gu-steam circle { animation: steam 2.4s ease-out infinite; }
.gu-steam circle:nth-child(2) { animation-delay: -1.2s; }
.gu-arm-l { transform-origin: 58px 104px; animation: armSwing 3.4s ease-in-out infinite; }
.gu-arm-r { transform-origin: 202px 104px; animation: armSwing 3.4s ease-in-out infinite reverse; }

.fighter.entering .sprite-wrap { animation: enterRight .9s cubic-bezier(.2, .9, .3, 1.15) backwards; }
.fighter.entering .bars, .fighter.entering .enemy-name { animation: fadeIn .6s .5s backwards; }
.fighter.dying .sprite-wrap { animation: die 1.1s forwards; }
.fighter.dying .bars, .fighter.dying .statuses, .fighter.dying .intent, .fighter.dying .enemy-name { opacity: 0; transition: opacity .4s; }

.enemy-name {
  font-family: var(--title); font-weight: 800; font-size: 17px; color: #f0d9b0;
  text-shadow: 0 2px 4px #000; margin-top: -2px; letter-spacing: .5px;
}
#enemy.elite .enemy-name { color: #ffb347; }
#enemy.boss .enemy-name { color: #ff7a6a; font-size: 20px; }

/* barres de vie */
.bars { position: relative; margin-top: 6px; display: flex; align-items: center; }
.hpbar {
  position: relative; width: 210px; height: 20px; overflow: hidden;
  background: #2a0d10; border: 2px solid #050304; border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .7), inset 0 2px 4px rgba(0, 0, 0, .6);
}
.hpbar .ghost, .hpbar .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; border-radius: 8px; }
.hpbar .ghost { background: #ffe1a0; transition: width .7s .35s ease-in; }
.hpbar .fill {
  background: linear-gradient(#ff6a5a, #c2181f 60%, #8a0d14);
  transition: width .25s ease-out, background .3s;
}
.hpbar.has-block .fill { background: linear-gradient(#7cc8ff, #2a7ed0 60%, #1a4a8a); }
.hptext {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 2;
  font-weight: 800; font-size: 14px; color: #fff; text-shadow: 0 1px 2px #000, 0 0 4px #000;
}
.block-badge {
  position: absolute; left: -34px; top: 50%; translate: 0 -50%; z-index: 3;
  width: 40px; height: 44px; display: none; place-items: center;
  background: linear-gradient(#8ad0ff, #2a6ab8);
  border: 3px solid #0c2a4a; border-radius: 8px 8px 50% 50%;
  font-family: var(--title); font-weight: 900; font-size: 18px; color: #fff; text-shadow: 0 2px 0 #0c2a4a;
  box-shadow: 0 0 12px rgba(100, 180, 255, .7);
}
.block-badge.show { display: grid; }
.block-badge.gain { animation: blockGain .45s cubic-bezier(.3, 1.6, .5, 1); }
.block-badge.break { display: grid; animation: blockBreak .45s forwards; }

/* statuts */
.statuses { display: flex; gap: 6px; margin-top: 8px; min-height: 30px; flex-wrap: wrap; justify-content: center; max-width: 240px; }
.status { position: relative; width: 28px; height: 28px; cursor: help; animation: popIn .35s cubic-bezier(.3, 1.6, .5, 1); }
.status svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 2px #000); }
.status span {
  position: absolute; right: -6px; bottom: -6px; font-weight: 800; font-size: 14px;
  color: #fff; text-shadow: 0 0 3px #000, 0 1px 2px #000;
}

/* intention de l'ennemi */
.intent {
  position: absolute; top: -66px; left: 50%; translate: -50% 0; z-index: 5;
  display: flex; align-items: center; gap: 2px; cursor: help;
  animation: bob 1.8s ease-in-out infinite;
}
.intent.pop { animation: intentPop .45s cubic-bezier(.3, 1.6, .5, 1), bob 1.8s .45s ease-in-out infinite; }
.intent-icon { position: relative; width: 52px; height: 52px; }
.intent-icon svg { width: 100%; height: 100%; filter: drop-shadow(0 3px 3px #000); }
.intent-icon .sub { position: absolute; right: -10px; bottom: -6px; width: 28px; height: 28px; }
.intent-num {
  font-family: var(--title); font-weight: 900; font-size: 28px; color: #fff;
  text-shadow: 0 0 4px #000, 0 2px 0 #000, 0 0 12px rgba(255, 60, 40, .6);
}
.intent.big .intent-icon svg { filter: drop-shadow(0 0 10px #ff2a1a) drop-shadow(0 3px 3px #000); animation: rage .5s ease-in-out infinite alternate; }
.intent.big .intent-num { color: #ffcf6b; font-size: 32px; }

.move-name {
  position: absolute; top: -118px; left: 50%; translate: -50% 0; z-index: 6; white-space: nowrap;
  padding: 6px 18px; border-radius: 20px; background: rgba(10, 6, 12, .85); border: 2px solid #7a2a2a;
  font-family: var(--title); font-weight: 800; font-size: 18px; color: #ffd0c0;
  opacity: 0; pointer-events: none;
}
.move-name.show { animation: moveName 1.3s ease forwards; }

/* ------------------------------------------------------------ HUD */

#hud { position: absolute; left: 0; right: 0; bottom: 0; height: 0; z-index: 30; }
#hand { position: absolute; left: 50%; bottom: 0; width: 0; height: 0; z-index: 30; }

.energy-orb {
  position: absolute; left: 44px; bottom: 150px; width: 96px; height: 96px; border-radius: 50%;
  display: grid; place-items: center; cursor: help;
  background: radial-gradient(circle at 40% 35%, #ffe8b0, #ff8a1a 38%, #b31d0b 72%, #3a0602);
  border: 3px solid #2a0a04;
  box-shadow: 0 0 30px rgba(255, 120, 30, .6), inset 0 -10px 20px rgba(0, 0, 0, .5);
  font-family: var(--title); font-weight: 900; font-size: 30px; color: #fff;
  text-shadow: 0 2px 0 #000, 0 0 10px #000;
  transition: filter .3s;
}
.energy-orb span { position: relative; z-index: 2; }
.orb-ring {
  position: absolute; inset: -9px; border-radius: 50%;
  border: 3px dashed rgba(255, 210, 140, .6); animation: spin 14s linear infinite;
}
.energy-orb.empty { filter: grayscale(.85) brightness(.6); }
.energy-orb.pulse { animation: orbBump .4s cubic-bezier(.3, 1.6, .5, 1); }

.pile {
  position: absolute; bottom: 26px; width: 80px; height: 104px; cursor: pointer;
  transition: transform .15s;
}
.pile:hover { transform: translateY(-4px) scale(1.04); }
#drawPile { left: 52px; }
#discardPile { right: 52px; }
#exhaustPile { right: 150px; bottom: 30px; transform: scale(.7); transform-origin: bottom right; }
.pile-stack, .card-back {
  position: absolute; inset: 0; border-radius: 9px;
  background:
    radial-gradient(circle at 50% 50%, rgba(232, 193, 112, .35) 0 14px, transparent 15px),
    repeating-linear-gradient(45deg, #3e2c1c 0 6px, #2a1c12 6px 12px);
  border: 3px solid var(--gold);
  box-shadow: 3px 3px 0 #6a4a20, 6px 6px 0 #4a3418, 0 8px 18px rgba(0, 0, 0, .7);
}
#discardPile .pile-stack { filter: hue-rotate(190deg) saturate(.7); }
#exhaustPile .pile-stack { filter: grayscale(1) brightness(.7); }
.pile.empty .pile-stack { opacity: .35; box-shadow: none; }
.pile-count {
  position: absolute; right: -12px; bottom: -10px; min-width: 34px; height: 34px; padding: 0 6px;
  display: grid; place-items: center; border-radius: 17px;
  background: #120a0e; border: 2px solid var(--gold);
  font-family: var(--title); font-weight: 900; font-size: 17px; color: #fff;
}
.pile.bump { animation: pileBump .3s; }
.card-back { position: fixed; width: 60px; height: 84px; z-index: 55; pointer-events: none; }

#endTurnBtn {
  position: absolute; right: 34px; bottom: 156px; padding: 14px 24px; cursor: pointer;
  font-family: var(--title); font-weight: 900; font-size: 18px; color: #fff; letter-spacing: .5px;
  background: linear-gradient(#4a8a44, #1e4a1c);
  border: 3px solid var(--gold); border-radius: 30px;
  box-shadow: 0 6px 0 #0d1a0c, 0 10px 22px rgba(0, 0, 0, .6);
  text-shadow: 0 2px 0 #0d1a0c;
  transition: transform .12s, filter .2s, box-shadow .12s;
}
#endTurnBtn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.15); }
#endTurnBtn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 #0d1a0c, 0 4px 10px rgba(0, 0, 0, .6); }
#endTurnBtn:disabled { filter: grayscale(1) brightness(.55); cursor: default; }
#endTurnBtn.pulse { animation: btnGlow 1.2s ease-in-out infinite; }

/* ------------------------------------------------------------ cartes */

.card {
  position: absolute; left: 0; top: 0; width: var(--card-w); height: var(--card-h);
  transition: transform .3s cubic-bezier(.2, .9, .3, 1.1), opacity .35s;
  cursor: pointer; touch-action: none; will-change: transform;
}
.card-frame {
  position: absolute; inset: 0; padding: 7px 9px; border-radius: 13px;
  display: flex; flex-direction: column; align-items: center;
  background: var(--card-bg); border: 3px solid var(--card-border, var(--gold));
  box-shadow: 0 10px 20px rgba(0, 0, 0, .65), inset 0 0 0 2px rgba(255, 255, 255, .08), inset 0 0 24px rgba(0, 0, 0, .5);
  transition: box-shadow .2s;
}
.card.attack { --card-bg: linear-gradient(160deg, #8e2c25, #4e1411 58%, #2a0907); --art-bg: radial-gradient(circle at 50% 40%, #7a3424, #1e0705); }
.card.skill { --card-bg: linear-gradient(160deg, #2a6690, #143651 58%, #0a1b29); --art-bg: radial-gradient(circle at 50% 40%, #2d5d80, #081520); }
.card.power { --card-bg: linear-gradient(160deg, #a58226, #5c4410 58%, #2c1f06); --art-bg: radial-gradient(circle at 50% 40%, #8a6a24, #1c1204); }
.card.status { --card-bg: linear-gradient(160deg, #55555e, #2a2a30 60%, #18181c); --card-border: #8a8a92; --art-bg: radial-gradient(circle at 50% 40%, #4a4a52, #121214); }

.card-name {
  position: relative; margin-top: 4px; width: 112%; padding: 3px 6px 3px 18px; border-radius: 4px;
  background: linear-gradient(#ece0c4, #b9a57a); color: #2a1a0a;
  font-family: var(--title); font-weight: 800; font-size: 13.5px; line-height: 1.1; text-align: center;
  white-space: normal; overflow-wrap: anywhere; flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .5);
}
.rarity-uncommon .card-name { background: linear-gradient(#cfeaff, #6fa5d6); }
.rarity-rare .card-name { background: linear-gradient(#fff0b0, #e0a93a); }
.card-art {
  width: 100%; height: 76px; margin-top: 6px; border-radius: 6px; overflow: hidden;
  display: grid; place-items: center;
  background: var(--art-bg); border: 2px solid rgba(0, 0, 0, .6);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, .7);
}
.card-art svg { width: 82%; height: 88%; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .6)); }
.card-type {
  margin-top: -9px; padding: 1px 9px; border-radius: 8px; z-index: 1;
  background: rgba(0, 0, 0, .65); color: #d8c8a8;
  font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
}
.card-desc {
  flex: 1; display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 2px 1px; font-size: 13.5px; line-height: 1.22; color: #f6efe0; text-shadow: 0 1px 2px #000;
}
.card-desc { flex-direction: column; gap: 3px; }
.card-flavor { font-size: 11px; line-height: 1.15; color: #d8c8a8; opacity: .85; }
.inspect-flavor { font-style: italic; color: #c9b89a; font-size: 16px; }
.card-desc b { color: #ffd76b; }
.card-desc b.num { color: #fff; }
.card-desc b.up { color: #7dff8f; }
.card-desc b.down { color: #ff7b6b; }
.card-cost {
  position: absolute; left: -11px; top: -11px; width: 40px; height: 40px; border-radius: 50%; z-index: 2;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #ffd08a, #e0572a 55%, #6a1a08);
  border: 3px solid #2a0d05;
  font-family: var(--title); font-weight: 900; font-size: 22px; color: #fff; text-shadow: 0 2px 0 #000;
}
.card.no-cost .card-cost { display: none; }
.card.too-expensive .card-cost { color: #ff6b6b; }

#hand .card.playable .card-frame {
  box-shadow: 0 0 0 2px #a8f4ff, 0 0 18px 4px rgba(80, 220, 255, .65), 0 10px 20px rgba(0, 0, 0, .65);
}
#hand .card:not(.playable):not(.in-play) .card-frame { filter: brightness(.82); }
#hand.locked .card:not(.in-play) .card-frame { filter: brightness(.6) saturate(.7); box-shadow: 0 10px 20px rgba(0, 0, 0, .65); }
.card.dragging { transition: none; z-index: 300 !important; }
.card.will-play .card-frame {
  box-shadow: 0 0 0 3px #fff, 0 0 34px 10px rgba(255, 210, 110, .9) !important;
}
.card.in-play { pointer-events: none; z-index: 200 !important; }
.card.in-play .card-frame { box-shadow: 0 0 0 3px #fff6d0, 0 0 40px 12px rgba(255, 220, 140, .8); }
.card.shake .card-frame { animation: cardShake .4s; }
.card.trigger .card-frame { animation: cardTrigger .5s; }
.card.exhausting .card-frame { animation: burnAway .65s forwards; }
.card.powering .card-frame { animation: powerUp .65s forwards; }

/* cartes statiques (récompenses, piles) */
.card.static { position: relative; transition: transform .2s; }
.card.static .card-cost { color: #fff; }
.reward-cards { display: flex; gap: 34px; margin: 14px 0 6px; }
.reward-cards .card { animation: dealIn .6s cubic-bezier(.2, .9, .3, 1.2) backwards; }
.reward-cards .card:hover { transform: translateY(-16px) scale(1.1); }
.reward-cards .card:hover .card-frame { box-shadow: 0 0 0 3px #fff6d0, 0 0 34px 10px rgba(255, 220, 140, .7); }

.pile-grid {
  display: grid; grid-template-columns: repeat(auto-fill, var(--card-w)); gap: 26px 20px; justify-content: center;
  width: min(1100px, 92vw); max-height: 68vh; overflow-y: auto; padding: 20px 14px;
}
.pile-grid .card { cursor: default; animation: fadeIn .3s backwards; }
.pile-grid .empty-msg { grid-column: 1 / -1; text-align: center; opacity: .6; font-size: 18px; }

/* ------------------------------------------------------------ effets flottants */

.float-text {
  position: fixed; z-index: 65; pointer-events: none; white-space: nowrap;
  font-family: var(--title); font-weight: 900; font-size: 46px; color: #fff;
  text-shadow: 0 0 3px #000, 0 3px 0 #000, 0 0 14px rgba(0, 0, 0, .8);
  animation: floatUp 1.15s cubic-bezier(.2, .8, .3, 1) forwards;
}
.float-text.dmg { color: #ffe6dc; }
.float-text.big { font-size: 68px; color: #ffd36b; }
.float-text.blocked { font-size: 30px; color: #9fd6ff; }
.float-text.block { font-size: 32px; color: #8fd0ff; }
.float-text.buff { font-size: 24px; color: #ffd36b; }
.float-text.debuff { font-size: 24px; color: #d6a8ff; }
.float-text.heal { color: #7dff8f; }
.float-text.energy { font-size: 28px; color: #ffb36b; }

.slash { position: fixed; width: 280px; height: 280px; margin: -140px 0 0 -140px; z-index: 62; pointer-events: none; }
.slash path { fill: none; stroke-linecap: round; stroke-dasharray: 420; stroke-dashoffset: 420; animation: slashDraw .38s ease-out forwards; }
.slash .glow { stroke: #ff6a3d; stroke-width: 18; opacity: .7; filter: blur(4px); }
.slash .core { stroke: #fff; stroke-width: 6; }
.slash.enemy .glow { stroke: #b02aff; }
.slash.minion .glow { stroke: #6ae4ff; }
.float-text.poison { color: #9cff7a; font-size: 38px; }
.sprite.poisoned svg { animation: poisonFlash .45s; }

/* ------------------------------------------------------------ bannière, toast, infobulle */

#banner { position: fixed; left: 0; right: 0; top: 36%; z-index: 70; pointer-events: none; opacity: 0; }
#banner.show { animation: bannerIn var(--dur, 1s) ease forwards; }
.banner-inner {
  padding: 18px 0 16px; text-align: center;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .85) 22%, rgba(0, 0, 0, .85) 78%, transparent);
  border-top: 1px solid rgba(232, 193, 112, .35); border-bottom: 1px solid rgba(232, 193, 112, .35);
}
#banner h2 {
  font-family: var(--title); font-weight: 900; font-size: 54px; letter-spacing: 5px; color: #f6e3b4;
  text-shadow: 0 0 24px rgba(255, 180, 80, .65), 0 3px 0 #000;
}
#banner p { font-size: 22px; color: #d8c8a8; margin-top: 2px; letter-spacing: 1px; }
#banner p:empty { display: none; }
#banner.enemy h2 { color: #ff9a8a; text-shadow: 0 0 24px rgba(255, 60, 40, .7), 0 3px 0 #000; }
#banner.elite p { color: #ffb347; }
#banner.boss h2 { color: #ff6a5a; font-size: 64px; }
#banner.boss p { color: #ff9a8a; font-size: 26px; }

#toast {
  position: fixed; left: 50%; bottom: 300px; translate: -50% 0; z-index: 80; pointer-events: none;
  padding: 10px 22px; border-radius: 10px; background: rgba(40, 6, 8, .92); border: 2px solid #c43a3a;
  font-weight: 800; font-size: 18px; opacity: 0; transition: opacity .2s;
}
#toast.show { opacity: 1; }

#tooltip {
  position: fixed; z-index: 120; max-width: 260px; pointer-events: none;
  padding: 10px 13px; border-radius: 8px; background: rgba(14, 10, 16, .96); border: 2px solid var(--gold-dark);
  font-size: 15px; line-height: 1.3; box-shadow: 0 6px 20px rgba(0, 0, 0, .7);
  opacity: 0; transition: opacity .12s;
}
#tooltip.show { opacity: 1; }
#tooltip b { color: var(--gold); }

/* ------------------------------------------------------------ écrans */

.screen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: radial-gradient(ellipse at center, rgba(34, 16, 40, .9), rgba(5, 3, 8, .96));
  transition: opacity .45s;
  text-align: center; font-size: 19px;
}
.screen.hidden { display: flex !important; opacity: 0; pointer-events: none; }
#lobbyScreen, #endScreen, #selectScreen { justify-content: safe center; overflow-y: auto; padding: 24px 0; }
.screen h1 {
  font-family: var(--title); font-weight: 900; font-size: clamp(56px, 9vw, 118px); letter-spacing: 6px; line-height: 1;
  color: #f6e3b4; text-shadow: 0 0 30px rgba(255, 140, 60, .6), 0 6px 0 #2a0a04;
  animation: titleGlow 3s ease-in-out infinite;
}
.screen h1 span { color: #ff5a3c; }
.subtitle { font-size: 22px; color: #d8c8a8; letter-spacing: 1px; }
.hint { font-size: 15px; opacity: .7; margin-top: 8px; }
kbd {
  display: inline-block; padding: 1px 7px; border-radius: 4px; border: 1px solid #8a6a2a;
  background: #2a1c12; font-family: var(--body); font-size: 13px;
}
.screen-title {
  font-family: var(--title); font-weight: 900; font-size: 64px; color: #f6e3b4; letter-spacing: 3px;
  text-shadow: 0 0 26px rgba(255, 180, 80, .6), 0 4px 0 #000;
  animation: dropIn .6s cubic-bezier(.2, .9, .3, 1.3);
}
.screen-title.small { font-size: 40px; }
.screen-title.defeat { color: #ff6a5a; text-shadow: 0 0 26px rgba(255, 40, 30, .7), 0 4px 0 #000; }
.heal-text { color: #7dff8f; font-weight: 800; }
.big-btn {
  margin-top: 10px; padding: 16px 40px; cursor: pointer;
  font-family: var(--title); font-weight: 900; font-size: 22px; color: #fff; letter-spacing: 1px;
  background: linear-gradient(#c24a2a, #6a1a0c); border: 3px solid var(--gold); border-radius: 12px;
  box-shadow: 0 6px 0 #3a0a04, 0 10px 30px rgba(255, 90, 40, .35); text-shadow: 0 2px 0 #3a0a04;
  transition: transform .12s, filter .2s;
}
.big-btn:hover { transform: translateY(-3px); filter: brightness(1.15); }
.big-btn.ghost { background: linear-gradient(#3a2c22, #1e1610); box-shadow: 0 5px 0 #0e0a06; font-size: 18px; padding: 12px 32px; }
.end-stats { display: flex; gap: 20px; margin: 10px 0; }
.end-stats div {
  min-width: 140px; padding: 14px 18px; border-radius: 10px;
  background: rgba(0, 0, 0, .45); border: 2px solid #5a4630;
}
.end-stats b { display: block; font-family: var(--title); font-size: 34px; color: var(--gold); }

.title-art { display: flex; align-items: flex-end; gap: 120px; margin-bottom: -10px; }
.title-hero { width: 170px; aspect-ratio: 200 / 240; animation: breathe 3.4s ease-in-out infinite; transform-origin: bottom; }
.title-boss { width: 220px; aspect-ratio: 260 / 280; animation: breathe 3s ease-in-out infinite; transform-origin: bottom; filter: brightness(.65) saturate(.8); }
.title-hero svg, .title-boss svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 10px 20px #000); }

/* ------------------------------------------------------------ keyframes */

@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.015, .985); } }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(5deg); } }
@keyframes capeWave { 0%, 100% { transform: skewX(0deg); } 50% { transform: skewX(-3deg) scaleX(1.02); } }
@keyframes eyeGlow { 0%, 100% { opacity: .65; } 50% { opacity: 1; } }
@keyframes wobble { 0%, 100% { transform: scale(1, 1); } 30% { transform: scale(1.06, .93); } 60% { transform: scale(.96, 1.05); } }
@keyframes bubble { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: .4; } 100% { transform: translateY(-60px); opacity: 0; } }
@keyframes drip { 0% { transform: scaleY(.2); transform-origin: top; opacity: 0; } 30% { opacity: 1; } 100% { transform: scaleY(1.2) translateY(6px); opacity: 0; } }
@keyframes orbPulse { 0%, 100% { transform: scale(.9); opacity: .75; } 50% { transform: scale(1.15); opacity: 1; } }
@keyframes capBob { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg) translateY(-3px); } }
@keyframes spore { 0% { transform: translate(0, 10px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translate(12px, -40px); opacity: 0; } }
@keyframes corePulse { 0%, 100% { transform: scale(.92); } 50% { transform: scale(1.08); } }
@keyframes steam { 0% { transform: translateY(10px) scale(.6); opacity: .5; } 100% { transform: translateY(-50px) scale(2.2); opacity: 0; } }
@keyframes armSwing { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(3deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes flicker { 0%, 100% { opacity: .9; } 40% { opacity: .5; } 60% { opacity: 1; } }
@keyframes fogDrift { from { transform: translateX(-6%); } to { transform: translateX(6%); } }

@keyframes hitFlash {
  0% { filter: brightness(3.5) saturate(0) drop-shadow(0 0 0 #fff); }
  40% { filter: brightness(1.4) sepia(1) hue-rotate(-50deg) saturate(6) drop-shadow(0 12px 16px rgba(0, 0, 0, .6)); }
  100% { filter: drop-shadow(0 12px 16px rgba(0, 0, 0, .6)); }
}
@keyframes enterRight { from { transform: translateX(380px) scale(.9); opacity: 0; filter: brightness(0); } }
@keyframes die {
  0% { filter: brightness(1); }
  25% { filter: brightness(3) saturate(0); transform: translateY(0); }
  100% { filter: brightness(0) blur(6px); transform: translateY(50px) scale(1.1, .2); opacity: 0; }
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { transform: scale(0); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes intentPop { 0% { transform: scale(0) rotate(-20deg); } 100% { transform: scale(1); } }
@keyframes rage { from { transform: rotate(-6deg) scale(1); } to { transform: rotate(6deg) scale(1.1); } }
@keyframes moveName {
  0% { opacity: 0; transform: translateY(12px) scale(.8); }
  15% { opacity: 1; transform: translateY(0) scale(1.05); }
  25% { transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-10px); }
}
@keyframes blockGain { 0% { transform: scale(.2) rotate(-30deg); } 100% { transform: scale(1); } }
@keyframes blockBreak {
  0% { transform: scale(1.2); filter: brightness(2); }
  100% { transform: scale(1.6) rotate(20deg); opacity: 0; }
}
@keyframes orbBump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes pileBump { 50% { transform: scale(1.12); } }
@keyframes btnGlow {
  0%, 100% { box-shadow: 0 6px 0 #0d1a0c, 0 0 10px rgba(255, 220, 120, .4); }
  50% { box-shadow: 0 6px 0 #0d1a0c, 0 0 30px 8px rgba(255, 220, 120, .85); }
}
@keyframes cardShake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes cardTrigger { 0%, 100% { transform: scale(1); filter: none; } 50% { transform: scale(1.12); filter: brightness(1.8) sepia(1) hue-rotate(-30deg) saturate(4); } }
@keyframes burnAway {
  0% { filter: brightness(1); }
  30% { filter: brightness(2) sepia(1) saturate(5) hue-rotate(-20deg); }
  100% { filter: brightness(0) blur(3px); transform: translateY(-50px) scale(.9); opacity: 0; }
}
@keyframes powerUp {
  0% { filter: brightness(1); }
  40% { filter: brightness(2.2); transform: scale(1.15); }
  100% { filter: brightness(3); transform: scale(1.5) translateY(-30px); opacity: 0; }
}
@keyframes dealIn { from { transform: translateY(80px) rotateY(90deg) scale(.6); opacity: 0; } }
@keyframes dropIn { from { transform: translateY(-60px) scale(1.4); opacity: 0; } }
@keyframes titleGlow {
  0%, 100% { text-shadow: 0 0 24px rgba(255, 140, 60, .5), 0 6px 0 #2a0a04; }
  50% { text-shadow: 0 0 46px rgba(255, 140, 60, .9), 0 6px 0 #2a0a04; }
}
@keyframes floatUp {
  0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; }
  14% { transform: translate(-50%, -95%) scale(1.3); opacity: 1; }
  28% { transform: translate(-50%, -105%) scale(1); }
  75% { opacity: 1; }
  100% { transform: translate(-50%, -230%) scale(.9); opacity: 0; }
}
@keyframes slashDraw {
  0% { stroke-dashoffset: 420; opacity: 1; }
  55% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: -420; opacity: 0; }
}
@keyframes bannerIn {
  0% { opacity: 0; transform: scaleY(0); }
  12% { opacity: 1; transform: scaleY(1); }
  82% { opacity: 1; transform: scaleY(1); }
  100% { opacity: 0; transform: scaleY(.6); }
}
@keyframes nodePulse { 0%, 100% { box-shadow: 0 0 8px rgba(232, 193, 112, .6); } 50% { box-shadow: 0 0 20px rgba(232, 193, 112, 1); } }
@keyframes shake1 {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-6px, 3px); } 40% { transform: translate(5px, -4px); }
  60% { transform: translate(-4px, 2px); } 80% { transform: translate(3px, -1px); }
}
@keyframes shake2 {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-14px, 6px); } 25% { transform: translate(12px, -8px); }
  40% { transform: translate(-10px, 5px); } 55% { transform: translate(8px, -4px); }
  70% { transform: translate(-5px, 2px); } 85% { transform: translate(3px, -1px); }
}

/* ------------------------------------------------------------ héros jouables */


.pr-halo { animation: haloGlow 2.4s ease-in-out infinite; }
.pr-aura { transform-origin: 100px 64px; animation: corePulse 3s ease-in-out infinite; }
.pr-sun { transform-origin: 155.5px 40px; animation: spin 10s linear infinite; }
.me-feather { transform-origin: 116px 42px; animation: sway 2.4s ease-in-out infinite; }
.me-coins circle { animation: coinBob 1.6s ease-in-out infinite; }
.me-coins circle:nth-child(2) { animation-delay: -.5s; }
.me-coins circle:nth-child(3) { animation-delay: -1s; }
.su-ghost { animation: ghostFloat 3s ease-in-out infinite; }
.su-ghost.g2 { animation-delay: -1.5s; }
.su-circle { animation: runeDash 3s linear infinite; }
.su-eye { animation: eyeGlow 1.6s ease-in-out infinite; }
.su-bookglow { transform-origin: 100px 146px; animation: corePulse 2s ease-in-out infinite; }
.wz-orb { transform-origin: 160px 30px; animation: orbPulse 1.6s ease-in-out infinite; }
.wz-spark { animation: sparkle 1.2s ease-in-out infinite alternate; }
.wz-hat { transform-origin: 100px 55px; animation: hatFlop 3.2s ease-in-out infinite; }
.dw-beard { transform-origin: 100px 100px; animation: sway 3.6s ease-in-out infinite; }
.ar-bow { transform-origin: 150px 106px; animation: aim 3s ease-in-out infinite; }
.tb-feather { transform-origin: 118px 44px; animation: sway 2.2s ease-in-out infinite; }
.tb-cape { transform-origin: 90px 90px; animation: capeWave 3.6s ease-in-out infinite; }
.tb-lute { transform-origin: 104px 132px; animation: strum .9s ease-in-out infinite alternate; }
.tb-hand { animation: strumHand .45s ease-in-out infinite alternate; }
.tb-mouth { transform-origin: 103px 73px; animation: sing 1.2s ease-in-out infinite; }
.tb-note { animation: noteFloat 3s ease-in-out infinite; }
.tb-note.n2 { animation-delay: -1s; }
.tb-note.n3 { animation-delay: -2s; }

.minions { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.wisp {
  position: absolute; width: 42px; height: 42px;
  filter: drop-shadow(0 0 8px #6ae4ff) drop-shadow(0 0 16px rgba(106, 228, 255, .6));
  animation: wispIn .5s cubic-bezier(.3, 1.6, .5, 1), ghostFloat 2.6s ease-in-out infinite;
}
.wisp svg { width: 100%; height: 100%; }

/* ------------------------------------------------------------ sélection du héros */

#selectScreen { gap: 10px; }
.select-layout {
  display: grid; grid-template-columns: minmax(300px, 420px) minmax(420px, 640px); gap: 26px;
  width: min(1120px, 94vw); align-items: stretch;
}
.hero-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; align-content: start; }
.hero-tile {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; cursor: pointer;
  background: linear-gradient(160deg, rgba(58, 40, 30, .85), rgba(20, 14, 18, .9));
  border: 2px solid #4a3a2a; border-radius: 12px; color: var(--ink); text-align: left;
  transition: transform .15s, border-color .15s, box-shadow .2s;
  animation: dealIn .5s cubic-bezier(.2, .9, .3, 1.2) backwards;
}
.hero-tile:hover { transform: translateY(-3px); border-color: var(--gold-dark); }
.hero-tile.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(232, 193, 112, .35), 0 0 22px rgba(255, 190, 90, .45);
  background: linear-gradient(160deg, rgba(110, 70, 30, .9), rgba(40, 22, 18, .95));
}
.hero-portrait {
  width: 58px; height: 64px; flex: none; border-radius: 8px; overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #4a3a5a, #140c18);
  border: 1px solid rgba(255, 255, 255, .1);
}
.hero-portrait svg { width: 100%; height: 140%; margin-top: -2px; }
.hero-tile-name { font-family: var(--title); font-weight: 800; font-size: 15px; line-height: 1.15; }

.hero-detail {
  display: flex; gap: 18px; padding: 18px 20px; text-align: left;
  background: linear-gradient(160deg, rgba(40, 26, 34, .92), rgba(14, 9, 14, .95));
  border: 2px solid var(--gold-dark); border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .6), inset 0 0 40px rgba(0, 0, 0, .5);
}
.hero-detail.swap .hd-art { animation: heroIn .5s cubic-bezier(.2, .9, .3, 1.2); }
.hero-detail.swap .hd-info { animation: fadeIn .4s; }
.hd-art { flex: none; width: 170px; align-self: center; aspect-ratio: 200 / 240; }
.hd-art svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 12px 18px #000); animation: breathe 3.4s ease-in-out infinite; transform-origin: bottom; }
.hd-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.hd-info h3 { font-family: var(--title); font-weight: 900; font-size: 30px; color: #f6e3b4; line-height: 1; }
.hd-title { font-style: italic; color: #c9a15a; font-size: 17px; }
.hd-stats { font-weight: 800; font-size: 17px; }
.hd-stats .heart { color: #ff4a4a; }
.hd-stats .sep { opacity: .5; margin: 0 4px; }
.hd-desc { font-size: 16px; line-height: 1.3; color: #e2d6c0; }
.hd-passive {
  display: flex; flex-direction: column; padding: 8px 12px; border-radius: 10px;
  background: rgba(232, 193, 112, .1); border: 1px solid rgba(232, 193, 112, .4); font-size: 15px;
}
.hd-passive b { font-family: var(--title); color: var(--gold); font-size: 15px; }
.hd-deck-title { font-family: var(--title); font-weight: 800; font-size: 14px; color: #c9a15a; margin-top: 4px; letter-spacing: 1px; text-transform: uppercase; }
.hd-deck { display: flex; gap: 4px; flex-wrap: wrap; }
.hd-card { position: relative; width: 86px; height: 122px; animation: dealIn .45s backwards; }
.hd-card .card { transform: scale(.573); transform-origin: top left; cursor: default; }
.hd-count {
  position: absolute; right: -2px; bottom: -4px; z-index: 3; padding: 0 6px; border-radius: 10px;
  background: #120a0e; border: 2px solid var(--gold); font-weight: 800; font-size: 14px;
}
.select-actions { display: flex; gap: 18px; margin-top: 6px; }

@keyframes haloGlow { 0%, 100% { opacity: .7; stroke-width: 4; } 50% { opacity: 1; stroke-width: 6; } }
@keyframes coinBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes ghostFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes runeDash { to { stroke-dashoffset: -64; } }
@keyframes sparkle { from { opacity: .3; } to { opacity: 1; } }
@keyframes hatFlop { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-3deg); } }
@keyframes aim { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-3deg); } }
@keyframes strum { from { transform: rotate(-2deg); } to { transform: rotate(2deg); } }
@keyframes strumHand { from { transform: translateY(-3px); } to { transform: translateY(3px); } }
@keyframes sing { 0%, 100% { transform: scale(1, .7); } 50% { transform: scale(1, 1.2); } }
@keyframes noteFloat {
  0% { transform: translate(0, 8px); opacity: 0; }
  25% { opacity: 1; }
  75% { opacity: 1; }
  100% { transform: translate(6px, -22px); opacity: 0; }
}
@keyframes wispIn { from { transform: scale(0); opacity: 0; } }
@keyframes heroIn { from { transform: translateX(-40px) scale(.9); opacity: 0; } }
@keyframes poisonFlash {
  0% { filter: brightness(1.6) sepia(1) hue-rotate(50deg) saturate(5) drop-shadow(0 0 10px #6ad04a); }
  100% { filter: drop-shadow(0 12px 16px rgba(0, 0, 0, .6)); }
}

/* ------------------------------------------------------------ menu principal */

.screen.menu {
  justify-content: flex-start; align-items: stretch; gap: 0; text-align: left;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(120, 50, 40, .35), transparent 60%),
    radial-gradient(ellipse at center, rgba(28, 14, 34, .93), rgba(5, 3, 8, .97));
}
.menu-nav {
  flex: none; height: 66px; display: flex; align-items: center; gap: 24px; padding: 0 26px;
  background: linear-gradient(#1d1522f2, #120d16e6);
  border-bottom: 2px solid #5a4630; box-shadow: 0 4px 24px rgba(0, 0, 0, .6);
}
.menu-logo { font-family: var(--title); font-weight: 900; font-size: 26px; color: #f6e3b4; letter-spacing: 2px; cursor: pointer; white-space: nowrap; }
.menu-logo span { color: #ff5a3c; }
.menu-tabs { flex: 1; display: flex; justify-content: center; gap: 4px; }
.menu-tabs button {
  position: relative; padding: 10px 16px; cursor: pointer; background: none; border: none;
  font-family: var(--title); font-weight: 800; font-size: 16px; color: #b8a888; letter-spacing: .5px;
  transition: color .15s;
}
.menu-tabs button::after {
  content: ''; position: absolute; left: 50%; right: 50%; bottom: 2px; height: 3px; border-radius: 2px;
  background: var(--gold); transition: left .25s, right .25s;
}
.menu-tabs button:hover { color: #f6e3b4; }
.menu-tabs button.active { color: var(--gold); }
.menu-tabs button.active::after { left: 14px; right: 14px; }
.menu-play {
  padding: 10px 28px; cursor: pointer; border-radius: 10px;
  font-family: var(--title); font-weight: 900; font-size: 17px; color: #fff;
  background: linear-gradient(#c24a2a, #6a1a0c); border: 2px solid var(--gold);
  box-shadow: 0 4px 0 #3a0a04; transition: transform .12s, filter .2s;
}
.menu-play:hover { transform: translateY(-2px); filter: brightness(1.15); }

.menu-page { display: none; flex: 1; overflow-y: auto; padding: 28px max(24px, calc((100vw - 1200px) / 2)) 50px; }
.menu-page.active { display: block; animation: pageIn .35s ease; }
.menu-page::-webkit-scrollbar { width: 10px; }
.menu-page::-webkit-scrollbar-thumb { background: #5a4630; border-radius: 5px; }
.page-title { font-family: var(--title); font-weight: 900; font-size: 40px; color: #f6e3b4; text-shadow: 0 0 20px rgba(255, 180, 80, .4); }
.page-sub { color: #c9b89a; margin: 4px 0 22px; }

/* accueil */
.page-home.active { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.page-home h1 { margin-top: 8px; }
.home-stage { position: relative; width: min(1100px, 100%); margin: 6px 0 4px; }
.home-lineup { position: relative; z-index: 1; display: flex; justify-content: center; align-items: flex-end; gap: 6px; height: 190px; }
.lineup-hero {
  width: 110px; height: 100%; background: none; border: none; cursor: pointer; padding: 0;
  display: flex; align-items: flex-end; justify-content: center;
  animation: lineupIn .6s cubic-bezier(.2, .9, .3, 1.2) backwards; animation-delay: calc(var(--i) * 70ms);
}
.lineup-sprite { width: 100%; aspect-ratio: 200 / 240; transition: transform .2s, filter .2s; transform-origin: bottom; filter: brightness(.85); }
.lineup-sprite svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 8px 10px #000); }
.lineup-hero:hover .lineup-sprite { transform: translateY(-10px) scale(1.12); filter: brightness(1.1) drop-shadow(0 0 16px rgba(255, 200, 120, .6)); }
.home-ledge {
  height: 26px; margin-top: -14px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, .8), transparent 70%);
}
.home-tiles { display: grid; grid-template-columns: repeat(4, minmax(150px, 220px)); gap: 16px; margin-top: 12px; }
.home-tile {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px 12px; cursor: pointer;
  background: linear-gradient(160deg, rgba(58, 40, 30, .85), rgba(20, 14, 18, .9));
  border: 2px solid #4a3a2a; border-radius: 14px; color: var(--ink);
  transition: transform .15s, border-color .15s, box-shadow .2s;
}
.home-tile:hover { transform: translateY(-4px); border-color: var(--gold); box-shadow: 0 0 22px rgba(255, 190, 90, .35); }
.home-tile b { font-family: var(--title); font-size: 36px; color: var(--gold); line-height: 1; }
.home-tile b i { font-size: 20px; font-style: normal; opacity: .6; }
.home-tile span { font-family: var(--title); font-weight: 800; font-size: 17px; }
.home-tile small { font-size: 14px; opacity: .65; }

/* héros */
.ch-tabs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.ch-tab {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 10px 6px; cursor: pointer;
  background: rgba(20, 14, 18, .8); border: 2px solid #3a2e24; border-radius: 12px; color: #c9b89a;
  font-family: var(--title); font-weight: 800; font-size: 12px; transition: all .15s;
}
.ch-tab:hover { border-color: var(--gold-dark); color: var(--ink); transform: translateY(-2px); }
.ch-tab.active { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 16px rgba(255, 190, 90, .4); background: rgba(70, 44, 24, .9); }
.ch-main {
  display: grid; grid-template-columns: 320px 1fr; gap: 30px; padding: 24px;
  background: linear-gradient(160deg, rgba(40, 26, 34, .92), rgba(14, 9, 14, .95));
  border: 2px solid var(--gold-dark); border-radius: 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
}
.codex-hero.swap .ch-sprite { animation: heroIn .5s cubic-bezier(.2, .9, .3, 1.2); }
.codex-hero.swap .ch-info { animation: fadeIn .4s; }
.ch-portrait {
  position: relative; display: flex; align-items: flex-end; justify-content: center; min-height: 340px; border-radius: 14px;
  background: radial-gradient(circle at 50% 40%, rgba(255, 170, 90, .25), transparent 60%), radial-gradient(circle at 50% 100%, #2a1a24, #0e080c);
  overflow: hidden;
}
.ch-pedestal {
  position: absolute; left: 15%; right: 15%; bottom: 20px; height: 34px; border-radius: 50%;
  background: radial-gradient(ellipse, #5a4630, #2a1e14 70%); box-shadow: 0 0 30px rgba(255, 190, 90, .25);
}
.ch-sprite { position: relative; width: 230px; aspect-ratio: 200 / 240; margin-bottom: 34px; }
.ch-sprite svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 12px 18px #000); animation: breathe 3.4s ease-in-out infinite; transform-origin: bottom; }
.ch-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ch-info h2 { font-family: var(--title); font-weight: 900; font-size: 42px; color: #f6e3b4; line-height: 1; }
.ch-title { font-style: italic; color: #c9a15a; font-size: 19px; margin-top: -4px; }
.ch-desc { font-size: 17px; line-height: 1.35; color: #e2d6c0; }
.ch-stats { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; }
.ch-stat { display: grid; grid-template-columns: 130px 1fr 40px; align-items: center; gap: 12px; font-weight: 700; color: #c9b89a; }
.ch-stat b { color: #fff; font-family: var(--title); font-size: 18px; }
.ch-bar { height: 12px; border-radius: 6px; background: #2a0d10; overflow: hidden; border: 1px solid #000; }
.ch-bar i { display: block; height: 100%; background: linear-gradient(#ff6a5a, #a8141c); border-radius: 6px; animation: barGrow .8s ease-out; }
.ch-stars { color: var(--gold); font-size: 20px; letter-spacing: 3px; }
.ch-pips { display: flex; gap: 6px; }
.ch-pips i { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffd08a, #e0572a 60%, #6a1a08); }
.ch-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ch-box { padding: 12px 14px; border-radius: 12px; font-size: 15px; line-height: 1.3; }
.ch-box h4 { font-family: var(--title); font-size: 15px; margin-bottom: 4px; }
.ch-box.passive { background: rgba(232, 193, 112, .1); border: 1px solid rgba(232, 193, 112, .4); }
.ch-box.passive h4 { color: var(--gold); }
.ch-box.mechanic { background: rgba(110, 180, 255, .08); border: 1px solid rgba(110, 180, 255, .35); }
.ch-box.mechanic h4 { color: #8fc8ff; }
.ch-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: auto; flex-wrap: wrap; }
.ch-record { display: flex; gap: 18px; color: #c9b89a; font-size: 15px; }
.ch-record b { color: #fff; font-family: var(--title); }
.ch-footer .big-btn { margin: 0; }
.ch-section { font-family: var(--title); font-size: 22px; color: #f6e3b4; margin: 28px 0 14px; }
.ch-section small { font-family: var(--body); font-size: 15px; color: #a8987a; font-weight: 400; margin-left: 8px; }

/* grilles de cartes */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 26px 18px; justify-items: center; }
.coll-item { position: relative; width: 150px; cursor: pointer; animation: dealIn .45s cubic-bezier(.2, .9, .3, 1.2) backwards; }
.coll-item .card { position: relative; cursor: pointer; transition: transform .2s; }
.coll-item:hover .card { transform: translateY(-8px) scale(1.06); }
.coll-item:hover .card-frame { box-shadow: 0 0 0 2px #fff6d0, 0 0 26px 6px rgba(255, 220, 140, .55); }
.coll-caption { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 8px; font-size: 13px; color: #c9b89a; font-weight: 700; }
.coll-caption.rarity-common { color: #c9c9c9; }
.coll-caption.rarity-uncommon { color: #8fc8ff; }
.coll-caption.rarity-rare { color: #ffcf6b; }
.coll-count {
  position: absolute; right: -8px; top: 190px; z-index: 3; padding: 1px 8px; border-radius: 10px;
  background: #120a0e; border: 2px solid var(--gold); font-weight: 800; font-size: 15px;
}
.mini-portrait {
  display: inline-block; flex: none; width: 24px; height: 26px; border-radius: 6px; overflow: hidden; vertical-align: middle;
  background: radial-gradient(circle at 50% 35%, #4a3a5a, #140c18);
}
.mini-portrait svg { width: 100%; height: 150%; }

/* collection */
.collection-filters {
  position: sticky; top: -28px; z-index: 5; margin: -28px -6px 22px; padding: 16px 6px 12px;
  display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(rgba(20, 12, 22, .98) 80%, rgba(20, 12, 22, 0));
}
.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; cursor: pointer;
  background: rgba(30, 20, 26, .9); border: 1px solid #4a3a2a; border-radius: 16px;
  color: #c9b89a; font-weight: 700; font-size: 14px; transition: all .12s;
}
.chip .mini-portrait { width: 20px; height: 22px; margin-left: -6px; }
.chip:hover { border-color: var(--gold-dark); color: var(--ink); }
.chip.active { background: linear-gradient(#7a4a1e, #4a2a10); border-color: var(--gold); color: #fff; }
#fSearch {
  flex: 1; min-width: 220px; max-width: 420px; padding: 8px 14px; border-radius: 10px;
  background: #120a0e; border: 1px solid #5a4630; color: var(--ink); font: inherit; font-size: 15px;
}
#fSearch:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 10px rgba(232, 193, 112, .4); }
.sort-label { display: flex; align-items: center; gap: 8px; color: #c9b89a; font-size: 14px; font-weight: 700; }
#fSort { padding: 6px 10px; border-radius: 8px; background: #120a0e; border: 1px solid #5a4630; color: var(--ink); font: inherit; }
.result-count { margin-left: auto; color: var(--gold); font-weight: 800; }
.empty-msg { grid-column: 1 / -1; text-align: center; opacity: .6; font-size: 18px; padding: 40px; }

/* inspection d'une carte */
.inspect {
  position: fixed; inset: 0; z-index: 110; display: grid; place-items: center;
  background: rgba(4, 2, 6, .82); backdrop-filter: blur(5px); transition: opacity .25s;
}
.inspect.hidden { display: grid !important; opacity: 0; pointer-events: none; }
.inspect-panel {
  position: relative; display: flex; gap: 36px; align-items: center; padding: 34px 40px; max-width: min(860px, 94vw);
  background: linear-gradient(160deg, rgba(44, 28, 36, .97), rgba(14, 9, 14, .98));
  border: 2px solid var(--gold-dark); border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .8);
  animation: dropIn .35s cubic-bezier(.2, .9, .3, 1.2);
}
.inspect.hidden .inspect-panel { animation: none; }
.inspect-card { flex: none; width: 240px; height: 340px; }
.inspect-card .card { transform: scale(1.6); transform-origin: top left; cursor: default; }
.inspect-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.inspect-info h3 { font-family: var(--title); font-weight: 900; font-size: 34px; color: #f6e3b4; line-height: 1; }
.inspect-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { padding: 2px 10px; border-radius: 10px; font-size: 13px; font-weight: 800; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .15); }
.tag.type-attack { color: #ff9a8a; border-color: rgba(255, 120, 100, .5); }
.tag.type-skill { color: #8fc8ff; border-color: rgba(110, 180, 255, .5); }
.tag.type-power { color: #ffcf6b; border-color: rgba(255, 200, 100, .5); }
.tag.rarity-uncommon { color: #8fc8ff; }
.tag.rarity-rare { color: #ffcf6b; }
.tag.buff { color: #ffcf6b; }
.tag.debuff { color: #d6a8ff; }
.inspect-owner { display: flex; align-items: center; gap: 8px; color: #c9b89a; font-weight: 700; }
.inspect-owner .mini-portrait { width: 30px; height: 32px; }
.inspect-desc { font-size: 18px; line-height: 1.35; }
.inspect-desc b { color: #ffd76b; }
.inspect-desc b.num { color: #fff; }
.inspect-info h4 { font-family: var(--title); color: var(--gold); margin-top: 6px; }
.inspect-keywords { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.inspect-keywords li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.inspect-keywords .kw-icon { flex: none; width: 26px; height: 26px; }
.inspect-keywords .kw-icon svg { width: 100%; height: 100%; }
.inspect-keywords p { opacity: .8; }
.inspect-close {
  position: absolute; right: 14px; top: 12px; width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  background: #120a0e; border: 1px solid #5a4630; color: var(--ink); font-size: 16px;
}
.inspect-close:hover { border-color: var(--gold); }
.big-btn.small { padding: 8px 20px; font-size: 15px; align-self: flex-start; margin-top: 6px; }

/* bestiaire */
.bestiary-list { display: flex; flex-direction: column; gap: 18px; }
.beast {
  display: grid; grid-template-columns: 260px 1fr; overflow: hidden;
  background: linear-gradient(160deg, rgba(40, 26, 34, .92), rgba(14, 9, 14, .95));
  border: 2px solid #4a3a2a; border-radius: 16px; animation: dealIn .5s backwards;
}
.beast.elite { border-color: #a8742a; }
.beast.boss { border-color: #c4402a; box-shadow: 0 0 30px rgba(200, 60, 40, .25); }
.beast-art {
  display: flex; align-items: flex-end; justify-content: center; padding: 18px 10px 14px; min-height: 230px;
  background: radial-gradient(circle at 50% 30%, rgba(255, 170, 90, .15), transparent 60%), radial-gradient(circle at 50% 100%, #24141c, #0a0608);
}
.beast-sprite { width: 170px; aspect-ratio: 200 / 240; }
.beast-sprite.elite { width: 180px; aspect-ratio: 220 / 260; }
.beast-sprite.boss { width: 220px; aspect-ratio: 260 / 280; }
.beast-sprite svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 10px 14px #000); animation: breathe 3.4s ease-in-out infinite; transform-origin: bottom; }
.beast-info { padding: 20px 24px; display: flex; flex-direction: column; gap: 6px; }
.beast-head { display: flex; gap: 10px; align-items: center; }
.tier-badge { padding: 2px 10px; border-radius: 10px; font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; background: rgba(255, 255, 255, .08); }
.tier-badge.elite { color: #ffb347; background: rgba(255, 170, 60, .15); }
.tier-badge.boss { color: #ff7a6a; background: rgba(255, 80, 60, .15); }
.beast-floor { color: #a8987a; font-weight: 700; }
.beast-info h3 { font-family: var(--title); font-weight: 900; font-size: 30px; color: #f6e3b4; }
.beast-hp { font-weight: 800; }
.beast-hp .heart { color: #ff4a4a; }
.beast-desc { color: #d8ccb4; font-size: 16px; }
.beast-moves { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.beast-moves li {
  display: grid; grid-template-columns: 32px 190px 1fr; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 8px; background: rgba(0, 0, 0, .3); font-size: 15px;
}
.beast-moves b { font-family: var(--title); font-size: 14px; color: #ffd0c0; }
.beast-moves span:last-child { color: #d8ccb4; }
.mv-icon { width: 30px; height: 30px; }
.mv-icon svg { width: 100%; height: 100%; }

/* lexique */
.howto { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 16px 0 26px; }
.howto div { padding: 14px; border-radius: 12px; background: rgba(0, 0, 0, .35); border: 1px solid #3a2e24; font-size: 15px; }
.howto b {
  display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 8px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd08a, #e0572a 60%, #6a1a08); font-family: var(--title); color: #fff;
}
.lex-title { font-family: var(--title); font-size: 24px; color: #f6e3b4; margin: 18px 0 12px; }
.lex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.lex-item {
  display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 12px;
  background: rgba(30, 20, 26, .85); border: 1px solid #3a2e24;
}
.lex-item.buff { border-left: 4px solid #e8a83a; }
.lex-item.debuff { border-left: 4px solid #a86bff; }
.lex-item.keyword { border-left: 4px solid #5a8acf; }
.lex-icon { flex: none; width: 36px; height: 36px; }
.lex-icon svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 2px #000); }
.lex-item h4 { font-family: var(--title); font-size: 17px; display: flex; align-items: center; gap: 8px; }
.lex-item p { font-size: 15px; color: #d8ccb4; margin-top: 2px; }

/* statistiques */
.stats-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin: 18px 0 24px; }
.stat-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 18px 10px;
  background: linear-gradient(160deg, rgba(58, 40, 30, .85), rgba(20, 14, 18, .9)); border: 2px solid #4a3a2a; border-radius: 14px;
}
.stat-tile b { font-family: var(--title); font-size: 38px; color: var(--gold); line-height: 1; }
.stat-tile b i { font-size: 20px; font-style: normal; opacity: .6; }
.stat-tile span { font-weight: 800; }
.stat-tile small { opacity: .6; }
.stat-tile.fav .hero-portrait { width: 52px; height: 56px; }
.stats-table { border: 2px solid #4a3a2a; border-radius: 14px; overflow: hidden; margin-bottom: 20px; }
.st-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1.6fr; align-items: center; padding: 10px 18px; gap: 10px; }
.st-row:nth-child(odd) { background: rgba(255, 255, 255, .03); }
.st-head { background: rgba(232, 193, 112, .12) !important; font-family: var(--title); font-weight: 800; color: var(--gold); }
.st-hero { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.st-hero .mini-portrait { width: 32px; height: 34px; }
.st-floors { display: flex; gap: 6px; }
.st-floors i { width: 18px; height: 18px; border-radius: 50%; background: #2a1e18; border: 2px solid #4a3a2a; }
.st-floors i.on { background: radial-gradient(circle at 35% 30%, #ffe08a, #c88a20); border-color: #e8c170; }
.st-floors i.win { background: radial-gradient(circle at 35% 30%, #fff, #ff5a3c); box-shadow: 0 0 10px #ff5a3c; }

@keyframes pageIn { from { opacity: 0; transform: translateY(12px); } }
@keyframes lineupIn { from { opacity: 0; transform: translateY(40px); } }
@keyframes barGrow { from { width: 0; } }

@media (max-width: 1100px) {
  .menu-tabs button { padding: 8px 9px; font-size: 14px; }
  .ch-main { grid-template-columns: 1fr; }
  .ch-boxes, .home-tiles { grid-template-columns: 1fr 1fr; }
  .howto, .stats-summary { grid-template-columns: repeat(2, 1fr); }
  .beast { grid-template-columns: 1fr; }
  .beast-moves li { grid-template-columns: 32px 1fr; }
  .beast-moves li span:last-child { grid-column: 2; }
}

/* ------------------------------------------------------------ groupe de héros (multijoueur) */

.party { position: absolute; inset: 0; pointer-events: none; }
.party .fighter.hero { pointer-events: auto; transform-origin: 50% 100%; transform: scale(var(--s, 1)); }

.hero-tag {
  position: absolute; top: -34px; left: 50%; translate: -50% 0; z-index: 6; white-space: nowrap;
  display: flex; align-items: baseline; gap: 6px; padding: 3px 12px; border-radius: 14px;
  background: rgba(10, 6, 12, .85); border: 1px solid #5a4630; font-size: 15px;
}
.party.solo .hero-tag { display: none; }
.hero-tag b { font-family: var(--title); color: #f0d9b0; }
.hero-tag small { color: #a8987a; }
.fighter.hero.me .hero-tag { border-color: var(--gold); box-shadow: 0 0 12px rgba(232, 193, 112, .45); }
.fighter.hero.me .hero-tag b { color: var(--gold); }
.ready-badge {
  display: none; width: 20px; height: 20px; border-radius: 50%; place-items: center; align-self: center;
  background: #3f9a4a; color: #fff; font-size: 13px; font-weight: 900;
}
.fighter.hero.ready .ready-badge { display: inline-grid; animation: popIn .3s cubic-bezier(.3, 1.6, .5, 1); }
.fighter.hero.ready .hero-tag { border-color: #3f9a4a; }
.fighter.hero.offline .hero-tag::after { content: 'déconnecté'; color: #ff8a7a; font-size: 12px; font-style: italic; }
.fighter.hero.offline .sprite { opacity: .55; }
.fighter.hero.downed .sprite-wrap { filter: grayscale(1) brightness(.45); transform: rotate(-80deg) translate(-60px, 30px); transition: transform .8s ease-in, filter .6s; }
.fighter.hero.downed .sprite { animation: none; }
.fighter.hero.downed .statuses, .fighter.hero.downed .minions { opacity: 0; }
.fighter.hero.downed .hero-tag::after { content: 'à terre'; color: #ff8a7a; font-size: 12px; font-style: italic; }
.fighter.hero.targeted-hero .shadow {
  background: radial-gradient(ellipse, rgba(255, 50, 30, .65), transparent 70%);
  animation: targetPulse 1.2s ease-in-out infinite;
}
.intent-target {
  position: absolute; top: 100%; left: 50%; translate: -50% 2px; white-space: nowrap;
  padding: 1px 10px; border-radius: 10px; background: rgba(60, 8, 8, .85); border: 1px solid #c4402a;
  font-weight: 800; font-size: 13px; color: #ffcfc0;
}
.room-tag { padding: 2px 10px; border-radius: 10px; background: rgba(232, 193, 112, .15); border: 1px solid var(--gold-dark); color: var(--gold); font-weight: 800; font-size: 14px; }

/* ------------------------------------------------------------ salon multijoueur */

.menu-play.multi, .big-btn.multi { background: linear-gradient(#2a6a9a, #123a5a); box-shadow: 0 4px 0 #061a2a; }
.home-actions { display: flex; gap: 18px; }
.home-actions .big-btn { margin-top: 0; }
#lobbyScreen { gap: 14px; }
.lobby-entry, .lobby-room { display: flex; flex-direction: column; align-items: center; gap: 16px; width: min(900px, 94vw); }
.field { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 18px; }
.field input, .code-input {
  padding: 10px 14px; border-radius: 10px; background: #120a0e; border: 2px solid #5a4630;
  color: var(--ink); font: inherit; font-size: 18px; width: 240px;
}
.field input:focus, .code-input:focus { outline: none; border-color: var(--gold); }
.lobby-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; width: 100%; }
.lobby-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px;
  background: linear-gradient(160deg, rgba(58, 40, 30, .85), rgba(20, 14, 18, .92));
  border: 2px solid #4a3a2a; border-radius: 16px;
}
.lobby-card h3 { font-family: var(--title); font-size: 26px; color: #f6e3b4; }
.lobby-card p { color: #c9b89a; font-size: 16px; }
.lobby-card .big-btn { margin-top: 4px; }
.code-input { width: 170px; text-align: center; font-family: var(--title); font-weight: 900; font-size: 30px; letter-spacing: 8px; text-transform: uppercase; }
.room-code { display: flex; align-items: center; gap: 14px; font-size: 18px; color: #c9b89a; }
.room-code b { font-family: var(--title); font-size: 46px; color: var(--gold); letter-spacing: 10px; text-shadow: 0 0 18px rgba(255, 190, 90, .5); }
.room-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; }
.room-slots.teams { grid-template-columns: 1fr 1fr; gap: 18px; }
.room-team { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; border: 2px solid; }
.room-team h4 { display: flex; align-items: center; gap: 10px; font-family: var(--title); font-size: 20px; }
.room-team h4 small { font-family: var(--body); font-size: 14px; opacity: .7; }
.room-team h4 .icon-btn { margin-left: auto; padding: 4px 12px; font-size: 13px; }
.room-team.team-A { border-color: rgba(220, 70, 60, .7); background: rgba(90, 15, 15, .35); }
.room-team.team-A h4 { color: #ff8a7a; }
.room-team.team-B { border-color: rgba(80, 150, 230, .7); background: rgba(15, 40, 90, .35); }
.room-team.team-B h4 { color: #8fc0ff; }
.room-team .room-slot { min-height: 70px; padding: 8px; }
.room-mode { display: flex; gap: 10px; }
.mode-btn {
  padding: 10px 18px; border-radius: 12px; cursor: pointer; font-family: var(--title); font-weight: 800; font-size: 15px;
  background: rgba(20, 14, 18, .9); border: 2px solid #4a3a2a; color: #c9b89a; transition: all .15s;
}
.mode-btn.active { border-color: var(--gold); color: #fff; background: linear-gradient(#7a4a1e, #4a2a10); box-shadow: 0 0 16px rgba(255, 190, 90, .35); }
.mode-btn:disabled { cursor: default; }
.mode-btn:disabled:not(.active) { opacity: .45; }
.room-slot {
  display: flex; align-items: center; gap: 10px; padding: 10px; min-height: 80px; text-align: left;
  background: rgba(20, 14, 18, .9); border: 2px solid #3a2e24; border-radius: 14px; animation: dealIn .4s backwards;
}
.room-slot.me { border-color: var(--gold); }
.room-slot.ready { box-shadow: inset 0 0 0 1px #3f9a4a; }
.room-slot.empty { justify-content: center; color: #8a7a62; font-style: italic; border-style: dashed; animation: emptyPulse 2s ease-in-out infinite; }
.room-slot.empty .slot-portrait { display: none; }
.slot-portrait { flex: none; width: 60px; height: 66px; border-radius: 10px; overflow: hidden; background: radial-gradient(circle at 50% 35%, #4a3a5a, #140c18); }
.slot-portrait svg { width: 100%; height: 140%; }
.slot-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.slot-info b { font-family: var(--title); font-size: 17px; overflow: hidden; text-overflow: ellipsis; }
.slot-info small { color: var(--gold); font-family: var(--body); }
.slot-info span { color: #a8987a; font-size: 14px; }
.slot-state { font-weight: 800; font-size: 13px; color: #a8987a; }
.room-slot.ready .slot-state { color: #6ad07a; }
.room-scale { color: #c9b89a; font-size: 15px; max-width: 760px; }
.room-scale b { color: var(--gold); }
.room-heroes { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; width: 100%; }
.hero-tile.small { flex-direction: column; text-align: center; padding: 8px 4px; gap: 4px; }
.hero-tile.small .hero-tile-name { font-size: 12px; }
#startRoomBtn:disabled { filter: grayscale(.8) brightness(.6); cursor: default; transform: none; }
.reward-wait { font-size: 22px; color: #c9b89a; font-style: italic; padding: 40px; animation: emptyPulse 2s ease-in-out infinite; }
.end-stats .end-hero { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 170px; }
.end-hero .mini-portrait { width: 48px; height: 52px; margin-bottom: 4px; }
.end-hero strong { font-family: var(--title); font-size: 18px; }
.end-hero small { color: #a8987a; }
.end-hero b { font-size: 28px; }
.load-error { grid-column: 1 / -1; padding: 30px; text-align: center; color: #ffb0a0; font-size: 17px; line-height: 1.5; background: rgba(60, 10, 10, .4); border: 1px solid #a8402a; border-radius: 12px; }
.load-error code { background: #120a0e; padding: 1px 6px; border-radius: 4px; color: #fff; }

/* ------------------------------------------------------------ joueur contre joueur */

body.pvp #enemy, body.pvp #floorMap { display: none; }
.fighter.hero.foe .sprite svg { transform: scaleX(-1); }
.fighter.hero.team-A .hero-tag { border-color: rgba(220, 70, 60, .8); }
.fighter.hero.team-B .hero-tag { border-color: rgba(80, 150, 230, .8); }
.fighter.hero.foe.targeted .sprite svg, .fighter.hero.foe.aim-target:hover .sprite svg {
  filter: drop-shadow(0 0 14px #ff3030) drop-shadow(0 0 30px rgba(255, 60, 40, .6));
}
.fighter.hero.foe.aim-target { cursor: crosshair; }
.fighter.hero.foe.aim-target .shadow { background: radial-gradient(ellipse, rgba(255, 50, 30, .7), transparent 70%); animation: targetPulse .9s ease-in-out infinite; }
.card.aiming .card-frame { box-shadow: 0 0 0 3px #ff8a6a, 0 0 30px 8px rgba(255, 90, 60, .75) !important; }
.card.dragging { pointer-events: none; }
.room-tag.team-A { color: #ff8a7a; border-color: #c4402a; background: rgba(120, 20, 20, .35); }
.room-tag.team-B { color: #8fc0ff; border-color: #3a6ab0; background: rgba(20, 50, 120, .35); }
.end-team { min-width: 300px; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.end-team h4 { font-family: var(--title); font-size: 20px; text-align: center; }
.end-team.team-A h4 { color: #ff8a7a; }
.end-team.team-B h4 { color: #8fc0ff; }
.end-team.winner { border-color: var(--gold) !important; box-shadow: 0 0 22px rgba(255, 190, 90, .35); }
.end-row { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 8px; }
.end-row .mini-portrait { width: 34px; height: 36px; }
.end-row small { color: #a8987a; }
.end-row b { font-size: 20px !important; display: inline !important; }
.end-row.fallen { opacity: .5; }

@keyframes targetPulse { 0%, 100% { opacity: .6; } 50% { opacity: 1; } }
@keyframes emptyPulse { 0%, 100% { opacity: .65; } 50% { opacity: 1; } }

@media (max-width: 1000px) {
  .select-layout { grid-template-columns: 1fr; }
  .hero-grid { grid-template-columns: repeat(4, 1fr); }
  .hero-tile { flex-direction: column; text-align: center; }
}

@media (max-height: 760px) {
  .fighter { bottom: calc(180px + 2vh); }
  .energy-orb { bottom: 130px; width: 82px; height: 82px; font-size: 26px; }
  #endTurnBtn { bottom: 132px; }
}

/* ------------------------------------------------------------ mobile (téléphones et petites tablettes) */

@media (max-width: 1024px) {
  /* la nav doit toujours tenir sur une ligne, même sur tablette */
  .menu-nav { height: 48px; flex-wrap: nowrap; min-width: 0; padding: 0 10px; gap: 8px; }
  .menu-logo { font-size: 18px; flex-shrink: 0; }
  .menu-tabs { flex: 1; min-width: 0; justify-content: space-around; overflow: hidden; gap: 0; }
  .menu-tabs button { padding: 6px 4px; font-size: 11px; letter-spacing: 0; white-space: nowrap; }
  .menu-play { flex-shrink: 0; padding: 6px 12px; font-size: 12px; }

  /* accueil : tout tient sur un écran, pas de scroll */
  .screen.menu { height: 100%; overflow: hidden; }
  .menu-page { height: calc(100% - 48px); overflow: hidden; flex-direction: column; padding: 10px 16px; }
  .menu-page.active { display: flex; }
  .menu-page.active:not(.page-home) { overflow-y: auto; display: block; }

  .page-home.active { gap: 8px; padding: 10px 16px; justify-content: space-between; }
  .page-home h1 { font-size: 32px; margin-top: 0; }
  .subtitle { font-size: 14px; margin: 0; }
  .home-stage { margin: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; }
  .home-lineup { height: 110px; gap: 2px; flex-wrap: nowrap; }
  .lineup-hero { width: auto; min-width: 0; flex: 1; }
  .home-ledge { height: 18px; margin-top: -10px; }
  .home-actions { gap: 10px; }
  .home-actions .big-btn { padding: 10px 20px; font-size: 15px; }
  .home-tiles { grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 0; }
  .home-tile { padding: 8px 6px; gap: 0; }
  .home-tile b { font-size: 22px; line-height: 1; }
  .home-tile b i { font-size: 13px; }
  .home-tile span { font-size: 13px; }
  .home-tile small { font-size: 10px; }
  .hint { display: none; }
}

@media (max-width: 820px) {
  :root { --card-w: 104px; --card-h: 146px; }

  /* barre du haut compacte */
  #topbar { height: 46px; padding: 0 8px; }
  .tb-left, .tb-right { min-width: 0; gap: 8px; }
  .hero-name { font-size: 14px; letter-spacing: 0; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tb-hp { font-size: 14px; }
  .icon-btn { padding: 4px 8px; font-size: 12px; gap: 4px; border-width: 1px; }
  .icon-btn span { display: none; }
  #floorMap { gap: 0; }
  #floorMap .node { width: 22px; height: 22px; border-width: 1px; }
  #floorMap .node svg { width: 14px; height: 14px; }
  #floorMap .node.boss { width: 26px; height: 26px; }
  #floorMap .node.boss svg { width: 16px; height: 16px; }
  #floorMap .link { width: 10px; }

  /* champ de bataille */
  #battlefield { inset: 46px 0 0 0; }
  .fighter { bottom: calc(140px + 1vh); width: 150px; }
  #enemy { right: 10%; }
  .sprite { width: min(110px, 18vh); max-height: calc(100vh - 300px); }
  .party.solo .fighter.hero { transform: scale(1); }
  .party.solo .fighter.hero .sprite { width: min(110px, 18vh); }
  .party:not(.solo) .fighter.hero .sprite { width: min(90px, 15vh); }
  .hero-tag { font-size: 12px; padding: 2px 8px; top: -26px; }
  #enemy.elite .sprite { width: min(160px, 25vh); }
  #enemy.boss .sprite { width: min(190px, 30vh); }
  .shadow { width: 120px; height: 20px; }
  #enemy.boss .shadow { width: 170px; }
  .enemy-name { font-size: 13px; }
  #enemy.boss .enemy-name { font-size: 15px; }
  .hpbar { width: 150px; height: 16px; }
  .hptext { font-size: 11px; }
  .block-badge { width: 30px; height: 34px; font-size: 14px; left: -26px; }
  .statuses { gap: 4px; min-height: 24px; max-width: 180px; }
  .status { width: 22px; height: 22px; }
  .status span { font-size: 11px; right: -4px; bottom: -4px; }
  .intent { top: -52px; gap: 1px; }
  .intent-icon { width: 40px; height: 40px; }
  .intent-icon .sub { width: 22px; height: 22px; right: -8px; bottom: -4px; }
  .intent-num { font-size: 22px; }
  .intent.big .intent-num { font-size: 24px; }
  .move-name { top: -92px; font-size: 13px; padding: 4px 12px; }

  /* HUD : énergie, piles, fin de tour */
  .energy-orb { left: 8px; bottom: 120px; width: 60px; height: 60px; font-size: 20px; border-width: 2px; }
  .orb-ring { inset: -5px; border-width: 2px; }
  .pile { width: 56px; height: 74px; bottom: 18px; }
  #drawPile { left: 12px; }
  #discardPile { right: 12px; }
  #exhaustPile { right: 76px; bottom: 20px; transform: scale(.55); }
  .pile-count { min-width: 24px; height: 24px; font-size: 13px; right: -8px; bottom: -6px; border-width: 1px; }
  #endTurnBtn { right: 8px; bottom: 108px; padding: 8px 14px; font-size: 13px; border-width: 2px; box-shadow: 0 3px 0 #0d1a0c, 0 6px 12px rgba(0, 0, 0, .6); }

  /* cartes */
  .card-name { font-size: 11px; padding: 2px 4px 2px 14px; }
  .card-art { height: 56px; margin-top: 4px; border-width: 1px; }
  .card-type { font-size: 8px; padding: 1px 6px; margin-top: -7px; }
  .card-desc { font-size: 10.5px; line-height: 1.2; padding: 1px; }
  .card-flavor { font-size: 8.5px; line-height: 1.1; }
  .card-cost { width: 30px; height: 30px; font-size: 16px; border-width: 2px; left: -9px; top: -9px; }
  .card-frame { padding: 5px 6px; border-width: 2px; border-radius: 10px; }

  /* récompenses & grilles de cartes */
  .reward-cards { gap: 10px; }
  .pile-grid { grid-template-columns: repeat(auto-fill, var(--card-w)); gap: 16px 10px; max-height: 72vh; padding: 10px; width: 96vw; }

  /* bannière & étiquettes */
  #banner { top: 28%; }
  .banner-inner h2 { font-size: 32px !important; }
  .banner-inner p { font-size: 14px !important; }

  /* menu — tout sur une page, pas de scroll */
  .menu-nav { height: 40px; flex-wrap: nowrap; padding: 0 6px; gap: 4px; }
  .menu-logo { font-size: 16px; letter-spacing: 1px; }
  .menu-tabs { flex: 1; justify-content: space-around; overflow: hidden; flex-wrap: nowrap; gap: 0; min-width: 0; }
  .menu-tabs button { padding: 4px 2px; font-size: 10px; white-space: nowrap; letter-spacing: 0; }
  .menu-tabs button::after { bottom: 0; }
  .menu-play { padding: 4px 10px; font-size: 11px; border-width: 1px; box-shadow: 0 2px 0 #3a0a04; }
  .menu-page { padding: 6px 10px; height: calc(100% - 40px); }

  .page-title { font-size: 22px; }
  .page-sub { font-size: 13px; margin-bottom: 8px; }

  /* accueil — compact, tient sur un écran */
  .page-home.active { gap: 6px; padding: 4px 8px 8px; justify-content: space-between; }
  .page-home h1 { font-size: 24px; margin-top: 0; }
  .subtitle { font-size: 12px; margin: 0; }
  .home-stage { margin: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; }
  .home-lineup { height: 90px; gap: 1px; flex-wrap: nowrap; }
  .lineup-hero { width: auto; min-width: 0; flex: 1; }
  .home-ledge { height: 14px; margin-top: -8px; }
  .home-actions { flex-direction: row; gap: 8px; width: 100%; }
  .home-actions .big-btn { width: 100%; margin-top: 0; padding: 10px 6px; font-size: 13px; }
  .home-tiles { grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 0; }
  .home-tile { padding: 6px 4px; border-width: 1px; border-radius: 10px; gap: 0; }
  .home-tile b { font-size: 18px; line-height: 1; }
  .home-tile b i { font-size: 11px; }
  .home-tile span { font-size: 11px; }
  .home-tile small { font-size: 9px; }
  .hint { display: none; }
  .big-btn { padding: 10px 20px; font-size: 14px; }


  /* lobby multijoueur */
  .lobby-choices { grid-template-columns: 1fr; gap: 12px; }
  .lobby-card { padding: 14px; }
  .lobby-card h3 { font-size: 20px; }
  .field { flex-direction: column; gap: 6px; font-size: 15px; }
  .field input, .code-input { width: 100%; max-width: 260px; font-size: 16px; padding: 8px 12px; }
  .code-input { font-size: 24px; letter-spacing: 6px; }
  .room-code b { font-size: 32px; letter-spacing: 6px; }
  .room-slots { grid-template-columns: 1fr 1fr; }
  .room-slots.teams { grid-template-columns: 1fr; }
  .room-heroes { grid-template-columns: repeat(4, 1fr); }

  /* filtres de collection */
  .chip-row { flex-wrap: wrap; gap: 6px; }
  .chip-group { flex-wrap: wrap; }

  /* écran sélection de héros : lisible et bouton Confirmer accessible */
  #selectScreen { padding: 12px 8px; gap: 8px; }
  .screen-title.small { font-size: 22px; }
  .select-layout { grid-template-columns: 1fr; width: 96vw; gap: 10px; }
  .hero-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .hero-tile { flex-direction: column; text-align: center; padding: 6px 4px; gap: 2px; }
  .hero-portrait { width: 48px; height: 54px; }
  .hero-tile-name { font-size: 11px; }
  .hero-detail { flex-direction: column; padding: 10px; gap: 10px; align-items: center; }
  .hd-art { width: 110px; }
  .hd-info { gap: 4px; text-align: center; }
  .hd-info h3 { font-size: 22px; }
  .hd-title { font-size: 14px; }
  .hd-stats, .hd-desc, .hd-passive { font-size: 13px; }
  .hd-deck-title { font-size: 12px; }
  .hd-card { width: 64px; height: 90px; }
  .hd-card .card { transform: scale(.42); }
  .select-actions { gap: 10px; width: 100%; justify-content: center; }
  .select-actions .big-btn { padding: 10px 16px; font-size: 14px; }

  /* fin de partie */
  .end-hero { min-width: 130px !important; }
  .end-team { min-width: 0 !important; }

  /* désactive les info-bulles au survol sur tactile (gêne plus qu'elles n'aident) */
  #tooltip { display: none !important; }
}

@media (max-width: 480px) {
  :root { --card-w: 90px; --card-h: 126px; }
  .card-name { font-size: 10px; padding: 1px 3px 1px 12px; }
  .card-art { height: 48px; margin-top: 3px; }
  .card-type { font-size: 7px; padding: 1px 4px; margin-top: -6px; }
  .card-desc { font-size: 9.5px; line-height: 1.15; }
  .card-flavor { font-size: 7.5px; }
  .card-cost { width: 26px; height: 26px; font-size: 14px; left: -8px; top: -8px; }
  .card-frame { padding: 4px 5px; }
  .fighter { width: 130px; bottom: calc(150px + 1vh); }
  .sprite { width: min(110px, 18vh); }
  .party .fighter.hero { transform: scale(calc(var(--s, 1) * .6)); }
  .party .fighter.hero .sprite { width: min(90px, 15vh); }
  .hpbar { width: 120px; height: 14px; }
  .hptext { font-size: 10px; }
  .energy-orb { width: 52px; height: 52px; font-size: 17px; bottom: 108px; }
  .pile { width: 48px; height: 64px; }
  #endTurnBtn { bottom: 100px; padding: 7px 10px; font-size: 12px; }
  .page-home h1 { font-size: 20px; }
  .home-lineup { height: 76px; }
  .home-tiles { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .home-tile b { font-size: 16px; }
  .home-tile span { font-size: 10px; }
  .home-tile small { font-size: 8px; }
  .menu-tabs button { font-size: 9px; padding: 3px 1px; }
  .room-heroes { grid-template-columns: repeat(3, 1fr); }
}

/* orientation paysage étroite (téléphone couché) */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  :root { --card-w: 86px; --card-h: 120px; }
  #topbar { height: 36px; }
  #battlefield { inset: 36px 0 0 0; }
  .fighter { bottom: calc(128px + 2vh); width: 140px; }
  #enemy { right: 12%; }
  .sprite { width: min(110px, 30vh); }
  .party.solo .fighter.hero { transform: none; }
  .party.solo .fighter.hero .sprite { width: min(110px, 30vh); }
  .party:not(.solo) .fighter.hero .sprite { width: min(90px, 22vh); }
  .energy-orb { bottom: 92px; width: 52px; height: 52px; font-size: 17px; }
  .pile { bottom: 10px; width: 48px; height: 64px; }
  #endTurnBtn { bottom: 86px; padding: 6px 12px; font-size: 12px; }
}

/* tablettes : premier palier de réduction des héros */
@media (max-width: 1100px) and (min-width: 821px) {
  .sprite { width: min(190px, 24vh); }
  .party .fighter.hero .sprite { width: min(170px, 22vh); }
}
