/* AIwaken (nom de code ÉVEIL) — thème « cendre et éther ». Aucune ressource externe. */

:root {
  color-scheme: dark;
  /* Palette « manhwa » : noir profond, bleu éther, accents or. */
  --bg: #07080c;
  --bg-deep: #040508;
  --surface: #10121a;
  --surface-2: #161924;
  --surface-3: #1f2331;
  --line: #2a3043;
  --text: #ece6dc;
  --text-soft: #cfc7bb;
  --muted: #9d968d;
  /* « ember » = accent chaud de l'interface, désormais l'or des titres et raretés. */
  --ember: #e8b44c;
  --ember-strong: #f6d27d;
  --ember-deep: #9c7426;
  --ether: #7fd8ff;
  --ether-glow: rgba(127, 216, 255, 0.45);
  --ether-soft: rgba(127, 216, 255, 0.1);
  --gold: #f0c96a;
  --danger: #ea6a5f;
  --ok: #7fcf9a;
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 48px; /* cibles tactiles mobiles */
  /* Polices système uniquement ; la fin de pile couvre le CJK (ja, ko, zh-Hans) pour plus tard. */
  --font-cjk: "Hiragino Sans", "Noto Sans CJK JP", "Microsoft YaHei", sans-serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, var(--font-cjk);
  --font-story: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif", "Hiragino Mincho ProN", "Noto Serif CJK JP", var(--font-cjk);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  font-size: 16px;
}
:root[data-text-size="s"] { font-size: 15px; }
:root[data-text-size="l"] { font-size: 18px; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(120% 60% at 50% -10%, rgba(127, 216, 255, 0.08), transparent 60%),
    radial-gradient(90% 50% at 50% 110%, rgba(240, 201, 106, 0.04), transparent 60%);
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior-y: none;
}
button, .btn, .chip, label.btn { touch-action: manipulation; -webkit-user-select: none; user-select: none; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: 0.01em; }
h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 0.6rem; }
p { margin: 0; }
a { color: var(--ether); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--ether); outline-offset: 2px; }

/* ---------------------------------------------------------------- boutons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: var(--tap); padding: 0.55rem 1.1rem;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2;
  color: var(--text); background: var(--surface-3);
  cursor: pointer; text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, transform 0.08s, opacity 0.15s;
}
.btn:active:not(:disabled), .chip:active:not(:disabled), .tabbar button:active, .choice:active, .star:active, .btn-close:active {
  transform: scale(0.97); filter: brightness(1.25); transition-duration: 0s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary {
  background: linear-gradient(180deg, var(--ember-strong), var(--ember));
  color: #1b0f08; border-color: rgba(255, 200, 160, 0.25);
  box-shadow: 0 6px 18px -10px rgba(236, 140, 78, 0.8);
}
@media (hover: hover) { .btn-primary:hover:not(:disabled) { background: var(--ember-strong); } }
.btn-secondary { background: var(--surface-2); border-color: var(--line); }
@media (hover: hover) { .btn-secondary:hover:not(:disabled) { border-color: #4a4555; background: var(--surface-3); } }
.btn-danger { background: rgba(234, 106, 95, 0.12); color: #ffb1a9; border-color: rgba(234, 106, 95, 0.45); }
@media (hover: hover) { .btn-danger:hover:not(:disabled) { background: rgba(234, 106, 95, 0.22); } }
.btn-small { min-height: var(--tap); padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.btn-link {
  min-height: var(--tap); padding: 0 0.25rem; border: 0; background: none;
  color: var(--ether); font: inherit; font-size: 0.9rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.btn-close {
  width: var(--tap); height: var(--tap); border-radius: 50%; flex: none;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-soft);
  font-size: 1rem; cursor: pointer;
}

/* ---------------------------------------------------------------- formulaires */

