:root {
  --bg: #0b0d17;
  --panel-top: #24357a;
  --panel-bot: #101a4a;
  --border: #c8d3ff;
  --text: #eef2ff;
  --muted: #9aa6d1;
  --gold: #f5c84c;
  --player: #7ea6ff;
  --enemy: #ff7070;
  --ally: #7be39a;
  --hp: #4ade80;
  --mp: #60a5fa;
  --xp: #f5c84c;
  --pixel: "Press Start 2P", "Courier New", monospace;
  --retro: "VT323", "Consolas", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 20px/1.15 var(--retro);
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: linear-gradient(#151b3a, #0b0f24);
  border-bottom: 2px solid #2c3870;
}

.topbar h1 {
  margin: 0;
  font: 16px var(--pixel);
  color: var(--gold);
  text-shadow: 2px 2px 0 #3a1d00;
}

.topbar h1 span {
  margin-left: 10px;
  font: 18px var(--retro);
  color: var(--muted);
  text-shadow: none;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.turn {
  margin-left: auto;
  display: flex;
  gap: 14px;
  font: 11px var(--pixel);
}

.turn #phase { color: var(--player); }
.turn.enemy #phase { color: var(--enemy); }

.actions { display: flex; gap: 6px; }

button {
  font: 11px var(--pixel);
  color: var(--text);
  background: linear-gradient(#2c3d86, #18235a);
  border: 2px solid #8696d8;
  border-radius: 4px;
  padding: 8px 12px;
  cursor: pointer;
}

button:hover:not(:disabled) { filter: brightness(1.25); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

button.primary {
  background: linear-gradient(#b8892a, #7a5512);
  border-color: var(--gold);
}

/* --- plateau ------------------------------------------------------------------ */

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  min-height: 0;
}

.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #07091a;
}

#board {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  image-rendering: pixelated;
  touch-action: manipulation; /* pas de zoom au double appui sur mobile */
  -webkit-tap-highlight-color: transparent;
}

button { touch-action: manipulation; }

/* Bouton « Retour » (équivalent du clic droit), surtout utile sur écran tactile */
.back-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  font-size: 10px;
  padding: 8px 12px;
}

.back-btn[hidden] { display: none; }

.window {
  background: linear-gradient(var(--panel-top), var(--panel-bot));
  border: 2px solid var(--border);
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px #0a0f2e, 0 4px 14px rgba(0, 0, 0, 0.5);
  padding: 10px 12px;
}

.window h3 {
  margin: 0 0 8px;
  font: 10px var(--pixel);
  color: var(--gold);
  text-transform: none; /* la police pixel n’a pas de majuscules accentuées */
}

/* menu d'action façon JRPG */
.menu {
  position: absolute;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 190px;
  padding: 6px;
}

.menu[hidden] { display: none; }

.menu button {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 7px 8px 7px 24px;
  background: transparent;
  border: 0;
  text-align: left;
  font-size: 10px;
}

.menu button:hover:not(:disabled),
.menu button:focus-visible,
.menu button:focus {
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

.menu button:hover:not(:disabled)::before,
.menu button:focus::before {
  content: '▶';
  position: absolute;
  left: 7px;
  color: var(--gold);
}

.menu small { font: 16px var(--retro); color: #a9c4ff; }

/* bannière de phase */
.banner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
}

.banner.show { animation: banner 1.3s ease forwards; }

.banner-inner {
  padding: 16px 90px;
  text-align: center;
  background: linear-gradient(90deg, transparent, rgba(10, 14, 40, 0.94) 20%, rgba(10, 14, 40, 0.94) 80%, transparent);
  border-top: 3px solid var(--gold);
  border-bottom: 3px solid var(--gold);
}

.banner h2 {
  margin: 0;
  font: 26px var(--pixel);
  color: #fff;
  text-shadow: 3px 3px 0 #000;
}

.banner p {
  margin: 10px 0 0;
  font: 10px var(--pixel);
  color: var(--gold);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

@keyframes banner {
  0% { opacity: 0; transform: translateX(-40px); }
  18% { opacity: 1; transform: none; }
  78% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateX(40px); }
}

.hint {
  position: absolute;
  left: 50%;
  bottom: 10px;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 4px 14px;
  transform: translateX(-50%);
  border: 1px solid #36447f;
  border-radius: 999px;
  background: rgba(8, 10, 24, 0.82);
  color: #cfd8ff;
  font-size: 19px;
  text-align: center;
  pointer-events: none;
}

.hint[hidden] { display: none; }

.end {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgba(4, 6, 16, 0.7);
}

.end[hidden] { display: none; }

.end-box { padding: 26px 44px; text-align: center; }
.end-box h2 { margin: 0 0 14px; font: 28px var(--pixel); }
.end-box.win h2 { color: var(--gold); }
.end-box.lose h2 { color: var(--enemy); }
.end-box p { margin: 0 0 18px; font-size: 22px; }

/* --- panneau latéral ------------------------------------------------------------ */

.side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  overflow-y: auto;
  background: #0d1128;
  border-left: 2px solid #2c3870;
}

.muted { margin: 0; color: var(--muted); }

.unit-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.unit-head strong { font: 11px var(--pixel); }
.unit-head.player strong { color: var(--player); }
.unit-head.enemy strong { color: var(--enemy); }
.unit-head.ally strong { color: var(--ally); }
.unit-head span { color: var(--muted); }

.bars {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 4px 6px;
  align-items: center;
  color: var(--muted);
}

.bar {
  position: relative;
  height: 16px;
  overflow: hidden;
  background: #070a1c;
  border: 1px solid #44508a;
}

.bar span { position: absolute; inset: 0 auto 0 0; background: var(--hp); }
.bar.mp span { background: var(--mp); }
.bar.xp span { background: var(--xp); }

.bar em {
  position: relative;
  display: block;
  font-style: normal;
  font-size: 17px;
  line-height: 14px;
  text-align: center;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, auto 1fr);
  gap: 0 6px;
  margin: 8px 0 4px;
}

