:root {
  color-scheme: dark;
  --bg: #07060a;
  --ink: #efe6d6;
  --muted: #a89c8c;
  --panel: #16121a;
  --panel-2: #201a24;
  --line: #3a2e32;
  --gold: #e8b64a;
  --ember: #ff7a2a;
  --blood: #c0302a;
  --mana: #4a8cff;
  --good: #6ad07a;
  --bad: #ff6a5a;
  --r-common: #e8e4dc;
  --r-magic: #6f9bff;
  --r-rare: #ffd84a;
  --r-legendary: #ff8a1f;
  --r-set: #3fe07a;
  --font: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-family: var(--font);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--ink); }
body { -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; touch-action: none; }
input, textarea, select { user-select: text; -webkit-user-select: text; font: inherit; }
button { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

.app { position: fixed; inset: 0; overflow: hidden; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; background: var(--bg); }

/* ---------------- HUD ---------------- */
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud > * { pointer-events: none; }
.hud button, .hud .touch, .hud .hint { pointer-events: auto; }
.hud-top { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.hero-chip { display: flex; align-items: center; gap: 10px; background: linear-gradient(180deg, rgba(28, 20, 26, 0.88), rgba(14, 10, 14, 0.88)); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45); max-width: 52%; }
.hero-text { min-width: 0; }
.hero-text strong { font-weight: 900; font-size: 14px; letter-spacing: 0.02em; }
.title-name { color: var(--gold); font-weight: 800; font-size: 13px; }
.hero-text .sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gold { display: flex; align-items: center; gap: 5px; font-weight: 900; color: #ffe08a; font-size: 13px; }
.gold i { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff4b0, #e8b64a 55%, #8a5a1a); box-shadow: 0 0 6px rgba(255, 200, 80, 0.6); }
.hud-buttons { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.hb { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: linear-gradient(180deg, #2a2028, #16101a); cursor: pointer; font-size: 17px; display: grid; place-items: center; position: relative; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); }
.hb:hover { border-color: var(--gold); }
.hb.alert::after { content: ""; position: absolute; top: 3px; right: 3px; width: 9px; height: 9px; border-radius: 50%; background: var(--ember); box-shadow: 0 0 8px var(--ember); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.35); } }

.side { position: absolute; top: 56px; right: 8px; width: 170px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#minimap { width: 150px; height: 150px; border-radius: 50%; border: 2px solid #4a3a30; box-shadow: 0 0 0 2px #120c10, 0 6px 20px rgba(0, 0, 0, 0.6); background: rgba(8, 6, 12, 0.6); }
.tracker { width: 100%; display: flex; flex-direction: column; gap: 5px; }
.tq { background: rgba(10, 8, 14, 0.72); border-left: 3px solid #6a5a4a; padding: 5px 7px; border-radius: 6px; font-size: 11.5px; line-height: 1.3; display: flex; flex-direction: column; }
.tq.main { border-left-color: var(--gold); }
.tq.companion { border-left-color: var(--good); }
.tq b { font-weight: 900; color: #f3e2c2; }
.tq span { color: var(--muted); }

.bossbar { position: absolute; top: 54px; left: 50%; transform: translateX(-50%); width: min(460px, 56vw); text-align: center; font-weight: 900; color: #ffb38a; text-shadow: 0 2px 4px #000; font-size: 14px; letter-spacing: 0.04em; }
.bb { height: 12px; margin-top: 3px; border-radius: 6px; background: rgba(0, 0, 0, 0.7); border: 1px solid #6a2a1a; overflow: hidden; }
.bb i { display: block; height: 100%; width: 100%; background: linear-gradient(180deg, #ff6a3a, #a8200f); transition: width 0.15s; }
.riftbar { position: absolute; top: 54px; left: 50%; transform: translateX(-50%); width: min(420px, 54vw); text-align: center; font-size: 12px; font-weight: 800; color: #e0c8ff; text-shadow: 0 1px 3px #000; }
.riftbar .bb { border-color: #6a3a9a; }
.riftbar .bb i { background: linear-gradient(90deg, #7a3ad8, #d88aff); }
.bossbar:not([hidden]) ~ .riftbar { top: 92px; }
.buffs { position: absolute; top: 58px; left: 8px; display: flex; flex-wrap: wrap; gap: 4px; max-width: 40%; }
.buff { font-size: 11px; background: rgba(20, 14, 24, 0.85); border: 1px solid #4a3a4a; border-radius: 999px; padding: 2px 8px; color: #e8d8f8; }
.buff b { color: #fff; }
.buff.shield { border-color: #4a8ad8; color: #bfe0ff; }
.comp-chip { position: absolute; left: 8px; bottom: 116px; display: flex; gap: 8px; align-items: center; background: rgba(14, 10, 16, 0.8); border: 1px solid var(--line); border-radius: 10px; padding: 5px 9px 5px 5px; font-size: 12px; min-width: 150px; }
.comp-chip small { color: var(--muted); }
.mini-bar { height: 5px; background: #200; border-radius: 3px; overflow: hidden; margin-top: 3px; }
.mini-bar i { display: block; height: 100%; background: var(--good); }

.hint { position: absolute; left: 50%; top: 58px; transform: translateX(-50%); max-width: min(520px, 70vw); background: linear-gradient(180deg, rgba(60, 40, 20, 0.95), rgba(30, 20, 12, 0.95)); border: 1px solid #a8803a; color: #ffe8c0; border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 800; box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5); display: flex; gap: 10px; align-items: center; }
.bossbar:not([hidden]) ~ .hint, .riftbar:not([hidden]) ~ .hint { top: 96px; }
.link { background: none; border: 0; color: #d8b88a; text-decoration: underline; cursor: pointer; font-size: 11px; white-space: nowrap; }

.bottom { position: absolute; left: 0; right: 0; bottom: 8px; display: flex; justify-content: center; align-items: flex-end; gap: 12px; }
.xpbar { position: absolute; left: 50%; transform: translateX(-50%); bottom: 4px; width: min(520px, 60vw); height: 5px; background: rgba(0, 0, 0, 0.7); border-radius: 3px; overflow: visible; z-index: 1; }
.xpbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #a8781a, #ffe08a); border-radius: 3px; transition: width 0.3s; }
.xpbar span { position: absolute; left: 50%; bottom: 7px; transform: translateX(-50%); font-size: 10px; color: var(--muted); white-space: nowrap; opacity: 0; transition: opacity 0.2s; }
.orb { position: relative; width: 86px; height: 86px; border-radius: 50%; border: 3px solid #3a2a24; box-shadow: 0 0 0 2px #0c080a, inset 0 0 18px rgba(0, 0, 0, 0.8), 0 8px 20px rgba(0, 0, 0, 0.6); background: #0e0a0c; overflow: hidden; margin-bottom: 6px; }
.orb-fill { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; }
.orb-fill i { position: absolute; inset: 0; transition: transform 0.12s linear; }
.orb.life .orb-fill i { background: radial-gradient(circle at 40% 30%, #ff8a7a, #c0201a 50%, #5a0a0a); }
.orb.res .orb-fill i { background: var(--res-grad, radial-gradient(circle at 40% 30%, #9ad0ff, #2a6ad8 50%, #0a1a5a)); }
.orb::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 45%); pointer-events: none; }
.orb span { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; font-size: 11px; font-weight: 900; text-shadow: 0 1px 3px #000, 0 0 4px #000; z-index: 2; line-height: 1.1; padding: 0 4px; }
.hotbar { display: flex; gap: 6px; padding: 6px; background: linear-gradient(180deg, rgba(34, 24, 28, 0.92), rgba(14, 10, 12, 0.92)); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5); }
.hk { position: relative; width: 50px; height: 50px; border-radius: 9px; border: 1px solid #4a3a34; background: #120c10; cursor: pointer; padding: 0; overflow: hidden; }
.hk img { width: 100%; height: 100%; display: block; }
.hk .key { position: absolute; left: 3px; top: 2px; font-size: 10px; font-weight: 900; color: #e8d8b8; text-shadow: 0 1px 2px #000; }
.hk .cd, .ta .cd { position: absolute; inset: 0; background: conic-gradient(rgba(0, 0, 0, 0.72) calc(var(--cd, 0) * 360deg), transparent 0); pointer-events: none; }
.hk .cdnum, .ta .cdnum { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 16px; text-shadow: 0 1px 3px #000; pointer-events: none; }
.hk.low img, .ta.low img { filter: grayscale(0.6) brightness(0.6); }
.hk.primary { border-color: #8a6a3a; }
.hk:hover { border-color: var(--gold); }

/* touch controls */
.touch { display: none; }
body.is-touch .touch { display: block; }
body.is-touch .hotbar { display: none; }
body.is-touch .bottom { justify-content: space-between; padding: 0 10px; pointer-events: none; bottom: calc(10px + env(safe-area-inset-bottom)); }
body.is-touch .bottom .orb { width: 64px; height: 64px; }
body.is-touch .bottom .orb.life { position: absolute; left: 12px; bottom: 150px; }
body.is-touch .bottom .orb.res { position: absolute; right: 12px; bottom: 208px; width: 54px; height: 54px; }
body.is-touch .comp-chip { bottom: 222px; }
.joy { position: absolute; left: 22px; bottom: calc(22px + env(safe-area-inset-bottom)); width: 128px; height: 128px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)); border: 2px solid rgba(232, 182, 74, 0.35); touch-action: none; }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #6a5a4a, #2a2024); border: 2px solid rgba(232, 182, 74, 0.6); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6); }
.actions { position: absolute; right: 14px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 190px; height: 190px; }
.ta { position: absolute; border-radius: 50%; border: 2px solid rgba(232, 182, 74, 0.45); background: rgba(20, 14, 18, 0.8); padding: 0; overflow: hidden; touch-action: none; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); }
.ta img { width: 100%; height: 100%; display: block; }
.ta.held { transform: scale(0.94); border-color: var(--gold); }
.ta.attack { right: 0; bottom: 0; width: 88px; height: 88px; background: radial-gradient(circle, #5a2a1a, #200c0a); }
.ta.sk { width: 54px; height: 54px; }
.ta.s0 { right: 98px; bottom: 4px; }
.ta.s1 { right: 90px; bottom: 66px; }
.ta.s2 { right: 44px; bottom: 112px; }
.ta.s3 { right: -6px; bottom: 124px; }
.ta.potion { width: 46px; height: 46px; right: 140px; bottom: 112px; }

/* ---------------- banner & toasts ---------------- */
.banner { position: absolute; left: 50%; top: 32%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; opacity: 0; }
.banner.show { animation: banner 3.2s ease forwards; }
.banner strong { display: block; font-family: var(--serif); font-size: clamp(26px, 5vw, 44px); letter-spacing: 0.06em; color: #f5dca8; text-shadow: 0 3px 12px #000, 0 0 30px rgba(255, 140, 60, 0.35); }
.banner span { font-size: 13px; color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase; text-shadow: 0 2px 6px #000; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -40%); } 15%, 70% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; } }
.toasts { position: absolute; top: 100px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; pointer-events: none; width: min(560px, 90vw); z-index: 30; }
.toast { background: rgba(14, 10, 16, 0.92); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-size: 13px; font-weight: 800; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5); animation: tin 0.25s ease; text-align: center; transition: opacity 0.5s, transform 0.5s; }
.toast.out { opacity: 0; transform: translateY(-8px); }
.t-legendary { border-color: var(--r-legendary); color: #ffc08a; box-shadow: 0 0 18px rgba(255, 138, 31, 0.35); }
.t-set { border-color: var(--r-set); color: #a8ffc8; }
.t-achievement { border-color: var(--gold); color: #ffe8a8; }
.t-quest { border-color: #c8a060; color: #ffe8c0; }
.t-level { border-color: #ffe08a; color: #fff2c0; font-size: 14px; }
.t-warn { border-color: #8a3a2a; color: #ffb8a8; }
.t-boss { border-color: var(--ember); color: #ffc8a0; font-size: 15px; }
.t-power, .t-shrine { border-color: #8a6aff; color: #e0d0ff; }
.t-rare { border-color: var(--r-rare); color: #ffec9a; }
body.panel-open .toasts { top: auto; bottom: 24px; }
@keyframes tin { from { opacity: 0; transform: translateY(-6px); } }

/* ---------------- common controls ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid #5a4638; background: linear-gradient(180deg, #3a2c28, #221816); color: var(--ink); padding: 8px 14px; border-radius: 9px; font-weight: 800; font-size: 13.5px; cursor: pointer; text-align: center; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 6px rgba(0, 0, 0, 0.4); }
.btn:hover:not(:disabled) { border-color: var(--gold); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #b8641a, #7a3410); border-color: #e0903a; color: #fff4e0; }
.btn.danger { background: linear-gradient(180deg, #7a2018, #401008); border-color: #c0402a; }
.btn.ghost { background: transparent; border-color: #4a3a34; }
.btn.quest { border-color: #c8a060; color: #ffe8c0; }
.btn.big { padding: 12px 22px; font-size: 16px; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.plus { min-width: 40px; padding: 6px 10px; }
.btn.on { border-color: var(--gold); }
.btn .ico { width: 18px; height: 18px; }
.btn small { display: block; font-size: 11px; font-weight: 700; opacity: 0.8; }
.mini { min-width: 26px; height: 26px; border-radius: 6px; border: 1px solid #5a4638; background: #221816; cursor: pointer; font-weight: 900; font-size: 12px; padding: 0 5px; }
.mini.on { background: #7a3410; border-color: #e0903a; }
.mini:disabled { opacity: 0.4; }
.row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.row.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.kicker { text-transform: uppercase; letter-spacing: 0.14em; font-size: 11px; color: #c8a878; margin: 6px 0; font-weight: 900; }
.notice { background: rgba(60, 40, 20, 0.6); border: 1px solid #8a6a3a; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.notice.warn { background: rgba(80, 20, 16, 0.6); border-color: #a83a2a; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 800; color: var(--muted); }
.field input, .field select, textarea { background: #0e0a0e; border: 1px solid #4a3a34; color: var(--ink); border-radius: 8px; padding: 8px 10px; font-weight: 700; }
textarea { width: 100%; font-size: 12px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 8px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ember); }
.bar { height: 7px; background: #140c0c; border-radius: 4px; overflow: hidden; border: 1px solid #2a1e1e; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #a8781a, #ffe08a); }

/* portraits with graceful fallback */
.portrait { position: relative; display: inline-block; flex: none; border-radius: 12px; overflow: hidden; background: radial-gradient(circle at 40% 30%, #5a4038, #1e1418); border: 2px solid #6a4a34; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55); }
.portrait::before { content: attr(data-initial); position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-weight: 700; color: #f0d8a8; font-size: 0.5em; }
.portrait img { position: relative; width: 100%; height: 100%; object-fit: cover; display: block; }
.portrait.sm { width: 36px; height: 36px; font-size: 36px; border-radius: 8px; }
.portrait.md { width: 64px; height: 64px; font-size: 64px; }
.portrait.lg { width: 104px; height: 104px; font-size: 104px; }
.portrait.xl { width: 220px; height: 220px; font-size: 220px; border-radius: 16px; }

/* ---------------- panels ---------------- */
.panel { position: absolute; inset: 0; background: rgba(4, 2, 6, 0.62); display: grid; place-items: center; z-index: 20; padding: 10px; }
.panel-card { width: min(980px, 100%); max-height: 100%; display: flex; flex-direction: column; background: linear-gradient(180deg, #1c1519, #120d10); border: 1px solid #5a4234; border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 220, 160, 0.06); outline: none; }
.panel-card header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid #3a2a26; }
.panel-card h2 { margin: 0; font-family: var(--serif); font-size: 21px; color: #f5dca8; letter-spacing: 0.04em; }
.close { width: 36px; height: 36px; border-radius: 9px; border: 1px solid #5a4638; background: #221816; cursor: pointer; font-size: 16px; }
.panel-body { padding: 12px 14px; overflow: auto; min-height: 0; flex: 1; user-select: none; }
.panel-body h3 { font-family: var(--serif); color: #f0d0a0; font-size: 16px; margin: 14px 0 8px; }
.panel-body h3 small { font-family: var(--font); color: var(--muted); font-size: 12px; margin-left: 6px; }
.panel-body h4 { margin: 0 0 2px; font-size: 14px; }
.panel-body h4 small { color: var(--muted); font-weight: 700; margin-left: 4px; }
.panel-body p { margin: 4px 0; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; border-bottom: 1px solid #3a2a26; padding-bottom: 8px; }
.tab { border: 1px solid #4a3a34; background: #1a1216; padding: 7px 12px; border-radius: 8px; cursor: pointer; font-weight: 800; font-size: 13px; }
.tab[aria-selected="true"] { background: linear-gradient(180deg, #7a3a14, #4a200a); border-color: #e0903a; color: #fff0d8; }

/* item slots */
.slot { position: relative; width: 46px; height: 46px; border-radius: 8px; border: 1px solid #3a2e2a; background: radial-gradient(circle at 50% 40%, #241a1e, #120c10); padding: 3px; cursor: pointer; }
.slot img { width: 100%; height: 100%; display: block; }
.slot:not(.empty) { border-color: color-mix(in srgb, var(--rc) 70%, #000); box-shadow: inset 0 0 12px color-mix(in srgb, var(--rc) 25%, transparent); }
.slot.r-legendary, .slot.r-set { box-shadow: inset 0 0 14px color-mix(in srgb, var(--rc) 45%, transparent), 0 0 8px color-mix(in srgb, var(--rc) 40%, transparent); }
.slot.sel { outline: 2px solid var(--gold); outline-offset: 1px; }
.slot.empty { cursor: default; }
.slot.empty span { font-size: 9px; color: #5a4a44; }
.slot .enh { position: absolute; right: 2px; top: 1px; font-size: 10px; color: #9fe0ff; text-shadow: 0 1px 2px #000; }
.slot .unid { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; color: #fff; text-shadow: 0 0 6px #000; background: rgba(0, 0, 0, 0.35); border-radius: 8px; }
.slot .sock { position: absolute; left: 2px; bottom: 0; font-size: 8px; color: #c8b0ff; font-style: normal; }
.bag { display: grid; grid-template-columns: repeat(auto-fill, 46px); gap: 4px; }
.inv { display: grid; grid-template-columns: minmax(250px, 300px) 1fr; gap: 14px; }
.doll { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; justify-items: center; background: radial-gradient(circle at 50% 40%, #2a1e22, #140e12); border: 1px solid #3a2a26; border-radius: 12px; padding: 10px; }
.doll-slot { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.doll-slot small { font-size: 9.5px; color: var(--muted); }
.doll .slot { width: 54px; height: 54px; }
.gold-line { margin: 8px 0; font-weight: 800; color: #ffe08a; }
.stacks { display: flex; flex-wrap: wrap; gap: 5px; }
.stack { display: inline-flex; align-items: center; gap: 4px; background: #1a1216; border: 1px solid #3a2e2a; border-radius: 7px; padding: 3px 7px 3px 3px; font-size: 11.5px; }
.stack img { width: 22px; height: 22px; }
.bag-head { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.detail { margin-top: 10px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; }
.item-card { background: linear-gradient(180deg, #1e161a, #110c0f); border: 1px solid color-mix(in srgb, var(--rc, #555) 55%, #000); border-radius: 10px; padding: 10px; }
.item-head { display: flex; gap: 8px; align-items: center; }
.item-head img { width: 44px; height: 44px; }
.item-head h4 { color: var(--rc); font-size: 15px; }
.item-head p { color: var(--muted); font-size: 11.5px; margin: 0; }
.stats { list-style: none; padding: 0; margin: 8px 0; font-size: 13px; }
.stats li { padding: 1px 0; }
.stats li.base { color: #f0e8d8; }
.stats li.base em { color: #9fd8ff; font-style: normal; font-size: 11px; }
.stats li.affix { color: #8ab0ff; }
.stats li.affix.ench { color: #d8b0ff; }
.stats li.gem { color: #c8b0ff; font-size: 12px; }
.power { color: #ffae5a; font-size: 12.5px; font-style: italic; border-top: 1px solid #3a2a22; padding-top: 6px; }
.set { color: var(--r-set); font-size: 12px; border-top: 1px solid #2a3a2e; padding-top: 6px; margin-top: 6px; }
.set ul { margin: 2px 0 4px; padding-left: 16px; color: #6a8a70; }
.set li.on, .set p.on { color: var(--r-set); }
.set p.muted { color: #5a6a5e; }
.compare { margin-top: 8px; }
.compare ul { list-style: none; padding: 0; margin: 4px 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; font-weight: 800; }
.compare .up { color: var(--good); }
.compare .down { color: var(--bad); }

/* skills */
.points { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-weight: 800; }
.points b { color: var(--gold); font-size: 16px; }
.hotbar-preview { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.hb-slot { display: flex; align-items: center; gap: 6px; background: #1a1216; border: 1px solid #3a2e2a; border-radius: 8px; padding: 4px 8px 4px 4px; font-size: 12px; min-width: 120px; }
.hb-slot img { width: 30px; height: 30px; border-radius: 6px; }
.hb-slot small { font-weight: 900; color: var(--gold); }
.skill-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border: 1px solid #2e2226; border-radius: 10px; margin-bottom: 6px; background: #150f13; }
.skill-row img { width: 48px; height: 48px; border-radius: 8px; background: #0c080a; }
.skill-row.locked { opacity: 0.75; }
.skill-row .grow { flex: 1; min-width: 0; }
.skill-row p { font-size: 12.5px; }
.assign { display: flex; gap: 4px; align-items: center; font-size: 11px; color: var(--muted); margin-top: 4px; }
.passives { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.grow { flex: 1; min-width: 0; }

/* quests & achievements */
.quest { border: 1px solid #2e2226; background: #150f13; border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; }
.quest.main { border-left: 3px solid var(--gold); }
.quest.companion { border-left: 3px solid var(--good); }
.quest.bounty { border-left: 3px solid #8a6aff; }
.quest.ready { box-shadow: 0 0 0 1px #c8a060; }
.quest.done h4, .quest .objs li.done { color: #7a8a70; }
.objs { list-style: none; padding: 0; margin: 4px 0 0; font-size: 12.5px; }
.objs b { color: var(--gold); }
.tag { font-size: 10px; background: #7a5a1a; color: #fff0c0; padding: 1px 6px; border-radius: 999px; margin-left: 6px; }
.tag.done { background: #2a4a2a; }
.ach, .title-row { display: flex; gap: 10px; align-items: center; border: 1px solid #2e2226; background: #150f13; border-radius: 10px; padding: 8px 10px; margin-bottom: 5px; }
.ach.done { border-color: #6a5a2a; }
.ach em, .title-row em { color: var(--gold); font-style: normal; }
.ach .bar { margin-top: 4px; }
.title-row.locked { opacity: 0.55; }
.title-row.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }

/* character */
.char-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.stat-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stat-table th { text-align: left; color: var(--muted); font-weight: 700; padding: 3px 6px; }
.stat-table td { text-align: right; font-weight: 800; padding: 3px 6px; }
.stat-table tr:nth-child(odd) { background: rgba(255, 255, 255, 0.025); }
.powers { font-size: 12.5px; color: #ffc08a; padding-left: 18px; }
.paragon { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; }
.par { display: flex; justify-content: space-between; align-items: center; border: 1px solid #2e2226; border-radius: 8px; padding: 5px 8px; font-size: 13px; }
.par small { color: var(--muted); display: block; }

/* waypoints / stash / roster / shop */
.wp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.btn.wp { flex-direction: column; align-items: flex-start; }
.btn.wp.here { border-color: var(--gold); }
.stash-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.comp { display: flex; gap: 12px; border: 1px solid #2e2226; background: #150f13; border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.comp.active { border-color: var(--good); }
.comp.locked { opacity: 0.7; }
.loyal { display: flex; align-items: center; gap: 8px; font-size: 12px; margin: 4px 0; }
.loyal .bar { flex: 1; }
.loyal .bar i { background: linear-gradient(90deg, #2a8a4a, #8aff9a); }
.shop-stacks { display: grid; gap: 6px; }
.stack-buy { display: flex; align-items: center; gap: 8px; border: 1px solid #2e2226; border-radius: 10px; padding: 6px; background: #150f13; }
.stack-buy img { width: 36px; height: 36px; }
.split { display: grid; grid-template-columns: minmax(200px, 300px) 1fr; gap: 14px; }
.picker .bag { margin-bottom: 6px; }
.gem-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; margin: 4px 0; }
.gem-row b { width: 70px; }
.gem-cell { display: inline-flex; gap: 3px; align-items: center; background: #1a1216; border: 1px solid #2e2226; border-radius: 6px; padding: 2px 5px; }
.gamble-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.gamble { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 1px solid #4a3a5a; background: radial-gradient(circle, #2a1e36, #140e1a); border-radius: 12px; padding: 8px; cursor: pointer; font-weight: 800; }
.gamble img { width: 56px; height: 56px; }
.gamble small { color: #ffe08a; }
.gamble:disabled { opacity: 0.45; }
.enchant-list { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.menu-main { display: flex; flex-direction: column; gap: 10px; max-width: 320px; margin: 10px auto; }
.form { max-width: 620px; }
.tips { font-size: 13px; padding-left: 18px; }

/* enhancement */
.enh-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 6px; }
.enh-table th, .enh-table td { padding: 3px 6px; text-align: center; border-bottom: 1px solid #2a1e1e; }
.enh-table tr.down td:nth-child(3) { color: #ffb86a; }
.enh-table tr.break td:nth-child(3) { color: var(--bad); font-weight: 900; }
.anvil { position: relative; height: 110px; margin: 4px 0 10px; border-radius: 12px; background: radial-gradient(ellipse at 50% 90%, #5a2a14 0%, #1a0e0c 60%, #0e0a0c 100%); border: 1px solid #4a2e22; display: grid; place-items: center; overflow: hidden; }
.anvil::after { content: ""; position: absolute; left: 50%; bottom: 10px; width: 150px; height: 22px; transform: translateX(-50%); background: linear-gradient(180deg, #5a5a64, #2a2a30); border-radius: 6px 6px 2px 2px; box-shadow: 0 -2px 0 #7a7a84 inset; }
.anvil-item { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; margin-bottom: 24px; }
.anvil-item img { width: 58px; height: 58px; filter: drop-shadow(0 0 8px rgba(255, 170, 80, 0.5)); }
.anvil-item b { font-size: 18px; color: #9fe0ff; text-shadow: 0 2px 4px #000; }
.sparks i { position: absolute; left: 50%; top: 55%; width: 5px; height: 5px; border-radius: 50%; background: #ffd46a; opacity: 0; box-shadow: 0 0 8px #ff9a2a; }
.anvil.a-success { animation: glowok 0.9s ease; }
.anvil.a-success .sparks i { animation: spark 0.8s ease-out forwards; }
.anvil.a-success .anvil-item { animation: pop 0.6s ease; }
.anvil.a-fail .anvil-item, .anvil.a-downgrade .anvil-item { animation: shake 0.45s ease; }
.anvil.a-fail, .anvil.a-downgrade { animation: glowbad 0.8s ease; }
.anvil.a-destroyed { animation: glowbad 1s ease; }
.anvil.a-destroyed .anvil-item { animation: shatter 0.8s ease forwards; }
.sparks i:nth-child(1) { --dx: -70px; --dy: -50px; } .sparks i:nth-child(2) { --dx: 60px; --dy: -60px; } .sparks i:nth-child(3) { --dx: -40px; --dy: -80px; }
.sparks i:nth-child(4) { --dx: 80px; --dy: -20px; } .sparks i:nth-child(5) { --dx: -90px; --dy: -10px; } .sparks i:nth-child(6) { --dx: 20px; --dy: -90px; }
@keyframes spark { 0% { opacity: 1; transform: translate(0, 0); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)); } }
@keyframes pop { 40% { transform: scale(1.25); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes shatter { 30% { transform: scale(1.1) rotate(4deg); } 100% { transform: scale(0.2) rotate(-30deg); opacity: 0; } }
@keyframes glowok { 30% { box-shadow: 0 0 40px rgba(120, 220, 255, 0.7) inset; } }
@keyframes glowbad { 30% { box-shadow: 0 0 40px rgba(255, 60, 40, 0.6) inset; } }
.enh-line { font-size: 15px; }
.chance { font-size: 15px; }
.chance b { font-size: 22px; color: #9fe0ff; }
.pity { display: flex; align-items: center; gap: 8px; font-size: 12px; margin: 4px 0; }
.pity .bar { flex: 1; max-width: 220px; }
.pity .bar i { background: linear-gradient(90deg, #3a7ad8, #9fe0ff); }
.fail { font-weight: 800; font-size: 13px; }
.fail.keep { color: var(--good); }
.fail.down { color: #ffb86a; }
.fail.break { color: var(--bad); }
.cost { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-weight: 800; font-size: 13px; }
.cost li { display: flex; align-items: center; gap: 4px; }
.cost li img { width: 20px; height: 20px; }
.cost .short { color: var(--bad); }

/* ---------------- dialog ---------------- */
.dialog { position: absolute; inset: 0; z-index: 25; display: flex; align-items: flex-end; justify-content: center; padding: 12px; background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.55)); }
.dialog-card { width: min(760px, 100%); display: flex; gap: 14px; align-items: flex-start; background: linear-gradient(180deg, rgba(34, 24, 26, 0.98), rgba(16, 11, 13, 0.98)); border: 1px solid #6a4a34; border-radius: 14px; padding: 14px; box-shadow: 0 16px 50px rgba(0, 0, 0, 0.7); max-height: 100%; overflow: auto; }
.dialog-card.inline { margin: auto; }
.dialog-main { flex: 1; min-width: 0; }
.dialog-card h3 { margin: 0; font-family: var(--serif); color: #f5dca8; font-size: 19px; }
.dialog-card h3 small { font-family: var(--font); font-size: 12px; color: var(--muted); margin-left: 6px; }
.dialog-text, .dialog-card p { font-size: 14.5px; line-height: 1.5; }
.dialog-opts { display: flex; flex-direction: column; gap: 6px; align-items: stretch; margin-top: 8px; }
.dialog-opts .btn { justify-content: flex-start; text-align: left; }
.lore { flex: 1; background: linear-gradient(180deg, #2a2218, #1a140e); border-radius: 10px; padding: 12px 16px; }
.lore h3 { font-family: var(--serif); }
.lore-text { font-family: var(--serif); font-size: 16px; color: #f0e2c4; line-height: 1.6; font-style: italic; }

/* ---------------- screens ---------------- */
.screen { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; padding: 14px; overflow: auto; background: radial-gradient(ellipse at 50% 20%, #3a1a10 0%, #120a0c 55%, #050305 100%); }
.screen.story.dim, .screen.boss { background: rgba(4, 2, 6, 0.72); }
.screen.death { background: radial-gradient(ellipse at center, rgba(60, 0, 0, 0.55), rgba(0, 0, 0, 0.85)); }
.title-bg { position: absolute; inset: 0; }
.title-bg img { width: 100%; height: 100%; object-fit: cover; opacity: 0.55; }
.title-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, rgba(0, 0, 0, 0.1), rgba(5, 3, 5, 0.85) 75%); }
.title-card { position: relative; width: min(620px, 100%); text-align: center; background: rgba(12, 8, 10, 0.72); border: 1px solid #5a3a2a; border-radius: 16px; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7); backdrop-filter: blur(3px); }
.title-card.wide { width: min(900px, 100%); }
.title-card.narrow { width: min(480px, 100%); text-align: left; }
.title-card h2 { font-family: var(--serif); color: #f5dca8; margin: 0 0 12px; }
.title-card .row { justify-content: center; }
.title-card.narrow .row { justify-content: flex-start; }
.logo { margin: 4px 0 14px; font-family: var(--serif); font-size: clamp(40px, 8vw, 72px); letter-spacing: 0.06em; line-height: 1; color: #ffe0a8; text-shadow: 0 0 24px rgba(255, 110, 40, 0.55), 0 4px 10px #000; }
.logo span { display: block; font-size: 0.34em; letter-spacing: 0.4em; color: #ff9a5a; margin-top: 6px; text-transform: uppercase; }
.title-actions { display: flex; flex-direction: column; gap: 10px; align-items: center; margin: 16px 0; }
.title-actions .btn { min-width: 240px; flex-direction: column; }
.fine { font-size: 11.5px; color: var(--muted); }
.class-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.class-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; border-radius: 14px; border: 2px solid #3a2a26; background: linear-gradient(180deg, #1e1519, #120c0f); cursor: pointer; text-align: center; }
.class-card[aria-pressed="true"] { border-color: var(--ember); box-shadow: 0 0 22px rgba(255, 122, 42, 0.35); }
.cc-text { display: flex; flex-direction: column; gap: 4px; }
.class-card strong { font-family: var(--serif); font-size: 20px; color: #f5dca8; }
.class-card em { font-style: normal; font-size: 11px; color: #ffae5a; font-weight: 900; letter-spacing: 0.08em; }
.class-card span { font-size: 12.5px; color: #cfc2b0; }
.class-card .portrait { width: 132px; height: 132px; font-size: 132px; }
.story-card { width: min(620px, 100%); text-align: center; background: rgba(12, 8, 10, 0.8); border: 1px solid #5a3a2a; border-radius: 16px; padding: 26px; }
.story-text { font-family: var(--serif); font-size: clamp(17px, 2.6vw, 22px); line-height: 1.55; color: #f3e2c4; min-height: 4.6em; }
.story-card .row { justify-content: center; }
.story-card h2 { font-family: var(--serif); color: #ff8a6a; font-size: 34px; margin: 0 0 8px; }
.dots { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: #4a3a34; }
.dots i.on { background: var(--gold); }
.boss-card { display: flex; gap: 20px; align-items: center; background: linear-gradient(180deg, rgba(40, 14, 10, 0.95), rgba(14, 6, 6, 0.95)); border: 1px solid #a8401a; border-radius: 18px; padding: 18px; width: min(700px, 100%); box-shadow: 0 0 60px rgba(255, 80, 20, 0.3); animation: bossin 0.5s ease; }
.boss-card h2 { font-family: var(--serif); font-size: clamp(24px, 4vw, 36px); color: #ffc89a; margin: 4px 0 8px; text-shadow: 0 0 20px rgba(255, 80, 20, 0.6); }
.boss-card p { color: #e8d0c0; font-style: italic; }
.screen.noportrait .boss-card .portrait { display: none; }
@keyframes bossin { from { transform: scale(1.08); opacity: 0; } }

/* ---------------- responsive ---------------- */
body.compact .hero-chip { max-width: 60%; padding: 4px 8px; }
body.compact .hb { width: 32px; height: 32px; font-size: 15px; }
body.compact .hb.opt { display: none; }
body.compact .hud-buttons { flex-wrap: nowrap; }
body.compact .hint { left: 8px; right: 8px; transform: none; max-width: none; top: 50px; font-size: 12px; padding: 6px 10px; }
body.compact .hint span { flex: 1; }
body.compact .side { top: 96px; }
body.compact .toasts { top: 150px; }
body.compact .side { top: 50px; width: 120px; }
body.compact #minimap { width: 104px; height: 104px; }
body.compact .tracker { display: none; }
body.compact .hk { width: 42px; height: 42px; }
body.compact .orb { width: 64px; height: 64px; }
body.compact .buffs { top: 50px; }
@media (max-width: 760px) {
  .inv, .split, .stash-wrap { grid-template-columns: 1fr; }
  .class-grid { grid-template-columns: 1fr; }
  .class-card { flex-direction: row; text-align: left; }
  .class-card .portrait { width: 72px; height: 72px; font-size: 72px; }
  .portrait.lg { width: 72px; height: 72px; font-size: 72px; }
  .portrait.xl { width: 120px; height: 120px; font-size: 120px; }
  .boss-card { flex-direction: column; text-align: center; }
  .dialog-card { flex-direction: column; align-items: stretch; }
  .dialog-card .portrait { align-self: flex-start; }
  .hud-buttons { max-width: 48%; }
  .toasts { top: 120px; }
  .panel { padding: 4px; }
  .panel-body { padding: 10px; }
}
@media (max-height: 560px) {
  .orb { width: 64px; height: 64px; }
  .hk { width: 42px; height: 42px; }
  #minimap { width: 110px; height: 110px; }
  .tracker { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