.stack { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field-label { font-size: 0.85rem; font-weight: 600; color: var(--text-soft); }
.field-hint { font-size: 0.8rem; color: var(--muted); }
.counter { align-self: flex-end; font-variant-numeric: tabular-nums; }

input, textarea, select {
  width: 100%; min-height: var(--tap);
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-deep); color: var(--text);
  font: inherit; font-size: max(16px, 1rem); /* ≥ 16 px : évite le zoom automatique d'iOS */
}
textarea { resize: vertical; min-height: 7rem; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #6f6a64; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ether); box-shadow: 0 0 0 3px var(--ether-soft); }
select { appearance: none; padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat; }
.code-input { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 0.12em; text-transform: uppercase; font-size: max(16px, 1.05rem); }
.otp { letter-spacing: 0.5em; text-align: center; font-size: 1.4rem; }

.fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.fieldset legend { padding: 0; margin-bottom: 0.5rem; }

.form-error {
  padding: 0.6rem 0.8rem; border-radius: var(--radius-sm);
  background: rgba(234, 106, 95, 0.1); border: 1px solid rgba(234, 106, 95, 0.35);
  color: #ffb9b1; font-size: 0.9rem;
}
.success {
  padding: 0.7rem 0.9rem; border-radius: var(--radius-sm);
  background: rgba(127, 207, 154, 0.1); border: 1px solid rgba(127, 207, 154, 0.4);
  color: #b4ecc6; font-weight: 600;
}
.info { color: var(--text-soft); font-size: 0.92rem; }
.row-links { display: flex; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.row-buttons { display: flex; gap: 0.6rem; }
.row-buttons > * { flex: 1; }
.inline-form { display: flex; gap: 0.5rem; }
.inline-form input { flex: 1; min-width: 0; }

.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px;
  padding: 4px; border-radius: 12px; background: var(--bg-deep); border: 1px solid var(--line);
}
.segmented button {
  min-height: var(--tap); padding: 0.4rem 0.5rem; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font: inherit; font-size: 0.88rem; font-weight: 600; line-height: 1.2; cursor: pointer;
}
.segmented button[aria-selected="true"], .segmented button[aria-checked="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset; }
.segmented-small button { min-height: var(--tap); }

/* ---------------------------------------------------------------- démarrage */

.boot { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; }
.boot-mark { animation: breathe 2.4s ease-in-out infinite; }
.boot-text { color: var(--muted); letter-spacing: 0.08em; }
@keyframes breathe { 0%, 100% { opacity: 0.55; transform: scale(0.96); } 50% { opacity: 1; transform: scale(1); } }

/* ---------------------------------------------------------------- accueil */

.auth {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: calc(1.25rem + var(--safe-top)) calc(1rem + var(--safe-right)) calc(1.25rem + var(--safe-bottom)) calc(1rem + var(--safe-left));
}
.auth-card { position: relative; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 1.1rem; }
.lang-corner { display: flex; align-items: center; justify-content: flex-end; gap: 0.35rem; margin-bottom: -0.5rem; }
.lang-ico { color: var(--muted); font-size: 0.95rem; }
.lang-select {
  width: auto; min-height: var(--tap); padding: 0.3rem 2rem 0.3rem 0.75rem; font-size: max(16px, 0.9rem);
  background-color: var(--surface-2); border-radius: 999px;
}
.lang-select-wide { width: 100%; min-height: var(--tap); border-radius: var(--radius-sm); font-size: 1rem; }
.auth-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.auth-mark { filter: drop-shadow(0 0 24px rgba(143, 208, 255, 0.25)); }
.brand {
  font-family: var(--font-story); font-weight: 600; font-size: 2.7rem; line-height: 1.05; letter-spacing: 0.02em;
  color: #f7e9d8; text-shadow: 0 2px 24px rgba(236, 140, 78, 0.25);
}
/* Les lettres « AI » de la marque, en éther. */
.ai { color: var(--ether); text-shadow: 0 0 18px rgba(143, 208, 255, 0.55); }
.brand .ai { font-weight: 700; }
.slogan {
  font-family: var(--font-ui); font-size: 0.82rem; font-weight: 600; letter-spacing: 0.24em; text-transform: none;
  color: var(--text-soft); margin-top: -0.2rem;
}
.slogan .ai { font-weight: 800; }
.hook { font-family: var(--font-story); font-size: 1.1rem; color: var(--gold); text-shadow: 0 0 16px rgba(240, 201, 106, 0.3); }
.tagline { color: var(--muted); font-family: var(--font-story); font-style: italic; max-width: 32ch; }
.notice {
  text-align: center; font-size: 0.9rem; color: var(--ether);
  padding: 0.6rem 0.8rem; border: 1px dashed rgba(143, 208, 255, 0.35); border-radius: var(--radius-sm); background: var(--ether-soft);
}

/* ---------------------------------------------------------------- coquille de l'application */

.app {
  /* Fixée au viewport visuel : mobile.js recale --app-h / --app-top quand le clavier virtuel s'ouvre. */
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--app-h, 100dvh);
  transform: translateY(var(--app-top, 0px));
  display: flex; flex-direction: column;
  max-width: 760px; margin: 0 auto;
  padding-left: var(--safe-left); padding-right: var(--safe-right);
}
@media (min-width: 780px) {
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); background: rgba(7, 8, 12, 0.6); }
}
.app-top {
  flex: none; display: flex; align-items: center; gap: 0.6rem;
  padding: calc(0.45rem + var(--safe-top)) 0.9rem 0.45rem;
  background: linear-gradient(180deg, var(--surface) 0%, rgba(16, 18, 26, 0.9) 100%);
  border-bottom: 1px solid var(--line);
}
.app-top-mark { flex: none; border-radius: 8px; }
.app-top-title { flex: 1; min-width: 0; font-size: 1.25rem; font-weight: 750; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wallet-pill {
  flex: none; display: inline-flex; align-items: center; gap: 0.35rem; min-height: var(--tap); padding: 0 0.9rem;
  border-radius: 999px; border: 1px solid rgba(240, 201, 106, 0.45); background: rgba(240, 201, 106, 0.08);
  color: var(--gold); font: inherit; font-weight: 800; font-variant-numeric: tabular-nums; cursor: pointer;
}
.wallet-ico { color: var(--ether); text-shadow: 0 0 8px var(--ether-glow); }

.view { flex: 1 1 auto; min-height: 0; }
.view-scroll { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 0.9rem 0.9rem 1.6rem; }
.view-sub { display: flex; flex-direction: column; }
.view-sub > .view-scroll { flex: 1 1 auto; min-height: 0; }
.game { display: flex; flex-direction: column; }

.sub-top, .game-top {
  flex: none; padding: calc(0.3rem + var(--safe-top)) 0.5rem 0.4rem;
  background: linear-gradient(180deg, var(--surface) 0%, rgba(16, 18, 26, 0.92) 100%);
  border-bottom: 1px solid var(--line); box-shadow: 0 8px 24px -18px #000; z-index: 2;
}
.sub-top { display: flex; align-items: center; gap: 0.4rem; }
.sub-title { flex: 1; min-width: 0; font-size: 1.08rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  flex: none; width: var(--tap); height: var(--tap); display: grid; place-items: center;
  border: 0; border-radius: 12px; background: none; color: var(--text); font: inherit; font-size: 1.2rem; cursor: pointer;
}
.icon-btn:active { background: var(--surface-3); }
.game-top { display: flex; flex-direction: column; gap: 0.3rem; }
.gt-row { display: flex; align-items: center; gap: 0.15rem; }
.gt-title {
  flex: 1; min-width: 0; min-height: var(--tap); display: flex; flex-direction: column; justify-content: center; line-height: 1.2;
  padding: 0 0.25rem; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.gt-place { display: flex; align-items: center; gap: 0.3rem; min-width: 0; font-weight: 700; font-size: 1rem; }
.gt-place > span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gt-title[aria-expanded="true"] .chev { transform: rotate(180deg); }
.gt-story { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ether); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gt-meters { gap: 0.35rem; padding: 0 0.35rem; }
.gt-meters .gauge { flex: 1 1 auto; }

.status-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.pill {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.2rem 0.55rem; border-radius: 999px; background: var(--surface-3); color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
.pill-diff { background: var(--ether-soft); color: var(--ether); }
.pill-diff[data-diff="difficile"], .pill-diff[data-diff="brutal"] { background: rgba(234, 106, 95, 0.14); color: #ffab9f; }

.place-btn {
  display: inline-flex; align-items: center; gap: 0.3rem; min-height: 30px; min-width: 0; max-width: 100%;
  padding: 0; border: 0; background: none; color: var(--text); font: inherit; font-weight: 700; font-size: 1rem; text-align: left; cursor: pointer;
}
.place-btn > span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.place-icon { color: var(--ember); }
.chev { color: var(--muted); font-size: 0.75rem; transition: transform 0.15s; }
.place-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }

.gauge {
  --pct: 100%;
  position: relative; flex: 0 0 9.5rem; height: 26px; border-radius: 999px; overflow: hidden;
  background: var(--bg-deep); border: 1px solid var(--line);
}
.gauge-fill {
  position: absolute; inset: 0 auto 0 0; width: var(--pct);
  background: linear-gradient(90deg, #3d8b5c, var(--ok));
  transition: width 0.45s cubic-bezier(.2,.8,.2,1), background 0.3s;
}
.gauge[data-level="mid"] .gauge-fill { background: linear-gradient(90deg, #b07a1f, var(--gold)); }
.gauge[data-level="low"] .gauge-fill { background: linear-gradient(90deg, #8f2c25, var(--danger)); }
.gauge-enemy .gauge-fill, .gauge-enemy[data-level] .gauge-fill { background: linear-gradient(90deg, #6b2a52, #c4568e); }
.gauge-text {
  position: relative; display: block; text-align: center; line-height: 24px;
  font-size: 0.8rem; font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.85);
}
.enemy-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  padding: 0.35rem 0.55rem; border-radius: var(--radius-sm);
  background: rgba(196, 86, 142, 0.1); border: 1px solid rgba(196, 86, 142, 0.35);
  animation: slide-in 0.25s ease-out;
}
.enemy-name { font-weight: 650; color: #f2b5d4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.place-panel {
  padding: 0.6rem 0.7rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 0.35rem;
}
.place-desc { font-family: var(--font-story); color: var(--text-soft); }
.place-meta { font-size: 0.85rem; color: var(--muted); }

/* ---------------------------------------------------------------- journal */

.journal {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 1.4rem 1.15rem 1.6rem;
  display: flex; flex-direction: column; gap: 1.5rem;
  scroll-behavior: smooth; -webkit-overflow-scrolling: touch;
}
.journal:focus-visible { outline-offset: -2px; }
.journal-intro {
  text-align: center; padding: 0.5rem 0.5rem 1rem; margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--line);
}
.intro-world { font-family: var(--font-story); font-size: 0.8rem; letter-spacing: 0.25em; text-transform: uppercase; color: var(--ember); margin-bottom: 0.5rem; }
.intro-text { font-family: var(--font-story); font-style: italic; color: var(--text-soft); font-size: 1.02rem; line-height: 1.65; }

.entry { display: flex; flex-direction: column; gap: 0.9rem; }
.entry-new { animation: slide-in 0.3s ease-out; }
.entry-line { overflow-wrap: anywhere; hyphens: none; }
/* Mots longs (allemand…) : on ne coupe que ce qui déborderait, le récit peut couper n'importe où. */
.journal, .sheet-body, .auth-card, .admin { overflow-wrap: break-word; }
.entry-recit .entry-line { font-family: var(--font-story); font-size: 1.14rem; line-height: 1.85; color: var(--text); letter-spacing: 0.005em; }
.entry-joueur {
  align-self: flex-end; max-width: 88%;
  padding: 0.45rem 0.8rem; border-radius: 14px 14px 4px 14px;
  background: rgba(240, 201, 106, 0.08); border: 1px solid rgba(240, 201, 106, 0.3);
  color: #f6e2b0; font-size: 1rem;
}
.entry-joueur .prompt { color: var(--ember); font-weight: 700; }
.entry-systeme .entry-line { font-size: 0.86rem; color: var(--muted); font-style: italic; text-align: center; }
.entry-local .entry-line { color: #ffb9b1; }

.entry .line-fight {
  font-family: var(--font-ui); font-size: 0.95rem; line-height: 1.45; text-align: left;
  padding: 0.45rem 0.7rem; border-left: 3px solid #c4568e; border-radius: 2px;
  background: rgba(196, 86, 142, 0.1); color: #f2b5d4; font-weight: 650;
}

/* ---- Fenêtres système façon manhwa : cadre fin éther lumineux, fond sombre translucide, coins nets. */
.syswin {
  --sys: var(--ether);
  --sys-glow: var(--ether-glow);
  position: relative; margin: 0.15rem 0.1rem;
  padding: 0.7rem 0.9rem 0.8rem;
  border: 1px solid var(--sys); border-radius: 2px;
  background: linear-gradient(180deg, rgba(10, 22, 34, 0.88), rgba(6, 12, 20, 0.92));
  box-shadow: 0 0 0 1px rgba(127, 216, 255, 0.08) inset, 0 0 16px -4px var(--sys-glow), inset 0 0 22px -12px var(--sys-glow);
  font-family: var(--font-ui); color: #e6f6ff;
  animation: syswin-in 0.42s cubic-bezier(.2,.8,.2,1) both;
}
/* Petits coins lumineux, signature des panneaux système. */
.syswin::before, .syswin::after {
  content: ""; position: absolute; width: 9px; height: 9px; border: 2px solid var(--sys);
}
.syswin::before { top: -3px; left: -3px; border-right: 0; border-bottom: 0; }
.syswin::after { bottom: -3px; right: -3px; border-left: 0; border-top: 0; }
.syswin-head {
  display: flex; align-items: center; justify-content: center; gap: 0.45rem;
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--sys); text-shadow: 0 0 10px var(--sys-glow); margin-bottom: 0.4rem;
}
.syswin-head::before, .syswin-head::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--sys)); opacity: 0.6; }
.syswin-head::after { background: linear-gradient(90deg, var(--sys), transparent); }
.syswin-ico { font-size: 0.9rem; letter-spacing: 0; text-shadow: none; }
.syswin-body { text-align: center; font-size: 1rem; line-height: 1.5; font-weight: 600; overflow-wrap: anywhere; }
.syswin-roll .syswin-body { font-weight: 500; font-variant-numeric: tabular-nums; color: #cdeeff; }
.syswin-evo .syswin-body { font-size: 1.05rem; }
.syswin-title, .syswin-chapter { --sys: var(--gold); --sys-glow: rgba(240, 201, 106, 0.45); color: #fff1c9; }
.syswin-title { background: linear-gradient(180deg, rgba(34, 26, 8, 0.9), rgba(16, 12, 4, 0.92)); }
.syswin-quest .syswin-body { text-align: left; font-weight: 500; }
@keyframes syswin-in {
  0% { opacity: 0; transform: scaleY(0.2); filter: brightness(2); }
  60% { opacity: 1; transform: scaleY(1.03); }
  100% { opacity: 1; transform: none; filter: none; }
}
.journal-intro .syswin, .entry:not(.entry-new) .syswin { animation: none; }

.pending { display: flex; align-items: center; gap: 0.6rem; color: var(--muted); font-style: italic; font-family: var(--font-story); }
.dots { display: inline-flex; gap: 4px; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--ether); animation: dot 1.2s infinite ease-in-out; }
.dots span:nth-child(2) { animation-delay: 0.15s; }
.dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes slide-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.over-banner {
  flex: none; margin: 0 0.75rem 0.5rem; padding: 0.8rem 0.9rem;
  display: flex; align-items: center; gap: 0.8rem; justify-content: space-between;
  border-radius: var(--radius); background: rgba(234, 106, 95, 0.12); border: 1px solid rgba(234, 106, 95, 0.45);
  color: #ffd0ca; font-size: 0.92rem;
}
.over-banner strong { display: block; color: #ffe1dc; }

/* ---------------------------------------------------------------- actions rapides & saisie */

.quick {
  flex: none; display: flex; gap: 0.45rem; overflow-x: auto; scrollbar-width: none;
  padding: 0.5rem 0.75rem 0.15rem;
  mask-image: linear-gradient(90deg, #000 92%, transparent);
}
.quick::-webkit-scrollbar { display: none; }
.quick:empty { display: none; }
.chip {
  flex: none; min-height: var(--tap); padding: 0.35rem 1rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-soft);
  font: inherit; font-size: 0.88rem; font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
@media (hover: hover) { .chip:hover:not(:disabled) { border-color: #4f4a5a; } }
.chip:disabled { opacity: 0.45; }
.chip-move { color: var(--ether); border-color: rgba(143, 208, 255, 0.3); text-transform: capitalize; }
.chip-fight { color: #f6bfd9; border-color: rgba(196, 86, 142, 0.5); background: rgba(196, 86, 142, 0.12); }
.chip-item { color: #b4ecc6; border-color: rgba(127, 207, 154, 0.35); }
.chip-toggle[aria-checked="true"] { background: var(--ember); border-color: var(--ember); color: #1b0f08; }

.composer {
  flex: none; display: flex; gap: 0.5rem; padding: 0.5rem 0.75rem 0.6rem;
}
.composer input { flex: 1; min-width: 0; border-radius: 999px; padding-left: 1rem; background: var(--surface); }
.btn-send { border-radius: 999px; min-width: 6.2rem; }

.tabbar {
  flex: none; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 0.2rem 0.3rem calc(0.25rem + var(--safe-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar button {
  min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 0; background: none; color: var(--muted); font: inherit; font-size: 0.72rem; font-weight: 600; cursor: pointer; border-radius: 10px;
}
@media (hover: hover) { .tabbar button:hover { color: var(--text); } }
.tab-ico { font-size: 1.15rem; line-height: 1.2; color: var(--text-soft); }
.tabbar button[aria-current="page"] { color: var(--text); }
.tabbar button[aria-current="page"] .tab-ico { color: var(--ether); text-shadow: 0 0 10px var(--ether-glow); }
.tabbar button[aria-current="page"]::after { content: ""; width: 18px; height: 2px; border-radius: 2px; background: var(--ether); margin-top: 2px; }

/* ---------------------------------------------------------------- feuilles du bas */

dialog.sheet {
  width: 100%; max-width: 560px; max-height: 88dvh;
  margin: auto auto 0; padding: 0;
  border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0;
  background: var(--surface); color: var(--text);
  box-shadow: 0 -20px 60px -20px #000;
}
dialog.sheet[open] { animation: sheet-up 0.22s cubic-bezier(.2,.8,.2,1); }
dialog.sheet::backdrop { background: rgba(5, 4, 8, 0.62); backdrop-filter: blur(2px); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) {
  dialog.sheet { margin: auto; border-radius: 20px; border-bottom: 1px solid var(--line); }
}
.sheet-inner { display: flex; flex-direction: column; max-height: 88dvh; }
.sheet-head {
  position: relative; flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1rem 0.6rem 1.2rem;
}
.sheet-head::before {
  content: ""; position: absolute; top: 7px; left: 50%; width: 38px; height: 4px; margin-left: -19px;
  border-radius: 4px; background: var(--line);
}
.sheet-head h2 { font-family: var(--font-story); font-size: 1.35rem; font-weight: 600; }
.sheet-body {
  overflow-y: auto; overscroll-behavior: contain;
  padding: 0.4rem 1.2rem calc(1.4rem + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 1.3rem;
}
.block { display: flex; flex-direction: column; gap: 0.6rem; }
.block > h3 { margin-bottom: 0; }
.empty { color: var(--muted); font-style: italic; list-style: none; padding: 0.5rem 0; }

/* Personnage : fenêtre de statut façon manhwa */
.syswin-status { margin: 0.2rem 0 0; padding: 0.9rem 1rem 1rem; animation: none; display: flex; flex-direction: column; gap: 0.7rem; }
.sw-identity { text-align: center; display: flex; flex-direction: column; gap: 0.15rem; }
.sw-name { font-family: var(--font-story); font-size: 1.6rem; font-weight: 600; color: #f7f3ea; letter-spacing: 0.02em; }
.sw-title { color: var(--gold); font-weight: 650; text-shadow: 0 0 12px rgba(240, 201, 106, 0.35); }
.sw-title-none { color: var(--muted); font-weight: 400; font-size: 0.88rem; text-shadow: none; }
.sw-label { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ether); }
.sw-row { display: flex; align-items: center; gap: 0.7rem; }
.sw-gauge { flex: 1 1 auto; }
.sw-meta { font-size: 0.9rem; color: var(--text-soft); }
.sw-stats { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem 1.2rem; border-top: 1px solid rgba(127, 216, 255, 0.25); padding-top: 0.65rem; }
.sw-stat { display: flex; align-items: baseline; gap: 0.4rem; }
.sw-stat dt { font-size: 0.76rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-soft); }
.sw-stat::after { content: ""; order: 1; flex: 1; border-bottom: 1px dotted rgba(127, 216, 255, 0.3); transform: translateY(-0.25em); }
.sw-stat dd { order: 2; margin: 0; font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; color: #e6f6ff; }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin: 0; padding: 0; }
.tag { display: inline-block; font-size: 0.78rem; font-weight: 650; padding: 0.2rem 0.6rem; border-radius: 999px; background: var(--surface-3); color: var(--text-soft); }
.tag-title { background: rgba(240, 201, 106, 0.12); color: #f6dfa4; border: 1px solid rgba(240, 201, 106, 0.4); font-size: 0.85rem; }
.skills { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.skill { padding: 0.6rem 0.75rem; border-radius: 2px; background: rgba(10, 22, 34, 0.6); border: 1px solid rgba(127, 216, 255, 0.3); display: flex; flex-direction: column; gap: 0.25rem; }
.skill-name { font-weight: 700; display: flex; align-items: baseline; gap: 0.55rem; }
.skill-level {
  flex: none; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.04em; color: #04121c;
  background: var(--ether); padding: 0.05rem 0.4rem; border-radius: 2px; box-shadow: 0 0 10px -2px var(--ether-glow);
}
.skill-desc { font-size: 0.85rem; color: var(--muted); }
.skill-hidden { border-style: dashed; background: transparent; border-color: var(--line); }
.skill-hidden .skill-level { background: var(--surface-3); color: var(--muted); box-shadow: none; }
.skill-hidden .skill-name span:last-child { color: var(--muted); letter-spacing: 0.2em; }
.skill-bar { --pct: 0%; display: block; height: 4px; border-radius: 1px; background: var(--bg-deep); overflow: hidden; margin-top: 0.2rem; }
.skill-bar-fill { display: block; height: 100%; width: var(--pct); background: linear-gradient(90deg, #2d7fb0, var(--ether)); }

/* Inventaire */
.inv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.inv-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.75rem; min-height: 52px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.inv-name { flex: 1; font-weight: 600; }
.inv-qty { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Codex */
.note-form { display: flex; flex-direction: column; gap: 0.45rem; }
.codex-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.codex-entry { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.55rem 0.75rem; border-left: 3px solid var(--ether); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.codex-joueur { border-left-color: var(--ember); }
.codex-meta { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.codex-text { font-family: var(--font-story); color: var(--text-soft); }

/* Réglages */
.choice-list { display: flex; flex-direction: column; gap: 0.45rem; }
.choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; text-align: left;
  min-height: var(--tap); padding: 0.6rem 0.8rem 0.6rem 2.4rem; position: relative;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text);
  font: inherit; cursor: pointer;
}
.choice::before {
  content: ""; position: absolute; left: 0.85rem; top: 0.85rem; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--muted);
}
.choice[aria-checked="true"] { border-color: var(--ember); background: rgba(236, 140, 78, 0.08); }
.choice[aria-checked="true"]::before { border-color: var(--ember); background: radial-gradient(circle, var(--ember) 45%, transparent 50%); }
.choice-title { font-weight: 650; }
.choice-desc { font-size: 0.84rem; color: var(--muted); }
.confirm { display: flex; flex-direction: column; gap: 0.7rem; padding: 0.8rem; border-radius: var(--radius-sm); border: 1px solid rgba(234, 106, 95, 0.45); background: rgba(234, 106, 95, 0.08); }
.block .btn + .btn { margin-top: 0.1rem; }

/* Retours */
.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chips .chip { min-height: var(--tap); }
.stars { display: flex; align-items: center; gap: 0.15rem; }
.star { width: var(--tap); height: var(--tap); border: 0; background: none; font-size: 1.7rem; line-height: 1; color: #4a4553; cursor: pointer; padding: 0; transition: color 0.12s, transform 0.12s; }
.star-on { color: var(--gold); text-shadow: 0 0 12px rgba(233, 196, 106, 0.45); }
.star:active { transform: scale(0.9); }
.star-hint { margin-left: 0.4rem; }
.fb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.fb-item { padding: 0.65rem 0.75rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 0.35rem; }
.fb-item-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.fb-rating { color: var(--gold); font-size: 0.85rem; letter-spacing: 0.05em; }
.fb-msg { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-soft); font-size: 0.92rem; }
.badge-status { margin-left: auto; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.18rem 0.55rem; border-radius: 999px; background: var(--surface-3); color: var(--text-soft); }
.badge-nouveau { background: var(--ether-soft); color: var(--ether); }
.badge-analyse { background: rgba(233, 196, 106, 0.14); color: #f6dfa4; }
.badge-planifie { background: rgba(176, 140, 255, 0.15); color: #d5c4ff; }
.badge-fait { background: rgba(127, 207, 154, 0.14); color: #b4ecc6; }
.badge-rejete { background: rgba(157, 150, 141, 0.16); color: var(--muted); }

/* Toast */
.toast {
  /* Au-dessus de la barre du bas et de la saisie, sans couvrir les champs. */
  position: fixed; left: 50%; bottom: calc(8.6rem + var(--safe-bottom)); transform: translateX(-50%);
  max-width: calc(100% - 2rem); padding: 0.6rem 1rem; border-radius: 999px;
  background: #f1ebe2; color: #1b1a20; font-weight: 600; font-size: 0.9rem; text-align: center;
  box-shadow: 0 10px 30px -10px #000; z-index: 50; animation: slide-in 0.2s ease-out;
}

/* ---------------------------------------------------------------- administration */

.admin { max-width: 980px; margin: 0 auto; padding: calc(1rem + var(--safe-top)) calc(1rem + var(--safe-right)) calc(2rem + var(--safe-bottom)) calc(1rem + var(--safe-left)); display: flex; flex-direction: column; gap: 1.2rem; }
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; flex-wrap: wrap; }
.admin-top h1 { font-family: var(--font-story); font-size: 1.5rem; font-weight: 600; display: flex; align-items: center; gap: 0.6rem; }
.admin-top h1 img { flex: none; }
.admin-tools { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: 0.9rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.card-head h2 { font-size: 1.05rem; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; align-items: end; } }
.reveal { border: 1px solid rgba(143, 208, 255, 0.45); background: var(--ether-soft); border-radius: var(--radius-sm); padding: 0.8rem; display: flex; flex-direction: column; gap: 0.6rem; }
.reveal-row { display: flex; gap: 0.5rem; align-items: center; }
.reveal-row code { flex: 1; min-width: 0; padding: 0.55rem 0.7rem; border-radius: 8px; background: var(--bg-deep); border: 1px solid var(--line); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.9rem; overflow-wrap: anywhere; color: #e6f5ff; }
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; padding: 0.65rem 0.75rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.row-main { flex: 1 1 14rem; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.row-title { font-weight: 650; overflow-wrap: anywhere; }
.row-sub { font-size: 0.82rem; color: var(--muted); overflow-wrap: anywhere; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; align-items: center; margin-left: auto; }
.row-actions select { width: auto; min-height: var(--tap); padding-top: 0.3rem; padding-bottom: 0.3rem; font-size: 0.9rem; }
.row-body { flex-basis: 100%; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-soft); font-size: 0.92rem; }
.row-context { flex-basis: 100%; font-size: 0.78rem; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.row-disabled .row-title { color: var(--muted); text-decoration: line-through; }
.denied { text-align: center; padding: 3rem 1rem; display: flex; flex-direction: column; gap: 1rem; align-items: center; }
.filter { display: flex; align-items: center; gap: 0.5rem; }
.filter select { width: auto; min-height: var(--tap); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------------------------------------------------------------- pièces jointes des retours */

.attach { display: flex; flex-direction: column; gap: 0.5rem; }
/* Champ fichier masqué visuellement mais focalisable ; son <label> sert de bouton. */
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.file-input:focus-visible + label { outline: 2px solid var(--ether); outline-offset: 2px; }
label.btn { cursor: pointer; }
label.btn.is-disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.thumbs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.thumbs:empty { display: none; }
.thumb {
  position: relative; aspect-ratio: 3 / 4; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--bg-deep); border: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-size {
  position: absolute; left: 4px; bottom: 4px; padding: 0.05rem 0.4rem; border-radius: 6px;
  background: rgba(12, 11, 14, 0.8); color: var(--text-soft); font-size: 0.7rem; font-variant-numeric: tabular-nums;
}
.thumb-remove {
  position: absolute; top: 2px; right: 2px; width: var(--tap); height: var(--tap);
  border: 0; background: none; color: #fff; font-size: 0.85rem; cursor: pointer;
  display: flex; align-items: flex-start; justify-content: flex-end; padding: 4px;
}
.thumb-remove::before {
  content: ""; position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(12, 11, 14, 0.82); border: 1px solid var(--line); z-index: -1;
}
.thumb-remove { z-index: 1; isolation: isolate; }
@media (hover: hover) { .thumb-remove:hover::before { border-color: var(--danger); } }
.upload-progress { display: flex; flex-direction: column; gap: 0.35rem; }
.upload-bar { --pct: 0%; display: block; height: 6px; border-radius: 6px; background: var(--bg-deep); overflow: hidden; border: 1px solid var(--line); }
.upload-bar-fill { display: block; height: 100%; width: var(--pct); background: linear-gradient(90deg, var(--ember-deep), var(--ember-strong)); transition: width 0.2s; }
.warning {
  padding: 0.6rem 0.8rem; border-radius: var(--radius-sm);
  background: rgba(233, 196, 106, 0.1); border: 1px solid rgba(233, 196, 106, 0.4); color: #f6dfa4; font-size: 0.9rem;
}
.attach-links { flex-basis: 100%; list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; }
.attach-link { display: inline-flex; align-items: center; min-height: var(--tap); font-size: 0.9rem; font-weight: 600; }


/* ---------------------------------------------------------------- mobile : clavier, gestes, réseau */

/* Clavier ouvert : la barre d'onglets s'efface, la saisie colle au clavier. */
:root[data-kb="open"] .tabbar { display: none; }
:root[data-kb="open"] .journal-intro { display: none; }
.composer { padding-bottom: 0.6rem; }
.sheet-head { touch-action: none; cursor: grab; }
dialog.sheet.is-dragging { animation: none; transition: none; }
dialog.sheet.is-settling { transition: transform 0.18s ease-out; }

.net-banner {
  flex: none; display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.35rem 0.75rem; font-size: 0.85rem; font-weight: 650;
  background: rgba(234, 106, 95, 0.14); color: #ffc2bb; border-bottom: 1px solid rgba(234, 106, 95, 0.35);
}
.retry-line { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.retry-line .entry-line { color: #ffb9b1; font-style: normal; }
.boot-msg { color: var(--text-soft); text-align: center; max-width: 30ch; }
.boot { padding: var(--safe-top) 1rem var(--safe-bottom); }

/* ---------------------------------------------------------------- quota et forfait */

.pill-quota { background: var(--ether-soft); color: var(--ether); }
.pill-quota[data-state="low"] { background: rgba(240, 201, 106, 0.14); color: var(--gold); }
.pill-quota[data-state="out"] { background: rgba(234, 106, 95, 0.16); color: #ffab9f; }
.pill-quota[data-state="unlimited"] { background: rgba(240, 201, 106, 0.12); color: var(--gold); text-transform: none; letter-spacing: 0.02em; }
.syswin-quota { --sys: var(--gold); --sys-glow: rgba(240, 201, 106, 0.45); display: flex; flex-direction: column; gap: 0.6rem; }
.syswin-quota .syswin-head { margin-bottom: 0; }
.syswin-quota .syswin-body { font-weight: 500; }



/* ---------------------------------------------------------------- compagnon Écho */

.tabbar .tab-echo .tab-ico { color: var(--ether); text-shadow: 0 0 8px var(--ether-glow); }

.echo { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.echo-head { flex: none; display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.9rem 0.4rem; }
.echo-id { min-width: 0; }
.echo-name { font-family: var(--font-story); font-size: 1.2rem; font-weight: 600; }
.echo-tagline { font-size: 0.85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.echo-avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.1rem; color: #e6f6ff;
  background: radial-gradient(circle at 40% 35%, #bfeaff, #2a7fb3 55%, #0a2233);
  box-shadow: 0 0 14px var(--ether-glow), 0 0 0 1px rgba(127, 216, 255, 0.6);
}
.echo-avatar-small { width: 30px; height: 30px; font-size: 0.85rem; align-self: flex-end; }
.echo-banner {
  flex: none; margin: 0 0.9rem 0.3rem; padding: 0.4rem 0.7rem; text-align: center;
  font-size: 0.82rem; font-weight: 600; color: var(--ether);
  border: 1px solid rgba(127, 216, 255, 0.35); border-radius: 2px; background: var(--ether-soft);
}
.echo-list {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 0.8rem 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.7rem;
}
.echo-row { display: flex; align-items: flex-end; gap: 0.5rem; }
.echo-row-me { justify-content: flex-end; }
.bubble {
  max-width: 82%; padding: 0.55rem 0.85rem; border-radius: 16px;
  display: flex; flex-direction: column; gap: 0.35rem; overflow-wrap: anywhere; line-height: 1.5;
}
.bubble-me { background: rgba(240, 201, 106, 0.1); border: 1px solid rgba(240, 201, 106, 0.32); color: #f6e2b0; border-bottom-right-radius: 4px; }
.bubble-echo { background: rgba(10, 22, 34, 0.85); border: 1px solid rgba(127, 216, 255, 0.4); color: #e6f6ff; border-bottom-left-radius: 4px; box-shadow: 0 0 14px -8px var(--ether-glow); }
.bubble-pending { opacity: 0.75; }
.bubble-thinking { flex-direction: row; align-items: center; gap: 0.5rem; color: var(--muted); font-style: italic; }
.echo-empty { color: var(--muted); text-align: center; font-family: var(--font-story); font-style: italic; margin: auto 1rem; }
.echo-error { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; color: #ffb9b1; text-align: center; font-size: 0.9rem; }

/* ---------------------------------------------------------------- admin : options d'invitation, forfaits */

.invite-options { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.2rem; }
.check { display: inline-flex; align-items: center; gap: 0.55rem; min-height: var(--tap); cursor: pointer; font-size: 0.95rem; }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--ether); margin: 0; }
.field-inline { flex-direction: row; align-items: center; gap: 0.6rem; }
.field-inline select { width: auto; }
.form-grid > .btn { grid-column: 1 / -1; }
.badge-plan-free { background: var(--surface-3); color: var(--text-soft); }
.badge-plan-unlimited { background: rgba(240, 201, 106, 0.14); color: var(--gold); }

/* ================================================================ Bibliothèque, Découvrir, fiche */

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 1.1rem 0 0.55rem; }
.section-title { font-size: 1.05rem; font-weight: 750; letter-spacing: 0.01em; color: var(--text); text-transform: none; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 0.8rem; padding: 1.5rem 0.5rem; text-align: center; color: var(--muted); }
.lib-add { margin-top: 1rem; }

/* ---- Couvertures générées (dégradé du genre + glyphe), sans image ni illustration tierce */
.cover {
  --shift: 0deg;
  position: relative; display: block; overflow: hidden; isolation: isolate;
  aspect-ratio: 3 / 4; width: 100%; border-radius: 10px;
  background: #0b0d14; border: 1px solid rgba(127, 216, 255, 0.16);
}
.cover::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: var(--cover-bg); filter: hue-rotate(var(--shift)) saturate(1.05);
}
.cover::after {
  /* Trame façon planche de manhwa + voile bas pour la lisibilité du titre. */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, transparent 45%, rgba(4, 5, 8, 0.88) 100%);
}
.cover-g-fantasy { --cover-bg: radial-gradient(120% 80% at var(--light-x, 50%) var(--light-y, 15%), #4b7bd6 0%, #1d2d63 45%, #0a0d1f 100%); }
.cover-g-tour_donjon { --cover-bg: radial-gradient(110% 80% at var(--light-x, 50%) var(--light-y, 15%), #c48a3a 0%, #4b2a1a 50%, #0d0a08 100%); }
.cover-g-regression { --cover-bg: conic-gradient(from 210deg at var(--light-x, 60%) 40%, #1e5f7a, #0e1a33, #3a2a6b, #1e5f7a); }
.cover-g-romance_fantasy { --cover-bg: radial-gradient(110% 80% at var(--light-x, 50%) var(--light-y, 15%), #e07aa0 0%, #6b2348 50%, #140812 100%); }
.cover-g-academie { --cover-bg: linear-gradient(160deg, #2f6d63 0%, #173a44 50%, #0a1418 100%); }
.cover-g-horreur { --cover-bg: radial-gradient(90% 70% at var(--light-x, 50%) var(--light-y, 15%), #6b1d1d 0%, #240a0d 60%, #060304 100%); }
.cover-g-scifi { --cover-bg: linear-gradient(200deg, #2ad1d1 0%, #1b3f72 45%, #070b1c 100%); }
.cover-g-autre { --cover-bg: linear-gradient(170deg, #5c5f7a 0%, #23253a 55%, #0a0b12 100%); }
.cover-glyph {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%);
  font-size: 2.6rem; line-height: 1; filter: drop-shadow(0 0 14px rgba(127, 216, 255, 0.55));
}
.cover-title {
  position: absolute; left: 0.5rem; right: 0.5rem; bottom: 0.5rem;
  font-family: var(--font-story); font-weight: 700; font-size: 0.9rem; line-height: 1.15; color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cover-hero { aspect-ratio: 16 / 10; border-radius: 0; border: 0; border-bottom: 1px solid var(--line); }
.cover-hero .cover-glyph { font-size: 4.2rem; top: 45%; }
.cover-hero .cover-title { display: none; }
.cover-banner { position: absolute; inset: 0; aspect-ratio: auto; height: 100%; border-radius: 14px; }
.cover-banner .cover-glyph { left: auto; right: 1.2rem; transform: translateY(-50%); font-size: 4rem; top: 38%; opacity: 0.9; }
.cover-banner .cover-title { display: none; }
.cover-resume { flex: none; width: 88px; border-radius: 8px; }
.cover-resume .cover-glyph { font-size: 2rem; }
.cover-resume .cover-title { display: none; }
.cover-mini { flex: none; width: 52px; border-radius: 6px; }
.cover-mini .cover-glyph { font-size: 1.4rem; top: 50%; }
.cover-mini .cover-title { display: none; }

/* ---- Cartes */
.card-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 0.9rem 0.65rem; }
.card-cell { position: relative; min-width: 0; }
.story-card {
  display: flex; flex-direction: column; gap: 0.3rem; width: 100%; padding: 0; border: 0; background: none;
  color: var(--text); font: inherit; text-align: left; cursor: pointer; -webkit-touch-callout: none;
}
.story-card:active .cover { transform: scale(0.98); }
.card-title { font-size: 0.9rem; font-weight: 700; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-off .cover { filter: grayscale(0.8) brightness(0.7); }
.card-badge {
  position: absolute; left: 6px; top: 6px; padding: 0.1rem 0.45rem; border-radius: 4px;
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
}
.card-badge-new { background: var(--ether); color: #04121c; box-shadow: 0 0 10px var(--ether-glow); }
.card-badge-done { background: var(--gold); color: #1b1404; }
.card-badge-unavailable { background: rgba(234, 106, 95, 0.9); color: #1b0605; }
.card-more {
  position: absolute; right: 0; top: 0; width: var(--tap); height: var(--tap);
  display: flex; align-items: flex-start; justify-content: flex-end; padding: 5px;
  border: 0; background: none; color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.card-more::before {
  content: ""; position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(4, 5, 8, 0.7); border: 1px solid rgba(255, 255, 255, 0.15); z-index: -1;
}
.card-more { isolation: isolate; z-index: 1; padding: 9px 11px; }

/* ---- Rangées horizontales (une ligne, défilement au pouce) */
.rail-section { margin-top: 0.3rem; }
.rail {
  list-style: none; margin: 0 -0.9rem; padding: 0 0.9rem 0.3rem; display: flex; gap: 0.65rem;
  overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; overscroll-behavior-x: contain;
}
.rail::-webkit-scrollbar { display: none; }
.rail .card-cell { flex: 0 0 31%; max-width: 150px; scroll-snap-align: start; }
@media (min-width: 600px) { .rail .card-cell { flex-basis: 140px; } }

/* ---- Recherche et filtres */
.search { position: relative; margin-bottom: 0.6rem; }
.search input { padding-left: 2.4rem; border-radius: 999px; background: var(--surface); }
.search-ico { position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.1rem; pointer-events: none; }
.chip-row { display: flex; gap: 0.45rem; overflow-x: auto; scrollbar-width: none; padding-bottom: 0.2rem; margin: 0 -0.9rem; padding-left: 0.9rem; padding-right: 0.9rem; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-filter[aria-selected="true"] { background: var(--ether-soft); border-color: var(--ether); color: var(--ether); box-shadow: 0 0 10px -4px var(--ether-glow); }
.results-count { margin: 0.6rem 0; }

/* ---- Bannière « À la une » */
.banner { position: relative; min-height: 190px; margin-top: 0.7rem; border-radius: 14px; overflow: hidden; display: flex; align-items: flex-end; }
.banner-body { position: relative; padding: 1rem; display: flex; flex-direction: column; gap: 0.35rem; max-width: 78%; }
.banner-kicker { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }
.banner-title { font-family: var(--font-story); font-size: 1.45rem; line-height: 1.15; text-shadow: 0 2px 10px #000; }
.banner-summary { font-size: 0.86rem; color: var(--text-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.banner-body .btn { align-self: flex-start; margin-top: 0.2rem; }

/* ---- Carte « Reprendre » */
.resume { margin-bottom: 0.2rem; }
.resume-card {
  display: flex; gap: 0.9rem; padding: 0.8rem; border-radius: 14px;
  background: linear-gradient(135deg, rgba(240, 201, 106, 0.08), rgba(127, 216, 255, 0.06));
  border: 1px solid rgba(240, 201, 106, 0.35); box-shadow: 0 0 24px -14px rgba(240, 201, 106, 0.7);
}
.resume-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; justify-content: center; }
.resume-kicker { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }
.resume-title { font-family: var(--font-story); font-size: 1.2rem; line-height: 1.2; }
.resume-meta { font-size: 0.82rem; color: var(--muted); }
.resume-bar { --pct: 0%; display: block; height: 5px; border-radius: 3px; background: var(--bg-deep); overflow: hidden; }
.resume-bar-fill { display: block; height: 100%; width: var(--pct); background: linear-gradient(90deg, var(--ember-deep), var(--gold)); }
.resume-body .btn { align-self: flex-start; margin-top: 0.2rem; }

/* ---- Fiche */
.view-sub > .view-scroll.story-scroll, #view-story .view-scroll { padding: 0 0 1.6rem; }
.story-body { padding: 0.9rem; display: flex; flex-direction: column; gap: 0.6rem; }
.story-title { font-family: var(--font-story); font-size: 1.6rem; line-height: 1.15; }
.story-summary { font-family: var(--font-story); font-size: 1.05rem; line-height: 1.7; color: var(--text-soft); }
.story-actions { display: grid; gap: 0.55rem; margin-top: 0.4rem; }
.report-link { align-self: center; color: var(--muted); text-decoration: none; }
.tag-genre { background: var(--ether-soft); color: var(--ether); }
.report-story { font-weight: 700; margin-bottom: 0.3rem; }
.action-list { gap: 0.6rem; }

/* ================================================================ Créer */

.create-intro { margin-bottom: 0.8rem; }
.create-options { display: grid; gap: 0.7rem; }
@media (min-width: 560px) { .create-options { grid-template-columns: 1fr 1fr; } }
.option-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; min-height: 96px;
  padding: 0.9rem 1rem; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.option-card:active { transform: scale(0.99); filter: brightness(1.2); }
.option-ai { border-color: rgba(127, 216, 255, 0.55); background: linear-gradient(135deg, rgba(10, 22, 34, 0.95), rgba(22, 25, 36, 0.95)); box-shadow: 0 0 22px -12px var(--ether-glow); }
.option-ico { font-size: 1.4rem; }
.option-title { font-weight: 750; font-size: 1.02rem; }
.option-desc { font-size: 0.85rem; color: var(--muted); }
.cost-badge { position: absolute; top: 0.8rem; right: 0.9rem; padding: 0.15rem 0.55rem; border-radius: 999px; background: rgba(240, 201, 106, 0.12); color: var(--gold); font-weight: 800; font-size: 0.8rem; }
.stat-tiles { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.stat-tile { padding: 0.6rem 0.5rem; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); text-align: center; }
.stat-tile dt { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stat-tile dd { margin: 0.1rem 0 0; font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.my-stories { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.my-story-btn {
  display: flex; align-items: center; gap: 0.75rem; width: 100%; min-height: 72px; padding: 0.55rem 0.7rem;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.my-story-body { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; }
.my-story-title { font-weight: 700; }
.my-story-stats { font-size: 0.8rem; color: var(--muted); }
.my-story-note { font-size: 0.8rem; color: #f6dfa4; }
.my-story-body .badge-status { margin-left: 0; }
.badge-story-draft { background: var(--surface-3); color: var(--text-soft); }
.badge-story-review { background: rgba(240, 201, 106, 0.14); color: var(--gold); }
.badge-story-published { background: rgba(127, 207, 154, 0.14); color: #b4ecc6; }
.badge-story-rejected, .badge-story-suspended { background: rgba(234, 106, 95, 0.16); color: #ffab9f; }
.cost-line { font-weight: 700; color: var(--gold); }
.gen-errors { margin: 0; padding-left: 1.1rem; color: #ffb9b1; font-size: 0.88rem; }

/* ---- Éditeur */
.ed-tabs { flex: none; padding-top: 0.5rem; padding-bottom: 0.5rem; margin: 0; background: var(--bg); border-bottom: 1px solid var(--line); }
.ed-tab-count { color: var(--muted); font-weight: 600; }
.ed-tab-err { color: #ffab9f; }
.ed-scroll { padding-bottom: 1.2rem; }
.ed-body { display: flex; flex-direction: column; gap: 0.9rem; }
.ed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.ed-field.has-error input, .ed-field.has-error textarea, .ed-field.has-error select { border-color: var(--danger); }
.ed-field.has-error { border-left: 3px solid var(--danger); padding-left: 0.6rem; }
.field-error { color: #ffb9b1; font-size: 0.84rem; }
.ed-errors { padding: 0.7rem 0.8rem; border-radius: 10px; border: 1px solid rgba(234, 106, 95, 0.45); background: rgba(234, 106, 95, 0.07); margin-bottom: 0.8rem; }
.ed-errors h3 { color: #ffab9f; margin-bottom: 0.4rem; }
.ed-errors ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.ed-error {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.05rem; width: 100%; min-height: var(--tap); padding: 0.4rem 0.5rem;
  border: 0; border-radius: 8px; background: rgba(4, 5, 8, 0.4); color: var(--text); font: inherit; font-size: 0.88rem; text-align: left; cursor: pointer;
}
.ed-error-path { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.75rem; color: #ffab9f; overflow-wrap: anywhere; }
.ed-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.ed-item {
  display: flex; align-items: center; gap: 0.6rem; width: 100%; min-height: 56px; padding: 0.5rem 0.8rem;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.ed-item-name { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-item-id { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.75rem; color: var(--muted); }
.ed-item-err { color: #ffab9f; font-weight: 700; font-size: 0.8rem; }
.ed-back { align-self: flex-start; text-decoration: none; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.multi { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0 0.8rem; }
.exits { display: flex; flex-direction: column; gap: 0.4rem; }
.exit-row { display: flex; align-items: center; gap: 0.6rem; }
.exit-dir { flex: 0 0 4.2rem; font-weight: 700; color: var(--ether); font-size: 0.9rem; }
.exit-row select { flex: 1; }
.ed-dirty { color: var(--gold); font-size: 0.85rem; font-weight: 700; margin-bottom: 0.5rem; }
.ed-danger { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.ed-actions {
  flex: none; display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 0.5rem;
  padding: 0.55rem 0.75rem calc(0.55rem + var(--safe-bottom)); background: var(--surface); border-top: 1px solid var(--line);
}
:root[data-kb="open"] .ed-actions { display: none; }

/* ================================================================ Profil */

.profile-card { display: flex; align-items: center; gap: 0.9rem; padding: 0.4rem 0 0.9rem; }
.profile-avatar {
  flex: none; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 1.4rem; color: #fff;
  background: radial-gradient(circle at 40% 35%, #f6d27d, #9c7426 60%, #2a1d08); box-shadow: 0 0 16px rgba(240, 201, 106, 0.35);
}
.profile-name { font-family: var(--font-story); font-size: 1.4rem; font-weight: 600; }
.profile-badges { display: flex; gap: 0.35rem; margin-top: 0.15rem; }
.plan-badge { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--surface-3); color: var(--text-soft); }
.plan-badge[data-plan="unlimited"] { background: rgba(240, 201, 106, 0.14); color: var(--gold); }
.plan-admin { background: var(--ether-soft); color: var(--ether); }
.wallet-card {
  display: flex; flex-direction: column; gap: 0.5rem; padding: 0.9rem 1rem; border-radius: 14px; margin-bottom: 1rem;
  border: 1px solid rgba(240, 201, 106, 0.35); background: linear-gradient(160deg, rgba(34, 26, 8, 0.6), rgba(16, 18, 26, 0.9));
}
.pw-total { font-size: 1.5rem; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.pw-split { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.pw-split dt { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.pw-split dd { margin: 0; font-size: 1.1rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.soon { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.05rem 0.4rem; border-radius: 4px; background: var(--ether-soft); color: var(--ether); }
.pw-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.pw-move { display: grid; grid-template-columns: 1fr auto auto; gap: 0.6rem; align-items: baseline; font-size: 0.88rem; }
.pw-plus { color: #b4ecc6; font-weight: 700; }
.pw-minus { color: #ffab9f; font-weight: 700; }
.danger-link { color: #ffab9f; align-self: flex-start; }
#view-profile .block { margin-bottom: 1rem; }

/* ================================================================ Jeu : menu de partie, fin */

.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.menu-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem; min-height: 72px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.85rem; font-weight: 650; cursor: pointer;
}
.menu-tile > span:first-child { font-size: 1.3rem; color: var(--ether); }
.over-banner { flex-direction: column; align-items: stretch; }
.over-actions { display: flex; gap: 0.5rem; }
.over-chapter { background: rgba(240, 201, 106, 0.1); border-color: rgba(240, 201, 106, 0.5); color: #f6e2b0; }
.over-chapter strong { color: var(--gold); }
.quest-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.quest { display: flex; flex-direction: column; padding: 0.5rem 0.7rem; border-radius: 2px; border: 1px solid rgba(127, 216, 255, 0.3); background: rgba(10, 22, 34, 0.6); }
.quest-name { font-weight: 700; }
.quest-meta { font-size: 0.8rem; color: var(--muted); }
.quest-en_cours { border-color: var(--ether); }
.quest-accomplie { border-color: rgba(240, 201, 106, 0.5); }
.quest-accomplie .quest-name { color: var(--gold); }
.journal-loading { color: var(--muted); text-align: center; font-style: italic; }
.composer-game input { min-height: 52px; border-radius: 26px; border-color: rgba(127, 216, 255, 0.35); }
.composer-game .btn-send { min-height: 52px; }
.mod-actions { flex-basis: 100%; display: flex; flex-direction: column; gap: 0.5rem; }
.mod-actions textarea { min-height: 3.2rem; }
.mod-actions .row-buttons { flex-wrap: wrap; }
#view-create .block { margin-top: 1.4rem; }
.pw-total { font-size: 1.25rem; line-height: 1.3; }
.exit-row { flex-wrap: wrap; }
.exit-row .field-error { flex-basis: 100%; padding-left: 4.8rem; }
.exit-row.has-error select { border-color: var(--danger); }

/* ================================================================ QA mobile (B9 et suivants) */

* { hyphens: none; }
.card-badge { position: absolute; left: 6px; right: auto; top: auto; bottom: 6px; max-width: calc(100% - 12px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 1; }
.cover.has-badge .cover-title { bottom: 2rem; }
.cover-title { overflow-wrap: anywhere; word-break: normal; }
.card-title, .resume-title, .story-title, .banner-title, .sub-title, .my-story-title { overflow-wrap: anywhere; }
.card-title { text-overflow: ellipsis; }
:root[data-kb="open"] .toast { bottom: auto; top: calc(var(--app-top, 0px) + var(--safe-top) + 4.5rem); }
.toast { max-width: min(92vw, 420px); }
.echo-tagline, .echo-banner { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer input::placeholder { text-overflow: ellipsis; }

.end-line .syswin { display: flex; flex-direction: column; gap: 0.5rem; }
.end-title { text-align: center; font-family: var(--font-story); font-size: 1.25rem; font-weight: 700; }
.end-text { font-weight: 500; }
.syswin-over { --sys: var(--danger); --sys-glow: rgba(234, 106, 95, 0.45); }
.end-line .row-buttons .btn { min-height: var(--tap); }

.ed-locked { padding: 0.6rem 0.8rem; border-radius: 10px; margin-bottom: 0.7rem; font-weight: 700;
  background: rgba(240, 201, 106, 0.1); border: 1px solid rgba(240, 201, 106, 0.45); color: var(--gold); }
.ed-exit-warn { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.8rem; }
.ed-exit-warn ul { margin: 0; padding-left: 1.1rem; }
.cost-badge.cost-off { background: rgba(234, 106, 95, 0.14); color: #ffab9f; }
.mod-preview { align-self: flex-start; }
