/* ══════════════════════════════════════════════════════════════════════
   HEROIK — feuille de style unique (mobile-first, offline, zéro CDN)
   Palette : nuit / pierre / or runique. Typo : piles système (Android OK).
   ══════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: "OpenDyslexic";
  src: url("assets/fonts/opendyslexic-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "OpenDyslexic";
  src: url("assets/fonts/opendyslexic-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --bg: #0a0a0c;
  --bg-2: #12100e;
  --stone: #1b1815;
  --stone-2: #241f19;
  --line: #3a3228;
  --gold: #c9a45c;
  --gold-hi: #e8c98a;
  --rune: #7fd8c8;
  --ink: #ece5d8;
  --ink-dim: #b9ae9c;
  --bad: #d2665a;
  --good: #7fbf7f;
  --radius: 14px;
  --tap: 56px;
  --font-title: "Cinzel", "Trajan Pro", Georgia, "Times New Roman", serif;
  --font-body: "EB Garamond", Georgia, Cambria, "Noto Serif", serif;
  --font-easy: "OpenDyslexic", "Comic Sans MS", Verdana, system-ui, sans-serif;
  --text-scale: 1;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }

html {
  font-size: calc(19px * var(--text-scale));
  height: 100%;
}
html[data-text="confort"] { --text-scale: .92; }
html[data-text="grand"] { --text-scale: 1.15; }
/* lecture facile : police pour dyslexiques, interlignage et espacement élargis */
html.easy-read { --font-body: var(--font-easy); }
html.easy-read body { line-height: 1.7; letter-spacing: .015em; word-spacing: .08em; }
html.easy-read .story p, html.easy-read .prologue-text p { line-height: 1.75; }

body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, #241a12 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
}

.skip {
  position: absolute; left: -9999px; top: 0; background: var(--gold); color: #111;
  padding: .6rem 1rem; z-index: 99; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

.hidden { display: none !important; }

/* ── barre du haut ─────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: calc(.45rem + var(--safe-t)) .7rem .45rem;
  background: rgba(10, 10, 12, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; min-width: 0; flex: 1 1 auto; overflow: hidden; }
.brand .mark { color: var(--gold); font-size: 1.1rem; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; overflow: hidden; }
.brand-txt b { font-family: var(--font-title); letter-spacing: .18em; font-size: .95rem; color: var(--gold-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-txt i {
  font-family: var(--font-ui); font-style: normal; font-size: .72rem; letter-spacing: .06em;
  color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tools { display: flex; align-items: center; gap: .3rem; flex: 0 0 auto; }

.langs { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang {
  font-family: var(--font-ui); font-size: .78rem; font-weight: 600; letter-spacing: .04em;
  background: transparent; color: var(--ink-dim); border: 0; padding: .45rem .55rem;
  min-width: 44px; min-height: 44px; cursor: pointer;
}
.lang[aria-pressed="true"] { background: var(--gold); color: #14100a; }
.lang:active { transform: scale(.97); }

.icon-btn {
  min-width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--stone); color: var(--ink); font-size: 1.05rem; cursor: pointer;
  display: grid; place-items: center;
}
.icon-btn[aria-pressed="true"] { border-color: var(--rune); color: var(--rune); box-shadow: 0 0 0 1px var(--rune) inset; }
.icon-btn[data-speaking="true"] { border-color: var(--gold); color: var(--gold-hi); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.icon-btn:active { transform: scale(.96); }

/* ── structure d'écran ─────────────────────────────────────────────── */
#app { position: relative; z-index: 1; outline: none; min-height: calc(100vh - 130px); }
.screen { max-width: 1100px; margin: 0 auto; padding: 1.1rem .9rem calc(2rem + var(--safe-b)); }
.screen h1, .screen h2, .screen h3 { font-family: var(--font-title); font-weight: 600; letter-spacing: .06em; }

.boot { min-height: 70vh; display: grid; place-content: center; justify-items: center; gap: 1rem; color: var(--ink-dim); }

.sigil {
  width: 92px; height: 92px; display: grid; place-items: center;
  transform: rotate(45deg); border: 2px solid var(--gold); border-radius: 14px;
  background: linear-gradient(160deg, #2a2118, #0f0c0a);
  box-shadow: 0 0 40px rgba(201, 164, 92, .28), inset 0 0 22px rgba(201, 164, 92, .18);
}
.sigil > span { transform: rotate(-45deg); font-family: var(--font-title); font-size: 2.3rem; color: var(--gold-hi); }

/* ── couverture ────────────────────────────────────────────────────── */
.cover { text-align: center; padding-top: .6rem; }
.cover-art {
  position: relative; border-radius: 18px; overflow: hidden; border: 1px solid var(--line);
  aspect-ratio: 16 / 10; background: #000;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}
.cover-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-art::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(70% 60% at 50% 40%, transparent 30%, rgba(0, 0, 0, .55) 100%);
}
.cover h1 {
  margin: 1rem 0 .2rem; font-size: clamp(1.9rem, 7vw, 3rem); line-height: 1.05;
  text-transform: uppercase; letter-spacing: .12em; color: var(--gold-hi);
  text-shadow: 0 2px 24px rgba(201, 164, 92, .3);
}
.cover .tome {
  margin: 0 0 .35rem; font-family: var(--font-title); font-size: clamp(.72rem, 2.6vw, .85rem);
  letter-spacing: .16em; text-transform: uppercase; color: var(--ink-dim);
}
.cover .tagline { margin: .2rem 0 1.1rem; color: var(--ink-dim); font-style: italic; }
#app h1:focus, #app h2:focus, #app h1[tabindex="-1"], #app h2[tabindex="-1"] { outline: none; }
.menu { display: grid; gap: .6rem; max-width: 420px; margin: 0 auto; }

/* ── boutons ───────────────────────────────────────────────────────── */
.btn {
  font-family: var(--font-ui); font-size: 1rem; font-weight: 600; letter-spacing: .02em;
  min-height: var(--tap); padding: .8rem 1.1rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--stone); color: var(--ink);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.985); }
