/* PokeLife — styles */
:root {
  --accent: #b18cff;
  --bg: #0b0f24;
  --panel: rgba(12, 14, 30, 0.62);
  --panel-strong: rgba(10, 12, 26, 0.82);
  --border: rgba(255, 255, 255, 0.12);
  --text: #eef0fa;
  --muted: #a7adc6;
  --good: #6ee7a8;
  --bad: #ff7a7a;
  --gold: #ffd166;
  --radius: 16px;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-story: "Lora", Georgia, "Times New Roman", serif;
  --font-title: "Cinzel", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; } /* pas de « tirer pour actualiser » ni de rebond : c'est une appli */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
code, kbd {
  font-family: ui-monospace, Menlo, monospace;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 0.88em;
}
button { font: inherit; color: inherit; }

/* ---------- fond ---------- */
#stage { position: fixed; inset: 0; z-index: 0; overflow: hidden; }
.bg-layer {
  position: absolute;
  inset: -4%;
  width: 108%;
  height: 108%;
  opacity: 0;
  transition: opacity 2.2s ease;
  animation: kenburns 60s ease-in-out infinite alternate;
}
.bg-layer.show { opacity: 1; }
#bg-image {
  background-size: cover;
  background-position: center;
  z-index: 1;
  filter: saturate(1.05) brightness(0.85);
}
#fx { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
#flash { position: absolute; inset: 0; background: #e8efff; opacity: 0; z-index: 3; pointer-events: none; }
#flash.on { animation: lightning 0.9s ease-out; }
#vignette {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.55) 100%);
}
body[data-screen="game"] #vignette {
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.5) 100%),
    linear-gradient(to bottom, transparent 30%, rgba(0, 0, 0, 0.45) 100%);
}
@keyframes kenburns {
  from { transform: scale(1) translate(0, 0); }
  to { transform: scale(1.06) translate(-1.2%, -0.8%); }
}
@keyframes lightning {
  0% { opacity: 0; } 8% { opacity: 0.75; } 14% { opacity: 0.1; } 22% { opacity: 0.5; } 100% { opacity: 0; }
}
body.reduce-motion .bg-layer { animation: none; }
body.reduce-motion * { transition-duration: 0.2s !important; }

/* ---------- écrans ---------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 16px 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s;
  overflow-y: auto;
}
.screen.active { opacity: 1; visibility: visible; }

#topbar {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 40;
  display: flex;
  gap: 8px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  padding: 28px;
}
.panel.wide { width: min(760px, 100%); margin: auto; }
h2 { font-family: var(--font-title); font-weight: 700; letter-spacing: 0.04em; margin: 0 0 14px; }
h2 small { font-family: var(--font-ui); font-size: 0.55em; color: var(--muted); letter-spacing: 0; font-weight: 400; margin-left: 8px; }
h3 { font-family: var(--font-title); font-size: 1rem; letter-spacing: 0.05em; margin: 20px 0 8px; color: var(--accent); }

/* ---------- accueil ---------- */
.home-wrap { text-align: center; max-width: 440px; width: 100%; }
.logo {
  font-family: var(--font-title);
  font-size: clamp(3rem, 12vw, 5.6rem);
  margin: 0;
  letter-spacing: 0.06em;
  text-shadow: 0 0 30px rgba(0, 0, 0, 0.6), 0 0 60px color-mix(in srgb, var(--accent) 50%, transparent);
  animation: float 6s ease-in-out infinite;
}
.logo span { color: var(--accent); transition: color 2s; }
.tagline {
  font-family: var(--font-story);
  font-style: italic;
  font-size: 1.15rem;
  color: #dfe3f5;
  margin: 6px 0 34px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}
.menu { display: flex; flex-direction: column; gap: 12px; }
.home-foot { margin-top: 26px; font-size: 0.85rem; color: var(--muted); text-shadow: 0 1px 6px #000; }
@keyframes float { 50% { transform: translateY(-6px); } }

/* ---------- boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-weight: 500;
  transition: transform 0.15s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); transform: translateY(-1px); border-color: rgba(255, 255, 255, 0.28); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary {
  background: color-mix(in srgb, var(--accent) 70%, #1a1030);
  border-color: color-mix(in srgb, var(--accent) 80%, white);
  color: #fff;
  box-shadow: 0 6px 24px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 85%, #1a1030); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.big { padding: 15px 22px; font-size: 1.05rem; font-family: var(--font-title); letter-spacing: 0.06em; }
.btn.small { padding: 7px 12px; font-size: 0.9rem; }
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(10, 12, 26, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
}
.icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.15); }
.icon-btn:disabled { opacity: 0.4; }
.lang-btn { font-weight: 600; font-size: 0.85rem; letter-spacing: 0.05em; }

/* ---------- formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.field > span { font-size: 0.85rem; color: var(--muted); font-weight: 500; letter-spacing: 0.02em; }
input[type="text"], input[type="search"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 13px;
  font: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
select option { background: #151935; }
textarea { resize: vertical; font-family: var(--font-story); line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
input[type="range"] { accent-color: var(--accent); }
.row { display: flex; gap: 8px; align-items: center; }
.row > input, .row > select { flex: 1; }
.row.gap { gap: 14px; flex-wrap: wrap; }
.row.center { justify-content: center; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hint { font-size: 0.85rem; color: var(--muted); margin: 4px 0; }
.status { min-height: 1.4em; font-size: 0.92rem; margin-top: 10px; color: var(--muted); }
.status.ok { color: var(--good); }
.status.err { color: var(--bad); }
.check { display: flex; align-items: center; gap: 10px; margin: 10px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.center { text-align: center; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.92rem;
}
.chip:hover { background: rgba(255, 255, 255, 0.14); }
.chip.on {
  background: color-mix(in srgb, var(--accent) 45%, transparent);
  border-color: var(--accent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 40%, transparent);
}

.steps { display: flex; align-items: center; justify-content: center; margin-bottom: 18px; }
.step {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); font-size: 0.85rem; color: var(--muted);
}
.step.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.step.done { background: rgba(110, 231, 168, 0.25); color: var(--good); border-color: var(--good); }
.step-line { width: 50px; height: 2px; background: var(--border); }
.step-line.on { background: var(--good); }
.howto-list { line-height: 1.7; padding-left: 22px; }

/* ---------- sauvegardes ---------- */
.saves-list { display: flex; flex-direction: column; gap: 10px; max-height: 55vh; overflow-y: auto; }
.save-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px; border-radius: 12px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.05);
}
.save-card.dead { opacity: 0.7; }
.save-ico { font-size: 1.8rem; }
.save-info { flex: 1; min-width: 0; }
.save-info .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-actions { display: flex; gap: 6px; align-items: center; }

/* ---------- jeu ---------- */
#screen-game { flex-direction: column; justify-content: flex-start; padding: 0; overflow: hidden; }
#hud {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 176px 12px 16px;
  background: linear-gradient(to bottom, rgba(5, 6, 16, 0.75), transparent);
  flex-shrink: 0;
}
.hud-id { min-width: 0; }
.hud-name { font-family: var(--font-title); font-weight: 700; font-size: 1.15rem; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-sub { font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-stats { display: flex; gap: 14px; flex: 1; justify-content: center; flex-wrap: wrap; }
.hud-actions { display: flex; gap: 6px; }
.stat { display: flex; align-items: center; gap: 6px; position: relative; font-size: 0.9rem; }
.stat .ico { width: 18px; text-align: center; }
.bar { width: 74px; height: 7px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.bar.big { width: 100%; height: 10px; }
.bar i { display: block; height: 100%; border-radius: 99px; transition: width 1s ease; }
.s-health { background: linear-gradient(90deg, #ff5f6d, #ff9a8b); }
.s-mood { background: linear-gradient(90deg, #f7b733, #fcd96b); }
.s-reputation { background: linear-gradient(90deg, #7f7fd5, #86a8e7); }
.stat.low .bar { box-shadow: 0 0 10px rgba(255, 80, 80, 0.8); animation: pulse 1.2s infinite; }
.delta {
  position: absolute; right: -6px; top: -14px; font-size: 0.75rem; font-weight: 700;
  animation: rise 2.4s ease forwards;
}
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
@keyframes rise { 0% { opacity: 0; transform: translateY(6px); } 15% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-8px); } }
@keyframes pulse { 50% { opacity: 0.55; } }

#story {
  flex: 1;
  width: min(820px, 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
  padding: 8px 16px 18px;
  min-height: 0;
}
.story-card {
  padding: 24px 28px;
  overflow-y: auto;
  max-height: 58vh;
  background: var(--panel-strong);
  position: relative;
}
.chapter {
  font-family: var(--font-title);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}
.chapter span { opacity: 0.7; font-size: 0.8em; text-transform: uppercase; }
.chapter small { font-family: var(--font-ui); letter-spacing: 0; color: var(--muted); font-size: 0.8rem; margin-left: auto; }
.narrative { font-family: var(--font-story); font-size: 1.1rem; line-height: 1.75; color: #f2f3fb; }
.narrative p { margin: 0 0 0.85em; }
.narrative p:last-child { margin-bottom: 0; }
.narrative.typing { cursor: pointer; }
.narrative.typing::after { content: "▍"; animation: blink 0.8s steps(1) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

.loading { display: flex; align-items: center; gap: 12px; color: var(--muted); font-style: italic; font-family: var(--font-story); padding-top: 10px; }
.quill { font-size: 1.4rem; animation: write 1.2s ease-in-out infinite; color: var(--accent); }
@keyframes write { 0%, 100% { transform: translate(0, 0) rotate(-10deg); } 50% { transform: translate(8px, 2px) rotate(8deg); } }
#story.busy .narrative { opacity: 0.45; transition: opacity 0.4s; }
#story.busy.streaming .narrative { opacity: 1; }
.error-box { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: rgba(255, 80, 80, 0.12); border: 1px solid rgba(255, 80, 80, 0.4); }
.error-box p { margin: 0 0 8px; color: #ffc2c2; }

.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 12px;
  text-align: left; width: 100%;
  padding: 13px 16px; border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(12, 14, 30, 0.7);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  font-size: 1rem;
  /* visible par défaut : l'apparition en fondu n'est qu'une décoration (« both » applique le départ pendant le délai) */
  animation: fadeUp 0.45s ease both;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.choice:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 22%, rgba(12, 14, 30, 0.8));
  border-color: var(--accent);
  transform: translateX(4px);
}
.choice:disabled { opacity: 0.4 !important; cursor: wait; }
.choice kbd { background: color-mix(in srgb, var(--accent) 35%, transparent); color: #fff; flex-shrink: 0; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.free-form { display: flex; gap: 8px; }
.free-form input { background: rgba(12, 14, 30, 0.75); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.chip-btn {
  padding: 6px 12px; border-radius: 999px; font-size: 0.82rem;
  border: 1px solid var(--border); background: rgba(12, 14, 30, 0.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  cursor: pointer; color: var(--muted); transition: all 0.2s;
}
.chip-btn:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.chip-btn:disabled { opacity: 0.4; }

.gameover { text-align: center; padding: 18px; border-radius: var(--radius); background: var(--panel-strong); border: 1px solid var(--border); animation: fadeUp 0.8s ease; }
.gameover h3 { font-size: 1.5rem; color: var(--gold); margin: 0 0 14px; }

/* ---------- modale ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadeIn 0.25s ease;
}
.modal-box { position: relative; width: min(480px, 100%); max-height: 88vh; overflow-y: auto; background: var(--panel-strong); animation: pop 0.3s ease; }
.modal-box.wide { width: min(760px, 100%); }
.modal-close { position: absolute; top: 14px; right: 14px; }
.modal .menu .btn { width: 100%; }
.prose { line-height: 1.65; font-family: var(--font-story); }
.prose p { margin: 0 0 10px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } }

.sheet-stats { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.sheet-stat { display: grid; grid-template-columns: 140px 1fr 44px; align-items: center; gap: 12px; }
.sheet-stat b { text-align: right; }
.sheet-stat:has(> b:nth-child(2)) { grid-template-columns: 140px 1fr; }
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { padding: 5px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.08); font-size: 0.88rem; }
.tags.gold li:not(.muted) { background: rgba(255, 209, 102, 0.15); color: var(--gold); }
.tags li.muted { background: none; padding-left: 0; }
.npcs { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.npcs li { display: grid; grid-template-columns: auto 1fr 120px; gap: 10px; align-items: center; }
.npcs li.muted { display: block; }
.npcs em { color: var(--muted); font-size: 0.85rem; }
.aff { position: relative; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); }
.aff::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: rgba(255, 255, 255, 0.4); }
.aff i { position: absolute; top: 0; bottom: 0; border-radius: 99px; }
.aff.love i { background: #ff6fa5; }
.aff.ok i { background: #6ee7a8; }
.aff.meh i { background: #f7b733; }
.aff.hate i { background: #ff5f5f; }

.journal { max-height: 65vh; overflow-y: auto; padding-right: 6px; }
.j-chapter { border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.j-entry { font-family: var(--font-story); line-height: 1.65; margin-bottom: 18px; }
.j-entry p { margin: 0 0 8px; }
.j-meta { font-family: var(--font-ui); font-size: 0.78rem; color: var(--muted); margin-bottom: 6px; }
.j-choice { font-family: var(--font-ui); font-size: 0.9rem; color: var(--accent); padding: 6px 10px; border-left: 2px solid var(--accent); background: rgba(255, 255, 255, 0.04); }

/* ---------- toasts ---------- */
#toasts { position: fixed; top: 64px; right: 14px; z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  padding: 10px 16px; border-radius: 12px; font-size: 0.92rem;
  background: var(--panel-strong); border: 1px solid var(--border);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  animation: slideIn 0.35s ease;
  transition: opacity 0.5s, transform 0.5s;
  max-width: 320px;
}
.toast.good { border-color: rgba(110, 231, 168, 0.5); }
.toast.bad { border-color: rgba(255, 122, 122, 0.5); }
.toast.gold { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 30px rgba(255, 209, 102, 0.3); }
.toast.out { opacity: 0; transform: translateX(20px); }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } }
@media (max-width: 720px) {
  /* téléphone : en bas, au-dessus de la barre, pour ne pas cacher la scène ni l'en-tête */
  #toasts { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 80px); left: 12px; right: 12px; align-items: center; flex-direction: column-reverse; gap: 6px; }
  .toast { max-width: 100%; font-size: 0.86rem; padding: 8px 14px; animation-name: toastUp; }
  .toast.out { transform: translateY(10px); }
  @keyframes toastUp { from { opacity: 0; transform: translateY(16px); } }
}

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  #hud { flex-wrap: wrap; padding: 10px 12px; gap: 8px 12px; }
  .hud-id { flex: 1; }
  .hud-stats { order: 3; flex: 1 1 100%; justify-content: space-between; gap: 8px; }
  .hud-actions { order: 2; }
  .bar { width: 52px; }
  .story-card { padding: 18px; max-height: 50vh; }
  .narrative { font-size: 1.02rem; }
  .grid2, .sheet-grid { grid-template-columns: 1fr; }
  .sheet-stat { grid-template-columns: 110px 1fr 36px; }
  .npcs li { grid-template-columns: 1fr 80px; }
  .npcs em { grid-column: 1; }
  .panel { padding: 20px; }
  .hud-actions .icon-btn { width: 36px; height: 36px; }
  #hud { padding-top: 60px; }
}
@media (max-width: 480px) {
  /* les boutons sur leur propre ligne : le nom et l'âge gardent toute la largeur */
  .hud-actions { flex: 1 1 100%; justify-content: space-between; gap: 4px; }
}

/* ---------- monde Pokémon ---------- */
.pokeball-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #fff 0 9px, #222 9px 14px, transparent 14px),
    linear-gradient(to bottom, #e3353d 0 46%, #222 46% 54%, #f4f4f4 54% 100%);
  box-shadow: 0 0 0 4px #222, 0 0 40px color-mix(in srgb, var(--accent) 60%, transparent);
  animation: wobble 5s ease-in-out infinite;
}
@keyframes wobble {
  0%, 80%, 100% { transform: rotate(0); }
  84% { transform: rotate(-14deg); }
  88% { transform: rotate(12deg); }
  92% { transform: rotate(-6deg); }
}
.disclaimer { font-size: 0.72rem; color: var(--muted); opacity: 0.75; margin-top: 6px; text-shadow: 0 1px 4px #000; }
#place-caption {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 5;
  font-family: var(--font-title);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 8px #000;
  opacity: 0;
  transition: opacity 0.8s;
}
body.show-caption #place-caption { opacity: 1; }

.regions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.region-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.2s;
}
.region-card .r-icon { grid-row: span 2; font-size: 1.5rem; }
.region-card b { font-family: var(--font-title); letter-spacing: 0.04em; }
.region-card small { color: var(--muted); font-size: 0.75rem; }
.region-card:hover { background: rgba(255, 255, 255, 0.12); }
.region-card.on {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
  border-color: var(--accent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 35%, transparent);
}
.region-blurb { font-family: var(--font-story); font-style: italic; color: #dfe3f5; margin: 8px 0 0; }

.difficulties { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.diff-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.2s;
}
.diff-card b { font-family: var(--font-title); font-size: 1.05rem; letter-spacing: 0.04em; }
.diff-card small { color: var(--muted); line-height: 1.45; }
.diff-card:hover { background: rgba(255, 255, 255, 0.12); }
.diff-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 28%, transparent); }
.diff-card[data-v="hard"].on { border-color: #ff4d4d; background: rgba(255, 60, 60, 0.18); }
.warning {
  margin-top: 18px;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 120, 90, 0.55);
  background: rgba(120, 20, 20, 0.25);
  line-height: 1.6;
}
.warning h3 { color: #ffb199; margin-top: 0; }
.warning ul { padding-left: 20px; margin: 8px 0; }
.warning p { margin: 6px 0; }

.hud-team { display: flex; align-items: center; gap: 2px; margin-top: 2px; min-height: 0; }
.team-slot { width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); display: inline-flex; align-items: center; justify-content: center; overflow: hidden; }
.team-slot.hurt { box-shadow: inset 0 0 0 2px #f7b733; }
.team-slot.dead { filter: grayscale(1); opacity: 0.45; }
.sprite { width: 40px; height: 40px; image-rendering: pixelated; object-fit: contain; }
.sprite.big { width: 72px; height: 72px; }
.sprite-fallback { color: #ff6b6b; font-size: 1.1rem; }
.badge-count { margin-left: 6px; font-size: 0.8rem; color: var(--gold); white-space: nowrap; }

.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.team-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); }
.team-card em { color: var(--muted); font-size: 0.82rem; }
.team-card.hurt { box-shadow: inset 0 0 0 1px #f7b733; }
.team-card.dead { filter: grayscale(1); opacity: 0.55; }
.bond { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--muted); margin-top: 4px; }

#pokemon-layer { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
#pokemon-layer .featured {
  position: absolute;
  bottom: 40%;
  width: clamp(110px, 17vw, 250px);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1.4s ease, transform 1.4s ease;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55));
}
#pokemon-layer .featured.left { left: 5%; }
#pokemon-layer .featured.right { right: 5%; transform: translateY(14px) scaleX(-1); }
#pokemon-layer .featured.show { opacity: 0.95; transform: none; animation: bob 5s ease-in-out infinite; }
#pokemon-layer .featured.right.show { transform: scaleX(-1); animation: bob-flip 5s ease-in-out infinite; }
#pokemon-layer[data-time="night"] .featured { filter: brightness(0.55) saturate(0.7) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.6)); }
#pokemon-layer[data-time="dusk"] .featured { filter: brightness(0.8) sepia(0.2) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55)); }
@keyframes bob { 50% { transform: translateY(-8px); } }
@keyframes bob-flip { 0%, 100% { transform: scaleX(-1); } 50% { transform: scaleX(-1) translateY(-8px); } }
body.reduce-motion #pokemon-layer .featured.show { animation: none; }

@media (max-width: 720px) {
  .regions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .difficulties { grid-template-columns: 1fr; }
  #pokemon-layer .featured { bottom: auto; top: 22vh; width: 26vw; }
  .sprite { width: 32px; height: 32px; }
  .team-slot { width: 28px; height: 28px; }
}

/* ---------- destin & chromatiques ---------- */
.teaser { font-family: var(--font-story); font-style: italic; font-size: 1.1rem; color: var(--accent); margin: 0 0 14px; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.profile-grid > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
#d-traits { margin-bottom: 4px; }
#screen-destiny .loading { padding: 30px 0; justify-content: center; }
.team-slot.shiny, .team-card.shiny { box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(255, 209, 102, 0.6); }
.team-card.shiny { background: rgba(255, 209, 102, 0.1); }
#pokemon-layer .featured.shiny.show { filter: drop-shadow(0 0 16px rgba(255, 240, 160, 0.95)) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.5)); }
@media (max-width: 720px) {
  .profile-grid { grid-template-columns: 1fr; }
}

/* ---------- combat ---------- */
#battle {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at 50% 30%, rgba(20, 24, 50, 0.35), rgba(3, 4, 12, 0.85));
  animation: fadeIn 0.4s ease;
}
.b-field { flex: 1; position: relative; min-height: 0; }
.b-side { position: absolute; display: flex; align-items: flex-end; gap: 12px; }
.b-foe { top: 8%; right: 6%; flex-direction: row; align-items: flex-start; }
.b-me { bottom: 4%; left: 6%; }
.b-mon { position: relative; }
.b-mon::after { content: ""; position: absolute; left: 10%; right: 10%; bottom: 6px; height: 16%; border-radius: 50%; background: rgba(0, 0, 0, 0.35); z-index: -1; }
.b-mon img { width: clamp(150px, 22vw, 260px); image-rendering: pixelated; display: block; }
.b-me .b-mon img { width: clamp(170px, 26vw, 300px); }
.b-mon img.flip { transform: scaleX(-1); }
.b-mon img.enter { animation: b-enter 0.6s ease; }
.b-mon img.lunge { animation: b-lunge 0.3s ease; }
.b-foe .b-mon img.lunge { animation: b-lunge-foe 0.3s ease; }
.b-mon img.hit { animation: b-hit 0.5s steps(2) ; }
.b-mon img.faint { animation: b-faint 0.7s cubic-bezier(0.55, 0, 0.9, 0.45) forwards; }
@keyframes b-faint {
  0% { translate: 0 0; clip-path: inset(0 0 0 0); opacity: 1; }
  92% { opacity: 1; }
  100% { translate: 0 100%; clip-path: inset(0 0 100% 0); opacity: 0; }
}
.b-mon img.caught { transition: transform 0.5s ease, opacity 0.5s; transform: scale(0.1); opacity: 0.2; }
@keyframes b-enter { from { opacity: 0; transform: translateX(-40px); } }
@keyframes b-lunge { 50% { transform: translate(24px, -12px); } }
@keyframes b-lunge-foe { 50% { transform: translate(-24px, 12px); } }
@keyframes b-hit { 0%, 100% { opacity: 1; } 25%, 75% { opacity: 0.2; transform: translateX(6px); } }
.b-info {
  min-width: 220px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.b-name { font-weight: 700; font-family: var(--font-title); }
.b-name small { font-family: var(--font-ui); color: var(--muted); font-weight: 400; margin-left: 4px; }
.b-types, .dex-types { display: flex; gap: 4px; margin: 4px 0; flex-wrap: wrap; }
.b-types span, .type { font-size: 0.68rem; padding: 1px 7px; border-radius: 6px; color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5); }
.b-hp { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
.b-hp i { display: block; height: 100%; transition: width 0.6s ease, background 0.6s; }
.b-hptext { font-size: 0.8rem; text-align: right; margin-top: 3px; color: var(--muted); }
.b-bottom { display: grid; grid-template-columns: 1fr minmax(280px, 420px); gap: 10px; padding: 12px; background: rgba(5, 6, 16, 0.85); border-top: 1px solid var(--border); }
.b-log { font-family: var(--font-story); font-size: 1.15rem; padding: 14px 16px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); min-height: 92px; cursor: pointer; }
.b-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; }
.b-btn {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background 0.15s, transform 0.1s;
}
.b-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); transform: translateY(-1px); }
.b-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.b-btn.fight { background: color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); font-weight: 700; }
.b-btn.move { border-width: 2px; }
.b-btn small { color: var(--muted); font-size: 0.75rem; }
.b-btn.mon { flex-direction: row; align-items: center; gap: 8px; }
.b-btn.mon img { width: 40px; height: 40px; image-rendering: pixelated; }
.b-btn.mon small { margin-left: auto; }
.b-btn.back { grid-column: span 2; text-align: center; align-items: center; }
body.in-battle #screen-game { visibility: hidden; }
.battle-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid #ff6b6b;
  background: rgba(120, 20, 30, 0.45);
  animation: pulse-border 1.6s ease-in-out infinite;
}
.battle-banner .foes { display: flex; gap: 2px; margin-top: 4px; }
@keyframes pulse-border { 50% { box-shadow: 0 0 22px rgba(255, 90, 90, 0.5); } }

