:root {
  --ink: #1d1b2e;
  --panel: #2a2457;
  --panel2: #3b3279;
  --gold: #ffd23f;
  --accent: #3d7bff;
  --text: #fff;
  --font: "Lilita One", system-ui, sans-serif;
  --body: "Nunito", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0f0c24; overflow: hidden; touch-action: manipulation; }
/* Pas de zoom au double tap sur mobile. */
button, input, select, label, .screen, .panel, #hud * { touch-action: manipulation; }
body {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--body); color: var(--text); user-select: none; -webkit-user-select: none;
  background: radial-gradient(circle at 50% 30%, #2a2160, #0b0920 70%);
}
#app {
  position: relative; overflow: hidden;
  width: min(100vw, calc(100dvh * 9 / 16)); height: min(100dvh, calc(100vw * 16 / 9));
  background: #1e5cb2; box-shadow: 0 0 60px rgba(0, 0, 0, .6);
}
/* Téléphones récents (plus hauts que 9:16) : le jeu occupe tout l'écran au lieu de laisser des bandes vides.
   Les encoches et la barre d'accueil sont gérées par les marges env(safe-area-inset-*). */
@media (max-aspect-ratio: 9 / 16) {
  #app { width: 100vw; height: 100dvh; box-shadow: none; }
}
#game, #map { position: absolute; inset: 0; display: block; touch-action: none; }
#map { pointer-events: none; }
.hidden { display: none !important; }

