/* Layout: one centred column, a status strip on top, the crucible as the focal panel. */
:root {
  --bg: #17110d;
  --panel: #221a14;
  --panel-2: #2b2119;
  --line: #3d2e22;
  --text: #f1e6d6;
  --muted: #a8957f;
  --brass: #d6a453;
  --danger: #d9534a;
  --good: #79c28f;
  --fire: #e2643a;
  --water: #3e8fd1;
  --earth: #a07d4c;
  --wind: #5cb88a;
  --aether: #b48ae2;
  --poison: #b7c43a;
  --metal: #a9b6c4;
  --slag: #5a5049;
  --r-common: #cfc8bc;
  --r-rare: #4f9be8;
  --r-epic: #b46cf0;
  --r-legendary: #f2a33a;
  --display: "Noto Serif SC", "Songti SC", "STSong", serif;
  --body: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { height: 100%; }
body { min-height: 100%; margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 var(--body); }
.wrap { max-width: 980px; margin: 0 auto; padding-block: 16px 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 16px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; text-wrap: balance; }
h1 { font-weight: 900; font-size: clamp(40px, 9vw, 72px); color: var(--brass); letter-spacing: 0.12em; line-height: 1.1; }
h2 { font-size: 26px; color: var(--brass); }
h3 { font-size: 19px; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 12px; min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
button { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--brass); }
button:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--brass); color: #1d140c; border-color: var(--brass); font-weight: 600; }
.choice { text-align: left; display: grid; gap: 4px; padding: 14px 16px; }
.choice strong { font-family: var(--display); font-size: 20px; font-weight: 600; color: var(--brass); }

/* status strip */
.status { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font-variant-numeric: tabular-nums; }
.status b { color: var(--brass); font-weight: 600; }
.bag { display: flex; flex-wrap: wrap; gap: 6px; }
.relics { display: flex; flex-wrap: wrap; gap: 6px; }
.relic { font-size: 12px; padding: 2px 8px; border: 1px solid var(--brass); color: var(--brass); border-radius: 999px; }

/* element tokens */
.tok { --c: var(--muted); display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 8px; border-radius: 999px; border: 2px solid var(--c); color: var(--text); background: color-mix(in srgb, var(--c) 22%, var(--panel-2)); font-family: var(--display); font-size: 20px; }
.tok.small { min-width: 26px; height: 26px; font-size: 13px; border-width: 1px; padding: 0 6px; }
.tok.fire { --c: var(--fire); }
.tok.water { --c: var(--water); }
.tok.earth { --c: var(--earth); }
.tok.wind { --c: var(--wind); }
.tok.aether { --c: var(--aether); }
.tok.poison { --c: var(--poison); }
.tok.metal { --c: var(--metal); }
.tok.slag { --c: var(--slag); color: var(--muted); border-style: dashed; }
button.tok { cursor: pointer; transition: transform 0.12s; }
button.tok[aria-pressed="true"] { transform: translateY(-6px); box-shadow: 0 0 0 3px var(--brass); }

