/* Naheumess · thème « Donjon » (sombre) et « Parchemin » (clair) */

@font-face {
  font-family: 'OpenDyslexic';
  src: url('https://cdn.jsdelivr.net/npm/@fontsource/opendyslexic@5.2.5/files/opendyslexic-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'OpenDyslexic';
  src: url('https://cdn.jsdelivr.net/npm/@fontsource/opendyslexic@5.2.5/files/opendyslexic-latin-700-normal.woff2') format('woff2');
  font-weight: 700; font-display: swap;
}

:root {
  --text-scale: 1;
  --f-display: 'Unbounded', 'Segoe UI', system-ui, sans-serif;
  --f-body: 'Atkinson Hyperlegible Next', 'Atkinson Hyperlegible', 'Segoe UI', system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, monospace;
  --f-pixel: 'JetBrains Mono', ui-monospace, monospace;

  --bg: #0b0912;
  --bg-2: #140f22;
  --surface: rgba(30, 23, 48, .58);
  --surface-2: rgba(44, 34, 70, .55);
  --surface-solid: #1a1429;
  --border: rgba(255, 255, 255, .09);
  --border-hi: rgba(255, 255, 255, .18);
  --text: #f4effe;
  --muted: #a99fc4;
  --gold: #f5c451;
  --arcane: #8b5cf6;
  --ember: #ff7a45;
  --accent: var(--gold);
  --hr: #ff4d6d;
  --en: #4cc9f0;
  --good: #34d399;
  --bad: #fb7185;
  --warn: #fbbf24;
  --c-grimoire: #a78bfa;
  --c-ecoute: #2dd4bf;
  --c-oral: #f472b6;
  --c-ecrit: #fbbf24;
  --ribbon: #7c3aed;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, .7);
  --glow: 0 0 0 1px rgba(255, 255, 255, .04) inset, 0 1px 0 rgba(255, 255, 255, .08) inset;
  --blur: blur(18px) saturate(140%);
  color-scheme: dark;
}

[data-theme='parchemin'] {
  --bg: #f4ecdc;
  --bg-2: #eadfc8;
  --surface: rgba(255, 251, 242, .72);
  --surface-2: rgba(250, 242, 226, .85);
  --surface-solid: #fffaf0;
  --border: rgba(80, 52, 20, .14);
  --border-hi: rgba(80, 52, 20, .28);
  --text: #2a1f14;
  --muted: #6d5a43;
  --gold: #b7791f;
  --arcane: #6d28d9;
  --ember: #c2410c;
  --hr: #c8102e;
  --en: #0369a1;
  --good: #047857;
  --bad: #be123c;
  --warn: #a16207;
  --c-grimoire: #6d28d9;
  --c-ecoute: #0f766e;
  --c-oral: #be185d;
  --c-ecrit: #a16207;
  --shadow: 0 18px 50px -24px rgba(80, 50, 10, .45);
  --glow: 0 1px 0 rgba(255, 255, 255, .7) inset;
  color-scheme: light;
}

.dys { --f-body: 'OpenDyslexic', 'Atkinson Hyperlegible Next', sans-serif; }
.dys body { letter-spacing: .01em; word-spacing: .08em; }

* { box-sizing: border-box; }
html { font-size: calc(100% * var(--text-scale)); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
.no-motion, .no-motion * { scroll-behavior: auto !important; }
body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(1200px 700px at 85% -10%, color-mix(in srgb, var(--arcane) 22%, transparent), transparent 60%),
              radial-gradient(900px 600px at -10% 110%, color-mix(in srgb, var(--ember) 16%, transparent), transparent 60%),
              var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  -webkit-font-smoothing: antialiased;
}
[data-theme='parchemin'] body {
  background: radial-gradient(1000px 600px at 90% -10%, rgba(183, 121, 31, .18), transparent 60%),
              radial-gradient(800px 600px at 0% 110%, rgba(109, 40, 217, .1), transparent 60%),
              var(--bg);
}
#bg { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.aurora {
  position: fixed; inset: -20%; z-index: 0; pointer-events: none; opacity: .35;
  background: conic-gradient(from 180deg at 50% 50%, transparent, color-mix(in srgb, var(--arcane) 30%, transparent), transparent 30%, color-mix(in srgb, var(--hr) 18%, transparent), transparent 60%, color-mix(in srgb, var(--en) 18%, transparent), transparent);
  filter: blur(90px);
  animation: drift 40s linear infinite;
}
[data-theme='parchemin'] .aurora { opacity: .12; }
@keyframes drift { to { transform: rotate(360deg); } }

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
.skip { position: absolute; left: -999px; top: 0; z-index: 99; background: var(--gold); color: #000; padding: .6rem 1rem; border-radius: 0 0 12px 0; }
.skip:focus { left: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Rail ---------- */
.rail {
  position: sticky; top: 0; height: 100dvh; z-index: 5;
  display: flex; flex-direction: column; gap: 1.2rem;
  padding: 1.4rem 1rem;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 65%, transparent);
  backdrop-filter: var(--blur);
}
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; padding: .2rem .4rem; }
.brand-mark { width: 46px; height: 46px; flex: none; filter: drop-shadow(0 0 12px rgba(245, 196, 81, .35)); transition: transform .5s cubic-bezier(.2, .8, .2, 1.4); }
.brand:hover .brand-mark { transform: rotate(60deg) scale(1.06); }
.brand-name { font-family: var(--f-display); font-weight: 900; font-size: 1.2rem; letter-spacing: -.02em; line-height: 1.05;
  background: linear-gradient(100deg, var(--gold), var(--ember) 50%, var(--arcane)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-name small { display: block; font-family: var(--f-mono); font-weight: 500; font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); -webkit-text-fill-color: var(--muted); }

.hud { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.hud-level { display: flex; align-items: center; gap: .65rem; text-decoration: none; width: 100%; padding: .55rem .7rem; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--glow); }
.hud-rank { display: grid; line-height: 1.2; font-size: .85rem; font-weight: 600; }
.hud-rank small { font-family: var(--f-mono); color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; }
.ring { --p: 0; flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--gold) calc(var(--p) * 1turn), color-mix(in srgb, var(--text) 10%, transparent) 0); position: relative; }
.ring::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: var(--surface-solid); }
.ring b { position: relative; font-family: var(--f-pixel); font-size: 1.2rem; }
.hud-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); font-family: var(--f-mono); font-weight: 700; font-size: .9rem; }