/* ---------- Écrans ---------- */
.screen {
  position: absolute; inset: 0; z-index: 20; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: max(16px, env(safe-area-inset-top)) 16px 24px;
  background: linear-gradient(180deg, #3b7ce0 0%, #5fb3f4 38%, #2a2457 38.2%, #1a1440 100%);
}
#hero { width: 100%; max-width: 360px; aspect-ratio: 32 / 22; display: block; }
.logo {
  font-family: var(--font); font-weight: 400; margin: -10px 0 12px; font-size: clamp(36px, 11vw, 52px);
  letter-spacing: 1px; color: var(--gold);
  text-shadow: 0 3px 0 #b8741a, 0 6px 0 var(--ink), 0 8px 14px rgba(0, 0, 0, .5);
  -webkit-text-stroke: 2px var(--ink);
}
.logo span { color: #fff; font-size: .6em; }
.panel {
  width: 100%; max-width: 380px; background: var(--panel); border: 3px solid var(--ink);
  border-radius: 18px; padding: 14px; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .12), 0 6px 0 var(--ink);
  display: flex; flex-direction: column; gap: 8px;
}
label { font-family: var(--font); font-size: 15px; letter-spacing: .5px; color: #c9c2ff; }
select, input[type=text], #realmName {
  width: 100%; font: 900 17px var(--body); color: var(--ink); background: #fff;
  border: 3px solid var(--ink); border-radius: 12px; padding: 9px 12px; outline: none;
  box-shadow: inset 0 -3px 0 #d6d1f0;
}
.row { display: flex; gap: 8px; align-items: center; }
.row.two > div { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.preview {
  font-family: var(--font); font-size: 20px; text-align: center; color: var(--gold);
  padding: 6px; background: rgba(0, 0, 0, .25); border-radius: 10px; min-height: 38px;
}
.colors { display: flex; gap: 8px; flex-wrap: wrap; justify-content: space-between; }
.colors button {
  width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--ink); cursor: pointer;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25);
}
.colors button.on { outline: 3px solid #fff; transform: scale(1.12); }
.deckpts { float: right; color: var(--gold); }
.deckpts.over { color: #ff6b6b; animation: pop .3s; }
.deckgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dcard {
  position: relative; aspect-ratio: 3 / 4; border-radius: 10px; border: 3px solid var(--ink); cursor: pointer; padding: 0;
  background: linear-gradient(#7a6bf0, #4b3cb8); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .3); overflow: hidden;
  font-family: var(--font); color: #fff; opacity: .45; filter: grayscale(.6); transition: transform .1s, opacity .1s;
}
.dcard.on { opacity: 1; filter: none; outline: 3px solid var(--gold); transform: translateY(-2px); }
.dcard canvas { position: absolute; top: 4%; left: 0; width: 100%; }
.dcard .pt {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 35%, #d9b8ff, #8a3cf0); border: 2px solid var(--ink); font-size: 13px; z-index: 1;
}
.dcard .nm { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; background: rgba(0, 0, 0, .55); padding: 2px 0; z-index: 1; }
.hint { font-size: 11px; opacity: .7; margin-top: -2px; }
.btn {
  font-family: var(--font); font-size: 18px; color: #fff; cursor: pointer;
  border: 3px solid var(--ink); border-radius: 14px; padding: 10px 16px;
  background: linear-gradient(#58c4ff, #2a86e8); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .25), 0 4px 0 var(--ink);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .4);
}
.btn:active { transform: translateY(3px); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25), 0 1px 0 var(--ink); }
.btn.big { font-size: 28px; padding: 12px; margin-top: 6px; background: linear-gradient(#ffe066, #f5a623); color: #fff; }
.btn.square { width: 50px; height: 48px; padding: 0; font-size: 22px; flex: none; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; font-size: 16px; opacity: .8; }
.btn.red { background: linear-gradient(#ff7b7b, #e23a3a); }
.btn.green { background: linear-gradient(#7fe07a, #2fa84a); }
.btn.gold { background: linear-gradient(#ffd866, #e0a020); color: #4a2a00; }
.btn.small { font-size: 14px; padding: 6px 10px; border-radius: 10px; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
#hud > * { pointer-events: auto; }
#topbar {
  position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 8px; align-items: flex-start;
  padding: max(8px, env(safe-area-inset-top)) 8px 8px;
  background: linear-gradient(rgba(16, 12, 40, .85), rgba(16, 12, 40, 0)); pointer-events: none;
}
.realm { flex: 1; min-width: 0; }
#hudName {
  font-family: var(--font); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 2px 0 var(--ink);
}
.bar { position: relative; height: 10px; margin-top: 3px; background: rgba(0, 0, 0, .45); border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; }
#landBar { height: 100%; width: 0; background: linear-gradient(#ffe680, #f5a623); transition: width .3s; }
.goal { position: absolute; top: 0; bottom: 0; left: 95%; width: 2px; background: #fff; }
.realm small { font-size: 11px; opacity: .85; }
.res { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.pill {
  display: flex; align-items: center; gap: 5px; background: rgba(20, 16, 50, .85); border: 2px solid var(--ink);
  border-radius: 20px; padding: 2px 9px 2px 5px; font-family: var(--font); font-size: 16px; min-width: 112px;
}
.pill small { font-family: var(--body); font-size: 10px; opacity: .75; margin-left: auto; }
.pill[hidden] { display: none; }
.pill.rail { font-size: 13px; min-width: 0; border-color: #ffd34a55; }
.pill .ic { font-size: 14px; }
.coin {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); display: inline-block;
  background: radial-gradient(circle at 35% 35%, #fff5b0, #ffd23f 45%, #d99a0b);
}
.lbtoggle {
  position: absolute; top: 74px; left: 8px; width: 38px; height: 38px; border-radius: 12px;
  border: 2px solid var(--ink); background: rgba(20, 16, 50, .85); font-size: 18px; cursor: pointer;
}
#leaderboard {
  position: absolute; top: 116px; left: 8px; margin: 0; padding: 6px 8px; list-style: none; width: 190px;
  background: rgba(20, 16, 50, .88); border: 2px solid var(--ink); border-radius: 12px; font-size: 12px;
}
#leaderboard li { display: flex; gap: 6px; align-items: center; padding: 2px 0; }
#leaderboard li i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; border: 1px solid var(--ink); }
#leaderboard li span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#leaderboard li.me { color: var(--gold); font-weight: 900; }
#leaderboard li.dead { opacity: .4; text-decoration: line-through; }

#banner {
  position: absolute; left: 50%; top: 82px; transform: translateX(-50%); max-width: 92%;
  font-family: var(--font); font-size: 15px; text-align: center; padding: 7px 14px;
  background: rgba(20, 16, 50, .9); border: 2px solid var(--ink); border-radius: 14px; pointer-events: none;
}
#banner b { color: var(--gold); font-weight: 400; }
#toasts {
  position: absolute; left: 8px; right: 8px; bottom: 160px; display: flex; flex-direction: column-reverse;
  gap: 6px; align-items: center; pointer-events: none;
}
.toast {
  pointer-events: auto; max-width: 100%; padding: 7px 12px; border-radius: 12px; font-size: 13px; font-weight: 900;
  background: rgba(20, 16, 50, .92); border: 2px solid var(--ink); animation: pop .25s ease-out;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center;
}
.toast.err { background: rgba(140, 30, 40, .92); }
.toast.good { background: rgba(30, 110, 60, .92); }
.toast.bad { background: rgba(150, 30, 30, .95); }
.toast.big { font-family: var(--font); font-weight: 400; font-size: 20px; color: var(--gold); }
.toast.fade { opacity: 0; transition: opacity .4s; }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
@keyframes popc { from { transform: translateX(-50%) scale(.7); opacity: 0; } }

#bottom {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 6px max(8px, env(safe-area-inset-bottom));
  background: linear-gradient(rgba(42, 36, 87, 0), rgba(26, 20, 64, .92) 25%);
}
.ratio { display: flex; align-items: center; gap: 8px; padding: 2px 6px 6px; font-size: 12px; font-weight: 900; }
.ratio input { flex: 1; accent-color: var(--gold); height: 24px; }
.ratio b { font-family: var(--font); font-weight: 400; font-size: 16px; min-width: 40px; text-align: right; color: var(--gold); }
#cards { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.card .pt { position: absolute; top: 2px; left: 2px; z-index: 1; font-size: 10px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; background: #8a3cf0; border: 1px solid var(--ink); }
.card {
  position: relative; aspect-ratio: 3 / 4; border-radius: 10px; border: 3px solid var(--ink); cursor: pointer;
  background: linear-gradient(#7a6bf0, #4b3cb8); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .3), 0 3px 0 var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 0; overflow: hidden;
  font-family: var(--font); color: #fff; transition: transform .1s;
}
.card canvas { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 100%; }
.card .cost {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 2px; font-size: 12px;
  background: rgba(0, 0, 0, .55); width: 100%; justify-content: center; padding: 1px 0 2px;
}
.card .cost .coin { width: 10px; height: 10px; border-width: 1px; }
.card.legend { background: linear-gradient(#ffb347, #c2581b); }
.card.epic { background: linear-gradient(#c86bf0, #7a2cb8); }
.card.build { background: linear-gradient(#5fd38a, #23885a); }
.card.build .em { position: absolute; top: 14%; font-size: 26px; }
.card.poor { filter: grayscale(.85) brightness(.75); }
.card.sel { transform: translateY(-8px) scale(1.06); outline: 3px solid #fff; }
.card .bar2 { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--gold); }

.popup {
  position: absolute; left: 50%; bottom: 170px; transform: translateX(-50%); width: min(92%, 340px); z-index: 15;
  background: var(--panel); border: 3px solid var(--ink); border-radius: 16px; padding: 12px;
  box-shadow: 0 6px 0 var(--ink), 0 10px 30px rgba(0, 0, 0, .5); animation: popc .2s ease-out;
}
.popup h3 { margin: 0 0 4px; font-family: var(--font); font-weight: 400; font-size: 18px; }
.popup p { margin: 0 0 10px; font-size: 13px; opacity: .9; }
.popup .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.popup .opt {
  display: flex; gap: 8px; align-items: center; text-align: left; font-family: var(--body); font-weight: 900; font-size: 13px;
  background: var(--panel2); color: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 6px; cursor: pointer;
}
.popup .opt canvas { width: 46px; height: 46px; flex: none; }
.popup .opt small { display: block; font-weight: 700; opacity: .75; font-size: 11px; }
.popup .opt.poor { opacity: .5; }
.popup .opt.vassal { grid-column: 1 / -1; background: linear-gradient(#6a4bc8, #45309a); }
.popup .opt .em { font-size: 30px; width: 46px; text-align: center; flex: none; }
.popup .close { margin-top: 8px; width: 100%; }

.end h2 { font-family: var(--font); font-weight: 400; font-size: 44px; margin: 0; text-align: center; color: var(--gold); -webkit-text-stroke: 2px var(--ink); text-shadow: 0 4px 0 var(--ink); }
.end p { text-align: center; margin: 0; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stats div { background: rgba(0, 0, 0, .25); border-radius: 10px; padding: 8px; text-align: center; font-size: 12px; }
.stats b { display: block; font-family: var(--font); font-weight: 400; font-size: 20px; color: var(--gold); }
#end { justify-content: center; background: rgba(10, 8, 30, .78); }

/* ---------- Menu à onglets (Deck · Jouer · Boutique) ---------- */
#menu.menu { display: block; padding: 0; overflow: hidden; }
.mtop {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; justify-content: space-between; align-items: center;
  padding: max(10px, env(safe-area-inset-top)) 12px 8px; background: linear-gradient(rgba(16, 12, 48, .75), rgba(16, 12, 48, 0));
}
.mprofile { display: flex; align-items: center; gap: 8px; font-family: var(--font); font-size: 16px; text-shadow: 0 2px 0 var(--ink); }
.mprofile .lvl {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; border: 3px solid var(--ink);
  background: linear-gradient(#58c4ff, #2a86e8); font-size: 15px;
}
.mres { display: flex; gap: 6px; }
.mres .pill {
  display: flex; align-items: center; gap: 5px; padding: 3px 10px 3px 4px; border-radius: 20px;
  background: rgba(0, 0, 0, .45); border: 2px solid var(--ink); font-family: var(--font); font-size: 15px;
}
.mres .coin { width: 20px; height: 20px; }
.gem {
  display: inline-block; width: 18px; height: 18px; transform: rotate(45deg) scale(.8); border-radius: 4px;
  background: linear-gradient(135deg, #9dffb0, #1fc96a 55%, #0d8a45); border: 2px solid var(--ink);
}
.pages {
  position: absolute; top: 0; left: 0; bottom: 0; width: 300%; display: flex;
  transition: transform .32s cubic-bezier(.2, .8, .2, 1); will-change: transform;
}
.pages.drag { transition: none; }
.page {
  width: 33.3334%; height: 100%; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: calc(max(10px, env(safe-area-inset-top)) + 46px) 16px 96px;
}
#pagePlay { gap: 0; background: linear-gradient(180deg, #3b7ce0 0%, #5fb3f4 34%, #2a2457 34.2%, #1a1440 100%); }
#pageDeck { background: linear-gradient(180deg, #4a2f9e, #1a1440 60%); }
#pageShop { background: linear-gradient(180deg, #8a4b1e, #3b1f40 45%, #1a1440 100%); }
.ptitle {
  font-family: var(--font); font-weight: 400; font-size: 30px; margin: 4px 0 0; color: var(--gold);
  text-shadow: 0 3px 0 #b8741a, 0 5px 0 var(--ink); -webkit-text-stroke: 1.5px var(--ink);
}
.linkbtn {
  float: right; background: none; border: 0; color: var(--gold); font-family: var(--font); font-size: 14px; cursor: pointer; padding: 0;
}
.deckslots { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.deckslots .dcard { opacity: 1; filter: none; }
.dcard.empty { opacity: .5; filter: none; background: rgba(0, 0, 0, .25); border-style: dashed; box-shadow: none; cursor: default; }
.dcard.locked { opacity: 1; filter: none; cursor: pointer; background: linear-gradient(#4a4566, #2a2640); }
.dcard.locked .q {
  position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; color: rgba(255, 255, 255, .35);
  text-shadow: 0 3px 0 rgba(0, 0, 0, .4);
}
.dcard.locked .nm { color: #b8b2d8; }
.soon { float: right; font-size: 12px; background: #ff8a3d; color: #fff; padding: 1px 8px; border-radius: 8px; border: 2px solid var(--ink); }
.deckmini { display: flex; gap: 5px; cursor: pointer; }
.deckmini .mc {
  position: relative; flex: 1; aspect-ratio: 3 / 4; border-radius: 8px; border: 2px solid var(--ink); overflow: hidden;
  background: linear-gradient(#7a6bf0, #4b3cb8);
}
.deckmini .mc canvas { position: absolute; top: 0; left: 0; width: 100%; }
.deckmini .mc.empty { background: rgba(0, 0, 0, .25); border-style: dashed; }

/* Boutique */
.soon-banner {
  width: 100%; max-width: 380px; text-align: center; font-family: var(--font); font-size: 17px; padding: 8px;
  background: linear-gradient(#ff9d4d, #e5641e); border: 3px solid var(--ink); border-radius: 12px; box-shadow: 0 4px 0 var(--ink);
}
.packs { width: 100%; max-width: 380px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pack {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 8px;
  border: 3px solid var(--ink); border-radius: 14px; cursor: pointer; font-family: var(--font); color: #fff;
  background: linear-gradient(var(--c1), var(--c2)); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .2), 0 5px 0 var(--ink);
}
.pack .pn { font-size: 14px; text-align: center; line-height: 1.05; min-height: 30px; display: grid; place-items: center; }
.pack .cnt { font-size: 11px; opacity: .85; font-family: var(--body); font-weight: 900; }
.pack .price {
  display: flex; align-items: center; gap: 4px; font-size: 15px; background: rgba(0, 0, 0, .35); padding: 2px 10px; border-radius: 10px;
}
.pack.big { grid-column: span 3; flex-direction: row; justify-content: space-around; padding: 12px; }
.pack.big .pn { font-size: 20px; }
/* Coffre dessiné en CSS */
.chest { position: relative; width: 64px; height: 52px; animation: bob 2.4s ease-in-out infinite; }
.pack.big .chest { width: 92px; height: 74px; }
.chest .lid, .chest .box {
  position: absolute; left: 0; right: 0; border: 3px solid var(--ink); background: linear-gradient(var(--w1), var(--w2));
}
.chest .lid { top: 0; height: 44%; border-radius: 40% 40% 6px 6px / 70% 70% 6px 6px; }
.chest .box { bottom: 0; height: 60%; border-radius: 4px 4px 8px 8px; }
.chest .band { position: absolute; top: 0; bottom: 0; width: 16%; background: linear-gradient(#ffe48a, #c98a1e); border-left: 2px solid var(--ink); border-right: 2px solid var(--ink); }
.chest .band.l { left: 14%; } .chest .band.r { right: 14%; }
.chest .lock {
  position: absolute; left: 50%; top: 38%; width: 22%; height: 30%; transform: translateX(-50%); z-index: 2;
  background: linear-gradient(#fff2b0, #e0a52a); border: 2px solid var(--ink); border-radius: 4px;
}
.chest::after {
  content: ''; position: absolute; inset: -30% -20%; z-index: -1; border-radius: 50%;
  background: radial-gradient(circle, var(--glow), transparent 65%);
}
@keyframes bob { 50% { transform: translateY(-4px) rotate(-2deg); } }
.offers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.offer {
  position: relative; aspect-ratio: 3 / 4; border-radius: 10px; border: 3px solid var(--ink); overflow: hidden; cursor: pointer;
  background: linear-gradient(#5b4fcf, #2d2480); font-family: var(--font);
}
.offer canvas { position: absolute; top: 2%; left: 0; width: 100%; }
.offer .price { color: #fff;
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: 4px;
  background: rgba(0, 0, 0, .55); padding: 3px 0; font-size: 13px;
}
.offer .price .coin { width: 14px; height: 14px; }
.offer .tag { position: absolute; top: 3px; right: 3px; font-size: 10px; background: #ff4d6d; padding: 1px 5px; border-radius: 6px; border: 2px solid var(--ink); }

/* Barre d'onglets */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: flex;
  padding: 6px 8px max(8px, env(safe-area-inset-bottom)); background: linear-gradient(#2a2457, #15103a);
  border-top: 3px solid var(--ink); box-shadow: 0 -4px 14px rgba(0, 0, 0, .35);
}
.tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0 4px; margin: 0 3px;
  font-family: var(--font); font-size: 13px; color: #b9b2e8; background: transparent; border: 3px solid transparent;
  border-radius: 14px; cursor: pointer; transition: transform .15s;
}
.tabbar .ti { font-size: 24px; filter: grayscale(.4); transition: transform .15s; }
.tabbar button.on {
  color: #fff; background: linear-gradient(#5c51d6, #3b3290); border-color: var(--ink); transform: translateY(-8px);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .18), 0 4px 0 var(--ink); text-shadow: 0 2px 0 var(--ink);
}
.tabbar button.on .ti { filter: none; transform: scale(1.18); }
.menutoast {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 6; white-space: nowrap;
  font-family: var(--font); font-size: 15px; padding: 9px 16px; border-radius: 12px; border: 3px solid var(--ink);
  background: #2a2457; box-shadow: 0 4px 0 var(--ink); animation: popc .25s;
}
/* Le bouton JOUER reste visible au-dessus de la barre d'onglets. */
#pagePlay #play { margin-top: 10px; }

/* ---------- Paramètres, trophées, fiche de carte ---------- */
.mprofile > div { display: flex; flex-direction: column; line-height: 1; }
.mtroph { font-family: var(--font); font-size: 12px; color: var(--gold); margin-top: 2px; }
.gear {
  width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--ink); font-size: 18px; cursor: pointer;
  background: linear-gradient(#6c63c9, #3b3290); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25);
}
.arena {
  width: 100%; max-width: 380px; margin: -4px 0 10px; text-align: center; padding: 10px; border-radius: 16px;
  background: rgba(0, 0, 0, .3); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.league { font-family: var(--font); font-size: 18px; text-shadow: 0 2px 0 var(--ink); }
.troph { display: flex; align-items: center; gap: 8px; font-family: var(--font); font-size: 34px; color: var(--gold);
  text-shadow: 0 3px 0 #b8741a, 0 5px 0 var(--ink); }
.troph .cup { font-size: 30px; }
.arena small { font-size: 12px; opacity: .8; }
.modal {
  position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(8, 6, 24, .7); animation: fadein .15s;
}
.mtitle { font-family: var(--font); font-weight: 400; font-size: 24px; margin: 0 0 4px; text-align: center; color: var(--gold); }
@keyframes fadein { from { opacity: 0; } }
.rankbox b sup { font-size: 12px; }
.trophybox.up b { color: #7dff8a; }
.trophybox.down b { color: #ff7b7b; }
.dcard { -webkit-touch-callout: none; }
.cardinfo {
  position: absolute; inset: 0; z-index: 9; display: flex; align-items: center; justify-content: center; padding: 18px;
  background: rgba(8, 6, 24, .72); pointer-events: none; animation: fadein .12s;
}
.ci {
  width: 100%; max-width: 330px; border: 4px solid var(--ink); border-radius: 18px; padding: 12px; position: relative;
  background: linear-gradient(#4f43c4, #2a2457 60%); box-shadow: 0 8px 0 var(--ink), 0 0 40px rgba(120, 100, 255, .4);
  animation: cipop .18s cubic-bezier(.2, 1.6, .4, 1);
}
.ci.epic { background: linear-gradient(#8a3cf0, #3a1e7a 60%); box-shadow: 0 8px 0 var(--ink), 0 0 50px rgba(200, 120, 255, .5); }
.ci.legend { background: linear-gradient(#f0a83c, #7a3a1e 60%); box-shadow: 0 8px 0 var(--ink), 0 0 60px rgba(255, 200, 80, .55); }
@keyframes cipop { from { transform: scale(.6); opacity: 0; } }
.ciart { height: 150px; display: flex; justify-content: center; margin-top: -10px; }
.ciart canvas { width: 160px; height: 160px; margin-top: -8px; }
.cihead { text-align: center; }
.cihead b { display: block; font-family: var(--font); font-size: 26px; text-shadow: 0 3px 0 var(--ink); }
.cihead .rar { font-size: 12px; font-weight: 900; opacity: .85; }
.ci p { font-size: 13px; text-align: center; margin: 6px 0 10px; opacity: .9; }
.cistats { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.cistats div {
  display: grid; grid-template-columns: 22px 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 4px;
  background: rgba(0, 0, 0, .3); border-radius: 9px; padding: 5px 7px;
}
.cistats span { grid-row: span 2; font-size: 17px; }
.cistats small { font-size: 10px; opacity: .75; }
.cistats b { font-family: var(--font); font-weight: 400; font-size: 15px; }

/* ---------- Coffres 3D : boutique + ouverture ---------- */
.pack canvas.chest3d { width: 84px; height: 84px; margin: -14px 0 -10px; animation: bob 2.4s ease-in-out infinite; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .3)); }
.pack.big canvas.chest3d { width: 120px; height: 120px; margin: -20px 0 -16px; }
.copen {
  position: absolute; inset: 0; z-index: 10; overflow: hidden; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 55%, #3b2d8f, #120d33 70%); animation: fadein .2s;
}
.copen .ctitle {
  position: absolute; top: calc(max(16px, env(safe-area-inset-top)) + 10px); left: 0; right: 0; text-align: center;
  font-family: var(--font); font-size: 28px; color: #fff; text-shadow: 0 3px 0 var(--ink); -webkit-text-stroke: 1px var(--ink);
}
.copen .tap {
  position: absolute; bottom: 12%; left: 0; right: 0; text-align: center; font-family: var(--font); font-size: 18px;
  opacity: 0; transition: opacity .3s; animation: blink 1.2s ease-in-out infinite; text-shadow: 0 2px 0 var(--ink);
}
.copen.ready .tap, .copen.opened .tap { opacity: 1; }
@keyframes blink { 50% { opacity: .45; } }
.copen .chestcv {
  position: absolute; width: 78%; max-width: 360px; aspect-ratio: 1; top: 50%; left: 50%; transform: translate(-50%, -46%);
  animation: chestdrop .6s cubic-bezier(.3, 1.5, .5, 1); filter: drop-shadow(0 18px 18px rgba(0, 0, 0, .45));
}
@keyframes chestdrop { 0% { transform: translate(-50%, -160%) scale(.6); } 70% { transform: translate(-50%, -40%) scale(1.06, .92); } }
.copen.ready:not(.opened) .chestcv { animation: chestidle 1.6s ease-in-out infinite; }
@keyframes chestidle { 50% { transform: translate(-50%, -49%) scale(1.02); } }
.copen.rumble { animation: rumble .08s linear infinite; }
@keyframes rumble { 25% { transform: translate(3px, -2px); } 75% { transform: translate(-3px, 2px); } }
.copen .rays {
  position: absolute; width: 180%; aspect-ratio: 1; left: -40%; top: 50%; transform: translateY(-50%) scale(.2); opacity: 0;
  background: repeating-conic-gradient(from 0deg, var(--ray) 0deg 7deg, transparent 7deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 8%, transparent 60%); mask: radial-gradient(circle, #000 8%, transparent 60%);
  transition: opacity .4s, transform .6s cubic-bezier(.2, 1.4, .4, 1);
}
.copen.opened .rays { opacity: .55; transform: translateY(-50%) scale(1); animation: spin 14s linear infinite; }
@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }
.copen .glowball {
  position: absolute; width: 60%; aspect-ratio: 1; left: 20%; top: 50%; transform: translateY(-58%) scale(0); border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, var(--ray) 30%, transparent 70%); transition: transform .5s cubic-bezier(.2, 1.6, .4, 1);
}
.copen.opened .glowball { transform: translateY(-58%) scale(1.2); }
.copen .flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.copen.opened .flash { animation: flash .5s ease-out; }
.copen.flashy .flash { animation: flash .45s ease-out; }
@keyframes flash { 0% { opacity: .9; } 100% { opacity: 0; } }
.copen .sparks { position: absolute; left: 50%; top: 46%; width: 0; height: 0; }
.copen .sparks i {
  position: absolute; width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px 3px var(--ray);
  animation: spark 1s cubic-bezier(.1, .8, .3, 1) forwards; opacity: 0;
}
@keyframes spark { 0% { transform: translate(0, 0) scale(1.4); opacity: 1; } 100% { transform: translate(var(--dx), calc(var(--dy) + 120px)) scale(.2); opacity: 0; } }
.copen .reveal { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; pointer-events: none; }
.copen.summary .reveal { pointer-events: auto; background: rgba(10, 8, 30, .6); padding: 20px; }
.copen.summary .chestcv { opacity: .25; }
.rcard { width: 58%; max-width: 230px; aspect-ratio: 3 / 4; perspective: 900px; animation: cardout .7s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes cardout { 0% { transform: translateY(160px) scale(.15) rotate(-20deg); opacity: 0; } 60% { opacity: 1; } }
.rinner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; animation: flip .8s .25s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes flip { from { transform: rotateY(180deg); } to { transform: rotateY(0deg); } }
.rback, .rfront { position: absolute; inset: 0; border-radius: 16px; border: 4px solid var(--ink); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.rback { transform: rotateY(180deg); background: repeating-linear-gradient(45deg, #3b3290 0 12px, #2a2457 12px 24px); box-shadow: inset 0 0 0 6px var(--gold); }
.rfront {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 12px;
  background: linear-gradient(#7a6bf0, #4b3cb8); box-shadow: 0 8px 0 var(--ink), 0 0 50px rgba(150, 140, 255, .6);
  font-family: var(--font);
}
.rcard.epic .rfront { background: linear-gradient(#c06bff, #6a2ac0); box-shadow: 0 8px 0 var(--ink), 0 0 60px rgba(210, 120, 255, .8); }
.rcard.legend .rfront { background: linear-gradient(#ffd36b, #e0742a); box-shadow: 0 8px 0 var(--ink), 0 0 80px rgba(255, 210, 90, .95); }
.rart { position: absolute; top: 2%; left: 0; right: 0; display: flex; justify-content: center; }
.rart canvas { width: 92%; }
.rfront b { font-size: 24px; text-shadow: 0 3px 0 var(--ink); position: relative; }
.rfront small { font-family: var(--body); font-weight: 900; font-size: 12px; opacity: .85; position: relative; }
.rn {
  position: absolute; top: 8px; right: 8px; font-family: var(--font); font-size: 20px; color: #fff; z-index: 1;
  background: var(--ink); padding: 2px 9px; border-radius: 10px;
}
.sumgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; width: 100%; max-width: 300px; }
.scard {
  position: relative; aspect-ratio: 3 / 4; border-radius: 12px; border: 3px solid var(--ink); overflow: hidden;
  background: linear-gradient(#7a6bf0, #4b3cb8); animation: cipop .25s backwards;
}
.scard.epic { background: linear-gradient(#c06bff, #6a2ac0); }
.scard.legend { background: linear-gradient(#ffd36b, #e0742a); }
.scard canvas { position: absolute; top: 3%; left: 0; width: 100%; }
.scard small { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-family: var(--font); font-size: 13px; background: rgba(0, 0, 0, .5); padding: 3px 0; }
.scard .rn { font-size: 14px; top: 4px; right: 4px; padding: 1px 6px; }
.demo { font-size: 12px; opacity: .75; text-align: center; }
/* Accueil : l'illustration prend la place restante, pour que JOUER soit toujours visible sans défiler. */
#pagePlay #hero { flex: 1 1 0; min-height: 90px; max-height: 260px; aspect-ratio: auto; height: auto; }
#pagePlay .logo { flex: none; margin-top: -6px; }
#pagePlay .arena, #pagePlay .panel { flex: none; }
.mtop .mres .pill { width: auto; min-width: 0; flex: none; }
.mtop .mprofile { min-width: 0; overflow: hidden; }
.mtop .mprofile b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 96px; display: block; }

/* ---------- Bâtiments sur le côté droit (plus d'onglet « Bâtir ») ---------- */
.buildbar {
  position: absolute; right: 6px; top: 50%; transform: translateY(-56%); display: flex; flex-direction: column; gap: 6px;
  padding: 5px; border-radius: 16px; background: rgba(20, 16, 50, .55); border: 2px solid rgba(29, 27, 46, .8);
}
.bbtn {
  position: relative; width: 52px; height: 58px; padding: 0; border-radius: 12px; border: 3px solid var(--ink); cursor: pointer;
  background: linear-gradient(#5fd38a, #23885a); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .3), 0 3px 0 var(--ink);
  overflow: hidden; font-family: var(--font); color: #fff; transition: transform .1s;
}
.bbtn canvas { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); width: 58px; height: 58px; z-index: 1; }
.bbtn .bc {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; background: rgba(0, 0, 0, .55); padding: 1px 0;
}
.bbtn .bc b { font-weight: 400; }
.bbtn .bc .coin { width: 9px; height: 9px; border-width: 1px; }
.bbtn .bt { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(255, 210, 63, .25); z-index: 0; }
.bbtn.vassal { background: linear-gradient(#ffcf5a, #c98a1e); }
.bbtn.vassal .em { position: absolute; top: 8px; left: 0; right: 0; text-align: center; font-size: 22px; }
.bbtn.poor { filter: grayscale(.85) brightness(.7); }
.bbtn.sel { transform: translateX(-6px) scale(1.08); outline: 3px solid #fff; }
#banner small { font-family: var(--body); font-weight: 900; font-size: 11px; opacity: .8; }
/* La colonne s'adapte à la hauteur : elle tient entre la barre du haut et les cartes, même sur petit écran. */
.buildbar { top: 108px; transform: none; }
.bbtn { --bh: min(58px, calc((100dvh - 332px) / 6)); height: var(--bh); width: calc(var(--bh) * .9); }
.bbtn canvas { width: var(--bh); height: var(--bh); }

/* ---------- Cartes illustrées : cadre posé par-dessus l'illustration ---------- */
.cart { position: absolute; inset: 0; background-size: cover; background-position: center 32%; z-index: 0; }
.art { --ring: #cfd6ff; }
.art.r-epic { --ring: #e3a6ff; }
.art.r-legend { --ring: #ffd36b; }
.art::after {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(rgba(10, 6, 30, .25), transparent 22%, transparent 58%, rgba(10, 6, 30, .9));
}
.art::before {
  content: ''; position: absolute; inset: 2px; z-index: 2; pointer-events: none; border-radius: 7px;
  border: 2px solid var(--ring); box-shadow: inset 0 0 10px rgba(0, 0, 0, .45);
}
.art.r-legend::before { border-width: 2px; box-shadow: inset 0 0 12px rgba(255, 190, 60, .6); }
.dcard.art .nm, .scard.art small { background: none; text-shadow: 0 2px 0 var(--ink), 0 0 6px rgba(0, 0, 0, .8); font-size: 11px; z-index: 3; }
.dcard.art .pt, .card.art .pt { z-index: 3; }
.card.art .cost, .offer.art .price { z-index: 3; }
.mc.art::before { inset: 1px; border-width: 1px; border-radius: 5px; }
.mc.art .cart { background-position: center 30%; }
/* Carte révélée dans le coffre */
.rfront.art { overflow: hidden; }
.rfront.art .rart { display: none; }
.rfront.art b, .rfront.art small, .rfront.art .rn { z-index: 3; }
.rfront.art::before { border-radius: 10px; inset: 4px; border-width: 3px; }
/* Fiche de carte (appui long) */
.ci .ciart.art {
  position: relative; height: 210px; margin: 0 0 8px; border-radius: 12px; overflow: hidden; border: 3px solid var(--ink);
}
.ci .ciart.art::before { border-radius: 9px; }
.ci .ciart.art::after { background: linear-gradient(transparent 70%, rgba(10, 6, 30, .55)); }
/* Deck de bâtiments */
.bcard { background: linear-gradient(#5fd38a, #23885a); }
.bcard canvas { top: -2%; }
.bcard .bcost {
  position: absolute; top: 3px; right: 3px; z-index: 1; display: flex; align-items: center; gap: 2px; font-size: 10px;
  background: rgba(0, 0, 0, .5); padding: 1px 4px; border-radius: 6px;
}
.bcard .bcost .coin { width: 9px; height: 9px; border-width: 1px; }

/* ---------- Colonne d'infos à gauche (les bâtiments sont à droite) : ne cache plus le centre du jeu ---------- */
#toasts {
  left: 6px; right: auto; bottom: 204px; width: min(54%, 215px); max-height: 48%; overflow: hidden;
  flex-direction: column-reverse; align-items: stretch; gap: 5px;
}
.toast {
  font-size: 11px; line-height: 1.25; padding: 6px 8px; border-radius: 10px; justify-content: flex-start; text-align: left;
  gap: 5px; animation: slidein .22s ease-out;
}
.toast span { flex: 1 1 100%; }
.toast .btn.small { font-size: 11px; padding: 3px 8px; border-radius: 8px; }
.toast.indep { background: rgba(70, 40, 120, .95); border: 1px solid #c9a2ff; }
.toast.help { background: rgba(150, 40, 40, .95); border: 1px solid #ffb0a0; }
.toast.err { font-size: 11px; }
@keyframes slidein { from { transform: translateX(-30px); opacity: 0; } }

/* ---------- Mana (le chiffre violet des cartes) ---------- */
.manabar { display: flex; align-items: center; gap: 6px; padding: 0 4px 6px; }
.mdrop {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center; font-family: var(--font); font-size: 17px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; border: 2px solid var(--ink); text-shadow: 0 2px 0 var(--ink);
  background: radial-gradient(circle at 35% 30%, #f1c6ff, #c04dff 50%, #7a1fd0);
}
.mtrack {
  flex: 1; height: 14px; border-radius: 8px; border: 2px solid var(--ink); background: rgba(0, 0, 0, .45); overflow: hidden; position: relative;
}
.mtrack::after {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(20, 10, 40, .7) calc(10% - 2px) 10%);
}
.mfill { height: 100%; background: linear-gradient(#e59bff, #a43cf0); transition: width .2s linear; }
.card .pt { background: radial-gradient(circle at 35% 30%, #f1c6ff, #c04dff 55%, #7a1fd0); width: 18px; height: 18px; font-size: 11px; }
.card.nomana { filter: grayscale(.7) brightness(.7); }
.card.nomana .pt { animation: none; filter: grayscale(0); }
/* Cartes de monstres : plus de prix en or (coût en mana seulement), le nom à la place. */
#cards .card .cost { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; text-align: center; }
#cards .card .bar2 { background: #d47bff; }

/* ---------- Recherche de joueurs ---------- */
.matchmaking {
  position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(circle at 50% 40%, #3b2d8f, #0d0a26 75%); animation: fadein .2s;
}
.mm-box { width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.mm-ring {
  width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; font-size: 44px; position: relative;
  background: radial-gradient(circle, #4b3cb8 55%, transparent 56%);
}
.mm-ring::before {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  border: 6px solid transparent; border-top-color: var(--gold); border-right-color: #ff9d4d; animation: mmspin 1s linear infinite;
}
@keyframes mmspin { to { transform: rotate(360deg); } }
.mm-title { font-family: var(--font); font-weight: 400; font-size: 28px; margin: 4px 0 0; color: var(--gold); text-shadow: 0 3px 0 var(--ink); }
.mm-count { font-family: var(--font); font-size: 18px; }
.mm-count b { font-weight: 400; color: var(--gold); font-size: 24px; }
.mm-slots { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; width: 100%; }
.mm-slot {
  aspect-ratio: 1; border-radius: 10px; border: 2px dashed rgba(255, 255, 255, .25); display: grid; place-items: center;
  font-style: normal; font-size: 16px; animation: mmpulse 1.2s ease-in-out infinite;
}
.mm-slot.me { border: 3px solid var(--ink); background: var(--c); animation: none; box-shadow: 0 0 12px var(--c); }
.mm-slot.bot { border: 2px solid var(--ink); background: linear-gradient(#6c63c9, #3b3290); animation: cipop .25s; }
@keyframes mmpulse { 50% { border-color: rgba(255, 255, 255, .55); } }
.mm-status { font-size: 13px; opacity: .85; margin: 4px 0 0; min-height: 34px; }
.mm-lvl { font-size: 13px; margin: 0; }
.mm-lvl b { color: var(--gold); }
.mm-list { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
.mm-row {
  display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 900; padding: 3px 6px; border-radius: 8px;
  background: rgba(0, 0, 0, .3); min-width: 0; height: 24px;
}
.mm-row i { flex: none; width: 10px; height: 10px; border-radius: 3px; border: 1px solid var(--ink); background: var(--c, #555); }
.mm-row span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.mm-row b { flex: none; color: var(--gold); font-size: 10px; }
.mm-row.empty { opacity: .35; animation: mmpulse 1.2s ease-in-out infinite; }
.mm-row.empty i { background: transparent; border-style: dashed; }
.mm-row.in { animation: slidein .25s ease-out; }
.mm-row.me { grid-column: span 2; background: rgba(255, 210, 63, .18); border: 2px solid var(--gold); font-size: 13px; height: 28px; }
/* Rotation des cartes : la suivante, plus petite, à gauche ; une carte qui arrive en main glisse depuis elle. */
#cards { align-items: end; }
.card.next { opacity: .85; transform: scale(.92); transform-origin: bottom; cursor: default; filter: saturate(.8); }
.card.next .nl {
  position: relative; z-index: 3; width: 100%; text-align: center; font-size: 9px; background: rgba(0, 0, 0, .6); padding: 2px 0;
}
.card.drawn { animation: cardin .28s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes cardin { from { transform: translateX(-30px) scale(.7); opacity: 0; } }

/* ---------- Cartes à personnage détouré : décor de carte par rareté, personnage par-dessus ---------- */
.art.cutout { --bg1: #8a9bff; --bg2: #3b3fb4; --glow: rgba(190, 210, 255, .75); }
.art.cutout.r-epic { --bg1: #d27bff; --bg2: #5a1fa8; --glow: rgba(240, 190, 255, .8); }
.art.cutout.r-legend { --bg1: #ffd36b; --bg2: #c2501b; --glow: rgba(255, 240, 170, .9); }
.art.cutout, .ciart.art.cutout {
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, var(--glow), transparent 70%),
    repeating-conic-gradient(from 0deg at 50% 45%, rgba(255, 255, 255, .07) 0deg 10deg, transparent 10deg 20deg),
    linear-gradient(var(--bg1), var(--bg2));
}
/* Pas d'ombre portée : sur les images qui touchent les bords (skins), elle dessinait une bande sombre le long du rognage. */
.cart.cut { background-size: auto 96%; background-position: center 92%; background-repeat: no-repeat; }
/* ombre au sol sous le personnage */
.art.cutout .cart.cut::before {
  content: ''; position: absolute; left: 22%; right: 22%; bottom: 5%; height: 8%; border-radius: 50%;
  background: radial-gradient(rgba(0, 0, 0, .45), transparent 70%); z-index: -1;
}
.art.cutout::after { background: linear-gradient(transparent 62%, rgba(10, 6, 30, .85)); }
.mc.art.cutout .cart.cut { background-size: auto 100%; background-position: center bottom; }
.ci .ciart.art.cutout .cart.cut { background-size: auto 104%; background-position: center 80%; }
.rcard .rfront.art.cutout {
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, var(--glow), transparent 70%),
    repeating-conic-gradient(from 0deg at 50% 45%, rgba(255, 255, 255, .07) 0deg 10deg, transparent 10deg 20deg),
    linear-gradient(var(--bg1), var(--bg2));
}
/* Zoom sur le personnage (buste et tête, comme les cartes de Clash) : on garde le haut du corps. */
.cart.cut { background-size: auto 132%; background-position: center 18%; }
.mc.art.cutout .cart.cut { background-size: auto 140%; background-position: center 15%; }
.ci .ciart.art.cutout .cart.cut { background-size: auto 125%; background-position: center 22%; }
.rcard .rfront.art.cutout .cart.cut { background-size: auto 122%; background-position: center 20%; }
.cart.cut::before { display: none; }
/* Zoom unique et modéré pour tous les personnages détourés, partout (chaque image est recadrée à la même hauteur). */
.cart.cut,
.mc.art.cutout .cart.cut,
.ci .ciart.art.cutout .cart.cut,
.rcard .rfront.art.cutout .cart.cut { background-size: auto 112%; background-position: center 28%; }
/* Mana plafonné à 5 : une case par point. */
.mtrack::after { background: repeating-linear-gradient(90deg, transparent 0 calc(20% - 2px), rgba(20, 10, 40, .7) calc(20% - 2px) 20%); }
/* Nombre d'exemplaires d'une carte dans le deck */
.dcard .cnt, .mc .cnt {
  position: absolute; top: 3px; right: 3px; z-index: 3; font-family: var(--font); font-size: 12px; color: #fff;
  background: var(--ink); border: 2px solid var(--gold); padding: 0 5px; border-radius: 8px;
}
.mc .cnt { font-size: 10px; padding: 0 3px; top: 1px; right: 1px; }
.deckslots { grid-template-columns: repeat(6, 1fr); }
/* Aperçu du deck sur l'accueil : vignettes de taille fixe (6 par ligne), même avec peu de cartes différentes. */
.deckmini { justify-content: flex-start; }
.deckmini .mc { flex: 0 0 calc((100% - 25px) / 6); }

/* ---------- Onglet Deck : cartes façon Clash ---------- */
#pageDeck .dhead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
#pageDeck .dhead b { font-family: var(--font); font-weight: 400; font-size: 18px; color: #fff; text-shadow: 0 2px 0 var(--ink); }
#pageDeck .dhead small { font-size: 11px; opacity: .7; }
#pageDeck .dhead .deckpts { float: none; font-family: var(--font); font-size: 15px; }
.dstats { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 900; }
.dstats b { font-family: var(--font); font-weight: 400; color: var(--gold); font-size: 14px; }
.dbar { flex: 1; height: 10px; border-radius: 6px; border: 2px solid var(--ink); background: rgba(0, 0, 0, .4); overflow: hidden; }
.dbar i { display: block; height: 100%; background: linear-gradient(#ffe066, #f5a623); transition: width .2s; }
#pageDeck .deckslots, #pageDeck .deckgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
#pageDeck .dcard {
  aspect-ratio: 3 / 4; border-radius: 12px; border: 3px solid var(--ink); opacity: 1; filter: none; overflow: visible;
  box-shadow: 0 4px 0 var(--ink); transition: transform .12s;
}
#pageDeck .dcard .cart { border-radius: 9px; }
#pageDeck .dcard.art::after, #pageDeck .dcard.art::before { border-radius: 9px; }
#pageDeck .dcard:active { transform: translateY(2px) scale(.97); }
/* Goutte de mana */
#pageDeck .dcard .pt {
  top: -7px; left: -7px; width: 26px; height: 30px; font-size: 15px; z-index: 4;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; border: 2px solid var(--ink);
  background: radial-gradient(circle at 35% 30%, #f1c6ff, #c04dff 55%, #7a1fd0); text-shadow: 0 2px 0 var(--ink);
}
/* Bandeau du nom */
#pageDeck .dcard .nm {
  left: 0; right: 0; bottom: 0; padding: 14px 2px 5px; font-size: 12px; z-index: 3; border-radius: 0 0 9px 9px;
  background: linear-gradient(transparent, rgba(10, 6, 30, .92) 55%); text-shadow: 0 2px 0 var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#pageDeck .dcard .cnt { top: -7px; right: -7px; font-size: 13px; z-index: 4; }
/* Collection : cartes vives ; celles déjà dans le deck brillent */
#pageDeck .deckgrid .dcard.on { box-shadow: 0 4px 0 var(--ink), 0 0 0 3px var(--gold), 0 0 14px rgba(255, 210, 63, .55); outline: none; transform: none; }
#pageDeck .deckgrid .dcard:not(.on):not(.locked) .cart { filter: saturate(.85); }
#pageDeck .deckslots .dcard.on { outline: none; transform: none; }
/* Case « + » */
#pageDeck .dcard.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: default;
  border: 3px dashed rgba(255, 255, 255, .3); background: rgba(0, 0, 0, .25); box-shadow: none;
}
#pageDeck .dcard.empty .plus { font-family: var(--font); font-size: 30px; color: rgba(255, 255, 255, .45); line-height: 1; }
#pageDeck .dcard.empty small { font-size: 11px; opacity: .6; font-weight: 900; }
/* Bâtiments et cartes à débloquer : même gabarit */
#pageDeck .bcard .bcost { z-index: 4; }
#pageDeck .dcard.locked { opacity: .85; }

/* ---------- Scène d'accueil : héros devant le château, ciel animé ---------- */
#pagePlay { background: linear-gradient(180deg, #2a2160, #1a1440 70%); }
#pagePlay #hero.hero {
  position: relative; width: 100%; max-width: 380px; overflow: hidden; border-radius: 18px; border: 3px solid var(--ink);
  box-shadow: 0 6px 0 var(--ink), 0 10px 30px rgba(0, 0, 0, .45); margin-top: 2px; isolation: isolate;
}
.h-sky { position: absolute; inset: 0; background: linear-gradient(#3b2a8f 0%, #8a4fd1 38%, #ff9a6b 72%, #ffcf86 100%); }
.h-rays {
  position: absolute; left: 50%; top: 58%; width: 260%; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, rgba(255, 240, 200, .22) 0deg 6deg, transparent 6deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 4%, transparent 45%); mask: radial-gradient(circle, #000 4%, transparent 45%);
  animation: hrays 40s linear infinite;
}
@keyframes hrays { to { transform: translate(-50%, -50%) rotate(360deg); } }
.h-cloud {
  position: absolute; height: 18%; width: 45%; border-radius: 50%; background: rgba(255, 230, 240, .5); filter: blur(6px);
  animation: hcloud linear infinite;
}
.h-cloud.c1 { top: 10%; animation-duration: 38s; }
.h-cloud.c2 { top: 26%; width: 34%; opacity: .7; animation-duration: 55s; animation-delay: -20s; }
.h-cloud.c3 { top: 4%; width: 26%; opacity: .5; animation-duration: 70s; animation-delay: -45s; }
@keyframes hcloud { from { left: 110%; } to { left: -60%; } }
#heroDragon {
  position: absolute; top: 2%; width: 34%; aspect-ratio: 1; z-index: 1; animation: hdragon 16s linear infinite;
  filter: drop-shadow(0 6px 4px rgba(40, 10, 60, .35));
}
@keyframes hdragon {
  0% { left: 110%; transform: translateY(0) scale(.8); } 25% { transform: translateY(14%) scale(.85); }
  50% { transform: translateY(-4%) scale(.9); } 75% { transform: translateY(10%) scale(.85); } 100% { left: -45%; transform: translateY(0) scale(.8); }
}
.h-castle { position: absolute; left: 10%; right: 10%; bottom: 14%; width: 80%; height: 56%; z-index: 1; }
.h-castle .h-win { animation: hwin 3s ease-in-out infinite; }
@keyframes hwin { 50% { opacity: .65; } }
.h-castle .h-flags path { transform-box: fill-box; transform-origin: left center; animation: hflag 1.2s ease-in-out infinite; }
@keyframes hflag { 50% { transform: scaleX(.8) skewY(6deg); } }
.h-ground {
  position: absolute; left: -10%; right: -10%; bottom: -30%; height: 52%; border-radius: 50%; z-index: 2;
  background: radial-gradient(ellipse at 50% 20%, #8fdc6a, #4a9a3c 60%, #2f6b2a);
  box-shadow: 0 -6px 0 rgba(255, 255, 255, .12) inset;
}
.h-char { position: absolute; bottom: 2%; z-index: 3; filter: drop-shadow(0 6px 4px rgba(0, 0, 0, .45)); transform-origin: bottom center; }
.h-char.knight { left: 50%; height: 92%; margin-left: -24%; z-index: 4; animation: hbreath 3s ease-in-out infinite; }
.h-char.archer { left: 1%; height: 74%; animation: hbreath 3.4s ease-in-out infinite -1.1s; }
.h-char.mage { right: 1%; height: 76%; animation: hbreath 3.2s ease-in-out infinite -2s; }
@keyframes hbreath { 50% { transform: translateY(-2%) scale(1.015, .99); } }
.h-sparks { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.h-sparks i {
  position: absolute; bottom: -4%; width: 5px; height: 5px; border-radius: 50%; background: #fff3b0;
  box-shadow: 0 0 8px 2px rgba(255, 220, 120, .8); animation: hspark 5s linear infinite; opacity: 0;
}
.h-sparks i:nth-child(1) { left: 12%; animation-delay: 0s; } .h-sparks i:nth-child(2) { left: 28%; animation-delay: -1.2s; }
.h-sparks i:nth-child(3) { left: 44%; animation-delay: -2.6s; } .h-sparks i:nth-child(4) { left: 58%; animation-delay: -.6s; }
.h-sparks i:nth-child(5) { left: 70%; animation-delay: -3.3s; } .h-sparks i:nth-child(6) { left: 84%; animation-delay: -1.9s; }
.h-sparks i:nth-child(7) { left: 36%; animation-delay: -4.1s; } .h-sparks i:nth-child(8) { left: 92%; animation-delay: -2.2s; }
@keyframes hspark { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-260px) translateX(12px); opacity: 0; } }
.h-vignette { position: absolute; inset: 0; z-index: 6; pointer-events: none; box-shadow: inset 0 0 40px rgba(20, 8, 50, .55); }
#pagePlay .logo { margin-top: 6px; }
/* Bloc trophées compact (une ligne) : la scène d'accueil prend la place. */
#pagePlay .arena { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: baseline; column-gap: 10px; row-gap: 0; padding: 6px 10px; margin: 0 0 8px; }
#pagePlay .arena .troph { font-size: 24px; order: -1; }
#pagePlay .arena .troph .cup { font-size: 20px; }
#pagePlay .arena .league { font-size: 16px; }
#pagePlay .arena small { flex-basis: 100%; text-align: center; font-size: 11px; }
#pagePlay .logo { font-size: clamp(30px, 9vw, 44px); margin: 4px 0 6px; }
#pagePlay #hero.hero { max-height: 300px; }

/* ---------- Niveaux de cartes ---------- */
#pageDeck .dcard .lvl {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 22%; z-index: 4; white-space: nowrap;
  font-family: var(--font); font-size: 10px; padding: 0 6px; border-radius: 6px; border: 2px solid var(--ink);
  background: linear-gradient(#ffe066, #f5a623); color: var(--ink);
}
#pageDeck .deckslots .dcard .lvl { bottom: 24%; }
#pageDeck .dcard .cprog {
  position: absolute; left: 6%; right: 6%; bottom: -9px; height: 13px; z-index: 4; border-radius: 7px; overflow: hidden;
  border: 2px solid var(--ink); background: #2a2457; display: grid; place-items: center;
}
#pageDeck .dcard .cprog i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#7fd0ff, #3d7bff); }
#pageDeck .dcard .cprog.ready i { background: linear-gradient(#9dff8a, #2fa84a); width: 100% !important; }
#pageDeck .dcard .cprog b { position: relative; font-family: var(--font); font-weight: 400; font-size: 9px; text-shadow: 0 1px 0 var(--ink); }
#pageDeck .deckgrid { row-gap: 16px; }
#pageDeck .dcard .upg {
  position: absolute; top: 22%; right: -8px; z-index: 5; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 14px; border: 2px solid var(--ink); background: radial-gradient(circle at 35% 30%, #c9ff9a, #2fa84a); color: #fff;
  animation: upgpulse 1s ease-in-out infinite; text-shadow: 0 1px 0 var(--ink);
}
@keyframes upgpulse { 50% { transform: scale(1.18); } }
#pageDeck .dcard.upgradable { box-shadow: 0 4px 0 var(--ink), 0 0 0 3px #5dff7a, 0 0 14px rgba(93, 255, 122, .6); }
/* Fenêtre d'amélioration */
.modal.upgrade .panel { max-width: 320px; align-items: stretch; text-align: center; }
.ugart { position: relative; height: 170px; border-radius: 14px; overflow: hidden; border: 3px solid var(--ink); }
.ugart canvas { width: 140px; }
.uglvl { font-family: var(--font); font-size: 18px; }
.uglvl b { color: #7dff8a; font-weight: 400; }
.modal.upgrade .cistats em { font-style: normal; color: #7dff8a; }
.ugcost { display: flex; justify-content: space-around; font-weight: 900; font-size: 13px; }
.ugcost .ok { color: #7dff8a; } .ugcost .ko { color: #ff7b7b; }
.ugnote { font-size: 12px; opacity: .8; margin: 0; }
.modal.upgrade .btn[disabled] { filter: grayscale(1) brightness(.7); }
.modal.upgrade .panel.leveled { animation: leveled .8s ease-out; }
@keyframes leveled { 0% { box-shadow: 0 0 0 0 rgba(255, 230, 120, .9); transform: scale(1); } 30% { transform: scale(1.05); } 100% { box-shadow: 0 0 0 40px rgba(255, 230, 120, 0); transform: scale(1); } }
/* Récapitulatif du coffre */
.scard .slvl { position: absolute; top: 4px; left: 4px; z-index: 3; font-family: var(--font); font-size: 10px; background: linear-gradient(#ffe066, #f5a623); color: var(--ink); padding: 0 5px; border-radius: 6px; border: 2px solid var(--ink); }
.scard .sprog { position: absolute; left: 6%; right: 6%; bottom: 22px; height: 12px; z-index: 3; border-radius: 6px; overflow: hidden; border: 2px solid var(--ink); background: #2a2457; display: grid; place-items: center; }
.scard .sprog i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#7fd0ff, #3d7bff); }
.scard .sprog.ready i { background: linear-gradient(#9dff8a, #2fa84a); }
.scard .sprog b { position: relative; font-family: var(--font); font-weight: 400; font-size: 9px; }
.scard .sgold { position: absolute; bottom: 22px; left: 0; right: 0; text-align: center; z-index: 3; font-family: var(--font); color: var(--gold); }
.goldbox b { color: var(--gold) !important; }

/* Cartes du Deck épurées */
#pageDeck .dcard .cprog { bottom: -8px; height: 12px; }
#pageDeck .dcard .cprog b { font-size: 9px; }
#pageDeck .dcard .cnt { font-size: 11px; padding: 0 4px; }
#pageDeck .dcard .upg { top: auto; bottom: 8%; right: -8px; width: 22px; height: 22px; font-size: 12px; }
#pageDeck .deckslots .dcard .nm { padding-bottom: 6px; }

/* Titres de page (Mon deck, Boutique) : police plus « jeu », dorée */
.ptitle {
  font-family: 'Luckiest Guy', var(--font); font-size: 34px; letter-spacing: 1.5px; line-height: 1; margin: 6px 0 2px;
  color: #ffd84a; -webkit-text-stroke: 2px var(--ink);
  text-shadow: 0 3px 0 #c77d14, 0 6px 0 var(--ink), 0 8px 14px rgba(0, 0, 0, .45);
}
/* Titres de page simples, sans relief */
.ptitle {
  font-family: var(--body); font-weight: 900; font-size: 26px; letter-spacing: 0; line-height: 1.1; margin: 4px 0 0;
  color: #fff; -webkit-text-stroke: 0; text-shadow: none; align-self: flex-start; padding-left: 4px;
}

/* Collection et bâtiments : un seul contour (plus d'anneau doré) ; badge ✓ / ×n pour ce qui est dans le deck */
#pageDeck .deckgrid .dcard.on, #pageDeck .bcard.on { box-shadow: 0 4px 0 var(--ink); outline: none; }
#pageDeck .deckgrid .dcard:not(.on):not(.locked) { filter: brightness(.82); }
#pageDeck .deckgrid .dcard:not(.on):not(.locked) .cart { filter: none; }
#pageDeck .dcard .cnt { background: #2fa84a; border-color: var(--ink); }
#pageDeck .dcard.upgradable { box-shadow: 0 4px 0 var(--ink); }

/* Onglets des decks */
.decktabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.decktabs::-webkit-scrollbar { display: none; }
.dtab {
  flex: none; display: flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 10px; cursor: pointer;
  font-family: var(--font); font-size: 13px; color: #c9c2ff; background: rgba(0, 0, 0, .3); border: 2px solid var(--ink);
}
.dtab.on { color: #fff; background: linear-gradient(#6c63c9, #3b3290); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .15); }
.dtab .ren { font-style: normal; font-size: 11px; }
.dtab.add { width: 32px; justify-content: center; font-size: 18px; color: var(--gold); }
#deckNameIn {
  width: 100%; font: 900 18px var(--body); color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 9px 12px;
}
#pageDeck .bcard .cnt { right: auto; left: -7px; }
/* Barre de niveau : posée par-dessus le bas de la carte (au premier plan), non rognée */
#pageDeck .dcard { overflow: visible; }
#pageDeck .dcard .cprog {
  bottom: -11px; height: 15px; z-index: 6; left: 4%; right: 4%;
  box-shadow: 0 2px 0 var(--ink), 0 3px 6px rgba(0, 0, 0, .5);
}
#pageDeck .dcard .cprog b { font-size: 10px; }
#pageDeck .deckgrid { row-gap: 20px; padding-bottom: 8px; }

/* ---------- Classe du monstre (fiche au maintien) ---------- */
.ciclass {
  position: absolute; top: 8px; right: 8px; z-index: 4; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  font-size: 20px; background: radial-gradient(circle at 35% 30%, #fff8, var(--cc) 60%); border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
}
.ciart { position: relative; }
.ciclassrow {
  display: flex; align-items: center; gap: 8px; margin: 8px 0 6px; padding: 6px 8px; border-radius: 12px; text-align: left;
  background: linear-gradient(90deg, color-mix(in srgb, var(--cc) 45%, transparent), rgba(0, 0, 0, .25)); border: 2px solid var(--ink);
}
.ciclassrow .ico {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 18px;
  background: var(--cc); border: 2px solid var(--ink);
}
.ciclassrow b { display: block; font-family: var(--font); font-weight: 400; font-size: 16px; }
.ciclassrow small { display: block; font-size: 11px; opacity: .9; line-height: 1.25; }
.citraits { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin: 2px 0 8px; }
.citraits span { font-size: 11px; font-weight: 900; padding: 2px 7px; border-radius: 8px; background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .15); }
/* Fiche compacte : tient sur l'écran, même sur un petit téléphone */
.cardinfo { padding: 10px 14px; }
.ci { padding: 10px; max-height: 100%; overflow: hidden; }
.ci .ciart.art, .ci .ciart { height: min(150px, 19vh); margin-top: 0; }
.ciart canvas { width: auto; height: 100%; margin-top: 0; }
.cihead b { font-size: 22px; }
.ciclassrow { margin: 6px 0 4px; padding: 5px 7px; }
.citraits { margin: 2px 0 6px; }
.cistats { grid-template-columns: repeat(3, 1fr); gap: 4px; }
.cistats div { grid-template-columns: 18px 1fr; padding: 4px 5px; }
.cistats span { font-size: 14px; }
.cistats b { font-size: 13px; }
.cistats small { font-size: 9px; }
.lbtoggle.center { left: 52px; }

/* ---------- Cadres selon la rareté ---------- */
@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
/* Épique : double liseré violet lumineux */
.art.r-epic::before {
  border: 3px solid #d08cff; box-shadow: inset 0 0 0 2px #5a1fa8, inset 0 0 14px rgba(200, 120, 255, .65);
}
/* Légendaire : bordure arc-en-ciel dorée qui tourne + halo */
.art.r-legend::before {
  inset: 0; border: none; padding: 4px; border-radius: inherit;
  background: conic-gradient(from var(--ang), #fff3a8, #ffb340, #ff5fa2, #9b7bff, #5ff0ff, #9dff8a, #fff3a8);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: legendSpin 3.5s linear infinite; box-shadow: none;
}
@keyframes legendSpin { to { --ang: 360deg; } }
#pageDeck .dcard.art.r-legend, #cards .card.art.r-legend, .scard.art.r-legend, .offer.art.r-legend {
  box-shadow: 0 4px 0 var(--ink), 0 0 12px rgba(255, 200, 90, .75), 0 0 22px rgba(255, 120, 220, .35);
}
.rcard.legend .rfront.art::before { padding: 6px; }
.ci .ciart.art.r-legend { box-shadow: 0 0 18px rgba(255, 200, 90, .7); }
/* Petite couronne au-dessus des cartes légendaires du deck et de la collection */
#pageDeck .dcard.art.r-legend .nm::before { content: '👑 '; font-size: 10px; }

/* ---------- Skins ---------- */
/* Badge ✨ sur les cartes portant un skin (élément à part : ne pas toucher au ::after, qui porte le voile de la carte) */
.skinbadge {
  position: absolute; right: 3px; bottom: 22%; z-index: 4; font-size: 13px; line-height: 1;
  filter: drop-shadow(0 1px 0 var(--ink)); pointer-events: none;
}
.ciskins { margin-top: 10px; }
.ciskins > small { display: block; font-size: 11px; font-weight: 900; opacity: .85; margin-bottom: 5px; text-align: center; }
.ciskins .row { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; }
.ciskins .sk {
  position: relative; flex: 0 0 70px; height: 92px; border-radius: 10px; border: 2px solid var(--ink); padding: 0;
  background: linear-gradient(#5b4aa8, #2d2366); overflow: hidden; display: flex; align-items: flex-end; justify-content: center;
  color: #fff; font: inherit;
}
.ciskins .sk canvas, .ciskins .sk .cart { position: absolute; inset: 0; width: 100%; height: 100%; }
.ciskins .sk .nm {
  position: relative; z-index: 3; font-size: 9px; font-weight: 900; line-height: 1.1; padding: 2px 3px 3px; width: 100%;
  background: linear-gradient(transparent, rgba(0, 0, 0, .75)); text-align: center;
}
.ciskins .sk.on { border-color: #ffe14a; box-shadow: 0 0 0 2px #ffe14a, 0 0 12px rgba(255, 225, 74, .7); }
.ciskins .sk.on::before { content: '✓'; position: absolute; top: 2px; left: 4px; z-index: 4; font-weight: 900; color: #ffe14a; }
.ciskins .sk.locked .cart, .ciskins .sk.locked canvas { filter: grayscale(1) brightness(.45) !important; }
.ciskins .sk .skinbadge, .scard.skin .skinbadge { display: none; }
.ciskins .sk .lock { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); z-index: 4; font-size: 20px; }
/* Révélation d'un skin dans un coffre : carte arc-en-ciel */
.rcard.skin .rfront {
  background: conic-gradient(from var(--ang), #ff6ad5, #ffd36b, #6bffb8, #6bc8ff, #c78bff, #ff6ad5);
  animation: legendSpin 2.5s linear infinite; box-shadow: 0 8px 0 var(--ink), 0 0 90px rgba(255, 140, 240, .95);
}
.rcard.skin .skintag {
  position: relative; z-index: 3; font-family: var(--font); font-size: 15px; letter-spacing: 2px; color: #fff;
  text-shadow: 0 2px 0 var(--ink), 0 0 12px #ff6ad5;
}
.copen.skinflash .rays { filter: hue-rotate(90deg) saturate(2); }
.scard.skin { background: conic-gradient(#ff6ad5, #ffd36b, #6bffb8, #6bc8ff, #c78bff, #ff6ad5); }
/* Fiche de carte épinglée dans le menu (pour choisir un skin) */
.cardinfo.pinned { pointer-events: auto; }
.ciclose {
  position: absolute; top: 4px; left: 4px; z-index: 30; width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--ink); background: linear-gradient(#ff7a6b, #d63a3a); color: #fff; font-weight: 900; font-size: 16px;
  box-shadow: 0 3px 0 var(--ink);
}
.rcard.skin .rfront.art { justify-content: flex-end; padding-bottom: 10px; }
.rcard.skin .rfront.art b { font-size: 20px; line-height: 1.05; }
.rcard.skin .rfront.art .skintag { margin-bottom: 2px; }

/* ---------- Accueil « Jouer » : emblème de la ligue ---------- */
.league-hero { --lg1: #e8a26a; --lg2: #8a4a22; --lgc: #e0a06a; }
.league-hero .h-sky { background: radial-gradient(circle at 50% 48%, color-mix(in srgb, var(--lgc) 55%, #3a2a8a), #241a5c 62%, #150f3a); }
.league-hero .h-rays { top: 46%; filter: drop-shadow(0 0 0 var(--lgc)); opacity: .9; }
.lg-badge {
  position: absolute; left: 50%; top: 47%; z-index: 3; width: min(78%, 270px); aspect-ratio: 300 / 240;
  transform: translate(-50%, -50%); animation: lgfloat 4s ease-in-out infinite;
  filter: drop-shadow(0 10px 10px rgba(10, 6, 30, .55)) drop-shadow(0 0 22px color-mix(in srgb, var(--lgc) 60%, transparent));
}
@keyframes lgfloat { 50% { transform: translate(-50%, -54%); } }
.lg-crest { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lg-wings path:first-child { transform-origin: 96px 110px; animation: lgwingL 4s ease-in-out infinite; }
.lg-wings path:last-child { transform-origin: 204px 110px; animation: lgwingR 4s ease-in-out infinite; }
@keyframes lgwingL { 50% { transform: rotate(-5deg); } }
@keyframes lgwingR { 50% { transform: rotate(5deg); } }
.lg-shine { animation: lgshine 3.5s ease-in-out infinite; }
@keyframes lgshine { 0%, 60% { opacity: 0; } 75% { opacity: 1; } 100% { opacity: 0; } }
.lg-icon {
  position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); font-size: clamp(34px, 12vw, 58px);
  filter: drop-shadow(0 3px 0 rgba(20, 12, 50, .6));
}
.lg-ribbon {
  position: absolute; left: 50%; bottom: -6%; transform: translateX(-50%); white-space: nowrap;
  padding: 4px 18px 5px; border: 3px solid var(--ink); border-radius: 10px;
  background: linear-gradient(var(--lg1), var(--lg2)); box-shadow: 0 4px 0 var(--ink);
}
.lg-ribbon b { font-family: var(--font); font-weight: 400; font-size: clamp(15px, 4.6vw, 20px); color: #fff; text-shadow: 0 2px 0 var(--ink); }
/* Barre de progression vers la ligue suivante */
.lg-prog {
  width: min(100%, 260px); height: 10px; border-radius: 6px; border: 2px solid var(--ink); background: rgba(0, 0, 0, .45); overflow: hidden;
}
.lg-prog i { display: block; height: 100%; width: 0; background: linear-gradient(#ffe680, #f5a623); transition: width .4s; }
#pagePlay .arena .lg-prog { order: 0; flex-basis: 100%; margin: 3px auto 2px; }

/* ---------- Écran de chargement ---------- */
.boot {
  position: absolute; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 24px; overflow: hidden; text-align: center;
  background: radial-gradient(circle at 50% 40%, #6a4ad0, #2a1d6e 55%, #120c34);
  transition: opacity .5s ease, transform .5s ease;
}
.boot.done { opacity: 0; transform: scale(1.06); pointer-events: none; }
.boot-rays {
  position: absolute; left: 50%; top: 38%; width: 240%; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, rgba(255, 230, 160, .16) 0deg 7deg, transparent 7deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 5%, transparent 45%); mask: radial-gradient(circle, #000 5%, transparent 45%);
  animation: hrays 30s linear infinite;
}
.boot-crest {
  position: relative; width: min(62%, 230px); aspect-ratio: 300 / 240; animation: bootfloat 3s ease-in-out infinite;
  filter: drop-shadow(0 10px 10px rgba(10, 6, 30, .55)) drop-shadow(0 0 24px rgba(255, 210, 90, .55));
}
@keyframes bootfloat { 50% { transform: translateY(-6%); } }
.boot-crest svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.boot-crest .bw-l { transform-origin: 96px 110px; animation: lgwingL 1.6s ease-in-out infinite; }
.boot-crest .bw-r { transform-origin: 204px 110px; animation: lgwingR 1.6s ease-in-out infinite; }
.boot-icon { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); font-size: clamp(34px, 11vw, 54px); }
.boot-logo { position: relative; font-family: var(--font); font-weight: 400; color: var(--gold); margin: 6px 0 4px;
  font-size: clamp(34px, 10vw, 50px); letter-spacing: 2px; text-shadow: 0 3px 0 #b8741a, 0 6px 0 var(--ink); }
.boot-logo span { font-size: .5em; color: #fff; }
.boot-bar {
  position: relative; width: min(76%, 280px); height: 16px; border-radius: 10px; border: 3px solid var(--ink);
  background: rgba(0, 0, 0, .45); overflow: hidden; box-shadow: 0 3px 0 var(--ink);
}
.boot-bar i {
  display: block; height: 100%; width: 0; transition: width .25s ease;
  background: linear-gradient(#ffe680, #f5a623); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18);
}
.boot-pct { position: relative; font-family: var(--font); font-size: 16px; color: #fff; text-shadow: 0 2px 0 var(--ink); }
.boot-tip { position: relative; max-width: 300px; margin: 8px 0 0; font-size: 13px; font-weight: 900; opacity: .85; line-height: 1.35; }

/* ---------- Écusson (paramètres) ---------- */
.lbl-hint { font-weight: 700; opacity: .65; font-size: 11px; margin-left: 4px; }
.crestbox { display: flex; gap: 10px; align-items: center; margin: 4px 0 6px; }
#crestPreview { width: 96px; height: 116px; flex: none; filter: drop-shadow(0 4px 0 rgba(10, 6, 30, .5)); }
.crestopts { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.crestrow { display: flex; gap: 5px; flex-wrap: wrap; }
.crestrow button {
  width: 38px; height: 38px; padding: 0; border-radius: 9px; border: 2px solid var(--ink); background: rgba(0, 0, 0, .3);
  display: flex; align-items: center; justify-content: center;
}
.crestrow button canvas { width: 32px; height: 32px; }
.crestrow.colors.small button { width: 28px; height: 28px; border-radius: 50%; }
.crestrow button.on, .crestsyms button.on { border-color: #ffe14a; box-shadow: 0 0 0 2px #ffe14a; }
.crestsyms { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; margin-bottom: 10px; }
.crestsyms button {
  aspect-ratio: 1; padding: 0; border-radius: 9px; border: 2px solid var(--ink); background: rgba(0, 0, 0, .3); font-size: 18px; line-height: 1;
}
#settings .panel { max-height: 92%; overflow-y: auto; }
/* Fiche d'une carte : aucun voile sombre sur l'illustration (pas de texte dessus) ; il s'arrêtait net au milieu de l'image. */
.ci .ciart.art::after, .ci .ciart.art.cutout::after { display: none; }
/* … et l'illustration reste à l'intérieur du liseré : plus de personnage coupé net dans la bande entre liseré et bordure. */
.ci .ciart.art .cart { inset: 5px; border-radius: 8px; }
/* Plus de voile sombre en bas des cartes : les noms restent lisibles grâce à leur contour. */
.art::after, .art.cutout::after { display: none; }
/* Nom des cartes sans bandeau sombre : un contour épais suffit à le rendre lisible sur l'illustration. */
#pageDeck .dcard .nm, .dcard .nm, .rfront.art b, .scard small, #cards .card .nm, .ciskins .sk .nm {
  background: none;
  text-shadow: -1.5px -1.5px 0 var(--ink), 1.5px -1.5px 0 var(--ink), -1.5px 1.5px 0 var(--ink), 1.5px 1.5px 0 var(--ink), 0 2.5px 0 var(--ink);
}

/* ---------- Cartes à débloquer (set de base) ---------- */
.dcard.locked .cart, .dcard.locked canvas { filter: grayscale(1) brightness(.45) !important; }
.dcard.locked .lockico {
  position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); z-index: 4; font-size: 22px;
  filter: drop-shadow(0 2px 0 var(--ink));
}
.dcard.locked .nm { color: #b8b2d8; }
.newtag {
  position: relative; z-index: 3; margin-bottom: 4px; padding: 2px 10px; border-radius: 8px; border: 2px solid var(--ink);
  background: linear-gradient(#ffe680, #f5a623); color: #3a2400; font-family: var(--font); font-size: 14px; letter-spacing: 1px;
  animation: newpulse .8s ease-in-out infinite alternate;
}
@keyframes newpulse { to { transform: scale(1.1); } }
.rcard.bld .rfront { background: linear-gradient(#5fd38a, #23885a); box-shadow: 0 8px 0 var(--ink), 0 0 60px rgba(120, 255, 170, .7); }
.scard.bld { background: linear-gradient(#5fd38a, #23885a); }
.scard.bld canvas { width: 100%; height: auto; }

/* ---------- Révélations légendaire et skin ---------- */
.efx { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.copen .reveal { z-index: 3; }
.efx .veil { position: absolute; inset: 0; background: #000; opacity: 0; animation: efxveil 1.7s ease forwards; }
.efx.skin .veil { animation-duration: 2.8s; }
@keyframes efxveil { 0% { opacity: 0; } 20% { opacity: .85; } 55% { opacity: .85; } 100% { opacity: .25; } }
.efx .beams {
  position: absolute; left: 50%; top: 45%; width: 220vmax; height: 220vmax; transform: translate(-50%, -50%) scale(0);
  background: repeating-conic-gradient(from 0deg, rgba(255, 215, 90, .55) 0deg 4deg, transparent 4deg 15deg);
  -webkit-mask: radial-gradient(circle, #000 0%, transparent 42%); mask: radial-gradient(circle, #000 0%, transparent 42%);
  animation: efxbeam 1.7s cubic-bezier(.3, 1.2, .4, 1) forwards, efxspin 6s linear infinite;
}
.efx .beams.b2 { opacity: .6; animation-direction: normal, reverse; animation-duration: 1.7s, 9s; }
.efx.skin .beams { background: repeating-conic-gradient(from 0deg, #ff5fd2 0deg 5deg, transparent 5deg 12deg, #6bc8ff 12deg 17deg, transparent 17deg 24deg, #ffd34a 24deg 29deg, transparent 29deg 36deg, #6bffb8 36deg 41deg, transparent 41deg 48deg);
  animation-duration: 2.8s, 3s; }
@keyframes efxbeam { 0% { transform: translate(-50%, -50%) scale(0); } 45% { transform: translate(-50%, -50%) scale(.15); } 70% { transform: translate(-50%, -50%) scale(1.15); } 100% { transform: translate(-50%, -50%) scale(1); } }
@keyframes efxspin { to { rotate: 360deg; } }
.efx .ring {
  position: absolute; left: 50%; top: 45%; width: 40px; height: 40px; margin: -20px; border-radius: 50%;
  border: 6px solid var(--c); box-shadow: 0 0 30px var(--c); opacity: 0; animation: efxring .9s ease-out var(--d) forwards;
}
.efx.skin .ring { animation-duration: 1.2s; --d2: 0s; }
.efx.skin .ring { animation-delay: calc(var(--d) + .6s); }
@keyframes efxring { 0% { opacity: 1; transform: scale(.2); } 100% { opacity: 0; transform: scale(22); } }
.efx i {
  position: absolute; left: 50%; top: 45%; width: var(--s); height: var(--s); border-radius: 2px; background: var(--c);
  box-shadow: 0 0 8px var(--c); opacity: 0; animation: efxpart 1.4s cubic-bezier(.1, .8, .3, 1) var(--d) forwards;
}
@keyframes efxpart { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 260px)) rotate(720deg); } }
.efx .star { position: absolute; left: var(--x); top: var(--y); color: #fff; font-size: 26px; text-shadow: 0 0 12px #fff, 0 0 24px #ff5fd2;
  opacity: 0; animation: efxstar 1s ease-in-out var(--d) infinite; }
@keyframes efxstar { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0); } 50% { opacity: 1; transform: scale(1.3) rotate(90deg); } }
.efx .banner {
  position: absolute; left: 50%; top: 13%; transform: translateX(-50%) scale(0); white-space: nowrap;
  font-family: var(--font); font-size: clamp(24px, 8vw, 36px); color: #ffe680; letter-spacing: 2px;
  text-shadow: 0 3px 0 #8a4a00, 0 6px 0 var(--ink), 0 0 30px #ffd34a; animation: efxbanner .7s cubic-bezier(.2, 1.6, .4, 1) .9s forwards;
}
.efx.skin .banner {
  animation-delay: 1.5s; background: linear-gradient(90deg, #ff5fd2, #ffd34a, #6bffb8, #6bc8ff, #c78bff, #ff5fd2); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none;
  filter: drop-shadow(0 3px 0 var(--ink)) drop-shadow(0 0 18px #fff); animation: efxbanner .8s cubic-bezier(.2, 1.6, .4, 1) 1.5s forwards, efxrainbow 1.5s linear infinite;
}
@keyframes efxbanner { to { transform: translateX(-50%) scale(1); } }
@keyframes efxrainbow { to { background-position: 200% 0; } }
.efx.settle .beams, .efx.settle .beams.b2 { opacity: .35; }
/* Carte légendaire : tourne sur elle-même en grossissant, puis s'impose */
.rcard.legend-in { animation: legendin 1.7s cubic-bezier(.25, 1, .3, 1) both; }
@keyframes legendin {
  0% { transform: translateY(80px) scale(.15) rotateY(0); filter: brightness(3); opacity: 0; }
  20% { opacity: 1; }
  55% { transform: translateY(-10px) scale(.8) rotateY(1080deg); filter: brightness(2.2); }
  72% { transform: scale(1.3) rotateY(1080deg); filter: brightness(1.6); }
  100% { transform: scale(1) rotateY(1080deg); filter: brightness(1); }
}
/* Carte skin : tombe du ciel en vrille avec une traînée arc-en-ciel */
.rcard.skin-in { animation: skinin 2.8s cubic-bezier(.3, 1, .3, 1) both; }
@keyframes skinin {
  0% { transform: translateY(-120vh) rotate(-40deg) scale(.4); filter: hue-rotate(0) brightness(3); opacity: 0; }
  12% { opacity: 1; }
  45% { transform: translateY(0) rotate(720deg) scale(.6); filter: hue-rotate(360deg) brightness(2.5); }
  58% { transform: scale(1.45) rotate(720deg); filter: hue-rotate(540deg) brightness(2); }
  70% { transform: scale(.9) rotate(720deg); }
  80% { transform: scale(1.12) rotate(720deg); filter: hue-rotate(720deg) brightness(1.3); }
  100% { transform: scale(1) rotate(720deg); filter: none; }
}
.copen.shake { animation: efxshake .45s linear; }
.copen.shakebig { animation: efxshake .25s linear 3; }
@keyframes efxshake { 0%, 100% { transform: none; } 20% { transform: translate(-8px, 5px); } 40% { transform: translate(7px, -6px); } 60% { transform: translate(-6px, -4px); } 80% { transform: translate(5px, 6px); } }
.rcard.coinc .rfront, .scard.coinc { background: linear-gradient(#ffe27a, #d68a1a); }
.rcard.coinc .rfront { box-shadow: 0 8px 0 var(--ink), 0 0 60px rgba(255, 210, 90, .8); }
.bigcoin { display: block; font-size: 72px; text-align: center; margin-top: 18%; filter: drop-shadow(0 4px 0 rgba(60, 30, 0, .5)); }
.scard.coinc .bigcoin { font-size: 40px; margin-top: 12%; }
/* Dos de carte : rien de la face (illustration de bâtiment, pièce…) ne doit transparaître pendant le retournement. */
.rfront { transform: translateZ(1px); }
.rfront *, .rback * { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.rback { transform: rotateY(180deg) translateZ(1px); }

/* ---------- Premier lancement (onboarding) ---------- */
.onboard {
  position: absolute; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 18px;
  background: radial-gradient(circle at 50% 30%, #5a3fc0, #1d1450 65%, #0e0a2a); animation: fadein .3s;
}
.obcard {
  width: 100%; max-width: 360px; max-height: 100%; overflow-y: auto; text-align: center; padding: 18px 16px 16px;
  background: linear-gradient(#3d2f8f, #241b5c); border: 4px solid var(--ink); border-radius: 22px; box-shadow: 0 8px 0 var(--ink), 0 0 50px rgba(150, 120, 255, .45);
  display: flex; flex-direction: column; gap: 12px; animation: cipop .25s cubic-bezier(.2, 1.6, .4, 1);
}
.obcard h2 { margin: 0; font-family: var(--font); font-weight: 400; font-size: 24px; line-height: 1.15; text-shadow: 0 3px 0 var(--ink); }
.obcard p { margin: 0; font-size: 14px; line-height: 1.4; opacity: .92; }
.obcard canvas#obCrest { width: 104px; height: 126px; margin: 0 auto; filter: drop-shadow(0 4px 0 rgba(10, 6, 30, .5)); }
.obcard .colors { justify-content: center; }
.obhero { font-size: 64px; line-height: 1; animation: obfloat 3s ease-in-out infinite; filter: drop-shadow(0 6px 0 rgba(10, 6, 30, .4)); }
@keyframes obfloat { 50% { transform: translateY(-8px); } }
.obcard select, .obcard input { width: 100%; box-sizing: border-box; }
.obcard .row { display: flex; gap: 8px; }
.obcard .row input { flex: 1; font: inherit; font-weight: 900; font-size: 18px; padding: 10px 12px; border-radius: 12px; border: 3px solid var(--ink); }
.oblogo { display: inline-block; margin-top: 4px; font-size: 40px; color: var(--gold); text-shadow: 0 3px 0 #b8741a, 0 6px 0 var(--ink); }
.oblogo small { font-size: .45em; color: #fff; }
.obdots { display: flex; gap: 6px; justify-content: center; }
.obdots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .25); }
.obdots i.done { background: #8f7cff; }
.obdots i.on { background: var(--gold); transform: scale(1.3); }
.obrules { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.obrules div { display: flex; gap: 10px; align-items: center; background: rgba(0, 0, 0, .25); border-radius: 12px; padding: 8px 10px; }
.obrules span { font-size: 26px; flex: none; }
.obrules p { font-size: 13px; }
.btn.gold { background: linear-gradient(#ffe680, #f5a623); color: #3a2400; }
.linkbtn.danger { color: #ff8f8f; margin-top: 10px; font-size: 13px; opacity: .85; background: none; border: 0; }
/* Carte inconnue : dos neutre avec un « ? », sans illustration ni cadre de rareté */
.dcard.unknown, .dcard.bcard.unknown {
  aspect-ratio: 3 / 4; background: repeating-linear-gradient(45deg, #2e2670 0 10px, #251f5c 10px 20px); border: 3px solid var(--ink);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .08); display: flex; align-items: center; justify-content: center;
}
.dcard.unknown .q { font-family: var(--font); font-size: 34px; color: rgba(255, 255, 255, .35); text-shadow: 0 3px 0 var(--ink); position: static; }
/* Menus : défilement vertical au doigt partout, y compris en partant d'une carte (Safari applique sinon le
   touch-action: none de la page). Le glissement horizontal reste géré par le code pour changer d'onglet. */
.page, .page *, .modal .panel, .modal .panel * { touch-action: pan-y; }
/* En partie, seule la carte (canvas) bloque les gestes du navigateur : déplacement et zoom gérés par le jeu. */
#hud, #game, #map { touch-action: none; }
#hud button, #hud input, #hud .hand, #hud .hand * { touch-action: manipulation; }
/* Probabilités d'un coffre */
.modal.odds .panel { max-width: 320px; }
.oddsub { text-align: center; font-size: 13px; opacity: .8; margin: -4px 0 10px; }
.oddrows, .oddextra { display: flex; flex-direction: column; gap: 6px; }
.oddrows div, .oddextra div { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 10px; border: 2px solid var(--ink); font-weight: 900; }
.oddrows b { font-family: var(--font); font-weight: 400; font-size: 20px; }
.oddrows .r-common { background: linear-gradient(#7a6bf0, #4b3cb8); }
.oddrows .r-epic { background: linear-gradient(#c06bff, #6a2ac0); }
.oddrows .r-legend { background: linear-gradient(#ffd36b, #e0742a); color: #3a1a00; }
.oddextra { margin: 10px 0; }
.oddextra div { background: rgba(0, 0, 0, .25); font-size: 13px; }
.oddextra b { color: var(--gold); }
/* Le défilement des onglets du menu est géré par le code (voir initTabs) : le navigateur ne doit pas s'en mêler. */
.page, .page * { touch-action: none; }
.page input, .page select, .page textarea { touch-action: manipulation; }
/* Offres du jour */
.otimer { font-weight: 700; opacity: .7; font-size: 11px; margin-left: 6px; }
.offer .ocount { position: absolute; top: 3px; left: 4px; z-index: 4; font-size: 14px; color: #fff; text-shadow: 0 2px 0 var(--ink); }
.offer .oname { position: absolute; left: 0; right: 0; bottom: 24px; z-index: 4; font-size: 12px; text-align: center; color: #fff;
  text-shadow: -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink), 1px 1px 0 var(--ink); }
.offer .price { color: #fff; z-index: 4; }
.offer .price .gem { width: 13px; height: 13px; }
.offer.mystery { background: linear-gradient(#ffd36b, #e0742a); }
.offer.mystery .q { position: absolute; inset: 0 0 22px; display: grid; place-items: center; font-size: 44px; color: rgba(255, 255, 255, .85); text-shadow: 0 3px 0 var(--ink); }
.offer.sold { filter: grayscale(.8) brightness(.7); }
.offer.sold .price { color: #7dff8a; }
/* Coffre gratuit quotidien */
.freechest {
  position: relative; width: 100%; max-width: 380px; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 16px;
  border: 3px solid var(--ink); background: linear-gradient(#4a4178, #2a2457); box-shadow: 0 4px 0 var(--ink); color: #fff; font: inherit; text-align: left;
  filter: grayscale(.5) brightness(.85);
}
.freechest.ready { filter: none; background: linear-gradient(#5fd38a, #23885a); animation: fcpulse 1.6s ease-in-out infinite; }
@keyframes fcpulse { 50% { box-shadow: 0 4px 0 var(--ink), 0 0 22px rgba(120, 255, 170, .7); } }
.freechest .fcart { width: 64px; height: 64px; flex: none; }
.freechest .fcart canvas { width: 64px; height: 64px; }
.freechest .fctxt { display: flex; flex-direction: column; gap: 2px; }
.freechest b { font-family: var(--font); font-weight: 400; font-size: 20px; text-shadow: 0 2px 0 var(--ink); }
.freechest small { font-size: 12px; font-weight: 900; opacity: .9; }
.freechest .fcbadge { position: absolute; top: -9px; right: 10px; padding: 1px 8px; border-radius: 8px; border: 2px solid var(--ink);
  background: linear-gradient(#ffe680, #f5a623); color: #3a2400; font-family: var(--font); font-size: 12px; }

/* ---------- Boutique de gemmes et d'or ---------- */
.mres button.pill { font: inherit; color: inherit; cursor: pointer; }
.pill .plus { display: grid; place-items: center; width: 18px; height: 18px; margin-left: 4px; border-radius: 50%; background: #3fbf5a;
  border: 2px solid var(--ink); font-size: 14px; line-height: 1; color: #fff; font-family: var(--font); }
.modal.store .panel { max-width: 360px; }
.stabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.stabs button { padding: 8px; border-radius: 10px; border: 2px solid var(--ink); background: rgba(0, 0, 0, .3); color: #fff; font: inherit; font-weight: 900; }
.stabs button.on { background: linear-gradient(#ffe680, #f5a623); color: #3a2400; }
.sgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.spack { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 4px 6px; border-radius: 12px;
  border: 3px solid var(--ink); background: linear-gradient(#4e9dff, #2a5bc0); color: #fff; font: inherit; }
.spack.gold { background: linear-gradient(#ffd36b, #d68a1a); }
.spack .sico { font-size: 22px; letter-spacing: -6px; }
.spack b { display: flex; align-items: center; gap: 3px; font-family: var(--font); font-weight: 400; font-size: 16px; text-shadow: 0 2px 0 var(--ink); }
.spack .seuro { width: 100%; padding: 3px 0; border-radius: 8px; background: #3fbf5a; border: 2px solid var(--ink); font-weight: 900; font-size: 13px; }
.spack .stag { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 0 6px; border-radius: 6px;
  border: 2px solid var(--ink); background: #ff4d6d; font-size: 10px; font-weight: 900; }
.snote { font-size: 11px; opacity: .75; text-align: center; margin: 10px 0 4px; }
/* Boutons 🏆 🎯 et classement : sous le bandeau du haut, qui descend avec l'encoche de l'iPhone. */
.lbtoggle { top: calc(max(8px, env(safe-area-inset-top)) + 66px); }
#leaderboard { top: calc(max(8px, env(safe-area-inset-top)) + 108px); }
#banner { top: calc(max(8px, env(safe-area-inset-top)) + 112px); }
/* ---------- Création de compte / connexion ---------- */
.onboard.auth { z-index: 70; }
.obhero.small { font-size: 46px; }
.obcard input[type=email], .obcard input[type=password], .obcard input[type=text] {
  width: 100%; box-sizing: border-box; font: inherit; font-weight: 800; font-size: 16px; padding: 12px; border-radius: 12px; border: 3px solid var(--ink);
}
.pwrow { position: relative; }
.pwrow .eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; font-size: 20px; }
.cgu { display: flex; gap: 8px; align-items: flex-start; text-align: left; font-size: 13px; line-height: 1.35; }
.cgu input { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--gold); }
.cgu a { color: var(--gold); }
.auerr { min-height: 18px; margin: 0; color: #ff8f8f; font-size: 13px; font-weight: 900; }
.modal.cgumodal .panel { width: min(92vw, 420px); height: 80vh; display: flex; flex-direction: column; gap: 8px; }
.modal.cgumodal iframe { flex: 1; width: 100%; border: 0; border-radius: 12px; background: #fff; }
.accountrow { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding: 8px 10px; border-radius: 10px; background: rgba(0, 0, 0, .25); font-size: 13px; }
.accountrow .linkbtn { color: var(--gold); background: none; border: 0; font: inherit; font-weight: 900; }
/* Liste des ligues */
.lg-badge { cursor: pointer; pointer-events: auto; }
.modal.leagues .panel { max-width: 340px; }
.lglist { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 10px; }
.lgrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 3px solid var(--ink); background: linear-gradient(var(--c1), var(--c2)); color: #fff; }
.lgrow.locked { filter: grayscale(.85) brightness(.6); }
.lgrow.on { box-shadow: 0 0 0 3px #ffe14a, 0 0 18px rgba(255, 225, 74, .6); }
.lgico { font-size: 28px; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .4)); }
.lginfo { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.lginfo b { font-family: var(--font); font-weight: 400; font-size: 17px; text-shadow: 0 2px 0 var(--ink); }
.lginfo small { font-size: 12px; font-weight: 900; text-shadow: 0 1px 0 var(--ink); }
.lgbar { height: 8px; border-radius: 5px; background: rgba(0, 0, 0, .4); overflow: hidden; }
.lgbar i { display: block; height: 100%; background: linear-gradient(#ffe680, #f5a623); }
.lgstate { font-weight: 900; font-size: 12px; text-shadow: 0 1px 0 var(--ink); }
.modal.cgumodal { z-index: 80; }