/* ---------- fin de vie ---------- */
.end-panel { max-width: 860px; }
.end-head { text-align: center; margin-bottom: 16px; }
.end-rip { font-size: 2rem; color: var(--gold); }
.end-head h1 { font-family: var(--font-title); font-size: clamp(2rem, 6vw, 3rem); margin: 4px 0; }
.end-head h2 { font-family: var(--font-story); font-style: italic; color: var(--accent); margin: 12px 0 4px; font-weight: 600; }
.epitaph { font-family: var(--font-story); font-style: italic; font-size: 1.1rem; color: #e8eaf6; }
.end-bio { font-size: 1.05rem; }
.timeline { padding-left: 22px; line-height: 1.7; }
.timeline li::marker { color: var(--accent); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.stat-cell { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); }
.stat-cell span { font-size: 1.2rem; }
.stat-cell small { color: var(--muted); font-size: 0.75rem; }
.stat-cell b { font-size: 1.05rem; }
.chapters { display: flex; flex-direction: column; gap: 6px; }
.chapter-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.chapter-row span { color: var(--accent); font-family: var(--font-title); }
.chapter-row small { color: var(--muted); }
.lineage { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lineage div { display: flex; flex-direction: column; padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); }
.lineage div.me { border: 1px solid var(--accent); }
.lineage small { color: var(--muted); font-size: 0.75rem; }
.end-actions { justify-content: center; }
.heir-banner { margin-top: 14px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--gold); background: rgba(255, 209, 102, 0.1); color: var(--gold); }

