/* ==========================================================================
   Deux Rives : style (design repris de CY Hub) « console portable » : panneaux épais, boutons
   en relief, tout est pensé pour le doigt autant que pour la souris.
   ========================================================================== */
:root {
  --bg: #14102a; --panel: #211a4a; --panel2: #2c2462; --panel3: #3a3080; --line: #5a4eb0; --line2: #1d1633;
  --ink: #f6f2ff; --muted: #b9aee6; --gold: #ffd24a; --gold2: #e8a81a; --green: #4be08a; --red: #ff5a73; --blue: #4da3ff; --pink: #ff7ad9; --teal: #2de2c6;
  --paper: #f7ecd2; --paper2: #ecdcb4; --paper-ink: #3b2b18; --paper-line: #c8b080;
  --font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, Menlo, monospace;
  --r: 16px; --safe-t: env(safe-area-inset-top, 0px); --safe-b: max(env(safe-area-inset-bottom, 0px), var(--hub-safe, 0px), var(--vp-hidden, 0px)); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { min-height: -webkit-fill-available; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font: 400 16px/1.45 var(--font); overscroll-behavior: none; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--blue); }
[hidden] { display: none !important; }
code { font-family: var(--mono); font-size: .9em; background: rgba(255, 255, 255, .13); padding: .05em .35em; border-radius: 5px; }
.ic { width: 1.3em; height: 1.3em; vertical-align: -0.3em; flex: none; }
* { scrollbar-width: thin; scrollbar-color: #5a4eb0 transparent; }

/* ----- disposition ----- */
/* 100lvh = la plus grande hauteur possible : le jeu passe aussi sous la barre du navigateur (iPhone) au lieu de laisser une bande noire ; les commandes remontent via --safe-b */
#app { position: fixed; left: 0; top: 0; right: 0; bottom: 0; min-height: 100vh; min-height: 100lvh; display: flex; flex-direction: column; background: #14102a; }
/* web app iPhone : document un peu plus haut que l'écran, défilé de 80 px par main.js, ce qui fait passer iOS à la fenêtre complète (le jeu est en position fixe, rien ne bouge) */
html.ios-fill, html.ios-fill body { overflow: auto; height: calc(100% + 240px); height: calc(100lvh + 240px); overscroll-behavior: none; }
/* Plus aucune bande sombre en bas de l'écran : le jeu va jusqu'au bord (le fond de la page suit la couleur du bas du
décor via UI.chrome, donc même la zone que le navigateur annonce en trop prolonge l'image au lieu d'un rectangle noir). */
#stage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: #14102a; }
#game { position: absolute; inset: 0; display: block; image-rendering: pixelated; touch-action: none; }
#pad { display: none; }
body.touch #pad { display: flex; }
/* --hub-dock : hauteur de la barre flottante du hub quand le jeu est intégré dedans (0 sinon) */
@media (orientation: portrait) {
  /* la manette flotte par-dessus la carte (aucun fond) ; la caméra garde le joueur au-dessus (voir world.js) */
  body.touch #pad { position: absolute; left: 0; right: 0; bottom: 0; height: calc(190px + var(--hub-dock, 0px)); pointer-events: none; align-items: flex-end; justify-content: space-between; padding: 0 calc(14px + var(--safe-r)) calc(10px + var(--safe-b) + var(--hub-dock, 0px)) calc(14px + var(--safe-l)); z-index: 5; }
  body.touch #pad > * { pointer-events: auto; }
  body.touch #dpad { opacity: .8; } body.touch #pad-btns { opacity: .88; }
  /* COURIR ne prend pas de place dans la rangée (sinon A débordait de l'écran sur les téléphones de 390 px) */
  body.touch #pad-mid { flex: 0 0 0; width: 0; min-width: 0; position: relative; align-self: stretch; padding: 0; }
  body.touch #btn-run { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); white-space: nowrap; }
}
@media (orientation: landscape) {
  body.touch #pad { position: absolute; inset: 0; pointer-events: none; align-items: flex-end; justify-content: space-between; padding: 0 calc(18px + var(--safe-r)) calc(14px + var(--safe-b) + var(--hub-dock, 0px)) calc(18px + var(--safe-l)); z-index: 5; }
  body.touch #pad > * { pointer-events: auto; }
  body.touch #dpad { opacity: .78; } body.touch #pad-btns { opacity: .85; }
}
#layers { position: absolute; inset: 0; pointer-events: none; z-index: 40; }
#layers > * { pointer-events: auto; }

/* ----- manette ----- */
#dpad { position: relative; width: 150px; height: 150px; flex: none; touch-action: none; }
#dpad::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #4a3f9a, #251d58); border: 4px solid #1d1633; box-shadow: inset 0 4px 0 rgba(255, 255, 255, .15), 0 5px 0 rgba(0, 0, 0, .4); }
#dpad .pk { position: absolute; width: 0; height: 0; border: 15px solid transparent; opacity: .55; transition: opacity .06s; }
#dpad .pk.on { opacity: 1; }
#dpad .up { left: 50%; top: 14px; margin-left: -15px; border-bottom: 22px solid #f6f2ff; border-top: 0; }
#dpad .dn { left: 50%; bottom: 14px; margin-left: -15px; border-top: 22px solid #f6f2ff; border-bottom: 0; }
#dpad .lf { top: 50%; left: 14px; margin-top: -15px; border-right: 22px solid #f6f2ff; border-left: 0; }
#dpad .rt { top: 50%; right: 14px; margin-top: -15px; border-left: 22px solid #f6f2ff; border-right: 0; }
#dpad .knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #8a7be0, #4a3f9a); border: 3px solid #1d1633; transition: transform .05s; }
#pad-mid { flex: 1; display: flex; justify-content: center; align-items: flex-end; align-self: flex-end; padding-bottom: 6px; }
#pad-btns { position: relative; width: 150px; height: 130px; flex: none; }
.pbtn { border-radius: 50%; font: 900 24px var(--font); color: #fff; border: 4px solid #1d1633; box-shadow: inset 0 4px 0 rgba(255, 255, 255, .3), 0 5px 0 rgba(0, 0, 0, .45); touch-action: none; }
.pbtn:active, .pbtn.on { transform: translateY(3px); box-shadow: inset 0 4px 0 rgba(255, 255, 255, .2), 0 2px 0 rgba(0, 0, 0, .45); }
.pbtn.a { position: absolute; right: 0; top: 8px; width: 78px; height: 78px; background: radial-gradient(circle at 35% 30%, #ff8aa0, #d63e56); font-size: 30px; }
.pbtn.b { position: absolute; left: 0; bottom: 4px; width: 62px; height: 62px; background: radial-gradient(circle at 35% 30%, #ffe08a, #e8a81a); color: #5a3a00; }
.pbtn.small { border-radius: 14px; width: auto; padding: 8px 14px; font-size: 12px; letter-spacing: .08em; background: #3a3080; opacity: .85; }
.pbtn.small.on { background: #ffb02e; color: #3a2200; }

/* ----- HUD ----- */
#hud { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: calc(8px + var(--safe-t)) calc(8px + var(--safe-r)) 0 calc(8px + var(--safe-l)); pointer-events: none; z-index: 6; }
#hud > div { display: flex; gap: 6px; align-items: center; min-width: 0; }
.hud-r { justify-content: flex-end; flex: 1; }
.pill { pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px 0 8px; border-radius: 19px; background: rgba(33, 26, 74, .9); border: 3px solid #1d1633; box-shadow: 0 3px 0 rgba(0, 0, 0, .35), inset 0 2px 0 rgba(255, 255, 255, .12); font-weight: 800; font-size: 15px; white-space: nowrap; transition: transform .1s; }
.pill:active { transform: translateY(2px); }
.pill .pi { display: inline-flex; font-size: 20px; }
.pill b { font-variant-numeric: tabular-nums; }
.pill.bump { animation: bump .35s; }
.pill.round { width: 42px; height: 42px; padding: 0; justify-content: center; border-radius: 14px; }
.pill.obj { max-width: min(300px, 52vw); height: auto; min-height: 38px; padding: 5px 12px 5px 8px; border-radius: 16px; white-space: normal; font-weight: 700; font-size: 12.5px; line-height: 1.25; text-align: left; }
.pill.obj .pi { color: var(--gold); }
.pill.obj.hide { display: none; }
@keyframes bump { 40% { transform: scale(1.18); } }
#banner { position: absolute; left: 50%; top: calc(64px + var(--safe-t)); transform: translate(-50%, -20px); opacity: 0; pointer-events: none; z-index: 7; text-align: center; padding: 8px 22px; border-radius: 14px; background: rgba(20, 16, 42, .92); border: 3px solid #ffd24a; box-shadow: 0 5px 0 rgba(0, 0, 0, .4); font-weight: 900; font-size: 20px; letter-spacing: .02em; text-shadow: 0 2px 0 #1d1633; transition: opacity .35s, transform .35s; max-width: 90vw; }
#banner small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; text-shadow: none; }
#banner.show { opacity: 1; transform: translate(-50%, 0); }
#toasts { position: absolute; left: 50%; bottom: calc(14px + var(--hub-dock, 0px)); transform: translateX(-50%); z-index: 20; display: flex; flex-direction: column-reverse; gap: 8px; align-items: center; pointer-events: none; width: min(520px, 94vw); }
.toast { background: #2c2462; border: 3px solid #1d1633; outline: 2px solid var(--blue); padding: 8px 16px; border-radius: 14px; font-weight: 700; font-size: 14.5px; box-shadow: 0 4px 0 rgba(0, 0, 0, .4); animation: toast .25s ease-out; max-width: 100%; text-align: center; }
.toast.good { outline-color: var(--green); } .toast.bad { outline-color: var(--red); } .toast.gold { outline-color: var(--gold); }
.toast.out { opacity: 0; transform: translateY(8px); transition: .3s; }
@keyframes toast { from { transform: translateY(14px) scale(.9); opacity: 0; } }
#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 30; transition: opacity .28s; }
#fade.on { opacity: 1; pointer-events: auto; }
#flash { position: absolute; inset: 0; z-index: 31; pointer-events: none; opacity: 0; background: #fff; }
#flash.go { animation: flash .9s steps(1) 1; }
@keyframes flash { 0%, 20%, 40% { opacity: 1; } 10%, 30%, 50% { opacity: 0; } 60% { opacity: 1; } 100% { opacity: 0; } }

/* ----- dialogues ----- */
#dialog { position: absolute; left: 50%; bottom: calc(12px + var(--safe-b) + var(--hub-dock, 0px)); transform: translateX(-50%); width: min(720px, calc(100% - 20px)); z-index: 12; padding: 18px 20px 16px; border-radius: 18px; background: linear-gradient(#fffdf4, #f7ecd2); color: var(--paper-ink); border: 4px solid #1d1633; box-shadow: 0 6px 0 rgba(0, 0, 0, .45), inset 0 0 0 3px #e0c98c; min-height: 104px; cursor: pointer; animation: pop .16s ease-out; }
.dlg-name { position: absolute; left: 14px; top: -17px; padding: 3px 14px; border-radius: 10px; border: 3px solid #1d1633; background: var(--c, #4a6fd0); color: #fff; font-weight: 900; font-size: 14px; letter-spacing: .03em; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.dlg-name:empty { display: none; }
.dlg-text { font-size: 18px; font-weight: 700; line-height: 1.4; min-height: 50px; white-space: pre-wrap; }
.dlg-text b, .dlg-text strong { color: #a02e42; }
.dlg-text code { background: rgba(59, 43, 24, .12); color: #2a3a8a; }
.dlg-next { position: absolute; right: 18px; bottom: 10px; width: 0; height: 0; border: 9px solid transparent; border-top: 12px solid #d63e56; border-bottom: 0; animation: bob 0.7s infinite alternate; }
.dlg-next.hide { display: none; }
@keyframes bob { to { transform: translateY(4px); } }
.dlg-choices { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.dlg-choices:empty { display: none; }
.dlg-choices button { text-align: left; padding: 10px 16px; border-radius: 12px; background: #fff; border: 3px solid #1d1633; color: var(--paper-ink); font-weight: 800; font-size: 16px; box-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
.dlg-choices button:hover, .dlg-choices button.sel { background: #ffe9a0; transform: translateX(4px); }
.dlg-choices button:active { transform: translateY(2px); }
@keyframes pop { from { transform: translateX(-50%) scale(.92); opacity: 0; } }

/* ----- boutons génériques ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 14px; font-weight: 900; font-size: 15px; background: linear-gradient(#5a4eb0, #3a3080); border: 3px solid #1d1633; box-shadow: 0 4px 0 rgba(0, 0, 0, .4), inset 0 2px 0 rgba(255, 255, 255, .22); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .3); transition: transform .08s, filter .15s; }
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .4); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.gold { background: linear-gradient(#ffd24a, #e8a81a); color: #4a2e00; text-shadow: 0 1px 0 rgba(255, 255, 255, .4); }
.btn.green { background: linear-gradient(#4be08a, #1fb870); color: #022a18; text-shadow: 0 1px 0 rgba(255, 255, 255, .35); }
.btn.red { background: linear-gradient(#ff7a90, #d63e56); }
.btn.ghost { background: rgba(255, 255, 255, .08); box-shadow: none; border-color: var(--line); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 11px; }
.btn.wide { width: 100%; }

/* ----- écrans plein cadre ----- */
.screen { position: absolute; inset: 0; z-index: 41; display: flex; flex-direction: column; background: radial-gradient(900px 500px at 80% -10%, rgba(255, 122, 217, .13), transparent), radial-gradient(800px 500px at 0 0, rgba(77, 163, 255, .15), transparent), var(--bg); animation: fadein .18s; padding-top: var(--safe-t); }
.screen.light { background: var(--paper); color: var(--paper-ink); }
@keyframes fadein { from { opacity: 0; transform: scale(.985); } }
.s-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: linear-gradient(#352c78, #261f58); border-bottom: 4px solid #1d1633; box-shadow: 0 4px 0 rgba(0, 0, 0, .25); z-index: 2; }
.s-head h2 { margin: 0; flex: 1; font-size: 19px; font-weight: 900; letter-spacing: .02em; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); display: flex; align-items: center; gap: 8px; min-width: 0; }
.s-head .x { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: #d63e56; border: 3px solid #1d1633; box-shadow: 0 3px 0 rgba(0, 0, 0, .4); color: #fff; font-size: 20px; flex: none; }
.s-head .x:active { transform: translateY(2px); }
.s-head .meta { font-size: 13px; color: var(--muted); font-weight: 700; display: flex; gap: 10px; align-items: center; }
.s-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 14px 14px calc(18px + var(--safe-b) + var(--hub-dock, 0px)); -webkit-overflow-scrolling: touch; }
.s-body.pad0 { padding: 0; }
.sheet-wrap { position: absolute; inset: 0; z-index: 41; background: rgba(8, 5, 24, .6); display: flex; align-items: flex-end; justify-content: center; animation: fadein .15s; }
.sheet { width: min(640px, 100%); max-height: 86%; display: flex; flex-direction: column; background: var(--bg); border: 4px solid #1d1633; border-bottom: 0; border-radius: 22px 22px 0 0; box-shadow: 0 -6px 0 rgba(0, 0, 0, .3); animation: up .22s ease-out; padding-bottom: var(--hub-dock, 0px); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet .s-head { border-radius: 18px 18px 0 0; }
.center-modal { position: absolute; inset: 0; z-index: 45; background: rgba(8, 5, 24, .72); display: flex; align-items: center; justify-content: center; padding: 14px; animation: fadein .15s; }
.cm { width: min(460px, 100%); max-height: 92%; overflow: auto; background: var(--panel); border: 4px solid #1d1633; border-radius: 20px; padding: 18px; box-shadow: 0 8px 0 rgba(0, 0, 0, .4); text-align: center; animation: popm .2s ease-out; }
.cm h3 { margin: 4px 0 8px; font-size: 22px; font-weight: 900; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.cm p { margin: 8px 0; color: var(--muted); font-weight: 600; }
.cm .row { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
@keyframes popm { from { transform: scale(.85); opacity: 0; } }

/* ----- menu principal ----- */
.menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 560px; margin: 0 auto; }
.mi { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px 8px 12px; border-radius: 18px; background: linear-gradient(#352c78, #2a2262); border: 4px solid #1d1633; box-shadow: 0 5px 0 rgba(0, 0, 0, .4), inset 0 3px 0 rgba(255, 255, 255, .14); font-weight: 900; font-size: 15px; text-align: center; transition: transform .1s; min-height: 108px; }
.mi:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .4); }
.mi .big { font-size: 38px; display: flex; }
.mi .big .ic { width: 1em; height: 1em; }
.mi small { font-size: 12px; color: var(--muted); font-weight: 700; }
.mi .dot { position: absolute; top: 8px; right: 10px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: var(--red); border: 2px solid #1d1633; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.mi.wide { grid-column: 1 / -1; min-height: 64px; flex-direction: row; gap: 12px; }
.mi.wide .big { font-size: 28px; }

/* ----- hub façon Clash of Clans : le joueur, puis de grandes actions illustrées ----- */
.hub { max-width: 560px; margin: 0 auto; }
.hub-top { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px 8px 8px; border-radius: 18px; background: linear-gradient(#3a3080, #291f5e); border: 4px solid #1d1633; box-shadow: 0 5px 0 rgba(0, 0, 0, .4), inset 0 3px 0 rgba(255, 255, 255, .16); text-align: left; }
.ht-av { flex: none; width: 52px; height: 62px; display: flex; align-items: flex-end; justify-content: center; border-radius: 13px; background: radial-gradient(ellipse at 50% 94%, rgba(255, 210, 74, .34), transparent 72%), #221a4e; border: 3px solid #1d1633; overflow: hidden; }
.ht-av canvas { width: 42px; height: 74px; image-rendering: pixelated; }
.ht-id { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.ht-id b { font-size: 17px; font-weight: 900; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht-id small { color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.3; }
.ht-res { flex: none; display: flex; flex-direction: column; gap: 5px; }
.res { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px 2px 3px; border-radius: 999px; background: #16113a; border: 3px solid #1d1633; font-size: 13.5px; font-weight: 900; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .12); font-variant-numeric: tabular-nums; }
.res .ic { width: 21px; height: 21px; }
.res.coin b { color: var(--gold); }
.res.crate b { color: #e8b27a; }
.hub .goal-card { display: block; width: 100%; text-align: left; margin-top: 12px; }

.acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.act { position: relative; display: flex; flex-direction: column; padding: 0; overflow: hidden; border-radius: 18px; background: linear-gradient(#352c78, #241d55); border: 4px solid #1d1633; box-shadow: 0 5px 0 rgba(0, 0, 0, .4), inset 0 3px 0 rgba(255, 255, 255, .14); text-align: left; transition: transform .1s; }
.act:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .4); }
.act .art { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; border-bottom: 4px solid #1d1633; background: #4a8a3a; }
.act .lb { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px 9px; }
.act .lb b { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 900; }
.act .lb b .ic { width: 21px; height: 21px; }
.act .lb small { color: var(--muted); font-size: 11.5px; font-weight: 700; line-height: 1.25; }
.act.big { grid-column: 1 / -1; }
.act.big .art { aspect-ratio: 3 / 1; }
.act.big .lb b { font-size: 17px; }
.act.gold { background: linear-gradient(#ffd24a, #e8a81a); color: #4a2e00; }
.act.gold .lb small { color: #6b4a06; }
.act.war { background: linear-gradient(#c0392b, #7a1f2b); }
.act.war .lb small { color: #ffd9d0; }
.act .tag { position: absolute; z-index: 2; top: 8px; right: 8px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 900; color: #fff; background: var(--red); border: 2px solid #1d1633; box-shadow: 0 2px 0 rgba(0, 0, 0, .35); }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 16px; background: linear-gradient(#332b74, #262058); border: 4px solid #1d1633; box-shadow: 0 4px 0 rgba(0, 0, 0, .36), inset 0 3px 0 rgba(255, 255, 255, .12); font-weight: 900; font-size: 14px; text-align: left; transition: transform .1s; color: inherit; text-decoration: none; }
.tile:active { transform: translateY(2px); }
.tile > .ic { width: 28px; height: 28px; flex: none; }
.tile .t { display: flex; flex-direction: column; min-width: 0; }
.tile .t small { color: var(--muted); font-size: 11.5px; font-weight: 700; }
.tile.wide { grid-column: 1 / -1; }
.tile.set { background: linear-gradient(#ffd24a, #e8a81a); color: #4a2e00; }
.tile.set .t small { color: #6b4a06; }
.tile .dot { position: absolute; top: 6px; right: 8px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--red); border: 2px solid #1d1633; font-size: 12.5px; display: flex; align-items: center; justify-content: center; }
/* ----- liste des villages des autres joueurs ----- */
.vv { display: flex; flex-direction: column; gap: 8px; }
.vv-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 16px; background: linear-gradient(#2f2768, #241d55); border: 4px solid #1d1633; box-shadow: 0 4px 0 rgba(0, 0, 0, .34), inset 0 2px 0 rgba(255, 255, 255, .1); }
.vv-av { flex: none; width: 44px; height: 52px; display: flex; align-items: flex-end; justify-content: center; border-radius: 12px; background: radial-gradient(ellipse at 50% 94%, rgba(255, 210, 74, .3), transparent 72%), #1d1746; border: 3px solid #1d1633; overflow: hidden; }
.vv-av canvas { width: 34px; height: 60px; image-rendering: pixelated; }
.vv-t { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.vv-t b { font-size: 15px; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vv-t small { color: var(--muted); font-size: 11.5px; font-weight: 700; }
.vv-b { flex: none; display: flex; align-items: center; gap: 6px; }
.vv-b .btn .ic { width: 18px; height: 18px; }

/* les anciennes listes d'actions empilées (village, guerre) passent aux grilles ci-dessus */
.vh-acts, .gw-acts, .fa-acts { display: block; margin-top: 14px; }
.vh-acts > .acts, .gw-acts > .acts, .fa-acts > .acts { margin-top: 0; }
.vh-acts .btn.wide + .btn.wide, .gw-acts .btn.wide + .btn.wide, .fa-acts .btn.wide + .btn.wide { margin-top: 8px; }

/* ----- composants ----- */
.card { background: var(--panel); border: 3px solid #1d1633; border-radius: var(--r); padding: 12px 14px; box-shadow: 0 4px 0 rgba(0, 0, 0, .3); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--c, #5a4eb0); color: #fff; border: 2px solid #1d1633; text-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.chip.dim { background: #3a3358; color: var(--muted); }
.bar { height: 14px; border-radius: 8px; background: #14102a; border: 3px solid #1d1633; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(#ffe08a, #e8a81a); transition: width .4s; }
.h3 { margin: 18px 0 8px; font-size: 13px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-weight: 700; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 4px; }
.tabs button { flex: none; padding: 8px 14px; border-radius: 12px; background: #2a2262; border: 3px solid #1d1633; font-weight: 800; font-size: 13.5px; }
.tabs button.on { background: var(--gold); color: #4a2e00; }

/* ----- écran titre ----- */
.title { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; overflow: hidden; background: linear-gradient(#2a1f6a 0%, #5a3ea8 45%, #e07ab8 78%, #ffb870 100%); }
.title canvas { position: absolute; left: 0; bottom: var(--vp-hidden, 0px); width: 100%; height: 46%; pointer-events: none; }
.title .logo { position: relative; z-index: 2; font-weight: 900; line-height: .92; letter-spacing: .02em; font-size: clamp(42px, 11vw, 92px); color: #ffd24a; text-shadow: 0 5px 0 #a8501a, 0 9px 0 #1d1633, 0 0 40px rgba(255, 210, 74, .5); -webkit-text-stroke: 3px #1d1633; paint-order: stroke fill; transform: rotate(-3deg); animation: logo 3s ease-in-out infinite alternate; }
.title .logo .cy { display: inline-block; font-size: .62em; color: #7ee8ff; letter-spacing: .3em; text-shadow: 0 4px 0 #1f6b8a, 0 7px 0 #1d1633, 0 0 30px rgba(126, 232, 255, .55); margin-bottom: 2px; }
.title .logo small { display: block; font-size: .36em; color: #fff; text-shadow: 0 3px 0 #1d1633; letter-spacing: .12em; margin-top: 10px; -webkit-text-stroke: 2px #1d1633; }
@keyframes logo { to { transform: rotate(-3deg) translateY(-8px) scale(1.02); } }
.title .menu { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 12px; margin-top: 34px; width: min(300px, 80vw); }
.title .menu .btn { padding: 14px; font-size: 18px; }
.title .menu .btn.ghost { background: rgba(34, 24, 86, .9); border-color: #6a5ec8; padding: 10px; font-size: 16px; }
@media (max-height: 760px) { .title .menu { gap: 9px; margin-top: 22px; } .title .menu .btn { padding: 11px; font-size: 17px; } .title .menu .btn.ghost { padding: 8px; font-size: 15px; } }
.title .menu .btn .ic { width: 1.15em; height: 1.15em; }
@media (max-height: 690px) { .title .tlogo { display: none; } .title .menu { margin-top: 16px; } }
.title .credit { position: absolute; z-index: 2; top: calc(12px + var(--safe-t)); left: 0; right: 0; padding: 0 10px; font-size: 12px; color: rgba(255, 255, 255, .85); font-weight: 700; text-shadow: 0 2px 0 #1d1633; }
.title .stars { position: absolute; inset: 0; background-image: radial-gradient(2px 2px at 20% 15%, #fff, transparent), radial-gradient(2px 2px at 70% 25%, #fff, transparent), radial-gradient(1.5px 1.5px at 40% 8%, #fff, transparent), radial-gradient(2px 2px at 85% 10%, #fff, transparent), radial-gradient(1.5px 1.5px at 10% 35%, #fff, transparent), radial-gradient(2px 2px at 58% 40%, #fff9, transparent); animation: twinkle 2.4s infinite alternate; }
@keyframes twinkle { to { opacity: .45; } }
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; margin: 10px 0; }
.field label { font-weight: 900; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.field input { font: 800 20px var(--font); padding: 10px 14px; border-radius: 12px; border: 3px solid #1d1633; background: #fff; color: #1d1633; outline: none; user-select: text; -webkit-user-select: text; }
.field input:focus { box-shadow: 0 0 0 4px rgba(255, 210, 74, .6); }
.looks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.look { border-radius: 14px; border: 4px solid #1d1633; background: #3a3080; padding: 6px 2px 2px; display: flex; flex-direction: column; align-items: center; }
.look.on { background: var(--gold); box-shadow: 0 0 0 3px #fff; }
.look canvas { width: 36px; height: 64px; image-rendering: pixelated; }
.hero-prev { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 4px 0 14px; padding: 14px 0 10px; border-radius: 18px; background: radial-gradient(ellipse at 50% 85%, rgba(255, 210, 74, .25), transparent 65%), #231b52; border: 3px solid #1d1633; }
.hero-prev canvas { width: 90px; height: 160px; image-rendering: pixelated; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .35)); animation: bobt 1s ease-in-out infinite alternate; }
.hero-nm { font-weight: 900; font-size: 20px; color: var(--gold); text-shadow: 0 2px 0 #1d1633; }