.btn.primary {
  background: linear-gradient(180deg, #d9b674, #b8934a); border-color: #e2c68c; color: #17120b;
  box-shadow: 0 10px 24px rgba(201, 164, 92, .22);
}
.btn.ghost { background: transparent; color: var(--ink-dim); }
.btn.danger { border-color: #5a3130; color: #f0c7c0; background: #2a1a19; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .lang:focus-visible, .icon-btn:focus-visible, .choice:focus-visible,
.disc:focus-visible, .step:focus-visible { outline: 2px solid var(--rune); outline-offset: 2px; }

/* ── comment jouer ─────────────────────────────────────────────────── */
.steps { display: grid; gap: .6rem; margin: 1rem 0 1.4rem; }
.step {
  display: grid; grid-template-columns: 44px 1fr; gap: .8rem; align-items: start;
  background: linear-gradient(180deg, rgba(36, 31, 25, .9), rgba(20, 17, 14, .9));
  border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem .9rem;
}
.step .ico { font-size: 1.4rem; text-align: center; }
.step p { margin: 0; font-size: 1.02rem; }

/* ── fiche / création ──────────────────────────────────────────────── */
.lede { color: var(--ink-dim); font-size: 1.05rem; }
.rolls { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem; margin: .9rem 0; }
.roll-card {
  background: linear-gradient(180deg, rgba(36, 31, 25, .95), rgba(16, 13, 11, .95));
  border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; text-align: center;
}
.roll-card span { display: block; font-family: var(--font-ui); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-dim); }
.roll-card strong { display: block; font-family: var(--font-title); font-size: 1.9rem; color: var(--gold-hi); line-height: 1.2; }
.roll-card small { color: var(--ink-dim); font-size: .74rem; font-family: var(--font-ui); }

.field { margin: 1rem 0; }
.field label { display: block; font-family: var(--font-ui); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: .35rem; }
.field input {
  width: 100%; min-height: var(--tap); padding: .7rem .9rem; border-radius: 12px;
  border: 1px solid var(--line); background: #0e0c0a; color: var(--ink);
  font-family: var(--font-ui); font-size: 1rem;
}
.field input:focus { outline: 2px solid var(--rune); outline-offset: 1px; }

.disc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .55rem; margin: .8rem 0 1rem; }
.disc {
  text-align: left; min-height: 96px; padding: .75rem .8rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: rgba(24, 20, 16, .85); color: var(--ink);
  cursor: pointer; display: flex; flex-direction: column; gap: .25rem;
  font-family: var(--font-ui);
}
.disc .ico { font-size: 1.15rem; }
.disc strong { font-family: var(--font-title); font-size: .95rem; letter-spacing: .04em; color: var(--gold-hi); }
.disc span { font-size: .78rem; color: var(--ink-dim); line-height: 1.3; }
.disc.on { border-color: var(--gold); background: linear-gradient(180deg, rgba(72, 56, 32, .9), rgba(30, 23, 15, .9)); box-shadow: 0 0 0 1px var(--gold) inset; }
.disc[disabled] { opacity: .5; }
.hint { color: var(--ink-dim); font-size: .92rem; font-family: var(--font-ui); min-height: 1.2rem; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.actions .btn { flex: 1 1 180px; }

/* ── prologue ──────────────────────────────────────────────────────── */
.prologue-text p { margin: 0 0 .9rem; font-size: 1.06rem; }
.prologue-text p:first-of-type::first-letter {
  float: left; font-family: var(--font-title); font-size: 3.1rem; line-height: .84;
  padding: .1rem .45rem .1rem 0; color: var(--gold);
}

/* ── écran de jeu ──────────────────────────────────────────────────── */
.play { padding: 0 0 calc(.8rem + var(--safe-b)); max-width: 1100px; margin: 0 auto; }
.play-grid { display: grid; grid-template-rows: auto 1fr; }

.figure {
  position: relative; margin: 0; height: 40dvh; min-height: 190px; max-height: 46dvh;
  overflow: hidden; border-bottom: 1px solid var(--line); background: #07070a;
}
.figure img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .92; }
.figure::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .15) 0%, transparent 35%, rgba(10, 10, 12, .96) 100%);
}
.figure .seclabel {
  position: absolute; left: .8rem; bottom: .55rem; z-index: 2;
  display: flex; align-items: baseline; gap: .55rem;
}
.seclabel .num {
  font-family: var(--font-title); font-size: .95rem; letter-spacing: .1em; color: var(--gold);
  border: 1px solid rgba(201, 164, 92, .45); border-radius: 999px; padding: .16rem .6rem;
  background: rgba(10, 10, 12, .6);
}
.seclabel .name { font-family: var(--font-ui); font-size: .8rem; color: var(--ink-dim); }
.figure .toggle {
  position: absolute; right: .6rem; top: .6rem; z-index: 2;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(10, 10, 12, .55); color: #fff; font-size: 1rem; cursor: pointer;
}