.nav { display: grid; gap: .3rem; margin-top: .4rem; }
.nav a { display: flex; align-items: center; gap: .8rem; padding: .7rem .9rem; border-radius: var(--radius-sm); text-decoration: none; color: var(--muted); font-weight: 600; transition: background .2s, color .2s, transform .2s; position: relative; }
.nav a span { font-size: 1.25rem; width: 1.6rem; text-align: center; transition: transform .3s cubic-bezier(.2, .8, .2, 1.6); }
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a:hover span { transform: scale(1.2) rotate(-8deg); }
.nav a[aria-current='page'] { color: var(--text); background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 18%, transparent), transparent); }
.nav a[aria-current='page']::before { content: ''; position: absolute; left: -1rem; top: 20%; bottom: 20%; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold); box-shadow: 0 0 14px var(--gold); }

/* ---------- Page ---------- */
main { position: relative; z-index: 1; padding: clamp(1rem, 3vw, 2.6rem); max-width: 1240px; width: 100%; margin: 0 auto; display: grid; gap: 1.4rem; align-content: start; outline: none; }
.glass {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--glow), var(--shadow);
  backdrop-filter: var(--blur);
  padding: clamp(1.1rem, 2.4vw, 1.7rem);
}
.glass::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, .07), transparent 40%); mix-blend-mode: overlay; }

h1, h2, h3, h4 { margin: 0; line-height: 1.15; }
.display { font-family: var(--f-display); font-weight: 900; letter-spacing: -.035em; font-size: clamp(1.9rem, 4.4vw, 3.3rem); }
.h3 { font-family: var(--f-display); font-weight: 700; font-size: 1.12rem; letter-spacing: -.01em; margin-bottom: .8rem; }
.h4 { font-family: var(--f-display); font-size: .95rem; margin: 1rem 0 .4rem; }
.eyebrow, .kicker { margin: 0 0 .35rem; font-family: var(--f-mono); font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.lead { font-size: 1.12rem; color: color-mix(in srgb, var(--text) 82%, var(--muted)); max-width: 62ch; margin: .6rem 0 0; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; justify-content: center; }
.section-title { font-family: var(--f-display); font-size: 1.05rem; letter-spacing: .02em; margin: .6rem 0 .1rem; display: flex; align-items: center; gap: .6rem; }
.section-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border-hi), transparent); }
.page-head { display: grid; gap: .3rem; padding-top: .4rem; }
.back { text-decoration: none; color: var(--muted); font-weight: 600; font-size: .95rem; justify-self: start; }
.back:hover { color: var(--text); }
.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: var(--radius-sm); padding: .7rem 1rem; margin: .6rem 0; }
.hint { color: var(--warn); font-weight: 600; }

/* ---------- Boutons ---------- */
.btn {
  --b: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .72rem 1.2rem; border-radius: 999px; border: 1px solid var(--border-hi);
  background: var(--b); color: var(--text); text-decoration: none; font-weight: 700; cursor: pointer;
  transition: transform .18s cubic-bezier(.2, .8, .2, 1.4), box-shadow .2s, background .2s, filter .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 28px -10px rgba(0, 0, 0, .6); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { border: 0; color: #1b1205; background: linear-gradient(110deg, #ffd978, var(--gold) 40%, #ff9b54); box-shadow: 0 8px 30px -8px color-mix(in srgb, var(--gold) 70%, transparent); }
[data-theme='parchemin'] .btn.primary { color: #fff; background: linear-gradient(110deg, #d69e2e, var(--gold) 50%, #c2410c); }
.btn.primary:hover { filter: brightness(1.07); box-shadow: 0 14px 40px -10px color-mix(in srgb, var(--gold) 80%, transparent); }
.btn.danger { border: 0; color: #fff; background: linear-gradient(110deg, #ff4d6d, #c026d3); box-shadow: 0 8px 30px -10px rgba(255, 77, 109, .7); }
.btn.ghost { background: transparent; }
.btn.big { padding: .95rem 1.6rem; font-size: 1.08rem; }
.btn.small { padding: .4rem .8rem; font-size: .88rem; }
.icon-btn { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; display: inline-grid; place-items: center; font-size: 1rem; transition: transform .2s, background .2s; }
.icon-btn:hover { transform: scale(1.1); background: color-mix(in srgb, var(--gold) 20%, var(--surface-2)); }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .75rem; border-radius: 99px; border: 1px solid var(--border-hi); font-family: var(--f-mono); font-size: .78rem; font-weight: 700; color: var(--muted); width: fit-content; }
.badge { padding: .25rem .6rem; border-radius: 99px; font-size: .72rem; font-weight: 700; font-family: var(--f-mono); text-transform: uppercase; letter-spacing: .06em; background: linear-gradient(110deg, #ff4d6d, #c026d3); color: #fff; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(255, 77, 109, 0); transform: scale(1.06); } 0% { box-shadow: 0 0 0 0 rgba(255, 77, 109, .6); } }

.bar { display: block; height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--text) 10%, transparent); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--arcane), var(--gold)); transition: width .8s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 0 12px color-mix(in srgb, var(--gold) 60%, transparent); }
.bar.big { height: 12px; margin-top: .8rem; }
.bar.full > span { background: linear-gradient(90deg, var(--good), #a7f3d0); }

/* ---------- Accueil ---------- */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: center; overflow: hidden; }
.hero::before { content: ''; position: absolute; right: -10%; top: -60%; width: 60%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--gold) 25%, transparent), transparent 65%); pointer-events: none; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; margin-top: 1.3rem; }
.quest-orb { width: clamp(130px, 18vw, 180px); aspect-ratio: 1; position: relative; display: grid; place-items: center; }
.quest-orb svg, .hourglass svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.orb-bg { fill: none; stroke: color-mix(in srgb, var(--text) 10%, transparent); stroke-width: 9; }
.orb-fg { fill: none; stroke: var(--gold); stroke-width: 9; stroke-linecap: round; filter: drop-shadow(0 0 8px var(--gold)); transition: stroke-dasharray 1s cubic-bezier(.2, .8, .2, 1); }
.quest-orb div { display: grid; text-align: center; line-height: 1; }
.quest-orb b { font-family: var(--f-pixel); font-size: 2.6rem; }
.quest-orb small { font-size: 1.2rem; color: var(--muted); }
.quest-orb span { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: .3rem; }

