/* HotSpot Dungeon 2.0 — phone client. Works fully offline: system fonts only. */
:root {
  --bg: #0f0d0b;
  --bg2: #17140f;
  --panel: #1f1a14;
  --panel2: #2a231b;
  --line: #3a3026;
  --text: #ece2cd;
  --muted: #a8997f;
  --dim: #75684f;
  --gold: #e0ad4f;
  --gold2: #b8862f;
  --good: #6fc28f;
  --bad: #e06a5c;
  --info: #7fb2d9;
  --crit: #ffcf5a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 14px;
  --shadow: 0 6px 24px rgba(0,0,0,.45);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 16px; line-height: 1.45; }
body { min-height: 100vh; min-height: 100dvh; background:
  radial-gradient(1200px 600px at 50% -200px, rgba(224,173,79,.10), transparent 60%),
  radial-gradient(800px 400px at 50% 120%, rgba(111,194,143,.05), transparent 60%), var(--bg); }
#app { max-width: 640px; margin: 0 auto; padding: 0 14px calc(28px + env(safe-area-inset-bottom)); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: .01em; margin: 0; }
h1 { font-size: 2rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .85em; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input { font: inherit; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: .85rem; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 10px; }
.hidden { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 18px; border-radius: 12px; font-weight: 600;
  background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  transition: transform .06s, background .15s, border-color .15s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(180deg, #e9b85c, #c48d33); color: #1a1206; border-color: #f0c56f; }
.btn.danger { border-color: #6b2e27; color: #f2a79d; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 7px 12px; font-size: .9rem; border-radius: 10px; }
.btn:disabled, .btn.disabled { opacity: .45; pointer-events: none; }
.iconbtn { min-width: 44px; min-height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--panel); border: 1px solid var(--line); position: relative; }
.iconbtn .badge { position: absolute; top: -4px; right: -4px; background: var(--gold); color: #1a1206; border-radius: 99px; font-size: .7rem; font-weight: 800; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
svg.i { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- panels ---------- */
.card { background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.grid2 > .card, .statrow > .card, .heroes-grid > .card, .foes > .card { margin-top: 0; }
details.again { margin: 4px 0 6px; }
details.again summary { cursor: pointer; color: var(--muted); font-size: .9rem; padding: 6px 0; }
.card.select { cursor: pointer; transition: border-color .15s, transform .06s; }
.card.select:active { transform: scale(.99); }
.card.selected { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(224,173,79,.25), var(--shadow); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.gold { color: var(--gold); border-color: #5b4520; }
.pill.good { color: var(--good); border-color: #2c5a3d; }
.pill.bad { color: var(--bad); border-color: #6b2e27; }
.pill.info { color: var(--info); border-color: #2e4a61; }

/* ---------- header / brand ---------- */
.brand { text-align: center; padding: 34px 0 18px; }
.brand .logo { width: 78px; height: 78px; margin: 0 auto 10px; display: block; filter: drop-shadow(0 0 18px rgba(224,173,79,.35)); }
.brand h1 { font-size: 2.1rem; background: linear-gradient(180deg, #f6d48d, #c48d33); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand .tag { color: var(--muted); font-family: var(--serif); font-style: italic; margin-top: 4px; }
.topbar { position: sticky; top: 0; z-index: 20; margin: 0 -14px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: linear-gradient(180deg, rgba(15,13,11,.97), rgba(15,13,11,.88)); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .title { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.herostrip { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.herostrip .name { font-weight: 700; }
.bar { height: 8px; border-radius: 99px; background: #2a2119; overflow: hidden; position: relative; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #b53b2f, #e06a5c); transition: width .4s; }
.bar.hp > i { background: linear-gradient(90deg, #3b9a63, #6fc28f); }
.bar.hp.low > i { background: linear-gradient(90deg, #b53b2f, #e06a5c); }
.bar.hp.mid > i { background: linear-gradient(90deg, #b8862f, #e0ad4f); }
.bar.xp > i { background: linear-gradient(90deg, #6d5ab8, #a08ce6); }
.bar.temp > b { position: absolute; right: 0; top: 0; bottom: 0; background: rgba(127,178,217,.8); }
.stat { display: inline-flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; }
.stat b { font-size: 1.05rem; }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; letter-spacing: .02em; }
.input { width: 100%; min-height: 52px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #120f0c; color: var(--text); font-size: 1.1rem; outline: none; }
.input:focus { border-color: var(--gold2); box-shadow: 0 0 0 3px rgba(224,173,79,.15); }
.pin { letter-spacing: .6em; text-align: center; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.tabs { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 16px; }
.tabs button { flex: 1; min-height: 42px; border-radius: 9px; font-weight: 600; color: var(--muted); font-size: .92rem; }
.tabs button.on { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.error { background: rgba(224,106,92,.12); border: 1px solid #6b2e27; color: #f4b2a8; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }
.notice { background: rgba(111,194,143,.10); border: 1px solid #2c5a3d; color: #b8e6c8; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }

/* ---------- creation ---------- */
.steps { display: flex; gap: 6px; justify-content: center; margin: 14px 0 18px; }
.steps i { width: 26px; height: 5px; border-radius: 99px; background: var(--line); }
.steps i.on { background: var(--gold); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.classcard { padding: 13px; }
.classcard h3 { font-size: 1.05rem; margin-bottom: 4px; }
.classcard p { font-size: .82rem; color: var(--muted); margin: 0; line-height: 1.35; }
.abil { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.abil button { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; text-align: center; }
.abil button.picked { border-color: var(--gold); background: #2d2418; }
.abil .k { font-size: .72rem; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.abil .v { font-size: 1.6rem; font-weight: 700; font-family: var(--serif); }
.abil .m { font-size: .85rem; color: var(--gold); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 8px 13px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); font-size: .9rem; font-weight: 600; color: var(--muted); }
.chip.on { color: #1a1206; background: var(--gold); border-color: var(--gold); }
.chip.fixed { color: var(--good); border-color: #2c5a3d; }

/* ---------- town ---------- */
.questcard h2 { margin-bottom: 2px; }
.questcard .sub { font-family: var(--serif); font-style: italic; color: var(--muted); margin-bottom: 10px; }
.questcard .blurb { font-family: var(--serif); font-size: 1.02rem; }
.list { display: flex; flex-direction: column; gap: 8px; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.li .grow { flex: 1; min-width: 0; }
.li .t { font-weight: 600; }
.li .s { font-size: .84rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank { width: 28px; text-align: center; font-family: var(--serif); font-weight: 700; color: var(--gold); }
.dot { width: 9px; height: 9px; border-radius: 99px; background: var(--good); box-shadow: 0 0 8px var(--good); flex: none; }
.dot.fight { background: var(--bad); box-shadow: 0 0 8px var(--bad); }

/* ---------- story ---------- */
.scene { padding-top: 14px; }
.scene h2 { margin: 10px 0 12px; font-size: 1.55rem; }
.prose p { font-family: var(--serif); font-size: 1.12rem; line-height: 1.62; color: #efe5d0; }
.prose p:first-child::first-letter { font-size: 2.6em; float: left; line-height: .9; padding: 4px 8px 0 0; color: var(--gold); font-weight: 700; }
.choices { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.choice { text-align: left; padding: 15px 16px; border-radius: 14px; background: linear-gradient(180deg, #262019, #1c1712); border: 1px solid var(--line); font-family: var(--serif); font-size: 1.06rem; line-height: 1.4; position: relative; transition: border-color .15s, transform .06s; }
.choice:active { transform: scale(.99); border-color: var(--gold2); }
.choice .tag { display: flex; gap: 6px; margin-top: 8px; font-family: var(--sans); }
.choice.locked { opacity: .5; }
.choice.locked .why { font-family: var(--sans); font-size: .82rem; color: var(--muted); margin-top: 6px; font-style: italic; }
.choice.fight { border-color: #6b2e27; background: linear-gradient(180deg, #3a1d18, #22130f); text-align: center; font-family: var(--sans); font-weight: 700; letter-spacing: .03em; }
.outcome { margin-top: 14px; border-radius: var(--r); border: 1px solid var(--line); background: #15120e; padding: 14px 16px; }
.outcome .chose { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); font-weight: 700; margin-bottom: 4px; }
.outcome .chose + .what { font-family: var(--serif); font-style: italic; color: var(--muted); margin-bottom: 10px; }
.outcome .prose p { font-size: 1.04rem; }
.outcome .prose p:first-child::first-letter { font-size: inherit; float: none; padding: 0; color: inherit; font-weight: inherit; }
.events { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.levelup { margin-top: 12px; padding: 14px; border-radius: 12px; border: 1px solid #5b4520; background: radial-gradient(400px 120px at 50% 0, rgba(224,173,79,.22), transparent), #1d170f; text-align: center; }
.levelup h3 { color: var(--gold); font-size: 1.3rem; }

/* dice */
.roll { display: flex; align-items: center; gap: 14px; margin: 4px 0 12px; }
.d20 { width: 62px; height: 62px; flex: none; position: relative; display: flex; align-items: center; justify-content: center; }
.d20 svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.d20 svg path { fill: #2b2219; stroke: var(--gold2); stroke-width: 2; }
.d20 b { position: relative; font-family: var(--serif); font-size: 1.35rem; font-weight: 700; }
.d20.rolling svg { animation: spin .6s cubic-bezier(.3,.7,.4,1); }
.d20.ok svg path { stroke: var(--good); }
.d20.no svg path { stroke: var(--bad); }
.d20.crit svg path { stroke: var(--crit); fill: #3a2d12; }
@keyframes spin { from { transform: rotate(-540deg) scale(.6); } to { transform: rotate(0) scale(1); } }
.rollinfo .line1 { font-weight: 700; }
.rollinfo .line2 { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.verdict-ok { color: var(--good); }
.verdict-no { color: var(--bad); }

/* ---------- combat ---------- */
.foes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.foe { padding: 11px 12px; border-radius: 12px; background: linear-gradient(180deg, #2a1a16, #1b1210); border: 1px solid #4a2a23; text-align: left; transition: border-color .15s, transform .06s, opacity .3s; }
.foe .n { font-weight: 700; font-size: .95rem; line-height: 1.2; }
.foe .meta { font-size: .78rem; color: var(--muted); margin: 3px 0 6px; display: flex; justify-content: space-between; }
.foe.dead { opacity: .35; filter: grayscale(1); }
.foe.targetable { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(224,173,79,.3); animation: pulse 1.2s infinite; }
.foe.boss { grid-column: 1 / -1; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(224,173,79,.12); } }
.conds { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.conds .pill { font-size: .7rem; padding: 1px 7px; }
.herocard { margin-top: 10px; padding: 12px; border-radius: 12px; background: linear-gradient(180deg, #17241c, #111a14); border: 1px solid #2c5a3d; }
.turnbanner { margin-top: 12px; padding: 10px 14px; border-radius: 12px; text-align: center; font-weight: 700; letter-spacing: .03em; }
.turnbanner.you { background: rgba(224,173,79,.14); border: 1px solid #5b4520; color: var(--gold); }
.turnbanner.wait { background: var(--panel); border: 1px solid var(--line); color: var(--muted); }
.opts h4 { margin: 16px 0 8px; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.opt { width: 100%; text-align: left; padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 8px; display: flex; gap: 10px; align-items: center; }
.opt .grow { flex: 1; min-width: 0; }
.opt .on { font-weight: 700; }
.opt .od { font-size: .82rem; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.opt.sel { border-color: var(--gold); background: #2d2418; }
.opt.endturn { justify-content: center; font-weight: 700; color: var(--muted); }
.log { margin-top: 14px; max-height: 230px; overflow-y: auto; padding: 10px 12px; border-radius: 12px; background: #110e0b; border: 1px solid var(--line); font-size: .88rem; display: flex; flex-direction: column-reverse; }
.log div { padding: 3px 0; border-bottom: 1px dashed #241d16; }
.log .hit { color: #f1d9a8; }
.log .crit { color: var(--crit); font-weight: 700; }
.log .miss { color: var(--dim); }
.log .bad { color: #f0a097; }
.log .good, .log .heal { color: var(--good); }
.log .title { color: var(--gold); font-weight: 700; font-family: var(--serif); }
.rollstrip { display: flex; gap: 6px; overflow-x: auto; margin-top: 10px; padding-bottom: 2px; }
.rollchip { flex: none; padding: 6px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-size: .78rem; }
.rollchip b { font-size: .95rem; }
.rollchip.ok { border-color: #2c5a3d; }
.rollchip.no { border-color: #4a2a23; opacity: .8; }
.rollchip.crit { border-color: var(--crit); }
.rollchip.foe { background: #1d1210; }
.rollchip.foe.ok { border-color: #6b2e27; }
.rollchip.foe.no { border-color: #2c5a3d; opacity: 1; }

/* ---------- ending ---------- */
.ending { text-align: center; padding: 26px 4px 6px; }
.ending .kicker { letter-spacing: .25em; text-transform: uppercase; font-size: .78rem; color: var(--muted); font-weight: 700; }
.ending h1 { margin: 8px 0 18px; font-size: 2.1rem; background: linear-gradient(180deg, #f6d48d, #c48d33); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ending.grim h1 { background: linear-gradient(180deg, #c9d3c6, #7f8f80); -webkit-background-clip: text; background-clip: text; }
.ending .prose { text-align: left; }

/* ---------- modal sheet ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal .sheet { width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; background: var(--bg2); border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); animation: up .2s cubic-bezier(.3,.8,.4,1); }
.modal .grab { width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 12px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.abilgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.abilgrid > div { text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 4px; }
.abilgrid .k { font-size: .7rem; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.abilgrid .v { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; }
.abilgrid .s { font-size: .72rem; color: var(--dim); }
.skilllist { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; font-size: .9rem; }
.skilllist div { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed #2a231b; }
.skilllist .p { color: var(--gold); }
.feat { padding: 10px 0; border-bottom: 1px solid #2a231b; }
.feat .fn { font-weight: 700; }
.feat .fd { font-size: .88rem; color: var(--muted); }
.section-title { margin: 20px 0 8px; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: #241d15; border: 1px solid #5b4520; color: var(--text); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); max-width: 90vw; animation: up .2s; }
.spinner { width: 28px; height: 28px; border-radius: 99px; border: 3px solid var(--line); border-top-color: var(--gold); animation: rot .8s linear infinite; margin: 40px auto; }
@keyframes rot { to { transform: rotate(360deg); } }
.footer { text-align: center; color: var(--dim); font-size: .75rem; margin-top: 28px; line-height: 1.5; }
.footer a { color: var(--muted); }
@media (min-width: 560px) { .foes { grid-template-columns: 1fr 1fr 1fr; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- player dashboard ---------- */
body.noscroll { overflow: hidden; }
.dockbar { padding-bottom: 8px; }
.dock { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; text-align: left;
  background: linear-gradient(180deg, #221c15, #191410); border: 1px solid var(--line); transition: border-color .15s, transform .06s; }
.dock:active { transform: scale(.99); border-color: var(--gold2); }
.dock .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.dock .dn { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hpnum { font-variant-numeric: tabular-nums; font-size: .9rem; color: var(--muted); white-space: nowrap; }
.hpnum b { color: var(--text); font-size: 1.05rem; }
.hpnum em { color: var(--info); font-style: normal; }
.bar.thin { height: 4px; }
.acb { position: relative; width: 44px; height: 48px; flex: none; display: flex; align-items: center; justify-content: center; }
.acb svg.i { position: absolute; inset: 0; width: 100%; height: 100%; stroke: var(--gold2); stroke-width: 1.4; fill: rgba(224,173,79,.08); }
.acb b { position: relative; font-family: var(--serif); font-size: 1.15rem; }
.sigil { flex: none; position: relative; border-radius: 99px; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--hue) 45%, #2a2119), #17130e 75%);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--hue) 70%, transparent), 0 0 14px color-mix(in srgb, var(--hue) 25%, transparent); }
.sigil .cl { font-family: var(--serif); font-weight: 700; font-size: 1.35em; color: #f4ead6; line-height: 1; }
.sigil[style*="64px"] .cl { font-size: 1.9rem; }
.sigil .lv { position: absolute; right: -4px; bottom: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: var(--gold); color: #1a1206;
  font-size: .72rem; font-weight: 800; display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg); }
.dockchips { display: flex; gap: 6px; overflow-x: auto; margin-top: 8px; padding-bottom: 2px; scrollbar-width: none; }
.dockchips::-webkit-scrollbar { display: none; }
.dockchips .pill { flex: none; }
.pill.cond.bad { color: #f4b2a8; border-color: #6b2e27; background: rgba(224,106,92,.12); }
.pill.cond.good { color: var(--good); border-color: #2c5a3d; background: rgba(111,194,143,.10); }
.pill.cond.mixed { color: var(--gold); border-color: #5b4520; }
.pill.res.spent { opacity: .5; }
.pips { display: inline-flex; gap: 3px; vertical-align: middle; }
.pips i { width: 9px; height: 9px; border-radius: 99px; border: 1.5px solid var(--gold2); }
.pips i.on { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 6px rgba(224,173,79,.45); }
.pipnum { font-variant-numeric: tabular-nums; color: var(--muted); }
.pipnum b { color: var(--gold); }

.dash { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; animation: up .18s cubic-bezier(.3,.8,.4,1); }
.dashhead { padding: calc(10px + env(safe-area-inset-top)) 14px 0; max-width: 640px; width: 100%; margin: 0 auto; border-bottom: 1px solid var(--line); }
.dashhead .title { font-family: var(--serif); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dashbody { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 14px calc(28px + env(safe-area-inset-bottom)); max-width: 640px; width: 100%; margin: 0 auto; }
.dtabs { display: flex; gap: 2px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.dtabs::-webkit-scrollbar { display: none; }
.dtabs button { flex: 1; min-width: 64px; min-height: 44px; font-weight: 700; font-size: .9rem; color: var(--dim); border-bottom: 2px solid transparent; }
.dtabs button.on { color: var(--gold); border-bottom-color: var(--gold); }
.tabs + .dtabs { margin-top: -4px; margin-bottom: 14px; }

.herohead { display: flex; gap: 14px; align-items: center; }
.herohead .grow { flex: 1; min-width: 0; }
.herohead h2 { font-size: 1.45rem; }
.vitalwrap { display: grid; grid-template-columns: 128px 1fr; gap: 12px; align-items: center; margin-top: 16px; }
.ring { position: relative; width: 128px; height: 128px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .track { stroke: #2a2119; }
.ring .fill { stroke: var(--good); stroke-linecap: round; transition: stroke-dasharray .5s; filter: drop-shadow(0 0 5px rgba(111,194,143,.35)); }
.ring.mid .fill { stroke: var(--gold); filter: drop-shadow(0 0 5px rgba(224,173,79,.35)); }
.ring.low .fill { stroke: var(--bad); filter: drop-shadow(0 0 5px rgba(224,106,92,.45)); }
.ring .rt { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring .rt b { font-family: var(--serif); font-size: 2.1rem; line-height: 1; }
.ring .rt span { font-size: .74rem; color: var(--muted); margin-top: 2px; }
.ring .rt em { font-style: normal; font-size: .72rem; color: var(--info); }
.vitals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.vitals.three { margin-top: 2px; }
.vt { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 6px; text-align: center; min-width: 0; }
.vt .k { font-size: .64rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vt .v { font-family: var(--serif); font-size: 1.35rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.vt .v small { font-size: .8rem; color: var(--dim); }
.vt .s { font-size: .68rem; color: var(--dim); }
.condrow { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; margin-bottom: 6px; border: 1px solid; }
.condrow span { font-size: .86rem; color: var(--muted); }
.condrow.bad { border-color: #6b2e27; background: rgba(224,106,92,.10); }
.condrow.bad b { color: #f4b2a8; }
.condrow.good { border-color: #2c5a3d; background: rgba(111,194,143,.08); }
.condrow.good b { color: var(--good); }
.condrow.mixed { border-color: #5b4520; background: rgba(224,173,79,.08); }
.condrow.mixed b { color: var(--gold); }
.okline { display: flex; align-items: center; gap: 8px; color: var(--good); font-size: .92rem; padding: 4px 2px; }
.okline svg.i { width: 18px; height: 18px; }
.reslist { display: flex; flex-direction: column; gap: 6px; }
.resrow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: .92rem; }
.resrow .grow { flex: 1; min-width: 0; }
.resrow .rs { font-size: .7rem; color: var(--dim); width: 62px; text-align: right; }
.resrow.spent { opacity: .55; }
.atk { text-align: center; min-width: 56px; }
.atk b { display: block; font-family: var(--serif); font-size: 1.1rem; }
.atk span { font-size: .7rem; color: var(--dim); }
.abilgrid .prof { border-color: #5b4520; }
.abilgrid .prof .k { color: var(--gold); }
details.feat summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
details.feat summary::-webkit-details-marker { display: none; }
details.feat summary::after { content: '+'; margin-left: auto; color: var(--dim); font-weight: 400; }
details.feat[open] summary::after { content: '−'; }
details.feat .fd { margin-top: 6px; }
.skillrows { display: flex; flex-direction: column; }
.skillrows div { display: flex; justify-content: space-between; padding: 9px 4px; border-bottom: 1px dashed #2a231b; font-size: .95rem; }
.skillrows div b { font-variant-numeric: tabular-nums; }
.skillrows .p { color: var(--gold); }
.skillrows i { font-style: normal; }
.li.journal { font-family: var(--serif); line-height: 1.45; }
.section-title.row { display: flex; }
@media (max-width: 370px) { .vitalwrap { grid-template-columns: 1fr; justify-items: center; } .vitals { width: 100%; } }

/* ---------- portraits ---------- */
.sigil { background: none; box-shadow: none; }
.sigil svg.portrait { width: 100%; height: 100%; display: block; border-radius: 99px; }
.herostrip .sigil .lv { min-width: 17px; height: 17px; font-size: .64rem; right: -3px; bottom: -3px; }
.herohead .sigil .lv { min-width: 26px; height: 26px; font-size: .85rem; }

/* ---------- alerts ---------- */
#alerts { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); top: calc(10px + env(safe-area-inset-top)); width: min(560px, calc(100vw - 20px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.alert { pointer-events: auto; display: flex; flex-direction: column; gap: 2px; padding: 11px 14px 11px 16px; border-radius: 14px; background: #1d1813; border: 1px solid var(--line); border-left-width: 5px; box-shadow: 0 10px 30px rgba(0,0,0,.6); animation: drop .28s cubic-bezier(.3,.8,.4,1); transition: opacity .3s, transform .3s; }
.alert b { font-size: 1rem; }
.alert span { font-size: .86rem; color: var(--muted); }
.alert.bad { border-color: #8a2f25; border-left-color: var(--bad); background: linear-gradient(90deg, #2c1512, #1d1813 60%); }
.alert.bad b { color: #f4b2a8; }
.alert.warn { border-color: #5b4520; border-left-color: var(--gold); }
.alert.warn b { color: var(--gold); }
.alert.good { border-color: #2c5a3d; border-left-color: var(--good); }
.alert.good b { color: var(--good); }
.alert.info { border-left-color: var(--info); }
.alert.info b { color: var(--info); }
.alert.out { opacity: 0; transform: translateY(-10px); }
@keyframes drop { from { transform: translateY(-16px); opacity: 0; } }
body.lowhp::after { content: ''; position: fixed; inset: 0; z-index: 30; pointer-events: none; box-shadow: inset 0 0 70px 10px rgba(190,30,20,.55); animation: throb 1.6s ease-in-out infinite; }
@keyframes throb { 50% { box-shadow: inset 0 0 40px 4px rgba(190,30,20,.3); } }

/* credits & legal */
.tiny { font-size: 11px; line-height: 1.4; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--gold, #e0b84f); text-decoration: underline; font: inherit; cursor: pointer; }

/* journey & progress */
.qbadge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 8px; }
.qbadge svg { width: 14px; height: 14px; }
.qbadge.done { color: var(--good, #6fcf8e); }
.qbadge.new { color: var(--gold, #e0b84f); letter-spacing: .06em; text-transform: uppercase; font-size: 11px; }
.jstats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.jstats > div { background: var(--panel2, rgba(255,255,255,.04)); border: 1px solid var(--line, rgba(255,255,255,.08)); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.jstats b { font-family: var(--serif); font-size: 1.6rem; color: var(--gold, #e0b84f); line-height: 1.1; }
.jstats b small { font-size: .9rem; color: var(--muted); }
.jstats span { font-size: 12px; color: var(--muted); }
.li .t svg { width: 14px; height: 14px; vertical-align: -2px; }
/* feedback */
.chipbtn { background: var(--panel2, rgba(255,255,255,.05)); border: 1px solid var(--line, rgba(255,255,255,.1)); color: var(--text); border-radius: 99px; padding: 6px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.chipbtn.on { border-color: var(--gold, #e0b84f); color: var(--gold, #e0b84f); background: rgba(224,184,79,.1); }
textarea.input { width: 100%; resize: vertical; min-height: 110px; font: inherit; line-height: 1.4; }