.story { padding: .9rem 1rem 0; }
.story p { margin: 0 0 .8rem; font-size: 1.06rem; }
.story p.first::first-letter {
  float: left; font-family: var(--font-title); font-size: 2.9rem; line-height: .85;
  padding: .05rem .4rem .1rem 0; color: var(--gold);
}
.story-empty { color: var(--ink-dim); font-style: italic; }

.choices { display: grid; gap: .55rem; padding: .4rem 1rem 0; }
.choice {
  position: relative; text-align: left; min-height: 60px; padding: .8rem .9rem .8rem 2.9rem;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(34, 29, 23, .95), rgba(18, 15, 12, .95));
  color: var(--ink); font-family: var(--font-ui); font-size: 1rem; line-height: 1.35;
  cursor: pointer; display: flex; flex-direction: column; gap: .3rem;
  -webkit-tap-highlight-color: transparent;
}
.choice:active { transform: scale(.99); }
.choice .key {
  position: absolute; left: .75rem; top: .85rem; width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center; font-size: .8rem; font-weight: 700;
  background: rgba(201, 164, 92, .14); color: var(--gold-hi); border: 1px solid rgba(201, 164, 92, .35);
}
.choice .picto { font-size: 1rem; color: var(--gold); }
.choice .txt { display: block; }
.choice .tag {
  align-self: flex-start; font-size: .74rem; letter-spacing: .04em; padding: .12rem .45rem;
  border-radius: 999px; border: 1px solid var(--line); color: var(--ink-dim);
}
.choice .tag.fight { border-color: #6a4a3a; color: #f0b79a; }
.choice .tag.miss { border-color: #5a3130; color: #e4a49c; }
.choice .tag.req { border-color: #35504a; color: #a9d8ca; background: rgba(20, 44, 40, .35); }
.choice .picto svg { vertical-align: -2px; }
.choice .picto .lock.open { color: var(--rune); }
.choice .picto .lock.closed { color: var(--ink-dim); }
.choice.locked .picto .lock.closed { color: #e4a49c; }
.unit { color: var(--gold); font-size: .92em; margin-left: .25em; }
.choice.locked { opacity: .55; cursor: not-allowed; }
.choice .test-out { font-size: .82rem; color: var(--ink-dim); }

/* test / dé */
.test {
  margin: .8rem 1rem 0; padding: .9rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: rgba(20, 17, 14, .9);
}
.test-head { display: flex; align-items: center; gap: .7rem; }
.test .die {
  width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center;
  font-family: var(--font-title); font-size: 1.5rem; color: var(--gold-hi);
  border: 1px solid var(--gold); background: #14100b;
}
.test.bad .die { border-color: var(--bad); color: #f2b5ad; }
.test.good .die { border-color: var(--good); color: #b7e3b7; }
.test p { margin: .5rem 0 0; }

/* combat */
.combat { margin: .8rem 1rem 0; padding: .9rem; border-radius: var(--radius); border: 1px solid #5a3f2c; background: linear-gradient(180deg, rgba(46, 30, 22, .9), rgba(18, 13, 10, .95)); }
.combat-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; }
.combat-head .foe span { display: block; font-family: var(--font-ui); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim); }
.combat-head .foe strong { font-family: var(--font-title); color: #f0c8a0; letter-spacing: .04em; }
.combat-head .foe .stats { font-size: .8rem; }
.ratio { text-align: right; font-family: var(--font-ui); font-size: .8rem; color: var(--ink-dim); }
.ratio strong { display: block; font-family: var(--font-title); font-size: 1.5rem; color: var(--gold-hi); }

.bar-row { display: grid; grid-template-columns: 1fr auto; gap: .2rem .5rem; align-items: center; margin: .55rem 0; font-family: var(--font-ui); font-size: .78rem; color: var(--ink-dim); }
.bar { grid-column: 1 / -1; height: 10px; border-radius: 999px; background: #241d17; overflow: hidden; border: 1px solid #3a2c22; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #b8564b, #d98a5e); transition: width .25s ease; }
.bar.foe i { background: linear-gradient(90deg, #6a4a3a, #c98f5e); }
.bar-row b { color: var(--ink); font-variant-numeric: tabular-nums; }

.dice-area { display: flex; align-items: center; gap: .7rem; margin-top: .7rem; }
.dice {
  width: 58px; height: 58px; border-radius: 14px; display: grid; place-items: center;
  border: 1px solid var(--gold); background: #14100b; color: var(--gold-hi);
  font-family: var(--font-title); font-size: 1.5rem; font-variant-numeric: tabular-nums;
}
.dice.spin { animation: spin .12s linear infinite; }
@keyframes spin { 50% { transform: rotate(9deg) scale(1.04); } }
.combat-actions { display: grid; gap: .5rem; flex: 1; }
.combat-log { margin-top: .6rem; font-family: var(--font-ui); font-size: .8rem; color: var(--ink-dim); display: grid; gap: .2rem; }
.combat-log b { color: var(--ink); }
details.table { margin-top: .7rem; font-family: var(--font-ui); font-size: .78rem; color: var(--ink-dim); }
details.table summary { cursor: pointer; padding: .3rem 0; }
.tablerow { display: grid; grid-template-columns: repeat(5, 1fr); gap: .25rem; margin: .4rem 0; }
.tablerow span { background: #17130f; border: 1px solid #322a22; border-radius: 6px; padding: .2rem .3rem; text-align: center; font-variant-numeric: tabular-nums; }
.tablerow b { display: block; color: var(--gold); font-size: .72rem; }

/* ── fiche (drawer) ────────────────────────────────────────────────── */
.drawer {
  position: fixed; z-index: 60; inset: auto 0 0 0; max-height: 82dvh; overflow: auto;
  background: linear-gradient(180deg, #16120f 0%, #0b0a09 100%);
  border-top: 1px solid var(--gold); border-radius: 18px 18px 0 0;
  padding: 1rem 1rem calc(1.2rem + var(--safe-b)); box-shadow: 0 -20px 60px rgba(0, 0, 0, .6);
  animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: .4; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.drawer h3, .drawer h4 { font-family: var(--font-title); color: var(--gold-hi); margin: 0; }
.drawer h4 { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim); margin: .9rem 0 .4rem; font-family: var(--font-ui); }
.stat { display: flex; justify-content: space-between; gap: .5rem; padding: .35rem 0; border-bottom: 1px dashed #2c251e; font-family: var(--font-ui); font-size: .9rem; }
.stat b { color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  font-family: var(--font-ui); font-size: .78rem; padding: .28rem .55rem; border-radius: 999px;
  border: 1px solid var(--line); background: #191410; color: var(--ink-dim);
}
.chip.item { border-color: #4a3a28; color: #e2cba6; }
.log-lines { display: grid; gap: .18rem; font-family: var(--font-ui); font-size: .8rem; color: var(--ink-dim); }

/* ── menu ──────────────────────────────────────────────────────────── */
.menu-panel {
  position: fixed; z-index: 70; top: calc(56px + var(--safe-t)); right: .6rem; width: min(280px, 82vw);
  background: #14110e; border: 1px solid var(--line); border-radius: 14px; padding: .5rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .6); display: grid; gap: .25rem;
  animation: slideUp .16s ease;
}
.menu-panel button {
  text-align: left; background: transparent; border: 0; color: var(--ink); padding: .7rem .7rem;
  border-radius: 10px; font-family: var(--font-ui); font-size: .95rem; cursor: pointer; min-height: 44px;
}
.menu-panel button:hover, .menu-panel button:focus-visible { background: #201a14; outline: none; }
.menu-panel button.danger { color: #e4a49c; }
.menu-panel hr { border: 0; border-top: 1px solid var(--line); margin: .25rem 0; }

/* ── fin ───────────────────────────────────────────────────────────── */
.end { text-align: center; padding-top: 2rem; }
.end h2 { font-size: clamp(1.6rem, 6vw, 2.4rem); color: var(--gold-hi); margin: .8rem 0 .2rem; }
.end .tagline { color: var(--ink-dim); font-style: italic; margin-top: 0; }
.magic-text { text-align: left; margin: .8rem 0; font-size: 1.02rem; }
.magic-text p { margin: 0 0 .7rem; }
.end-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .5rem; margin: 1.2rem 0; }
.end-stats div { background: rgba(24, 20, 16, .9); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .4rem; }
.end-stats b { display: block; font-family: var(--font-title); font-size: 1.5rem; color: var(--gold-hi); }
.end-stats span { font-family: var(--font-ui); font-size: .72rem; color: var(--ink-dim); }
.epilogue { text-align: left; background: rgba(20, 17, 14, .7); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.end.win .sigil { border-color: var(--gold); }
.end.lose .sigil { border-color: #6a3a36; box-shadow: 0 0 40px rgba(180, 80, 70, .25); }

/* ── divers ────────────────────────────────────────────────────────── */
.banner {
  position: sticky; top: 0; z-index: 25; background: #2a2118; color: #f0dcb8;
  border-bottom: 1px solid #4a3a24; padding: .5rem .9rem;
  font-family: var(--font-ui); font-size: .82rem; text-align: center;
}
.toast {
  position: fixed; left: 50%; bottom: calc(1.2rem + var(--safe-b)); transform: translate(-50%, 12px);
  background: #241f19; color: var(--ink); border: 1px solid var(--line); border-radius: 999px;
  padding: .55rem 1rem; font-family: var(--font-ui); font-size: .85rem; opacity: 0;
  transition: opacity .2s, transform .2s; z-index: 90; pointer-events: none; max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.footer {
  position: relative; z-index: 1; padding: 1.4rem .9rem calc(1.4rem + var(--safe-b));
  color: #948a76; font-family: var(--font-ui); font-size: .74rem; line-height: 1.5; text-align: center;
  border-top: 1px solid #1d1913; margin-top: 1rem;
}
.share {
  display: inline-block; margin: .2rem 0 .6rem; padding: .2rem .55rem; border-radius: 999px;
  border: 1px solid #35504a; background: #10201d; color: #a9d8ca;
  font-family: var(--font-ui); font-size: .72rem; letter-spacing: .06em;
}
.disclaimer { color: #948a76; font-family: var(--font-ui); font-size: .74rem; margin-top: 1.1rem; }

/* ── desktop ───────────────────────────────────────────────────────── */
@media (min-width: 900px) {
  html { font-size: calc(20px * var(--text-scale)); }
  .screen { padding: 1.6rem 1.5rem 3rem; }
  .cover { display: grid; grid-template-columns: 1.15fr .85fr; gap: 2rem; align-items: center; text-align: left; }
  .cover h1 { font-size: 3.2rem; }
  .menu { margin: 0; max-width: none; }
  .play { padding-bottom: 1.5rem; }
  .figure { height: 40dvh; max-height: 380px; border-radius: 0 0 18px 18px; }
  .play-grid { grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: auto 1fr; column-gap: 1.2rem; }
  .figure { grid-column: 1 / -1; }
  .story { padding: 1rem 1.4rem 0; }
  .choices { padding: .6rem 1.4rem 0; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .test, .combat { margin: .9rem 1.4rem 0; }
  .sheet-aside { position: sticky; top: 5rem; align-self: start; background: rgba(20, 17, 14, .7); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-top: 1rem; }
  /* la fiche reste un panneau flottant, centré et plus large sur desktop */
  .drawer {
    left: 50%; right: auto; transform: translateX(-50%);
    width: min(620px, 92vw); max-height: 78dvh; animation: none;
    border: 1px solid var(--line); border-radius: 18px;
  }
}

@media (max-width: 430px) {
  /* sur petit écran la marque se réduit au sigle : les cibles tactiles gardent 44px */
  .brand-txt { display: none; }
  .brand .mark { font-size: 1.3rem; }
  .lang { padding: .45rem .45rem; }  /* la cible reste ≥ 44px : cf. .lang plus haut */
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ── fiche : suivi du vital et inventaire (TASK-1 / TASK-2) ─────────── */
.tracker { display: flex; flex-wrap: wrap; gap: .3rem; margin: .55rem 0 .35rem; }
.pip {
  width: 44px; height: 44px; border-radius: 11px; border: 1px solid var(--line);
  background: #14100b; color: #8a7355; font-size: 1.05rem; line-height: 1; cursor: pointer;
  display: grid; place-items: center; -webkit-tap-highlight-color: transparent;
}
.pip.on { color: #e2705f; border-color: #6a3a36; background: #241312; }
.tracker.pv .pip.on { color: #7fbf7f; border-color: #35502f; background: #12200f; }
.pip:active { transform: scale(.94); }

.stepper { display: flex; align-items: center; gap: .55rem; margin: .5rem 0 .3rem; }
.step-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: #17130f; color: var(--gold-hi); font-size: 1.25rem; cursor: pointer;
  display: grid; place-items: center;
}
.step-btn:active { transform: scale(.95); }
.step-val { font-family: var(--font-ui); font-variant-numeric: tabular-nums; color: var(--ink); min-width: 76px; text-align: center; }

.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .4rem; }
.slot {
  min-height: 70px; border-radius: 12px; padding: .3rem; border: 1px dashed var(--line);
  background: #12100f; color: var(--ink-dim);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem;
  font-family: var(--font-ui); font-size: .72rem; line-height: 1.15; text-align: center;
}
.slot.filled { border-style: solid; border-color: #4a3a28; color: var(--ink); cursor: pointer; }
.slot.filled:active { transform: scale(.97); }
.slot .ico { font-size: 1.15rem; }
.slot .lbl { word-break: break-word; }
.slot.empty .ico { color: #3a3228; }
.cap { font-style: normal; text-transform: none; letter-spacing: 0; color: var(--ink-dim); font-size: .72rem; margin-left: .3rem; }
.chip.kw { border-color: #3d4a44; color: #a9d8ca; }

.notice {
  font-family: var(--font-ui); font-size: .86rem; color: #f0c8a0;
  background: #3c2614; border: 1px solid #5a3f2c; border-radius: 10px;
  padding: .55rem .75rem; margin: .6rem 0 0;
}

@media (max-width: 360px) {
  .slots { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
  /* cibles tactiles : jamais sous 44px, on wrap */
  .tracker { gap: .25rem; }
}

/* téléphone en paysage : l'illustration ne doit pas manger l'écran */
@media (orientation: landscape) and (max-height: 520px) {
  .figure { height: 34dvh; min-height: 120px; max-height: 190px; }
  .story { padding-top: .7rem; }
  .screen { padding-top: .8rem; padding-bottom: calc(1rem + var(--safe-b)); }
  .cover { display: grid; grid-template-columns: .9fr 1.1fr; gap: 1.2rem; align-items: center; text-align: left; padding: 1rem; }
  .cover .cover-art { aspect-ratio: 16 / 9; }
  .cover h1 { font-size: 1.7rem; }
  .cover .menu { gap: .4rem; }
  .btn { min-height: 46px; padding: .55rem .9rem; }
  .langs { display: flex; }
}

/* barre du haut étroite : le sélecteur de langue passe dans le menu */
@media (max-width: 359px) {
  .topbar { gap: .25rem; padding-left: .5rem; padding-right: .5rem; }
  .langs { display: none; }
  .brand .mark { display: none; }
  .tools { gap: .2rem; }
}

/* ── menu : sélecteur de langue (aussi accessible en ≤359px) ────────── */
.menu-langs { display: flex; gap: .35rem; padding: .3rem .4rem; }
.menu-langs .lang {
  flex: 1; min-height: 44px; border: 1px solid var(--line); border-radius: 10px;
  background: #17130f; color: var(--ink-dim);
}
.menu-langs .lang[aria-pressed="true"] { background: var(--gold); color: #14100a; border-color: var(--gold); }
.menu-sep { font-family: var(--font-ui); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim); padding: .45rem .7rem 0; }

/* ── menu : accessibilité lecture (TASK-4) ──────────────────────────── */
.menu-opt {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  min-height: 44px; padding: .55rem .7rem; border-radius: 10px;
  font-family: var(--font-ui); font-size: .92rem; color: var(--ink);
}
.menu-opt[aria-pressed="true"] { background: #221a12; color: var(--gold-hi); }
.menu-opt .state { font-size: .72rem; letter-spacing: .06em; color: var(--ink-dim); }
.menu-opt[aria-pressed="true"] .state { color: var(--gold); }
.menu-sizes { display: flex; gap: .3rem; padding: .2rem .4rem .4rem; }
.menu-sizes button {
  flex: 1; min-height: 44px; border-radius: 10px; border: 1px solid var(--line);
  background: #17130f; color: var(--ink-dim); font-family: var(--font-ui); cursor: pointer;
}
.menu-sizes button[aria-pressed="true"] { background: var(--gold); color: #14100a; border-color: var(--gold); }
.menu-sizes button:nth-child(1) { font-size: .82rem; }
.menu-sizes button:nth-child(3) { font-size: 1.05rem; }