/* ---------- Pokédex ---------- */
.dex-tabs { margin: 8px 0 14px; }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.dex-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 10px 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); position: relative; }
.dex-card .sprite { width: 72px; height: 72px; }
.dex-card.seen .sprite { filter: grayscale(1) brightness(0.8); }
.dex-card.shiny { box-shadow: inset 0 0 0 1px var(--gold); }
.dex-card small { color: var(--muted); font-size: 0.7rem; }
.dex-no { position: absolute; top: 6px; left: 8px; font-size: 0.68rem; color: var(--muted); }
.t0 { background: #a8a878; } .t1 { background: #f08030; } .t2 { background: #6890f0; } .t3 { background: #78c850; }
.t4 { background: #d8b020; } .t5 { background: #78c8c8; } .t6 { background: #c03028; } .t7 { background: #a040a0; }
.t8 { background: #c8a048; } .t9 { background: #a890f0; } .t10 { background: #f85888; } .t11 { background: #98a820; }
.t12 { background: #b8a038; } .t13 { background: #705898; } .t14 { background: #7038f8; } .t15 { background: #705848; }
.t16 { background: #a8a8c0; } .t17 { background: #e898ac; }

/* ---------- cartes ---------- */
.map-modal { max-width: 1100px; }
.map-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.map-tabs .chip-btn.on { background: color-mix(in srgb, var(--accent, #8b5cf6) 35%, transparent); border-color: var(--accent, #8b5cf6); }
.map-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 0.9rem; }
.map-progress .bar { flex: 1; max-width: 220px; height: 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.map-progress .bar i { display: block; height: 100%; background: linear-gradient(90deg, #4ade80, #facc15); border-radius: 6px; }
/* la mer remplit tout le cadre (plus de bandes noires) */
.map-frame { position: relative; border-radius: 16px; overflow: hidden; background: #2a79b0; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.map-frame svg { display: block; width: 100%; height: auto; max-height: min(66vh, 700px); touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.map-frame svg.dragging { cursor: grabbing; }
.map-frame .region-map { aspect-ratio: 108 / 112; }
.map-frame .world-map { aspect-ratio: 200 / 110; }
.map-zoom { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.map-zoom .icon-btn { background: rgba(10, 16, 34, 0.72); backdrop-filter: blur(6px); width: 36px; height: 36px; font-size: 1.05rem; }
/* détails visibles seulement en zoomant */
.region-map .lod2 { opacity: 0; transition: opacity 0.35s ease; }
.region-map.z2 .lod2 { opacity: 1; }
.region-map .m-frame { fill: none; stroke: rgba(255, 244, 214, 0.35); stroke-width: 0.4; stroke-dasharray: 2 1; pointer-events: none; }
.region-map .m-road { fill: none; stroke: #b08a5a; stroke-width: 1.5; stroke-linecap: round; opacity: 0.55; }
.region-map .m-route { fill: none; stroke: #f6ecd0; stroke-width: 0.6; stroke-linecap: round; stroke-dasharray: 1.4 1; }
.region-map .m-route.sea { stroke: #e3f4ff; stroke-width: 0.5; stroke-dasharray: 0.5 1.3; opacity: 0.85; }
.region-map .m-tree circle { fill: #2f7a3d; }
.region-map .m-tree .hl { fill: #58a45e; }
.region-map .m-tree .sh { fill: rgba(0, 0, 0, 0.22); }
.region-map .m-pine path { fill: #2a634a; stroke: #1f4d39; stroke-width: 0.15; }
.region-map .m-palm path { stroke: #2f8f4a; stroke-width: 0.45; fill: none; stroke-linecap: round; }
.region-map .m-palm path:first-child { stroke: #8a6437; stroke-width: 0.35; }
.region-map .m-mount path { fill: #9a8a72; }
.region-map .m-mount .side { fill: #7c6d58; }
.region-map .m-snow { fill: #f7f9fc; }
.region-map .m-cave { fill: #231c19; }
.region-map .m-desert { fill: #e8cb88; opacity: 0.9; }
.region-map .m-dune { fill: none; stroke: #c49a52; stroke-width: 0.35; }
.region-map .m-cactus path { fill: none; stroke: #3f8a4f; stroke-width: 0.4; stroke-linecap: round; }
.region-map .m-lagoon { fill: #56b3e0; opacity: 0.75; }
.region-map .m-wave, .region-map .m-wave2 { fill: none; stroke: rgba(235, 248, 255, 0.7); stroke-width: 0.28; }
.region-map .m-wave2 { stroke: rgba(235, 248, 255, 0.35); }
.region-map .m-light rect { fill: #f4f4f4; }
.region-map .m-light path { fill: #e04848; }
.region-map .m-bldg rect { fill: #cfd3dc; stroke: #7d8290; stroke-width: 0.15; }
.region-map .m-bldg .top { fill: #8a93a6; }
.region-map .m-bldg .win { stroke: #ffe28a; stroke-width: 0.25; }
.region-map .m-pc rect { fill: #fff; }
.region-map .m-pc path { fill: #e84a4a; }
.region-map .m-pc .plus { stroke: #e84a4a; stroke-width: 0.3; fill: none; }
.region-map .m-house rect { fill: #f3e9d4; }
.region-map .m-house .win { fill: #6aa7d8; }
.region-map .m-field rect { fill: #d9c36a; opacity: 0.8; }
.region-map .m-field path { stroke: #b59c3f; stroke-width: 0.15; }
.region-map .m-ruin { fill: #c2b69c; stroke: #8f846c; stroke-width: 0.12; }
.region-map .m-castle path { fill: #e0dbd0; stroke: #8f887b; stroke-width: 0.2; }
.region-map .m-castle .door { fill: #6a5a48; }
.region-map .m-castle .flag { fill: #e04848; stroke: #6a5a48; stroke-width: 0.15; }
.region-map .m-grass { fill: none; stroke: #2f7033; stroke-width: 0.3; }
.region-map .m-flowers circle { fill: #ffd166; }
.region-map .m-bush { fill: #3b8a46; }
.region-map .m-lake ellipse { fill: #4aa7d8; }
.region-map .m-lake .rim { fill: #9fd6ef; }
.region-map .m-lake path { fill: none; stroke: rgba(255, 255, 255, 0.7); stroke-width: 0.2; }
.region-map .m-rock ellipse { fill: #7d8793; }
.region-map .m-boat path { fill: #8a5a33; }
.region-map .m-boat .sail { fill: #fdfbf5; }
.region-map .m-boat { animation: boat-bob 6s ease-in-out infinite; }
@keyframes boat-bob { 50% { transform: translate(1.5px, -0.4px); } }
.region-map .m-cloud { fill: rgba(255, 255, 255, 0.28); pointer-events: none; animation: cloud-drift linear infinite; }
@keyframes cloud-drift { from { transform: translateX(-30px); } to { transform: translateX(130px); } }
.region-map.z3 .m-cloud { opacity: 0.4; }
.region-map .m-compass circle { fill: rgba(255, 248, 230, 0.85); stroke: #8a6a3a; stroke-width: 0.3; }
.region-map .m-compass path { fill: #8a6a3a; }
.region-map .m-compass path.n { fill: #d8453e; }
.region-map .m-compass path.minor { fill: #b89a6a; }
.region-map .m-compass text { font-size: 2.2px; fill: #fff; font-family: var(--font-ui); font-weight: 800; paint-order: stroke; stroke: rgba(0, 0, 0, 0.7); stroke-width: 0.5px; }
.region-map .m-node { cursor: pointer; }
.region-map .m-node .hit { fill: transparent; }
.region-map .m-node .dot, .region-map .m-node .hit, .region-map .pulse, .world-map .w-here { transform-box: fill-box; transform-origin: center; transform: scale(var(--dz, 1)); }
.region-map .m-pin .pin-in { transform: scale(var(--dz, 1)); transform-origin: 0 0; }
.region-map .m-node .dot { fill: #b9c0cc; stroke: #2a2a3e; stroke-width: 0.45; }
.region-map .m-node.visited .dot { fill: #fff; }
.region-map .m-node.town.visited .dot { fill: #ffe7a3; }
.region-map .m-node text { font-size: calc(2.9px * var(--lz, 1)); fill: #eef1f6; opacity: 0.85; paint-order: stroke; stroke: rgba(20, 24, 36, 0.9); stroke-width: calc(0.75px * var(--lz, 1)); font-family: var(--font-ui); font-weight: 600; pointer-events: none; }
.region-map .m-node.visited text { fill: #fff; opacity: 1; font-size: calc(3.2px * var(--lz, 1)); font-weight: 700; }
.region-map .m-node.here .dot { fill: #ff4b55; }
.region-map .m-node.selected .dot { stroke: var(--gold, #ffd166); stroke-width: 0.9; }
.region-map .m-node:hover .dot, .region-map .m-node:focus .dot { stroke: var(--gold, #ffd166); stroke-width: 0.9; }
.region-map .m-node:focus { outline: none; }
.region-map .pulse, .world-map .pulse { fill: none; stroke: #ff4b55; stroke-width: 0.6; animation: map-pulse 1.6s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.region-map .m-pin { pointer-events: none; }
.region-map .m-pin path { fill: #ff4b55; stroke: #fff; stroke-width: 0.35; }
.region-map .m-partner { animation: pin-bob 1.8s ease-in-out infinite; image-rendering: pixelated; }
@keyframes pin-bob { 50% { transform: translateY(-1px); } }
.world-map .w-grid line { stroke: rgba(255, 255, 255, 0.07); stroke-width: 0.3; }
.world-map .w-cont path { fill: #c9c3a6; opacity: 0.55; stroke: rgba(255, 245, 220, 0.5); stroke-width: 0.3; }
.world-map .w-coast path { fill: none; stroke: #a9dcf0; stroke-width: 2.4; opacity: 0.45; }
.world-map .w-waves path { fill: none; stroke: rgba(235, 248, 255, 0.28); stroke-width: 0.25; }
.world-map .w-trip { fill: none; stroke: #ffd166; stroke-width: 0.6; stroke-dasharray: 1.4 1; opacity: 0.9; }
.world-map .m-cloud { fill: rgba(255, 255, 255, 0.25); pointer-events: none; animation: cloud-drift-w linear infinite; }
@keyframes cloud-drift-w { from { transform: translateX(-40px); } to { transform: translateX(240px); } }
.world-map .m-compass circle { fill: rgba(255, 248, 230, 0.85); stroke: #8a6a3a; stroke-width: 0.3; }
.world-map .m-compass path { fill: #8a6a3a; }
.world-map .m-compass path.n { fill: #d8453e; }
.world-map .m-compass path.minor { fill: #b89a6a; }
.world-map .m-compass text { font-size: 2.2px; fill: #fff; font-family: var(--font-ui); font-weight: 800; paint-order: stroke; stroke: rgba(0, 0, 0, 0.7); stroke-width: 0.5px; }
.world-map .w-region { cursor: pointer; }
.world-map .w-region .hit { fill: transparent; }
.world-map .w-region text { font-size: calc(3.2px * var(--lz, 1)); fill: #e3e7ef; paint-order: stroke; stroke: rgba(10, 16, 30, 0.9); stroke-width: calc(0.7px * var(--lz, 1)); font-family: var(--font-ui); font-weight: 700; pointer-events: none; }
.world-map .w-region .w-pct { font-size: calc(2.5px * var(--lz, 1)); font-weight: 600; fill: #b9c0cc; }
.world-map .w-region.explored text { fill: #fff; }
.world-map .w-region.explored .w-pct { fill: #86efac; }
.world-map .w-region:hover > g, .world-map .w-region:focus > g { filter: brightness(1.3); }
.world-map .w-region:focus { outline: none; }
.world-map .w-here { fill: #ff4b55; stroke: #fff; stroke-width: 0.3; }
.place-card { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); animation: fadeUp 0.3s ease both; }
.place-card .pc-head { display: flex; align-items: center; gap: 10px; }
.place-card .pc-ico { font-size: 1.7rem; }
.place-card .pc-head small { display: block; color: var(--muted, #aab); }
.place-card > div + div, .place-card > div + p, .place-card > p + div { margin-top: 8px; }
.place-card small { color: var(--muted, #aab); font-weight: 600; }
.pc-origin { padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--gold, #ffd166) 12%, transparent); border: 1px solid color-mix(in srgb, var(--gold, #ffd166) 35%, transparent); }
.pc-origin p { margin: 4px 0 0; }
.pc-story ul { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.pc-story li { display: flex; gap: 8px; line-height: 1.35; }
.pc-story li span { flex: none; min-width: 52px; color: var(--gold, #ffd166); font-weight: 700; font-size: 0.8rem; padding-top: 1px; }
.pc-people div { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pc-people em { color: var(--muted, #aab); font-style: normal; font-size: 0.8em; }
.place-card .pc-mons div { display: flex; flex-wrap: wrap; gap: 2px; }
.place-card .pc-mons img { width: 40px; height: 40px; image-rendering: pixelated; opacity: 0.6; }
.place-card .pc-mons img.caught { opacity: 1; }
.place-card .btn { margin-top: 10px; }
.npc-aff { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 0.85rem; }
.npc-aff .aff { flex: 1; max-width: 160px; }
.npc-mons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.npc-mons figure { margin: 0; text-align: center; width: 64px; }
.npc-mons img { width: 56px; height: 56px; image-rendering: pixelated; }
.npc-mons span { display: block; font-size: 1.8rem; height: 56px; line-height: 56px; }
.npc-mons figcaption { font-size: 0.72rem; color: var(--muted, #aab); }
.npcs li[data-npc-open] { cursor: pointer; }
.npcs li[data-npc-open]:hover { background: rgba(255, 255, 255, 0.05); }
@keyframes map-pulse { from { transform: scale(calc(0.4 * var(--dz, 1))); opacity: 1; } to { transform: scale(calc(1.6 * var(--dz, 1))); opacity: 0; } }

@media (max-width: 720px) {
  .b-bottom { grid-template-columns: 1fr; }
  .b-log { min-height: 64px; font-size: 1rem; }
  .b-info { min-width: 160px; padding: 8px 10px; }
  .b-foe { top: 4%; right: 3%; }
  .b-me { left: 3%; }
  .battle-banner { flex-direction: column; align-items: stretch; }
}
body[data-screen="game"] #place-caption { display: none; }
@media (max-width: 720px) {
  .hud-sub { white-space: normal; font-size: 0.75rem; line-height: 1.3; }
}

/* ---------- jeu de rôle : zone d'écriture ---------- */
.write-box { display: flex; flex-direction: column; gap: 6px; animation: fadeUp 0.45s ease; }
.question {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-family: var(--font-story);
  font-size: 1.12rem;
  font-style: italic;
  color: #fff;
  padding: 12px 16px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 22%, rgba(10, 12, 26, 0.85));
  border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.q-icon { font-style: normal; }
.free-form textarea {
  flex: 1;
  resize: none;
  min-height: 46px;
  max-height: 180px;
  line-height: 1.45;
  font-family: var(--font-story);
  font-size: 1.02rem;
  background: rgba(12, 14, 30, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.free-form { align-items: flex-end; }
.write-box.mode-free .free-form textarea {
  min-height: 84px;
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent), 0 10px 30px rgba(0, 0, 0, 0.35);
}
.write-box.mode-free .question { animation: q-glow 3s ease-in-out infinite; }
@keyframes q-glow { 50% { box-shadow: 0 0 26px color-mix(in srgb, var(--accent) 45%, transparent); } }
.write-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.write-tools .hint { margin: 0 0 0 auto; opacity: 0.7; }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.85rem; padding: 2px 0; }
.link-btn:hover:not(:disabled) { color: var(--text); text-decoration: underline; }
.ideas { display: flex; flex-wrap: wrap; gap: 6px; }
.ideas .hint { width: 100%; margin: 0; }
.idea { padding: 7px 12px; border-radius: 999px; border: 1px dashed var(--border); background: rgba(12, 14, 30, 0.6); cursor: pointer; font-size: 0.88rem; color: var(--muted); }
.idea:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
@media (max-width: 720px) {
  .write-tools .hint { display: none; }
  .question { font-size: 1rem; }
}

/* ---------- narration : dialogues et pensées ---------- */
.narrative p.dialogue, .journal p.dialogue { padding-left: 14px; border-left: 3px solid color-mix(in srgb, var(--accent) 70%, transparent); }
.narrative .speaker, .journal .speaker { display: block; font-family: var(--font-ui); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin-bottom: 2px; }
.narrative p.thought, .narrative em, .journal p.thought { font-style: italic; color: #cfd3ee; }
.story-card.enter { animation: card-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(0.985); filter: blur(4px); } }

/* ---------- effets de mise en scène ---------- */
#stage { transition: transform 0.25s ease-out, filter 1.2s ease; transform: scale(1.03); }
#fx-glow, #fx-pulse { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0; transition: opacity 1.2s ease; }
#fx-glow { background: radial-gradient(ellipse at 50% 35%, rgba(255, 226, 140, 0.45), transparent 65%); mix-blend-mode: screen; }
#fx-pulse { background: radial-gradient(ellipse at center, transparent 45%, rgba(200, 0, 20, 0.55) 100%); }
body.fx-glow #fx-glow { opacity: 1; animation: glow-breathe 2.5s ease-in-out infinite; }
body.fx-heartbeat #fx-pulse, body.low-health #fx-pulse { animation: heartbeat 1.1s ease-in-out infinite; }
body.low-health:not(.fx-heartbeat) #fx-pulse { animation-duration: 1.8s; }
body.fx-shake #screen-game, body.fx-shake #stage { animation: shake 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
body.fx-blur #stage { filter: blur(3px) saturate(0.8); animation: wobble-blur 4.5s ease-in-out; }
body.fx-blur .narrative { animation: text-wobble 4.5s ease-in-out; }
body.fx-darken #stage { filter: grayscale(0.7) brightness(0.6); }
body.fx-glitch .story-card { animation: glitch 0.25s steps(2) 6; }
body.fx-glitch #stage { animation: glitch-bg 0.3s steps(2) 5; }
body.low-mood #stage { filter: saturate(0.45) brightness(0.9); }
body.low-mood.fx-darken #stage { filter: grayscale(0.85) brightness(0.55); }
body[data-screen="game"][data-time="night"] { --panel-strong: rgba(6, 7, 18, 0.88); }
body[data-screen="game"][data-time="day"] { --panel-strong: rgba(14, 18, 36, 0.78); }
@keyframes glow-breathe { 50% { opacity: 0.6; } }
@keyframes heartbeat { 0%, 100% { opacity: 0.15; } 15% { opacity: 0.85; } 30% { opacity: 0.3; } 45% { opacity: 0.7; } }
@keyframes shake {
  10%, 90% { transform: translate(-2px, 1px) scale(1.03); }
  20%, 80% { transform: translate(4px, -2px) scale(1.03); }
  30%, 50%, 70% { transform: translate(-7px, 3px) scale(1.03); }
  40%, 60% { transform: translate(7px, -3px) scale(1.03); }
}
@keyframes wobble-blur { 25% { transform: scale(1.05) rotate(-0.6deg); } 75% { transform: scale(1.04) rotate(0.6deg); } }
@keyframes text-wobble { 25% { filter: blur(0.6px); } 50% { filter: blur(0); } 75% { filter: blur(0.8px); } }
@keyframes glitch {
  0% { transform: translate(0); text-shadow: 2px 0 #ff00c8, -2px 0 #00f0ff; }
  50% { transform: translate(-3px, 1px) skewX(-2deg); text-shadow: -3px 0 #ff00c8, 3px 0 #00f0ff; }
  100% { transform: translate(2px, -1px); text-shadow: 2px 0 #ff00c8, -2px 0 #00f0ff; }
}
@keyframes glitch-bg { 50% { filter: hue-rotate(90deg) contrast(1.4); transform: translateX(6px) scale(1.03); } }

/* ---------- écran-titre de chapitre ---------- */
#chapter-card {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: radial-gradient(ellipse at center, rgba(5, 6, 16, 0.75), rgba(0, 0, 0, 0.95));
  opacity: 0;
  transition: opacity 0.5s ease;
  cursor: pointer;
  text-align: center;
  padding: 24px;
}
#chapter-card.show { opacity: 1; }
#chapter-card small { font-family: var(--font-title); letter-spacing: 0.4em; text-transform: uppercase; color: var(--accent); }
#chapter-card h2 { font-family: var(--font-title); font-size: clamp(2rem, 7vw, 3.6rem); margin: 0; }
#chapter-card.show small, #chapter-card.show h2 { animation: cc-in 1.4s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
#chapter-card.show h2 { animation-delay: 0.25s; }
.cc-line { width: 0; height: 1px; background: var(--accent); transition: width 1.6s ease 0.4s; }
#chapter-card.show .cc-line { width: min(320px, 60vw); }
@keyframes cc-in { from { opacity: 0; letter-spacing: 0.6em; filter: blur(6px); } }

/* ---------- confettis ---------- */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 58; overflow: hidden; }
#confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: confetti-fall linear forwards; }
@keyframes confetti-fall { to { top: 105%; transform: rotate(720deg) translateX(40px); } }
body.reduce-motion #stage { transform: none !important; }

/* ---------- choix riches (titre + risque) ---------- */
.choice { align-items: flex-start; }
.choice kbd { margin-top: 2px; }
.c-text { display: flex; flex-direction: column; gap: 3px; }
.c-text b { font-weight: 600; }
.c-text small { color: var(--muted); font-size: 0.86rem; line-height: 1.4; }
.choice.other { border-style: dashed; background: rgba(12, 14, 30, 0.45); }
.choice.other b { color: var(--accent); }
.narrative p.bullet { position: relative; padding-left: 20px; margin-bottom: 0.45em; }
.narrative p.bullet::before { content: "◆"; position: absolute; left: 2px; top: 0; color: var(--accent); font-size: 0.7em; line-height: 2.4; }
.narrative strong { color: #fff; font-weight: 600; }
.revise { margin-top: 6px; padding: 10px 12px; border-radius: 12px; border: 1px dashed color-mix(in srgb, var(--accent) 50%, transparent); }
.revise .field { margin: 4px 0; }

/* ---------- récits longs : toute la zone de jeu défile ---------- */
#story { overflow-y: auto; justify-content: flex-start; scrollbar-width: thin; }
#story > :first-child { margin-top: auto; }
#story .story-card { max-height: none; overflow: visible; flex-shrink: 0; }
#story .choices, #story .write-box, #story .quick-actions { flex-shrink: 0; }
@media (max-width: 720px) { #story .story-card { max-height: none; } }

/* ---------- objectifs & précédemment ---------- */
.goals { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 12px; }
.goals .g-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold); }
.goals .goal { font-size: 0.8rem; padding: 3px 10px; border-radius: 999px; background: rgba(255, 209, 102, 0.1); border: 1px solid rgba(255, 209, 102, 0.35); color: #f3e2b3; }
.threads { padding-left: 20px; line-height: 1.6; }

/* ---------- installation simplifiée ---------- */
.get-key { display: flex; justify-content: center; align-items: center; gap: 8px; width: 100%; margin: 14px 0 6px; padding: 14px 18px; font-size: 1.08rem; text-decoration: none; text-align: center; animation: keyGlow 2.4s ease-in-out infinite; }
@keyframes keyGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 203, 5, 0); } 50% { box-shadow: 0 0 22px 2px rgba(255, 203, 5, 0.35); } }
.other-ai { margin: 10px 0; padding: 10px 14px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 12px; background: rgba(255, 255, 255, 0.04); }
.other-ai summary { cursor: pointer; font-weight: 600; }
.other-ai ul { padding-left: 20px; line-height: 1.7; margin: 6px 0; }
.other-ai a { color: inherit; }
@media (prefers-reduced-motion: reduce) { .get-key { animation: none; } }

/* ---------- récit en direct (réponse en flux) ---------- */
.narrative .live { white-space: pre-wrap; }
.narrative .caret { display: inline-block; width: 0.55em; height: 1.05em; margin-left: 2px; vertical-align: -0.15em; background: var(--accent); border-radius: 2px; animation: caretBlink 0.9s steps(2, start) infinite; }
@keyframes caretBlink { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .narrative .caret { animation: none; } }
.destiny-live { max-height: 46vh; overflow-y: auto; font-family: var(--font-story); line-height: 1.65; padding: 6px 4px; }
.destiny-live h3 { margin-top: 0; }
.destiny-live .caret { display: inline-block; width: 0.55em; height: 1.05em; background: var(--accent); border-radius: 2px; animation: caretBlink 0.9s steps(2, start) infinite; }

/* ---------- démo sans clé ---------- */
.demo-btn { border-style: dashed; }
.demo-link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }
.hint.center { text-align: center; }
.demo-end { text-align: center; padding: 18px; border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 12%, transparent); animation: fadeUp 0.6s ease both; }
.demo-end h3 { margin-top: 0; }
.demo-end p { font-family: var(--font-story); line-height: 1.6; margin: 0 0 14px; }

/* ---------- fiche d'un Pokémon ---------- */
[data-mon] { cursor: pointer; }
.team-slot[data-mon]:hover, .team-card[data-mon]:hover { filter: brightness(1.15); transform: translateY(-1px); }
.mon-sheet h3 { margin-top: 18px; }
.mon-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.mon-head.shiny .mon-art { filter: drop-shadow(0 0 14px rgba(255, 215, 90, 0.7)); }
.mon-art { width: 150px; height: 150px; object-fit: contain; image-rendering: auto; }
.mon-id { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 6px; }
.mon-id h2 { margin: 0; }
.mon-id .row input { max-width: 160px; }
.mon-flash { margin-bottom: 10px; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--gold) 18%, transparent); border: 1px solid color-mix(in srgb, var(--gold) 60%, transparent); font-weight: 600; animation: fadeUp 0.5s ease both; }
.mon-stats { display: grid; gap: 6px; }
.st-row { display: grid; grid-template-columns: 64px 1fr 40px; gap: 10px; align-items: center; font-size: 0.9rem; }
.st-row .bar { width: auto; height: 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.st-row .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--good)); }
.st-row b { text-align: right; }
.mv-list { display: grid; gap: 6px; }
.mv-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); border-left: 3px solid var(--tc); }
.mv-type { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); text-transform: uppercase; letter-spacing: 0.03em; }
.mv-stats { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.mv-act { display: flex; gap: 4px; }
.icon-btn.sm { width: 30px; height: 30px; font-size: 0.85rem; }
.mv-replace { margin: 10px 0; padding: 10px; border-radius: 10px; border: 1px dashed var(--accent); }
.mv-replace .row { margin-top: 8px; }
.mv-next { margin: 0; padding-left: 20px; line-height: 1.7; }
.evo-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.evo-row > div { flex: 1; }
@media (max-width: 560px) {
  .mv-row { grid-template-columns: auto 1fr; }
  .mv-stats { grid-column: 1 / -1; white-space: normal; }
  .mv-row > .btn, .mv-act { grid-column: 1 / -1; justify-self: start; }
  .mon-art { width: 110px; height: 110px; }
}

/* ---------- Panthéon des vies ---------- */
.pantheon-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 14px 0 18px; }
.pth-tile { display: flex; flex-direction: column; align-items: center; padding: 10px 6px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); }
.pth-tile b { font-size: 1.35rem; font-family: var(--font-title); }
.pth-tile small { color: var(--muted); font-size: 0.75rem; text-align: center; }
.pth-family { margin: 0 0 18px; }
.pth-card { display: flex; gap: 14px; padding: 14px; border-radius: var(--radius); background: linear-gradient(135deg, rgba(255, 215, 120, 0.08), rgba(255, 255, 255, 0.03)); border: 1px solid rgba(255, 215, 120, 0.28); }
.pth-mon { flex: none; width: 76px; display: flex; align-items: center; justify-content: center; }
.pth-mon .sprite { width: 76px; height: 76px; }
.pth-body { flex: 1; min-width: 0; }
.pth-body h3 { margin: 2px 0 4px; color: var(--text); font-size: 1.1rem; }
.pth-body h3 small { color: var(--muted); font-family: var(--font-ui); font-size: 0.75rem; letter-spacing: 0; }
.pth-gen { font-size: 0.75rem; color: var(--gold); text-transform: uppercase; letter-spacing: 0.06em; }
.pth-title { font-family: var(--font-story); font-style: italic; font-size: 1.05rem; }
.pth-epitaph { margin: 6px 0; font-family: var(--font-story); color: #d9d4c4; font-size: 0.95rem; }
.pth-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.pth-chips span { font-size: 0.78rem; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); }
.pth-kids { position: relative; margin: 10px 0 0 30px; padding-left: 18px; border-left: 2px solid rgba(255, 215, 120, 0.35); display: grid; gap: 10px; }
.pth-kids > .pth-node { position: relative; }
.pth-kids > .pth-node::before { content: ""; position: absolute; left: -18px; top: 40px; width: 16px; border-top: 2px solid rgba(255, 215, 120, 0.35); }
@media (max-width: 560px) {
  .pth-card { flex-direction: column; }
  .pth-kids { margin-left: 10px; padding-left: 12px; }
}

/* ---------- évolution : lignée, conditions, scène ---------- */
.evo-line { overflow-x: auto; padding: 8px 2px 12px; margin-bottom: 6px; }
.evo-branch { display: flex; align-items: center; gap: 6px; }
.evo-next { display: flex; flex-direction: column; gap: 6px; }
.evo-arrow { color: var(--muted); font-size: 1.1rem; }
.evo-stage { display: flex; flex-direction: column; align-items: center; min-width: 84px; max-width: 110px; padding: 6px; border-radius: 12px; border: 1px solid transparent; text-align: center; opacity: 0.6; }
.evo-stage .sprite { width: 56px; height: 56px; }
.evo-stage b { font-size: 0.82rem; }
.evo-stage small { font-size: 0.68rem; color: var(--muted); line-height: 1.2; }
.evo-stage.here { opacity: 1; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.evo-stage.next { opacity: 0.9; }
.evo-stage.ready { opacity: 1; border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 209, 102, 0.35); animation: pulseGold 1.8s ease-in-out infinite; }
@keyframes pulseGold { 50% { box-shadow: 0 0 22px rgba(255, 209, 102, 0.6); } }
.evo-miss { font-size: 0.78rem; color: var(--muted); max-width: 260px; text-align: right; }
.evo-stone { margin-top: 10px; }
.mon-hist { margin: 0; padding-left: 20px; line-height: 1.7; font-family: var(--font-story); }

.evo-scene { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; background: radial-gradient(circle at center, rgba(46, 34, 92, 0.97), rgba(4, 4, 12, 0.99)); animation: evoIn 0.5s ease both; }
.evo-scene.out, .evo-scene.stopped { animation: evoOut 0.5s ease both; }
@keyframes evoIn { from { opacity: 0; } }
@keyframes evoOut { to { opacity: 0; } }
.evo-stagebox { position: relative; width: min(260px, 70vw); aspect-ratio: 1; }
.evo-stagebox img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.evo-a { animation: evoBlinkA 4.6s ease-in both; }
.evo-b { animation: evoBlinkB 4.6s ease-in both; }
/* silhouette blanche qui alterne de plus en plus vite entre les deux formes */
@keyframes evoBlinkA {
  0% { filter: none; opacity: 1; } 12% { filter: brightness(0) invert(1); opacity: 1; }
  25%, 45%, 62%, 74%, 83%, 90%, 95% { opacity: 1; filter: brightness(0) invert(1); }
  35%, 54%, 68%, 79%, 87%, 93%, 98%, 100% { opacity: 0; filter: brightness(0) invert(1); }
}
@keyframes evoBlinkB {
  0%, 25%, 45%, 62%, 74%, 83%, 90%, 95% { opacity: 0; filter: brightness(0) invert(1); }
  35%, 54%, 68%, 79%, 87%, 93%, 98%, 100% { opacity: 1; filter: brightness(0) invert(1); }
}
.evo-scene.reveal .evo-a { animation: none; opacity: 0; }
.evo-scene.reveal .evo-b { animation: evoReveal 1.2s ease both; }
@keyframes evoReveal { from { filter: brightness(0) invert(1); transform: scale(1.12); } to { filter: none; opacity: 1; transform: scale(1); } }
.evo-rays { position: absolute; inset: -35%; background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.1) 0deg 6deg, transparent 6deg 24deg); -webkit-mask-image: radial-gradient(circle, #000 12%, transparent 65%); mask-image: radial-gradient(circle, #000 12%, transparent 65%); animation: spin 14s linear infinite; z-index: -1; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.evo-text { font-family: var(--font-title); font-size: 1.3rem; text-align: center; padding: 0 16px; text-shadow: 0 2px 12px #000; }
body.reduce-motion .evo-a, body.reduce-motion .evo-b, body.reduce-motion .evo-rays { animation-duration: 0.6s; }
@media (max-width: 560px) { .evo-miss { text-align: left; max-width: none; } .evo-row { flex-wrap: wrap; } }
.bond.exp .bar i { background: linear-gradient(90deg, #58a6ff, #8fd3ff); }
.bond.exp small { margin-left: 8px; font-size: 0.75rem; }

/* ---------- combats : effets des attaques, altérations, sexes ---------- */
.b-fx { position: absolute; inset: 10% 15%; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, var(--tc) 0%, color-mix(in srgb, var(--tc) 40%, transparent) 35%, transparent 70%); mix-blend-mode: screen; animation: b-fx 0.6s ease-out both; }
.b-fx.strong { inset: 0; animation-duration: 0.7s; }
@keyframes b-fx { 0% { opacity: 0; transform: scale(0.3); } 30% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: scale(1.4); } }
.b-dmg { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); font: 800 1.5rem var(--font-ui); color: #fff; text-shadow: 0 2px 0 #000, 0 0 10px rgba(0, 0, 0, 0.7); pointer-events: none; animation: b-dmg 1.1s ease-out both; }
.b-dmg.super { color: #ffcf4d; font-size: 1.8rem; }
.b-dmg.weak { color: #cbd5e1; font-size: 1.2rem; }
@keyframes b-dmg { 0% { opacity: 0; transform: translate(-50%, 10px) scale(0.6); } 20% { opacity: 1; transform: translate(-50%, -8px) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -46px) scale(1); } }
.b-status { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 6px; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.04em; color: #fff; vertical-align: middle; }
.s-par { background: #d4a500; } .s-slp { background: #7c7c9c; } .s-frz { background: #58b7d6; } .s-brn { background: #e0582c; } .s-psn { background: #9b3fb5; } .s-cnf { background: #c05a8c; }
.b-stages { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0; }
.b-stage { font-size: 0.66rem; font-weight: 700; padding: 0 5px; border-radius: 5px; }
.b-stage.up { background: rgba(74, 222, 128, 0.25); color: #86efac; }
.b-stage.down { background: rgba(239, 68, 68, 0.25); color: #fca5a5; }
.sex { margin-left: 4px; font-weight: 800; }
.sex.m { color: #60a5fa; } .sex.f { color: #f472b6; }
.b-mon img.buff { animation: b-buff 0.7s ease; }
.b-mon img.debuff { animation: b-debuff 0.7s ease; }
@keyframes b-buff { 0%, 100% { filter: none; } 40% { filter: drop-shadow(0 -8px 10px rgba(248, 113, 113, 0.9)) brightness(1.25); transform: translateY(-6px); } }
@keyframes b-debuff { 0%, 100% { filter: none; } 40% { filter: drop-shadow(0 8px 10px rgba(96, 165, 250, 0.9)) brightness(0.8); transform: translateY(6px); } }
body.reduce-motion .b-fx, body.reduce-motion .b-dmg { animation-duration: 0.3s; }
.mon-nature { font-size: 0.85rem; }
.mon-nature .up, .st-row.up span:first-child { color: #f87171; }
.mon-nature .down, .st-row.down span:first-child { color: #60a5fa; }
.st-row.up span:first-child::after { content: " ▲"; font-size: 0.7em; }
.st-row.down span:first-child::after { content: " ▼"; font-size: 0.7em; }
.mon-items { display: flex; flex-wrap: wrap; gap: 8px; }
/* badges sur les Pokémon de l'équipe : niveau, évolution possible, attaque à apprendre */
.team-slot { position: relative; overflow: visible; }
.team-slot .sprite { border-radius: 50%; }
.team-slot .lv { position: absolute; right: -4px; bottom: -4px; min-width: 16px; padding: 0 3px; border-radius: 8px; background: rgba(10, 12, 26, 0.9); border: 1px solid var(--border); font-size: 0.6rem; font-weight: 700; line-height: 14px; text-align: center; color: var(--text); }
.team-slot .evo-dot, .team-slot .mv-dot { position: absolute; top: -2px; width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 6px currentColor; }
.team-slot .evo-dot { right: -2px; background: var(--gold); color: var(--gold); animation: pulseGold 1.6s ease-in-out infinite; }
.team-slot .mv-dot { left: -2px; background: #60a5fa; color: #60a5fa; }
.b-spark { position: absolute; width: 14px; height: 14px; pointer-events: none; background: radial-gradient(circle, #fff 0 20%, #ffe066 35%, transparent 70%); clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); animation: b-spark 1s ease-out both; }
@keyframes b-spark { 0% { opacity: 0; transform: scale(0.2) rotate(0deg); } 40% { opacity: 1; transform: scale(1.3) rotate(45deg); } 100% { opacity: 0; transform: scale(0.4) rotate(90deg); } }

/* ---------- sac ---------- */
.bag-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 10px; }
.bag-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); animation: fadeUp 0.35s ease both; }
.bag-ico { font-size: 1.6rem; line-height: 1; width: 2rem; text-align: center; flex: none; }
.bag-info { flex: 1; min-width: 0; }
.bag-qty { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--gold) 22%, transparent); font-weight: 700; font-size: 0.85em; }
.bag-targets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bag-target { display: inline-flex; align-items: center; gap: 4px; }
.bag-target img { width: 32px; height: 32px; margin: -6px 0; image-rendering: pixelated; }
.bag-actions { display: flex; gap: 6px; flex: none; }
@media (max-width: 520px) {
  .bag-item { flex-wrap: wrap; }
  .bag-actions { width: 100%; justify-content: flex-end; }
}

/* ---------- PV actuels ---------- */
.hp-line { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; font-size: 0.85rem; }
.hp-line > span { font-weight: 700; color: var(--muted, #aab); min-width: 22px; }
.mon-stats .st-row > span { white-space: nowrap; }
.hp-line b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hp-bar { flex: 1; max-width: 180px; height: 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.hp-bar i { display: block; height: 100%; border-radius: 6px; transition: width 0.4s ease; }
.hp-bar.ok i, .slot-hp.ok b { background: #4ade80; }
.hp-bar.mid i, .slot-hp.mid b { background: #facc15; }
.hp-bar.low i, .slot-hp.low b { background: #f87171; }
.team-slot .slot-hp { position: absolute; left: 1px; right: 12px; bottom: -5px; height: 4px; border-radius: 3px; background: rgba(10, 12, 26, 0.9); overflow: hidden; }
.team-slot .slot-hp b { display: block; height: 100%; }

/* ---------- quotas des modèles ---------- */
.quota-list { display: flex; flex-direction: column; gap: 4px; }
.quota-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 80px auto; align-items: center; gap: 8px; width: 100%; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.04); color: inherit; font: inherit; font-size: 0.85rem; text-align: left; cursor: pointer; }
.quota-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.quota-row.on { border-color: var(--accent, #8b5cf6); background: color-mix(in srgb, var(--accent, #8b5cf6) 18%, transparent); }
.quota-row small { color: var(--muted, #aab); white-space: nowrap; }
.q-bar { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.q-bar i { display: block; height: 100%; background: #4ade80; }
.q-bar i.busy { background: #facc15; }
.q-bar i.exhausted { background: #f87171; }
.q-bar i.broken { background: #6b7280; }
.quota-row .q-err { grid-column: 2 / -1; font-style: normal; font-size: 0.75rem; color: #fca5a5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loading-main { display: flex; flex-direction: column; gap: 2px; flex: 1; }
#loading-status { font-family: var(--font-ui); font-style: normal; font-size: 0.78rem; opacity: 0.8; }
#loading-cancel { font-style: normal; }

/* ---------- IA de secours ---------- */
.backup-list { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.backup-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); font-size: 0.88rem; }
.backup-list li b { flex: 1; }
.backup-list li.main { border-color: color-mix(in srgb, var(--gold, #ffd166) 45%, var(--border)); background: color-mix(in srgb, var(--gold, #ffd166) 10%, transparent); }
.backup-list li.main span { color: var(--gold, #ffd166); }
.backup-list li.main em { color: var(--muted, #aab); font-style: normal; font-size: 0.8em; }
.backup-list code { color: var(--muted, #aab); }
.backup-list .icon-btn.sm:disabled { opacity: 0.3; cursor: default; }
#s-backups .row { display: flex; gap: 6px; }
#s-backups input { flex: 1; min-width: 0; }
#error-backup { margin-left: 6px; }

/* ---------- carte : trajet récent ---------- */
.region-map .m-trail path { fill: none; stroke: #ffd166; stroke-width: calc(0.7px * var(--dz, 1)); stroke-linecap: round; stroke-dasharray: 1.2 1.1; animation: trail-run 1.6s linear infinite; filter: drop-shadow(0 0 0.6px rgba(0, 0, 0, 0.6)); pointer-events: none; }
.region-map .m-trail circle { fill: #ffd166; stroke: #6b4a0f; stroke-width: 0.2; pointer-events: none; transform-box: fill-box; transform-origin: center; transform: scale(var(--dz, 1)); }
@keyframes trail-run { to { stroke-dashoffset: -4.6; } }
@media (prefers-reduced-motion: reduce) { .region-map .m-trail path { animation: none; } }
.place-card { position: relative; }
.place-card .pc-close { position: absolute; top: 8px; right: 8px; }
.place-card .pc-head { padding-right: 36px; }

/* ---------- carte en plein écran (téléphone, tablette, ou bouton ⛶) ---------- */
.modal.modal-full { padding: 0; }
.modal-box.map-full { width: 100vw; max-width: none; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; padding: 0; overflow: hidden; border: 0; animation: fadeIn 0.2s ease; }
.modal-box.map-full .modal-close { top: calc(env(safe-area-inset-top) + 10px); right: calc(env(safe-area-inset-right) + 10px); z-index: 6; background: rgba(10, 16, 34, 0.72); backdrop-filter: blur(6px); }
.map-full .map-shell { position: absolute; inset: 0; }
.map-full .map-frame { position: absolute; inset: 0; border-radius: 0; box-shadow: none; }
.map-full .map-frame svg { width: 100%; height: 100%; max-height: none; aspect-ratio: auto; }
.map-full .map-head {
  position: absolute; top: 0; left: 0; right: 0; z-index: 4; pointer-events: none;
  padding: calc(env(safe-area-inset-top) + 12px) 64px 26px calc(env(safe-area-inset-left) + 14px);
  background: linear-gradient(to bottom, rgba(6, 9, 22, 0.96), rgba(6, 9, 22, 0.9) 78%, transparent);
}
.map-full .map-head > * { pointer-events: auto; }
.map-full .map-head h2 { margin: 0 0 6px; font-size: 1.15rem; }
.map-full .map-head .map-tabs { margin: 0 0 6px; }
.map-full .map-head .map-progress, .map-full .map-head .map-sub { margin: 0; font-size: 0.82rem; }
.map-full .map-zoom { right: calc(env(safe-area-inset-right) + 10px); top: 50%; bottom: auto; transform: translateY(-50%); z-index: 4; }
.map-full .map-zoom .icon-btn { width: 44px; height: 44px; font-size: 1.2rem; }
/* la fiche d'un lieu monte depuis le bas, par-dessus la carte */
.map-full .map-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 0 calc(env(safe-area-inset-right) + 12px) calc(env(safe-area-inset-bottom) + 12px) calc(env(safe-area-inset-left) + 12px);
  max-height: 58%; overflow-y: auto; overscroll-behavior: contain; pointer-events: none;
}
.map-full .map-sheet > * { pointer-events: auto; }
.map-full .map-sheet .map-tip { display: inline-block; margin: 0 auto; padding: 8px 12px; border-radius: 12px; background: rgba(8, 12, 28, 0.78); backdrop-filter: blur(6px); animation: tip-fade 7s ease forwards; }
@keyframes tip-fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
.map-full .map-sheet.open .place-card { margin: 0; background: rgba(12, 15, 32, 0.94); backdrop-filter: blur(10px); border-radius: 18px; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.45); animation: sheet-up 0.28s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
.map-full .map-sheet.open .place-card::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 3px; background: rgba(255, 255, 255, 0.25); margin: -2px auto 10px; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 900px) {
  /* grand écran en plein écran : la fiche se place en colonne à gauche */
  .map-full .map-sheet.open { left: calc(env(safe-area-inset-left) + 14px); right: auto; top: 150px; bottom: 14px; width: 380px; max-height: none; padding: 0; }
}
.world-map .w-region .hit { r: 11px; }

/* ---------- barre de navigation du bas (téléphone et tablette) ---------- */
.dock { display: none; }
@media (max-width: 1100px) {
  .dock {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px calc(env(safe-area-inset-right) + 6px) calc(env(safe-area-inset-bottom) + 6px) calc(env(safe-area-inset-left) + 6px);
    background: linear-gradient(to top, rgba(6, 8, 20, 0.96), rgba(8, 10, 24, 0.86));
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  .dock button {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 2px; border: 0; border-radius: 12px; background: transparent; color: var(--muted);
    font-size: 1.25rem; line-height: 1; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background 0.15s, color 0.15s, transform 0.1s;
  }
  .dock button span { font-size: 0.64rem; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .dock button:active { transform: scale(0.92); background: rgba(255, 255, 255, 0.08); color: var(--text); }
  .dock button:disabled { opacity: 0.35; }
  .dock button .dot { position: absolute; }
  body[data-screen="game"] .dock { display: flex; }
  body:not([data-screen="game"]) .dock { display: none; }
  .hud-actions { display: none !important; }
  #story { padding-bottom: calc(env(safe-area-inset-bottom) + 84px) !important; }
  body.in-battle .dock { display: none; }
}

/* ---------- téléphone : en-tête compact ---------- */
@media (max-width: 720px) {
  #hud { padding: calc(env(safe-area-inset-top) + 10px) 12px 6px; gap: 6px 10px; }
  .hud-id { flex: 1 1 100%; padding-right: 150px; min-height: 52px; }
  .hud-stats { order: 3; flex: 1 1 100%; justify-content: space-between; gap: 6px; }
  .hud-stats .bar { width: 44px; }
  .hud-team .team-slot { width: 34px; height: 34px; }
  #topbar { top: calc(env(safe-area-inset-top) + 10px); }
}
/* tablette : en-tête sur une ligne, texte plus grand */
@media (min-width: 721px) and (max-width: 1100px) {
  #hud { padding: calc(env(safe-area-inset-top) + 14px) 176px 10px 20px; flex-wrap: nowrap; }
  .hud-stats { flex-wrap: nowrap; justify-content: center; gap: 18px; }
  .hud-stats .bar { width: 64px; }
  #story .story-card { font-size: 1.04rem; }
  .choice { min-height: 64px; }
}
/* écrans tactiles : pas de raccourcis clavier, des cibles plus grandes */
@media (hover: none) and (pointer: coarse) {
  .write-tools .hint, .choice kbd { display: none; }
  .choice { padding-top: 14px; padding-bottom: 14px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
  .chip-btn { padding: 9px 14px; }
}

/* ---------- fenêtres en « feuille » qui monte du bas (téléphone) ---------- */
@media (max-width: 600px) {
  .modal:not(.modal-full) { align-items: flex-end; padding: 0; }
  .modal:not(.modal-full) .modal-box {
    width: 100%; max-width: none; max-height: calc(100dvh - env(safe-area-inset-top) - 24px);
    border-radius: 22px 22px 0 0; border-bottom: 0;
    padding: 26px 18px calc(env(safe-area-inset-bottom) + 20px);
    animation: sheet-up 0.32s cubic-bezier(0.2, 0.9, 0.3, 1) both;
    overscroll-behavior: contain;
  }
  .modal:not(.modal-full) .modal-box::before {
    content: ""; position: sticky; top: -18px; display: block; width: 44px; height: 5px; margin: -14px auto 12px;
    border-radius: 3px; background: rgba(255, 255, 255, 0.28); z-index: 2;
  }
  .modal:not(.modal-full) .modal-close { top: 10px; right: 10px; }
  .modal-box.dragging-sheet { transition: none; animation: none; }
}

/* ---------- carte : image rapide pendant les gestes ---------- */
.map-frame { background: radial-gradient(ellipse at 50% 45%, #767a80, #4a4a52); }
.map-frame:has(.world-map) { background: #2a79b0; }
.map-frame .map-raster { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; will-change: transform; }
.map-frame svg { position: relative; }
.region-map.moving .m-art { display: none; }
/* carte plein écran : le décor du jeu derrière est figé et caché (moins de calcul) */
body.map-open #stage, body.map-open #screen-game { visibility: hidden; }
body.map-open .bg-layer { animation-play-state: paused; }
.map-full .region-map .m-frame { display: none; }

/* taille du texte de l'histoire (réglage) */
body[data-textsize="s"] .narrative { font-size: 0.95rem; }
body[data-textsize="l"] .narrative { font-size: 1.22rem; line-height: 1.8; }
body[data-textsize="xl"] .narrative { font-size: 1.36rem; line-height: 1.85; }
@media (max-width: 720px) {
  body[data-textsize="s"] .narrative { font-size: 0.92rem; }
  body[data-textsize="l"] .narrative { font-size: 1.14rem; }
  body[data-textsize="xl"] .narrative { font-size: 1.26rem; }
}
/* application installée : respecter les bords de l'écran (encoche, barre du bas) */
@media (display-mode: standalone) {
  #topbar { top: calc(env(safe-area-inset-top) + 10px); }
}

/* ---------- Centre Pokémon express ---------- */
.chip-btn.heal-btn { border-color: #f472b6; color: #fbcfe8; }
.heal-scene { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: rgba(10, 8, 24, 0.72); backdrop-filter: blur(4px); animation: fadeIn 0.25s ease; }
.heal-scene p { font-family: var(--font-story); font-size: 1.15rem; margin: 0; text-align: center; padding: 0 20px; }
.heal-scene.out { opacity: 0; transition: opacity 0.3s ease; }
.heal-machine { display: grid; grid-template-columns: repeat(3, 64px); gap: 12px; padding: 18px; border-radius: 22px; background: linear-gradient(#f5f7fb, #d6dce8); box-shadow: 0 10px 40px rgba(244, 114, 182, 0.35), inset 0 -6px 0 rgba(0, 0, 0, 0.08); }
.heal-ball { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 50% 50%, #fff 0 9px, #333 9px 12px, transparent 12px), linear-gradient(#e3353d 0 47%, #333 47% 53%, #fafafa 53%); animation: heal-glow 0.5s ease both; overflow: hidden; }
.heal-ball img { width: 56px; height: 56px; image-rendering: pixelated; opacity: 0; }
.heal-scene.done .heal-ball { background: radial-gradient(circle, #fff7fb, #fbcfe8); box-shadow: 0 0 18px #f472b6; }
.heal-scene.done .heal-ball img { opacity: 1; transition: opacity 0.3s ease; }
@keyframes heal-glow { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.1); box-shadow: 0 0 22px #f472b6; } 100% { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .heal-ball { animation: none; } }

/* ---------- effets spéciaux des attaques ---------- */
.b-field { transition: transform 0.05s linear, scale 0.35s ease, filter 0.1s; }
.b-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
.b-field.b-flash::after { content: ""; position: absolute; inset: -10%; background: #fff; z-index: 6; pointer-events: none; animation: b-flash 0.5s ease-out; }
@keyframes b-flash { 0% { opacity: 0.9; } 100% { opacity: 0; } }
.b-crit { position: absolute; left: 50%; top: 38%; z-index: 7; transform: translate(-50%, -50%) rotate(-8deg); font-family: var(--font-title); font-weight: 900; font-size: clamp(1.8rem, 6vw, 3.4rem); color: #ffe066; letter-spacing: 0.06em; text-shadow: 0 0 18px rgba(255, 180, 0, 0.9), 3px 3px 0 #b3261e, -2px -2px 0 #000; animation: b-crit 1.1s cubic-bezier(0.2, 1.4, 0.4, 1) both; pointer-events: none; white-space: nowrap; }
@keyframes b-crit { 0% { transform: translate(-50%, -50%) rotate(-8deg) scale(2.4); opacity: 0; } 18% { transform: translate(-50%, -50%) rotate(-8deg) scale(1); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(-50%, -70%) rotate(-8deg) scale(1); opacity: 0; } }

/* ---------- combats : météo, champs, talents, objets tenus ---------- */
.b-wx { position: absolute; top: 10px; left: 12px; z-index: 8; display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none; }
.b-wx span { font-size: 0.78rem; padding: 3px 10px; border-radius: 999px; background: rgba(8, 12, 30, 0.72); border: 1px solid rgba(255, 255, 255, 0.18); backdrop-filter: blur(6px); }
.b-wx span.off { opacity: 0.45; text-decoration: line-through; }
.b-wx i { font-style: normal; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.15); font-size: 0.7rem; }
.b-field::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 4; opacity: 0; transition: opacity 0.8s ease; }
.b-field.wx-rain::before { opacity: 1; background-image: repeating-linear-gradient(105deg, transparent 0 14px, rgba(170, 200, 255, 0.35) 14px 15px, transparent 15px 34px); background-size: 120px 120px; animation: wx-rain 0.45s linear infinite; }
.b-field.wx-sun::before { opacity: 1; background: radial-gradient(circle at 85% -10%, rgba(255, 220, 120, 0.55), transparent 55%), linear-gradient(180deg, rgba(255, 170, 60, 0.12), transparent 60%); animation: wx-sun 3s ease-in-out infinite alternate; }
.b-field.wx-sand::before { opacity: 1; background-image: radial-gradient(rgba(214, 170, 100, 0.55) 1px, transparent 1.6px), radial-gradient(rgba(190, 140, 80, 0.4) 1.2px, transparent 2px); background-size: 38px 22px, 57px 31px; background-color: rgba(190, 140, 70, 0.18); animation: wx-sand 0.9s linear infinite; }
.b-field.wx-snow::before { opacity: 1; background-image: radial-gradient(#fff 1.4px, transparent 2px), radial-gradient(rgba(255, 255, 255, 0.7) 1px, transparent 1.6px); background-size: 60px 60px, 37px 37px; animation: wx-snow 5s linear infinite; }
@keyframes wx-rain { to { background-position: -40px 120px; } }
@keyframes wx-sun { to { opacity: 0.65; } }
@keyframes wx-sand { to { background-position: 380px 40px, 280px 30px; } }
@keyframes wx-snow { to { background-position: 30px 600px, -20px 370px; } }
.b-field.tr-electric { box-shadow: inset 0 -90px 80px -40px rgba(250, 220, 60, 0.35); }
.b-field.tr-grassy { box-shadow: inset 0 -90px 80px -40px rgba(80, 200, 90, 0.4); }
.b-field.tr-misty { box-shadow: inset 0 -90px 90px -30px rgba(250, 170, 220, 0.4); }
.b-field.tr-psychic { box-shadow: inset 0 -90px 80px -40px rgba(200, 90, 230, 0.4); }
.b-abpop { position: absolute; z-index: 9; display: flex; flex-direction: column; padding: 6px 16px; min-width: 150px; border-radius: 10px; background: linear-gradient(90deg, #1e293b, #334155); border: 1px solid rgba(255, 255, 255, 0.25); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); pointer-events: none; animation: ab-in-l 0.35s cubic-bezier(0.2, 1.2, 0.4, 1) both; }
.b-abpop small { font-size: 0.7rem; opacity: 0.75; }
.b-abpop b { font-family: var(--font-title); letter-spacing: 0.02em; }
.b-abpop.me { left: 0; bottom: 40%; border-left: 4px solid #60a5fa; border-radius: 0 10px 10px 0; }
.b-abpop.foe { right: 0; top: 34%; border-right: 4px solid #f87171; border-radius: 10px 0 0 10px; text-align: right; animation-name: ab-in-r; }
.b-abpop.out { transition: opacity 0.35s, transform 0.35s; opacity: 0; transform: translateY(-8px); }
@keyframes ab-in-l { from { transform: translateX(-110%); } }
@keyframes ab-in-r { from { transform: translateX(110%); } }
.b-heldpop { position: absolute; z-index: 9; padding: 4px 12px; border-radius: 999px; background: rgba(250, 204, 21, 0.92); color: #1a1405; font-weight: 700; font-size: 0.8rem; pointer-events: none; animation: held-pop 1.5s ease both; }
.b-heldpop.me { left: 8%; bottom: 46%; }
.b-heldpop.foe { right: 10%; top: 44%; }
@keyframes held-pop { 0% { transform: scale(0.4); opacity: 0; } 15% { transform: scale(1.08); opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(-14px); opacity: 0; } }
.b-held { margin-left: 4px; font-size: 0.8em; }
.b-lock { grid-column: 1 / -1; margin: 0; }
.b-aura, .b-stfx { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.b-aura i { position: absolute; bottom: 10%; font-style: normal; font-size: 1.1rem; animation: aura-up 1.1s ease-out both; }
.b-aura.up i { color: #fb923c; text-shadow: 0 0 10px #f97316; }
.b-aura.down i { color: #60a5fa; text-shadow: 0 0 10px #3b82f6; top: 10%; bottom: auto; animation-name: aura-down; }
@keyframes aura-up { from { transform: translateY(0); opacity: 0; } 25% { opacity: 1; } to { transform: translateY(-120px); opacity: 0; } }
@keyframes aura-down { from { transform: translateY(0); opacity: 0; } 25% { opacity: 1; } to { transform: translateY(120px); opacity: 0; } }
.b-stfx i { position: absolute; font-style: normal; font-weight: 900; animation: stfx 1.2s ease-out both; }
.b-stfx.s-psn i { color: #c084fc; font-size: 1.3rem; text-shadow: 0 0 8px #a855f7; }
.b-stfx.s-par i { color: #fde047; text-shadow: 0 0 8px #facc15; }
.b-stfx.s-slp i { color: #e0e7ff; font-size: 1.4rem; }
.b-stfx.s-frz i { color: #a5f3fc; text-shadow: 0 0 10px #22d3ee; }
@keyframes stfx { from { transform: translateY(8px) scale(0.5); opacity: 0; } 30% { opacity: 1; transform: translateY(0) scale(1.1); } to { transform: translateY(-40px) scale(0.9); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .b-field::before { animation: none !important; } }

/* ---------- fiche : talent, IV / EV, objet tenu ---------- */
.mon-ability { margin: 12px 0 4px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); }
.mon-ability > span { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.ab-hidden { color: #fbbf24; }
.mon-pot { float: right; color: #fbbf24; font-size: 0.95rem; letter-spacing: 0.05em; }
.mon-pot small { color: var(--muted); font-size: 0.75rem; letter-spacing: 0; margin-left: 4px; }
.st-row { position: relative; }
.st-row .bar { position: relative; }
.st-row .bar em { position: absolute; left: 0; bottom: 0; height: 3px; border-radius: 2px; background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.st-row small.iv { font-size: 0.68rem; padding: 1px 7px; border-radius: 999px; white-space: nowrap; background: rgba(255, 255, 255, 0.08); color: var(--muted); }
.st-row small.iv-5 { background: rgba(251, 191, 36, 0.2); color: #fcd34d; }
.st-row small.iv-4 { background: rgba(74, 222, 128, 0.16); color: #86efac; }
.st-row small.iv-3 { background: rgba(96, 165, 250, 0.16); color: #93c5fd; }
.mon-stats .st-row { grid-template-columns: 70px 1fr 42px auto !important; }
.mon-held { display: flex; flex-direction: column; gap: 8px; }
.held-cur { padding: 8px 12px; border-radius: 10px; background: rgba(250, 204, 21, 0.08); border: 1px solid rgba(250, 204, 21, 0.3); }
.mon-held > .btn { align-self: flex-start; }
.held-give { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.bag-hold summary { cursor: pointer; font-size: 0.85rem; color: var(--accent, #60a5fa); margin-top: 4px; }
.held-desc { margin-top: 2px; }

/* ---------- services de ville ---------- */
.town-tabs { margin: 6px 0 12px; }
.town-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); }
.pc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pc-grid h4, .town h4 { margin: 6px 0; font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.pc-mon { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); margin-bottom: 6px; }
.pc-mon.shiny { box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.45); }
.pc-mon .sprite { width: 48px; height: 48px; }
.pc-mon > div { flex: 1; min-width: 0; }
.pc-mon b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; max-width: 100%; }
.pc-acts { display: flex; gap: 4px; align-items: center; }
.pc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.shop-top { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 8px; }
.shop-money { font-weight: 800; font-size: 1.1rem; color: #fcd34d; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 10px; }
.shop-item { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); }
.shop-item.locked { opacity: 0.55; }
.shop-buy { display: flex; align-items: center; gap: 6px; margin-top: auto; flex-wrap: wrap; }
.shop-price { font-weight: 700; margin-right: auto; }
.dc-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.dc-slot { padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.dc-slot.empty { align-items: center; justify-content: center; color: var(--muted); border-style: dashed; min-height: 84px; }
.dc-compat { text-align: center; padding: 8px; border-radius: 10px; margin-bottom: 10px; font-weight: 600; }
.dc-compat.c0 { background: rgba(148, 163, 184, 0.12); }
.dc-compat.c1 { background: rgba(96, 165, 250, 0.12); }
.dc-compat.c2 { background: rgba(74, 222, 128, 0.14); }
.dc-compat.c3 { background: rgba(244, 114, 182, 0.18); }
.dc-egg { border-color: rgba(251, 191, 36, 0.5); background: rgba(251, 191, 36, 0.08); margin-bottom: 10px; }
.egg-list { display: flex; flex-direction: column; gap: 6px; }
.egg-row { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; }
.egg-row .bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.egg-row .bar i { display: block; height: 100%; background: linear-gradient(90deg, #fde68a, #f59e0b); }
.egg-ico { font-size: 1.4rem; animation: egg-wobble 2.4s ease-in-out infinite; display: inline-block; }
.egg-slot { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: conic-gradient(#f59e0b var(--p), rgba(255, 255, 255, 0.1) 0); font-size: 1.05rem; isolation: isolate; }
.egg-slot::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--panel-strong, #111827); z-index: 0; }
@keyframes egg-wobble { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-12deg); } 90% { transform: rotate(10deg); } 95% { transform: rotate(-6deg); } }
@media (max-width: 640px) { .pc-grid, .dc-slots { grid-template-columns: 1fr; } }

/* ---------- éclosion ---------- */
.hatch-scene { position: fixed; inset: 0; z-index: 95; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; background: radial-gradient(circle at 50% 45%, #1e1b4b, #05060f 70%); animation: fadeIn 0.4s ease; }
.hatch-scene.out { transition: opacity 0.4s; opacity: 0; }
.hatch-scene p { font-family: var(--font-title); font-size: 1.3rem; text-align: center; padding: 0 20px; }
.hatch-skip { position: absolute; top: 16px; right: 16px; }
.hatch-stage { position: relative; width: 220px; height: 240px; display: flex; align-items: center; justify-content: center; }
.hatch-egg { position: relative; width: 150px; height: 190px; border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%; background: radial-gradient(circle at 35% 30%, #fffdf5, #f5ecd2 55%, #d9c89a); box-shadow: inset -12px -16px 30px rgba(120, 90, 30, 0.25), 0 20px 40px rgba(0, 0, 0, 0.45); }
.hatch-egg::after { content: ""; position: absolute; left: 22%; top: 55%; width: 26px; height: 20px; border-radius: 50%; background: #a3e635; opacity: 0.7; box-shadow: 58px -40px 0 -2px #a3e635, 40px 30px 0 -6px #a3e635; }
.hatch-egg .crack { position: absolute; left: 30%; top: 30%; width: 60px; height: 3px; background: #3b2f14; opacity: 0; transform: rotate(-20deg); clip-path: polygon(0 0, 20% 100%, 40% 0, 60% 100%, 80% 0, 100% 100%, 100% 100%, 0 100%); }
.hatch-egg .c2 { left: 44%; top: 44%; transform: rotate(25deg); }
.hatch-egg .c3 { left: 20%; top: 58%; width: 90px; transform: rotate(-5deg); }
.hatch-scene.s1 .hatch-egg { animation: egg-shake 0.6s ease-in-out 2; }
.hatch-scene.s1 .c1, .hatch-scene.s2 .c2, .hatch-scene.s3 .c3 { opacity: 1; }
.hatch-scene.s2 .hatch-egg { animation: egg-shake 0.35s ease-in-out 3; }
.hatch-scene.s3 .hatch-egg { animation: egg-shake 0.18s ease-in-out infinite; filter: brightness(1.2); }
.hatch-mon { position: absolute; width: 200px; height: 200px; object-fit: contain; opacity: 0; transform: scale(0.3); }
.hatch-scene.born .hatch-egg { animation: egg-burst 0.5s ease-out forwards; }
.hatch-scene.born .hatch-mon { opacity: 1; transform: scale(1); transition: transform 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) 0.2s, opacity 0.3s 0.2s; }
.hatch-scene.born::before { content: ""; position: absolute; inset: 0; background: #fff; animation: b-flash 0.9s ease-out forwards; pointer-events: none; }
.hatch-scene.shiny .hatch-mon { filter: drop-shadow(0 0 18px #fde047); }
@keyframes egg-shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }
@keyframes egg-burst { to { transform: scale(1.6); opacity: 0; filter: brightness(3); } }
.egg-row .bar { width: auto; }

/* ---------- Pokédex vivant : Pokémon de la zone ---------- */
.pc-mons.zone div { display: flex; flex-wrap: wrap; gap: 4px; }
.zm { position: relative; display: inline-flex; width: 44px; height: 44px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); align-items: center; justify-content: center; }
.zm img { width: 44px; height: 44px; image-rendering: pixelated; }
.zm.unseen img { filter: brightness(0) invert(0.25); opacity: 0.55; }
.zm.caught { background: rgba(239, 68, 68, 0.12); }
.zm i { position: absolute; right: 1px; bottom: -2px; font-style: normal; font-size: 0.7rem; color: #f87171; }

/* ---------- médailles de vie ---------- */
.medal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.medal { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; border-radius: 14px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.04); color: inherit; font: inherit; text-align: center; cursor: default; }
.medal.got { cursor: pointer; }
.medal .md-ico { font-size: 1.9rem; width: 54px; height: 54px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255, 255, 255, 0.06); }
.medal small { color: var(--muted); font-size: 0.72rem; line-height: 1.25; }
.medal em { font-size: 0.68rem; color: var(--muted); font-style: normal; }
.medal.locked { opacity: 0.45; filter: grayscale(1); }
.medal.bronze .md-ico, .sc-slot.bronze span { background: radial-gradient(circle at 35% 30%, #fcd9b6, #b87333); box-shadow: 0 0 0 2px #8a5523; }
.medal.silver .md-ico, .sc-slot.silver span { background: radial-gradient(circle at 35% 30%, #ffffff, #9ca3af); box-shadow: 0 0 0 2px #6b7280; }
.medal.gold .md-ico, .sc-slot.gold span { background: radial-gradient(circle at 35% 30%, #fff7c2, #eab308); box-shadow: 0 0 0 2px #a16207, 0 0 16px rgba(234, 179, 8, 0.5); }
.medal.star { border-color: #fbbf24; box-shadow: 0 0 0 1px #fbbf24 inset; }
.showcase { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0; }
.showcase.small { gap: 6px; margin: 0; }
.sc-slot { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 14px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)); border: 1px solid var(--border); text-align: center; font-size: 0.8rem; }
.sc-slot span { font-size: 1.6rem; width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.sc-slot.empty { color: var(--muted); justify-content: center; border-style: dashed; min-height: 90px; font-size: 1.4rem; }
.showcase.small .sc-slot span { width: 38px; height: 38px; font-size: 1.2rem; }
.sheet-medals { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.sheet-medals .btn { align-self: flex-start; }
.medal-pop { position: fixed; left: 50%; top: 18px; z-index: 120; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 10px 20px 10px 12px; border-radius: 999px; background: linear-gradient(90deg, #1f2937, #111827); border: 1px solid rgba(255, 255, 255, 0.2); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: medal-in 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.medal-pop .mp-ico { font-size: 1.6rem; width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.medal-pop.bronze .mp-ico { background: radial-gradient(circle at 35% 30%, #fcd9b6, #b87333); }
.medal-pop.silver .mp-ico { background: radial-gradient(circle at 35% 30%, #fff, #9ca3af); }
.medal-pop.gold .mp-ico { background: radial-gradient(circle at 35% 30%, #fff7c2, #eab308); box-shadow: 0 0 20px rgba(234, 179, 8, 0.6); }
.medal-pop small { display: block; font-size: 0.7rem; color: #fcd34d; text-transform: uppercase; letter-spacing: 0.08em; }
.medal-pop.out { transition: opacity 0.4s, transform 0.4s; opacity: 0; transform: translate(-50%, -20px); }
@keyframes medal-in { from { transform: translate(-50%, -60px) scale(0.8); opacity: 0; } }

/* ---------- compagnon ---------- */
.companion { position: fixed; left: 14px; bottom: 16px; z-index: 30; width: 96px; height: 96px; padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.companion img { width: 96px; height: 96px; image-rendering: pixelated; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.45)); animation: cp-idle 2.6s ease-in-out infinite; transform-origin: 50% 100%; }
.companion::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: 8px; height: 10px; border-radius: 50%; background: rgba(0, 0, 0, 0.35); z-index: -1; }
.companion.shiny img { filter: drop-shadow(0 0 8px rgba(253, 224, 71, 0.8)); }
.companion.arrive img { animation: cp-arrive 0.7s ease, cp-idle 2.6s ease-in-out 0.7s infinite; }
.companion.petted img { animation: cp-happy 0.6s ease 2; }
.cp-bubble { position: absolute; right: -4px; top: -2px; min-width: 30px; height: 30px; padding: 0 4px; border-radius: 15px 15px 15px 4px; background: #fff; color: #111; display: flex; align-items: center; justify-content: center; font-size: 1rem; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); animation: cp-bubble 5s ease-in-out infinite; }
.cp-heart { position: absolute; bottom: 50%; font-style: normal; color: #f472b6; font-size: 1.2rem; pointer-events: none; animation: cp-heart 1.3s ease-out both; }
@keyframes cp-idle { 0%, 100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(-4px) scaleY(1.02); } }
@keyframes cp-arrive { from { transform: translateX(-120px); opacity: 0; } }
@keyframes cp-happy { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-18px) rotate(-6deg); } 70% { transform: translateY(0) rotate(4deg); } }
@keyframes cp-bubble { 0%, 70%, 100% { transform: scale(1); } 80% { transform: scale(1.15); } }
@keyframes cp-heart { from { transform: translateY(0) scale(0.6); opacity: 0; } 20% { opacity: 1; } to { transform: translateY(-70px) scale(1.2); opacity: 0; } }
body.in-battle .companion, body.map-open .companion { display: none; }
@media (max-width: 1100px) { .companion { width: 64px; height: 64px; left: 8px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); } .companion img { width: 64px; height: 64px; } .cp-bubble { min-width: 24px; height: 24px; font-size: 0.8rem; } }
@media (prefers-reduced-motion: reduce) { .companion img, .cp-bubble { animation: none !important; } }
.place-card .pc-mons.zone .zm img { opacity: 1; width: 44px; height: 44px; }
.place-card .pc-mons.zone .zm.unseen img { opacity: 0.5; }

/* ---------- album photo ---------- */
.photo-flash { position: fixed; inset: 0; z-index: 130; background: #fff; pointer-events: none; animation: b-flash 0.7s ease-out forwards; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 10px; }
.album-card { display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.04); color: inherit; font: inherit; text-align: left; cursor: pointer; transition: transform 0.2s; }
.album-card:hover { transform: rotate(-1deg) translateY(-2px); }
.album-card small { color: var(--muted); }
.ph-thumb { aspect-ratio: 1 / 0.7; border-radius: 6px; overflow: hidden; background: rgba(255, 255, 255, 0.06); }
.ph-thumb canvas, .photo-big canvas { width: 100%; height: auto; display: block; }
.photo-big { border-radius: 8px; overflow: hidden; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); min-height: 200px; display: flex; align-items: center; justify-content: center; transform: rotate(-0.6deg); }
.album-view input { width: 100%; margin-top: 14px; }

/* ---------- précédemment ---------- */
.prev-strip { display: grid; gap: 10px; margin: 12px 0; }
.prev-card { display: grid; grid-template-columns: 160px 1fr; gap: 12px; align-items: center; padding: 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); animation: prev-in 0.5s ease both; }
.prev-card canvas { width: 160px; height: 90px; border-radius: 8px; display: block; }
.prev-card small { color: var(--muted); }
.prev-card p { margin: 4px 0 0; font-size: 0.92rem; }
.prev-team { display: flex; gap: 4px; justify-content: center; margin: 4px 0 8px; }
.prev-team img { width: 56px; height: 56px; image-rendering: pixelated; animation: cp-idle 2.6s ease-in-out infinite; }
.prev-team img:nth-child(2n) { animation-delay: 0.4s; }
@keyframes prev-in { from { opacity: 0; transform: translateX(-20px); } }
@media (max-width: 520px) { .prev-card { grid-template-columns: 110px 1fr; } .prev-card canvas { width: 110px; height: 62px; } }

/* ---------- transfert ---------- */
#tr-out, #tr-in { width: 100%; font-family: ui-monospace, monospace; font-size: 0.72rem; word-break: break-all; }

/* ---------- logo ---------- */
.logo { font-weight: 800; letter-spacing: 0.02em; }
.logo span { background: linear-gradient(180deg, #ffd166, #ff8a5b 60%, #ef2f45); -webkit-background-clip: text; background-clip: text; color: transparent; }
.map-tip.faded { opacity: 0 !important; visibility: hidden; transition: opacity 0.6s, visibility 0s 0.6s; }

@media (max-width: 700px) { .map-full .map-shell.sheet-open .map-zoom { opacity: 0; pointer-events: none; transition: opacity 0.2s; } }
.pc-travel { margin: 8px 0 10px; }
.pc-travel .btn { width: 100%; }

/* ---------- effets d'attaque (images Pokémon Showdown) ---------- */
.fx-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 5; }
.fx-s { position: absolute; display: block; pointer-events: none; will-change: transform, opacity; }
.fx-tint { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.fx-bg { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.b-field > .b-side { z-index: 2; }

/* ---------- animations d'attaques (packs Essentials) ---------- */
.ma-layer, .ma-fg, .ma-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
/* pas de z-index sur le calque des effets : les mélanges (additif, soustractif) agissent sur le décor et les Pokémon */
.ma-fg { z-index: 6; }
.ma-bg { z-index: 1; }
.ma-cell { position: absolute; left: 0; top: 0; width: 192px; height: 192px; background-repeat: no-repeat; transform-origin: 96px 96px; display: none; }
.ma-plane { position: absolute; inset: 0; background-size: cover; background-repeat: no-repeat; opacity: 0; }
.ma-flash { position: absolute; inset: 0; pointer-events: none; }

/* logo de l'accueil (image) */
.logo-img { margin: 0 auto 4px; width: min(420px, 86vw); line-height: 0; animation: float 6s ease-in-out infinite; }
.logo-img img { width: 100%; height: auto; filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.55)); }
@media (max-height: 700px) { .logo-img { width: min(300px, 70vw); } }

/* carte plein écran : aucun geste du navigateur (actualiser, zoom de page, rebond) sur la carte et son en-tête */
.modal-box.map-full, .map-full .map-head, .map-full .map-frame { touch-action: none; overscroll-behavior: none; }
.map-full .map-sheet { touch-action: pan-y; }
.map-full .map-head .chip-btn, .map-full .map-zoom .icon-btn { touch-action: manipulation; }
.companion { display: flex; align-items: flex-end; justify-content: center; }
.companion img { flex: none; object-fit: contain; }

/* ---------- Pokémon de la scène ---------- */
.scene-mons { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; margin: 0 0 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.scene-mons::-webkit-scrollbar { display: none; }
.sm-chip { flex: none; position: relative; display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.06); color: inherit; font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; animation: sm-in 0.45s cubic-bezier(0.2, 1.3, 0.4, 1) both; transition: transform 0.15s, background 0.15s; }
.sm-chip:hover { background: rgba(255, 255, 255, 0.12); transform: translateY(-2px); }
.sm-chip img { width: 44px; height: 44px; object-fit: contain; image-rendering: pixelated; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, 0.14), transparent 70%); }
.sm-chip.shiny { border-color: rgba(251, 191, 36, 0.6); box-shadow: 0 0 12px rgba(251, 191, 36, 0.25); }
.sm-b { font-style: normal; font-size: 0.62rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em; }
.sm-b.new { background: #f59e0b; color: #1a1205; }
.sm-b.mine { background: rgba(96, 165, 250, 0.25); color: #bfdbfe; }
.sm-b.caught { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.sm-b.wild { background: rgba(74, 222, 128, 0.18); color: #bbf7d0; }
.sm-b.owner { background: rgba(192, 132, 252, 0.2); color: #e9d5ff; text-transform: none; }
@keyframes sm-in { from { opacity: 0; transform: translateY(8px) scale(0.9); } }
.mon-mention { display: inline-flex; align-items: center; gap: 2px; padding: 0 5px 0 0; margin: 0 1px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: inherit; font: inherit; font-weight: 700; cursor: pointer; vertical-align: baseline; line-height: 1.2; text-decoration: underline dotted rgba(255, 255, 255, 0.4); text-underline-offset: 3px; }
.mon-mention img { width: 1.6em; height: 1.6em; margin: -0.35em 0 -0.35em -0.1em; image-rendering: pixelated; }
.mon-mention:hover { background: rgba(255, 255, 255, 0.16); }
.sm-card { position: relative; text-align: center; }
.sm-art { width: min(220px, 60vw); height: auto; display: block; margin: 0 auto; filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.5)); }
.sm-card.shiny .sm-art { filter: drop-shadow(0 0 18px rgba(253, 224, 71, 0.6)); }
.sm-anim { position: absolute; top: 0; right: 0; }
.sm-anim img { width: 72px; height: 72px; object-fit: contain; image-rendering: pixelated; }
.sm-card .b-types { justify-content: center; }
@media (max-width: 700px) { .scene-mons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; gap: 6px; } .sm-chip { min-width: 0; } .sm-chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; text-align: left; } .sm-chip img { width: 32px; height: 32px; } .sm-chip { font-size: 0.78rem; gap: 4px; padding: 2px 8px 2px 2px; } .sm-b { font-size: 0.56rem; padding: 1px 5px; } }
/* téléphone : le compagnon est dans le bandeau du récit au lieu de flotter par-dessus les choix */
@media (max-width: 1100px) { .companion { display: none !important; } }
.sm-chip.pet { border-color: rgba(244, 114, 182, 0.45); background: rgba(244, 114, 182, 0.1); overflow: visible; }
.sm-b.pet { background: #fff; color: #111; font-size: 0.8rem; padding: 0 4px; text-transform: none; }
.sm-chip.petted img { animation: cp-happy 0.6s ease 2; }
.sm-chip .cp-heart { bottom: 40%; font-size: 1rem; animation: cp-heart-s 1s ease-out both; }
@keyframes cp-heart-s { from { transform: translateY(0) scale(0.6); opacity: 0; } 20% { opacity: 1; } to { transform: translateY(-26px) scale(1.1); opacity: 0; } }
/* carte : l'image du décor sous le calque interactif (lieux, noms, marqueur) */
.map-frame svg.live { position: relative; z-index: 1; }
.map-frame .map-raster { z-index: 0; }
.map-frame .map-raster.sharp { will-change: auto; }

/* ---------- coup fatal : arrêt sur image, flash, ralenti zoomé ---------- */
.b-field { transform-origin: var(--kx, 50%) var(--ky, 50%); }
.b-field.ko-stop { filter: contrast(1.35) brightness(1.15); }
.b-field.ko-stop .b-mon img { animation-play-state: paused !important; }
.b-field.ko-slow { scale: 1.1; transition: transform 0.05s linear, scale 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
.b-field.ko-final { scale: 1.2; }
.b-field.ko-slow .b-mon img:not(.ko-target) { filter: brightness(0.5) saturate(0.5); transition: filter 0.3s; }
.b-field.ko-slow .b-info, .b-field.ko-slow .b-wx { opacity: 0.35; transition: opacity 0.3s; }
.b-mon img.ko-target { filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 22px rgba(255, 255, 255, 0.7)); }
.b-field .ko-flash {
  position: absolute; inset: -20%; z-index: 7; pointer-events: none;
  background: radial-gradient(circle at var(--kx) var(--ky), #fff 0, rgba(255, 255, 255, 0.9) 12%, rgba(255, 255, 255, 0.35) 35%, rgba(255, 255, 255, 0) 65%);
  animation: ko-flash 0.6s ease-out forwards;
}
@keyframes ko-flash { 0% { opacity: 1; } 100% { opacity: 0; } }
.b-field .ko-lines {
  position: absolute; inset: -30%; z-index: 6; pointer-events: none; mix-blend-mode: screen;
  background: repeating-conic-gradient(from 0deg at var(--kx) var(--ky), rgba(255, 255, 255, 0.55) 0deg 1.2deg, transparent 1.2deg 9deg);
  -webkit-mask-image: radial-gradient(circle at var(--kx) var(--ky), transparent 0 22%, #000 55%);
  mask-image: radial-gradient(circle at var(--kx) var(--ky), transparent 0 22%, #000 55%);
  animation: ko-lines 1.4s ease-out forwards;
}
@keyframes ko-lines { 0% { opacity: 0; rotate: 0deg; } 15% { opacity: 1; } 100% { opacity: 0; rotate: 4deg; } }
#battle { overflow: hidden; }

/* ---------- réglages : musiques ---------- */
.music-set { display: grid; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); }
.music-set .row select { flex: 1; min-width: 0; }
.music-lib { margin-top: 6px; }
.music-lib .ml-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.music-lib ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.music-lib li { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 8px; background: rgba(0, 0, 0, 0.2); }
.music-lib li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-lib li small { opacity: 0.6; }
#s-btest.on { background: var(--accent, #f5c542); color: #111; }

/* ---------- apparence du personnage ---------- */
.avatar-img { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.look-row { display: flex; gap: 14px; align-items: center; }
.look-prev { width: 84px; height: 126px; flex: none; border-radius: 16px; overflow: hidden; background: linear-gradient(160deg, #3a3f6e, #252846); border: 1px solid rgba(255, 255, 255, 0.12); }
.look-prev.trainer, .av-preview.trainer, .hud-avatar.trainer { background: radial-gradient(circle at 50% 70%, #eef3ff 0, #b9c6e8 60%, #8d9ccc 100%); }
.look-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.look-actions .hint { flex: 1 1 100%; margin: 0; }
.hud-avatar { width: 48px; height: 48px; flex: none; padding: 0; border-radius: 12px; overflow: hidden; cursor: pointer; background: linear-gradient(160deg, #3a3f6e, #252846); border: 1px solid rgba(255, 255, 255, 0.18); color: var(--muted, #aaa); font-size: 1.3rem; }
.hud-avatar:hover { border-color: var(--accent); }
#hud { align-items: center; }
.save-ico .avatar-img { width: 44px; height: 44px; border-radius: 10px; background: linear-gradient(160deg, #3a3f6e, #252846); }
.save-ico .avatar-img.is-trainer { background: radial-gradient(circle at 50% 70%, #eef3ff 0, #b9c6e8 60%, #8d9ccc 100%); }

.av-tbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.av-search { flex: 1 1 160px; max-width: 240px; }
.av-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; max-height: 48vh; overflow: auto; padding: 2px; }
.av-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 12px; cursor: pointer; background: radial-gradient(circle at 50% 60%, #eef3ff 0, #c3cdea 70%); border: 2px solid transparent; color: #1d2240; }
.av-tile img { width: 80px; height: 80px; image-rendering: pixelated; }
.av-tile span { font-size: 0.72rem; font-weight: 600; line-height: 1.1; text-align: center; }
.av-tile.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

@media (max-width: 720px) {
  .hud-avatar { align-self: flex-start; }
  .hud-avatar + .hud-id { flex: 1 1 calc(100% - 52px); }
}

/* ---------- créateur d'avatar ---------- */
.modal-box.look-modal { width: min(980px, 100%); }
.avc { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 18px; min-height: 0; }
.avc-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.avc-preview {
  position: relative; width: 100%; aspect-ratio: 2 / 3; border-radius: 20px; overflow: hidden;
  background:
    radial-gradient(ellipse 46% 7% at 50% 86%, rgba(20, 40, 20, 0.35), transparent 70%),
    radial-gradient(ellipse 70% 16% at 50% 88%, #7cc56a 0 60%, #5aa04c 61% 100%, transparent 101%),
    linear-gradient(180deg, #9fd3ff 0%, #cdeaff 55%, #e8f6ff 70%, #bfe3a8 70.5%, #98cf7e 100%);
  border: 1px solid rgba(255, 255, 255, 0.16); box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35), inset 0 0 0 3px rgba(255, 255, 255, 0.08);
}
.avc-preview::before { content: ""; position: absolute; left: 8%; top: 9%; width: 30%; height: 7%; border-radius: 40px; background: rgba(255, 255, 255, 0.8); box-shadow: 70px 28px 0 -6px rgba(255, 255, 255, 0.65); }
.avc-big { position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%); width: 92%; image-rendering: pixelated; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.12)); animation: avc-idle 2.4s steps(2) infinite; }
.avc-big.face { bottom: auto; top: 50%; transform: translate(-50%, -50%); width: 86%; animation: none; border-radius: 16px; }
@keyframes avc-idle { 50% { translate: 0 -1.5%; } }
.avc-preview.trainer { background: radial-gradient(circle at 50% 68%, #eef3ff 0, #b9c6e8 60%, #8d9ccc 100%); }
.avc-trainer { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 78%; image-rendering: pixelated; }
.avc-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; }
.avc-tools .icon-btn:disabled { opacity: 0.35; cursor: default; }
.avc-panel { min-width: 0; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.avc-cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.avc-cat { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; padding: 6px 8px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04); color: inherit; cursor: pointer; font: inherit; }
.avc-cat i { font-style: normal; font-size: 1.25rem; line-height: 1; }
.avc-cat span { font-size: 0.7rem; white-space: nowrap; opacity: 0.85; }
.avc-cat.on { background: color-mix(in srgb, var(--accent) 30%, transparent); border-color: var(--accent); }
.avc-body { max-height: 56vh; overflow-y: auto; padding-right: 4px; display: flex; flex-direction: column; gap: 12px; }
.avc-sec h4 { margin: 0 0 6px; font-size: 0.85rem; opacity: 0.85; font-weight: 600; }
.avc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.avc-grid.wide { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.avc-tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; padding: 4px 3px 5px; border-radius: 12px; cursor: pointer; background: linear-gradient(180deg, #e9f2ff, #c9d9f2); border: 2px solid transparent; color: #1d2240; min-height: 76px; font: inherit; }
.avc-tile img { width: 100%; image-rendering: pixelated; display: block; }
.avc-tile img.crop-full { width: 70%; }
.avc-tile span { font-size: 0.68rem; font-weight: 600; line-height: 1.1; text-align: center; }
.avc-tile.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.avc-tile:hover { filter: brightness(1.06); }
.avc-none b { font-size: 1.6rem; opacity: 0.5; margin: auto 0; }
.avc-field { display: flex; flex-direction: column; gap: 6px; }
.avc-lbl { font-size: 0.85rem; opacity: 0.85; font-weight: 600; }
.avc-sw { display: flex; flex-wrap: wrap; gap: 6px; }
.avc-sw .sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); background: var(--c); padding: 0; cursor: pointer; }
.avc-sw .sw.on { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.avc-sw .sw-pick { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.avc-sw .sw-pick input { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); opacity: 0; cursor: pointer; border: 0; padding: 0; }
.avc-toggles { display: flex; gap: 14px; flex-wrap: wrap; }
.look-prev .avatar-img.is-full { object-fit: contain; }
.look-prev:not(.trainer) { background: linear-gradient(180deg, #9fd3ff 0%, #d6efff 62%, #98cf7e 62.5%, #7cc56a 100%); }
@media (max-width: 760px) {
  .avc { grid-template-columns: 1fr; gap: 10px; }
  .avc-stage { flex-direction: row; align-items: stretch; }
  .avc-preview { width: 42%; max-width: 170px; flex: none; }
  .avc-tools { flex-direction: column; justify-content: center; }
  .avc-body { max-height: 40vh; }
  .avc-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
  .avc-grid.wide { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
  .avc-tile { min-height: 64px; }
  .avc-cat { min-width: 56px; padding: 5px 6px; }
}

/* ---------- carte de dresseur (fiche) ---------- */
.tcard { display: flex; gap: 16px; align-items: stretch; padding: 12px; margin-bottom: 10px; border-radius: 18px; background: linear-gradient(135deg, rgba(229, 57, 53, 0.22), rgba(59, 111, 209, 0.18)); border: 1px solid rgba(255, 255, 255, 0.14); }
.tcard-av { position: relative; flex: none; width: 128px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tcard-av .avatar-img { width: 128px; height: 192px; object-fit: contain; border-radius: 14px; background: linear-gradient(180deg, #9fd3ff 0%, #d6efff 64%, #98cf7e 64.5%, #7cc56a 100%); }
.tcard.trainer .tcard-av .avatar-img { background: radial-gradient(circle at 50% 68%, #eef3ff 0, #b9c6e8 60%, #8d9ccc 100%); }
.tcard-empty { width: 128px; height: 160px; display: grid; place-items: center; font-size: 3rem; border-radius: 14px; background: rgba(255, 255, 255, 0.06); }
.tcard-info { min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.tcard-info h2 { margin: 0; }
.tcard-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.tcard-nums span { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); font-size: 0.8rem; opacity: 0.95; }
.tcard-nums b { font-size: 1.15rem; }
@media (max-width: 520px) {
  .tcard-av, .tcard-av .avatar-img { width: 96px; }
  .tcard-av .avatar-img { height: 144px; }
  .tcard-nums { grid-template-columns: 1fr 1fr; }
}

/* ---------- combat : le dresseur envoie son Pokémon, écran VS ---------- */
.b-trainer { position: absolute; left: 4%; bottom: 14%; height: 46%; z-index: 3; image-rendering: pixelated; pointer-events: none; animation: b-tr-in 0.55s cubic-bezier(0.2, 0.8, 0.2, 1); filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.25)); }
.b-trainer.throw { animation: b-tr-out 0.6s ease-in forwards; }
@keyframes b-tr-in { from { translate: -120% 0; } }
@keyframes b-tr-out { 25% { rotate: -6deg; translate: 6% 0; } 100% { translate: -140% 0; opacity: 0; } }
.b-vs { position: absolute; inset: 0; z-index: 60; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; background: linear-gradient(115deg, #1b3a8a 0 48%, #fff 48% 49%, #a51d2a 49% 100%); animation: b-vs-in 0.35s ease-out; cursor: pointer; overflow: hidden; }
.b-vs.out { animation: b-vs-out 0.35s ease-in forwards; }
.vs-side { display: flex; flex-direction: column; align-items: center; gap: 8px; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
.vs-side img { height: min(46vh, 300px); image-rendering: pixelated; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.3)); }
.vs-l img { animation: vs-l 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.vs-r img { animation: vs-r 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.vs-foe { filter: brightness(0) drop-shadow(0 0 12px rgba(255, 255, 255, 0.55)) !important; height: min(34vh, 220px) !important; }
.vs-side b { font-family: var(--font-title); font-size: clamp(1rem, 3vw, 1.6rem); letter-spacing: 0.05em; }
.vs-mid { font-family: var(--font-title); font-weight: 900; font-size: clamp(3rem, 12vw, 7rem); color: #ffd84a; -webkit-text-stroke: 3px #3a1a00; text-shadow: 0 6px 0 #3a1a00; animation: vs-pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes b-vs-in { from { opacity: 0; } }
@keyframes b-vs-out { to { opacity: 0; transform: scale(1.08); } }
@keyframes vs-l { from { translate: -60vw 0; } }
@keyframes vs-r { from { translate: 60vw 0; } }
@keyframes vs-pop { from { scale: 3; opacity: 0; } }
.tcard-av .btn { width: 100%; white-space: normal; line-height: 1.15; font-size: 0.78rem; padding: 6px 6px; }

/* ---------- créateur « Noir & Blanc » (façon PokeMMO) ---------- */
.mmo { display: grid; gap: 6px; }
.mmo-row { display: grid; grid-template-columns: minmax(96px, 150px) 1fr 38px; gap: 6px; align-items: center; }
.mmo-lbl, .mmo-sel {
  height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 3px;
  font-weight: 700; font-size: 0.92rem; color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(0, 0, 0, 0.55); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.mmo-lbl { background: linear-gradient(180deg, #4d6878, #3a5262); }
.mmo-sel {
  width: 100%; padding: 0 28px 0 10px; background: linear-gradient(180deg, #4a4f57, #33373e) !important;
  -webkit-appearance: none; appearance: none; cursor: pointer; text-align: center; text-align-last: center; font-family: inherit;
  background-image: linear-gradient(45deg, transparent 50%, #fff 50%), linear-gradient(135deg, #fff 50%, transparent 50%), linear-gradient(180deg, #4a4f57, #33373e) !important;
  background-position: calc(100% - 15px) 16px, calc(100% - 11px) 16px, 0 0 !important; background-size: 4px 4px, 4px 4px, 100% 100% !important; background-repeat: no-repeat !important;
}
.mmo-sel option { background: #33373e; color: #fff; }
.mmo-colbtn { gap: 8px; background: linear-gradient(180deg, #4a4f57, #33373e) !important; padding: 0 10px; }
.mmo-colbtn i { width: 16px; height: 16px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, 0.6); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3); }
.mmo-wheel {
  position: relative; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; overflow: hidden;
  background: radial-gradient(circle, #fff 0 18%, transparent 60%), conic-gradient(#ff4d4d, #ffd24d, #7dff4d, #4dffd2, #4d8aff, #b44dff, #ff4dc4, #ff4d4d);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), inset 0 0 6px rgba(0, 0, 0, 0.25);
}
.mmo-wheel input { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); opacity: 0; cursor: pointer; border: 0; padding: 0; }
.avc-preview.bw { background: linear-gradient(160deg, #b9c0c8 0%, #9aa4ae 45%, #c4cad0 100%); }
.avc-preview.bw::before { display: none; }
.avc-big.bw { height: 74% !important; bottom: 16% !important; animation: none; filter: none; }
.mmo-arrow {
  position: absolute; bottom: 3%; width: 44px; height: 34px; border: 0; cursor: pointer; background: transparent; padding: 0;
  image-rendering: pixelated;
}
.mmo-arrow::before {
  content: ""; position: absolute; inset: 0; background: #fff;
  clip-path: polygon(0 50%, 40% 0, 40% 28%, 100% 28%, 100% 72%, 40% 72%, 40% 100%);
  filter: drop-shadow(2px 2px 0 #1b1b1b);
}
.mmo-arrow.l { left: 6%; }
.mmo-arrow.r { right: 6%; transform: scaleX(-1); }
.mmo-arrow:hover::before { background: #ffe27a; }
.avatar-img.is-bw { image-rendering: pixelated; object-fit: contain; }
.hud-avatar .avatar-img.is-bw, .look-prev .avatar-img.is-bw { background: linear-gradient(160deg, #c4cad0, #9aa4ae); }
.tcard-av .avatar-img.is-bw { background: linear-gradient(160deg, #c4cad0, #9aa4ae); }
@media (max-width: 760px) {
  .mmo-row { grid-template-columns: 96px 1fr 36px; }
  .mmo-lbl, .mmo-sel { height: 34px; font-size: 0.82rem; }
}

/* ---------- créateur PokeMMO (rendu par apis.fiereu.de) ---------- */
.avc-big.mmo { height: 82% !important; bottom: 9% !important; animation: none; filter: none; }
.avc-down { position: absolute; inset: 30% 10% auto; text-align: center; color: #1d2240; font-weight: 600; }
.mmo-dyebtn { border: 0; padding: 0; }
.mmo-var { width: 34px; height: 34px; border-radius: 6px; border: 1px solid rgba(0, 0, 0, 0.5); background: #f4c542; color: #1d2240; font-weight: 800; cursor: pointer; }
.mmo-dyes { padding: 10px; border-radius: 8px; background: #2b2f36; border: 1px solid rgba(0, 0, 0, 0.5); }
.mmo-dyes b { display: block; margin-bottom: 8px; font-size: 0.85rem; }
.mmo-dyegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); gap: 5px; }
.mmo-dye { aspect-ratio: 1; border-radius: 4px; border: 2px solid rgba(0, 0, 0, 0.55); cursor: pointer; padding: 0; }
.mmo-dye:hover { outline: 2px solid #fff; }
.mmo-dye.none { background: #444a52; color: #fff; }
.mmo optgroup { background: #2b2f36; color: #aeb6c2; }
.avatar-img.is-mmo { image-rendering: pixelated; object-fit: contain; background: linear-gradient(160deg, #c4cad0, #9aa4ae); }
.avatar-img.is-mmo.is-face { object-fit: cover; object-position: 50% 0; transform: scale(2.1); transform-origin: 50% 14%; }
.hud-avatar, .save-ico, .look-prev { overflow: hidden; }
.save-ico .avatar-img { overflow: hidden; }

/* ---------- scène vivante ---------- */
.stage { position: sticky; top: 0; z-index: 6; height: 270px; margin: 4px -8px 14px; border-radius: 16px; overflow: hidden; background: #1b2238; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.35); isolation: isolate; }
.stage .st-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage .st-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.35) 100%); pointer-events: none; }
.stage[data-time="night"] .st-layer { filter: brightness(0.78) saturate(0.85); }
.stage[data-time="dusk"] .st-layer { filter: brightness(0.92) sepia(0.12); }
.stage .st-layer { position: absolute; inset: 0; }
.st-actor { position: absolute; bottom: calc(8% + var(--depth, 0) * -3%); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; cursor: pointer; transition: left 0.6s cubic-bezier(0.3, 0.8, 0.3, 1); }
.st-actor .st-body { position: relative; animation: st-breathe 3.2s ease-in-out infinite; transform-origin: 50% 100%; }
.st-actor.kind-mon .st-body { animation: st-hop 2.6s ease-in-out infinite; }
.st-actor img { display: block; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.25)); }
.st-actor img.flip { transform: scaleX(-1); }
.st-actor img { width: auto; transition: height 0.3s; }
.st-actor.kind-trainer img { height: 190px; }
.st-actor.kind-npc img { height: 180px; }
.st-actor.kind-mon img { height: 72px; }
.st-actor.no-img .st-body { width: 40px; height: 90px; border-radius: 20px 20px 6px 6px; background: rgba(20, 20, 30, 0.7); }
.st-actor .st-shadow { width: 70%; height: 10px; margin-top: -6px; border-radius: 50%; background: radial-gradient(rgba(0, 0, 0, 0.45), transparent 70%); }
.st-actor .st-name { position: absolute; bottom: -2px; left: 50%; transform: translate(-50%, 100%); font-size: 0.68rem; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000; white-space: nowrap; opacity: 0; transition: opacity 0.2s; }
.st-actor:hover .st-name, .st-actor.talking .st-name { opacity: 1; }
.st-actor.shiny img { filter: drop-shadow(0 0 6px #fff6a8) drop-shadow(0 2px 0 rgba(0, 0, 0, 0.25)); }
.st-actor.enter.side-L { animation: st-in-l 0.8s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
.st-actor.enter.side-R { animation: st-in-r 0.8s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
.st-actor.leave.side-L { animation: st-out-l 0.6s ease-in forwards; }
.st-actor.leave.side-R { animation: st-out-r 0.6s ease-in forwards; }
@keyframes st-in-l { from { translate: -60vw 0; } }
@keyframes st-in-r { from { translate: 60vw 0; } }
@keyframes st-out-l { to { translate: -60vw 0; opacity: 0; } }
@keyframes st-out-r { to { translate: 60vw 0; opacity: 0; } }
@keyframes st-breathe { 50% { scale: 1 1.015; } }
@keyframes st-hop { 0%, 70%, 100% { translate: 0 0; } 80% { translate: 0 -6px; } 90% { translate: 0 0; } }
/* parole : petit mouvement de tête */
.st-actor.talking .st-body { animation: st-talk 0.34s ease-in-out infinite alternate; }
@keyframes st-talk { to { translate: 0 -3px; } }
.st-actor.notice .st-body { animation: st-notice 0.6s ease-out; }
@keyframes st-notice { 30% { translate: 0 -8px; } }
/* émotions */
.st-emote { position: absolute; top: -6px; left: 50%; z-index: 3; min-width: 30px; height: 30px; padding: 0 6px; transform: translate(-50%, -100%) scale(0); display: grid; place-items: center; font-size: 1.05rem; font-weight: 900; color: #222; background: #fff; border: 2px solid #222; border-radius: 12px; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); }
.st-emote::after { content: ""; position: absolute; bottom: -7px; left: 50%; width: 10px; height: 10px; background: #fff; border-right: 2px solid #222; border-bottom: 2px solid #222; transform: translateX(-50%) rotate(45deg); }
.st-emote.pop { animation: st-pop 1.9s cubic-bezier(0.3, 1.6, 0.5, 1) forwards; }
@keyframes st-pop { 0% { transform: translate(-50%, -100%) scale(0); } 12% { transform: translate(-50%, -100%) scale(1.15); } 20%, 85% { transform: translate(-50%, -100%) scale(1); } 100% { transform: translate(-50%, -100%) scale(0); } }
.st-happy .st-body { animation: st-jump 0.5s ease-out 2 !important; }
.st-surprised .st-body { animation: st-jump 0.35s ease-out 1 !important; }
.st-angry .st-body { animation: st-shake 0.12s linear 6 !important; }
.st-scared .st-body { animation: st-shake 0.08s linear 12 !important; }
.st-sad .st-body { translate: 0 4px; filter: saturate(0.6) brightness(0.85); transition: 0.4s; }
.st-sleepy .st-body { animation: st-sway 1.6s ease-in-out 2 !important; }
.st-thinking .st-body { animation: st-tilt 0.9s ease-in-out 2 alternate !important; }
.st-determined .st-body { animation: st-lean 0.8s ease-out 1 !important; }
.st-hurt .st-body, .st-hit .st-body { animation: st-flash 0.12s linear 5 !important; }
@keyframes st-jump { 40% { translate: 0 -18px; } }
@keyframes st-shake { 25% { translate: -3px 0; } 75% { translate: 3px 0; } }
@keyframes st-sway { 50% { rotate: 4deg; } }
@keyframes st-tilt { to { rotate: -4deg; } }
@keyframes st-lean { 50% { translate: 0 -6px; scale: 1.05; } }
@keyframes st-flash { 50% { opacity: 0.25; filter: brightness(2) saturate(0); } }
/* attaques racontées */
.st-lunge-r .st-body { animation: st-lunge-r 0.45s ease-out !important; }
.st-lunge-l .st-body { animation: st-lunge-l 0.45s ease-out !important; }
@keyframes st-lunge-r { 40% { translate: 26px -6px; } }
@keyframes st-lunge-l { 40% { translate: -26px -6px; } }


/* bulle de dialogue */
.st-bubble {
  position: absolute; top: 10px; z-index: 40; max-width: min(300px, 60%); padding: 8px 12px; border-radius: 14px;
  background: #fff; color: #1d2240; border: 2px solid #1d2240; font: 600 0.86rem/1.3 var(--font-body, system-ui); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
  opacity: 0; transform: translateY(6px) scale(0.96); transition: opacity 0.18s, transform 0.18s;
}
.st-bubble.show { opacity: 1; transform: none; }
.st-bubble .st-bt { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.st-bubble::after { content: ""; position: absolute; bottom: -9px; left: var(--tail, 30px); width: 14px; height: 14px; background: #fff; border-right: 2px solid #1d2240; border-bottom: 2px solid #1d2240; transform: rotate(45deg); }
.stage.reduce .st-actor .st-body { animation: none !important; }
.stage.reduce .st-actor { transition: none; }
@media (max-width: 720px) {
  .stage { height: clamp(170px, 30vh, 250px); margin: 2px -10px 12px; border-radius: 12px; }
  .st-bubble { font-size: 0.8rem; max-width: 74%; padding: 6px 10px; }
  .st-emote { min-width: 26px; height: 26px; font-size: 0.95rem; }
}

/* ---------- teint (créateur) ---------- */
.av-tones { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 36px; }
.av-tone { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); cursor: pointer; padding: 0; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15); transition: transform 0.12s; }
.av-tone:hover { transform: scale(1.08); }
.av-tone.on { border-color: #ffd34d; box-shadow: 0 0 0 2px rgba(255, 211, 77, 0.45), inset 0 -3px 0 rgba(0, 0, 0, 0.15); transform: scale(1.1); }

/* ---------- combat : lancer de Poké Ball ---------- */
.b-ball { position: absolute; left: 0; top: 0; width: 22px; height: 22px; z-index: 8; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, #fff 0 17%, #222 18% 27%, transparent 28%), linear-gradient(180deg, #e3262e 0 44%, #222 44% 56%, #f4f4f4 56% 100%);
  border: 2px solid #222; box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.18), 0 3px 4px rgba(0, 0, 0, 0.35); }
.b-ball.open { animation: b-ball-open 0.3s ease-out forwards; }
@keyframes b-ball-open { 30% { scale: 1.3; filter: brightness(2.5); } 100% { scale: 0.2; opacity: 0; } }
.b-pop { position: absolute; z-index: 7; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, #fff 0 35%, rgba(255, 255, 255, 0.7) 50%, rgba(160, 220, 255, 0) 72%); animation: b-pop 0.55s ease-out forwards; }
.b-pop::before, .b-pop::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.9); animation: b-ring 0.55s ease-out forwards; }
.b-pop::after { animation-delay: 0.08s; border-color: rgba(170, 225, 255, 0.8); }
@keyframes b-pop { 0% { scale: 0.4; opacity: 1; } 45% { scale: 7; opacity: 0.95; } 100% { scale: 9; opacity: 0; } }
@keyframes b-ring { from { scale: 1; opacity: 0.9; } to { scale: 1.5; opacity: 0; } }
.b-mon img.b-appear { animation: b-appear 0.48s cubic-bezier(0.2, 0.9, 0.3, 1.2); transform-origin: 50% 85%; }
@keyframes b-appear { 0% { scale: 0.08; filter: brightness(0) invert(1) drop-shadow(0 0 10px #fff); } 55% { scale: 1.08; filter: brightness(0) invert(1) drop-shadow(0 0 8px #fff); } 75% { filter: brightness(1.8); } 100% { scale: 1; filter: none; } }
.b-foe-trainer { position: absolute; right: 7%; top: 3%; height: 44%; z-index: 3; image-rendering: pixelated; pointer-events: none; animation: b-ftr-in 0.55s cubic-bezier(0.2, 0.8, 0.2, 1); filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.25)); }
.b-foe-trainer.throw { animation: b-ftr-out 0.7s ease-in 0.15s forwards; }
@keyframes b-ftr-in { from { translate: 120% 0; } }
@keyframes b-ftr-out { 20% { rotate: 6deg; translate: -6% 0; } 100% { translate: 150% 0; opacity: 0; } }
.vs-foe-tr { filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.3)); }
@media (max-width: 600px) {
  .b-foe-trainer { height: 30%; right: 4%; top: 6%; }
  .b-trainer { height: 36%; }
  .vs-side img { height: min(28vh, 38vw); }
  .b-vs { grid-template-columns: 1fr auto 1fr; gap: 4px; }
}

/* ---------- audit : combat et notifications ---------- */
/* pendant un combat, rien de l'interface du jeu ne doit transparaître */
body.in-battle #topbar, body.in-battle #toasts, body.in-battle .medal-pop { visibility: hidden; }
/* ordinateur : les notifications en bas à droite, loin de la scène et du récit */
@media (min-width: 721px) {
  #toasts { top: auto; bottom: 20px; right: 16px; flex-direction: column-reverse; }
}
/* téléphone en portrait : Pokémon plus grands, adversaire un peu plus bas (sous l'encoche), infos compactes */
@media (max-width: 600px) and (orientation: portrait) {
  .b-foe { top: calc(env(safe-area-inset-top, 0px) + 9%); right: 2%; gap: 4px; }
  .b-me { bottom: 3%; left: 1%; gap: 4px; }
  .b-mon img { width: 44vw; }
  .b-me .b-mon img { width: 52vw; }
  .b-info { min-width: 0; width: 42vw; padding: 6px 8px; font-size: 0.85rem; }
  .b-info .b-types span { font-size: 0.6rem; }
  .b-log { font-size: 1rem; min-height: 64px; padding: 10px 12px; }
  .b-btn { padding: 10px; }
}
/* téléphone couché : tout doit tenir en hauteur */
@media (max-height: 500px) and (orientation: landscape) {
  .b-bottom { grid-template-columns: 1fr minmax(240px, 360px); padding: 6px 8px; }
  .b-log { min-height: 0; font-size: 0.95rem; padding: 8px 10px; }
  .b-btn { padding: 6px 8px; }
  .b-mon img { width: clamp(90px, 16vw, 150px); }
  .b-me .b-mon img { width: clamp(100px, 19vw, 170px); }
  .b-info { min-width: 150px; padding: 4px 8px; font-size: 0.8rem; }
  .b-trainer, .b-foe-trainer { height: 60%; }
}

/* ---------- scène : météo ---------- */
.stage .st-wx { position: absolute; inset: 0; z-index: 30; pointer-events: none; opacity: 0; transition: opacity 0.8s; }
.stage[data-weather="rain"] .st-wx, .stage[data-weather="storm"] .st-wx { opacity: 1; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cline x1='10' y1='5' x2='7' y2='19' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='34' y1='60' x2='31' y2='74' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='58' y1='20' x2='55' y2='34' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='80' y1='95' x2='77' y2='109' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='104' y1='40' x2='101' y2='54' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='126' y1='110' x2='123' y2='124' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='20' y1='100' x2='17' y2='114' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='70' y1='130' x2='67' y2='144' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='115' y1='0' x2='112' y2='14' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='46' y1='85' x2='43' y2='99' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='92' y1='62' x2='89' y2='76' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='132' y1='50' x2='129' y2='64' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cline x1='10' y1='5' x2='7' y2='19' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='34' y1='60' x2='31' y2='74' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='58' y1='20' x2='55' y2='34' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='80' y1='95' x2='77' y2='109' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='104' y1='40' x2='101' y2='54' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='126' y1='110' x2='123' y2='124' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='20' y1='100' x2='17' y2='114' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='70' y1='130' x2='67' y2='144' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='115' y1='0' x2='112' y2='14' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='46' y1='85' x2='43' y2='99' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='92' y1='62' x2='89' y2='76' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3Cline x1='132' y1='50' x2='129' y2='64' stroke='rgba(200,220,255,0.55)' stroke-width='1.2'/%3E%3C/svg%3E"); background-size: 140px 140px, 190px 190px; animation: st-rain 0.55s linear infinite; }
.stage[data-weather="storm"] .st-wx { animation-duration: 0.38s; filter: brightness(1.1); }
.stage[data-weather="storm"]::after { content: ""; position: absolute; inset: 0; z-index: 31; pointer-events: none; background: #fff; opacity: 0; animation: st-bolt 7s infinite; }
.stage[data-weather="snow"] .st-wx { opacity: 1; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Ccircle cx='10' cy='10' r='1.6' fill='rgba(255,255,255,0.85)'/%3E%3Ccircle cx='50' cy='30' r='2.2' fill='rgba(255,255,255,0.85)'/%3E%3Ccircle cx='90' cy='15' r='1.4' fill='rgba(255,255,255,0.85)'/%3E%3Ccircle cx='30' cy='70' r='1.8' fill='rgba(255,255,255,0.85)'/%3E%3Ccircle cx='75' cy='60' r='2.4' fill='rgba(255,255,255,0.85)'/%3E%3Ccircle cx='110' cy='90' r='1.5' fill='rgba(255,255,255,0.85)'/%3E%3Ccircle cx='15' cy='105' r='2' fill='rgba(255,255,255,0.85)'/%3E%3Ccircle cx='60' cy='100' r='1.3' fill='rgba(255,255,255,0.85)'/%3E%3Ccircle cx='100' cy='45' r='1.7' fill='rgba(255,255,255,0.85)'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Ccircle cx='10' cy='10' r='1.6' fill='rgba(255,255,255,0.85)'/%3E%3Ccircle cx='50' cy='30' r='2.2' fill='rgba(255,255,255,0.85)'/%3E%3Ccircle cx='90' cy='15' r='1.4' fill='rgba(255,255,255,0.85)'/%3E%3Ccircle cx='30' cy='70' r='1.8' fill='rgba(255,255,255,0.85)'/%3E%3Ccircle cx='75' cy='60' r='2.4' fill='rgba(255,255,255,0.85)'/%3E%3Ccircle cx='110' cy='90' r='1.5' fill='rgba(255,255,255,0.85)'/%3E%3Ccircle cx='15' cy='105' r='2' fill='rgba(255,255,255,0.85)'/%3E%3Ccircle cx='60' cy='100' r='1.3' fill='rgba(255,255,255,0.85)'/%3E%3Ccircle cx='100' cy='45' r='1.7' fill='rgba(255,255,255,0.85)'/%3E%3C/svg%3E"); background-size: 120px 120px, 170px 170px; animation: st-snow 7s linear infinite; }
.stage[data-weather="fog"] .st-wx { opacity: 1; background: linear-gradient(180deg, rgba(210, 215, 225, 0.05), rgba(210, 215, 225, 0.35) 60%, rgba(210, 215, 225, 0.5)); }
.stage[data-weather="cloudy"] .st-shade { background: linear-gradient(180deg, rgba(40, 45, 60, 0.25), rgba(0, 0, 0, 0.35)); }
.stage[data-weather="rain"] .st-layer, .stage[data-weather="storm"] .st-layer { filter: brightness(0.85) saturate(0.85); }
@keyframes st-rain { to { background-position: -12px 140px, -18px 190px; } }
@keyframes st-snow { to { background-position: 30px 120px, -40px 170px; } }
@keyframes st-bolt { 0%, 91%, 93.5%, 100% { opacity: 0; } 92% { opacity: 0.55; } 94% { opacity: 0.3; } }
.stage.reduce .st-wx, .stage.reduce::after { animation: none !important; }
/* tablette en portrait : le terrain est haut, les Pokémon doivent le remplir */
@media (min-width: 601px) and (max-width: 1100px) and (orientation: portrait) {
  .b-foe { top: 10%; right: 4%; }
  .b-me { bottom: 4%; left: 3%; }
  .b-mon img { width: min(38vw, 360px); }
  .b-me .b-mon img { width: min(46vw, 420px); }
  .b-trainer { height: 40%; }
  .b-foe-trainer { height: 36%; }
}
/* pastilles de teint : toujours sur une seule ligne */
.av-tones { flex-wrap: nowrap; gap: 6px; }
.av-tone { width: 30px; height: 30px; flex: none; }
@media (max-width: 400px) { .av-tones { gap: 4px; } .av-tone { width: 25px; height: 25px; } }

/* petits écrans : les libellés de la barre du bas tiennent en entier */
@media (max-width: 380px) { .dock button span { font-size: 0.58rem; letter-spacing: -0.01em; } .dock button { padding-left: 0; padding-right: 0; } }
/* téléphone couché (peu de hauteur) : la scène ne reste pas collée en haut, sinon elle cache tout le texte */
@media (max-height: 560px) and (orientation: landscape) {
  .stage { position: relative; height: clamp(150px, 44vh, 200px); }
}
.b-btn.mon small { white-space: nowrap; text-align: right; line-height: 1.25; }

/* ---------- audit 2 : fiche Pokémon, notifications et fenêtres ---------- */
/* fiche Pokémon : la ligne Cri / Te suit / Surnom passe à la ligne au lieu de sortir de l'écran */
.mon-head .row { flex-wrap: wrap; min-width: 0; }
.mon-head > div { min-width: 0; }
#mon-nick { flex: 1 1 120px; min-width: 0; width: auto; }
/* une fenêtre est ouverte : les notifications montent en haut pour ne pas cacher ses boutons */
/* une fenêtre s'ouvre alors qu'une notification est déjà là : elle s'efface vite */
body:has(#modal:not([hidden])) #toasts { opacity: 0; transition: opacity 0.3s; }

/* ---------- interface simplifiée ---------- */
/* paramètres : sections repliables */
.set-group { border: 1px solid var(--border); border-radius: 12px; background: rgba(255, 255, 255, 0.03); }
.set-group > summary { cursor: pointer; list-style: none; padding: 12px 14px; font-weight: 700; display: flex; flex-direction: column; gap: 2px; }
.set-group > summary::-webkit-details-marker { display: none; }
.set-group > summary::after { content: "▾"; position: absolute; right: 14px; opacity: 0.6; }
.set-group { position: relative; }
.set-group[open] > summary::after { content: "▴"; }
.set-group > summary small { font-weight: 400; color: var(--muted); font-size: 0.8rem; }
.set-group .set-body { display: flex; flex-direction: column; gap: 12px; padding: 4px 14px 14px; }
/* ✨ Actions : liste expliquée */
.act-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.act-item { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.05); color: inherit; cursor: pointer; font: inherit; }
.act-item:hover, .act-item:focus-visible { background: rgba(255, 255, 255, 0.1); border-color: var(--accent); }
.act-item .act-ic { font-size: 1.6rem; width: 40px; text-align: center; flex: none; }
.act-item b { display: block; }
.act-item small { display: block; color: var(--muted); font-size: 0.84rem; line-height: 1.35; margin-top: 2px; }
.actions-btn { font-weight: 700; border-color: color-mix(in srgb, var(--accent) 60%, transparent) !important; }
/* zone d'écriture repliée tant qu'on n'a pas touché « Une autre idée ? » */
.write-box.closed .write-tools { display: none; }
@media (hover: none) { .write-tools .hint { display: none; } }
/* en-tête sur ordinateur : un libellé sous chaque icône */
.hud-actions .icon-btn .hb-l { display: none; }
@media (min-width: 1101px) {
  .hud-actions .icon-btn { width: auto; min-width: 52px; height: auto; padding: 5px 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1.1; }
  .hud-actions .icon-btn .hb-l { display: block; font-size: 0.66rem; font-weight: 600; opacity: 0.85; letter-spacing: 0.01em; }
}
/* visite guidée */
.tour { position: fixed; inset: 0; z-index: 200; }
.tour-hole { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(4, 6, 18, 0.72); outline: 3px solid #ffd34d; transition: all 0.3s ease; pointer-events: none; }
.tour-bubble { position: fixed; z-index: 201; padding: 14px 16px 12px; border-radius: 14px; background: #fff; color: #1d2240; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5); font-size: 0.95rem; line-height: 1.45; opacity: 0; transform: translateY(6px); transition: opacity 0.25s, transform 0.25s, top 0.3s, left 0.3s; }
.tour-bubble.in { opacity: 1; transform: none; }
.tour-count { font-size: 0.72rem; font-weight: 700; color: #7a82a8; letter-spacing: 0.05em; }
.tour-text { margin: 4px 0 10px; }
.tour-btns { display: flex; justify-content: flex-end; gap: 8px; }
.tour-bubble .btn.ghost { color: #4a5280; border-color: #c9cfe0; }
/* écran de la clé : guide pas à pas */
.kg-what { padding: 12px 14px; border-radius: 12px; background: rgba(240, 182, 74, 0.1); border: 1px solid rgba(240, 182, 74, 0.35); line-height: 1.5; margin-bottom: 12px; }
.kg-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: none; }
.kg-step { padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); }
.kg-head { display: flex; align-items: center; gap: 10px; font-size: 1.02rem; }
.kg-n { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #1d2240; font-weight: 800; }
.kg-step p { margin: 8px 0; line-height: 1.5; }
.kg-step .get-key { margin: 6px 0 4px; }
.kg-fig { display: block; width: 100%; max-width: 360px; height: auto; margin: 8px auto 0; border-radius: 10px; }
.kg-fig .kg-pulse { animation: kg-pulse 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes kg-pulse { 50% { opacity: 0.35; } }
.kg-paste .row { gap: 6px; }
.kg-paste #setup-key { flex: 1; min-width: 0; }
.kg-note { font-size: 0.78rem; color: var(--muted); text-align: center; margin: 8px 0; }
.kg-faq, .other-ai { margin-top: 10px; }
.kg-faq > summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.kg-faq p { margin: 8px 0; line-height: 1.5; }
#setup-next.ready { animation: kg-ready 1.2s ease-in-out 3; }
@keyframes kg-ready { 50% { box-shadow: 0 0 0 6px rgba(240, 182, 74, 0.45); } }
@media (prefers-reduced-motion: reduce) { .kg-fig .kg-pulse, #setup-next.ready { animation: none; } }
@media (max-width: 520px) {
  .kg-paste .row { flex-wrap: wrap; }
  .kg-paste #setup-key { flex: 1 1 100%; font-size: 16px; }
  .kg-paste #setup-paste { flex: 1; }
}

/* ---------- hors connexion ---------- */
.offline-pill { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 50%; transform: translateX(-50%); z-index: 70; padding: 5px 12px; border-radius: 99px; background: #3a2a14; color: #ffd98a; border: 1px solid #8a6a2a; font-size: 0.8rem; font-weight: 700; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); pointer-events: none; }

/* ---------- match amical ---------- */
#fm-out, #fm-in { width: 100%; font: 0.78rem/1.35 ui-monospace, Menlo, monospace; word-break: break-all; }
.fm-card { display: flex; gap: 14px; align-items: center; padding: 12px; margin: 10px 0; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); }
.fm-av { width: 84px; height: 110px; flex: none; border-radius: 12px; overflow: hidden; background: linear-gradient(180deg, #9fd3ff 0%, #d6efff 64%, #98cf7e 64.5%); }
.fm-team { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.fm-team span { display: flex; flex-direction: column; align-items: center; font-size: 0.7rem; color: var(--muted); }
.fm-team img, .fm-team .sprite-fallback { width: 48px; height: 48px; }
.fm-history { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }

/* ---------- carte des relations ---------- */
.rel-map { position: relative; width: min(100%, 560px); aspect-ratio: 1; margin: 6px auto 0; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, 0.07) 0 30%, rgba(255, 255, 255, 0.02) 31% 58%, transparent 59%); }
.rel-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.rel-map line { stroke-linecap: round; opacity: 0.85; }
.rl-love { stroke: #ff7eb6; } .rl-friend { stroke: #5fd39c; } .rl-neutral { stroke: #9aa3c4; } .rl-wary { stroke: #f3b35b; } .rl-enemy { stroke: #ff6b5f; }
.rel-me { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 2px; z-index: 2; }
.rel-me-pic { width: 66px; height: 66px; border-radius: 50%; overflow: hidden; border: 3px solid var(--accent); background: linear-gradient(160deg, #3a3f6e, #252846); display: block; }
.rel-me-pic .avatar-img { width: 100% !important; height: 100% !important; object-fit: cover; object-position: 50% 10%; }
.rel-me b { font-size: 0.78rem; }
.rel-node { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 1px; background: none; border: 0; color: inherit; cursor: pointer; padding: 2px; width: 80px; z-index: 3; font: inherit; }
.rel-pic { width: 48px; height: 48px; border-radius: 50%; overflow: hidden; border: 3px solid var(--c, #9aa3c4); background: radial-gradient(circle at 50% 70%, #eef3ff 0, #b9c6e8 70%); display: block; }
.rel-pic img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; transform: scale(1.3); transform-origin: 50% 32%; image-rendering: pixelated; }
.rel-name { font-size: 0.72rem; font-weight: 700; line-height: 1.15; text-align: center; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-node small { font-size: 0.62rem; color: var(--muted); max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-node:hover .rel-pic, .rel-node:focus-visible .rel-pic { transform: scale(1.08); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25); }
.rn-love { --c: #ff7eb6; } .rn-friend { --c: #5fd39c; } .rn-neutral { --c: #9aa3c4; } .rn-wary { --c: #f3b35b; } .rn-enemy { --c: #ff6b5f; }
.rel-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; margin-top: 10px; font-size: 0.8rem; color: var(--muted); }
.rel-leg { display: inline-flex; align-items: center; gap: 5px; }
.rel-leg i { width: 14px; height: 4px; border-radius: 2px; background: var(--c, #9aa3c4); }
@media (max-width: 480px) { .rel-node { width: 64px; } .rel-pic { width: 38px; height: 38px; border-width: 2px; } .rel-name { font-size: 0.64rem; } .rel-node small { display: none; } .rel-me-pic { width: 52px; height: 52px; } }

/* ---------- événements du calendrier : décor qui tombe sur la scène ---------- */
.stage .st-ev { position: absolute; inset: 0; z-index: 29; pointer-events: none; opacity: 0; transition: opacity 1s; }
body[data-event="harvest"] .stage .st-ev { opacity: 1; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cellipse cx='55' cy='30' rx='4.5' ry='2.2' transform='rotate(234 55 30)' fill='%23e0782f' opacity='.9'/%3E%3Cellipse cx='61' cy='16' rx='4.3' ry='2.2' transform='rotate(183 61 16)' fill='%23b5652a' opacity='.9'/%3E%3Cellipse cx='68' cy='43' rx='4.4' ry='2.2' transform='rotate(198 68 43)' fill='%23e0782f' opacity='.9'/%3E%3Cellipse cx='144' cy='99' rx='4.4' ry='2.2' transform='rotate(210 144 99)' fill='%23b5652a' opacity='.9'/%3E%3Cellipse cx='15' cy='40' rx='4.7' ry='2.3' transform='rotate(200 15 40)' fill='%23b5652a' opacity='.9'/%3E%3Cellipse cx='29' cy='25' rx='7.1' ry='3.6' transform='rotate(111 29 25)' fill='%23c9502a' opacity='.9'/%3E%3Cellipse cx='23' cy='90' rx='4.6' ry='2.3' transform='rotate(68 23 90)' fill='%23e0782f' opacity='.9'/%3E%3Cellipse cx='89' cy='97' rx='6.1' ry='3.1' transform='rotate(179 89 97)' fill='%23e8a33b' opacity='.9'/%3E%3Cellipse cx='75' cy='141' rx='5.1' ry='2.5' transform='rotate(130 75 141)' fill='%23c9502a' opacity='.9'/%3E%3C/svg%3E"); animation: ev-harvest 9s linear infinite; }
@keyframes ev-harvest { to { background-position: -30px 160px; } }
body[data-event="spring"] .stage .st-ev { opacity: 1; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cellipse cx='102' cy='41' rx='5.1' ry='2.6' transform='rotate(207 102 41)' fill='%23ffd9e6' opacity='.9'/%3E%3Cellipse cx='106' cy='47' rx='3.9' ry='2.0' transform='rotate(353 106 47)' fill='%23ffd9e6' opacity='.9'/%3E%3Cellipse cx='30' cy='54' rx='4.8' ry='2.5' transform='rotate(336 30 54)' fill='%23f7a8c6' opacity='.9'/%3E%3Cellipse cx='18' cy='83' rx='6.0' ry='3.1' transform='rotate(284 18 83)' fill='%23ffd9e6' opacity='.9'/%3E%3Cellipse cx='101' cy='88' rx='4.9' ry='2.5' transform='rotate(209 101 88)' fill='%23ffc3d8' opacity='.9'/%3E%3Cellipse cx='135' cy='72' rx='3.7' ry='1.9' transform='rotate(239 135 72)' fill='%23f7a8c6' opacity='.9'/%3E%3Cellipse cx='49' cy='85' rx='4.8' ry='2.5' transform='rotate(245 49 85)' fill='%23f7a8c6' opacity='.9'/%3E%3Cellipse cx='60' cy='98' rx='4.9' ry='2.5' transform='rotate(8 60 98)' fill='%23ffc3d8' opacity='.9'/%3E%3Cellipse cx='90' cy='74' rx='4.4' ry='2.3' transform='rotate(79 90 74)' fill='%23f7a8c6' opacity='.9'/%3E%3Cellipse cx='41' cy='60' rx='3.7' ry='1.9' transform='rotate(314 41 60)' fill='%23ffd9e6' opacity='.9'/%3E%3C/svg%3E"); animation: ev-spring 10s linear infinite; }
@keyframes ev-spring { to { background-position: 40px 150px; } }
body[data-event="valentine"] .stage .st-ev { opacity: 1; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='170'%3E%3Cpath d='M70 54.6 l-4.8 -4.8 a2.7 2.7 0 0 1 4.8 -3.4 a2.7 2.7 0 0 1 4.8 3.4 z' fill='%23e8467a' opacity='.85'/%3E%3Cpath d='M51 76.9 l-6.2 -6.2 a3.4 3.4 0 0 1 6.2 -4.4 a3.4 3.4 0 0 1 6.2 4.4 z' fill='%23ff6b8f' opacity='.85'/%3E%3Cpath d='M31 38.5 l-4.2 -4.2 a2.4 2.4 0 0 1 4.2 -3.0 a2.4 2.4 0 0 1 4.2 3.0 z' fill='%23ff9ab6' opacity='.85'/%3E%3Cpath d='M136 39.2 l-3.9 -3.9 a2.2 2.2 0 0 1 3.9 -2.8 a2.2 2.2 0 0 1 3.9 2.8 z' fill='%23e8467a' opacity='.85'/%3E%3Cpath d='M65 99.7 l-5.6 -5.6 a3.1 3.1 0 0 1 5.6 -4.0 a3.1 3.1 0 0 1 5.6 4.0 z' fill='%23e8467a' opacity='.85'/%3E%3Cpath d='M154 112.8 l-4.9 -4.9 a2.7 2.7 0 0 1 4.9 -3.5 a2.7 2.7 0 0 1 4.9 3.5 z' fill='%23e8467a' opacity='.85'/%3E%3C/svg%3E"); animation: ev-valentine 12s linear infinite; }
@keyframes ev-valentine { to { background-position: -20px 170px; } }
body[data-event="halloween"] .stage .st-ev { opacity: 1; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='180'%3E%3Cg transform='translate(171 72) scale(0.76)'%3E%3Cellipse rx='7' ry='5.5' fill='%23f08a24'/%3E%3Cellipse rx='3' ry='5.5' fill='%23d9701a'/%3E%3Crect x='-1' y='-8' width='2' height='3' fill='%234d7a2a'/%3E%3C/g%3E%3Cg transform='translate(137 18) scale(0.83)'%3E%3Cellipse rx='7' ry='5.5' fill='%23f08a24'/%3E%3Cellipse rx='3' ry='5.5' fill='%23d9701a'/%3E%3Crect x='-1' y='-8' width='2' height='3' fill='%234d7a2a'/%3E%3C/g%3E%3Cg transform='translate(41 64) scale(0.70)'%3E%3Cellipse rx='7' ry='5.5' fill='%23f08a24'/%3E%3Cellipse rx='3' ry='5.5' fill='%23d9701a'/%3E%3Crect x='-1' y='-8' width='2' height='3' fill='%234d7a2a'/%3E%3C/g%3E%3Cpath transform='translate(39 25) scale(0.72)' d='M0 0 q-4 -4 -9 -2 q3 1 3 4 q2 -2 6 -2 q4 0 6 2 q0 -3 3 -4 q-5 -2 -9 2z' fill='%231a1426' opacity='.8'/%3E%3Cpath transform='translate(186 109) scale(0.85)' d='M0 0 q-4 -4 -9 -2 q3 1 3 4 q2 -2 6 -2 q4 0 6 2 q0 -3 3 -4 q-5 -2 -9 2z' fill='%231a1426' opacity='.8'/%3E%3Cpath transform='translate(79 68) scale(1.21)' d='M0 0 q-4 -4 -9 -2 q3 1 3 4 q2 -2 6 -2 q4 0 6 2 q0 -3 3 -4 q-5 -2 -9 2z' fill='%231a1426' opacity='.8'/%3E%3C/svg%3E"); animation: ev-halloween 16s linear infinite; }
@keyframes ev-halloween { to { background-position: -60px 30px; } }
body[data-event="winter"] .stage .st-ev { opacity: 1; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Ccircle cx='111' cy='56' r='1.4' fill='%23fff' opacity='.9'/%3E%3Ccircle cx='19' cy='44' r='2.2' fill='%23fff' opacity='.9'/%3E%3Ccircle cx='25' cy='10' r='1.8' fill='%23fff' opacity='.9'/%3E%3Ccircle cx='23' cy='64' r='1.8' fill='%23fff' opacity='.9'/%3E%3Ccircle cx='110' cy='98' r='1.5' fill='%23fff' opacity='.9'/%3E%3Ccircle cx='46' cy='25' r='1.8' fill='%23fff' opacity='.9'/%3E%3Ccircle cx='89' cy='42' r='2.1' fill='%23fff' opacity='.9'/%3E%3Ccircle cx='110' cy='97' r='2.1' fill='%23fff' opacity='.9'/%3E%3Ccircle cx='85' cy='32' r='1.6' fill='%23fff' opacity='.9'/%3E%3Ccircle cx='11' cy='11' r='1.5' fill='%23fff' opacity='.9'/%3E%3C/svg%3E"); animation: ev-winter 8s linear infinite; }
@keyframes ev-winter { to { background-position: 30px 120px; } }
body[data-event="newyear"] .stage .st-ev { opacity: 1; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='160'%3E%3Cline x1='163' y1='146' x2='174.5' y2='145.7' stroke='%236be0ff' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='163' y1='146' x2='171.2' y2='153.8' stroke='%236be0ff' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='163' y1='146' x2='163.1' y2='157.1' stroke='%236be0ff' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='163' y1='146' x2='155.1' y2='153.8' stroke='%236be0ff' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='163' y1='146' x2='151.8' y2='145.7' stroke='%236be0ff' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='163' y1='146' x2='155.1' y2='137.7' stroke='%236be0ff' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='163' y1='146' x2='163.1' y2='134.4' stroke='%236be0ff' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='163' y1='146' x2='171.2' y2='137.7' stroke='%236be0ff' stroke-width='1.3' stroke-linecap='round'/%3E%3Ccircle cx='163' cy='146' r='1.6' fill='%23fff'/%3E%3Cline x1='222' y1='61' x2='229.4' y2='60.5' stroke='%23ff6b8f' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='222' y1='61' x2='227.2' y2='65.8' stroke='%23ff6b8f' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='222' y1='61' x2='221.9' y2='68.0' stroke='%23ff6b8f' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='222' y1='61' x2='216.6' y2='65.8' stroke='%23ff6b8f' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='222' y1='61' x2='214.4' y2='60.5' stroke='%23ff6b8f' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='222' y1='61' x2='216.6' y2='55.2' stroke='%23ff6b8f' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='222' y1='61' x2='221.9' y2='53.0' stroke='%23ff6b8f' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='222' y1='61' x2='227.2' y2='55.2' stroke='%23ff6b8f' stroke-width='1.3' stroke-linecap='round'/%3E%3Ccircle cx='222' cy='61' r='1.6' fill='%23fff'/%3E%3Cline x1='84' y1='78' x2='93.2' y2='77.5' stroke='%23ffd54a' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='84' y1='78' x2='90.4' y2='84.3' stroke='%23ffd54a' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='84' y1='78' x2='83.7' y2='87.1' stroke='%23ffd54a' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='84' y1='78' x2='76.9' y2='84.3' stroke='%23ffd54a' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='84' y1='78' x2='74.1' y2='77.5' stroke='%23ffd54a' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='84' y1='78' x2='76.9' y2='70.7' stroke='%23ffd54a' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='84' y1='78' x2='83.7' y2='67.9' stroke='%23ffd54a' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='84' y1='78' x2='90.4' y2='70.7' stroke='%23ffd54a' stroke-width='1.3' stroke-linecap='round'/%3E%3Ccircle cx='84' cy='78' r='1.6' fill='%23fff'/%3E%3Cline x1='115' y1='102' x2='122.2' y2='102.0' stroke='%23ffd54a' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='115' y1='102' x2='120.2' y2='106.8' stroke='%23ffd54a' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='115' y1='102' x2='115.4' y2='108.8' stroke='%23ffd54a' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='115' y1='102' x2='110.6' y2='106.8' stroke='%23ffd54a' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='115' y1='102' x2='108.6' y2='102.0' stroke='%23ffd54a' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='115' y1='102' x2='110.6' y2='97.3' stroke='%23ffd54a' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='115' y1='102' x2='115.4' y2='95.3' stroke='%23ffd54a' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='115' y1='102' x2='120.2' y2='97.3' stroke='%23ffd54a' stroke-width='1.3' stroke-linecap='round'/%3E%3Ccircle cx='115' cy='102' r='1.6' fill='%23fff'/%3E%3C/svg%3E"); animation: ev-newyear 3s linear infinite; }
@keyframes ev-newyear { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }
body[data-event="summer"] .stage .st-ev { opacity: 1; background: radial-gradient(circle at 88% 8%, rgba(255, 226, 140, 0.45), transparent 38%), linear-gradient(180deg, rgba(255, 200, 120, 0.1), transparent 60%); }
body[data-event="halloween"] .stage .st-shade { background: linear-gradient(180deg, rgba(60, 20, 90, 0.25), rgba(40, 10, 20, 0.45)); }
body.real-night .stage .st-shade { background: linear-gradient(180deg, rgba(10, 14, 40, 0.3), rgba(0, 0, 0, 0.45)); }
.stage.reduce .st-ev { animation: none !important; }
.event-banner { display: flex; flex-direction: column; gap: 2px; align-items: center; text-align: center; padding: 10px 14px; margin-bottom: 4px; border-radius: 14px; background: linear-gradient(135deg, rgba(255, 180, 80, 0.2), rgba(255, 110, 150, 0.16)); border: 1px solid rgba(255, 200, 120, 0.45); }
.event-banner b { font-size: 1.02rem; }
.event-banner span { font-size: 0.86rem; opacity: 0.92; }
.event-banner small { font-size: 0.74rem; opacity: 0.7; }

/* ---------- courrier ---------- */
.hud-mail { position: relative; flex: none; align-self: flex-start; width: 40px; height: 40px; margin-left: -4px; border-radius: 12px; border: 1px solid rgba(255, 210, 120, 0.5); background: rgba(40, 30, 10, 0.55); font-size: 1.25rem; cursor: pointer; display: grid; place-items: center; }
.hud-mail:hover { border-color: var(--accent); }
.hud-mail .mail-n { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e5484d; color: #fff; font-size: 0.7rem; font-weight: 800; display: grid; place-items: center; line-height: 1; }
.hud-mail.bump { animation: mail-bump 0.6s cubic-bezier(0.3, 1.6, 0.5, 1) 3; }
@keyframes mail-bump { 40% { transform: translateY(-5px) rotate(-8deg); } }
.mail-list { display: flex; flex-direction: column; gap: 8px; }
.mail-item { position: relative; display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.04); color: inherit; font: inherit; cursor: pointer; }
.mail-item.unread { background: rgba(255, 210, 120, 0.1); border-color: rgba(255, 210, 120, 0.4); }
.mail-item b { display: block; } .mail-item small { display: block; color: var(--muted); } .mail-item em { display: block; font-size: 0.72rem; color: var(--muted); font-style: normal; }
.mail-dot { position: absolute; right: 12px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: #e5484d; }
.mail-pic { width: 44px; height: 44px; flex: none; border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 50% 70%, #eef3ff 0, #b9c6e8 70%); display: block; }
.mail-pic img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; transform: scale(1.3); transform-origin: 50% 32%; image-rendering: pixelated; }
.mail-pic.big { width: 56px; height: 56px; }
.letter-paper { margin-top: 8px; padding: 20px 22px 18px; border-radius: 6px; color: #3a2c1c; background: linear-gradient(180deg, #fbf3df, #f3e6c6); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), inset 0 0 40px rgba(160, 120, 60, 0.18); font-family: var(--font-story, Georgia, serif); line-height: 1.6; }
.letter-paper .lp-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.letter-paper .lp-head small { display: block; font-family: var(--font-ui, system-ui); font-size: 0.72rem; color: #8a6c44; }
.letter-paper h3 { margin: 4px 0 10px; color: #6b4a22; font-size: 1.05rem; }
.letter-paper p { margin: 0 0 10px; }
.letter-paper .lp-greet { font-style: italic; }
.letter-paper .lp-sign { text-align: right; font-style: italic; margin-top: 14px; }

/* ---------- facilité ---------- */
/* pendant la partie, les 3 boutons du coin sont rangés dans le menu (son, paramètres) */
body[data-screen="game"] #topbar { display: none; }
/* Journal et Retour sont dans le menu */
.hud-actions .icon-btn.in-menu { display: none; }
.menu-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* noms des jauges sur ordinateur */
.stat .st-l { display: none; }
@media (min-width: 1101px) { .stat .st-l { display: inline; font-size: 0.72rem; color: var(--muted); margin-right: 4px; } }
/* créer pour moi */
.quick-create { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 12px 14px; margin: 4px 0 14px; border-radius: 14px; background: rgba(240, 182, 74, 0.1); border: 1px solid rgba(240, 182, 74, 0.35); }
.quick-create .hint { margin: 0; }
/* précédemment : résumé court */
.prev-lines { margin: 8px 0; padding-left: 1.1em; display: grid; gap: 6px; line-height: 1.45; }
.prev-goal { margin: 6px 0; color: var(--accent); }
.prev-more { margin-top: 10px; }
.prev-more > summary { cursor: pointer; color: var(--muted); padding: 6px 0; }
/* gros texte et gros boutons */
body.big-ui { font-size: 112%; }
body.big-ui .narrative { font-size: 1.22rem; line-height: 1.8; }
body.big-ui .btn, body.big-ui .choice, body.big-ui .chip-btn, body.big-ui .b-btn { min-height: 52px; font-size: 1.06rem; }
body.big-ui .choice .c-text b { font-size: 1.1rem; }
body.big-ui .dock button { min-height: 60px; }
body.big-ui .dock button span { font-size: 0.74rem; }
body.big-ui .icon-btn { min-width: 46px; min-height: 46px; }
body.big-ui { --muted: #c3c8e6; }
@media (max-width: 720px) { body[data-screen="game"] #hud { padding-top: calc(env(safe-area-inset-top, 0px) + 12px); } }
