:root {
  --bg: #0f0b14;
  --bg-2: #1c1424;
  --card: #241a2e;
  --line: #3a2d47;
  --text: #f3ece0;
  --muted: #a99bb8;
  --accent: #ff7a1a;
  --accent-2: #ffb347;
  --boss: #c0392b;
  --player: #3fbf7f;
  --gold: #e8c26a;
  --danger: #e0503f;
  --radius: 14px;
}

* { box-sizing: border-box; }

/* L'app occupe tout l'écran, sans défilement ni zoom au double toucher.
   Sur ordinateur, elle se cadre en format téléphone au centre. */
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }

body {
  background: radial-gradient(circle at 50% -20%, #3a1f4a 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#app {
  position: fixed;
  inset: 0;
  max-width: 520px;
  margin: 0 auto;
  overflow: hidden;
}

.screen { position: absolute; inset: 0; text-align: center; }
[hidden] { display: none !important; }

/* Écrans de menu (accueil, victoire, game over) : centrés, tiennent sans défiler */
.screen-menu {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(12px + env(safe-area-inset-top)) 20px calc(12px + env(safe-area-inset-bottom));
  overflow-y: auto;
}
.screen-menu .btn { margin: 6px 0; }

h1 { font-size: clamp(1.7rem, 7vw, 2.2rem); margin: 0.15em 0; letter-spacing: 0.02em; }
h2 { font-size: 1.4rem; margin: 0.3em 0; }
h3 { font-size: 1rem; color: var(--muted); font-weight: 600; margin: 0 0 8px; }

.brand { color: var(--gold); text-transform: uppercase; letter-spacing: 0.2em; font-size: 0.75rem; margin: 0; }
.hook { font-size: clamp(0.95rem, 4vw, 1.1rem); color: var(--text); margin: 0.4em 0; }
.sub { color: var(--muted); margin-top: 0; }
.story { font-style: italic; color: var(--muted); }
.lys { font-size: clamp(3rem, 14vh, 5rem); margin: 1vh 0; filter: drop-shadow(0 0 18px rgba(255, 122, 26, 0.45)); }

/* ── Boutons ─────────────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  margin: 10px 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #1a0d00; }
.btn-secondary { background: transparent; border-color: var(--accent); color: var(--accent-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); font-weight: 400; }
.btn-small { width: auto; margin: 0; padding: 8px 14px; min-height: 40px; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ── Butin ───────────────────────────────────────────── */
.loot-emoji { font-size: 5rem; margin: 16px 0 0; }
.forge { background: rgba(232, 194, 106, 0.12); border: 1px solid var(--gold); border-radius: var(--radius); padding: 12px; }

/* ── Victoire ────────────────────────────────────────── */
.code-box { background: var(--card); border: 1px solid var(--gold); border-radius: var(--radius); padding: 16px; margin: 20px 0; }
.code-label { margin: 0; color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.15em; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 1.8rem; color: var(--gold); margin: 8px 0; user-select: all; word-break: break-all; }

/* ── Canvas pixel art : tout l'écran ──────────────────── */
.pixel {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #06121a;
  touch-action: none;
  cursor: pointer;
}

/* ── Bandeau du haut, posé sur la carte ─────────────── */
#screen-world { text-align: left; }
.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  padding: calc(6px + env(safe-area-inset-top)) 10px 10px;
  background: linear-gradient(180deg, rgba(10, 6, 16, 0.9) 0%, rgba(10, 6, 16, 0.65) 75%, rgba(10, 6, 16, 0) 100%);
  pointer-events: none;
}
.top-bar button { pointer-events: auto; }
.hud { display: flex; flex-direction: column; gap: 4px; }
.hud-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.goal { margin: 0; font-weight: 700; font-size: 0.82rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 2px #000; }
.hud-hp { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.hud-hp .bar { flex: 1; min-width: 40px; }
.hud-heart { font-size: 0.8rem; }
.hud-hp-num { font-variant-numeric: tabular-nums; font-size: 0.8rem; font-weight: 700; white-space: nowrap; text-shadow: 0 1px 2px #000; }
.bar-player.low { background: var(--danger); }
.gold { font-weight: 800; color: var(--gold); white-space: nowrap; font-size: 0.85rem; text-shadow: 0 1px 2px #000; }
.icon-btn {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(36, 26, 46, 0.85);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.bar { height: 10px; background: rgba(28, 20, 36, 0.9); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; transition: width 0.35s ease; }
.bar-boss { background: var(--boss); }
.bar-player { background: var(--player); }
.hint { color: var(--muted); font-size: 0.85rem; min-height: 1.2em; }

/* Bouton Sac flottant, au pouce (bas droite) */
.fab {
  position: absolute;
  right: 12px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 6;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: rgba(28, 20, 36, 0.92);
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.fab span { font-size: 0.62rem; font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: 0.06em; }
.fab:active { transform: scale(0.95); }

/* ── Combat : bandeau de l'adversaire (haut) ─────────── */
.fight-head { text-align: left; }
.fight-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; min-width: 0; }
.fight-title h2 { font-size: 1rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; flex: none; max-width: 55%; }
.fight-title .status { font-size: 0.72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; text-shadow: 0 1px 2px #000; }
.fight-head .bar { margin-top: 4px; height: 8px; }
.fight-head .telegraph {
  margin: 6px 0 0;
  padding: 5px 8px;
  font-size: 0.74rem;
  line-height: 1.3;
  background: rgba(40, 18, 8, 0.85);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.telegraph:empty { display: none; }

/* ── Combat : dock du bas ─────────────────────────────── */
.fight-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(10, 6, 16, 0.96) 0%, rgba(10, 6, 16, 0.92) 85%, rgba(10, 6, 16, 0.65) 100%);
  border-top: 1px solid var(--line);
}
.dock-stats { display: flex; align-items: center; gap: 10px; font-size: 0.8rem; font-weight: 700; }
.dock-hp { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.dock-hp .bar { flex: 1; min-width: 40px; height: 8px; }
.pa { color: #7fd0ff; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pm { color: #9be37f; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Rangées de boutons-icônes : tout tient sur la largeur (6 par rangée) */
.dock-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.dock-row:empty { display: none; }
.act {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 54px;
  padding: 4px 2px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.act:active { transform: scale(0.95); }
.act.weapon { border-color: #6aa7d6; }
.act.item, .act.bag-btn { border-color: var(--gold); }
.act.special { border-color: var(--accent-2); }
/* Attaques de zone : rangée sous les armes, bordure violette, petit ✦ */
.act.skill { border-color: #a77bff; background: #2a1d3d; }
.act-badge.zone { color: #c9a8ff; }
.act.selected { border-color: #ffb347; box-shadow: 0 0 0 2px #ffb347, 0 0 12px rgba(255, 160, 60, 0.5); background: #3a2614; }
.act.off { opacity: 0.4; }
.act:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.act-icon { font-size: 1.35rem; line-height: 1; }
/* Libellé sur 2 lignes au plus, coupé entre les mots : à 6 boutons par rangée
   sur un téléphone de 360 px, « Flèche perçante » ne tient pas sur une ligne */
.act-label { font-size: 0.6rem; font-weight: 700; line-height: 1.1; max-width: 100%; text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: break-word; }
.act-cost { font-size: 0.58rem; color: #7fd0ff; font-weight: 700; }
.act-badge { position: absolute; top: 2px; right: 3px; font-size: 0.55rem; font-weight: 800; }
.act-badge.good { color: #ffd76a; }
.act-badge.bad { color: #ff8f8f; }
.act-count { position: absolute; top: 2px; left: 4px; font-size: 0.55rem; font-weight: 800; color: var(--gold); }

.dock-foot { display: flex; align-items: center; gap: 8px; }
.dock-hint { flex: 1; min-width: 0; margin: 0; font-size: 0.72rem; line-height: 1.25; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.end-turn { flex: none; width: auto; margin: 0; padding: 12px 16px; font-size: 1rem; min-height: 48px; }
.fight-dock .log { display: none; }
.fight-dock .end { text-align: center; }
.fight-dock .end .btn { margin: 4px 0; }

/* Bandeau éphémère en haut de la carte */
.toast {
  position: absolute;
  z-index: 8;
  top: calc(70px + env(safe-area-inset-top));
  left: 8px;
  right: 8px;
  width: fit-content;
  margin: 0 auto;
  transform: translateY(-6px);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  background: rgba(20, 14, 28, 0.92);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast:empty { display: none; }
/* Dialogue : portrait du personnage au-dessus d'une bulle, au centre de
   l'écran, sur un voile qui assombrit la carte */
.dialog {
  position: absolute;
  z-index: 9;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at center, rgba(6, 4, 10, 0.35) 0%, rgba(6, 4, 10, 0.7) 100%);
}
.dialog-portrait {
  position: relative;
  z-index: 1;
  width: 104px;
  height: 104px;
  margin-bottom: 14px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  background: radial-gradient(circle at 50% 40%, #3a2a4a 0%, #160f1e 75%);
  box-shadow: 0 0 0 4px rgba(20, 14, 28, 0.9), 0 0 26px rgba(255, 190, 90, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: portrait-in 0.25s ease-out;
}
.pixel-face { width: 72px; height: 72px; image-rendering: pixelated; image-rendering: crisp-edges; }
/* Petite queue de la bulle, qui pointe vers le portrait */
.dialog-portrait::after {
  content: "";
  position: absolute;
  bottom: -17px;
  left: 50%;
  margin-left: -10px;
  border: 10px solid transparent;
  border-bottom-color: var(--gold);
}
.dialog-bubble {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: 62%;
  overflow-y: auto;
  padding: 14px 16px 12px;
  border-radius: 18px;
  border: 3px solid var(--gold);
  background: #f6edda;
  color: #2a1d14;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  text-align: left;
  animation: bubble-in 0.22s ease-out;
}
.dialog-name { margin: 0 0 6px; color: #8a4b10; font-weight: 800; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; }
.dialog-text { margin: 0 0 12px; font-size: 1.02rem; line-height: 1.45; min-height: 3em; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }
.dialog-bubble .btn-ghost { color: #7a5c45; }
.dialog-bubble .shop-row { border-top-color: #d9c9a8; }
.dialog-bubble .shop-text span { color: #6b5443; }
@keyframes bubble-in { from { transform: translateY(6px) scale(0.98); } to { transform: none; } }
@keyframes portrait-in { from { transform: scale(0.9); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .dialog-bubble, .dialog-portrait { animation: none; } }

/* Titre de zone : fondu, reste ~2 s, puis disparaît */
.zone-title {
  position: absolute;
  z-index: 7;
  top: 24%;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
}
.zone-title.show { animation: zone-title 3.2s ease forwards; }
.zone-name {
  font-size: clamp(0.9rem, 4.4vw, 1.45rem);
  white-space: nowrap;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f6e7c1;
  text-shadow: 0 2px 0 #3f2631, 0 0 12px rgba(0, 0, 0, 0.9);
  padding: 4px 14px;
  background: rgba(20, 14, 10, 0.55);
  border-top: 2px solid #9a9184;
  border-bottom: 2px solid #9a9184;
}
.zone-title.danger .zone-name { color: #ffd2c8; border-color: #c0392b; background: rgba(60, 8, 8, 0.7); }
.zone-sub { font-size: 0.85rem; color: #cfe3d0; text-shadow: 0 1px 0 #000, 0 0 8px #000; font-style: italic; }
.zone-sub:empty { display: none; }
@keyframes zone-title {
  0% { opacity: 0; transform: translateY(-6px); }
  12% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Marchands ───────────────────────────────────────── */
.shop { list-style: none; margin: 0 0 10px; padding: 0; max-height: 46vh; overflow-y: auto; }
.shop-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.shop-emoji { font-size: 1.4rem; }
.shop-text { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: 0.85rem; }
.shop-text span { color: var(--muted); font-size: 0.78rem; }
.btn-buy { flex: none; background: var(--accent); border-color: var(--accent); color: #1a0d00; }

/* ── Accueil ─────────────────────────────────────────── */
.home-block { margin-top: 8px; }
.modes-title { margin: 0 0 8px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--muted); }
.confirm-box { background: var(--card); border: 1px solid var(--danger); border-radius: var(--radius); padding: 14px; }
.confirm-text { margin: 0 0 4px; font-weight: 600; }

/* ── Game over ───────────────────────────────────────── */
.lys.skull { filter: drop-shadow(0 0 18px rgba(224, 80, 63, 0.55)); }

/* ── Le sac ──────────────────────────────────────────── */
.bag {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(6, 4, 10, 0.6);
}
.bag-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  max-height: 88dvh;
  background: var(--bg-2);
  border: 2px solid var(--gold);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.6);
  text-align: left;
}
.bag-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 12px 16px 8px; border-bottom: 1px solid var(--line); }
.bag-head h2 { margin: 0; font-size: 1.15rem; }
.bag-sub { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.bag-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 8px; }
.bag-foot { padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.bag-foot .btn { margin: 0; }
.bag-sec h3 { margin: 14px 0 4px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gold); }
.bag-note { margin: 0 0 4px; font-size: 0.8rem; color: var(--muted); font-style: italic; }
.bag-list { list-style: none; margin: 0; padding: 0; }
.bag-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.bag-row:first-child { border-top: none; }
.bag-emoji { flex: none; width: 1.6em; font-size: 1.5rem; text-align: center; }
.bag-text { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: 0.9rem; }
.bag-meta { font-size: 0.78rem; color: var(--accent-2); font-weight: 600; }
.bag-desc { font-size: 0.8rem; color: var(--muted); }
.bag-help { font-size: 0.78rem; color: #ff8f8f; }
.bag-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.bag-badge { font-size: 0.75rem; font-weight: 700; color: var(--player); border: 1px solid var(--player); border-radius: 999px; padding: 2px 8px; }
.btn-use { background: var(--accent); border-color: var(--accent); color: #1a0d00; min-width: 88px; }

@media (prefers-reduced-motion: reduce) {
  .bar-fill { transition: none; }
  .toast { transition: none; }
  .zone-title.show { animation-duration: 3.2s; transform: none; }
}

.btn-fs { font-size: 0.9rem; }
@media (max-height: 640px) {
  .act { min-height: 46px; }
  .act-icon { font-size: 1.15rem; }
  .end-turn { padding: 10px 12px; min-height: 42px; }
}

/* Téléphone en paysage : le dock de combat passe sur le côté droit */
@media (orientation: landscape) and (max-height: 560px) {
  #app { max-width: none; }
  .fight-dock {
    left: auto;
    top: 0;
    width: min(46%, 340px);
    padding: calc(8px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) 8px;
    border-top: none;
    border-left: 1px solid var(--line);
    background: rgba(10, 6, 16, 0.94);
    overflow-y: auto;
  }
  /* 5 par rangée : armes, attaques de zone et actions tiennent chacune sur une ligne */
  .dock-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .top-bar { right: min(46%, 340px); }
}

/* ── Accueil : création du personnage ────────────────── */
#screen-home.creating { justify-content: flex-start; }
#screen-home.creating .hook, #screen-home.creating .lys { display: none; }
.create { text-align: left; }
.create .modes-title { text-align: center; }
.create-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0 0 10px;
}
.create-hero {
  width: 96px;
  height: 96px;
  flex: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius: 50%;
  border: 3px solid var(--gold);
  background: radial-gradient(circle at 50% 40%, #3a2a4a 0%, #160f1e 75%);
  padding: 6px;
}
.create-fleur {
  height: clamp(110px, 20vh, 170px);
  width: auto;
  max-width: 55%;
  filter: drop-shadow(0 0 14px rgba(255, 190, 90, 0.25));
}
.create-name {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  -webkit-user-select: text;
  user-select: text;
}
.create-name:focus { outline: none; border-color: var(--gold); }
.create-options { display: flex; flex-direction: column; gap: 6px; }
.opt-row { display: flex; flex-direction: column; gap: 3px; }
.opt-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.opt-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.opt[aria-checked="true"] { border-color: var(--gold); background: #3a2a1a; color: #fff; }
.opt:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.opt.swatch { width: 36px; height: 36px; padding: 0; background: var(--sw); }
.opt.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--gold); background: var(--sw); }
.opt-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--sw); border: 1px solid #888; }
.create-error { margin: 6px 0 0; color: #ff8f8f; min-height: 0; }

/* ── Bandeau : la fleur et la flèche ─────────────────── */
.fleur-btn {
  flex: none;
  pointer-events: auto;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  background: rgba(36, 26, 46, 0.85);
  color: var(--gold);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.compass {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  padding: 4px 12px 4px 6px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  background: rgba(20, 14, 28, 0.88);
  font-size: 0.78rem;
  font-weight: 700;
  color: #f6e7c1;
  max-width: 100%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.compass-arrow {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold);
  position: relative;
  transition: transform 0.25s ease;
}
.compass-arrow::after {
  content: "";
  position: absolute;
  inset: 4px 3px 4px 5px;
  background: #2a1606;
  clip-path: polygon(0 20%, 55% 20%, 55% 0, 100% 50%, 55% 100%, 55% 80%, 0 80%);
}
.compass-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-reduced-motion: reduce) { .compass-arrow { transition: none; } }

/* ── Âme capturée / ton chandail ─────────────────────── */
.capture {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at center, rgba(40, 20, 60, 0.75) 0%, rgba(6, 4, 10, 0.92) 100%);
}
.capture-card {
  width: 100%;
  max-width: 400px;
  max-height: 100%;
  overflow-y: auto;
  padding: 14px 16px;
  border-radius: 18px;
  border: 2px solid var(--gold);
  background: var(--bg-2);
  text-align: center;
  box-shadow: 0 0 40px rgba(255, 190, 90, 0.25);
  animation: bubble-in 0.25s ease-out;
}
.capture-kicker { margin: 0; color: var(--gold); text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.72rem; font-weight: 800; }
.capture-title { margin: 2px 0 8px; font-size: 1.3rem; }
.capture-fleur {
  display: block;
  margin: 0 auto;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 42vh;
  filter: drop-shadow(0 0 22px rgba(255, 190, 90, 0.35));
}
.capture-text { margin: 10px 0 6px; font-size: 0.95rem; }
.capture-list { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.capture-list li {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--muted);
}
.capture-list li.got { border-color: var(--frag); color: var(--text); box-shadow: inset 0 0 0 1px var(--frag); }
.capture .btn { margin: 8px 0 0; }

/* ── Victoire : la fleur complète ────────────────────── */
.victory-fleur {
  display: block;
  margin: 0 auto 6px;
  width: auto;
  height: auto;
  max-width: 78%;
  max-height: 34vh;
  filter: drop-shadow(0 0 26px rgba(255, 190, 90, 0.45));
}

/* ── Cinématique « il est sept heures » (js/clock.js) ── */
.clock {
  position: absolute;
  z-index: 11;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2vh;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% 40%, rgba(58, 31, 74, 0.82) 0%, rgba(15, 11, 20, 0.95) 70%);
  cursor: pointer;
  animation: clock-in 0.3s ease-out;
  transition: opacity 0.25s ease-in;
}
.clock.is-closing { opacity: 0; }
/* Le flash chaud de la cloche, par-dessus tout le voile */
.clock::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 38%, rgba(255, 228, 170, 0.5) 0%, rgba(255, 140, 40, 0.16) 45%, transparent 75%);
}
.clock.is-dong { animation: clock-shake 0.32s ease-out; }
.clock.is-dong::after { animation: clock-flash 0.42s ease-out; }
.clock-face {
  display: block;
  width: min(74vw, 52vh, 330px);
  height: auto;
  aspect-ratio: 5 / 8;
}
.clock-dongs {
  display: flex;
  justify-content: center;
  gap: 0.55em;
  margin: 0;
  min-height: 1.5em;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 4.6vw, 1.3rem);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.clock-dong { color: var(--line); transition: color 0.2s, text-shadow 0.2s, transform 0.2s; }
.clock-dong.is-on { color: var(--gold); text-shadow: 0 0 12px rgba(255, 179, 71, 0.75); transform: scale(1.12); }
.clock-dong.is-last.is-on { color: var(--accent-2); }
.clock-text {
  margin: 0;
  min-height: 1.4em;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: clamp(1.5rem, 7.5vw, 2rem);
  color: var(--text);
  text-shadow: 0 0 18px rgba(255, 122, 26, 0.65), 0 2px 0 rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s ease-out, transform 0.45s ease-out;
}
.clock-text.is-on { opacity: 1; transform: none; }
@keyframes clock-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes clock-flash { from { opacity: 1; } to { opacity: 0; } }
@keyframes clock-shake {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-4px, 2px); }
  40% { transform: translate(4px, -2px); }
  60% { transform: translate(-2px, 1px); }
  80% { transform: translate(2px, -1px); }
  100% { transform: translate(0, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .clock.is-dong, .clock.is-dong::after { animation: none; }
  .clock-dong, .clock-text { transition: none; }
  .clock-dong.is-on { transform: none; }
  .clock-text { transform: none; }
}

/* ── Mode dev (js/dev.js, ?dev dans l'adresse) ─────────── */
.dev-btn {
  position: absolute;
  /* languette sur le bord gauche, à mi-hauteur : ne cache ni le haut, ni le dock de combat */
  left: env(safe-area-inset-left);
  top: 42%;
  z-index: 40;
  padding: 8px 6px;
  border-radius: 0 10px 10px 0;
  writing-mode: vertical-rl;
  border: 1px solid #9be37f;
  background: rgba(20, 40, 16, 0.85);
  color: #9be37f;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.dev-btn.active { background: #9be37f; color: #10200c; }
.dev-panel {
  position: absolute;
  left: calc(34px + env(safe-area-inset-left));
  right: 8px;
  top: 12%;
  z-index: 41;
  max-width: 420px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid #9be37f;
  background: rgba(10, 6, 16, 0.96);
  color: var(--text);
}
.dev-title { margin: 0 0 8px; font-weight: 800; color: #9be37f; text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.8rem; }
.dev-sub { margin: 10px 0 6px; font-size: 0.75rem; color: var(--muted); width: 100%; }
.dev-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.dev-toggle, .dev-act, .dev-leg, .dev-close, .dev-off {
  padding: 8px 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
}
.dev-toggle[aria-pressed="true"] { border-color: #9be37f; background: rgba(155, 227, 127, 0.18); }
.dev-legends { display: flex; flex-wrap: wrap; gap: 6px; }
.dev-leg { min-width: 38px; text-align: center; font-weight: 800; }
.dev-close, .dev-off { width: 100%; margin-top: 8px; text-align: center; }
.dev-off { border-color: var(--danger); color: #ff9b8f; }
