/* Digits everywhere the pixel font is used come from Silkscreen (Pixelify's 5 looks like an 8). */
@font-face { font-family: "PixDigits"; src: url("fonts/Silkscreen-Regular.ttf") format("truetype"); font-weight: 400 600; unicode-range: U+0030-0039; font-display: swap; }
@font-face { font-family: "PixDigits"; src: url("fonts/Silkscreen-Bold.ttf") format("truetype"); font-weight: 700 900; unicode-range: U+0030-0039; font-display: swap; }
/* Body text is a book face, so stories and descriptions read like the village's chronicle. */
@font-face { font-family: "Vollkorn"; src: url("fonts/Vollkorn.woff2") format("woff2"); font-weight: 400 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Vollkorn"; src: url("fonts/Vollkorn-Italic.woff2") format("woff2"); font-weight: 400 900; font-style: italic; font-display: swap; }
@font-face {
  font-family: "Pixelify";
  src: url("fonts/PixelifySans.ttf") format("truetype");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --bg: #17191b;
  --bg-2: #1e2123;
  --panel: #2a2d30;
  --panel-2: #383c40;
  --panel-3: #474c51;
  --ink: #efe9de;
  --muted: #a6a9a8;
  --gold: #f29b3a;
  --pv: #e0525b;
  --pm: #4b8ff0;
  --xp: #9b6cf0;
  --ok: #67c477;
  --bad: #ff6f6f;
  --edge: #0c0d0e;
  --rare: #5fb3ff;
  --epic: #c27cff;
  --legend: #ffb347;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --pixel: "PixDigits", "Pixelify", system-ui, sans-serif;
  --text: "Vollkorn", Georgia, serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* Pixelify draws its "fi" ligature like an "A" ("fidèles" read "Adèles"); the font shorthand resets this, hence !important */
*, *::before, *::after { font-variant-ligatures: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg) radial-gradient(ellipse at top, #2c2620 0%, var(--bg) 60%);
  color: var(--ink);
  font: 16px/1.45 var(--text);
  font-variant-numeric: lining-nums;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, .btn, .cbtn, #tabs button, .chip, .badge, .blabel, .rank, .banner, .pop, .lvl, .node small, .omen-head, .floor-head b {
  font-family: var(--pixel);
}

input, button { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }

.sprite { display: inline-block; flex: none; image-rendering: pixelated; background-repeat: no-repeat; vertical-align: middle; }

/* ---------- header ---------- */
/* App shell: header, scrolling middle, tab bar. Only <main> scrolls (see note in app.js). */
body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

#top {
  position: relative; flex: none; z-index: 5;
  padding: calc(var(--safe-top) + 6px) 12px 6px;
  background: linear-gradient(var(--panel), var(--bg-2));
  border-bottom: 3px solid var(--edge);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .25);
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#title { margin: 0 0 5px; font-size: 1.02rem; display: flex; flex-wrap: nowrap; align-items: baseline; gap: 8px; min-width: 0; white-space: nowrap; }
#title > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.rank { font-size: .78rem; color: var(--gold); background: rgba(242, 155, 58, .12); border: 1px solid rgba(242, 155, 58, .35); padding: 1px 6px; border-radius: 4px; }
#settings { background: none; border: 0; font-size: 1.35rem; color: var(--muted); padding: 2px 6px; }
/* The purse is one slim strip of short numbers; tapping it opens every exact count. */
#resources { display: flex; gap: 4px; flex-wrap: nowrap; justify-content: space-between; overflow: hidden; cursor: pointer; }
#resources .chip { flex: 0 1 auto; min-width: 0; gap: 3px; padding: 1px 5px 1px 2px; font-size: .78rem; }
#resources.open { flex-wrap: wrap; gap: 6px; justify-content: flex-start; }
#resources.open .chip { font-size: .92rem; padding: 2px 8px 2px 4px; }
#resources .ess-stack { display: inline-flex; padding-left: 4px; }
#resources .ess-stack .gem { width: 7px; height: 7px; margin-left: -4px; }
@media (max-width: 360px) { #resources { gap: 2px; } #resources .chip { font-size: .68rem; gap: 2px; padding: 1px 3px 1px 1px; } #resources .chip .sprite { zoom: .85; } }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px 2px 4px; background: var(--bg); border: 2px solid var(--edge); border-radius: 6px;
  font-variant-numeric: tabular-nums; font-size: .92rem;
}
.chip.ess { gap: 8px; padding-left: 6px; }
.chip.ess span { display: inline-flex; align-items: center; gap: 3px; }
.gem { display: inline-block; width: 9px; height: 9px; transform: rotate(45deg); border: 1px solid var(--edge); background: #888; flex: none; }

main {
  flex: 1 1 auto; min-height: 0; width: 100%; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain;
  padding: 12px max(12px, calc((100% - 640px) / 2)) 28px;
}
.loading { text-align: center; color: var(--muted); margin-top: 40vh; font-family: var(--pixel); }

h2 { font-size: 1.08rem; margin: 18px 0 8px; color: var(--gold); letter-spacing: .02em; }
h3 { margin: 12px 0 6px; font-size: 1rem; color: #ffc27a; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small, small { font-size: .82rem; }
.good { color: var(--ok); }
.grow { flex: 1; min-width: 0; }
.story { font-style: italic; color: #e6dcc0; }
.warn-text { color: #ffb0a0; }

/* ---------- cards & buttons ---------- */
.card, .hero, .panel {
  background: linear-gradient(var(--panel), #313538);
  border: 3px solid var(--edge); border-radius: 8px; padding: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05), 0 3px 0 rgba(0, 0, 0, .25);
}
.card { margin-bottom: 10px; }
.card.locked { text-align: center; padding: 22px 16px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.panel { margin-top: 12px; background: rgba(0, 0, 0, .18); box-shadow: none; }
.panel.warn { border-color: #5a1d2a; background: rgba(120, 30, 50, .25); }

.btn {
  display: block; width: 100%; margin-top: 10px; padding: 11px 12px;
  border: 3px solid var(--edge); border-radius: 8px;
  background: linear-gradient(var(--panel-3), var(--panel-2)); color: var(--ink);
  font-size: 1rem; box-shadow: 0 3px 0 var(--edge); transition: transform .05s;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.btn.primary { background: linear-gradient(#f3c45a, #d89a2b); color: #2a1a05; }
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--panel-3); }
.btn.danger { color: #ff9a9a; border-color: #6b2a3a; }
.btn.small { width: auto; display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; margin-top: 6px; font-size: .9rem; }
.btn.big { padding: 14px; font-size: 1.15rem; }
.btn:disabled { opacity: .45; filter: grayscale(.6); }
.btn span { display: inline-flex; align-items: center; gap: 3px; }
.row-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.row-buttons .btn { flex: 1; }
.input { width: 100%; padding: 10px; margin-top: 8px; border: 3px solid var(--edge); border-radius: 8px; background: var(--bg); color: var(--ink); -webkit-user-select: text; user-select: text; }

.badge { font-size: .74rem; padding: 3px 7px; border-radius: 4px; background: var(--panel-2); display: inline-flex; flex-direction: column; align-items: center; line-height: 1.15; }
.badge small { font-family: var(--text); font-size: .68rem; opacity: .85; }
.badge.pret { background: #2f5b37; }
.badge.blesse { background: #6b4a1d; }
.badge.a_terre { background: #6b1d2a; }
.badge.expedition { background: #2a4a6b; }

.bar { position: relative; height: 15px; background: var(--edge); border-radius: 3px; overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--ok); transition: width .25s; }
.bar.pv i { background: linear-gradient(#ff7a80, var(--pv)); }
.bar.pm i { background: linear-gradient(#7fb2ff, var(--pm)); }
.bar.xp i { background: linear-gradient(#b893ff, var(--xp)); }
.bar span { position: relative; display: block; padding-left: 6px; font-size: .7rem; line-height: 15px; font-weight: 700; text-shadow: 0 1px 0 var(--edge); }
.project-bar { margin: 6px 0; height: 17px; }
.project-bar i { background: linear-gradient(#ffd77a, #d89a2b); }
.project-bar span { line-height: 17px; }

/* ---------- toasts & sheet ---------- */
#toasts { position: fixed; z-index: 30; left: 0; right: 0; top: calc(max(var(--safe-top), 24px) + 74px); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { background: var(--panel-2); border: 3px solid var(--edge); border-radius: 8px; padding: 8px 14px; max-width: 90%; font-family: var(--pixel); animation: toastIn .25s ease-out; box-shadow: 0 4px 0 rgba(0, 0, 0, .3); }
.toast.good { background: #2f5b37; }
.toast.bad { background: #6b1d2a; }
.toast.out { opacity: 0; transform: translateY(-10px); transition: all .5s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.95); } }

#sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(11, 12, 13, .66); animation: fadeIn .15s; }
#sheet[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } }
.sheet-card {
  position: relative; width: 100%; max-width: 640px; max-height: 88vh; max-height: calc(100dvh - max(var(--safe-top), 24px) - 28px);
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 18px 16px calc(var(--safe-bottom) + 18px); background: linear-gradient(var(--panel), var(--bg-2));
  border: 3px solid var(--edge); border-bottom: 0; border-radius: 14px 14px 0 0; animation: slideUp .2s ease-out;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: .4; } }
.sheet-card h2 { margin-top: 0; padding-right: 36px; }
.sheet-close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--edge); background: var(--panel-2); font-size: 1rem; }
.lvl { font-size: .78rem; color: var(--muted); margin-left: 8px; font-weight: 400; }

/* ---------- bastion ---------- */
.scene-wrap { position: relative; border: 3px solid var(--edge); border-radius: 10px; overflow: hidden; line-height: 0; box-shadow: 0 4px 0 rgba(0, 0, 0, .3); }
.scene { width: 100%; height: auto; image-rendering: pixelated; display: block; }
.scene-overlay { position: absolute; inset: 0; pointer-events: none; }
.blabel {
  position: absolute; transform: translate(-50%, -60%); pointer-events: auto; line-height: 1;
  font-size: .7rem; padding: 3px 6px; border-radius: 4px; border: 2px solid var(--edge); background: rgba(32, 34, 37, .82); color: var(--ink); white-space: nowrap;
}
.blabel small { color: var(--gold); font-size: .7rem; }
.blabel.plot { background: rgba(80, 60, 30, .85); color: #ffe8b0; }
.bubble {
  position: absolute; transform: translate(-50%, 0); pointer-events: auto; line-height: 1; display: inline-flex; align-items: center; gap: 3px;
  font-family: var(--pixel); font-size: .72rem; padding: 3px 6px 3px 3px; border-radius: 12px; border: 2px solid var(--edge); background: #fff6d8; color: #3a2a08;
  animation: bob 1.4s ease-in-out infinite;
}
.bubble.full { background: #ffd36b; box-shadow: 0 0 0 2px rgba(255, 211, 107, .5); }
@keyframes bob { 50% { transform: translate(-50%, -4px); } }

.prod { margin-top: 10px; }
.prod-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.prod-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.pending { display: flex; gap: 6px; flex-wrap: wrap; }
.boost { color: #9fe3a8; font-size: .85rem; }

.bgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.bcard { text-align: left; padding: 9px 10px; border-radius: 8px; border: 3px solid var(--edge); background: var(--panel); display: flex; flex-direction: column; gap: 4px; }
.bcard b { font-family: var(--pixel); font-weight: 500; }
.bcard.unbuilt { background: rgba(80, 60, 30, .35); border-style: dashed; }
.bcard.can { box-shadow: 0 0 0 2px rgba(242, 155, 58, .5); }
.bcard .up { color: var(--gold); font-size: .75rem; font-family: var(--pixel); }
.pips { display: flex; gap: 3px; }
.pips i { width: 10px; height: 6px; border-radius: 2px; background: var(--edge); }
.pips i.on { background: var(--gold); }
.summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }

.upgrade { margin-top: 10px; padding: 10px; border-radius: 8px; background: rgba(0, 0, 0, .2); }
.costs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.cost { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px 2px 4px; border-radius: 6px; background: var(--bg); border: 2px solid var(--edge); font-family: var(--pixel); }
.cost.short { color: var(--bad); border-color: #5a1d2a; }

.recruit, .patient, .offer, .gift, .echo { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid rgba(255, 255, 255, .07); }
.recruit.hired { opacity: .5; }
.traits { display: flex; gap: 4px; flex-wrap: wrap; margin: 3px 0; }
.trait { font-size: .72rem; padding: 1px 6px; border-radius: 4px; background: rgba(155, 108, 240, .25); color: #e3d4ff; margin-left: 4px; }
.traits .trait { margin-left: 0; }
.kinds { display: flex; gap: 6px; flex-wrap: wrap; }
.kind { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; min-width: 56px; border-radius: 8px; border: 2px solid var(--edge); background: var(--panel); }
.kind.on { background: var(--panel-3); box-shadow: 0 0 0 2px var(--gold); }
.tiers { display: flex; gap: 6px; margin: 6px 0; }
.tier { padding: 4px 10px; border-radius: 6px; border: 2px solid var(--edge); background: var(--panel); font-family: var(--pixel); }
.tier.on { background: var(--gold); color: #2a1a05; }

/* ---------- heroes ---------- */
.heroes { display: grid; gap: 8px; }
.hero { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; color: var(--ink); }
.hero.a_terre, .hero.blesse { opacity: .8; }
.hero-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hero-name { font-family: var(--pixel); font-size: 1.02rem; }
.hero-class { color: var(--muted); font-size: .82rem; }
.seqs { display: flex; gap: 4px; flex-wrap: wrap; }
.seq { font-size: .7rem; padding: 1px 6px; border-radius: 4px; background: rgba(224, 82, 91, .25); color: #ffc2c2; }
.hero-head { display: flex; gap: 12px; align-items: center; }
.hero-head h2 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 14px; }
.stats div { display: flex; justify-content: space-between; border-bottom: 1px dotted rgba(255, 255, 255, .12); padding: 2px 0; }
.stats b { font-family: var(--pixel); }
.slots { display: grid; gap: 6px; }
.slot { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px; border-radius: 8px; border: 2px solid var(--edge); background: var(--panel); }
.slot small { display: block; color: var(--muted); }
.slot.empty { border-style: dashed; }
.skills { display: grid; gap: 4px; }
.skill { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 6px 8px; border-radius: 6px; background: rgba(0, 0, 0, .18); }
.skill small { grid-column: 1 / -1; color: var(--muted); }
.skill .pm { color: var(--rare); font-family: var(--pixel); font-size: .8rem; }
.skill.locked { opacity: .45; }
.items { display: grid; gap: 6px; }
.item { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px; border-radius: 8px; border: 2px solid var(--edge); background: var(--panel); width: 100%; }
.item small { display: block; color: var(--muted); }
.owner { font-size: .72rem; padding: 2px 6px; border-radius: 4px; background: var(--panel-3); font-family: var(--pixel); }
.r-commun { }
.r-rare b, h2.r-rare, .fx.r-rare { color: var(--rare); }
.r-epique b, h2.r-epique, .fx.r-epique { color: var(--epic); }
.r-legendaire b, h2.r-legendaire, .fx.r-legendaire { color: var(--legend); }
.item.r-rare, .slot.r-rare { border-color: #23466b; }
.item.r-epique, .slot.r-epique { border-color: #4b2a6b; }
.item.r-legendaire, .slot.r-legendaire { border-color: #6b4a1d; box-shadow: 0 0 8px rgba(255, 179, 71, .3); }

/* ---------- croisée ---------- */
.neighbour .nb-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.neighbour h2 { margin: 0; }
.mini-heroes { display: flex; gap: 4px; flex-wrap: wrap; }
.mini { display: inline-flex; flex-direction: column; align-items: center; font-family: var(--pixel); font-size: .7rem; }
.mini.a_terre, .mini.blesse { opacity: .45; }
.project h3 { display: flex; justify-content: space-between; }
.pct { color: var(--gold); font-size: .85rem; }
.reward { color: var(--gold); font-size: .85rem; }
.post-form { display: flex; gap: 6px; align-items: center; }
.post-form .input { margin-top: 0; }
.post-form .btn { margin-top: 0; }
.post { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid rgba(255, 255, 255, .07); font-size: .9rem; }
.post:first-child { border-top: 0; }
.post small { flex: none; }
.post.k-message span { color: #fff2c8; }
.post.k-projet span, .post.k-echo span { color: var(--gold); }
.give { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 8px; align-items: center; margin: 8px 0; }
.give .slider { grid-column: 1 / 3; width: 100%; accent-color: var(--gold); }
.give b { font-family: var(--pixel); min-width: 3ch; text-align: right; }
.echo .grow b { color: #cdb3ff; }
.stats-card { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; }
.stats-card b { font-family: var(--pixel); font-size: 1.4rem; display: block; color: var(--gold); }
.chronicle h3 { margin-top: 0; }

/* ---------- intro ---------- */
.intro { text-align: center; }
.intro-art { margin: 6px auto 8px; min-height: 112px; display: flex; align-items: flex-end; justify-content: center; }
.intro-row { display: flex; align-items: flex-end; justify-content: center; gap: 14px; }
.intro-row.res { gap: 18px; align-items: center; min-height: 96px; }
.intro-row.duel { gap: 22px; }
.intro-row.lantern { position: relative; }
.intro-row.lantern::before { content: ""; position: absolute; left: 50%; bottom: 10px; width: 140px; height: 140px; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(rgba(255, 200, 100, .28), rgba(255, 200, 100, 0) 65%); pointer-events: none; }
.intro-scene { width: 100%; max-width: 384px; margin: 0 auto; border: 3px solid var(--edge); box-shadow: 0 0 0 2px #3a3328, 0 10px 24px rgba(0,0,0,.45); line-height: 0; }
.intro-scene canvas { width: 100%; height: auto; image-rendering: pixelated; }
.intro-res { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; max-width: 360px; margin: 0 auto; }
.ir-cell { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 6px 8px; border: 2px solid var(--edge); background: linear-gradient(#2d2f31, #232527);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.06), 0 3px 0 #0c0d0e; }
.ir-icon { display: grid; place-items: center; width: 44px; height: 44px; border: 2px solid #4a4238; background: radial-gradient(#3a332a, #1d1a17); }
.ir-cell b { font-family: var(--pixel); font-size: .85rem; color: var(--gold); }
.ir-cell small { font-size: .72rem; color: var(--muted); }
.intro-pix { image-rendering: pixelated; width: auto; position: relative; }
.intro .row-buttons { justify-content: center; }
.dots { display: flex; justify-content: center; gap: 6px; margin: 10px 0; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--panel-3); }
.dots i.on { background: var(--gold); }
.toggle { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.toggle input { width: 22px; height: 22px; accent-color: var(--gold); }
.vol-row { display: flex; align-items: center; gap: 12px; }
.vol-row .toggle { flex: 0 0 auto; min-width: 7.5em; }
.vol-range { flex: 1; min-width: 0; accent-color: var(--gold); }
.vol-range:disabled { opacity: .4; }
.choice { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.choice span { min-width: 120px; }

/* ---------- tabs ---------- */
#tabs {
  position: relative; flex: none; z-index: 6; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 3px 4px max(3px, calc(var(--safe-bottom) - 18px)); background: linear-gradient(var(--bg-2), var(--panel)); border-top: 3px solid var(--edge);
}
#tabs button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 0; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: .68rem; }
#tabs button.active { color: var(--ink); background: var(--panel-2); }
#tabs .dot { position: absolute; top: 4px; right: 22%; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); border: 1px solid var(--edge); }

/* ---------- expedition prep ---------- */
.omens { display: grid; gap: 8px; }
.omen { text-align: left; padding: 10px; border-radius: 10px; border: 3px solid var(--edge); background: var(--panel); color: var(--ink); }
.omen h3 { margin: 4px 0; color: var(--ink); }
.omen.on { box-shadow: 0 0 0 3px var(--gold); }
.omen.o-calme { background: linear-gradient(#2c4a52, #24384a); }
.omen.o-orageux { background: linear-gradient(#46494c, #35373a); }
.omen.o-funeste { background: linear-gradient(#4a2038, #2a1428); }
.omen-head { display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.omen-icon { font-size: 1.1rem; }
.omen .region { color: var(--muted); }
.omen .new { margin-left: auto; font-size: .7rem; padding: 1px 6px; border-radius: 4px; background: var(--gold); color: #2a1a05; }
.pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pick-hero { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px; border-radius: 8px; border: 3px solid var(--edge); background: var(--panel); }
.pick-hero b { font-family: var(--pixel); font-weight: 500; font-size: .9rem; }
.pick-hero small { font-size: .7rem; color: var(--muted); }
.pick-hero .seq { color: #ffb0b0; background: none; }
.pick-hero.on { background: var(--panel-3); box-shadow: 0 0 0 3px var(--gold); }
.pick-hero.off { opacity: .4; }
.curses { display: grid; gap: 6px; }
.curse { text-align: left; padding: 8px; border-radius: 8px; border: 2px solid var(--edge); background: var(--panel); }
.curse small { display: block; color: var(--muted); }
.curse.on { background: #4a2038; box-shadow: 0 0 0 2px #ff6f6f; }
.kit { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.run-resume .btn { margin-top: 12px; }

/* ---------- run: map ---------- */
.run-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.run-top h2 { margin: 2px 0 8px; }
.hud { background: rgba(0, 0, 0, .25); border: 3px solid var(--edge); border-radius: 8px; padding: 8px; margin-bottom: 10px; }
.hud-party { display: grid; gap: 6px; }
.hud-hero { display: flex; gap: 8px; align-items: center; }
.hud-hero b { font-family: var(--pixel); font-weight: 500; font-size: .9rem; }
.hud-hero .bar { height: 11px; margin-top: 2px; }
.hud-hero .bar span { font-size: .62rem; line-height: 11px; }
.hud-hero.ko { opacity: .45; }
.hud-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip.relics { color: var(--gold); }
.relic { padding: 8px; border-radius: 8px; background: rgba(0, 0, 0, .2); margin-bottom: 6px; }
.relic.curse b { color: var(--bad); }
.relic.legendary b { color: var(--legend); }

.map { position: relative; padding-bottom: 20px; }
.map-lines { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; }
.map-lines line { stroke: rgba(185, 182, 175, .35); stroke-width: 2; stroke-dasharray: 4 4; }
.map-lines line.walked { stroke: var(--gold); stroke-dasharray: none; stroke-width: 3; }
.floor { position: relative; margin-bottom: 10px; padding: 8px; border-radius: 10px; border: 2px solid transparent; }
.floor.now { border-color: rgba(242, 155, 58, .35); background: rgba(242, 155, 58, .05); }
.floor-head { margin-bottom: 4px; }
.floor-head p { margin: 2px 0; }
.map-row { display: flex; justify-content: space-around; margin: 10px 0; position: relative; z-index: 1; }
.node {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; min-width: 70px;
  border-radius: 10px; border: 3px solid var(--edge); background: var(--panel); color: var(--ink); opacity: .5;
}
.node small { font-size: .65rem; }
.node.can { opacity: 1; animation: pulse 1.2s ease-in-out infinite; background: var(--panel-3); }
.node.cleared { opacity: .75; background: #2b3b2e; }
.node.cur { box-shadow: 0 0 0 3px var(--gold); opacity: 1; }
.node.t-boss { min-width: 110px; }
.node.t-elite small { color: #ffb0a0; }
.node.echo { background: #2d1f45; }
.node.echo small { color: #cdb3ff; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(242, 155, 58, .45); } }

/* ---------- run: nodes ---------- */
.event .choices { display: grid; gap: 6px; margin-top: 10px; }
.btn.choice { text-align: left; font-family: var(--text); font-weight: 600; margin-top: 0; }
.outcome { margin-top: 10px; padding-top: 8px; border-top: 1px dashed rgba(255, 255, 255, .15); }
.fx { margin: 4px 0; font-size: .92rem; }
.fx.good { color: #a6f0b0; }
.fx.bad { color: #ffaaaa; }
.typing::after { content: "▌"; animation: blink .6s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.merchant-head { display: flex; gap: 10px; align-items: center; }
.offer.sold { opacity: .45; }
.offer small { display: block; color: var(--muted); }
.campfire { text-align: center; }
.campfire .btn.choice { text-align: center; }
.fire { position: relative; width: 60px; height: 60px; margin: 10px auto; }
.fire i { position: absolute; bottom: 6px; left: 50%; width: 20px; height: 30px; margin-left: -10px; background: #ff9a3d; border-radius: 50% 50% 20% 20%; animation: flame .5s ease-in-out infinite alternate; transform-origin: bottom; }
.fire i:nth-child(2) { background: #ffd34d; width: 12px; margin-left: -6px; height: 22px; animation-delay: .15s; }
.fire i:nth-child(3) { background: #e8452c; width: 28px; margin-left: -14px; height: 18px; animation-delay: .3s; opacity: .8; }
.fire::after { content: ""; position: absolute; bottom: 0; left: 8px; right: 8px; height: 8px; background: #6b3a1d; border-radius: 3px; }
@keyframes flame { to { transform: scaleY(1.2) scaleX(.9); } }
.treasure { text-align: center; }
.chest-found .card { margin-top: 10px; animation: chest-in .35s ease-out; }
.treasure.cursed { border-color: #68386c; background: linear-gradient(160deg, #2e2240, #241c2e); }
@keyframes chest-in { from { opacity: 0; transform: translateY(6px); } }
.chest { animation: bob2 1s ease-in-out infinite; }
@keyframes bob2 { 50% { transform: translateY(-4px); } }

/* ---------- battle ---------- */
body.in-battle #top, body.in-battle #tabs, body.in-run #top { display: none; }
body.in-run main { padding-top: calc(max(var(--safe-top), 20px) + 10px); }
body.in-battle main { padding: calc(max(var(--safe-top), 20px) + 4px) 6px max(6px, calc(var(--safe-bottom) - 14px)); overflow: hidden; display: flex; flex-direction: column; }
.battle { display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 0; }
.stage { position: relative; flex: none; width: min(100%, calc(63dvh * 176 / 196)); margin: 0 auto; border: 3px solid var(--edge); border-radius: 10px; overflow: hidden; line-height: 0; }
.battle-canvas { width: 100%; height: auto; image-rendering: pixelated; display: block; }
.pops { position: absolute; inset: 0; pointer-events: none; line-height: 1.2; }
.pop {
  position: absolute; transform: translate(-50%, 0); font-size: 1rem; font-weight: 700; color: #fff; white-space: nowrap;
  text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000; animation: popUp 1.1s ease-out forwards;
}
.pop.crit { font-size: 1.35rem; color: #ffe066; }
.pop.on-hero { color: #ffb0b0; }
.pop.dot { color: #c7a0ff; font-size: .9rem; }
.pop.heal { color: #7dff9a; }
.pop.shield { color: #8fd0ff; font-size: .85rem; }
.pop.miss { color: #ccc; font-size: .85rem; }
.pop.bad { color: #ff9a9a; font-size: .85rem; }
.pop.good { color: #a6f0b0; font-size: .85rem; }
.pop.gold { color: var(--gold); }
.pop.mana { color: #8fb8ff; }
@keyframes popUp { 0% { opacity: 0; transform: translate(-50%, 6px) scale(.7); } 15% { opacity: 1; transform: translate(-50%, -6px) scale(1.15); } 30% { transform: translate(-50%, -10px) scale(1); } 100% { opacity: 0; transform: translate(-50%, -30px); } }
.banner {
  position: absolute; left: 50%; top: 6px; transform: translate(-50%, -30px); opacity: 0; transition: all .2s;
  padding: 4px 10px; border-radius: 6px; background: rgba(20, 22, 23, .88); border: 2px solid var(--panel-3); font-size: .85rem; line-height: 1.3;
  max-width: 92%; text-align: center; white-space: normal;
}
.banner { pointer-events: none; }
.banner.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; cursor: pointer; }
.banner.foe { border-color: #6b2a3a; }
.banner.warn { border-color: #ff6f6f; color: #ffd0d0; animation: shakeX .3s; }
.banner.boss { border-color: var(--gold); color: var(--gold); font-size: 1rem; }
.banner.echo { border-color: #9b6cf0; color: #e0ccff; }
@keyframes shakeX { 25% { margin-left: -4px; } 75% { margin-left: 4px; } }
.say {
  position: absolute; z-index: 4; max-width: 62%; opacity: 0; transform: translate(-50%, calc(-100% + 6px)); transition: opacity .2s, transform .2s; pointer-events: none;
  padding: 5px 8px; border-radius: 8px; background: rgba(250, 244, 228, .96); color: #252728; border: 2px solid var(--edge);
  font-size: .78rem; line-height: 1.3; font-style: italic; box-shadow: 0 2px 0 rgba(0, 0, 0, .35);
}
.say.show { opacity: 1; transform: translate(-50%, -100%); }
.say.spoken::after { content: ""; position: absolute; left: var(--tail, 50%); bottom: -8px; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--edge); border-bottom: 0; }
.say.spoken { width: max-content; }
.say.spoken.under.show { transform: translate(-50%, 0); }
.say.spoken.under::after { bottom: auto; top: -8px; border-top-color: transparent; border-bottom: 6px solid var(--edge); border-top: 0; }
.say.narrated { top: 52px; max-width: 86%; background: rgba(20, 22, 23, .9); color: var(--ink); border-color: var(--panel-3); transform: translate(-50%, 6px); }
.say.narrated.show { transform: translate(-50%, 0); }
.say.taunt { background: #fff1d6; color: #4a2a10; }
.say.info { font-style: normal; font-size: .72rem; }

@keyframes glow { to { filter: brightness(1.4); } }

.dock { flex: 1; min-height: 120px; display: flex; flex-direction: column; border-radius: 10px; border: 3px solid var(--edge); background: linear-gradient(#36393d, #27292c); overflow: hidden; }
.dock-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 8px 0; }
.dock.over .dock-head { display: none; }
.cmd { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px 8px 8px; }
.cmd-who { display: flex; gap: 8px; align-items: center; min-width: 0; font-family: var(--pixel); color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-who .back { background: var(--panel); border: 2px solid var(--edge); border-radius: 6px; padding: 3px 8px; color: var(--ink); font-family: var(--pixel); }
.cmd-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.cbtn {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; min-height: 48px; padding: 6px 10px; border-radius: 8px;
  border: 3px solid var(--edge); background: linear-gradient(var(--panel-3), var(--panel-2)); color: var(--ink); font-size: 1.02rem; text-align: left; box-shadow: 0 3px 0 var(--edge);
}
.cbtn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.cbtn b { font-weight: 500; }
.cbtn small { font-family: var(--text); font-size: .72rem; color: var(--muted); }
.cbtn:disabled { opacity: .4; }
.cbtn.el-feu { border-left-color: #ff7a3d; }
.cbtn.el-glace { border-left-color: #7fd8ff; }
.cbtn.el-foudre { border-left-color: #ffe14d; }
.cbtn.el-ombre { border-left-color: #b07cff; }
.cbtn.el-lumiere { border-left-color: #fff3b0; }
.cmd-hint { font-size: .78rem; color: var(--muted); margin: 6px 0 0; }
.cmd-wait { text-align: center; color: var(--muted); font-family: var(--pixel); margin-top: 24px; }
.tools { display: flex; justify-content: flex-end; gap: 6px; flex: none; }
.tool { padding: 5px 12px; border-radius: 6px; border: 2px solid var(--edge); background: var(--panel); font-family: var(--pixel); font-size: .85rem; }
.tool.on { background: var(--gold); color: #2a1a05; }
.victory { text-align: center; }
.victory h2 { margin-top: 4px; }
.victory.defeat h2 { color: var(--bad); }

/* ---------- end ---------- */
.end { text-align: center; }
.end h2 { font-size: 1.6rem; margin: 4px 0; }
.end.r-lose h2 { color: var(--bad); }
.end.r-retreat h2 { color: var(--muted); }
.end-stats { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 8px 0; }
.end-stats span { font-family: var(--pixel); font-size: .8rem; padding: 2px 8px; border-radius: 4px; background: rgba(0, 0, 0, .25); }
.loot { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.world-intro { text-align: center; }

@media (min-width: 560px) {
  .bgrid { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- level-ups and XP ---------- */
.levelup { margin: 6px 0; padding: 6px 8px; border-radius: 6px; background: rgba(103, 196, 119, .12); border: 1px solid rgba(103, 196, 119, .35); text-align: left; animation: toastIn .3s ease-out; }
.levelup b { color: #a6f0b0; font-family: var(--pixel); font-weight: 500; }
.gains { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.gain { font-family: var(--pixel); font-size: .75rem; padding: 1px 6px; border-radius: 4px; background: rgba(0, 0, 0, .3); color: #d6ffd9; }
.newskill { margin-top: 4px; font-size: .82rem; color: var(--gold); }
.xp-panel { display: grid; gap: 8px; margin: 8px 0; text-align: left; }
.xp-row { display: flex; gap: 8px; align-items: flex-start; }
.xp-row.ko { opacity: .45; }
.xp-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.xp-head b { font-family: var(--pixel); font-weight: 500; }
.xp-lvl { font-family: var(--pixel); font-size: .8rem; color: var(--muted); }
.xp-lvl.flash { color: #a6f0b0; animation: glow .4s 3 alternate; }
.xp-gain { margin-left: auto; font-size: .78rem; color: #c9b3ff; }
.xp-row .bar { height: 10px; }

/* ---------- juice: flying loot, counters, celebrations ---------- */
#fx { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.flyer { position: fixed; left: 0; top: 0; z-index: 41; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .5)); }
.bump { animation: bump .35s ease-out; }
@keyframes bump { 40% { transform: scale(1.18); filter: brightness(1.5); } }
.chip b { display: inline-block; min-width: 2ch; }
.spark { position: fixed; left: 0; top: 0; width: 5px; height: 5px; border-radius: 1px; }
.celebrate-wrap { position: fixed; inset: 0; padding: calc(max(var(--safe-top), 24px) + 20px) 0 calc(var(--safe-bottom) + 20px); display: flex; align-items: center; justify-content: center; pointer-events: auto; background: rgba(11, 12, 13, .35); animation: fadeIn .2s; }
.celebrate-wrap.out { opacity: 0; transition: opacity .3s; }
.celebrate {
  position: relative; overflow: hidden; width: min(86vw, 380px); padding: 20px 18px; text-align: center; border-radius: 14px;
  background: linear-gradient(#383c40, #1e2123); border: 3px solid var(--gold); box-shadow: 0 0 0 3px var(--edge), 0 10px 30px rgba(0, 0, 0, .5);
  animation: pop-in .45s cubic-bezier(.2, 1.4, .4, 1);
}
.celebrate h2 { margin: 6px 0; color: var(--gold); position: relative; }
.celebrate h3, .celebrate p { position: relative; }
.celebrate .sprite, .celebrate .relic-big { position: relative; margin: 4px auto; display: block; }
.celebrate .rays { position: absolute; inset: -60%; background: repeating-conic-gradient(rgba(242, 155, 58, .14) 0 10deg, transparent 10deg 20deg); animation: spin 8s linear infinite; }
.celebrate.legend { border-color: var(--legend); }
.celebrate.legend .rays { background: repeating-conic-gradient(rgba(255, 179, 71, .22) 0 10deg, transparent 10deg 20deg); }
.celebrate.curse { border-color: var(--bad); }
.celebrate.curse .rays { background: none; }
.celebrate.floor .rays, .celebrate.boss-floor .rays { background: none; }
.celebrate.boss-floor { border-color: var(--bad); }
.celebrate.boss-floor h2 { color: #ffb0a0; }
@keyframes pop-in { from { transform: scale(.6); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.relic-big { width: 64px; height: 64px; line-height: 64px; font-size: 2.2rem; border-radius: 12px; background: var(--panel-3); color: var(--gold); border: 3px solid var(--edge); }
.relic-big.legendary { color: var(--legend); box-shadow: 0 0 18px rgba(255, 179, 71, .6); }
.relic-big.curse { color: var(--bad); }
.relic-big.sky { color: #8fd0ff; }

/* rank & storage */
.rank { display: inline-flex; flex-direction: column; gap: 2px; }
.rank-bar { display: block; height: 3px; border-radius: 2px; background: rgba(0, 0, 0, .35); overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: var(--gold); }
.storage { height: 5px; border-radius: 3px; background: var(--edge); overflow: hidden; margin-top: 8px; }
.storage i { display: block; height: 100%; background: linear-gradient(90deg, #67c477, #f29b3a); }
.btn.pulse { animation: pulse 1s ease-in-out infinite; }

/* equipment comparison */
.cmp { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.cmp span { font-family: var(--pixel); font-size: .72rem; padding: 0 5px; border-radius: 3px; background: rgba(0, 0, 0, .3); }
.cmp .up { color: #8ff0a0; }
.cmp .down { color: #ff9a9a; }
.cmp .cmp-same { color: var(--muted); }

/* settings */
.notif-kinds { padding-left: 32px; }
.toggle.small { padding: 4px 0; font-size: .9rem; }
.toggle.small input { width: 18px; height: 18px; }

/* bestiary */
.subtabs { display: flex; gap: 6px; margin-bottom: 10px; }
.subtabs button { flex: 1; padding: 8px; border-radius: 8px; border: 3px solid var(--edge); background: var(--panel); font-family: var(--pixel); color: var(--muted); }
.subtabs button.on { background: var(--panel-3); color: var(--ink); }
.best-head .bar { margin: 6px 0; height: 8px; }
.bestiary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.beast { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 8px; border: 3px solid var(--edge); background: var(--panel); }
.beast b { font-family: var(--pixel); font-weight: 500; font-size: .8rem; text-align: center; }
.beast small { font-size: .68rem; color: var(--muted); }
.beast.unknown { background: rgba(0, 0, 0, .25); }
.beast .els { display: flex; gap: 4px; min-height: 10px; }
.els-row { display: flex; gap: 6px; flex-wrap: wrap; }
.elchip { padding: 2px 8px; border-radius: 4px; border: 2px solid; font-family: var(--pixel); font-size: .8rem; }

/* relics on the map and in battle */
.relic-row { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.relic-chip { display: inline-flex; gap: 4px; align-items: center; padding: 2px 7px; border-radius: 5px; border: 2px solid var(--edge); background: var(--panel-2); font-size: .72rem; color: #ffc27a; }
.relic-chip.legendary { color: var(--legend); border-color: #6b4a1d; }
.relic-chip.curse { color: #ffaaaa; border-color: #5a1d2a; }
.relic-chip.sky { color: #b8e4ff; border-color: #23466b; }
.relic.sky b { color: #b8e4ff; }
.relic-toast {
  position: absolute; left: 6px; z-index: 3; padding: 3px 8px; border-radius: 5px; background: rgba(20, 22, 23, .9); border: 2px solid var(--gold);
  color: #ffc27a; font-family: var(--pixel); font-size: .72rem; line-height: 1.2; animation: relicIn 1.7s ease-out forwards;
}
.relic-toast.legendary { border-color: var(--legend); color: var(--legend); }
.relic-toast.sky { border-color: #5fb3ff; color: #b8e4ff; }
.relic-toast.curse { border-color: var(--bad); color: #ffaaaa; }
@keyframes relicIn { 0% { transform: translateX(-30px); opacity: 0; } 12% { transform: none; opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
.loot-relic { text-align: left; margin: 6px 0; border: 2px solid rgba(242, 155, 58, .4); }
.stagger { opacity: 0; animation: staggerIn .35s ease-out forwards; }
@keyframes staggerIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* prep */
.risk { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .78rem; color: var(--muted); margin-top: 4px; }
.risk .reward { color: var(--gold); }
.legend-hint { color: var(--legend); }
.risk-total { color: var(--gold); font-family: var(--pixel); text-align: right; }
.sky-card { display: flex; gap: 10px; align-items: center; margin-top: 10px; background: linear-gradient(#24405a, #1f2f48); }
.sky-icon { font-size: 1.8rem; color: #b8e4ff; }

/* battle: enemy gauges, hints, skill text */
.ehint.warn { color: #ff9a9a; }
.ehint:empty { display: none; }
.ehint.w-égratignure, .cbtn.w-égratignure small { color: #c4c1bc; }
.ehint.w-léger, .cbtn.w-léger small { color: #e8e0c0; }
.ehint.w-moyen, .cbtn.w-moyen small { color: #ffd77a; }
.ehint.w-lourd, .cbtn.w-lourd small { color: #ff9a5a; }
.ehint.w-fatal, .cbtn.w-fatal small { color: #ff6f6f; font-weight: 700; }
.ehint.w-heal { color: #8ff0a0; }
.cbtn.skill { justify-content: flex-start; }
.sk-top { display: flex; justify-content: space-between; width: 100%; gap: 6px; }
.sk-top .pm { color: var(--rare); font-family: var(--pixel); }
.sk-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .66rem !important; line-height: 1.25; margin-top: 2px; }
.pop.learn { color: #ffe066; font-size: .85rem; }

/* end of run: reveals */
.reveal { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 8px 0; }
.gear-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border-radius: 10px; border: 3px solid var(--edge); background: var(--panel); text-align: center; }
.gear-card b { font-family: var(--pixel); font-weight: 500; font-size: .85rem; }
.gear-card small { font-size: .7rem; }
.gear-card.r-rare { border-color: #23466b; box-shadow: 0 0 10px rgba(95, 179, 255, .35); }
.gear-card.r-epique { border-color: #4b2a6b; box-shadow: 0 0 14px rgba(194, 124, 255, .45); }
.gear-card.r-legendaire { border-color: #6b4a1d; box-shadow: 0 0 20px rgba(255, 179, 71, .6); animation: glow .8s infinite alternate; }
.reveal-card.hidden { transform: rotateY(90deg); opacity: 0; }
.reveal-card.shown { transform: none; opacity: 1; transition: transform .45s cubic-bezier(.2, 1.3, .4, 1), opacity .2s; }
@media (prefers-reduced-motion: reduce) { .celebrate .rays, .gear-card.r-legendaire, .bubble { animation: none; } }

.push-panel { padding: 8px 10px; margin: 6px 0; border-radius: 8px; background: rgba(0, 0, 0, .2); }
.push-panel .btn { margin-top: 4px; }

/* ---------- tips ---------- */
.tip {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--safe-bottom) + 84px); z-index: 45; pointer-events: auto;
  max-width: 560px; margin: 0 auto; padding: 12px 14px; border-radius: 12px; border: 3px solid var(--gold);
  background: linear-gradient(#383c40, #34383c); box-shadow: 0 0 0 3px var(--edge), 0 8px 24px rgba(0, 0, 0, .5); animation: pop-in .35s cubic-bezier(.2, 1.4, .4, 1);
}
.tip b { font-family: var(--pixel); color: var(--gold); }
.tip p { margin: 6px 0 4px; }
.tip .btn { margin-top: 4px; }
/* map icons */
.node .icon { margin: 1px 0; }
.node.t-feu .icon { animation: flicker 1.2s ease-in-out infinite; }
@keyframes flicker { 50% { filter: brightness(1.25) saturate(1.2); } }

/* ---------- watching the other bastion ---------- */
.watch-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding-right: 36px; }
.watch-head h2 { margin: 0; }
.watch .scene-wrap { margin: 8px 0; }
.watch-run { background: linear-gradient(#2a3a5a, #232a48); }
.watch-party { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.wp { display: flex; align-items: center; gap: 4px; }
.wp.ko { opacity: .45; }
.watch-buildings { display: flex; gap: 6px; flex-wrap: wrap; }
.watch .hero { cursor: default; }
.wgears { display: flex; gap: 4px; flex-wrap: wrap; }
.wgear { font-size: .7rem; padding: 0 5px; border-radius: 3px; background: rgba(0, 0, 0, .3); }
.wgear.r-rare { color: var(--rare); }
.wgear.r-epique { color: var(--epic); }
.wgear.r-legendaire { color: var(--legend); }
body.in-battle .tip { bottom: auto; top: calc(max(var(--safe-top), 24px) + 14px); }

/* ---------- paths, ascension, contracts, Geste ---------- */
.stars { color: var(--legend); margin-left: 6px; font-size: .85em; letter-spacing: 1px; }
.spec-tag { font-size: .72rem; padding: 1px 6px; border-radius: 4px; background: rgba(242, 155, 58, .2); color: var(--gold); margin-left: 4px; }
.paths .path { margin: 8px 0; padding: 10px; border-radius: 8px; border: 2px solid var(--edge); background: rgba(0, 0, 0, .18); }
.paths .path.chosen { border-color: var(--gold); background: rgba(242, 155, 58, .08); }
.paths .path b { font-family: var(--pixel); font-weight: 500; color: #ffc27a; }
.panel.ascend { border-color: #6b4a1d; background: rgba(255, 179, 71, .08); }
.panel.ascend b { color: var(--legend); font-family: var(--pixel); }
.subtabs .count, .blabel .alert { display: inline-block; margin-left: 6px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: .72rem; line-height: 18px; text-align: center; font-style: normal; }
.blabel .alert { min-width: 14px; line-height: 14px; animation: pulse 1s infinite; }
.contract { padding: 10px 0; border-top: 1px solid rgba(255, 255, 255, .08); }
.contract:first-of-type { border-top: 0; }
.contract.done { background: rgba(103, 196, 119, .08); border-radius: 8px; padding: 10px; }
.contract-head { display: flex; gap: 8px; align-items: baseline; }
.contract-head b { font-family: var(--pixel); color: #ffc27a; }
.geste-head .bornes { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.bornes i { width: 18px; height: 26px; border-radius: 6px 6px 2px 2px; background: #383c40; border: 2px solid var(--edge); }
.bornes i.lit { background: linear-gradient(#fff3b0, #f29b3a); box-shadow: 0 0 10px rgba(242, 155, 58, .7); }
.bornes i.next { background: #64696e; animation: glow .8s infinite alternate; }
.chapter.hidden { opacity: .5; }
.chapter.current { border-color: var(--gold); }
.chapter.done h3 { color: var(--gold); }
.geste-card { border-color: #6b4a1d; background: linear-gradient(#3a2f20, #2a2318); }
.geste-card.open { box-shadow: 0 0 0 2px var(--legend); }
.geste-card h3 { margin: 4px 0; color: var(--legend); }
.omen.legend { background: linear-gradient(#4a3a1a, #2a2010); border-color: #6b4a1d; }
.omen.legend h3 { color: var(--legend); }
.new.legend { background: var(--legend); }
.curse.asc { border-color: #6b4a1d; }
.curse.asc b { color: var(--legend); }
.beast.boss b { color: #ffd0a0; }

/* ---------- the bastion world view ---------- */
.scene-wrap.world { height: min(60vh, 540px); min-height: 300px; line-height: normal; }
.scene-wrap.world.watch-world { height: min(46vh, 380px); }
.scene-wrap.world .scene { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.world .scene-overlay { overflow: hidden; }
.world .blabel, .world .bubble { position: absolute; left: 0; top: 0; animation: none; display: inline-flex; align-items: center; gap: 3px; will-change: transform; }
.world .blabel { padding: 2px 6px; font-size: .68rem; }
.world .blabel .bicon { font-size: .8rem; }
.world .blabel.tiny .bname, .world .blabel.tiny small { display: none; }
.world .bubble { padding: 3px 7px 3px 3px; border-radius: 12px; box-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.world .bubble.full { box-shadow: 0 0 0 2px rgba(255, 211, 107, .7); }
.zoomctl { position: absolute; right: 8px; bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.zoomctl button { width: 34px; height: 34px; border-radius: 8px; border: 2px solid var(--edge); background: rgba(32, 34, 37, .85); color: var(--ink); font-size: 1.1rem; font-family: var(--pixel); }

.news .release { padding: 8px 0; border-top: 1px solid rgba(255, 255, 255, .08); }
.news .release:first-child { border-top: 0; }
.news .release-head { display: flex; justify-content: space-between; align-items: baseline; }
.news .release-head b { font-family: var(--pixel); color: #ffc27a; }
.news .release.latest .release-head b { color: var(--gold); }
.news ul { margin: 4px 0 0; padding-left: 18px; }
.news li { margin: 2px 0; font-size: .9rem; }

/* ---------- encounters as scenes ---------- */
.scene .decor { font-style: italic; color: var(--muted); font-size: .88rem; margin: 2px 0 10px; }
.scene .speaker { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.scene .speaker b { font-family: var(--pixel); color: #ffc27a; }
.scene .speaker small { color: var(--muted); }
.scene .line { display: flex; margin: 6px 0; }
.scene .line .bubble-text { margin: 0; padding: 8px 11px; border-radius: 12px; max-width: 88%; line-height: 1.4; }
.scene .line.them .bubble-text { background: rgba(255, 255, 255, .08); border: 2px solid rgba(255, 255, 255, .1); border-top-left-radius: 3px; }
.scene .line.you { justify-content: flex-end; }
.scene .line.you .bubble-text { background: rgba(242, 155, 58, .16); border: 2px solid rgba(242, 155, 58, .35); border-top-right-radius: 3px; color: #ffe9b8; }
.scene .choices .btn.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.scene .choice .ton { font-family: var(--pixel); font-size: .72rem; font-weight: 400; color: var(--muted); }
.scene .choice.ton-agir .ton { color: #ffb0a0; }
.scene .choice.ton-ruser .ton { color: #c9b3ff; }
.scene .choice.ton-parler .ton { color: #a6f0b0; }

/* « Ta bourse » on windows that ask to pay */
.wallet {
  position: sticky; top: -18px; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  margin: -18px -16px 12px; padding: 22px 54px 8px 16px; background: linear-gradient(var(--panel), rgba(54, 58, 61, .96)); border-bottom: 2px solid var(--edge);
}
.wallet small { font-family: var(--pixel); color: var(--gold); margin-right: 2px; }
.wallet .chip { font-size: .82rem; padding: 1px 6px 1px 3px; }
.merchant .wallet { position: static; margin: 10px 0 4px; padding: 6px 8px; border: 2px solid var(--edge); border-radius: 8px; background: rgba(0, 0, 0, .2); }
.sheet-close { z-index: 4; }
.wallet .sheet-close { top: 50%; transform: translateY(-30%); right: 10px; }

.contract-head .timer { margin-left: auto; font-family: var(--pixel); font-size: .72rem; color: var(--muted); }
.contract-head .timer.urgent { color: var(--bad); animation: glow .8s infinite alternate; }
.contract.active { border: 2px solid rgba(242, 155, 58, .45); border-radius: 8px; padding: 10px; }
.contract-reminder { padding: 8px 10px; border-color: #6b4a1d; }
.contract-reminder.done { border-color: var(--ok); }

.danger { display: inline-block; margin: 4px 0; padding: 2px 8px; border-radius: 4px; font-family: var(--pixel); font-size: .74rem; }
.danger.d-ok { background: rgba(103, 196, 119, .18); color: #a6f0b0; }
.danger.d-hard { background: rgba(242, 155, 58, .18); color: var(--gold); }
.danger.d-danger { background: rgba(224, 82, 91, .22); color: #ffaaaa; animation: glow .9s infinite alternate; }

.filters { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.fchip { padding: 4px 9px; border-radius: 14px; border: 2px solid var(--edge); background: var(--panel); color: var(--muted); font-family: var(--pixel); font-size: .74rem; }
.fchip.on { background: var(--panel-3); color: var(--ink); box-shadow: 0 0 0 2px var(--gold); }
.fchip.r-rare { color: var(--rare); } .fchip.r-epique { color: var(--epic); } .fchip.r-legendaire { color: var(--legend); }
.recycle { margin-top: 12px; padding: 10px; border-radius: 8px; background: rgba(0, 0, 0, .18); }
.recycle h3 { margin-top: 0; }
.recycle-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; }
.recycle-row .btn { margin-top: 0; }
/* Numbers in Silkscreen: still pixel art, but a 5 never looks like an 8 (it does in Pixelify). */
@font-face { font-family: "Digits"; src: url("fonts/Silkscreen-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Digits"; src: url("fonts/Silkscreen-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
.chip, .cost, .wallet .chip, .bubble, .bar span, .stats b, .xp-gain, .timer { font-family: "Digits", system-ui, sans-serif; font-weight: 400; font-size: .82rem; letter-spacing: .02em; }
.pop { font-family: "Digits", system-ui, sans-serif; font-weight: 700; }
.chip b { font-weight: 400; }

/* battle: life plates on the battlefield */
.plates { position: absolute; inset: 0; line-height: 1.1; pointer-events: none; }
.plate, .bossrow { pointer-events: auto; color: var(--ink); text-align: left; font-family: var(--pixel); }
.plate { position: absolute; padding: 2px 3px 3px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, .55); background: rgba(20, 22, 23, .62); }
.plate.foe { width: 18%; transform: translateX(-50%); display: grid; gap: 1px; }
.plate.ally { left: 1%; right: 76.5%; display: grid; gap: 1px; }
.plate .ename, .plate .pname { font-size: .58rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 1px 1px 0 #000; }
.plate.elite .ename { color: #ffb0a0; }
.plate .estat, .plate .pstat { font-size: .6rem; color: #ffd0a0; }
.plate.foe .estat:empty { display: none; }
.plate .bar { height: 4px; border-radius: 2px; }
.plate.ally .bar.pv { height: 10px; }
.plate.ally .bar.pm { height: 7px; }
.plate.ally .bar span { font-size: .55rem; line-height: 10px; padding-left: 3px; }
.plate.ally .bar.pm span { font-size: .5rem; line-height: 7px; }
.plate .atb, .plate .eatb { height: 3px; border-radius: 2px; background: rgba(0, 0, 0, .5); overflow: hidden; }
.plate .atb i, .plate .eatb i { display: block; height: 100%; background: #d4d1cc; }
.plate .atb.full i { background: var(--gold); animation: glow .6s infinite alternate; }
.plate .ehint { font-size: .56rem; white-space: nowrap; text-align: center; text-shadow: 1px 1px 0 #000; }
.plate.ready { border-color: var(--gold); background: rgba(60, 48, 20, .78); box-shadow: 0 0 8px rgba(255, 224, 102, .45); }
.plate.ko { opacity: .35; }
.plate.gone { opacity: .5; filter: hue-rotate(60deg); }
.plate.charging { border-color: #ff6f6f; }
.plate.target, .bossrow.target { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); animation: pulse 1s infinite; }
.bossbar { position: absolute; left: 4px; right: 4px; top: 4px; line-height: 1.2; display: none; }
.bossbar.on { display: block; }
.bossrow { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 2px 6px; padding: 3px 6px 4px; border-radius: 5px; border: 1px solid #6b4a1d; background: rgba(20, 22, 23, .78); }
.bossrow .ename { color: var(--gold); font-size: .72rem; }
.bossrow .estat { font-size: .64rem; color: #ffd0a0; }
.bossrow .bar, .bossrow .eatb, .bossrow .ehint { grid-column: 1 / -1; }
.bossrow .bar { height: 6px; }
.bossrow .eatb { height: 3px; border-radius: 2px; background: rgba(0, 0, 0, .5); overflow: hidden; }
.bossrow .eatb i { display: block; height: 100%; background: #a09d96; }
.bossrow .ehint { font-size: .62rem; }
.bossbar.on ~ .banner { top: 46px; }
.eatb.soon i { background: #ff9a6a; }
.mark { position: absolute; width: 0; height: 0; transform: translate(-50%, -100%); display: none; }
.mark.turn, .mark.target { display: block; border-left: 6px solid transparent; border-right: 6px solid transparent; filter: drop-shadow(0 1px 0 #000); }
.mark.turn { border-top: 9px solid var(--gold); animation: markBob .7s ease-in-out infinite alternate; }
.mark.target { border-top: 8px solid #fff; animation: markBob .45s ease-in-out infinite alternate; }
@keyframes markBob { from { margin-top: -5px; } to { margin-top: 0; } }
.ehp i { background: linear-gradient(#ff7a80, var(--pv)); }
/* encounters: what a choice needs or risks, shown on the button */
.scene .choice .choice-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; }
.scene .choice span { min-width: 0; }
.scene .choice.ton-offrir .ton { color: #ffd77a; }
.ctag { font-family: "Digits", system-ui, sans-serif; font-size: .64rem; font-weight: 400; padding: 1px 5px; border-radius: 4px; background: rgba(0, 0, 0, .3); color: var(--ink); }
.ctag.classe { color: #b8e4ff; border: 1px solid rgba(95, 179, 255, .45); }
.ctag.cout { color: #ffd77a; border: 1px solid rgba(242, 155, 58, .4); }
.ctag.chance { color: #e0d0ff; border: 1px solid rgba(155, 108, 240, .5); }
.scene .btn.choice:disabled { opacity: .45; }
.roll { font-family: var(--pixel); font-size: 1rem; margin: 0 0 4px; }
.roll.good { color: #a6f0b0; } .roll.bad { color: #ffaaaa; }
.fx-list .fx { margin: 2px 0; }

/* bastion tab: the map takes the whole screen, nothing to scroll */
body.tab-bastion main { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 8px; }
body.tab-bastion .scene-wrap.world { flex: 1; height: auto; min-height: 0; }
.world .blabel { flex-direction: column; align-items: center; gap: 1px; padding: 2px 6px 3px; }
.world .blabel .bl-top { display: inline-flex; align-items: center; gap: 3px; }
.world .blabel .blvl { color: var(--gold); font-size: .7rem; }
.world .blabel .bup { font-style: normal; color: #7dff9a; font-size: .7rem; animation: upBob 1s ease-in-out infinite; }
.world .blabel.can { border-color: #3f8a4c; }
@keyframes upBob { 50% { transform: translateY(-2px); } }
.world .blabel .bl-rate { display: inline-flex; align-items: center; gap: 2px; font-family: "Digits", system-ui, sans-serif; font-size: .6rem; color: #d9f5c8; }
.world .blabel .bl-rate small { font-size: .55rem; color: var(--muted); }
.world .blabel .brate { display: inline-flex; align-items: center; gap: 1px; margin-right: 3px; }
.world .blabel.tiny .blvl { display: inline; }
.world-notes { position: absolute; left: 6px; top: 6px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; pointer-events: none; line-height: 1.2; }
.wnote { font-family: var(--pixel); font-size: .7rem; padding: 2px 7px; border-radius: 5px; border: 2px solid var(--edge); background: rgba(32, 34, 37, .85); }
.wnote.full { color: #ffd36b; } .wnote.boost { color: #9fe3a8; }
/* building sheet: what it does now, and what the next level brings */
.role { margin-top: -4px; }
table.effects { width: 100%; border-collapse: collapse; margin: 8px 0 4px; font-size: .9rem; }
table.effects th { text-align: left; font-weight: 400; color: var(--muted); padding: 4px 6px 4px 0; }
table.effects td { font-family: var(--pixel); text-align: right; padding: 4px 0 4px 8px; white-space: nowrap; }
table.effects td.next { color: #7dff9a; width: 1%; }
table.effects tr + tr th, table.effects tr + tr td { border-top: 1px solid rgba(255, 255, 255, .07); }
.upgrade { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.upgrade > b { flex: 1 1 100%; font-family: var(--pixel); font-weight: 500; }
.celebrate p { white-space: pre-line; }
.risk .rk { padding: 1px 6px; border-radius: 4px; background: rgba(0, 0, 0, .25); font-family: var(--pixel); font-size: .72rem; }
.risk .rk.danger { color: #ffb0a0; }
.tiers .tier { letter-spacing: -1px; font-size: .8rem; }
.tip p { white-space: pre-line; }
.confirm-list { margin: 8px 0 12px; padding-left: 18px; line-height: 1.5; }
.confirm-list li + li { margin-top: 2px; }
.cbtn.armed { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(242, 155, 58, .55), 0 3px 0 var(--edge); }
.cbtn.armed .sk-text { color: var(--gold); font-family: var(--pixel); }
.plate .phint { margin-left: 4px; color: #8ff0a0; font-size: .58rem; }
.plate .phint:empty { display: none; }
/* expedition prep: three steps */
.stepper { display: flex; gap: 6px; margin: 2px 0 6px; }
.stp { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 4px; border-radius: 8px; border: 2px solid var(--edge); background: var(--panel); color: var(--muted); font-family: var(--pixel); font-size: .8rem; }
.stp b { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--edge); font-size: .7rem; }
.stp.on { color: var(--ink); border-color: var(--gold); background: var(--panel-2); }
.stp.on b { background: var(--gold); color: #2a1a05; }
.stp.done { color: #a6f0b0; }
.stp:disabled { opacity: .55; }
.summary-card h2 { margin: 6px 0 4px; }
.sum-party { display: flex; justify-content: space-around; gap: 6px; margin: 12px 0 8px; }
.sum-hero { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.sum-hero b { font-family: var(--pixel); font-weight: 500; font-size: .85rem; }
.sum-hero small { color: var(--muted); font-size: .72rem; }
.summary-card .kit { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* expedition trail */
.trail { position: relative; width: 100%; margin: 8px auto 16px; max-width: 640px; border: 3px solid var(--edge); border-radius: 10px; overflow: hidden; line-height: 0; box-shadow: 0 4px 0 rgba(0, 0, 0, .3); }
.trail-canvas { width: 100%; height: auto; display: block; image-rendering: pixelated; }
.trail-over { position: absolute; inset: 0; line-height: 1.2; }
.trail .node { position: absolute; width: 46px; height: 46px; margin: -30px 0 0 -23px; padding: 0; border: 0; background: none; box-shadow: none; animation: none; opacity: 1; display: block; }
.trail .node:disabled { cursor: default; }
.trail .node small { position: absolute; left: 50%; top: 44px; transform: translateX(-50%); white-space: nowrap; padding: 1px 6px; border-radius: 4px; font-size: .64rem;
  background: rgba(20, 22, 23, .85); border: 1px solid rgba(242, 155, 58, .6); color: #ffc27a; }
.trail .node.t-boss { width: 70px; height: 70px; margin: -46px 0 0 -35px; }
.trail .node.t-boss small { top: 66px; }
.trail .node.t-elite small { color: #ffb0a0; }
.trail .node.echo small { color: #cdb3ff; }
.trail-sign { position: absolute; transform: translate(0, -50%); text-align: left; pointer-events: none; white-space: nowrap; }
.trail-sign.left { transform: translate(-100%, -50%); text-align: right; }
.trail .node:not(.can) { pointer-events: none; }
.trail-sign b { display: block; font-family: var(--pixel); font-weight: 500; font-size: .66rem; color: #ffc27a; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000; }
.trail-sign small { display: block; font-size: .62rem; color: #efe9de; text-shadow: 1px 1px 0 #000, -1px 1px 0 #000; font-style: italic; }
.trail-sign.boss { transform: translate(-50%, 0); text-align: center; }
.trail-sign.boss b { color: var(--gold); font-size: .8rem; }
.enc-art { display: block; width: calc(100% + 24px); margin: -12px -12px 10px; aspect-ratio: 16 / 9; object-fit: cover; image-rendering: pixelated; border-radius: 8px 8px 0 0; border-bottom: 3px solid var(--edge); }
.enc-art + h2 { margin-top: 0; }
.plate.foe .ename { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.05; overflow-wrap: anywhere; }
/* missions & posts */
.missions-btn { position: absolute; left: 6px; bottom: 6px; z-index: 3; padding: 6px 10px; border-radius: 8px; border: 2px solid var(--edge); background: rgba(32, 34, 37, .9); color: var(--ink); font-family: var(--pixel); font-size: .8rem; line-height: 1.2; }
.missions-btn small { color: var(--muted); font-size: .7rem; }
.missions-btn.alert { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(242, 155, 58, .45); animation: pulse 1.2s infinite; }
.missions-btn.alert small { color: var(--gold); }
.missions-card { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; color: var(--ink); }
.missions-card b { font-family: var(--pixel); font-weight: 500; }
.missions-card.alert { border-color: var(--gold); }
.mission .m-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.mission .m-head b { font-family: var(--pixel); font-weight: 500; color: #ffc27a; }
.mission .m-head small { color: var(--muted); }
.mission.done { border-color: var(--gold); }
.mission.open { border-color: var(--panel-3); }
.mission .bar { margin: 6px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.chips .chip { font-size: .72rem; }
.job-pick, .apt-heroes { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.pick-hero.small { padding: 4px 8px; min-width: 70px; }
.pick-hero.small b { font-size: .78rem; }
.pick-hero.small small { font-size: .66rem; }
.panel.job .job-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.panel.job .job-row small { display: block; color: #9fe3a8; }
.toggle.lend { display: flex; align-items: center; gap: 6px; margin: 6px 0; font-size: .85rem; color: var(--muted); }
.pick-sep { flex-basis: 100%; margin: 6px 0 0; }
.pick-hero.borrowed { border-style: dashed; }
/* together */
.card.menace { border-color: #6b2a3a; background: linear-gradient(#3a1f35, #313538); }
.card.menace.done { border-color: var(--ok); }
.card.menace .bar { height: 16px; margin: 6px 0; }
.card.daily { border-color: #6b5a1d; background: linear-gradient(#3a3320, #313538); }
.daily-row { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-top: 1px solid rgba(255, 255, 255, .06); font-size: .88rem; }
.daily-row b { font-family: var(--pixel); font-weight: 500; }
.omen .new.jour { background: #6b5a1d; color: #ffe9a8; }
.title-tag { font-family: var(--text); font-weight: 400; font-size: .8rem; color: var(--muted); font-style: italic; }
/* hauts faits */
.feats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.feat { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 8px; border-radius: 8px; border: 2px solid var(--edge); background: var(--panel); color: var(--ink); }
.feat b { font-family: var(--pixel); font-weight: 500; font-size: .82rem; }
.feat small { font-size: .7rem; color: var(--muted); }
.feat .feat-title { color: #c9b3ff; font-style: italic; }
.feat.on { border-color: #6b5a1d; background: linear-gradient(#3a3320, var(--panel)); }
.feat.on b { color: var(--gold); }
.feat.worn { box-shadow: 0 0 0 2px var(--gold); }
.feat:disabled { opacity: .55; }
/* aptitudes */
.apt-codex, .apt-offer { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.apt-offer { grid-template-columns: 1fr; margin: 8px 0; }
.apt-card { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 8px 10px; border-radius: 8px; border: 2px solid var(--edge); background: var(--panel); color: var(--ink); margin-bottom: 4px; }
.apt-card b { font-family: var(--pixel); font-weight: 500; }
.apt-card small { font-size: .74rem; }
.apt-card.r-rare { border-color: rgba(95, 179, 255, .6); }
.apt-card.r-rare b { color: var(--rare); }
.apt-card.r-epique { border-color: rgba(194, 124, 255, .7); background: linear-gradient(#352a55, var(--panel)); }
.apt-card.r-epique b { color: var(--epic); }
.apt-card.unknown { opacity: .45; }
.apt-card.pick { box-shadow: 0 3px 0 var(--edge); }
.apt-card.pick:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.apt-rar { font-family: var(--pixel); font-size: .64rem !important; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.apt-banner { width: 100%; margin: 6px 0; animation: pulse 1.2s infinite; }
.apt-chip { margin-left: 6px; padding: 0 5px; border-radius: 4px; border: 1px solid rgba(194, 124, 255, .7); background: rgba(194, 124, 255, .18); color: #e0ccff; font-size: .66rem; font-family: var(--pixel); }
.end-apts { display: block; color: #e0ccff; font-size: .72rem; margin-top: 2px; }
/* help buttons, advice */
.help-btn { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-left: 6px; padding: 0; border-radius: 50%; border: 2px solid var(--edge);
  background: var(--panel-3); color: var(--ink); font-family: var(--pixel); font-size: .75rem; line-height: 1; vertical-align: middle; }
.omen .danger { display: inline-block; margin: 2px 0 4px; }
.badge small { display: none; }
.hero .hero-when { position: absolute; right: 10px; bottom: 6px; font-size: .68rem; color: var(--muted); }
.hero { position: relative; }

/* Authored boss portraits share the battle sprite; retain their native pixel edges. */
.enemy-portrait{image-rendering:pixelated;flex-shrink:0}.menace .nb-head{gap:10px}.menace .nb-head h2{flex:1}

/* Company villages keep the same atlas and palette as the bastion. */
.company-map {position:relative;min-height:320px;margin:18px 0;background:repeating-linear-gradient(45deg,#293a35 0 8px,#2b3d37 8px 16px);border:3px solid #5a6650;border-radius:8px;overflow:hidden}
.company-map:before{content:"";position:absolute;left:48%;top:0;width:4%;height:100%;background:#8a7860;opacity:.4}
.map-village{position:absolute;transform:translate(-50%,-50%);display:flex;align-items:center;flex-direction:column;gap:4px;width:104px;max-width:32%;background:#202224cc;color:#f1d9aa;border:1px solid #6e655b;border-radius:6px;padding:6px;font:inherit}
.map-village span{font-size:12px;overflow-wrap:anywhere}.map-village small{font-size:10px}.map-village.home{border-color:#f1c783;background:#37393b}
.equipped{border-color:#e4b976!important;background:#404244!important}.duel-canvas{display:block;width:min(100%,260px);height:auto;margin:auto;image-rendering:pixelated}.duel-unit{display:flex;gap:8px;align-items:center;margin:6px 0}.duel-unit span:not(.sprite){flex:1}.duel-unit small{font-size:11px}.duel-unit.opponent{color:#edb0b5}.invite-code,.recovery-code{display:block;overflow-wrap:anywhere;padding:10px;background:#212224;border:1px solid #5d5f61;border-radius:5px;margin:10px 0}details{margin:12px 0}summary{cursor:pointer;color:#e7c18b}.card input,.card select{max-width:100%}

/* Invitations are reachable from every game tab, including an expedition. */
#duel-notices {flex:none;z-index:6;display:flex;flex-direction:column;gap:4px;padding:5px 8px;max-height:30vh;overflow:auto;background:var(--panel);border-top:3px solid var(--edge);}
#duel-notices[hidden]{display:none}
.duel-notice{display:flex;flex-wrap:wrap;align-items:center;gap:4px 6px}
.duel-notice .dn-icon{flex:none;color:var(--gold);font-size:1rem}
.duel-notice b{flex:1 1 calc(100% - 60px);min-width:0;font-family:var(--pixel);font-weight:400;font-size:.8rem;color:var(--gold);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.duel-notice .btn{order:2;flex:1;justify-content:center;text-align:center;padding:6px 9px;min-height:36px;font-size:.78rem}
.duel-notice .dn-close{order:1;flex:none;width:32px;height:28px;border:0;background:none;color:var(--muted);font-size:1rem}

/* Small live UX refinements: the places and preparation steps remain the same. */
.omen.omen-illustrated {padding:0;overflow:hidden;min-width:0;}
.omen-preview {display:block;width:100%;height:auto;aspect-ratio:208 / 72;image-rendering:pixelated;pointer-events:none;}
.omen-caption {padding:9px 11px 10px;}
.omen-illustrated .omen-head {flex-wrap:wrap;gap:4px 7px;}
.omen-illustrated .omen-head .new {margin-left:auto;}
.omen-choice {display:flex;align-items:center;justify-content:space-between;gap:6px;flex-wrap:wrap;}
.omen-read {color:var(--gold);font-size:.7rem;}
.omen-story details {margin-top:9px;font-size:.85rem;}
.omen-story summary {cursor:pointer;min-height:36px;display:list-item;align-content:center;color:var(--muted);}
.quest-label {color:var(--gold);font-family:var(--pixel);}
.world .blabel .bl-purpose {font: .6rem/1.25 var(--text);color:#e4d1ad;white-space:nowrap;}
.world .blabel.tiny .bl-purpose {font-size:.53rem;}

/* Preparation refinements: readable signs, a full narrative beat, and a separate companion picker. */
.world .blabel .bl-purpose {display:none;white-space:normal;text-align:center;max-width:78px;}
.world .blabel.show-purpose .bl-purpose {display:flex;flex-direction:column;gap:0;}
.world .blabel .bl-purpose > span {display:block;}
.omen-caption .risk {margin:7px 0 0;gap:4px;}
.omen-caption .risk .rk {font-size:.65rem;}
.presage-prologue {max-width:640px;margin:0 auto;padding-bottom:16px;}
.presage-prologue .omen-preview {border:2px solid var(--edge);border-radius:8px;margin-bottom:18px;}
.presage-prologue h2 {margin:8px 0 16px;}
.presage-prologue .story {font-size:1rem;line-height:1.75;margin:14px 0;}
.presage-prologue .presage-whisper {color:var(--gold);font-style:italic;}
.presage-prologue .row-buttons {margin-top:24px;}
.borrow-section {border-top:1px solid var(--panel-3);margin-top:20px;padding-top:14px;}
.borrow-section h3 {margin-bottom:10px;}
.borrow-section > .btn {width:100%;margin-top:8px;}
.borrow-selected {display:flex;align-items:center;gap:12px;background:var(--panel);border:2px solid var(--edge);border-radius:8px;padding:10px;}
.borrow-selected > div {flex:1;min-width:0;}
.borrow-selected small {display:block;font-size:.75rem;color:var(--muted);}
.borrow-owner {display:block;color:var(--gold)!important;overflow-wrap:anywhere;}
.borrow-pick {grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:16px 0;}
.borrow-pick .pick-hero {min-width:0;}

/* PvP uses the PvE stage and command dock; global invitations must not squeeze the battle. */
body.in-duel #duel-notices {display:none!important;}
body.in-duel .tools {flex-wrap:wrap;justify-content:flex-end;}
body.in-duel .dock .cmd > h2 {margin:6px 0;}
body.in-duel .dock-head {flex-wrap:wrap;}
body.in-duel .cmd-who {flex:1 1 100%;min-height:22px;}
body.in-duel .tools {flex:1 1 100%;min-width:0;max-width:100%;}

.duel-heading {position:absolute;top:5px;left:50%;transform:translateX(-50%);padding:4px 8px;border-radius:4px;background:#141617cc;color:#d8c9a9;font: .65rem/1.2 system-ui;max-width:90%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none;}

.duel-clock{color:var(--muted);font: .74rem var(--text);margin-left:auto;}

/* Narration owns the opening; it is also keyboard/touch dismissible. */
.say.show { pointer-events: auto; cursor: pointer; white-space: pre-line; max-height: 65%; overflow-y: auto; }
.speech-dismiss { display: block; margin-top: 8px; font-style: normal; font-size: .65rem; opacity: .75; }
.gear-preview { display: flex; justify-content: center; padding: 16px; background: var(--panel-2); border-radius: 10px; }
.gear-eligible { display: grid; gap: 8px; margin: 12px 0; }
.gear-eligible button { text-align: left; display: flex; gap: 10px; align-items: center; }
button.gear-card { color: inherit; font: inherit; cursor: pointer; text-align: center; }
.account-panel p { margin: 2px 0; }
.account-panel .btn { margin: 8px 8px 0 0; }

/* ---------- bastion districts: wooden signs on the whole bastion, a way back from a district ---------- */
.world .dsign {
  position: absolute; left: 0; top: 0; pointer-events: auto; will-change: transform;
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px; max-width: 46vw;
  padding: 4px 8px 5px; line-height: 1.15; font-family: var(--pixel); font-size: .72rem; color: var(--ink); white-space: nowrap;
  background: #4a3220; border: 2px solid var(--edge); border-radius: 3px;
  box-shadow: inset 0 0 0 1px #7a5634, inset 0 2px 0 #8a6440, 0 3px 0 rgba(0, 0, 0, .45);
}
.world .dsign.can { box-shadow: inset 0 0 0 1px #5d9a5a, inset 0 2px 0 #8a6440, 0 3px 0 rgba(0, 0, 0, .45); }
.world .dsign.empty { background: rgba(80, 60, 30, .92); padding: 2px 6px 3px; }
.world .dsign.empty .bname { color: #ffe8b0; font-size: .68rem; }
.world .dsign .ds-top { display: inline-flex; align-items: center; gap: 4px; }
.world .dsign .bname { color: var(--gold); font-size: .78rem; }
.world .dsign .bup { font-style: normal; color: #7dff9a; font-size: .7rem; animation: upBob 1s ease-in-out infinite; }
.world .dsign .alert { display: inline-block; min-width: 14px; padding: 0 4px; border-radius: 7px; background: var(--bad); color: #fff; font-size: .68rem; line-height: 14px; font-style: normal; animation: pulse 1s infinite; }
.world .dsign .ds-line { font-family: var(--text); font-size: .66rem; color: #e6d6b8; }
.world .dsign .ds-line.warn { color: #ffd36b; font-weight: 600; }
.world .bubble .brate { display: inline-flex; align-items: center; gap: 1px; margin-right: 3px; }
.district-back {
  pointer-events: auto; font-family: var(--pixel); font-size: .78rem; color: var(--gold); padding: 4px 10px 4px 8px;
  background: #4a3220; border: 2px solid var(--edge); border-radius: 3px; box-shadow: inset 0 0 0 1px #7a5634, 0 3px 0 rgba(0, 0, 0, .45);
}

/* ---------- interface kit: dressed stone and copper ----------
   Small pixel images drawn by tools/draw_ui_kit.py, stretched as nine-slices at 2 screen pixels per pixel. */
.sheet-card, .btn, .subtabs button, .sheet-card > div > h2:first-child, .sheet-close { image-rendering: pixelated; }
.sheet-card {
  border-style: solid; border-width: 12px 12px 0; border-radius: 0;
  border-image: url("assets/ui/frame.png") 6 / 12px 12px 0 repeat;
  background: linear-gradient(var(--panel), var(--bg-2));
}
/* The sheet's title hangs on two chains, carved in a light stone. */
.sheet-card > div > h2:first-child {
  position: relative; display: inline-block; max-width: calc(100% - 46px); margin: 18px 0 12px 6px; padding: 1px 8px 2px;
  border: 8px solid transparent; border-image: url("assets/ui/sign.png") 4 fill / 8px round;
  color: #141617; font-size: 1.05rem; text-shadow: 0 1px 0 rgba(230, 232, 234, .35); filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .35));
}
.sheet-card > div > h2:first-child .lvl { color: #2b2e31; }
.sheet-card > div > h2:first-child::before, .sheet-card > div > h2:first-child::after {
  content: ""; position: absolute; top: -24px; width: 8px; height: 18px; background: url("assets/ui/chain.png") 0 0 / 100% 100%;
}
.sheet-card > div > h2:first-child::before { left: 6px; }
.sheet-card > div > h2:first-child::after { right: 6px; }
.sheet-close {
  width: 34px; height: 34px; border: 0; border-radius: 0; color: #d6dae2; font-size: .72rem; text-shadow: 0 1px 0 #0c0d0e;
  background: url("assets/ui/ring.png") center / 24px 24px no-repeat;
}
/* Buttons are stone blocks: the main action glows like a torch, a quiet action is only outlined. */
.btn {
  border: 8px solid transparent; border-radius: 0; padding: 5px 8px; background: none; box-shadow: none;
  border-image: url("assets/ui/plank.png") 4 fill / 8px round; color: #efe9de; text-shadow: 0 1px 0 #0c0d0e;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .4));
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: none; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .4)); }
.btn.primary { border-image-source: url("assets/ui/plank-gold.png"); color: #2a1a05; text-shadow: 0 1px 0 rgba(255, 240, 180, .45); }
.btn.ghost { border: 2px solid var(--panel-3); border-image: none; padding: 11px 14px; background: rgba(20, 22, 23, .25); filter: none; }
.btn.small { padding: 0 4px; }
.btn.small.ghost { padding: 6px 10px; }
.btn.big { padding: 8px; }
.btn:disabled { opacity: .5; filter: grayscale(.7); }
/* Tabs are small blocks; the open one is the lighter stone. */
.subtabs button {
  border: 6px solid transparent; border-radius: 0; padding: 3px 2px; background: none; color: #d8d4cc;
  border-image: url("assets/ui/plank.png") 4 fill / 6px round;
}
.subtabs button.on { border-image-source: url("assets/ui/plank-lit.png"); color: #141617; }
.sheet-card .panel, .sheet-card .card { border-radius: 3px; border-color: var(--edge); }
.cost, .chip { border-radius: 3px; }
.trait { border-radius: 2px; background: var(--panel-2); color: var(--ink); box-shadow: inset 0 1px 0 var(--panel-3), 0 0 0 1px var(--edge); }

/* ---------- héros: the company of favourites, the roster's sorting ---------- */
.company { margin-bottom: 12px; }
.company h2 { margin-top: 4px; }
.comp-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.comp-slot {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 6px; min-height: 118px; min-width: 0;
  background: linear-gradient(var(--panel-2), var(--panel)); border: 3px solid var(--edge); border-radius: 3px; color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(242, 155, 58, .35), 0 3px 0 rgba(0, 0, 0, .3);
}
.comp-slot b { font-family: var(--pixel); font-weight: 500; font-size: .86rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-slot small { font-size: .74rem; color: var(--muted); }
.comp-slot .comp-away { position: absolute; top: 4px; right: 4px; font-family: var(--pixel); font-size: .6rem; color: var(--gold); }
.comp-slot:not(.pret):not(.empty) .sprite { opacity: .65; }
.comp-art { display: flex; align-items: flex-start; justify-content: center; width: 100%; }
.comp-slot.empty { justify-content: center; background: rgba(0, 0, 0, .18); box-shadow: none; border-style: dashed; border-color: var(--panel-3); color: var(--panel-3); }
.comp-slot.empty span { font-size: 1.6rem; }
.roster-head { display: flex; flex-direction: column; gap: 4px; margin: 14px 0 8px; }
.roster-head h2 { margin: 0; }
.sorts { display: flex; gap: 4px; flex-wrap: wrap; }
.sorts .sort { font-family: var(--pixel); font-size: .72rem; padding: 3px 8px; border: 2px solid var(--edge); border-radius: 3px; background: var(--panel); color: var(--muted); }
.sorts .sort.on { background: var(--gold); color: #1a0d04; }
.fav-mark { color: var(--gold); margin-right: 5px; }
.hero.fav { border-color: #6b4a1d; }
.todo-tag { margin-left: 6px; font-family: var(--pixel); font-size: .66rem; color: #1a0d04; background: var(--gold); padding: 0 5px; border-radius: 2px; }
.fav-note { margin: 2px 0 4px; font-family: var(--pixel); font-size: .8rem; color: var(--gold); }
.pick-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px; text-align: left; color: var(--ink);
  background: var(--panel); border: 2px solid var(--edge); border-radius: 3px; }
.pick-row b { font-family: var(--pixel); font-weight: 500; }
.pick-row small { color: var(--muted); margin-left: auto; }
.pick-row.on { border-color: var(--gold); }
.counter-actions { display: flex; flex-direction: column; gap: 4px; }

/* Ascension: a soft golden glow, stronger with each star; the third one breathes. */
.sprite.asc1 { filter: drop-shadow(0 0 3px rgba(255, 214, 110, .55)); }
.sprite.asc2 { filter: drop-shadow(0 0 2px rgba(255, 220, 120, .6)) drop-shadow(0 0 7px rgba(255, 196, 80, .45)); }
.sprite.asc3 { filter: drop-shadow(0 0 2px rgba(255, 226, 130, .75)) drop-shadow(0 0 10px rgba(255, 190, 70, .55)); animation: asc-breathe 2.6s ease-in-out infinite; }
@keyframes asc-breathe { 50% { filter: drop-shadow(0 0 3px rgba(255, 226, 130, .9)) drop-shadow(0 0 14px rgba(255, 190, 70, .7)); } }
@media (prefers-reduced-motion: reduce) { .sprite.asc3 { animation: none; } }

/* Battle center (preview builds only) */
.bc-open { margin: 0 0 10px; }
.bc h3 { margin: 14px 0 6px; }
/* Sound workshop (preview only, sound_lab.js) */
.sl-filter { width: 100%; margin: 8px 0 10px; }
.sl-group { border-top: 1px solid var(--panel-2); padding: 6px 0; }
.sl-group summary { cursor: pointer; padding: 6px 0; font-family: var(--pixel); }
.sl-chain { display: flex; gap: 6px; margin: 4px 0 6px; }
.sl-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.sl-play { min-width: 44px; }
.sl-text { display: grid; min-width: 0; }
.sl-text small { overflow-wrap: anywhere; }
.sl-on { filter: brightness(1.4); }
.bc-lineup { display: flex; flex-wrap: wrap; gap: 6px; min-height: 64px; padding: 6px; border: 2px dashed var(--panel-3); border-radius: 8px; margin-bottom: 8px; }
.bc-slot { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 74px; padding: 4px; background: var(--panel-2); border: 2px solid var(--edge); border-radius: 6px; font-size: .72rem; text-align: center; }
.bc-slot.boss { width: 150px; }
.bc-slot.boss select { width: 100%; font-size: .72rem; }
.bc-slot.elite { border-color: var(--gold); }
.bc-slot b { line-height: 1.1; }
.bc-x { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--edge); background: var(--panel-3); font-size: .7rem; padding: 0; z-index: 1; }
.bc-art { position: relative; background: none; border: 0; padding: 0; }
.bc-star { position: absolute; top: -2px; left: -4px; color: var(--gold); font-style: normal; text-shadow: 0 1px 0 #000; }
.bc-tabs { margin: 6px 0; }
.bc-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 4px; max-height: 190px; overflow-y: auto; padding: 2px; }
.bc-foe, .bc-hero { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 3px 2px; background: var(--panel); border: 2px solid var(--edge); border-radius: 6px; font-size: .66rem; line-height: 1.1; text-align: center; }
.bc-foe.on, .bc-hero.on { background: var(--panel-3); border-color: var(--gold); }
.bc-foe:disabled, .bc-hero:disabled { opacity: .45; }
.bc-heroes { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 4px; max-height: 210px; overflow-y: auto; padding: 2px; }
.bc-settings { display: grid; gap: 6px; margin-top: 10px; font-size: .85rem; }
.bc-settings label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bc-check { display: flex; align-items: center; gap: 6px; font-size: .78rem; }
.bc-step { display: inline-flex; align-items: center; gap: 3px; }
.bc-step button { min-width: 30px; padding: 3px 5px; border: 2px solid var(--edge); border-radius: 5px; background: var(--panel-2); font-size: .78rem; }
.bc-step b { min-width: 52px; text-align: center; font-size: .8rem; }
.bc-step .bc-auto { min-width: 64px; }
.bc-loadout { margin-top: 8px; padding: 6px; background: var(--panel-2); border: 2px solid var(--edge); border-radius: 6px; }
.bc-lhead { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.bc-lhead .bc-step { margin-left: auto; }
.bc-skills { display: flex; flex-wrap: wrap; gap: 4px; }
.bc-skill { padding: 3px 7px; border: 2px solid var(--edge); border-radius: 12px; background: var(--panel); color: var(--muted); font-size: .72rem; }
.bc-skill.on { background: var(--panel-3); color: var(--ink); border-color: var(--gold); }
.bc-skill:disabled { opacity: .45; }
.bc-go { position: sticky; bottom: -12px; padding: 10px 0 4px; background: linear-gradient(transparent, var(--panel) 40%); }
.tools .tool.stop { color: #ff8f7a; }
.bc-settings label.bc-check { justify-content: flex-start; }

/* Our own status glyphs (no emoji for these). Silence: a speech bubble with its dots, crossed out. */
.st-glyph { display: inline-block; width: 1.25em; height: 1.1em; vertical-align: -0.15em; background: center / contain no-repeat; image-rendering: pixelated; }
.st-silence { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2011%2010%22%20shape-rendering%3D%22crispEdges%22%3E%3Crect%20x%3D%222%22%20y%3D%220%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%223%22%20y%3D%220%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%224%22%20y%3D%220%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%225%22%20y%3D%220%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%226%22%20y%3D%220%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%227%22%20y%3D%220%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%228%22%20y%3D%220%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%221%22%20y%3D%221%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%222%22%20y%3D%221%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%223%22%20y%3D%221%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%224%22%20y%3D%221%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%225%22%20y%3D%221%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%226%22%20y%3D%221%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%227%22%20y%3D%221%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%228%22%20y%3D%221%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%229%22%20y%3D%221%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%220%22%20y%3D%222%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%221%22%20y%3D%222%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%222%22%20y%3D%222%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%223%22%20y%3D%222%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%224%22%20y%3D%222%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%225%22%20y%3D%222%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%226%22%20y%3D%222%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%227%22%20y%3D%222%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%228%22%20y%3D%222%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%229%22%20y%3D%222%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%2210%22%20y%3D%222%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%220%22%20y%3D%223%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%221%22%20y%3D%223%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%222%22%20y%3D%223%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233e2731%22/%3E%3Crect%20x%3D%223%22%20y%3D%223%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%224%22%20y%3D%223%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%225%22%20y%3D%223%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233e2731%22/%3E%3Crect%20x%3D%226%22%20y%3D%223%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%227%22%20y%3D%223%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%228%22%20y%3D%223%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233e2731%22/%3E%3Crect%20x%3D%229%22%20y%3D%223%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%2210%22%20y%3D%223%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%220%22%20y%3D%224%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%221%22%20y%3D%224%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%222%22%20y%3D%224%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%223%22%20y%3D%224%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%224%22%20y%3D%224%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%225%22%20y%3D%224%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%226%22%20y%3D%224%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%227%22%20y%3D%224%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%228%22%20y%3D%224%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%229%22%20y%3D%224%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%2210%22%20y%3D%224%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%221%22%20y%3D%225%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%222%22%20y%3D%225%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%223%22%20y%3D%225%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%224%22%20y%3D%225%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%225%22%20y%3D%225%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%226%22%20y%3D%225%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%227%22%20y%3D%225%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%228%22%20y%3D%225%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23ead4aa%22/%3E%3Crect%20x%3D%229%22%20y%3D%225%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%222%22%20y%3D%226%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%223%22%20y%3D%226%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%224%22%20y%3D%226%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%225%22%20y%3D%226%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%226%22%20y%3D%226%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%227%22%20y%3D%226%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%228%22%20y%3D%226%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%223%22%20y%3D%227%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%224%22%20y%3D%227%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%223%22%20y%3D%228%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%233f2631%22/%3E%3Crect%20x%3D%220%22%20y%3D%229%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%221%22%20y%3D%229%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%221%22%20y%3D%228%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%222%22%20y%3D%228%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%222%22%20y%3D%227%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%229%22%20y%3D%220%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3Crect%20x%3D%2210%22%20y%3D%220%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23e43b44%22/%3E%3C/svg%3E"); }

/* the "?" next to a tapped enemy: opens its bestiary page (run.js askAbout) */
.ask { position: absolute; z-index: 5; width: 24px; height: 24px; padding: 0; transform: translate(-50%, -100%); font-size: 0; color: #4a2a14;
  background: #efe2c4; border: 2px solid #1c1418; border-radius: 3px; box-shadow: inset 0 -2px 0 #cdb88e, 0 2px 0 rgba(0, 0, 0, .45); animation: askBob 1.2s ease-in-out infinite; }
.ask::before { content: ""; position: absolute; left: 50%; top: 50%; width: 7px; height: 9px; transform: translate(-50%, -55%); background: currentColor;
  -webkit-mask: var(--q-mark) center / 100% 100% no-repeat; mask: var(--q-mark) center / 100% 100% no-repeat; image-rendering: pixelated; }
.ask::after { content: ""; position: absolute; left: 50%; bottom: -7px; margin-left: -4px; border: 4px solid transparent; border-top: 5px solid #1c1418; border-bottom: 0; }
.ask.pop { animation: askPop .25s ease-out, askBob 1.2s ease-in-out .25s infinite; }
@keyframes askPop { from { transform: translate(-50%, -100%) scale(.3); opacity: 0; } }
@keyframes askBob { 50% { transform: translate(-50%, calc(-100% - 2px)); } }
/* the bestiary page over the fight (run.js beastBook): the fight waits behind it; a tap outside or the cross closes it */
.beast-pop { position: absolute; inset: 0; z-index: 7; line-height: 1.35; font-size: 1rem; white-space: normal; text-align: left; display: grid; place-items: center; padding: 8px; background: rgba(8, 6, 10, .55); animation: fadeIn .15s ease-out; }
.beast-pop .lib-book { position: relative; width: min(100%, 360px); max-height: 100%; overflow: auto; }
.beast-pop .book-page { padding-right: 40px; }
.beast-pop .x-btn { color: #5a2a1a; background: none; }
.beast-pop .book-unknown { color: #7a6448; font-style: italic; }
@keyframes fadeIn { from { opacity: 0; } }
.beast-book .book-head canvas, .beast-book .book-head img { flex: none; }

/* One close mark everywhere: a pixel cross drawn in the middle of its button (no font glyph, so it never sits off-centre). */
:root { --x-mark: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 8 8%22 shape-rendering=%22crispEdges%22%3E%3Crect x=%220%22 y=%220%22 width=%221%22 height=%221%22/%3E%3Crect x=%221%22 y=%220%22 width=%221%22 height=%221%22/%3E%3Crect x=%226%22 y=%220%22 width=%221%22 height=%221%22/%3E%3Crect x=%227%22 y=%220%22 width=%221%22 height=%221%22/%3E%3Crect x=%220%22 y=%221%22 width=%221%22 height=%221%22/%3E%3Crect x=%221%22 y=%221%22 width=%221%22 height=%221%22/%3E%3Crect x=%222%22 y=%221%22 width=%221%22 height=%221%22/%3E%3Crect x=%225%22 y=%221%22 width=%221%22 height=%221%22/%3E%3Crect x=%226%22 y=%221%22 width=%221%22 height=%221%22/%3E%3Crect x=%227%22 y=%221%22 width=%221%22 height=%221%22/%3E%3Crect x=%221%22 y=%222%22 width=%221%22 height=%221%22/%3E%3Crect x=%222%22 y=%222%22 width=%221%22 height=%221%22/%3E%3Crect x=%223%22 y=%222%22 width=%221%22 height=%221%22/%3E%3Crect x=%224%22 y=%222%22 width=%221%22 height=%221%22/%3E%3Crect x=%225%22 y=%222%22 width=%221%22 height=%221%22/%3E%3Crect x=%226%22 y=%222%22 width=%221%22 height=%221%22/%3E%3Crect x=%222%22 y=%223%22 width=%221%22 height=%221%22/%3E%3Crect x=%223%22 y=%223%22 width=%221%22 height=%221%22/%3E%3Crect x=%224%22 y=%223%22 width=%221%22 height=%221%22/%3E%3Crect x=%225%22 y=%223%22 width=%221%22 height=%221%22/%3E%3Crect x=%222%22 y=%224%22 width=%221%22 height=%221%22/%3E%3Crect x=%223%22 y=%224%22 width=%221%22 height=%221%22/%3E%3Crect x=%224%22 y=%224%22 width=%221%22 height=%221%22/%3E%3Crect x=%225%22 y=%224%22 width=%221%22 height=%221%22/%3E%3Crect x=%221%22 y=%225%22 width=%221%22 height=%221%22/%3E%3Crect x=%222%22 y=%225%22 width=%221%22 height=%221%22/%3E%3Crect x=%223%22 y=%225%22 width=%221%22 height=%221%22/%3E%3Crect x=%224%22 y=%225%22 width=%221%22 height=%221%22/%3E%3Crect x=%225%22 y=%225%22 width=%221%22 height=%221%22/%3E%3Crect x=%226%22 y=%225%22 width=%221%22 height=%221%22/%3E%3Crect x=%220%22 y=%226%22 width=%221%22 height=%221%22/%3E%3Crect x=%221%22 y=%226%22 width=%221%22 height=%221%22/%3E%3Crect x=%222%22 y=%226%22 width=%221%22 height=%221%22/%3E%3Crect x=%225%22 y=%226%22 width=%221%22 height=%221%22/%3E%3Crect x=%226%22 y=%226%22 width=%221%22 height=%221%22/%3E%3Crect x=%227%22 y=%226%22 width=%221%22 height=%221%22/%3E%3Crect x=%220%22 y=%227%22 width=%221%22 height=%221%22/%3E%3Crect x=%221%22 y=%227%22 width=%221%22 height=%221%22/%3E%3Crect x=%226%22 y=%227%22 width=%221%22 height=%221%22/%3E%3Crect x=%227%22 y=%227%22 width=%221%22 height=%221%22/%3E%3C/svg%3E"); --q-mark: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 7 9%22 shape-rendering=%22crispEdges%22%3E%3Crect x=%221%22 y=%220%22 width=%221%22 height=%221%22/%3E%3Crect x=%222%22 y=%220%22 width=%221%22 height=%221%22/%3E%3Crect x=%223%22 y=%220%22 width=%221%22 height=%221%22/%3E%3Crect x=%224%22 y=%220%22 width=%221%22 height=%221%22/%3E%3Crect x=%225%22 y=%220%22 width=%221%22 height=%221%22/%3E%3Crect x=%220%22 y=%221%22 width=%221%22 height=%221%22/%3E%3Crect x=%221%22 y=%221%22 width=%221%22 height=%221%22/%3E%3Crect x=%225%22 y=%221%22 width=%221%22 height=%221%22/%3E%3Crect x=%226%22 y=%221%22 width=%221%22 height=%221%22/%3E%3Crect x=%220%22 y=%222%22 width=%221%22 height=%221%22/%3E%3Crect x=%221%22 y=%222%22 width=%221%22 height=%221%22/%3E%3Crect x=%225%22 y=%222%22 width=%221%22 height=%221%22/%3E%3Crect x=%226%22 y=%222%22 width=%221%22 height=%221%22/%3E%3Crect x=%224%22 y=%223%22 width=%221%22 height=%221%22/%3E%3Crect x=%225%22 y=%223%22 width=%221%22 height=%221%22/%3E%3Crect x=%223%22 y=%224%22 width=%221%22 height=%221%22/%3E%3Crect x=%224%22 y=%224%22 width=%221%22 height=%221%22/%3E%3Crect x=%223%22 y=%225%22 width=%221%22 height=%221%22/%3E%3Crect x=%224%22 y=%225%22 width=%221%22 height=%221%22/%3E%3Crect x=%223%22 y=%227%22 width=%221%22 height=%221%22/%3E%3Crect x=%224%22 y=%227%22 width=%221%22 height=%221%22/%3E%3Crect x=%223%22 y=%228%22 width=%221%22 height=%221%22/%3E%3Crect x=%224%22 y=%228%22 width=%221%22 height=%221%22/%3E%3C/svg%3E"); }
.sheet-close, .dn-close, .bc-x, .x-btn { font-size: 0 !important; color: #e8dcc4; }
.dn-close, .bc-x { position: relative; }
.sheet-close::before, .dn-close::before, .bc-x::before, .x-btn::before { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; transform: translate(-50%, -50%); background: currentColor;
  -webkit-mask: var(--x-mark) center / contain no-repeat; mask: var(--x-mark) center / contain no-repeat; }
.sheet-close:active::before, .x-btn:active::before { transform: translate(-50%, calc(-50% + 1px)); }
.x-btn { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; padding: 0; border: 0; z-index: 2; background: url("assets/ui/ring.png") center / 24px 24px no-repeat; }
/* The auto tip points at its button for a few seconds. */
.tool.nudge { box-shadow: 0 0 0 3px var(--gold); animation: guide-bob 1s ease-in-out infinite; }