.stats dt { color: var(--muted); }
.stats dd { margin: 0; color: #fff; }

.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

.tag {
  padding: 0 7px;
  border: 1px solid #5d6db0;
  border-radius: 999px;
  background: #2b3a7a;
  font-size: 16px;
}

.tag.gold { background: #6b5214; border-color: var(--gold); }
.tag.dim { opacity: 0.7; }

.terrain { margin: 8px 0 0; color: var(--muted); }

.fc-title { margin-bottom: 4px; }
.fc-title small { color: var(--muted); }
.fc-row { display: flex; justify-content: space-between; gap: 8px; }
.fc-dmg { font: 16px var(--pixel); color: #ffe27a; }
.fc-mods { color: #c8d0f5; font-size: 17px; }
.fc-ko { color: var(--enemy); }
.fc-row.counter { margin-top: 2px; color: #ffb4aa; }

b.player { color: var(--player); font-weight: normal; }
b.enemy { color: var(--enemy); font-weight: normal; }
b.ally { color: var(--ally); font-weight: normal; }

.log-box { display: flex; flex-direction: column; min-height: 160px; flex: 1; }

#log {
  flex: 1;
  max-height: 300px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  font-size: 18px;
}

#log li { padding: 2px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
#log li.sys { color: var(--gold); }
#log li.ko { color: #ffb4b4; }
#log li.lvl { color: #7dffcf; }
#log i { color: var(--muted); font-style: normal; }

.help summary {
  cursor: pointer;
  font: 10px var(--pixel);
  color: var(--gold);
  text-transform: none;
}

.help ul { margin: 8px 0 0; padding-left: 18px; color: #d6dcfa; font-size: 18px; }
.help li { margin-bottom: 4px; }

@media (max-width: 860px) {
  body { overflow: auto; }
  .layout { grid-template-columns: 1fr; grid-template-rows: 62vh auto; }
  .side { border-left: 0; border-top: 2px solid #2c3870; }
  /* Barre du haut sur deux lignes : titre et tour, puis les boutons alignés, sans libellé coupé */
  .topbar { flex-wrap: wrap; gap: 6px 10px; padding: 8px 10px; }
  .topbar h1 { font-size: 12px; }
  .topbar h1 span { display: none; }
  .turn { font-size: 9px; gap: 8px; }
  .actions { width: 100%; display: grid; grid-template-columns: auto auto auto 1fr auto; gap: 6px; }
  .wide-only { display: none; } /* « Menace » réduit à son icône ⚠ pour laisser la place à « Fin du tour » */
  .hint { left: 12px; right: 12px; transform: none; max-width: none; }
  .actions button { min-width: 42px; min-height: 40px; padding: 9px 6px; font-size: 9px; white-space: nowrap; }
}

.end-actions { display: flex; justify-content: center; gap: 10px; }

/* --- écran titre --------------------------------------------------------------- */

.title-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: #070914;
}

.title-screen[hidden] { display: none; }

/* L'illustration garde ses proportions ; tout ce qui est posé dessus est en % de l'image */
.title-art {
  position: relative;
  width: min(100vw, calc(100vh * 1672 / 941));
  aspect-ratio: 1672 / 941;
  container-type: inline-size;
}

.title-bg {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
}

/* Sous le logo, à gauche (x 199→562 px, y 389→719 px sur 1672×941) */
.title-menu {
  position: absolute;
  left: 11.9%;
  top: 41.3%;
  width: 21.7%;
  height: 35.1%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.35cqw 0.45cqw;
}

.title-menu button {
  position: relative;
  height: 13.4%;
  padding: 0 0 0 2.7cqw;
  font: 1.75cqw/1 var(--retro);
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  color: #c9d4f0;
  background: linear-gradient(rgba(27, 36, 80, 0.88), rgba(16, 22, 58, 0.88));
  border: 0.12cqw solid #4a5687;
  box-shadow: 0 0.25cqw 0.6cqw rgba(0, 0, 0, 0.45);
  border-radius: 0;
  clip-path: polygon(0.8cqw 0, calc(100% - 0.8cqw) 0, 100% 50%, calc(100% - 0.8cqw) 100%, 0.8cqw 100%, 0 50%);
}

.title-menu button:hover:not(:disabled),
.title-menu button:focus {
  outline: none;
  filter: none;
  color: #f7d77c;
  border-color: #e7b84a;
  background: linear-gradient(#2a2a52, #171a3c);
}

.title-menu button:focus::before {
  content: '✦';
  position: absolute;
  left: 0.9cqw;
  color: #f7d77c;
}

.title-menu button:disabled { color: #5d6890; opacity: 1; }

.title-hint {
  position: absolute;
  left: 50%;
  bottom: 1.2%;
  margin: 0;
  transform: translateX(-50%);
  font: 1.25cqw var(--retro);
  color: rgba(230, 236, 255, 0.75);
  text-shadow: 0.1cqw 0.1cqw 0 #000;
  white-space: nowrap;
}

/* Liens légaux, en bas à droite de l'illustration */
.title-legal {
  position: absolute;
  right: 1.2%;
  bottom: 1.2%;
  font: 1.1cqw var(--retro);
  color: rgba(230, 236, 255, 0.6);
  text-shadow: 0.1cqw 0.1cqw 0 #000;
}

.title-legal a { color: rgba(230, 236, 255, 0.75); text-decoration: none; }
.title-legal a:hover, .title-legal a:focus { color: #f7d77c; text-decoration: underline; }

/* --- fenêtres (pause, options, galerie, crédits) ---------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 6, 16, 0.72);
}

.modal[hidden] { display: none; }

.modal-box {
  width: min(460px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 18px 20px;
}

.modal-box h2 {
  margin: 0 0 12px;
  font: 16px var(--pixel);
  color: var(--gold);
  text-align: center;
}

.modal-body p { margin: 0 0 10px; }
.modal-note { color: #7dffcf; }

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.modal-pause .modal-actions,
.modal-quit .modal-actions { flex-direction: column; align-items: stretch; }

.modal-actions small {
  display: block;
  margin-top: 4px;
  font: 15px var(--retro);
  color: var(--muted);
}

.opt-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 12px;
}

.choices { display: flex; flex-wrap: wrap; gap: 6px; }

.choice {
  font-size: 9px;
  padding: 7px 10px;
  background: #141b42;
}

.choice.on { border-color: var(--gold); color: var(--gold); }
.choice.danger { border-color: #c45a5a; }

.modal-gallery { width: min(880px, 100%); }
.modal-gallery h3 { margin: 6px 0 10px; font: 11px var(--pixel); color: var(--gold); }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.card {
  display: flex;
  gap: 10px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid #44508a;
}

.card canvas { flex: none; width: 52px; height: 72px; image-rendering: pixelated; }
.card strong { display: block; font: 10px var(--pixel); }
.card.player strong { color: var(--player); }
.card.enemy strong { color: var(--enemy); }
.card-class { color: var(--muted); }
.card p { margin: 4px 0 0; font-size: 17px; }
.card .card-stats { color: #a9b6e6; font-size: 16px; }

.credits { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 12px; }
.credits dt { color: var(--muted); }
.credits dd { margin: 0; }

#log li.save { color: #8fb4ff; }

/* --- objectif, bilan de victoire ---------------------------------------------- */

#objective { margin: 0; color: #f3e6b8; }

.recap { list-style: none; margin: 8px 0 12px; padding: 0; text-align: left; }
.recap li { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.recap i { color: var(--muted); font-style: normal; }
.recap .up { color: #7dffcf; font-weight: normal; }

/* --- dialogues ---------------------------------------------------------------- */

.dialogue {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 40px 16px 18px;
  background: linear-gradient(transparent, rgba(4, 6, 16, 0.85) 45%);
}

.dialogue[hidden] { display: none; }

.dialogue-box {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: min(880px, 100%);
  min-height: 150px;
  padding: 14px 18px;
  cursor: pointer;
}

#dlg-portrait {
  flex: none;
  width: 78px;
  height: 108px;
  image-rendering: pixelated;
  background: radial-gradient(circle at 50% 60%, rgba(255, 255, 255, 0.12), transparent 70%);
  border: 2px solid #44508a;
}

#dlg-portrait[hidden] { display: none; }

.dlg-content { flex: 1; min-width: 0; }
.dlg-name { margin-bottom: 8px; font: 12px var(--pixel); color: var(--gold); }
.dlg-name.player { color: var(--player); }
.dlg-name.enemy { color: var(--enemy); }
.dlg-name.ally { color: var(--ally); }
#dlg-text { margin: 0; font-size: 24px; line-height: 1.25; }
.dialogue.narrator #dlg-text { font-style: italic; color: #d9d2f5; }

.dlg-next {
  position: absolute;
  right: 14px;
  bottom: 8px;
  color: var(--gold);
  animation: blink 1s steps(2) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.dlg-skip {
  align-self: flex-end;
  margin-right: max(0px, calc((100% - 880px) / 2));
  font-size: 9px;
  padding: 6px 10px;
}

/* --- cartes de chapitre --------------------------------------------------------- */

.chapter-card {
  position: fixed;
  inset: 0;
  z-index: 16;
  display: grid;
  place-items: center;
  background: #05060d;
  cursor: pointer;
}

.chapter-card[hidden] { display: none; }
.chapter-card.show .card-inner { animation: card-in 3.2s ease forwards; }

.card-inner { text-align: center; padding: 0 16px; }
.card-kicker { margin: 0 0 14px; font: 12px var(--pixel); color: var(--gold); letter-spacing: 0.3em; }
.chapter-card h2 { margin: 0; font: 28px var(--pixel); color: #fff; text-shadow: 3px 3px 0 #3a1d00; }
.card-sub { margin: 16px 0 0; font-size: 24px; color: #cfd8ff; }

@keyframes card-in {
  0% { opacity: 0; transform: translateY(8px); }
  20% { opacity: 1; transform: none; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* --- états (poison, étourdi) ----------------------------------------------------- */

.tag.poison { background: #1f4a1a; border-color: #7ddc4a; }
.tag.stun { background: #5a4a10; border-color: #ffe27a; }
.fc-note { color: #b8f59a; font-style: normal; }

/* --- camp de l'escouade ----------------------------------------------------------- */

.camp {
  position: fixed;
  inset: 0;
  z-index: 17;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(circle at 50% 30%, #1d2554, #05060d 75%);
  overflow-y: auto;
}

.camp[hidden] { display: none; }

.camp-box { width: min(1100px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 18px 22px; }

.camp-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.camp-head .card-kicker { margin: 0 0 6px; }
.camp-head h2 { margin: 0; font: 14px var(--pixel); color: #fff; }
.camp-gold { font: 18px var(--pixel); color: var(--gold); white-space: nowrap; }
.camp-gold small { font: 18px var(--retro); color: var(--muted); }

.camp-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 18px; }
.camp-cols h3 { margin: 4px 0 8px; font: 10px var(--pixel); color: var(--gold); }

.camp-hero {
  display: flex;
  gap: 10px;
  padding: 6px 8px;
  margin-bottom: 6px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid #36447f;
}

.camp-hero canvas { flex: none; width: 39px; height: 54px; image-rendering: pixelated; }
.camp-hero strong { font: 10px var(--pixel); }
.camp-hero p { margin: 2px 0 0; }
.camp-stats { color: #cfd8ff; }
.camp-gear { color: var(--muted); font-size: 17px; }
.camp-gear i { color: #a6e3a1; font-style: normal; }

.shop-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.shop-row.gear { align-items: flex-start; flex-direction: column; gap: 6px; }
.shop-row small { color: var(--muted); font-size: 16px; }
.shop-row button { flex: none; font-size: 9px; padding: 6px 10px; }

.camp-note { min-height: 1.2em; margin: 10px 0 0; color: #7dffcf; }
.camp-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.recap-gold { margin: 0 0 10px; color: var(--gold); }

@media (max-width: 860px) {
  .camp-cols { grid-template-columns: 1fr; }
  .camp-box { padding: 14px; overflow-x: hidden; }
  .camp-head { flex-wrap: wrap; align-items: flex-start; }
  .camp-head h2 { font-size: 11px; line-height: 1.4; }
  .camp-gold { font-size: 14px; }
}

/* bouton à bascule (zone de menace) */
button.toggle { opacity: 0.7; }
button.toggle.on { opacity: 1; border-color: #ff8a9a; color: #ffd0d6; background: linear-gradient(#5a2030, #351320); }

/* --- téléphones et tablettes ------------------------------------------------------- */

@media (max-width: 860px) {
  .hint { font-size: 15px; padding: 3px 10px; max-width: calc(100% - 24px); bottom: 6px; }
  .dialogue-box { min-height: 120px; padding: 10px 12px; gap: 10px; }
  #dlg-portrait { width: 52px; height: 72px; }
  #dlg-text { font-size: 20px; }
  .banner h2 { font-size: 18px; }
  .banner-inner { padding: 12px 40px; }
}

/* Écran titre en portrait : l'illustration en plein écran, cadrée sur les héros ; logo en haut,
   menu au centre dans un panneau translucide */
.title-logo { display: none; }

@media (max-aspect-ratio: 1/1) {
  .title-screen { display: block; overflow-y: auto; }
  .title-art {
    width: 100%;
    min-height: 100%;
    aspect-ratio: auto;
    container-type: normal;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: max(3vh, env(safe-area-inset-top)) 0 32vh;
  }
  .title-art::before { /* voile sombre pour la lisibilité du menu */
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    /* très sombre en haut (masque le logo de l'illustration, remplacé par .title-logo), clair en bas (les héros) */
    background: linear-gradient(rgba(5, 6, 16, 0.96) 0%, rgba(5, 6, 16, 0.92) 42%, rgba(5, 6, 16, 0.4) 62%, rgba(5, 6, 16, 0.05) 80%);
  }
  .title-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    object-fit: cover;
    object-position: 42% 100%;
  }
  .title-logo {
    display: block;
    width: min(94vw, 460px);
    -webkit-mask-image: radial-gradient(ellipse 52% 50% at 50% 50%, #000 62%, transparent 100%);
    mask-image: radial-gradient(ellipse 52% 50% at 50% 50%, #000 62%, transparent 100%);
  }
  .title-menu {
    position: static;
    width: min(84vw, 330px);
    height: auto;
    gap: 10px;
    margin-top: 1vh;
    padding: 14px;
    background: rgba(8, 10, 28, 0.62);
    border: 1px solid rgba(231, 184, 74, 0.45);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }
  .title-menu button {
    height: 46px;
    padding-left: 44px;
    font-size: 23px;
    border-width: 1px;
    clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 12px 100%, 0 50%);
  }
  .title-menu button:focus::before { left: 20px; }
  .title-hint { display: none; }
  .title-legal {
    position: static;
    margin-top: 14px;
    padding: 4px 10px;
    font-size: 17px;
    background: rgba(5, 6, 16, 0.7);
    border-radius: 6px;
  }
}
}

/* --- choix de la difficulté ---------------------------------------------------------- */

.modal-difficulty { width: min(520px, 100%); }
.difficulty-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 8px 0 0; }
.difficulty-list dt { font: 10px var(--pixel); color: var(--gold); padding-top: 4px; }
.difficulty-list dd { margin: 0; color: #d6dcfa; }

/* --- conseils contextuels --------------------------------------------------------------- */

.tip {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 6;
  width: min(340px, calc(100% - 20px));
  padding: 10px 12px;
  border-color: var(--gold);
  animation: tip-in 0.25s ease-out;
}

.tip[hidden] { display: none; }
.tip strong { display: block; margin-bottom: 4px; font: 10px var(--pixel); color: var(--gold); }
.tip p { margin: 0 0 8px; font-size: 19px; line-height: 1.15; }
.tip button { float: right; font-size: 9px; padding: 6px 10px; }

@keyframes tip-in { from { opacity: 0; transform: translateY(-6px); } }

@media (max-width: 860px) {
  .tip { top: auto; bottom: 52px; right: 12px; width: calc(100% - 24px); }
  .tip p { font-size: 17px; }
}

/* --- compte et achat ----------------------------------------------------------------- */

.account-box {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px 8px;
  max-width: min(420px, calc(100% - 24px));
  padding: 8px 10px;
  background: rgba(8, 10, 28, 0.72);
  border: 1px solid rgba(231, 184, 74, 0.35);
  border-radius: 10px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.account-box:empty { display: none; }
.account-box small { width: 100%; text-align: right; color: var(--muted); font-size: 15px; }
.account-box button { font-size: 9px; padding: 6px 10px; }
.account-name { font: 10px var(--pixel); color: var(--player); }

.paywall-list { margin: 4px 0 10px; padding-left: 20px; }
.paywall-price { color: var(--gold); }
.paywall-google { margin: 6px 0; min-height: 44px; }

/* Case obligatoire avant l'achat : acceptation des CGV et renonciation au droit de rétractation */
.paywall-terms {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  margin: 10px 0 4px;
  padding: 8px 10px;
  font-size: 17px;
  line-height: 1.2;
  border: 1px solid rgba(231, 184, 74, 0.45);
  border-radius: 6px;
  cursor: pointer;
}
.paywall-terms input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--gold); cursor: pointer; }
.paywall-terms a { color: var(--player); }

@media (max-aspect-ratio: 1/1) {
  .account-box { position: relative; top: auto; right: auto; margin: 10px auto 0; justify-content: center; }
  .account-box small { text-align: center; }
}

/* --- camp : choix des héros déployés, promotions ---------------------------------------- */

.camp-hero.reserve { opacity: 0.55; }
.camp-hero-actions { margin: 4px 0; }
.choice.gold { border-color: var(--gold); color: var(--gold); }