.boards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
.board header { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; }
.board header .h3 { margin: 0; }
.board header small { color: var(--muted); font-family: var(--f-mono); font-size: .76rem; }
.flag { font-size: 2rem; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .4)); }
.board-count { margin-left: auto; font-family: var(--f-pixel); font-size: 1.4rem; color: var(--muted); }
.lang-hr { --lang: var(--hr); }
.lang-en { --lang: var(--en); }
.board { border-top: 2px solid color-mix(in srgb, var(--lang) 70%, transparent); }
.board::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(500px 200px at 0% 0%, color-mix(in srgb, var(--lang) 16%, transparent), transparent 70%); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.tile {
  --c: var(--gold);
  position: relative; display: grid; gap: .15rem; padding: 1rem; min-height: 132px;
  border-radius: 18px; text-decoration: none; overflow: hidden;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 16%, var(--surface-2)), var(--surface-2) 70%);
  border: 1px solid color-mix(in srgb, var(--c) 30%, var(--border));
  transition: transform .25s cubic-bezier(.2, .8, .2, 1.3), box-shadow .25s, border-color .25s;
}
.tile:hover { transform: translateY(-4px) rotate(-.4deg); border-color: var(--c); box-shadow: 0 16px 40px -14px color-mix(in srgb, var(--c) 70%, transparent); }
.tile-ico { font-size: 1.7rem; transition: transform .35s cubic-bezier(.2, .8, .2, 1.6); }
.tile:hover .tile-ico { transform: scale(1.25) rotate(-10deg); }
.tile-name { font-family: var(--f-display); font-weight: 700; font-size: 1rem; }
.tile small { color: var(--muted); font-size: .82rem; }
.tile-state { margin-top: auto; justify-self: start; font-family: var(--f-mono); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: .2rem .55rem; border-radius: 99px; border: 1px dashed color-mix(in srgb, var(--c) 60%, transparent); color: var(--c); }
.tile.done { background: linear-gradient(160deg, color-mix(in srgb, var(--good) 22%, var(--surface-2)), var(--surface-2) 75%); border-color: color-mix(in srgb, var(--good) 50%, transparent); }
.tile.done .tile-state { border-style: solid; background: var(--good); color: #052e1c; border-color: var(--good); }
.tile.done::after { content: '✓'; position: absolute; right: -6px; top: -14px; font-family: var(--f-display); font-weight: 900; font-size: 5rem; color: color-mix(in srgb, var(--good) 18%, transparent); }

.bento { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 1.2rem; }
.dice-card, .streak-card { display: grid; justify-items: center; text-align: center; align-content: start; gap: .5rem; }
.dice-card .h3, .streak-card .h3 { justify-self: start; }
.d20, .mini-d20 {
  width: 104px; aspect-ratio: 1; display: grid; place-items: center;
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  background: linear-gradient(145deg, #a78bfa, #6d28d9 55%, #2e1065);
  color: #fff; font-family: var(--f-pixel); font-weight: 700; font-size: 2.3rem;
  box-shadow: inset 0 0 20px rgba(255, 255, 255, .25);
  position: relative;
}
.d20::before { content: ''; position: absolute; inset: 22% 18% 30%; clip-path: polygon(50% 0, 100% 100%, 0 100%); background: rgba(255, 255, 255, .1); }
.d20 span, .mini-d20 span { position: relative; text-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
.d20.idle { animation: float 3s ease-in-out infinite; }
.d20.rolling { animation: roll .25s linear infinite; }
.d20.crit, .mini-d20.crit { background: linear-gradient(145deg, #fff3c4, var(--gold) 45%, #b45309); color: #1b1205; filter: drop-shadow(0 0 18px var(--gold)); }
.d20.fumble, .mini-d20.fumble { background: linear-gradient(145deg, #fda4af, #be123c 55%, #4c0519); }
@keyframes float { 50% { transform: translateY(-6px) rotate(4deg); } }
@keyframes roll { to { transform: rotate(360deg) scale(.92); } }
.flame { font-size: 3rem; filter: grayscale(1) opacity(.4); }
.flame.lit { filter: drop-shadow(0 0 16px var(--ember)); animation: flicker 2.2s ease-in-out infinite; }
@keyframes flicker { 30% { transform: scale(1.06) rotate(-3deg); } 60% { transform: scale(.97) rotate(2deg); } }
.big-num { font-family: var(--f-pixel); font-size: 2.4rem; margin: 0; line-height: 1; }
.big-num small { font-family: var(--f-body); font-size: 1rem; color: var(--muted); }
.heatmap { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; width: 100%; max-width: 230px; margin-top: .4rem; }
.hm { aspect-ratio: 1; border-radius: 5px; background: color-mix(in srgb, var(--gold) calc(var(--p) * 90%), color-mix(in srgb, var(--text) 8%, transparent)); }
.floors-card { display: grid; gap: .7rem; align-content: start; }
.floor-mini { display: flex; align-items: center; gap: .9rem; padding: .8rem; border-radius: 16px; text-decoration: none; background: var(--surface-2); border: 1px solid var(--border); transition: transform .2s, border-color .2s; }
.floor-mini:hover { transform: translateX(4px); border-color: var(--border-hi); }
.fm-glyph { font-size: 1.8rem; }
.fm-body { flex: 1; display: grid; gap: .25rem; }
.fm-body small { font-family: var(--f-mono); color: var(--muted); font-size: .74rem; }

/* ---------- Carte du donjon ---------- */
.seg { display: inline-flex; flex-wrap: wrap; gap: .3rem; padding: .3rem; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); width: fit-content; margin-top: .8rem; }
.seg a, .seg label { padding: .5rem 1rem; border-radius: 99px; text-decoration: none; font-weight: 700; cursor: pointer; color: var(--muted); display: inline-flex; gap: .4rem; align-items: center; }
.seg a[aria-selected='true'], .seg label:has(input:checked) { background: var(--text); color: var(--bg); }
.seg label small { font-weight: 400; opacity: .7; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:focus-visible) { outline: 3px solid var(--gold); }
.dungeon { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; position: relative; }
.dungeon::before { content: ''; position: absolute; left: 44px; top: 30px; bottom: 30px; width: 3px; border-radius: 3px;
  background: linear-gradient(var(--lang), var(--arcane), transparent); opacity: .45; }
.floor-node a { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 1rem; text-decoration: none; padding: 1rem 1.2rem; transition: transform .25s cubic-bezier(.2, .8, .2, 1.3), border-color .25s; }
.floor-node a[href]:hover { transform: translateX(8px); border-color: color-mix(in srgb, var(--lang) 60%, transparent); }
.fn-num { font-family: var(--f-pixel); font-size: 1.1rem; color: var(--muted); width: 2ch; }
.fn-glyph { width: 52px; aspect-ratio: 1; display: grid; place-items: center; font-size: 1.6rem; border-radius: 16px; background: var(--surface-solid); border: 1px solid var(--border-hi); position: relative; z-index: 1; }
.floor-node.current .fn-glyph { border-color: var(--lang); box-shadow: 0 0 0 4px color-mix(in srgb, var(--lang) 25%, transparent), 0 0 24px color-mix(in srgb, var(--lang) 50%, transparent); }
.fn-body { display: grid; gap: .25rem; }
.fn-body b { font-family: var(--f-display); font-size: 1.05rem; }
.fn-body small { color: var(--muted); }
.floor-node.locked { opacity: .5; }
.floor-node.locked a { cursor: not-allowed; filter: saturate(.3); }
.boss-name { font-family: var(--f-mono); font-size: .76rem; color: var(--muted); text-align: right; display: block; max-width: 14ch; }

.floor-hero { display: grid; grid-template-columns: auto 1fr auto; gap: 1.6rem; align-items: center; border-top: 2px solid color-mix(in srgb, var(--lang) 70%, transparent); }
.fh-glyph { font-size: 4rem; filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .45)); }
.stats-row { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-top: .7rem; color: var(--muted); font-size: .95rem; }
.stats-row b { color: var(--text); font-family: var(--f-mono); }
.stats-row.big { font-size: 1rem; margin-bottom: 1rem; }
.stats-row.big b { font-size: 1.5rem; display: block; font-family: var(--f-pixel); }
.boss-box { display: grid; justify-items: center; text-align: center; gap: .35rem; padding: 1rem; border-radius: 18px; background: var(--surface-solid); border: 1px solid var(--border-hi); min-width: 190px; }
.boss-box.ready { border-color: #ff4d6d; box-shadow: 0 0 30px -6px rgba(255, 77, 109, .6); }
.boss-box small { color: var(--muted); }
.skull { font-size: 2.6rem; filter: drop-shadow(0 0 10px rgba(255, 77, 109, .5)); }
.skull.big { font-size: 7rem; }
.mode-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.mode { display: grid; gap: .1rem; text-decoration: none; padding: 1rem 1.1rem; transition: transform .2s, border-color .2s; }
.mode span { font-size: 1.6rem; }
.mode b { font-family: var(--f-display); font-size: .95rem; }
.mode small { color: var(--muted); font-size: .84rem; }
.mode:hover { transform: translateY(-3px); border-color: var(--border-hi); }
.two-col { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.2rem; }
.parchment { background: linear-gradient(170deg, rgba(245, 196, 81, .1), var(--surface) 60%); }
.prose p { margin: .4rem 0; }
.prose i { color: var(--gold); font-style: normal; font-family: var(--f-mono); font-size: .95em; }
.transcript summary { cursor: pointer; color: var(--muted); font-weight: 600; margin-top: .8rem; }
.line { margin: .5rem 0; display: grid; grid-template-columns: auto 1fr; gap: 0 .6rem; align-items: start; }
.line small { grid-column: 2; color: var(--muted); }
.transcript.open .line { grid-template-columns: auto 1fr; }
.line.who-A b, .bubble.who-A { color: var(--lang); }
.card-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.card-list li { display: grid; grid-template-columns: auto 1fr 1fr auto; align-items: center; gap: .8rem; padding: .55rem .7rem; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.card-list li small { color: var(--muted); }
.card-list .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); opacity: .4; }
.cl-ok .dot { background: var(--good); opacity: 1; box-shadow: 0 0 10px var(--good); }
.cl-wip .dot { background: var(--gold); opacity: 1; }
.form-row { display: flex; flex-wrap: wrap; gap: .6rem; margin: .8rem 0; }
.form-row > input, .form-row > select { flex: 1 1 200px; }
input:not([type]), input[type=text], input[type=password], input[type=email], select, textarea {
  background: var(--surface-solid); border: 1px solid var(--border-hi); border-radius: 14px; padding: .75rem 1rem; width: 100%;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 22%, transparent); }
textarea { resize: vertical; line-height: 1.6; font-size: 1.12rem; }

/* ---------- Trophées ---------- */
.medal-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .5rem 0 1rem; }
.medal-row figure { margin: 0; display: grid; justify-items: center; font-family: var(--f-mono); font-size: .72rem; color: var(--muted); }
.medal { filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .45)); transition: transform .3s cubic-bezier(.2, .8, .2, 1.6); }
.medal:hover { transform: scale(1.12) rotate(-6deg); }
.medal.locked { opacity: .45; filter: none; }
.medal.tier-legende { filter: drop-shadow(0 0 14px #c084fc); animation: shimmer 3s ease-in-out infinite; }
.medal.tier-or { filter: drop-shadow(0 0 12px rgba(245, 196, 81, .7)); }
@keyframes shimmer { 50% { filter: drop-shadow(0 0 22px #f0abfc) hue-rotate(25deg); } }
.trophy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .8rem; }
.trophy { display: grid; gap: .25rem; align-content: start; padding: 1rem 1.1rem; opacity: .7; }
.trophy.got { opacity: 1; border-color: color-mix(in srgb, var(--gold) 45%, transparent); background: linear-gradient(160deg, color-mix(in srgb, var(--gold) 14%, var(--surface)), var(--surface)); }
.t-ico { font-size: 2rem; }
.trophy:not(.got) .t-ico { filter: grayscale(1); }
.trophy b { font-family: var(--f-display); font-size: .95rem; }
.trophy small { color: var(--muted); font-size: .85rem; }
.t-date { font-family: var(--f-mono); font-size: .72rem; color: var(--muted); }
.ranks { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .5rem; }
.ranks li { padding: .6rem .9rem; border-radius: 12px; background: var(--surface-2); color: var(--muted); }
.ranks li b { font-family: var(--f-mono); margin-right: .4rem; }
.ranks li.reached { color: var(--text); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); }

/* ---------- Fiche ---------- */
.xpbar { position: relative; height: 34px; border-radius: 99px; background: color-mix(in srgb, var(--text) 8%, transparent); overflow: hidden; }
.xpbar span { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(45deg, var(--arcane) 0 12px, color-mix(in srgb, var(--arcane) 80%, #fff) 12px 24px); border-radius: inherit; animation: stripes 1.2s linear infinite; }
@keyframes stripes { to { background-position: 34px 0; } }
.xpbar b { position: relative; display: grid; place-items: center; height: 100%; font-family: var(--f-pixel); text-shadow: 0 1px 4px rgba(0, 0, 0, .7); color: #fff; }
.attrs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .7rem; margin-top: 1.2rem; }
.attr { display: grid; justify-items: center; text-align: center; padding: .9rem .4rem; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.attr span { font-family: var(--f-mono); font-weight: 700; font-size: .78rem; color: var(--gold); letter-spacing: .1em; }
.attr b { font-family: var(--f-pixel); font-size: 1.7rem; line-height: 1.2; }
.attr small { color: var(--muted); font-size: .74rem; }
.journal { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.journal summary { cursor: pointer; padding: .55rem .8rem; border-radius: 12px; background: var(--surface-2); }
.journal-text { white-space: pre-wrap; padding: .6rem .8rem; }
.journal-fix { padding: 0 .8rem; color: var(--good); }
.settings { display: grid; gap: 1rem; }
.settings fieldset { border: 1px solid var(--border); border-radius: 18px; padding: 1rem 1.2rem; display: grid; gap: .6rem; margin: 0; }
.settings legend { font-family: var(--f-display); font-weight: 700; padding: 0 .4rem; }
.settings > label { display: grid; gap: .3rem; font-weight: 600; max-width: 380px; }
.switch, .range { display: flex; align-items: center; gap: .7rem; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--gold); }
.range input { accent-color: var(--gold); flex: 1; max-width: 220px; }
.voice-row { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.voice-row select { flex: 1 1 220px; width: auto; }
.method-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.method-grid p { margin: .3rem 0 0; color: var(--muted); font-size: .95rem; }

/* ---------- Exercices ---------- */
.play, .play-intro, .summary { width: 100%; max-width: 780px; margin: 0 auto; }
.play-intro, .summary { display: grid; justify-items: center; text-align: center; gap: .6rem; padding: clamp(1.4rem, 4vw, 2.6rem); border-top: 3px solid var(--c, var(--gold)); }
.play-intro .back { justify-self: start; }
.pi-ico { font-size: 4.2rem; animation: float 3s ease-in-out infinite; filter: drop-shadow(0 10px 22px rgba(0, 0, 0, .5)); }
.who { margin: 0; font-family: var(--f-mono); color: var(--c, var(--gold)); font-weight: 700; letter-spacing: .08em; }
.boss-intro { border-top-color: #ff4d6d; background: radial-gradient(600px 300px at 50% 0%, rgba(255, 77, 109, .2), transparent 70%), var(--surface); }
.boss-ico { color: #ff4d6d; }
.play { display: grid; gap: 1rem; }
.play-top { display: flex; align-items: center; gap: .8rem; }
.segments { flex: 1; display: flex; gap: 4px; }
.segments span { flex: 1; height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--text) 10%, transparent); transition: background .4s; }
.segments .ok { background: var(--good); box-shadow: 0 0 8px color-mix(in srgb, var(--good) 60%, transparent); }
.segments .meh { background: var(--warn); }
.segments .now { background: linear-gradient(90deg, var(--gold), var(--ember)); animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .55; } }
.step-count { font-family: var(--f-pixel); color: var(--muted); }
.is-boss .step { border-color: rgba(255, 77, 109, .4); box-shadow: 0 0 40px -14px rgba(255, 77, 109, .6), var(--shadow); }
.step { display: grid; gap: 1rem; animation: rise .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.step h2 { font-family: var(--f-display); font-size: clamp(1.25rem, 2.6vw, 1.6rem); letter-spacing: -.02em; }
.target { font-family: var(--f-display); font-weight: 700; font-size: clamp(1.4rem, 3.4vw, 2.1rem); letter-spacing: -.02em; margin: 0; line-height: 1.25;
  background: linear-gradient(100deg, var(--text), color-mix(in srgb, var(--lang) 70%, var(--text))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.source { margin: 0; font-size: 1.15rem; color: color-mix(in srgb, var(--text) 75%, var(--muted)); }
.source.big { font-size: clamp(1.25rem, 3vw, 1.6rem); font-weight: 600; color: var(--text); }
.answer { font-family: var(--f-display); font-weight: 700; font-size: 1.2rem; margin: .4rem 0; white-space: pre-wrap; }
.audio-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.btn-play {
  width: 66px; height: 66px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.5rem; color: #fff;
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--lang, var(--gold)) 60%, #fff), var(--lang, var(--gold)) 50%, color-mix(in srgb, var(--lang, var(--gold)) 50%, #000));
  box-shadow: 0 10px 30px -8px var(--lang, var(--gold)), inset 0 2px 0 rgba(255, 255, 255, .3);
  transition: transform .2s cubic-bezier(.2, .8, .2, 1.6);
}
.btn-play:hover { transform: scale(1.08); }
.btn-play:active { transform: scale(.94); }
.flash { position: relative; padding: 1.4rem; border-radius: 20px; background: var(--surface-solid); border: 1px solid var(--border-hi); display: grid; gap: .8rem; min-height: 190px; align-content: center; text-align: center; justify-items: center; }
.flash.flipped { animation: flip .5s cubic-bezier(.2, .8, .2, 1); }
@keyframes flip { 0% { transform: perspective(900px) rotateY(0); } 50% { transform: perspective(900px) rotateY(90deg); } 100% { transform: perspective(900px) rotateY(0); } }
.flash-front, .flash-back { display: grid; gap: .8rem; justify-items: center; }
.grades { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
.grades.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grade { position: relative; display: grid; gap: .1rem; padding: .85rem .5rem; border-radius: 16px; border: 1px solid var(--border-hi); background: var(--surface-2); cursor: pointer; transition: transform .18s cubic-bezier(.2, .8, .2, 1.5), border-color .2s; }
.grade:hover { transform: translateY(-3px); }
.grade small { color: var(--muted); font-family: var(--f-mono); font-size: .76rem; }
.grade kbd { position: absolute; top: 6px; right: 8px; font-family: var(--f-mono); font-size: .66rem; color: var(--muted); }
.grade.g1:hover { border-color: var(--bad); } .grade.g2:hover { border-color: var(--warn); } .grade.g3:hover { border-color: var(--good); } .grade.g4:hover { border-color: var(--en); }
.diac { display: flex; gap: .4rem; flex-wrap: wrap; }
.key { min-width: 46px; padding: .45rem .7rem; border-radius: 10px; border: 1px solid var(--border-hi); background: var(--surface-2); cursor: pointer; font-size: 1.1rem; font-weight: 700; box-shadow: 0 3px 0 var(--border-hi); transition: transform .1s; }
.key:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--border-hi); }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: flex-end; margin-top: .3rem; }
.actions.center { justify-content: center; }
.feedback { display: grid; gap: .6rem; padding: 1.1rem 1.2rem; border-radius: 18px; border: 1px solid var(--border-hi); animation: rise .35s cubic-bezier(.2, .8, .2, 1); }
.feedback.good { background: color-mix(in srgb, var(--good) 13%, var(--surface-solid)); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.feedback.meh { background: color-mix(in srgb, var(--warn) 10%, var(--surface-solid)); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.feedback.bad { background: color-mix(in srgb, var(--bad) 12%, var(--surface-solid)); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.fb-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.score-pill { font-family: var(--f-pixel); font-size: 1.4rem; padding: .1rem .7rem; border-radius: 10px; background: var(--surface-2); }
.quip { color: var(--muted); font-style: italic; }
.marks { font-size: 1.15rem; line-height: 2; margin: 0; }
.w { padding: .05rem .25rem; border-radius: 6px; }
.w.ok { background: color-mix(in srgb, var(--good) 20%, transparent); }
.w.bad { background: color-mix(in srgb, var(--bad) 22%, transparent); }
.w.bad s { margin-left: .3rem; opacity: .7; font-size: .85em; }
.w.miss { border: 1px dashed var(--bad); color: var(--bad); }
.scene { display: flex; flex-wrap: wrap; gap: .5rem; }
.bubble { padding: .45rem .9rem; border-radius: 16px 16px 16px 4px; background: var(--surface-2); border: 1px solid var(--border); font-family: var(--f-mono); color: var(--muted); transition: all .3s; }
.bubble.who-B { border-radius: 16px 16px 4px 16px; }
.bubble.speaking { background: color-mix(in srgb, var(--lang) 25%, var(--surface-2)); border-color: var(--lang); color: var(--text); transform: scale(1.08); box-shadow: 0 0 20px -4px var(--lang); }
.q { border: 1px solid var(--border); border-radius: 16px; padding: .8rem 1rem; margin: 0 0 .7rem; display: grid; gap: .4rem; }
.q legend { font-weight: 700; padding: 0 .3rem; }
.opt { display: flex; gap: .6rem; align-items: center; padding: .55rem .8rem; border-radius: 12px; background: var(--surface-2); cursor: pointer; border: 1px solid transparent; transition: border-color .2s, background .2s; }
.opt:hover { border-color: var(--border-hi); }
.opt input { accent-color: var(--gold); width: 18px; height: 18px; }
.opt.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 15%, var(--surface-2)); }
.opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 15%, var(--surface-2)); }
.opt.x { opacity: .55; }
.mic { justify-self: center; display: inline-flex; align-items: center; gap: .6rem; padding: 1rem 2rem; border-radius: 99px; border: 0; cursor: pointer; font-weight: 800; font-size: 1.1rem; color: #fff;
  background: linear-gradient(110deg, #f472b6, #a855f7); box-shadow: 0 12px 34px -10px #f472b6; transition: transform .2s; }
.mic.big { padding: 1.2rem 2.4rem; font-size: 1.2rem; }
.mic:hover { transform: scale(1.04); }
.mic.recording { background: linear-gradient(110deg, #ff4d6d, #e11d48); animation: rec 1.2s ease-in-out infinite; }
@keyframes rec { 0% { box-shadow: 0 0 0 0 rgba(255, 77, 109, .7); } 70% { box-shadow: 0 0 0 22px rgba(255, 77, 109, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0); } }
.live { min-height: 1.6em; text-align: center; font-size: 1.15rem; font-style: italic; color: var(--muted); margin: 0; }
.live.long { text-align: left; }
.my-voice { width: 100%; margin-top: .3rem; }
.spells { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.spells li { display: grid; padding: .5rem .85rem; border-radius: 14px; border: 1px dashed color-mix(in srgb, var(--arcane) 60%, transparent); background: color-mix(in srgb, var(--arcane) 10%, transparent); transition: all .3s; }
.spells li small { color: var(--muted); font-size: .8rem; }
.spells li.hit { border-style: solid; border-color: var(--good); background: color-mix(in srgb, var(--good) 16%, transparent); transform: scale(1.03); }
.spells li.hit span::before { content: '✓ '; color: var(--good); font-weight: 900; }
.spells.compact li { padding: .35rem .75rem; font-size: .95rem; }
.wc { display: flex; align-items: center; gap: .8rem; font-family: var(--f-mono); font-size: .88rem; color: var(--muted); }
.wc .bar { flex: 1; }
.hourglass { width: 130px; aspect-ratio: 1; position: relative; display: grid; place-items: center; justify-self: center; }
.hourglass b { font-family: var(--f-pixel); font-size: 1.8rem; }
.hourglass .orb-fg { stroke: #f472b6; filter: drop-shadow(0 0 8px #f472b6); transition: stroke-dasharray .25s linear; }
.hourglass.full .orb-fg { stroke: var(--good); filter: drop-shadow(0 0 10px var(--good)); }
.verdict { font-size: 1.08rem; margin: 0; }
.errors { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.errors li { padding: .6rem .8rem; border-radius: 12px; background: var(--surface-2); display: grid; gap: .1rem; }
.errors s { color: var(--bad); }
.errors b { color: var(--good); }
.errors small { color: var(--muted); }
.feedback details summary { cursor: pointer; font-weight: 700; }
.oracle-wait { display: grid; justify-items: center; gap: .5rem; padding: 1.4rem; text-align: center; color: var(--muted); }
.crystal { font-size: 3rem; animation: float 1.6s ease-in-out infinite, glowp 1.6s ease-in-out infinite; }
@keyframes glowp { 50% { filter: drop-shadow(0 0 22px #c084fc); } }

.sum-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; margin: .8rem 0; }
.sum-stats div { display: grid; min-width: 120px; padding: .9rem 1.2rem; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--border); }
.sum-stats b { font-family: var(--f-pixel); font-size: 2rem; line-height: 1.1; color: var(--gold); }
.sum-stats small { color: var(--muted); font-family: var(--f-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; }
.mini-d20 { width: 74px; font-size: 1.7rem; animation: roll-in .9s cubic-bezier(.2, .8, .2, 1); }
@keyframes roll-in { from { transform: rotate(-540deg) scale(.3); opacity: 0; } }
.banner { padding: .7rem 1.2rem; border-radius: 14px; background: color-mix(in srgb, var(--good) 16%, transparent); border: 1px solid color-mix(in srgb, var(--good) 45%, transparent); font-weight: 600; }
.medal-reveal { animation: reveal 1s cubic-bezier(.2, .8, .2, 1.3); }
@keyframes reveal { from { transform: scale(.2) rotate(-200deg); opacity: 0; } }
.boss-end.win { border-top-color: var(--gold); }
.boss-end.lose { border-top-color: #ff4d6d; }

/* ---------- Superpositions ---------- */
#overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1rem; background: rgba(5, 3, 10, .6); backdrop-filter: blur(6px); opacity: 0; transition: opacity .25s; }
#overlay.show { opacity: 1; }
.ov-card { max-width: 560px; width: 100%; display: grid; gap: .8rem; justify-items: center; text-align: center; transform: scale(.92); transition: transform .35s cubic-bezier(.2, .8, .2, 1.4); background: var(--surface-solid); }
#overlay.show .ov-card { transform: scale(1); }
.welcome-list { text-align: left; display: grid; gap: .5rem; padding-left: 1.2rem; margin: .4rem 0; }
.lvl-burst { width: 150px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; position: relative;
  background: radial-gradient(circle, color-mix(in srgb, var(--gold) 70%, #fff), var(--gold) 45%, transparent 70%); animation: burst 1.2s cubic-bezier(.2, .8, .2, 1.3); }
.lvl-burst::before { content: ''; position: absolute; inset: -30px; border-radius: 50%; background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--gold) 45%, transparent) 0 8deg, transparent 8deg 24deg); animation: drift 12s linear infinite; z-index: -1; }
.lvl-burst span { font-family: var(--f-pixel); font-size: 4.2rem; color: #1b1205; }
@keyframes burst { from { transform: scale(0) rotate(-90deg); } }
#toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 60; display: grid; gap: .6rem; max-width: min(380px, calc(100vw - 2rem)); }
.toast { display: flex; gap: .8rem; align-items: flex-start; padding: .9rem 1.1rem; border-radius: 16px; background: var(--surface-solid); border: 1px solid var(--border-hi); box-shadow: var(--shadow); animation: slidein .45s cubic-bezier(.2, .8, .2, 1.3); }
.toast-ico { font-size: 1.6rem; line-height: 1; }
.toast-gold { border-color: color-mix(in srgb, var(--gold) 60%, transparent); box-shadow: 0 0 30px -8px var(--gold), var(--shadow); }
.toast-bad { border-color: color-mix(in srgb, var(--bad) 60%, transparent); }
.toast.out { opacity: 0; transform: translateX(30px); transition: all .4s; }
@keyframes slidein { from { opacity: 0; transform: translateX(40px) scale(.9); } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }

::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .bento { grid-template-columns: 1fr 1fr; }
  .floors-card { grid-column: 1 / -1; }
  .mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .method-grid { grid-template-columns: 1fr 1fr; }
  .attrs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  body { grid-template-columns: 1fr; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .rail { position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; padding: .6rem 1rem; border-right: 0; border-bottom: 1px solid var(--border); gap: .6rem; }
  .brand-name small, .hud-rank { display: none; }
  .brand-mark { width: 38px; height: 38px; }
  .brand-name { font-size: 1rem; }
  .hud { margin-left: auto; flex-wrap: nowrap; }
  .hud-level { width: auto; padding: 0; background: none; border: 0; box-shadow: none; }
  .ring { width: 38px; height: 38px; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; grid-template-columns: repeat(5, 1fr); gap: 0; margin: 0;
    padding: .4rem .4rem calc(.4rem + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: var(--blur); border-top: 1px solid var(--border); }
  .nav a { flex-direction: column; gap: .1rem; padding: .45rem .2rem; font-size: .72rem; }
  .nav a[aria-current='page']::before { left: 30%; right: 30%; top: -.4rem; bottom: auto; width: auto; height: 3px; border-radius: 0 0 4px 4px; }
  .in-play .nav { display: none; }
  .in-play { padding-bottom: 0; }
  .hero { grid-template-columns: 1fr; }
  .quest-orb { justify-self: center; grid-row: 1; }
  .boards, .two-col { grid-template-columns: 1fr; }
  .floor-hero { grid-template-columns: 1fr; text-align: left; }
  .fh-glyph { font-size: 3rem; }
  #toasts { bottom: calc(86px + env(safe-area-inset-bottom)); }
}
@media (max-width: 600px) {
  main { padding: 1rem 1rem 1.5rem; gap: 1rem; }
  .bento { grid-template-columns: 1fr; }
  .tiles { gap: .55rem; }
  .tile { min-height: 116px; padding: .8rem; }
  .hud-chip { padding: .25rem .5rem; font-size: .82rem; }
  .brand-name { display: none; }
  .floor-node a { grid-template-columns: auto 1fr auto; padding: .8rem; gap: .7rem; }
  .fn-num { display: none; }
  .dungeon::before { left: 34px; }
  .card-list li { grid-template-columns: auto 1fr auto; }
  .card-list li small { grid-column: 2; }
  .grades { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .method-grid, .attrs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-grid { grid-template-columns: 1fr 1fr; }
  .actions { justify-content: stretch; }
  .actions .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
.no-motion *, .no-motion *::before, .no-motion *::after { animation: none !important; transition: none !important; }
.no-motion .aurora { display: none; }
.flagi { height: .9em; width: auto; vertical-align: -.08em; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .15), 0 2px 6px rgba(0, 0, 0, .35); }
.flag .flagi { height: 1.6rem; border-radius: 5px; }
#overlay[hidden], [hidden] { display: none !important; }
/* Chiffres : chasse fixe, graisse forte, lisibles (pas de police pixel ambiguë) */
.ring b, .quest-orb b, .big-num, .attr b, .sum-stats b, .score-pill, .xpbar b, .hourglass b, .board-count, .step-count, .fn-num, .stats-row.big b { font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.d20, .mini-d20, .lvl-burst span { font-family: var(--f-display); font-weight: 900; }
@media (max-width: 900px) {
  /* backdrop-filter crée un bloc conteneur : la barre d'onglets fixe resterait collée au rail. */
  .rail { backdrop-filter: none; background: color-mix(in srgb, var(--bg) 94%, transparent); }
}
.quest-orb svg, .hourglass svg { overflow: visible; }
