/* Plateau sombre serti d'or au centre, interface bois et or façon Dofus, ciel d'Incarnam animé derrière. Univers unique (pas de thème sombre). */
:root {
  --sky1: #4aa6d3; --sky2: #9fd8ea; --sky3: #e6f5dc;
  --wood: #2c1d11; --wood2: #3e2a19; --wood3: #5a3d22; --woodline: #170e06;
  --gold: #f6c95a; --gold2: #c88d24; --gold3: #8a5a12;
  --cream: #fff4da; --cream2: #e6d1a3; --ink: #2a1b0e;
  --leaf: #5fb53a; --red: #e3583d;
  --display: 'Lilita One', 'Trebuchet MS', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
}
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.screen { overflow: clip; }
body {
  margin: 0; overflow: hidden;
  background: var(--sky2) url(img/bg.jpg) center / cover no-repeat;
  color: var(--cream); font-family: var(--body); font-weight: 800;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
#bg { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }

#app { position: relative; height: 100%; box-sizing: border-box;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 12px; }
.screen { position: absolute; inset: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; }

/* ---------- textes ---------- */
.logo { margin: 0; line-height: 0; }
.logo img { height: clamp(64px, 13vh, 132px); width: auto; display: block; filter: drop-shadow(0 6px 10px rgba(0,0,0,.25)); }
.ribbon { font-family: var(--display); font-size: 20px; color: var(--gold); padding: 6px 22px; border-radius: 8px; letter-spacing: .6px;
  background: linear-gradient(180deg, var(--wood3), var(--wood2)); box-shadow: 0 0 0 2px var(--gold2), 0 0 0 4px var(--woodline), 0 5px 0 4px rgba(0,0,0,.2); }

/* ---------- boutons ---------- */
.btn { font-family: var(--display); font-size: 22px; color: var(--ink); cursor: pointer; letter-spacing: .3px;
  background: linear-gradient(180deg, #fff1b0, var(--gold) 50%, var(--gold2)); border: 0; border-radius: 14px; padding: 11px 28px;
  box-shadow: 0 0 0 3px var(--woodline), 0 6px 0 3px var(--woodline), inset 0 2px 0 rgba(255,255,255,.7), inset 0 -3px 0 rgba(0,0,0,.15);
  transition: transform .09s, box-shadow .09s, filter .15s; }
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(5px); box-shadow: 0 0 0 3px var(--woodline), 0 1px 0 3px var(--woodline), inset 0 2px 0 rgba(255,255,255,.6); }
.btn.green { background: linear-gradient(180deg, #d4ff9a, #7fd146 50%, #3f8f1f); }
.btn.plain { background: linear-gradient(180deg, #fbf0d4, var(--cream2)); }
.btn.small { font-size: 16px; padding: 7px 14px; border-radius: 10px; box-shadow: 0 0 0 3px var(--woodline), 0 4px 0 3px var(--woodline), inset 0 2px 0 rgba(255,255,255,.6); }
.btn:focus-visible, .node:focus-visible, .iconbtn:focus-visible { outline: 3px solid #fff; outline-offset: 5px; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; border: 0; color: var(--gold); cursor: pointer; display: grid; place-items: center; padding: 0;
  background: linear-gradient(180deg, var(--wood3), var(--wood2)); box-shadow: 0 0 0 2px var(--gold2), 0 0 0 4px var(--woodline), 0 4px 0 4px rgba(0,0,0,.2); }
.iconbtn svg { width: 24px; height: 24px; }
.iconbtn.off { color: #8c7a5c; }
.icons { display: flex; gap: 12px; }

/* ---------- carte ---------- */
#map header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between; position: relative; z-index: 2; padding: 4px 4px 0; }
#map .hgroup { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.startotal { display: flex; align-items: center; gap: 6px; font-family: var(--display); font-size: 22px; color: var(--cream); padding: 5px 14px; border-radius: 12px;
  background: linear-gradient(180deg, var(--wood3), var(--wood2)); box-shadow: 0 0 0 2px var(--gold2), 0 0 0 4px var(--woodline); font-variant-numeric: tabular-nums; }
.startotal svg { width: 24px; height: 24px; }
.mapwrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
#mapSvg { width: 100%; height: 100%; overflow: visible; }
.node { cursor: pointer; }
.node .bob { transform-box: fill-box; transform-origin: center; transition: transform .15s; }
.node.current .bob { animation: bob 1.2s ease-in-out infinite; }
.node.locked { cursor: default; }
.node:not(.locked):hover .bob { transform: scale(1.08); }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.halo { transform-box: fill-box; transform-origin: center; animation: halo 1.6s ease-out infinite; }
@keyframes halo { from { transform: scale(.8); opacity: .9; } to { transform: scale(1.6); opacity: 0; } }
.nnum { font-family: var(--display); font-size: 30px; fill: var(--cream); stroke: var(--woodline); stroke-width: 6px; paint-order: stroke; text-anchor: middle; }
.mlabel { font-family: var(--display); font-size: 18px; fill: var(--cream); stroke: var(--woodline); stroke-width: 5px; paint-order: stroke; text-anchor: middle; letter-spacing: .5px; }

/* ---------- jeu ---------- */
#play { display: grid; grid-template-columns: minmax(230px, 290px) 1fr; gap: 22px; }
.side { display: flex; flex-direction: column; gap: 14px; min-width: 0; overflow: auto; padding: 4px 6px 8px; }
.topline { display: flex; align-items: center; gap: 12px; }
.lvltitle { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.lvltitle small { font-size: 12px; color: var(--woodline); opacity: .8; letter-spacing: 1.2px; text-transform: uppercase; }
.lvltitle small, .lvltitle b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lvltitle b { font-family: var(--display); font-weight: 400; font-size: 30px; color: var(--cream); -webkit-text-stroke: 5px var(--woodline); paint-order: stroke fill; }
.panel { position: relative; border-radius: 16px; padding: 12px 14px;
  background: radial-gradient(120% 90% at 50% 0%, #4a321d 0%, var(--wood2) 45%, var(--wood) 100%);
  box-shadow: 0 0 0 2px var(--gold2), 0 0 0 4px var(--woodline), inset 0 2px 0 rgba(255,220,150,.12), 0 8px 0 4px rgba(23,14,6,.25); }
.lbl { display: block; font-family: var(--display); font-size: 14px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--gold); }
.big { font-family: var(--display); font-size: 40px; line-height: 1.05; color: var(--cream); font-variant-numeric: tabular-nums; display: inline-block; text-shadow: 0 3px 0 var(--woodline); }
.movesP { display: flex; align-items: center; justify-content: space-between; }
.medal { width: 82px; height: 82px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: radial-gradient(circle at 50% 35%, #5a3d22, var(--wood) 70%); box-shadow: 0 0 0 4px var(--gold), 0 0 0 7px var(--woodline), inset 0 4px 10px rgba(0,0,0,.5); }
.medal .big { font-size: 42px; }
.movesP.low .medal { animation: lowpulse .8s ease-in-out infinite; }
.movesP.low .big { color: #ffb09a; }
@keyframes lowpulse { 50% { box-shadow: 0 0 0 4px #ff8a5a, 0 0 0 7px var(--woodline), 0 0 24px 6px rgba(255,90,40,.6), inset 0 4px 10px rgba(0,0,0,.5); } }
.bump { animation: bump .4s cubic-bezier(.3,1.9,.5,1); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.4); } 100% { transform: scale(1); } }
.goals { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.goal { position: relative; display: flex; align-items: center; gap: 6px; border-radius: 14px; padding: 4px 12px 4px 4px; background: rgba(0,0,0,.28); box-shadow: inset 0 2px 4px rgba(0,0,0,.35); transition: background .3s; }
.goal img, .goal canvas { width: 44px; height: 44px; display: block; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.goal .gn { font-family: var(--display); font-size: 26px; font-variant-numeric: tabular-nums; min-width: 26px; display: inline-block; text-shadow: 0 2px 0 var(--woodline); }
.goal.done { background: rgba(95,181,58,.35); }
.goal.done .gn { color: #d7ffaa; }
.goal .check { position: absolute; right: -7px; top: -7px; width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(180deg, #a6ef6a, #3f8f1f); box-shadow: 0 0 0 2px var(--woodline); display: none; }
.goal.done .check { display: grid; place-items: center; animation: bump .5s cubic-bezier(.3,1.9,.5,1); }
.sbar { position: relative; height: 20px; margin: 12px 6px 12px; background: rgba(0,0,0,.45); border-radius: 12px; box-shadow: inset 0 2px 4px rgba(0,0,0,.6), 0 0 0 2px var(--woodline); }
.sbar i { position: absolute; left: 2px; top: 2px; bottom: 2px; width: 0; min-width: 0; border-radius: 10px; overflow: visible;
  background: linear-gradient(180deg, #fff6c4 0%, #ffd96a 30%, var(--gold) 55%, var(--gold2) 100%); box-shadow: 0 0 10px rgba(255,210,90,.55), inset 0 -2px 0 rgba(120,70,0,.35); transition: filter .25s, box-shadow .25s; }
/* reflet qui glisse le long de la jauge */
.sbar i::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(105deg, transparent 0 35%, rgba(255,255,255,.75) 45%, transparent 55% 100%) no-repeat; background-size: 220% 100%; animation: sheen 2.6s linear infinite; mix-blend-mode: screen; }
@keyframes sheen { 0% { background-position: 160% 0; } 100% { background-position: -60% 0; } }
/* étincelle au bout de la jauge */
.sbar i::after { content: ''; position: absolute; right: -9px; top: 50%; width: 22px; height: 22px; margin-top: -11px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, #fff 0 18%, rgba(255,240,170,.9) 32%, rgba(255,200,80,.35) 55%, transparent 70%); transition: opacity .3s; }
.sbar.filling i { filter: brightness(1.25) saturate(1.15); box-shadow: 0 0 18px rgba(255,220,110,.95), inset 0 -2px 0 rgba(120,70,0,.35); }
.sbar.filling i::after { opacity: 1; animation: edge .35s ease-in-out infinite alternate; }
@keyframes edge { from { transform: scale(.85); } to { transform: scale(1.3); } }
.sbar .mk { position: absolute; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; z-index: 1; }
.sbar .mk svg { position: relative; width: 100%; height: 100%; display: block; }
.sbar .mk.near svg { animation: nearStar .7s ease-in-out infinite; filter: drop-shadow(0 0 6px rgba(255,220,120,.8)); }
@keyframes nearStar { 0%, 100% { transform: rotate(-8deg) scale(1); } 50% { transform: rotate(8deg) scale(1.12); } }
.sbar .mk.lit svg { animation: starPop .9s cubic-bezier(.2,1.6,.4,1) both, starGlow 2.4s ease-in-out .9s infinite; }
@keyframes starPop { 0% { transform: scale(.3) rotate(-120deg); filter: brightness(3); } 45% { transform: scale(2) rotate(14deg); filter: brightness(1.8) drop-shadow(0 0 14px #fff2a0); }
  70% { transform: scale(.92) rotate(-4deg); } 100% { transform: scale(1.12) rotate(0); filter: drop-shadow(0 0 6px rgba(255,210,90,.9)); } }
@keyframes starGlow { 0%, 100% { transform: scale(1.12); filter: drop-shadow(0 0 5px rgba(255,210,90,.8)); } 50% { transform: scale(1.2); filter: drop-shadow(0 0 11px rgba(255,236,150,1)); } }
/* rayons de lumière derrière l'étoile qui s'allume */
.sbar .mk::before { content: ''; position: absolute; left: 50%; top: 50%; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; pointer-events: none; opacity: 0; z-index: -1;
  background: repeating-conic-gradient(from 0deg, rgba(255,240,170,.85) 0 7deg, transparent 7deg 30deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 68%); mask: radial-gradient(circle, #000 18%, transparent 68%); }
.sbar .mk.lit::before { animation: rays 1.6s ease-out both; }
@keyframes rays { 0% { opacity: 0; transform: scale(.2) rotate(0); } 25% { opacity: 1; transform: scale(1.1) rotate(40deg); } 100% { opacity: 0; transform: scale(1.5) rotate(160deg); } }
#scoreN { display: inline-block; transform-origin: left center; }
#scoreN.pop { animation: scorePop .45s cubic-bezier(.3,1.8,.5,1); }
@keyframes scorePop { 0% { transform: scale(1); } 40% { transform: scale(1.28); color: #fff2a0; text-shadow: 0 0 12px rgba(255,220,110,.9); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .sbar i::before, .sbar .mk.near svg, .sbar .mk.lit svg, .sbar .mk.lit::before { animation: none; } }
.bossP { display: grid; grid-template-columns: 116px 1fr; gap: 10px; align-items: center; }
.bossP canvas { width: 116px; height: 116px; margin: -14px -6px -10px -10px; }
.bossP b { font-family: var(--display); font-weight: 400; font-size: 24px; color: #b6f07a; }
.hpbar { height: 18px; border-radius: 10px; background: rgba(0,0,0,.5); box-shadow: inset 0 2px 4px rgba(0,0,0,.6), 0 0 0 2px var(--woodline); overflow: hidden; margin: 5px 0 3px; }
.hpbar i { display: block; height: 100%; width: 100%; background: linear-gradient(180deg, #ff9b7a, var(--red) 55%, #a52f1a); transition: width .4s cubic-bezier(.3,1.4,.5,1); }
.hptxt { font-size: 13px; color: var(--cream2); font-variant-numeric: tabular-nums; }
.bossP.hurt { animation: hurt .35s; }
.bossP.twin .hpbar { height: 12px; margin: 3px 0 2px; }
.bossP.twin #hpFill { background: linear-gradient(180deg, #b49aff, #5a3ab8 55%, #2a1a6a); }
.bossP.twin #hpFill2 { background: linear-gradient(180deg, #fffbe8, #f2dca0 55%, #c8a050); }
@keyframes hurt { 20% { transform: translateX(-7px) rotate(-1deg); filter: brightness(1.7) saturate(1.6); } 55% { transform: translateX(6px) rotate(1deg); } }
.say { grid-column: 1 / -1; font-size: 14px; color: var(--ink); background: var(--cream); border-radius: 10px; padding: 7px 10px; box-shadow: 0 0 0 2px var(--woodline); display: none; }
.say.on { display: block; animation: bump .4s; }

.boardArea { position: relative; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
#boardWrap { position: relative; will-change: transform; }
#board { display: block; touch-action: none; cursor: pointer; }
.combo { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); pointer-events: none; white-space: nowrap; z-index: 3; opacity: 0;
  font-family: var(--display); font-size: clamp(44px, 7.5vw, 84px); color: var(--gold); -webkit-text-stroke: 9px var(--woodline); paint-order: stroke fill;
  text-shadow: 0 7px 0 var(--woodline), 0 0 30px rgba(255,220,120,.7); }
.combo.go { animation: combo 1.05s cubic-bezier(.2,1.7,.4,1) forwards; }
@keyframes combo { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.2) rotate(-12deg); } 22% { opacity: 1; transform: translate(-50%,-50%) scale(1.15) rotate(3deg); }
  40% { transform: translate(-50%,-50%) scale(.97) rotate(-1deg); } 75% { opacity: 1; transform: translate(-50%,-56%) scale(1) rotate(0); } 100% { opacity: 0; transform: translate(-50%,-80%) scale(.92); } }
.banner { position: absolute; left: -3%; right: -3%; top: 50%; transform: translateY(-50%) scaleY(0); text-align: center; pointer-events: none; z-index: 4; padding: 16px 0 12px;
  background: linear-gradient(180deg, rgba(62,42,25,.95), rgba(23,14,6,.95)); box-shadow: 0 -3px 0 var(--gold), 0 3px 0 var(--gold), 0 -6px 0 var(--woodline), 0 6px 0 var(--woodline), 0 10px 30px rgba(0,0,0,.4); }
.banner b { display: block; font-family: var(--display); font-weight: 400; font-size: clamp(38px, 6.5vw, 70px); line-height: 1;
  background: linear-gradient(180deg, #fff3b8, var(--gold) 50%, #e39a1c); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 0 var(--woodline)); }
.banner span { display: block; margin-top: 6px; color: var(--cream2); font-size: 16px; letter-spacing: .6px; }
.banner.go { animation: banner 2.1s cubic-bezier(.2,1.2,.4,1) forwards; }
@keyframes banner { 0% { transform: translateY(-50%) scaleY(0); } 12%,82% { transform: translateY(-50%) scaleY(1); } 100% { transform: translateY(-50%) scaleY(0); } }
.toast { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); background: var(--cream); color: var(--ink); box-shadow: 0 0 0 3px var(--woodline), 0 5px 0 3px var(--woodline);
  border-radius: 12px; padding: 8px 16px; font-size: 16px; z-index: 5; pointer-events: none; opacity: 0; transition: opacity .2s; white-space: nowrap; }
.toast.on { opacity: 1; }
.tuto { position: absolute; left: 50%; top: 2%; transform: translateX(-50%); z-index: 6; max-width: min(460px, 92%); text-align: center; pointer-events: none;
  background: linear-gradient(180deg, #fff8e6, #f1e2bd); color: var(--ink); border-radius: 16px; padding: 12px 18px; font-size: 18px; line-height: 1.3;
  box-shadow: 0 0 0 3px var(--woodline), 0 6px 0 3px var(--woodline), 0 12px 30px rgba(0,0,0,.3); animation: dlg .4s cubic-bezier(.2,1.6,.4,1); }
.tuto b { color: #8a4a12; }
.zones { display: flex; gap: 8px; flex-wrap: wrap; }
.zones button { font-family: var(--display); font-size: 18px; color: var(--cream); cursor: pointer; border: 0; padding: 7px 16px; border-radius: 10px;
  background: linear-gradient(180deg, var(--wood3), var(--wood2)); box-shadow: 0 0 0 2px var(--gold3), 0 0 0 4px var(--woodline), 0 4px 0 4px rgba(0,0,0,.2); }
.zones button[aria-pressed="true"] { color: var(--ink); background: linear-gradient(180deg, #fff1b0, var(--gold) 50%, var(--gold2)); box-shadow: 0 0 0 2px var(--gold), 0 0 0 4px var(--woodline), 0 4px 0 4px rgba(0,0,0,.2); }
.zones button:disabled { color: #9c8a6c; cursor: default; }
.zones button:focus-visible, .almanax:focus-visible, .mineur:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.almanax { position: absolute; left: 6px; bottom: 6px; z-index: 3; display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer; border: 0; color: var(--cream);
  font-family: var(--body); font-weight: 800; padding: 10px 18px 10px 12px; border-radius: 16px; max-width: min(360px, 90%);
  background: radial-gradient(120% 90% at 50% 0%, #5c3e23 0%, var(--wood2) 50%, var(--wood) 100%); box-shadow: 0 0 0 2px var(--gold), 0 0 0 5px var(--woodline), 0 8px 0 4px rgba(0,0,0,.25); transition: transform .12s; }
.almanax:hover { transform: translateY(-2px); }
.almanax.infb { bottom: 86px; }
.almanax .cal.inf i { background: #4a3aa8; }
.dialog .reward.fin { flex-direction: column; }
.dialog .reward.fin b { font-size: 18px; color: var(--gold); }
.almanax .cal { flex: none; width: 54px; height: 58px; border-radius: 8px; background: var(--cream); color: var(--ink); display: flex; flex-direction: column; align-items: center; overflow: hidden; box-shadow: 0 0 0 2px var(--woodline); }
.almanax .cal i { display: block; width: 100%; background: var(--red); color: #fff; font-style: normal; font-size: 11px; text-align: center; letter-spacing: .5px; text-transform: uppercase; padding: 1px 0; }
.almanax .cal b { font-family: var(--display); font-weight: 400; font-size: 28px; line-height: 1.25; }
.almanax strong { display: block; font-family: var(--display); font-weight: 400; font-size: 20px; color: var(--gold); }
.almanax small { display: block; font-size: 13px; color: var(--cream2); }
.mineurs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.mineur { display: flex; align-items: center; gap: 6px; cursor: pointer; border: 0; border-radius: 12px; padding: 4px 12px 4px 4px; font-family: var(--body); font-weight: 800; font-size: 14px; color: var(--cream);
  background: rgba(0,0,0,.3); box-shadow: inset 0 0 0 2px rgba(255,255,255,.08); }
.mineur img { width: 36px; height: 36px; }
.mineur[aria-pressed="true"] { background: rgba(246,201,90,.25); box-shadow: inset 0 0 0 2px var(--gold); color: #fff3c4; }
.mineurDesc { margin-top: 6px; font-size: 13px; color: var(--cream2); min-height: 1.2em; }
.reward { margin-top: 14px; padding: 10px; border-radius: 14px; background: rgba(246,201,90,.15); box-shadow: inset 0 0 0 2px var(--gold); display: flex; gap: 12px; align-items: center; text-align: left; }
.reward img { width: 64px; height: 64px; animation: starin .7s cubic-bezier(.2,1.9,.4,1); }
.reward b { font-family: var(--display); font-weight: 400; font-size: 20px; color: var(--gold); display: block; }
.modtxt { margin-top: 6px; font-size: 15px; color: var(--cream); line-height: 1.3; }
.modtxt b { color: var(--gold); font-family: var(--display); font-weight: 400; font-size: 18px; display: block; }

/* ---------- fenêtres ---------- */
.modal { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; overflow-y: auto; overscroll-behavior: contain; background: radial-gradient(circle, rgba(23,14,6,.35), rgba(23,14,6,.7)); z-index: 20; padding: 16px; }
.dialog { margin: auto; flex: none; width: min(450px, 100%); box-sizing: border-box; text-align: center; position: relative; border-radius: 24px; padding: 24px 22px 26px;
  background: radial-gradient(120% 80% at 50% 0%, #5c3e23 0%, var(--wood2) 50%, var(--wood) 100%);
  box-shadow: 0 0 0 3px var(--gold), 0 0 0 6px var(--woodline), inset 0 2px 0 rgba(255,220,150,.15), 0 14px 0 6px rgba(0,0,0,.3);
  animation: dlg .45s cubic-bezier(.2,1.6,.4,1); }
@keyframes dlg { from { transform: scale(.6) translateY(30px); opacity: 0; } }
.dialog h2 { margin: 0 0 4px; font-family: var(--display); font-weight: 400; font-size: 40px; line-height: 1.05; text-wrap: balance;
  background: linear-gradient(180deg, #fff3b8, var(--gold) 50%, #e39a1c); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 0 var(--woodline)); }
.dialog .sub { margin: 0 0 14px; color: var(--cream2); font-size: 15px; letter-spacing: .4px; }
.dialog .row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.objlist { display: flex; flex-direction: column; gap: 8px; text-align: left; background: rgba(0,0,0,.3); border-radius: 14px; padding: 10px 12px; box-shadow: inset 0 2px 5px rgba(0,0,0,.4); }
.obj { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.obj img, .obj canvas { width: 44px; height: 44px; flex: none; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.tip { margin-top: 14px; background: linear-gradient(180deg, #fff8e6, #f1e2bd); color: var(--ink); border-radius: 12px; padding: 10px 12px; font-size: 15px; text-align: left; box-shadow: 0 0 0 2px var(--woodline); line-height: 1.35; }
.tip b { color: #8a4a12; }
.bigstars { display: flex; justify-content: center; align-items: flex-start; gap: 4px; margin: 8px 0 4px; }
.bigstars .bs { width: 76px; height: 76px; }
.bigstars .bs:nth-child(2) { width: 96px; height: 96px; margin-top: -16px; }
.bigstars .bs.on { animation: starin .55s cubic-bezier(.2,1.9,.4,1); }
@keyframes starin { from { transform: scale(2.6) rotate(-60deg); opacity: 0; } }
.endscore { font-family: var(--display); font-size: 48px; color: var(--cream); font-variant-numeric: tabular-nums; text-shadow: 0 4px 0 var(--woodline); }
.best { font-size: 15px; color: var(--cream2); }
.best.rec { color: #b6f07a; }
.movesline { margin-top: 10px; font-size: 15px; color: var(--cream2); }
.movesline b { font-family: var(--display); font-weight: 400; color: var(--cream); font-size: 22px; }
.dofuslist { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.dofuslist div { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--cream2); line-height: 1.2; }
.dofuslist img { width: 40px; height: 40px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }

/* ---------- Kamas, coffres, succès, boosters ---------- */
.kamas, .metabtn { display: flex; align-items: center; gap: 6px; font-family: var(--display); font-size: 20px; color: var(--cream); padding: 4px 12px 4px 6px; border-radius: 12px; border: 0;
  background: linear-gradient(180deg, var(--wood3), var(--wood2)); box-shadow: 0 0 0 2px var(--gold2), 0 0 0 4px var(--woodline); font-variant-numeric: tabular-nums; }
.kamas img { width: 24px; height: 24px; }
.metabtn { cursor: pointer; position: relative; font-size: 15px; }
.metabtn img, .metabtn svg { width: 28px; height: 28px; color: var(--gold); }
.metabtn.ready { animation: chestReady 1s ease-in-out infinite; box-shadow: 0 0 0 2px #fff2a0, 0 0 0 4px var(--woodline), 0 0 18px 4px rgba(255,220,110,.8); }
.metabtn.ready .cnt { background: #e3583d; color: #fff; border-radius: 999px; padding: 0 7px; }
@keyframes chestReady { 0%, 100% { transform: rotate(-3deg) scale(1); } 50% { transform: rotate(3deg) scale(1.08); } }
img.kama { vertical-align: -3px; display: inline-block; }
.kamasline { font-family: var(--display); font-size: 26px; color: #ffe38a; margin: 4px 0; text-shadow: 0 2px 0 var(--woodline); }
.boosters { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.boost { display: flex; flex-direction: column; align-items: center; gap: 1px; width: 104px; padding: 6px 4px; border-radius: 12px; border: 0; cursor: pointer; color: var(--cream);
  background: rgba(0,0,0,.28); box-shadow: inset 0 0 0 2px rgba(246,201,90,.35); font-family: var(--body); }
.boost b { font-size: 13px; } .boost small { font-size: 11px; color: var(--cream2); }
.boost[aria-pressed="true"] { background: rgba(95,181,58,.4); box-shadow: inset 0 0 0 2px #a6ef6a, 0 0 12px rgba(166,239,106,.5); }
.boost:disabled { opacity: .4; cursor: default; }
.bi { width: 30px; height: 30px; display: block; background: center/contain no-repeat; }
.bi-moves { background-image: none; font-family: var(--display); font-size: 22px; color: #ffe38a; } .bi-moves::before { content: '+3'; }
.bi-bomb { background-image: radial-gradient(circle at 40% 38%, #ffe08a 0 18%, #ff6a1a 40%, #2a1206 42% 52%, transparent 54%); }
.bi-dofus { background-image: url(img/dofus_dofawa.webp); }
.chestwrap { display: flex; justify-content: center; margin: 6px 0; }
.chestimg { width: 150px; height: auto; display: block; margin: 0 auto; filter: drop-shadow(0 6px 10px rgba(0,0,0,.4)); }
.chestimg.shake { animation: chestShake .15s linear infinite; }
.chestimg.open { animation: chestOpen .7s cubic-bezier(.2,1.8,.4,1); }
@keyframes chestShake { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes chestOpen { 0% { transform: scale(1); } 40% { transform: scale(1.3) translateY(-10px); } 100% { transform: scale(1.1); } }
.achlist { display: flex; flex-direction: column; gap: 5px; max-height: min(55vh, 440px); overflow-y: auto; text-align: left; touch-action: pan-y; margin-top: 8px; }
.ach { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; background: rgba(0,0,0,.22); opacity: .6; }
.ach.on { opacity: 1; background: rgba(246,201,90,.16); box-shadow: inset 0 0 0 2px rgba(246,201,90,.5); }
.ach .achico { width: 30px; height: 30px; color: #8a7a5a; flex: none; } .ach.on .achico { color: var(--gold); }
.ach .am { flex: 1; display: flex; flex-direction: column; } .ach .am b { color: var(--cream); font-size: 14px; } .ach .am small { color: var(--cream2); font-size: 12px; }
.ach .ak { font-weight: 800; color: #ffe38a; font-size: 13px; white-space: nowrap; }
.achpop { position: fixed; left: 50%; top: 14px; z-index: 60; transform: translate(-50%, -140%); transition: transform .45s cubic-bezier(.2,1.4,.4,1); display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 10px; border-radius: 14px;
  background: linear-gradient(180deg, var(--wood3), var(--wood)); box-shadow: 0 0 0 2px var(--gold), 0 0 0 4px var(--woodline), 0 10px 24px rgba(0,0,0,.45); color: var(--cream); }
.achpop.on { transform: translate(-50%, 0); }
.achpop .achico { width: 38px; height: 38px; color: var(--gold); } .achpop small { display: block; font-size: 11px; color: var(--cream2); letter-spacing: 1px; text-transform: uppercase; }
.achpop b { display: block; font-family: var(--display); font-weight: 400; font-size: 20px; } .achpop em { font-style: normal; font-weight: 800; color: #ffe38a; font-size: 13px; }
@media (max-width: 760px), (max-height: 520px) { .kamas, .metabtn { font-size: 14px; padding: 3px 8px 3px 4px; } .kamas img, .metabtn img, .metabtn svg { width: 20px; height: 20px; } .boost { width: 88px; } }
@media (max-width: 760px) {
  #map header { gap: 6px; } #map .hgroup:last-child { gap: 6px; row-gap: 6px; }
  .startotal { font-size: 15px; padding: 3px 8px; } .startotal svg { width: 18px; height: 18px; }
  #map .icons { gap: 6px; } #map .iconbtn { width: 34px; height: 34px; } #map .iconbtn svg { width: 20px; height: 20px; }
  .logo img { height: 58px; }
}
/* ---------- Volume ---------- */
#sndPanel { position: fixed; z-index: 40; width: min(300px, calc(100vw - 16px)); box-sizing: border-box; padding: 12px 14px; border-radius: 16px; display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(180deg, var(--wood3), var(--wood)); box-shadow: 0 0 0 2px var(--gold2), 0 0 0 4px var(--woodline), 0 12px 30px rgba(0,0,0,.45); }
#sndPanel label { display: grid; grid-template-columns: 26px 64px 1fr 44px; align-items: center; gap: 8px; color: var(--cream); font-weight: 800; font-size: 14px; }
#sndPanel .si { color: var(--gold); display: flex; } #sndPanel .si svg { width: 22px; height: 22px; }
#sndPanel b { text-align: right; font-variant-numeric: tabular-nums; color: var(--cream2); font-size: 13px; }
#sndPanel input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; margin: 0; cursor: pointer; touch-action: none; }
#sndPanel input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 6px; background: linear-gradient(90deg, var(--gold) var(--p, 100%), rgba(0,0,0,.45) var(--p, 100%)); box-shadow: inset 0 0 0 1px var(--woodline); }
#sndPanel input[type=range]::-moz-range-track { height: 8px; border-radius: 6px; background: rgba(0,0,0,.45); box-shadow: inset 0 0 0 1px var(--woodline); }
#sndPanel input[type=range]::-moz-range-progress { height: 8px; border-radius: 6px; background: var(--gold); }
#sndPanel input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -7px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff3b8, var(--gold) 55%, var(--gold2)); box-shadow: 0 0 0 2px var(--woodline), 0 2px 4px rgba(0,0,0,.4); }
#sndPanel input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px var(--woodline); }
#sndPanel input[type=range]:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 6px; }
/* ---------- Classements et compte ---------- */
.dialog.wide { width: min(520px, 100%); }
.dialog .reward.soon { justify-content: center; text-align: center; }
#lbPanel { text-align: left; }
#lbPanel .acct { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: rgba(0,0,0,.25); }
#lbPanel .acct .am { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#lbPanel .acct .am b { color: var(--cream); font-size: 17px; }
#lbPanel .acct .am small { color: var(--cream2); font-size: 13px; line-height: 1.3; }
#lbPanel .dico { color: #8c9eff; display: flex; }
#lbPanel .av { width: 34px; height: 34px; border-radius: 50%; flex: none; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; background: #3d2b1a; color: var(--cream); font-weight: 700; }
.btn.small { font-size: 16px; padding: 6px 14px; }
.btn.discord { background: linear-gradient(180deg, #a7b2ff, #5865f2 55%, #3b45b8); color: #fff; }
.lbtabs { display: flex; gap: 8px; justify-content: center; margin: 14px 0 6px; }
.lbnote { margin: 4px 0 8px; color: var(--cream2); font-size: 13px; text-align: center; }
.lbbox { max-height: min(46vh, 360px); overflow-y: auto; touch-action: pan-y; }
.lbempty { text-align: center; color: var(--cream2); margin: 18px 0; }
ol.lb { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
ol.lb li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; background: rgba(0,0,0,.18); color: var(--cream); }
ol.lb li.moi { background: rgba(244,197,79,.22); box-shadow: inset 0 0 0 2px rgba(244,197,79,.6); }
ol.lb li.gap { justify-content: center; background: none; color: var(--cream2); padding: 0; }
ol.lb .rk { width: 26px; text-align: right; font-weight: 800; color: #f6c95a; }
ol.lb .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ol.lb .sc { font-weight: 800; }
#lbPanel .join { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; color: #b8c1ff; font-size: 14px; text-decoration: none; }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }

@media (max-aspect-ratio: 1/1) { body { background-image: url(img/bgm.jpg); } }
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  #play { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 10px; }
  .side { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; overflow: visible; padding: 4px; }
  .topline { grid-column: 1 / -1; }
  .lvltitle { grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 10px; }
  .panel { padding: 8px 10px; border-radius: 12px; }
  .movesP { flex-direction: column; justify-content: center; gap: 4px; }
  .medal { width: 58px; height: 58px; } .medal .big { font-size: 30px; }
  .scoreP { grid-column: 1 / -1; display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 4px 12px; }
  .scoreP .big { font-size: 26px; }
  .sbar { margin: 4px 16px 4px 4px; }
  .goal img, .goal canvas { width: 34px; height: 34px; }
  .goal .gn { font-size: 21px; }
  .bossP { grid-column: 1 / -1; grid-template-columns: 56px 1fr; position: relative; }
  .bossP canvas { width: 72px; height: 72px; margin: -8px 0; }
  /* combat de boss : le boss prend la place de l'objectif, à côté des coups, et sa bulle flotte sans pousser le plateau */
  .side:has(.goalsP[hidden]) .bossP { grid-column: 2; grid-row: 3; align-self: stretch; grid-template-columns: 48px 1fr; gap: 6px; padding: 6px 10px; }
  .side:has(.goalsP[hidden]) .bossP canvas { width: 60px; height: 60px; margin: -6px -4px -6px -8px; }
  .side:has(.goalsP[hidden]) .bossP b { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  .bossP .say { position: absolute; left: 8px; right: 8px; top: calc(100% + 6px); z-index: 6; font-size: 13px; padding: 6px 9px; box-shadow: 0 0 0 2px var(--woodline), 0 6px 14px rgba(0,0,0,.35); }
  .bossP .say::before { content: ''; position: absolute; top: -7px; left: 26px; border: 7px solid transparent; border-top: 0; border-bottom-color: var(--cream); }
  .almanax { left: 0; right: 0; bottom: 0; max-width: none; }
  .zones button { font-size: 15px; padding: 5px 12px; }
}
/* téléphone en paysage : peu de hauteur, on resserre le panneau de gauche */
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  .screen { inset: 6px max(10px, env(safe-area-inset-right, 0px)) 6px max(10px, env(safe-area-inset-left, 0px)); }
  #play { grid-template-columns: minmax(190px, 250px) 1fr; gap: 10px; }
  .side { gap: 6px; padding: 2px 4px 4px; }
  .topline { gap: 6px; }
  .topline .iconbtn { width: 34px; height: 34px; }
  .lvltitle { flex-direction: row; align-items: baseline; gap: 8px; }
  .lvltitle small { font-size: 10px; }
  .lvltitle b { font-size: 20px; -webkit-text-stroke: 4px var(--woodline); }
  .panel { padding: 5px 10px; border-radius: 12px; }
  .medal { width: 46px; height: 46px; } .medal .big { font-size: 24px; }
  .goals { margin-top: 2px; gap: 6px; }
  .goal { padding: 2px 8px 2px 2px; }
  .goal img, .goal canvas { width: 28px; height: 28px; }
  .goal .gn { font-size: 18px; }
  .scoreP { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 10px; }
  .scoreP .big { font-size: 20px; }
  .scoreP .sbar { grid-column: 1 / -1; margin: 2px 12px 4px 2px; }
  .bossP { grid-template-columns: 52px 1fr; gap: 6px; }
  .bossP canvas { width: 60px; height: 60px; margin: -6px 0; }
  .bossP b { font-size: 18px; }
  .bossP .say { display: none; }
  .modal { padding: 8px; }
  .dialog { padding: 14px 18px 16px; }
  .dialog h2 { font-size: 28px; }
  .dialog .row { margin-top: 10px; }
  .almanax { padding: 4px; gap: 0; }
  .almanax.infb { bottom: 64px; }
  .almanax > span:not(.cal) { display: none; }
  .almanax .cal { width: 44px; height: 48px; } .almanax .cal b { font-size: 22px; }
}
/* téléphone : une seule rangée de zones qui défile au doigt */
@media (max-width: 760px), (max-height: 520px) {
  #map .hgroup:first-child { flex-wrap: nowrap; min-width: 0; max-width: 100%; }
  .zones { flex-wrap: nowrap; overflow-x: auto; min-width: 0; padding: 6px 6px 8px; scrollbar-width: none; touch-action: pan-x; -webkit-overflow-scrolling: touch; }
  .zones::-webkit-scrollbar { display: none; }
  .zones button { flex: none; }
}
.mapwrap.pan { justify-content: flex-start; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; touch-action: pan-x; overscroll-behavior-x: contain; }
.mapwrap.pan::-webkit-scrollbar { display: none; }
.mapwrap.pan #mapSvg { flex: none; overflow: hidden; }
@media (max-aspect-ratio: 1/1) { #map:has(.almanax:not([hidden])) .mapwrap { margin-bottom: 86px; } #map:has(.infb:not([hidden])) .mapwrap { margin-bottom: 170px; } }
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  #map header { flex-wrap: nowrap; gap: 10px; padding: 0; }
  #map .hgroup:first-child { flex: 1; gap: 10px; }
  #map .hgroup:last-child { flex: none; gap: 8px; }
  .logo img { height: 44px; }
  .zones button { font-size: 15px; padding: 5px 12px; }
  .startotal { font-size: 17px; padding: 4px 10px; } .startotal svg { width: 18px; height: 18px; }
  #map .icons { gap: 8px; } #map .iconbtn { width: 36px; height: 36px; }
  .mineurs { gap: 6px; margin-top: 6px; }
  .mineur { padding: 2px 10px 2px 2px; font-size: 13px; } .mineur img { width: 26px; height: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .node.current .bob, .halo, .movesP.low .medal { animation: none; }
}