/* combat */
.combat { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bar { height: 10px; border-radius: 5px; background: #0f0b08; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--good); transition: width 0.3s; }
.bar.enemy span { background: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.chip { padding: 1px 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.intent { font-family: var(--display); font-size: 20px; color: var(--danger); }
.crucible { border-color: var(--brass); }
.hand { display: flex; flex-wrap: wrap; gap: 10px; min-height: 50px; }
.preview { min-height: 52px; padding: 10px 12px; border-radius: 8px; background: var(--panel-2); }
.preview strong { font-family: var(--display); font-size: 20px; font-weight: 600; color: var(--brass); }
.badge { font-size: 12px; color: #1d140c; background: var(--brass); border-radius: 4px; padding: 0 6px; margin-left: 6px; }
.log { display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.log p:last-child { color: var(--text); }
.toast { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--danger); color: #fff; padding: 8px 16px; border-radius: 8px; max-width: calc(100% - 32px); }

/* recipe book */
.book { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.recipe { padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); display: grid; gap: 4px; font-size: 13px; }
.recipe.unknown { opacity: 0.55; }
.recipe strong { font-family: var(--display); font-size: 17px; font-weight: 600; color: var(--brass); }
.hero { display: grid; gap: 10px; padding-block: 24px 8px; }
.result-title { font-size: 40px; }

.row.tight { gap: 4px; }
.choice { transition: transform 0.15s, border-color 0.15s; }
.choice:hover:not(:disabled) { transform: translateY(-2px); }
.choice.rare { border-color: var(--brass); box-shadow: 0 0 16px color-mix(in srgb, var(--brass) 25%, transparent); }
.node-elite strong, .node-boss strong { color: var(--danger); }
.intent-block { color: var(--water); }
.intent-buff, .intent-weak, .intent-curse { color: var(--aether); }
.intent-burn { color: var(--fire); }
.fighter { position: relative; }
.relic.potion { border-color: var(--good); color: var(--good); }

/* crucible pot */
.crucible-row { display: flex; gap: 16px; align-items: flex-start; }
.crucible-main { flex: 1; min-width: 0; display: grid; gap: 12px; }
.pot { position: relative; flex: none; width: 96px; height: 84px; margin-top: 8px; border-radius: 10px 10px 44px 44px; background: linear-gradient(#3a2c21, #1d150f); border: 2px solid #5b4433; overflow: hidden; }
.pot::before { content: ""; position: absolute; inset: -2px -8px auto; height: 12px; border-radius: 6px; background: #5b4433; z-index: 2; }
.pot .liquid { position: absolute; inset: 22px 6px 6px; border-radius: 4px 4px 36px 36px; background: var(--panel-2); transition: background 0.35s; }
.pot.ready .liquid { box-shadow: 0 0 22px currentColor; }
.pot.ready { box-shadow: 0 0 24px color-mix(in srgb, var(--brass) 35%, transparent); }
.pot.big { width: 160px; height: 140px; border-radius: 16px 16px 74px 74px; }
.pot.big .liquid { inset: 34px 10px 10px; border-radius: 6px 6px 60px 60px; background: conic-gradient(from 90deg, var(--fire), var(--aether), var(--water), var(--wind), var(--fire)); opacity: 0.75; animation: swirl 9s linear infinite; }
.bubble { position: absolute; bottom: 14px; width: 9px; height: 9px; border-radius: 50%; background: color-mix(in srgb, var(--text) 45%, transparent); opacity: 0; animation: rise 2.4s ease-in infinite; z-index: 1; }
.bubble.b1 { left: 28%; }
.bubble.b2 { left: 52%; animation-delay: 0.8s; width: 6px; height: 6px; }
.bubble.b3 { left: 70%; animation-delay: 1.6s; }
@keyframes rise { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 0.9; } 100% { transform: translateY(-60px); opacity: 0; } }
@keyframes swirl { to { filter: hue-rotate(360deg); } }
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.hero-text { display: grid; gap: 10px; flex: 1 1 320px; min-width: 0; }

/* belt */
.belt { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 4px; border-top: 1px dashed var(--line); }
.flask { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; border-color: var(--good); }
.flask-dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }

/* effects layer */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.float { position: fixed; font-family: var(--display); font-size: 26px; font-weight: 700; white-space: nowrap; text-shadow: 0 2px 6px #000c; }
.float.dmg { color: #ff8a7a; font-size: 30px; }
.float.burn { color: var(--fire); }
.float.heal { color: var(--good); }
.float.block { color: #8fc3f0; font-size: 20px; }
.float.status { color: var(--brass); font-size: 18px; }
.float.name { color: var(--text); font-size: 18px; }
.particle { position: fixed; width: 7px; height: 7px; border-radius: 50%; }
.orb { position: fixed; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%; }
.tok.flying { position: fixed; margin: 0; z-index: 51; }
.banner { position: fixed; left: 50%; top: 38%; display: grid; justify-items: center; gap: 2px; padding: 14px 32px; border-radius: 12px; background: color-mix(in srgb, var(--bg) 88%, transparent); border: 1px solid var(--brass); box-shadow: 0 0 40px color-mix(in srgb, var(--brass) 40%, transparent); }
.banner span { font-size: 13px; letter-spacing: 0.3em; color: var(--brass); }
.banner strong { font-family: var(--display); font-weight: 600; font-size: 36px; color: var(--text); }

/* deal and screen transitions */
.hand.deal .tok { animation: deal 0.36s cubic-bezier(.2,.8,.3,1.2) both; animation-delay: calc(var(--i) * 70ms); }
@keyframes deal { from { transform: translateY(-36px) scale(0.5) rotate(-20deg); opacity: 0; } }
.enter > * { animation: enter 0.35s ease-out both; }
.enter > *:nth-child(2) { animation-delay: 0.05s; }
.enter > *:nth-child(3) { animation-delay: 0.1s; }
.enter > *:nth-child(4) { animation-delay: 0.15s; }
@keyframes enter { from { transform: translateY(10px); opacity: 0; } }
body[data-busy] .wrap button { pointer-events: none; }

/* title: schools, depth, achievements */
.split.schools { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
button.quiet { padding: 4px 10px; font-size: 13px; background: transparent; }
.choice.school[aria-pressed="true"] { border-color: var(--brass); background: color-mix(in srgb, var(--brass) 14%, var(--panel-2)); box-shadow: 0 0 0 1px var(--brass); }
button.depth { width: 44px; height: 44px; padding: 0; font-family: var(--display); font-size: 18px; }
button.depth[aria-pressed="true"] { background: var(--brass); color: #1d140c; border-color: var(--brass); }
.rules { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; display: grid; gap: 2px; }
.achievements { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.ach { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.ach strong { font-family: var(--display); font-size: 16px; color: var(--muted); }
.ach.earned { border-color: var(--brass); color: var(--text); }
.ach.earned strong { color: var(--brass); }
.unlock { color: var(--brass); font-family: var(--display); font-size: 20px; }

/* portraits */
.fighter-head { display: flex; align-items: center; gap: 12px; }
.portrait { width: 96px; height: 96px; flex: none; border-radius: 12px; background: radial-gradient(circle at 50% 60%, #3a2c21, transparent 70%); }
.portrait.boss { width: 120px; height: 120px; }
.portrait svg { width: 100%; height: 100%; display: block; transform-origin: 50% 88%; animation: idle 2.8s ease-in-out infinite; }
@keyframes idle { 50% { transform: scale(1.03, 0.97) translateY(1px); } }

/* map */
.map-wrap { display: grid; justify-items: center; }
.map { width: 100%; max-width: 460px; height: auto; overflow: visible; }
.map .edge { stroke-width: 2.5; stroke-linecap: round; }
.map .edge.live { stroke: #6b5644; }
.map .edge.dead { stroke: var(--line); opacity: 0.5; }
.map .edge.walked { stroke: var(--brass); stroke-width: 3.5; }
.map .edge.open { stroke: var(--brass); stroke-dasharray: 6 6; animation: march 0.9s linear infinite; }
@keyframes march { to { stroke-dashoffset: -12; } }
.map .node circle { fill: var(--panel-2); stroke: #5b4433; stroke-width: 2; }
.map .node.dead { opacity: 0.28; }
.map .node.visited circle { fill: color-mix(in srgb, var(--brass) 28%, var(--panel-2)); stroke: var(--brass); }
.map .node.current circle { fill: color-mix(in srgb, var(--brass) 45%, var(--panel-2)); stroke: var(--brass); stroke-width: 3.5; }
.map .node.avail { cursor: pointer; transform-box: fill-box; transform-origin: center; animation: beckon 1.5s ease-in-out infinite; }
.map .node.avail circle { stroke: var(--brass); stroke-width: 3; fill: #3a2c21; }
.map .node.avail:hover circle, .map .node.avail:focus-visible circle { fill: color-mix(in srgb, var(--brass) 35%, var(--panel-2)); }
.map .node:focus { outline: none; }
.map .node.avail:focus-visible circle { stroke: #fff; }
@keyframes beckon { 50% { transform: scale(1.12); } }
.type-fight { color: var(--text); }
.type-elite, .type-boss { color: var(--danger); }
.type-event { color: var(--aether); }
.type-rest { color: var(--fire); }
.type-shop { color: var(--brass); }
.map .node.type-boss circle { stroke: var(--danger); }
.node-icon { display: inline-grid; width: 22px; height: 22px; flex: none; }
.node-icon svg { width: 100%; height: 100%; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; font-size: 13px; color: var(--muted); }

/* help, settings, history */
button.chip { font: inherit; font-size: 13px; color: var(--text); cursor: help; padding: 1px 8px; }
button.intent { background: none; border: none; padding: 0; cursor: help; text-decoration: underline dotted 1px; text-underline-offset: 4px; }
button.relic { font: inherit; font-size: 12px; background: none; cursor: help; padding: 2px 8px; }
.settings { margin-left: auto; }
.toast.info { background: var(--panel-2); border: 1px solid var(--brass); color: var(--text); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; max-width: min(560px, calc(100% - 32px)); }
.toast.info strong { color: var(--brass); font-family: var(--display); }
.history { display: grid; gap: 6px; }
.history-row { display: grid; grid-template-columns: 7em 1fr auto; gap: 12px; align-items: baseline; padding: 6px 10px; border-radius: 8px; background: var(--panel-2); font-size: 14px; }
.history-row strong { font-family: var(--display); color: var(--muted); }
.history-row.won strong { color: var(--brass); }

/* player portraits and element effects */
.school-head { display: flex; align-items: center; gap: 10px; }
.school-art { width: 56px; height: 56px; flex: none; display: inline-block; }
.school-art svg, .school-art.raw svg { width: 100%; height: 100%; display: block; }
.portrait.player .school-art.raw { width: 100%; height: 100%; }
.portrait.player svg { animation-duration: 3.4s; }
.choice.school[disabled] .school-art { filter: grayscale(1) brightness(.5); }
.passive-text { color: var(--brass); font-size: 13px; }
button.passive { font: inherit; font-size: 13px; color: var(--brass); background: none; border: 1px dashed var(--brass); padding: 1px 8px; cursor: help; justify-self: start; }
.stack { display: grid; gap: 4px; min-width: 0; }
.vfx { position: fixed; left: 0; top: 0; pointer-events: none; transform: translate(-50%, -50%); z-index: 52; }
.vfx svg { width: 100%; height: 100%; display: block; }
.vfx.glow { border-radius: 50%; }
.vfx.ring { border-radius: 50%; }
.vfx.flame { border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; background: linear-gradient(#ffe08a, #ff6a2a 70%); box-shadow: 0 0 10px #ff8a3d; }
.vfx.drop { width: 8px; height: 11px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: #8fd0ff; box-shadow: 0 0 6px #3e8fd1; }
.vfx.shard { background: linear-gradient(135deg, #c9a46a, #6b4f2f); clip-path: polygon(50% 0, 100% 40%, 80% 100%, 15% 85%, 0 30%); }
.vfx.blob { border-radius: 50%; background: radial-gradient(circle at 40% 40%, rgba(212,223,99,.9), rgba(95,122,42,.55) 60%, transparent 72%); }
.vfx.slash-line { width: 150px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, transparent, #ffffff 45%, #c9d4df 55%, transparent); box-shadow: 0 0 10px #ffffff; }
.vfx.spark { width: 5px; height: 5px; border-radius: 50%; background: #fff6c2; box-shadow: 0 0 6px #ffd34d; }
.vfx.trail { width: 10px; height: 10px; border-radius: 50%; filter: blur(1px); }
.vfx.plus { color: var(--good); font: 700 26px var(--display); text-shadow: 0 0 8px rgba(121,194,143,.8); }
.vfx.fragment { border-radius: 2px; }
.vfx.bolt { transform: none; filter: drop-shadow(0 0 8px #ffd34d); }
.vfx.screen-flash { inset: 0; transform: none; }

/* workshop, rewards, collection */
.stardust { font-family: var(--display); color: var(--brass); font-size: 18px; }
.upgrade-group { display: grid; gap: 8px; }
.upgrade-group h3 { color: var(--muted); font-size: 15px; }
.choice.upgrade.maxed { border-color: color-mix(in srgb, var(--brass) 50%, var(--line)); }
.pips { display: inline-flex; gap: 3px; margin-left: 6px; }
.pips i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--brass); }
.pips i.on { background: var(--brass); }
.ach .reward { color: var(--muted); font-size: 12px; }
.ach.earned .reward { color: var(--text); }
.ach.rare { border-style: dashed; }
.ach.rare.earned { border-style: solid; box-shadow: 0 0 14px color-mix(in srgb, var(--brass) 30%, transparent); }
.tag { font-size: 11px; padding: 0 6px; border-radius: 4px; background: color-mix(in srgb, var(--aether) 30%, var(--panel-2)); color: var(--text); }
button.claim { justify-self: start; padding: 4px 12px; font-size: 13px; animation: beckon-btn 1.4s ease-in-out infinite; }
@keyframes beckon-btn { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brass) 35%, transparent); } }
.claim-notice { justify-self: start; border-color: var(--brass); color: var(--brass); }
.player-title { font-family: var(--display); color: var(--aether); letter-spacing: 0.2em; }
.choice.legendary { border-color: var(--aether); background: color-mix(in srgb, var(--aether) 14%, var(--panel-2)); box-shadow: 0 0 20px color-mix(in srgb, var(--aether) 35%, transparent); }
.choice.legendary strong { color: var(--aether); }
.relic.legendary { border-color: var(--aether); color: var(--aether); }
.skin-pick { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.skin-pick.on { border-color: var(--brass); color: var(--brass); }
.swatch { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #5b4433; background: linear-gradient(#3a2c21, #1d150f); }

/* crucible skins: body gradient, rim and glow */
.pot.skin-brass, .swatch.skin-brass { background: linear-gradient(#c8964a, #6b4a1c); border-color: #e0b066; }
.pot.skin-brass::before { background: #a87a34; }
.pot.skin-emerald, .swatch.skin-emerald { background: linear-gradient(#2f7a5a, #123a2a); border-color: #5cb88a; }
.pot.skin-emerald::before { background: #2a6a4e; }
.pot.skin-obsidian, .swatch.skin-obsidian { background: linear-gradient(#2a2433, #0b090e); border-color: #7b6a9a; }
.pot.skin-obsidian::before { background: #3a3248; }
.pot.skin-obsidian { box-shadow: 0 0 18px rgba(139,92,246,.25); }
.pot.skin-golden, .swatch.skin-golden { background: linear-gradient(#ffdf7e, #a8771f); border-color: #fff0b0; }
.pot.skin-golden::before { background: #e8b84a; }
.pot.skin-golden { box-shadow: 0 0 22px rgba(255,215,106,.4); }
.pot.skin-starry, .swatch.skin-starry { background: radial-gradient(circle at 30% 30%, #fff 0 1px, transparent 2px), radial-gradient(circle at 70% 55%, #fff 0 1px, transparent 2px), radial-gradient(circle at 45% 80%, #f4e6a3 0 1px, transparent 2px), linear-gradient(#2a2052, #0c0920); border-color: #b48ae2; }
.pot.skin-starry::before { background: #4a3a80; }
.pot.skin-starry { box-shadow: 0 0 22px rgba(180,138,226,.35); }
.pot.skin-abyss, .swatch.skin-abyss { background: linear-gradient(#3a0a14, #000); border-color: #c4483d; }
.pot.skin-abyss::before { background: #5a1420; }
.pot.skin-abyss { box-shadow: 0 0 24px rgba(196,72,61,.4); }
.pot.skin-slag, .swatch.skin-slag { background: radial-gradient(circle at 30% 70%, #ff8a2a 0 1.5px, transparent 3px), radial-gradient(circle at 70% 40%, #ff8a2a 0 1px, transparent 2.5px), linear-gradient(#4a3c33, #1a1310); border-color: #ff8a2a; }
.pot.skin-slag::before { background: #3a2f28; }
.pot.skin-slag { box-shadow: 0 0 20px rgba(255,138,42,.35); }
.pot.skin-founder, .swatch.skin-founder { background: linear-gradient(135deg, #f6e7c1 0%, #d6a453 35%, #6b3f12 70%, #f6e7c1 100%); border-color: #fff4d0; }
.pot.skin-founder::before { background: #b8862f; }
.pot.skin-founder { box-shadow: 0 0 26px rgba(246,231,193,.5), 0 0 6px rgba(255,180,80,.6) inset; }

/* weaknesses, chains, tips */
.affinity { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.affinity-group { display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 13px; padding: 2px 8px; cursor: help; background: none; }
.affinity-group.weak { border-color: var(--good); color: var(--good); }
.affinity-group.resist { border-color: var(--danger); color: #ff9d94; }
.matchup { font-size: 13px; }
.matchup.weak { color: var(--good); }
.matchup.resist { color: #ff9d94; }
.badge.chain { background: var(--good); }
.float.chain { color: #ffd36b; font-size: 24px; }
.coach { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: min(560px, calc(100% - 32px)); background: var(--panel-2); border: 2px solid var(--brass); border-radius: 12px; padding: 12px 16px; display: grid; gap: 8px; box-shadow: 0 10px 40px #000a; z-index: 60; }
.coach p { line-height: 1.6; }
.coach-label { font-size: 12px; letter-spacing: 0.2em; color: var(--brass); }
.coach-target { outline: 3px solid var(--brass) !important; outline-offset: 4px; border-radius: 10px; animation: coach-pulse 1.4s ease-in-out infinite; }
@keyframes coach-pulse { 50% { outline-color: color-mix(in srgb, var(--brass) 30%, transparent); } }
.wrap { padding-bottom: 180px; }

/* playtest fixes: obvious start, clear actions, stronger hits */
.cta { font: 600 22px var(--display); padding: 16px 40px; border-radius: 14px; background: var(--brass); color: #1d140c; border: none; box-shadow: 0 0 0 0 color-mix(in srgb, var(--brass) 60%, transparent); animation: cta-glow 1.8s ease-in-out infinite; justify-self: start; }
.cta:hover { filter: brightness(1.1); }
@keyframes cta-glow { 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--brass) 0%, transparent), 0 0 30px color-mix(in srgb, var(--brass) 45%, transparent); } }
.hero.first { justify-items: center; text-align: center; padding-block: 40px; gap: 16px; }
.hero.first .cta { justify-self: center; font-size: 26px; padding: 18px 56px; }
.hero.first .pitch { font-size: 18px; }
.row.center { justify-content: center; }
.hand-label { font-size: 14px; color: var(--muted); }
.hand-label strong { color: var(--text); }
.hand.beckon .tok { animation: tok-beckon 1.6s ease-in-out infinite; }
.hand.beckon .tok:nth-child(2n) { animation-delay: 0.2s; }
@keyframes tok-beckon { 50% { transform: translateY(-4px); box-shadow: 0 0 12px var(--c); } }
.how { margin: 0; padding-left: 22px; display: grid; gap: 2px; font-size: 14px; color: var(--muted); }
.how li::marker { color: var(--brass); font-weight: 700; }
.how-done { color: var(--brass); font-size: 14px; }
.brew-btn { font-size: 17px; padding: 10px 22px; }
#end-turn.nudge { border-color: var(--brass); color: var(--brass); animation: cta-glow 1.4s ease-in-out infinite; }
.float.weak { color: #ffd34d; -webkit-text-stroke: 1px #6b3a00; }
.float.dmg { -webkit-text-stroke: 1px #5a120c; }
.float.hurt { color: #ff6b5e; -webkit-text-stroke: 1px #3a0806; }
.turn-banner { position: fixed; left: 50%; top: 30%; padding: 10px 80px; font: 700 34px var(--display); letter-spacing: 0.3em; color: #fff; white-space: nowrap; }
.turn-banner.enemy { background: linear-gradient(90deg, transparent, rgba(160,40,32,.9) 20%, rgba(160,40,32,.9) 80%, transparent); }
.turn-banner.player { background: linear-gradient(90deg, transparent, rgba(160,120,50,.9) 20%, rgba(160,120,50,.9) 80%, transparent); }
.bar { position: relative; }
.bar .lag { position: absolute; left: 0; top: 0; bottom: 0; background: #f4eee6; opacity: 0.85; transition: width 0.55s ease-in; }
.bar span { position: relative; }
.vfx.claw { height: 7px; border-radius: 4px; background: linear-gradient(90deg, transparent, #ff4b3e 25%, #ffb4a8 50%, #ff4b3e 75%, transparent); box-shadow: 0 0 12px #ff4b3e; }
.vfx.vignette { inset: 0; transform: none; }
.vfx.speedlines, .vfx.dim { inset: 0; transform: none; }
.vfx.speedlines svg { width: 100%; height: 100%; }
.vfx.crack { filter: drop-shadow(0 0 6px rgba(255,240,180,.9)); }
.vfx.debris { border-radius: 2px; box-shadow: 0 0 6px rgba(255,220,150,.6); }
.vfx.hexbit { opacity: .9; }
.vfx.ghost { filter: brightness(1.6) saturate(.4); }
.vfx.ghost svg { width: 100%; height: 100%; }
.float.tier-label { font-size: 22px; letter-spacing: .2em; color: #fff3c4; -webkit-text-stroke: 1px #5a3a00; }
.float.tier-3 { color: #ffd34d; -webkit-text-stroke: 2px #6b3a00; text-shadow: 0 0 18px rgba(255,200,60,.8), 0 3px 8px #000; }
.float.hurt.tier-3, .float.hurt.tier-4 { color: #ff5a4a; -webkit-text-stroke: 2px #3a0806; text-shadow: 0 0 22px rgba(255,60,40,.9), 0 4px 10px #000; }
.float.tier-label { font-size: 30px; z-index: 60; }
.float.tier-4 { color: #fff3c4; -webkit-text-stroke: 2px #a3360a; text-shadow: 0 0 26px rgba(255,120,40,.95), 0 0 60px rgba(255,200,80,.6), 0 4px 10px #000; }
#spotlight { position: fixed; z-index: 54; border-radius: 14px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(10, 7, 5, 0.62); transition: left 0.25s, top 0.25s, width 0.25s, height 0.25s; }
.toast { z-index: 61; }
.coach.top { top: calc(16px + env(safe-area-inset-top, 0px)); bottom: auto; }

/* hand hints for the current enemy */
.tok.weak-match { box-shadow: 0 0 0 3px var(--good), 0 0 14px color-mix(in srgb, var(--good) 60%, transparent); }
.tok.resist-match { opacity: 0.55; filter: saturate(0.5); }
button.tok.weak-match[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--brass), 0 0 16px var(--good); }

/* rarity colours: common grey-white, rare blue, epic purple, legendary orange-gold */
.rarity-common { --rc: var(--r-common); }
.rarity-rare { --rc: var(--r-rare); }
.rarity-epic { --rc: var(--r-epic); }
.rarity-legendary { --rc: var(--r-legendary); }
.rarity-text-common { color: var(--r-common) !important; }
.rarity-text-rare { color: var(--r-rare) !important; }
.rarity-text-epic { color: var(--r-epic) !important; }
.rarity-text-legendary { color: var(--r-legendary) !important; }
.rarity-tag { display: inline-block; justify-self: start; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; padding: 1px 8px; border-radius: 4px; color: #160f0a; background: var(--rc); }
.relic[class*="rarity-"] { border-color: var(--rc); color: var(--rc); }
.relic.rarity-epic, .relic.rarity-legendary { box-shadow: 0 0 8px color-mix(in srgb, var(--rc) 50%, transparent); }
.choice.item { border-color: var(--rc); background: color-mix(in srgb, var(--rc) 9%, var(--panel-2)); position: relative; overflow: hidden; }
.choice.item strong { color: var(--rc); }
.choice.item.rarity-rare { box-shadow: 0 0 12px color-mix(in srgb, var(--rc) 30%, transparent); }
.choice.item.rarity-epic, .choice.item.rarity-legendary { box-shadow: 0 0 22px color-mix(in srgb, var(--rc) 45%, transparent); }
.choice.item.rarity-epic::after, .choice.item.rarity-legendary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, color-mix(in srgb, var(--rc) 35%, transparent) 50%, transparent 65%); transform: translateX(-100%); animation: sheen 2.6s ease-in-out infinite; pointer-events: none; }
.choice.item.rarity-legendary::after { animation-duration: 1.8s; }
@keyframes sheen { 60%, 100% { transform: translateX(100%); } }
.flask[class*="rarity-"] { border-color: var(--rc); }
.recipe[class*="rarity-"] { border-left: 3px solid var(--rc); }
.ach.legendary-card { border-style: dashed; border-color: color-mix(in srgb, var(--r-legendary) 50%, var(--line)); }
.ach.legendary-card.earned { border-style: solid; border-color: var(--r-legendary); box-shadow: 0 0 14px color-mix(in srgb, var(--r-legendary) 35%, transparent); }
.ach.legendary-card.earned strong { color: var(--r-legendary); }

/* titles */
.titles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.title-card { display: grid; gap: 2px; text-align: left; padding: 10px 12px; font-size: 13px; }
.title-card strong { font-family: var(--display); font-size: 16px; color: var(--aether); }
.title-card.on { border-color: var(--aether); box-shadow: 0 0 0 1px var(--aether), 0 0 14px color-mix(in srgb, var(--aether) 35%, transparent); }
.title-card:disabled strong { color: var(--muted); }
.title-tag { font: inherit; font-size: 12px; padding: 1px 8px; border-color: var(--aether); color: var(--aether); background: none; cursor: help; }
.player-title .muted { letter-spacing: 0; font-family: var(--body); margin-left: 6px; }

/* ---------- story ---------- */
.speech { position: fixed; transform: translate(-50%, -100%); max-width: min(300px, 80vw); padding: 10px 14px; border-radius: 12px; background: #f1e6d6; color: #24180f; font: 600 15px/1.5 var(--display); box-shadow: 0 6px 24px rgba(0,0,0,.5); z-index: 60; }
.speech::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 14px; height: 14px; background: inherit; transform: translateX(-50%) rotate(45deg); }
.speech.enemy { background: #2a1f2e; color: #f4dcff; border: 1px solid var(--aether); }
.speech.enemy::after { border-right: 1px solid var(--aether); border-bottom: 1px solid var(--aether); }
.story-intro { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 70%, #3a2614 0%, #120c08 55%, #070504 100%); cursor: pointer; }
.intro-glow { position: absolute; left: 50%; bottom: -10vh; width: 60vw; height: 40vh; transform: translateX(-50%); background: radial-gradient(ellipse, color-mix(in srgb, var(--fire) 35%, transparent), transparent 70%); animation: intro-flicker 3s ease-in-out infinite; pointer-events: none; }
.intro-text { position: relative; display: grid; gap: 18px; max-width: 560px; justify-items: center; text-align: center; }
.intro-line { font: 600 clamp(17px, 2.6vw, 22px)/1.7 var(--display); color: var(--text); animation: intro-in 1.4s ease-out both; }
.intro-line:last-of-type { color: var(--brass); font-size: clamp(20px, 3.2vw, 28px); }
.story-intro .cta { justify-self: center; margin-top: 12px; animation: intro-in 1s ease-out both; }
.story-intro.all .intro-line, .story-intro.all .cta { animation: none; }
.intro-skip { position: absolute; top: max(16px, env(safe-area-inset-top, 0px)); right: 16px; }
@keyframes intro-in { from { opacity: 0; transform: translateY(10px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes intro-flicker { 0%, 100% { opacity: .8; } 40% { opacity: 1; } 60% { opacity: .65; } }
.journal { display: grid; gap: 12px; }
.page { position: relative; display: grid; gap: 8px; padding: 18px 20px; border-radius: 10px; background: linear-gradient(#efe2c8, #e2d0ad); color: #2b1d10; box-shadow: inset 0 0 30px rgba(120,80,30,.25); }
.page h3 { color: #6b3f12; }
.page-text { font: 600 16px/1.85 var(--display); }
.page.new { box-shadow: inset 0 0 30px rgba(120,80,30,.25), 0 0 0 2px var(--brass), 0 0 18px color-mix(in srgb, var(--brass) 50%, transparent); }
.page .tag { position: absolute; top: 10px; right: 12px; background: var(--danger); }
.page.locked { background: var(--panel); color: var(--muted); box-shadow: none; border: 1px dashed var(--line); }
.page.locked h3 { color: var(--muted); }
.journal-found { border-color: var(--brass); background: linear-gradient(color-mix(in srgb, var(--brass) 10%, var(--panel)), var(--panel)); }
.journal-found .page-text { color: var(--text); }
.ending { font: 600 18px/1.8 var(--display); color: var(--text); max-width: 640px; }
.has-new { border-color: var(--brass); color: var(--brass); }
.end-actions { background: none; border: none; padding: 0; }

/* ---------- battle stage ---------- */
.stage { --wall: #2b1e15; --wall-2: #140e0a; --glow: #e2843a; --ground: #241912; position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr auto; column-gap: 24px; min-height: 420px; padding: 34px 20px 16px; border-radius: 14px; border: 1px solid var(--line); }
.stage.floor-2 { --wall: #1c2619; --wall-2: #0c120b; --glow: #a4c23a; --ground: #172012; }
.stage.floor-3 { --wall: #201b30; --wall-2: #0d0a17; --glow: #9a6ae2; --ground: #15111f; }
.stage-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 55% 45% at 50% 40%, color-mix(in srgb, var(--glow) 16%, transparent), transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 38px, rgba(0,0,0,.28) 38px 40px),
    repeating-linear-gradient(90deg, transparent 0 78px, rgba(0,0,0,.18) 78px 80px),
    linear-gradient(var(--wall), var(--wall-2));
  box-shadow: inset 0 0 90px rgba(0,0,0,.75); }
.stage.boss .stage-bg { box-shadow: inset 0 0 120px rgba(0,0,0,.85), inset 0 -60px 120px color-mix(in srgb, var(--danger) 30%, transparent); }
.stage-bg .arch { position: absolute; left: 50%; top: 10%; width: 26%; height: 58%; transform: translateX(-50%); border-radius: 50% 50% 0 0 / 34% 34% 0 0; background: radial-gradient(ellipse 60% 45% at 50% 85%, color-mix(in srgb, var(--glow) 22%, #000), #050302 75%); box-shadow: 0 0 0 10px rgba(0,0,0,.35), 0 0 0 12px color-mix(in srgb, var(--wall) 60%, #000); }
.stage-bg .ground { position: absolute; left: -40%; right: -40%; bottom: 0; height: 44%; transform-origin: 50% 0; transform: perspective(260px) rotateX(38deg);
  background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.55)), repeating-linear-gradient(90deg, transparent 0 70px, rgba(0,0,0,.3) 70px 73px), repeating-linear-gradient(0deg, transparent 0 46px, rgba(0,0,0,.25) 46px 48px), var(--ground);
  border-top: 2px solid color-mix(in srgb, var(--glow) 25%, #000); }
.stage-bg .torch { position: absolute; top: 16%; width: 8px; height: 30px; border-radius: 2px; background: linear-gradient(#5a4330, #2a1d14); }
.stage-bg .t1 { left: 4%; }
.stage-bg .t2 { right: 4%; }
.stage-bg .torch::before { content: ""; position: absolute; left: 50%; bottom: 100%; width: 16px; height: 26px; margin-left: -8px; border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%; background: radial-gradient(ellipse at 50% 75%, #fff4c2, color-mix(in srgb, var(--glow) 80%, #ffb347) 45%, transparent 72%); animation: flame 0.9s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.stage-bg .torch::after { content: ""; position: absolute; left: 50%; top: -30px; width: 180px; height: 180px; margin: -70px 0 0 -90px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--glow) 26%, transparent), transparent 65%); animation: glow 2.3s ease-in-out infinite; }
.stage-bg .t2::before { animation-delay: -0.4s; }
.stage-bg .t2::after { animation-delay: -1.1s; }
@keyframes flame { from { transform: scale(1, 1) rotate(-3deg); } to { transform: scale(0.85, 1.15) rotate(3deg); } }
@keyframes glow { 0%, 100% { opacity: .85; } 50% { opacity: .55; } }
.stage-name { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); font: 600 13px var(--display); letter-spacing: 0.3em; color: color-mix(in srgb, var(--glow) 55%, var(--muted)); white-space: nowrap; }
.stage .fighter { grid-row: 1 / 4; display: grid; grid-template-rows: subgrid; justify-items: center; min-width: 0; }
.stage .cue { min-height: 38px; display: grid; align-items: end; justify-items: center; }
.stage .stand { position: relative; display: grid; align-items: end; justify-items: center; align-self: end; padding-bottom: 6px; }
.stage .stand::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 70%; height: 18px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(ellipse, rgba(0,0,0,.7), transparent 70%); z-index: -1; }
.stage .portrait { width: 160px; height: 160px; background: none; }
.stage .portrait.boss { width: 210px; height: 210px; }
.stage .portrait.player { width: 190px; height: 190px; }
.stage.elite .side-enemy .portrait { width: 180px; height: 180px; }
.stage .plate { align-self: start; width: 100%; max-width: 360px; display: grid; gap: 6px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, #0b0805 80%, transparent); border: 1px solid color-mix(in srgb, var(--line) 85%, transparent); }
.stage .plate .muted { color: #bba893; }
.intent-bubble { position: relative; margin: 0 0 10px; padding: 4px 16px; border-radius: 999px; background: color-mix(in srgb, #0b0805 88%, transparent); border: 1px solid var(--danger); box-shadow: 0 0 16px color-mix(in srgb, var(--danger) 30%, transparent); white-space: nowrap; }
.intent-bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px; margin-left: -5px; background: inherit; border-right: inherit; border-bottom: inherit; transform: rotate(45deg); }
.intent-bubble.intent-block { border-color: var(--water); box-shadow: 0 0 16px color-mix(in srgb, var(--water) 30%, transparent); }
.intent-bubble.intent-buff, .intent-bubble.intent-weak, .intent-bubble.intent-curse, .intent-bubble.intent-cleanse { border-color: var(--aether); box-shadow: 0 0 16px color-mix(in srgb, var(--aether) 30%, transparent); }
.intent-bubble.intent-burn { border-color: var(--fire); }
.intent-bubble .muted { font-size: 12px; }

/* ---------- long-term goals ---------- */
.level-box { display: grid; gap: 6px; max-width: 520px; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--brass) 8%, var(--panel)); border: 1px solid color-mix(in srgb, var(--brass) 45%, var(--line)); }
.level-badge { font-family: var(--display); font-size: 18px; color: var(--brass); }
.xp-bar { position: relative; height: 10px; border-radius: 5px; background: #0f0b08; overflow: hidden; }
.xp-bar span { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, #b07a2a, var(--brass), #ffe3a0); box-shadow: 0 0 10px color-mix(in srgb, var(--brass) 60%, transparent); }
.xp-bar.big { height: 16px; border-radius: 8px; }
.xp-bar .fill { animation: xp-fill 1.6s cubic-bezier(.2,.8,.3,1) 0.4s both; }
@keyframes xp-fill { from { width: var(--from); } to { width: var(--to); } }
.next-unlock { font-size: 13px; color: var(--brass); }
.welcome { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--good); background: color-mix(in srgb, var(--good) 12%, var(--panel)); }
.bounties { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.bounty { display: grid; gap: 4px; align-content: start; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.bounty .reward { font-size: 12px; color: var(--brass); }
.bounty .quiet { justify-self: start; font-size: 12px; padding: 2px 10px; }
.bounty-progress { font-size: 13px; color: var(--muted); }
.bounty.done { border-color: var(--good); background: color-mix(in srgb, var(--good) 10%, var(--panel-2)); }
.bounty.done .bounty-progress { color: var(--good); }
.track { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.track li { display: grid; grid-template-columns: 34px auto auto 1fr; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; border: 1px solid transparent; opacity: .55; }
.track li.got { opacity: 1; }
.track li.got .track-level { background: var(--brass); color: #1d140c; }
.track li.next { opacity: 1; border-color: var(--brass); background: color-mix(in srgb, var(--brass) 10%, transparent); }
.track-level { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--brass); font: 600 13px var(--display); color: var(--brass); }
.boss-preview { font-size: 14px; color: var(--muted); }
.boss-preview strong { color: var(--danger); font-family: var(--display); }
.choice.mutator { border-color: color-mix(in srgb, var(--aether) 60%, var(--line)); }
.choice.mutator:hover { box-shadow: 0 0 0 1px var(--aether), 0 0 16px color-mix(in srgb, var(--aether) 35%, transparent); }
.choice.mutator strong { font-family: var(--display); font-size: 20px; color: var(--aether); }
.choice.mutator .reward { color: var(--brass); font-size: 13px; }
.mutator-tag { border-color: var(--fire); color: #ffb08a; }
.progress-panel { border-color: color-mix(in srgb, var(--brass) 60%, var(--line)); }
.xp-gain { font: 600 20px var(--display); color: var(--brass); }
.unlocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.unlock-card { display: grid; gap: 4px; padding: 12px; border-radius: 10px; border: 1px solid var(--brass); background: color-mix(in srgb, var(--brass) 12%, var(--panel)); box-shadow: 0 0 18px color-mix(in srgb, var(--brass) 25%, transparent); animation: unlock-pop .6s cubic-bezier(.2,.8,.3,1.3) 1.2s both; }
.unlock-card strong { font-family: var(--display); font-size: 18px; color: var(--brass); }
.unlock-card .tag { justify-self: start; }
@keyframes unlock-pop { from { transform: scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- growth: stars, forge, visible power ---------- */
.stars { color: #ffd36a; letter-spacing: 2px; font-size: 15px; text-shadow: 0 0 8px rgba(255,200,80,.5); }
.mastery { display: block; font-size: 12px; color: var(--muted); }
.choice.star-option { border-color: #d6a453; background: linear-gradient(color-mix(in srgb, #ffd36a 10%, var(--panel-2)), var(--panel-2)); }
.choice.star-option strong { color: #ffd36a; }
.choice.forge-option { border-color: var(--fire); }
.choice.forge-option strong { font-family: var(--display); font-size: 22px; color: #ffb08a; }
.choice.forge-option:hover { box-shadow: 0 0 0 1px var(--fire), 0 0 18px color-mix(in srgb, var(--fire) 35%, transparent); }
.forge-hero h2 { font-size: 34px; }
.relic.forge-tag { border-color: var(--fire); color: #ffb08a; }
.star-tag { border-color: #d6a453; color: #ffd36a; }
.power-summary { border-color: color-mix(in srgb, var(--good) 50%, var(--line)); }
.power-summary h3 { color: var(--good); }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; }
.chip.good { border-color: var(--good); color: var(--good); }
.chip.star { border-color: #d6a453; color: #ffd36a; }
.growth-line { color: #ffd36a; font-size: 14px; }
.loot-pop { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(8,5,3,.6); animation: loot-fade .2s ease-out; }
.loot-card { width: min(460px, 100%); max-height: 90vh; overflow: auto; display: grid; gap: 10px; padding: 20px; border-radius: 14px; background: var(--panel); border: 1px solid var(--brass); box-shadow: 0 10px 40px rgba(0,0,0,.6), 0 0 24px color-mix(in srgb, var(--brass) 25%, transparent); animation: loot-pop .35s cubic-bezier(.2,.8,.3,1.25); }
.loot-card h3 { color: var(--brass); font-size: 22px; }
.loot-line { font-size: 14px; }
.loot-items { display: grid; gap: 8px; }
.loot-item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.loot-item.relic { display: grid; gap: 4px; }
.loot-item.relic strong { font-size: 16px; }
.loot-item.relic > span:last-child { color: var(--text); font-size: 14px; }
.loot-item.relic.rarity-rare { border-color: var(--r-rare); }
.loot-item.relic.rarity-epic { border-color: var(--r-epic); box-shadow: 0 0 14px color-mix(in srgb, var(--r-epic) 35%, transparent); }
.loot-item.relic.rarity-legendary { border-color: var(--r-legendary); box-shadow: 0 0 16px color-mix(in srgb, var(--r-legendary) 40%, transparent); }
.loot-item.loss { opacity: .85; border-style: dashed; color: #ffb4a8; }
@keyframes loot-fade { from { opacity: 0; } }
@keyframes loot-pop { from { transform: scale(.85); opacity: 0; } }
.recipe-chips { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; }
.recipe-chips .tok.small { min-width: 24px; height: 24px; font-size: 12px; }
.recipe-chips .plus { color: var(--muted); font-size: 12px; }
.recipe-how { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
.flask .recipe-chips { margin-left: 6px; }
.stardust-shop { border-color: color-mix(in srgb, var(--aether) 50%, var(--line)); }

@media (max-height: 820px) and (min-width: 721px) {
  .stage { min-height: 340px; padding-top: 30px; }
  .stage .portrait { width: 130px; height: 130px; }
  .stage .portrait.boss { width: 170px; height: 170px; }
  .stage .portrait.player { width: 150px; height: 150px; }
  .stage.elite .side-enemy .portrait { width: 150px; height: 150px; }
}

/* ---------- school ranks ---------- */
.rank-badge { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 6px; font: 600 13px var(--display); background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.rank-badge.rank-2 { border-color: #c9d4df; color: #e8eef5; background: linear-gradient(#5a6472, #2d333b); }
.rank-badge.rank-3 { border-color: #ffd36a; color: #2a1a05; background: linear-gradient(#ffe7a0, #d6a453); box-shadow: 0 0 10px rgba(255,211,106,.6); }
.rank-line { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.rank-line.done { color: #ffd36a; }
.rank-bar { display: block; height: 6px; border-radius: 3px; background: #0f0b08; overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: linear-gradient(90deg, #8a96a6, #e8eef5); }
.rank-card { align-content: start; }
.rank-card.on { border-color: var(--brass); box-shadow: 0 0 0 1px var(--brass), 0 0 16px color-mix(in srgb, var(--brass) 30%, transparent); }
.rank-card.rank-3:not(:disabled) strong { color: #ffd36a; }
.school-art.rank-2 svg { filter: drop-shadow(0 0 6px rgba(201,212,223,.9)); }
.school-art.rank-3 svg { filter: drop-shadow(0 0 8px rgba(255,211,106,.95)) drop-shadow(0 0 18px rgba(255,170,60,.5)); }
.portrait.player.rank-3::before { content: ""; position: absolute; left: 50%; top: 6%; width: 46%; height: 12%; transform: translateX(-50%); border-radius: 50%; border: 3px solid #ffd36a; box-shadow: 0 0 14px #ffd36a; animation: halo 2.6s ease-in-out infinite; }
.portrait.player { position: relative; }
@keyframes halo { 50% { transform: translateX(-50%) translateY(-4px); opacity: .75; } }
.skill-btn { border-color: #b48ae2; color: #e4ccff; }
.skill-btn.ready { background: linear-gradient(color-mix(in srgb, #b48ae2 25%, var(--panel-2)), var(--panel-2)); box-shadow: 0 0 12px color-mix(in srgb, #b48ae2 40%, transparent); }
.skill-left { color: #ffd36a; }
.skill-hint { font-size: 12px; }
.school-progress { display: grid; gap: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.unlock-card.rank-up.rank-3 { border-color: #ffd36a; box-shadow: 0 0 24px rgba(255,211,106,.45); }

/* ---------- main menu tabs ---------- */
.hero.compact { padding-block: 16px 4px; gap: 12px; }
.hero.compact .pot.big { width: 120px; height: 108px; }
.hero.compact .level-box { margin-top: 4px; }
.tabs { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border-radius: 12px; background: color-mix(in srgb, var(--bg) 92%, transparent); border: 1px solid var(--line); backdrop-filter: blur(4px); }
.tab { position: relative; font: 600 16px var(--display); padding: 8px 18px; border-radius: 8px; background: none; border: 1px solid transparent; color: var(--muted); }
.tab:hover { color: var(--text); border-color: var(--line); }
.tab.on { color: #1d140c; background: var(--brass); border-color: var(--brass); }
.tab-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font: 700 11px/18px var(--body); text-align: center; }
.tab-badge.dot { min-width: 10px; width: 10px; height: 10px; padding: 0; top: -3px; right: -3px; }
.choice.school.locked { opacity: .55; cursor: default; }
.copy-area { width: 100%; font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; background: #0f0b08; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px; resize: vertical; }
.chip.reflect { border-color: #b48ae2; color: #e4ccff; }
.chip.passive-chip { border-color: var(--danger); color: #ffb4a8; }
.intent-bubble.intent-charge { border-color: #ffb347; box-shadow: 0 0 18px rgba(255,140,60,.6); animation: charge-pulse 1s ease-in-out infinite; }
.intent-bubble.intent-reflect { border-color: #b48ae2; }
.intent-bubble.intent-freeze { border-color: #8fd0ff; }
.intent-bubble.intent-steal { border-color: #d6a453; }
@keyframes charge-pulse { 50% { box-shadow: 0 0 28px rgba(255,140,60,.9); } }
.locked-hint { padding: 0 4px; }
.choice.upgrade.can-buy { border-color: var(--brass); box-shadow: 0 0 0 1px color-mix(in srgb, var(--brass) 50%, transparent); }

@media (max-width: 720px) {
  .tabs { gap: 4px; padding: 6px; }
  .tab { font-size: 14px; padding: 6px 10px; }
  .hero.compact .pot.big { display: none; }
  .track li { grid-template-columns: 30px auto 1fr; }
  .track li > .muted { grid-column: 2 / -1; }
  .stage { column-gap: 8px; min-height: 0; padding: 30px 8px 10px; }
  .stage .portrait { width: 96px; height: 96px; }
  .stage .portrait.boss { width: 120px; height: 120px; }
  .stage .portrait.player { width: 110px; height: 110px; }
  .stage.elite .side-enemy .portrait { width: 108px; height: 108px; }
  .stage .plate { padding: 8px; gap: 4px; }
  .stage .plate h3 { font-size: 15px; }
  .stage .cue { min-height: 32px; }
  .intent-bubble { padding: 3px 10px; white-space: normal; text-align: center; }
  .intent-bubble .muted { display: none; }
  .stage-bg .torch { display: none; }
  .stage-bg .arch { width: 34%; }
  .combat { gap: 8px; }
  .fighter { padding: 10px; gap: 6px; }
  .fighter h3 { font-size: 16px; }
  .fighter .muted, .chips { font-size: 12px; }
  .intent { font-size: 15px; display: block; }
  .wrap { gap: 12px; }
  .tok { min-width: 42px; height: 42px; }
  .pot { width: 72px; height: 66px; }
  .portrait { width: 56px; height: 56px; }
  .portrait.boss { width: 68px; height: 68px; }
  .fighter-head { gap: 8px; }
  .history-row { grid-template-columns: 1fr; gap: 0; }
  .cta { width: 100%; justify-self: stretch; font-size: 20px; padding: 14px 20px; }
  .hero.first .cta { width: 100%; font-size: 22px; padding: 16px 20px; }
  .turn-banner { font-size: 26px; padding: 8px 48px; }
  .settings { margin-left: 0; }
  .pot .liquid { inset: 18px 5px 5px; }
  .crucible-row { gap: 12px; }
}
/* Animations follow the in-game setting, which starts from the system's preference. */
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { transition: none !important; animation: none !important; }
.motion-off { font-size: 13px; color: var(--brass); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* English: element names are words, not single characters, and the title is two words. */
html[lang="en"] h1 { letter-spacing: 0.03em; }
html[lang="en"] .tok { font-size: 16px; padding: 0 11px; }
html[lang="en"] .tok.small { font-size: 12px; }
html[lang="en"] .stage-name { letter-spacing: 0.12em; }
@media (max-width: 600px) {
  html[lang="en"] .tok { font-size: 14px; padding: 0 8px; }
  html[lang="en"] .tok.small { font-size: 11px; padding: 0 5px; }
}
/* Brews left this turn; a three-element potion spends two. */
.brew-pips { display: inline-flex; gap: 4px; align-items: center; }
.brew-pips .pip { width: 10px; height: 10px; border-radius: 50%; background: var(--brass); box-shadow: 0 0 6px color-mix(in srgb, var(--brass) 60%, transparent); }
.brew-pips .pip.spend { background: transparent; border: 2px solid var(--brass); box-shadow: none; animation: pip-blink 1s ease-in-out infinite; }
@keyframes pip-blink { 50% { opacity: 0.4; } }
.badge.cost { background: color-mix(in srgb, var(--brass) 25%, var(--panel-2)); color: var(--brass); }
.badge.swift { background: color-mix(in srgb, var(--wind) 25%, var(--panel-2)); color: var(--wind); }
/* The total under a multi-hit potion's separate numbers. */
.float.total { color: #ffe6a8; font-size: 20px; letter-spacing: 0.02em; }
/* School sets: the progress chip, pieces in the relic bar, tags on cards. */
.relic.set-chip { border-style: dashed; border-color: var(--brass); color: var(--brass); background: transparent; }
.relic.set-chip.set-2 { border-style: solid; background: color-mix(in srgb, var(--brass) 18%, transparent); }
.relic.set-chip.set-3 { border-style: solid; color: #1c140c; background: var(--brass); box-shadow: 0 0 12px color-mix(in srgb, var(--brass) 70%, transparent); }
.relic.set-piece::before { content: '◆ '; color: var(--brass); }
.set-tag { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--brass); background: color-mix(in srgb, var(--brass) 14%, transparent); font-size: 13px; text-align: left; }
.set-tag strong { color: var(--brass); font-size: 13px; }
.set-text { font-size: 13px; color: var(--muted); }
.set-text strong { color: var(--brass); }
.choice .set-tag strong, .choice.school .set-text strong { color: var(--brass); font-family: inherit; font-size: 13px; font-weight: 700; }
.choice.school .set-text { line-height: 1.45; }
/* The journal button carries its own dot until the new page is read. */
.has-new { position: relative; }
/* NEW on a skin, title or legendary relic the player has not looked at yet. */
.new-tag { display: inline-block; margin-left: 6px; padding: 1px 5px; border-radius: 4px; background: var(--danger); color: #fff; font: 800 10px/1.4 var(--body); letter-spacing: 0.06em; vertical-align: middle; }
/* Element tokens carry an icon; small ones (recipes, bag, weakness) show only the icon. */
.tok { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.tok .ico { display: inline-flex; width: 26px; height: 26px; flex: none; }
.tok .ico svg { width: 100%; height: 100%; }
.tok .lbl { font-size: 0.8em; line-height: 1; }
.tok.small { padding: 0 3px; gap: 0; }
.tok.small .ico { width: 18px; height: 18px; }
.recipe-chips .tok.small .ico { width: 16px; height: 16px; }
html[lang="en"] .tok .lbl { font-size: 0.85em; }
/* Every portrait shares one outline, rim light and base shade (see PORTRAIT_FILTER). */
.portrait svg { filter: url(#toon); }
@media (max-width: 600px) {
  .tok .ico { width: 20px; height: 20px; }
  .tok { gap: 3px; }
  html[lang="en"] .tok { padding: 0 7px; }
  html[lang="en"] .tok .lbl { font-size: 12px; }
}
@media (max-width: 600px) {
  .hand { gap: 6px; }
}
@media (max-width: 600px) {
  .crucible-row { gap: 10px; }
  .crucible-row > .pot { width: 64px; height: 58px; border-radius: 8px 8px 30px 30px; }
  .crucible-row > .pot .liquid { inset: 16px 5px 5px; border-radius: 3px 3px 24px 24px; }
}
/* Relic icons: small in the relic bar, big on reward, shop, loot and collection cards. */
.relic-ico { display: inline-flex; width: 18px; height: 18px; flex: none; vertical-align: -4px; margin-right: 4px; }
.relic-ico svg { width: 100%; height: 100%; }
.relic-ico.big { width: 34px; height: 34px; margin-right: 8px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.45)); }
.card-title { display: inline-flex; align-items: center; }
.rarity-tag { align-self: start; }
/* Painted portraits: same box, sway and rank glow as the drawn SVGs. */
.portrait img, .school-art img { width: 100%; height: 100%; display: block; object-fit: contain; -webkit-user-drag: none; user-select: none; }
.portrait img { transform-origin: 50% 88%; animation: idle 2.8s ease-in-out infinite; }
.portrait.player img { animation-duration: 3.4s; }
.school-art.rank-2 img { filter: drop-shadow(0 0 6px rgba(201,212,223,.9)); }
.school-art.rank-3 img { filter: drop-shadow(0 0 8px rgba(255,211,106,.95)) drop-shadow(0 0 18px rgba(255,170,60,.5)); }
.choice.school[disabled] .school-art img { filter: grayscale(1) brightness(.5); }
/* Small school icons show the painted figure from the waist up, so faces read at 56px. */
.school-art:not(.raw):has(img) { overflow: hidden; border-radius: 10px; }
.school-art:not(.raw) img { transform: scale(1.7); transform-origin: 50% 14%; }
/* Painted battle backdrop: replaces the drawn wall, arch, floor and torches but keeps
   the vignette (and the boss's red edge) and a slow firelight flicker on top. */
.stage-bg.painted { background: var(--backdrop) 50% 58% / cover no-repeat, var(--wall-2); }
.stage-bg.painted .arch, .stage-bg.painted .ground, .stage-bg.painted .torch { display: none; }
.stage-bg.painted::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 70% 60% at 50% 40%, color-mix(in srgb, var(--glow) 12%, transparent), transparent 70%); animation: glow 2.3s ease-in-out infinite; }
.stage:has(.stage-bg.painted) .stage-name { color: color-mix(in srgb, var(--glow) 45%, #f3e6cf); text-shadow: 0 1px 3px #000, 0 0 10px rgba(0,0,0,.9); }
/* Title key art: the painting fills the hero, darkened on the left where the text
   sits; the drawn crucible steps aside since the painting has its own. On phones the
   painting is a banner on top and the text follows below it. */
.hero.painted { position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); padding: 30px 30px 22px; min-height: 380px; align-content: end;
  background:
    linear-gradient(90deg, rgba(23,17,13,.95) 0%, rgba(23,17,13,.82) 32%, rgba(23,17,13,.3) 58%, rgba(23,17,13,0) 78%),
    linear-gradient(0deg, rgba(23,17,13,.85), rgba(23,17,13,0) 40%),
    var(--keyart) 70% 40% / cover no-repeat, var(--bg); }
.hero.painted > * { max-width: 600px; }
.hero.painted .pot.big { display: none; }
.hero.painted h1 { text-shadow: 0 2px 12px rgba(0,0,0,.8); }
.hero.first.painted { justify-items: start; text-align: left; min-height: min(80vh, 640px); }
.hero.first.painted .cta { justify-self: start; }
@media (max-width: 720px) {
  .hero.painted { padding: 200px 16px 18px; min-height: 0;
    background: linear-gradient(180deg, rgba(23,17,13,0) 0, rgba(23,17,13,0) 120px, var(--bg) 290px), var(--keyart) 76% 0 / auto 300px no-repeat, var(--bg); }
  .hero.first.painted { min-height: 0; }
}
/* Scene banners: a painting across the top of the rest, shop, event, forge and end
   screens, fading into the panel; the heading sits on its lower edge. */
.scene { --scene-h: 190px; --scene-fade: var(--panel); position: relative; isolation: isolate; overflow: hidden; padding-top: calc(var(--scene-h) - 46px); }
.scene::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: var(--scene-h); z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.15) 0%, rgba(0,0,0,0) 35%, color-mix(in srgb, var(--scene-fade) 70%, transparent) 78%, var(--scene-fade) 100%), var(--scene) 50% 50% / cover no-repeat; }
.scene > h2, .scene > .coach-label, .scene > .result-title { text-shadow: 0 2px 10px rgba(0,0,0,.9), 0 0 2px rgba(0,0,0,.8); }
.hero.scene { --scene-h: 260px; --scene-fade: var(--bg); border-radius: 16px; border: 1px solid var(--line); padding-inline: 20px; padding-bottom: 18px; }
@media (max-width: 600px) {
  .scene { --scene-h: 140px; }
  .hero.scene { --scene-h: 190px; }
}
/* The map panel: the floor's backdrop faintly behind the map, no extra height. */
.map-scene { position: relative; isolation: isolate; overflow: hidden; }
.map-scene::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(color-mix(in srgb, var(--panel) 82%, transparent), color-mix(in srgb, var(--panel) 92%, transparent)), var(--scene) 50% 40% / cover no-repeat; }
/* Crucible cards: picture, name, trait; locked ones say how to earn them. */
.pot-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.pot-card { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center; text-align: left; padding: 8px 10px; }
.pot-card.on { border-color: var(--brass); box-shadow: 0 0 14px color-mix(in srgb, var(--brass) 30%, transparent); }
.pot-card.locked { opacity: .55; }
.pot-card.locked .pot-pic { filter: grayscale(.9) brightness(.6); }
.pot-pic { width: 64px; height: 64px; display: grid; place-items: center; }
.pot-pic img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 6px rgba(0,0,0,.6)); }
.pot-pic .swatch { width: 40px; height: 40px; }
.pot-text { display: grid; gap: 2px; font-size: 13px; min-width: 0; }
.pot-text strong { font-family: var(--display); font-size: 16px; color: var(--brass); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pot-on { font: 600 11px var(--body); color: #1a120c; background: var(--brass); border-radius: 6px; padding: 0 6px; }
@media (max-width: 600px) { .pot-cards { grid-template-columns: 1fr; } .pot-card { grid-template-columns: 52px 1fr; } .pot-pic { width: 52px; height: 52px; } }
/* Wide windows: the current scene, blurred and dark, fills the space beside the column. */
body::before { content: ""; position: fixed; inset: -60px; z-index: -1; pointer-events: none;
  background: var(--page-art, none) center / cover no-repeat; filter: blur(20px) brightness(.42) saturate(.9); }
@media (max-width: 720px) { body::before { display: none; } }
