/* Sigilborn — mobile-first UI over a full-screen three.js canvas. */

:root {
    --bg: #0e0a1c;
    --panel: rgba(22, 16, 42, 0.94);
    --panel-2: rgba(36, 26, 66, 0.96);
    --panel-3: #2e2256;
    --ink: #f6f0ff;
    --muted: #b9b0d6;
    --dim: #8a80aa;
    --gold: #f2c45a;
    --gold-2: #ffe7a3;
    --gold-3: #a8741c;
    --line: rgba(242, 196, 90, 0.38);
    --line-soft: rgba(255, 255, 255, 0.1);
    --good: #7be08a;
    --bad: #ff6a7a;
    --r1: #b9c2cc; --r2: #6ee07a; --r3: #53b4ff; --r4: #c879ff; --r5: #ffc94a; --r6: #ff5d8f;
    --fire: #ff6a3d; --water: #3da5ff; --wind: #4fd36a; --light: #ffd84a; --dark: #a65cff;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --top-h: 58px;
    --tab-h: 66px;
    --radius: 14px;
    --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --title: 'Cinzel', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; font-weight: 700; overflow: hidden; overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; touch-action: manipulation; }
button { font: inherit; color: inherit; }
img { -webkit-user-drag: none; }

#games-link { position: fixed; top: calc(8px + var(--safe-t)); left: 8px; z-index: 99999; font-family: Arial, Helvetica, sans-serif; font-size: 13px; color: #fff; background: rgba(0, 0, 0, 0.55); padding: 6px 12px; border-radius: 6px; text-decoration: none; border: 1px solid rgba(255, 255, 255, 0.25); }
body.ingame #games-link { display: none; }

#app { position: fixed; inset: 0; }
#gl-host, #gl-host canvas { position: absolute; inset: 0; display: block; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
#screen { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
#screen > * { pointer-events: auto; }
/* transparent overlays let taps through to the 3D canvas and unit plates; their controls opt back in */
#screen > .passthrough, #screen > .battle-hud, #screen > .citadel-hud, #screen > .scene-hud, #screen > .summon-ui,
#screen > .title-screen, #screen > .creator, #screen > .hd-top, #screen > .featured { pointer-events: none; }
#screen > .passthrough > * { pointer-events: auto; }

.ico { width: 1.25em; height: 1.25em; display: inline-block; vertical-align: -0.28em; flex: none; }
.tint .ico path, .tint .ico circle { fill: var(--c); }

/* ---------------------------------------------------------------- top bar */
#topbar { position: absolute; z-index: 30; top: 0; left: 0; right: 0; padding: calc(6px + var(--safe-t)) 8px 6px; display: flex; align-items: center; gap: 8px; background: linear-gradient(180deg, rgba(10, 6, 24, 0.86), rgba(10, 6, 24, 0)); pointer-events: none; }
#topbar > * { pointer-events: auto; }
.tb-ol { display: flex; align-items: center; gap: 6px; background: rgba(20, 14, 40, 0.82); border: 1.5px solid var(--line); border-radius: 30px; padding: 3px 12px 3px 3px; position: relative; cursor: pointer; min-height: 46px; }
.tb-portrait { width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #6a4ab0, #20143e); border: 2px solid var(--gold); object-fit: cover; }
.tb-ol-text { display: flex; flex-direction: column; line-height: 1.05; text-align: left; }
.tb-name { font-size: 14px; font-weight: 800; max-width: 22vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-lv { font-size: 13px; color: var(--gold-2); }
.tb-xp { position: absolute; left: 46px; right: 12px; bottom: 4px; height: 3px; background: rgba(255, 255, 255, 0.15); border-radius: 3px; overflow: hidden; }
.tb-xp span { display: block; height: 100%; background: linear-gradient(90deg, #7be0ff, #c8a0ff); width: 0; }
.tb-res { margin-left: auto; display: flex; gap: 6px; }
.res-chip { display: flex; align-items: center; gap: 4px; background: rgba(20, 14, 40, 0.82); border: 1.5px solid var(--line-soft); border-radius: 22px; padding: 4px 10px 4px 6px; font-size: 15px; font-weight: 900; min-height: 44px; cursor: pointer; white-space: nowrap; }
.res-chip .ico { width: 22px; height: 22px; }
.res-chip small { font-size: 12px; color: var(--muted); font-weight: 700; }

/* ---------------------------------------------------------------- tab bar */
#tabbar { position: absolute; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b); display: flex; background: linear-gradient(180deg, rgba(26, 18, 50, 0.96), rgba(12, 8, 26, 0.99)); border-top: 1.5px solid var(--line); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: none; border: 0; color: var(--muted); font-size: 13px; font-weight: 800; position: relative; cursor: pointer; padding: 4px 0; min-width: 0; }
.tab .tab-ico .ico { width: 28px; height: 28px; }
.tab.on { color: var(--gold-2); }
.tab.on::before { content: ''; position: absolute; top: -1px; left: 22%; right: 22%; height: 3px; border-radius: 0 0 4px 4px; background: var(--gold); box-shadow: 0 0 12px var(--gold); }
.tab.big .tab-ico { width: 54px; height: 54px; margin-top: -26px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, #8a5ae0, #3a1e7a); border: 2.5px solid var(--gold); box-shadow: 0 0 18px rgba(170, 120, 255, 0.7), inset 0 0 10px rgba(255, 255, 255, 0.2); color: #fff; }
.tab.big .tab-ico .ico { width: 30px; height: 30px; }
.badge { position: absolute; top: 4px; right: calc(50% - 26px); min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #ff3a5a; color: #fff; font-size: 12px; font-weight: 900; display: grid; place-items: center; box-shadow: 0 0 0 2px #1a1030; }
.tab.big .badge { top: -22px; right: calc(50% - 32px); }

/* ---------------------------------------------------------------- buttons */
.btn { appearance: none; border: 0; cursor: pointer; min-height: 48px; padding: 10px 18px; border-radius: 12px; font-weight: 900; font-size: 16px; letter-spacing: 0.02em; color: #fff; background: linear-gradient(180deg, #6a4ab8, #3e2680); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -3px 0 rgba(0, 0, 0, 0.3), 0 3px 10px rgba(0, 0, 0, 0.4); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform 0.08s, filter 0.15s; position: relative; }
.btn:active { transform: translateY(2px) scale(0.98); }
.btn:disabled { filter: grayscale(0.85) brightness(0.65); cursor: default; }
.btn.gold { background: linear-gradient(180deg, #ffd978, #d89a24); color: #3a2204; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); }
.btn.green { background: linear-gradient(180deg, #6ee08a, #2a9a4a); }
.btn.red { background: linear-gradient(180deg, #ff7a8a, #b8283e); }
.btn.blue { background: linear-gradient(180deg, #6ac0ff, #2a62c8); }
.btn.ghost { background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.2); }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: 15px; border-radius: 10px; }
.btn.wide { width: 100%; }
.btn .cost { margin-left: 2px; }
.btn small { font-size: 13px; opacity: 0.85; font-weight: 800; }
.icon-btn { appearance: none; border: 0; background: rgba(255, 255, 255, 0.08); color: var(--ink); width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn .ico { width: 24px; height: 24px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; min-width: 120px; }

/* ---------------------------------------------------------------- panels & screens */
.panel { background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.04); }
.sheet { position: absolute; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b)); top: calc(var(--top-h) + var(--safe-t)); display: flex; flex-direction: column; background: linear-gradient(180deg, rgba(18, 12, 36, 0.92), rgba(12, 8, 26, 0.97)); }
.sheet.full { bottom: 0; top: 0; padding-top: var(--safe-t); }
.sheet.notab { bottom: 0; padding-bottom: var(--safe-b); }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); flex: none; }
.sheet-head h1 { font-family: var(--title); font-size: 22px; margin: 0; color: var(--gold-2); letter-spacing: 0.04em; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.sheet-foot { flex: none; padding: 10px 12px; border-top: 1px solid var(--line-soft); background: rgba(10, 6, 22, 0.6); }
.wrap { max-width: 760px; margin: 0 auto; }
h2.sec { font-family: var(--title); font-size: 18px; color: var(--gold-2); margin: 16px 0 8px; letter-spacing: 0.03em; display: flex; align-items: center; gap: 8px; }
h2.sec:first-child { margin-top: 2px; }
h2.sec .aside { margin-left: auto; font-family: var(--font); font-size: 14px; color: var(--muted); letter-spacing: 0; }
p { line-height: 1.45; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 16px; background: rgba(255, 255, 255, 0.08); font-size: 14px; font-weight: 800; border: 1px solid var(--line-soft); }
.chip.on { background: var(--gold); color: #2a1804; border-color: var(--gold-2); }
button.chip { cursor: pointer; min-height: 36px; }
.card { background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px; }
.card + .card { margin-top: 10px; }
.list > * + * { margin-top: 8px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 15px; }
.kv .k { color: var(--muted); }
.kv .v { text-align: right; font-weight: 900; }

/* ---------------------------------------------------------------- bars */
.bar { position: relative; height: 14px; border-radius: 8px; background: rgba(0, 0, 0, 0.45); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.bar-fill { height: 100%; background: linear-gradient(180deg, #8ae8ff, #3a9ae0); border-radius: 8px; transition: width 0.3s; }
.bar.gold .bar-fill { background: linear-gradient(180deg, #ffe08a, #d8981c); }
.bar.green .bar-fill { background: linear-gradient(180deg, #9af08a, #3aa84a); }
.bar.purple .bar-fill { background: linear-gradient(180deg, #d8a8ff, #7a3ad0); }
.bar.tall { height: 20px; }
.bar-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 900; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.bar.tall .bar-text { font-size: 13px; }

/* ---------------------------------------------------------------- stars, badges */
.stars { display: inline-flex; letter-spacing: -2px; }
.star { color: #ffd24a; text-shadow: 0 0 2px #6a4400, 0 1px 1px #000; }
.stars.r6 .star { color: #ff7aa8; }
.star.awake { color: #d8a0ff; text-shadow: 0 0 6px #b06aff, 0 1px 1px #000; }
.star.off { color: rgba(255, 255, 255, 0.2); text-shadow: none; }
.el-badge, .cls-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px 3px 5px; border-radius: 14px; font-size: 14px; font-weight: 900; background: rgba(0, 0, 0, 0.35); border: 1px solid color-mix(in srgb, var(--c, #fff) 60%, transparent); color: var(--c, #fff); }
.cls-badge { --c: #e8dcff; }
.cls-badge .ico { color: #e8dcff; }

/* ---------------------------------------------------------------- hero cards */
.hero-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.hero-card { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; border: 0; padding: 0; overflow: hidden; cursor: pointer; background: radial-gradient(circle at 50% 30%, var(--hc-bg1, #4a3a7a), var(--hc-bg2, #1a1230)); box-shadow: inset 0 0 0 2px var(--hc-frame, #6f7884), 0 3px 8px rgba(0, 0, 0, 0.5); transition: transform 0.1s; }
.hero-card:active { transform: scale(0.97); }
.hero-card.r1 { --hc-frame: #8a929c; --hc-bg1: #4a5260; }
.hero-card.r2 { --hc-frame: #4fc060; --hc-bg1: #2f6a3a; }
.hero-card.r3 { --hc-frame: #4aa0f0; --hc-bg1: #2a4a8a; }
.hero-card.r4 { --hc-frame: #b86af0; --hc-bg1: #5a2a8a; }
.hero-card.r5 { --hc-frame: #ffc94a; --hc-bg1: #8a5a1a; box-shadow: inset 0 0 0 2px #ffc94a, 0 0 12px rgba(255, 201, 74, 0.5), 0 3px 8px rgba(0, 0, 0, 0.5); }
.hero-card.r6 { --hc-frame: #ff5d8f; --hc-bg1: #8a1a4a; box-shadow: inset 0 0 0 2px #ff5d8f, 0 0 14px rgba(255, 93, 143, 0.6), 0 3px 8px rgba(0, 0, 0, 0.5); }
.hero-card.radiant::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.35) 45%, transparent 60%); background-size: 250% 100%; animation: shimmer 2.6s linear infinite; pointer-events: none; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.hero-card.selected { outline: 3px solid var(--gold-2); outline-offset: -3px; }
.hero-card.selected::before { content: '✓'; position: absolute; z-index: 3; top: 30%; left: 50%; transform: translateX(-50%); width: 36px; height: 36px; border-radius: 50%; background: var(--gold); color: #2a1804; font-size: 24px; display: grid; place-items: center; font-weight: 900; }
.hero-card.dim { filter: grayscale(0.7) brightness(0.55); }
.hero-card .portrait { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; }
.hc-el { position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0, 0, 0, 0.55); display: grid; place-items: center; }
.hc-el .ico { width: 18px; height: 18px; }
.hc-cls { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0, 0, 0, 0.55); display: grid; place-items: center; color: #e8dcff; }
.hc-cls .ico { width: 16px; height: 16px; }
.hc-lv { position: absolute; left: 0; right: 0; bottom: 30px; text-align: center; font-size: 13px; font-weight: 900; text-shadow: 0 1px 2px #000, 0 0 3px #000; }
.hc-stars { position: absolute; left: 0; right: 0; bottom: 16px; text-align: center; font-size: 13px; }
.hc-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 4px 3px; text-align: center; font-size: 12.5px; font-weight: 800; background: rgba(0, 0, 0, 0.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-card.compact .hc-lv { bottom: 16px; }
.hero-card.compact .hc-stars { bottom: 2px; }
.hc-tag { position: absolute; top: 32px; left: 0; right: 0; text-align: center; font-size: 11.5px; font-weight: 900; background: rgba(0, 0, 0, 0.7); color: var(--gold-2); padding: 1px 0; }
.hc-lock { position: absolute; top: 30px; right: 6px; color: var(--gold-2); }
.hc-lock .ico { width: 16px; height: 16px; }
.hc-new { position: absolute; top: 30px; left: 4px; background: #ff3a5a; color: #fff; font-size: 11px; font-weight: 900; padding: 1px 5px; border-radius: 6px; }

/* ---------------------------------------------------------------- gear */
.gear-icon { position: relative; width: 56px; height: 56px; border-radius: 12px; flex: none; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--set) 55%, #2a2050), #140e28); box-shadow: inset 0 0 0 2px var(--gr, #8a929c); }
.gear-icon.gr1 { --gr: #8a929c; } .gear-icon.gr2 { --gr: #4fc060; } .gear-icon.gr3 { --gr: #4aa0f0; } .gear-icon.gr4 { --gr: #b86af0; } .gear-icon.gr5 { --gr: #ffc94a; box-shadow: inset 0 0 0 2px #ffc94a, 0 0 10px rgba(255, 201, 74, 0.5); }
.gi-ico .ico { width: 32px; height: 32px; }
.gi-tier { position: absolute; left: 4px; top: 2px; font-size: 11.5px; font-weight: 900; color: var(--muted); }
.gi-lv { position: absolute; right: 3px; bottom: 1px; font-size: 13px; font-weight: 900; color: #fff; text-shadow: 0 1px 2px #000; }
.gear-card { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; padding: 8px; border-radius: 12px; border: 1px solid var(--line-soft); background: var(--panel-2); cursor: pointer; position: relative; }
.gear-card.selected { outline: 2.5px solid var(--gold-2); }
.gc-body { flex: 1; min-width: 0; }
.gc-name { font-weight: 900; font-size: 15px; }
.gc-main { font-size: 15px; display: flex; gap: 8px; }
.gc-main .sl-v { color: var(--gold-2); }
.gc-subs { font-size: 13.5px; color: var(--muted); display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; margin-top: 2px; }
.gc-sub { display: flex; gap: 4px; }
.gc-sub .sl-v { color: var(--ink); }
.gc-r { color: var(--gold); font-size: 10px; }
.gc-owner { position: absolute; right: 8px; top: 6px; font-size: 12px; color: var(--muted); }
.sl-k { color: inherit; }
.gear-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.slot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot { position: relative; min-height: 76px; border-radius: 12px; border: 1.5px dashed rgba(255, 255, 255, 0.2); background: rgba(0, 0, 0, 0.25); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; padding: 6px; color: var(--muted); font-size: 13px; }
.slot.filled { border-style: solid; border-color: var(--line); }
.slot .gear-icon { width: 48px; height: 48px; }

/* ---------------------------------------------------------------- rewards */
.reward-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.reward { position: relative; background: var(--panel-2); border-radius: 12px; padding: 8px 4px 6px; text-align: center; border: 1px solid var(--line-soft); animation: pop 0.35s backwards cubic-bezier(.2, 1.6, .5, 1); }
.reward.rare { border-color: #53b4ff; box-shadow: 0 0 10px rgba(83, 180, 255, 0.35); }
.reward.epic { border-color: #c879ff; box-shadow: 0 0 12px rgba(200, 121, 255, 0.45); }
.reward.legend, .reward.r5, .reward.gr5 { border-color: #ffc94a; box-shadow: 0 0 14px rgba(255, 201, 74, 0.55); }
.reward.r4, .reward.gr4 { border-color: #c879ff; }
.reward .gear-icon { margin: 0 auto; }
.reward .portrait.small { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; object-position: 50% 25%; background: radial-gradient(circle, #4a3a7a, #1a1230); }
.rw-ico .ico { width: 40px; height: 40px; }
.rw-n { font-size: 16px; font-weight: 900; margin-top: 2px; }
.rw-label { font-size: 12.5px; color: var(--muted); line-height: 1.15; margin-top: 2px; }
.rw-stars { font-size: 12px; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } }
.cost { display: inline-flex; align-items: center; gap: 2px; font-weight: 900; margin-right: 6px; }
.cost .ico { width: 20px; height: 20px; }
.cost.short { color: var(--bad); }

/* ---------------------------------------------------------------- modals & toasts */
#modal-root { position: absolute; inset: 0; z-index: 60; pointer-events: none; }
.modal-back { position: absolute; inset: 0; background: rgba(6, 3, 14, 0.66); display: flex; align-items: center; justify-content: center; padding: calc(12px + var(--safe-t)) 12px calc(12px + var(--safe-b)); opacity: 0; transition: opacity 0.18s; pointer-events: auto; backdrop-filter: blur(2px); }
.modal-back.on { opacity: 1; }
.modal { width: 100%; max-width: 520px; max-height: 100%; display: flex; flex-direction: column; background: linear-gradient(180deg, #2a1e52, #160f30); border: 2px solid var(--gold); border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(242, 196, 90, 0.15); transform: scale(0.92); transition: transform 0.22s cubic-bezier(.2, 1.4, .5, 1); }
.modal-back.on .modal { transform: none; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px 16px; border-bottom: 1px solid var(--line-soft); }
.modal-title { font-family: var(--title); font-size: 21px; color: var(--gold-2); margin: 0; flex: 1; letter-spacing: 0.03em; }
.modal-body { padding: 14px 16px; overflow-y: auto; touch-action: pan-y; }
.modal-btns { display: flex; gap: 8px; padding: 10px 14px 14px; }
.modal-btns .btn { flex: 1; }
#toasts { position: absolute; z-index: 70; left: 0; right: 0; top: calc(70px + var(--safe-t)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { background: rgba(20, 12, 40, 0.95); border: 1.5px solid var(--line); padding: 10px 16px; border-radius: 12px; font-size: 15px; font-weight: 800; max-width: 92vw; text-align: center; transform: translateY(-10px); opacity: 0; transition: all 0.25s; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }
.toast.on { transform: none; opacity: 1; }
.toast.good { border-color: var(--good); }
.toast.bad { border-color: var(--bad); }

/* ---------------------------------------------------------------- boot / fade */
#fade { position: absolute; inset: 0; z-index: 90; background: #000; opacity: 0; pointer-events: none; transition: opacity 0.35s; }
#fade.on { opacity: 1; }
#boot { position: absolute; inset: 0; z-index: 95; background: radial-gradient(circle at 50% 40%, #3a2470, #0e0a1c 70%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; transition: opacity 0.5s; }
#boot.gone { opacity: 0; pointer-events: none; }
.boot-logo { font-family: var(--title); font-weight: 900; font-size: clamp(36px, 11vw, 72px); letter-spacing: 0.08em; background: linear-gradient(180deg, #fff6d0, #f2c45a 55%, #a8741c); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.7)); }
.boot-bar { width: min(70vw, 320px); height: 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
#boot-fill { height: 100%; width: 0; background: linear-gradient(90deg, #c8a0ff, #ffe08a); transition: width 0.2s; }
.boot-text { color: var(--muted); font-size: 15px; }

/* ---------------------------------------------------------------- title */
.title-screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: calc(50px + var(--safe-t)) 16px calc(28px + var(--safe-b)); pointer-events: none; }
.title-screen > * { pointer-events: auto; }
.logo { text-align: center; }
.logo-main { font-family: var(--title); font-weight: 900; font-size: clamp(44px, 14vw, 96px); letter-spacing: 0.06em; line-height: 1; background: linear-gradient(180deg, #fffbe8, #ffd978 50%, #b8801c); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 0 #3a1e70) drop-shadow(0 8px 18px rgba(0, 0, 0, 0.6)); }
.logo-sub { font-family: var(--title); font-size: clamp(15px, 4.2vw, 22px); color: #f0e6ff; letter-spacing: 0.22em; margin-top: 8px; text-shadow: 0 2px 6px #000; }
.title-btns { display: flex; flex-direction: column; gap: 10px; width: min(88vw, 340px); }
.title-btns .btn { min-height: 56px; font-size: 18px; }
.title-foot { font-size: 13px; color: rgba(255, 255, 255, 0.9); text-align: center; text-shadow: 0 1px 3px #000; margin-top: 10px; background: rgba(10, 6, 24, 0.55); border-radius: 12px; padding: 6px 10px; }

/* ---------------------------------------------------------------- 3D labels */
.blabel { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; pointer-events: auto; cursor: pointer; }
.blabel-name { background: linear-gradient(180deg, rgba(40, 26, 76, 0.94), rgba(20, 12, 40, 0.94)); border: 1.5px solid var(--line); color: #fff; font-weight: 900; font-size: 14px; padding: 5px 12px; border-radius: 14px; white-space: nowrap; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); display: flex; align-items: center; gap: 6px; }
.blabel-name .ico { width: 20px; height: 20px; }
.blabel-sub { margin-top: 3px; font-size: 12.5px; font-weight: 900; color: var(--gold-2); background: rgba(0, 0, 0, 0.6); padding: 2px 8px; border-radius: 8px; white-space: nowrap; }
.blabel-sub.ready { color: #fff; background: linear-gradient(180deg, #4ac06a, #1a7a3a); animation: bob 1.2s ease-in-out infinite; }
.blabel .badge { position: static; margin-left: 2px; box-shadow: none; }
.blabel::after { content: ''; width: 2px; height: 10px; background: linear-gradient(var(--gold), transparent); }
@keyframes bob { 50% { transform: translateY(-3px); } }

/* ---------------------------------------------------------------- citadel HUD */
.citadel-hud { position: absolute; left: 0; right: 0; top: calc(var(--top-h) + var(--safe-t) + 4px); bottom: calc(var(--tab-h) + var(--safe-b)); pointer-events: none; }
.citadel-hud > * { pointer-events: auto; }
.main-quest { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; align-items: center; gap: 10px; background: linear-gradient(180deg, rgba(40, 26, 76, 0.95), rgba(20, 12, 40, 0.95)); border: 1.5px solid var(--line); border-radius: 14px; padding: 8px 10px; max-width: 560px; margin: 0 auto; cursor: pointer; }
.mq-ico { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 10px; background: rgba(242, 196, 90, 0.15); color: var(--gold); }
.mq-text { flex: 1; min-width: 0; }
.mq-kicker { font-size: 12.5px; color: var(--gold); font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.mq-title { font-size: 15px; font-weight: 800; }
.side-btns { position: absolute; right: 8px; top: 4px; display: flex; flex-direction: column; gap: 8px; }
.side-btns.left { right: auto; left: 8px; }
.side-btn { width: 58px; min-height: 56px; border-radius: 14px; border: 1.5px solid var(--line); background: rgba(20, 12, 40, 0.88); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; font-weight: 900; gap: 1px; cursor: pointer; position: relative; padding: 4px 0; }
.side-btn .ico { width: 28px; height: 28px; }
.side-btn .badge { top: -6px; right: -6px; }
.buff-row { position: absolute; left: 8px; top: 4px; display: flex; flex-direction: column; gap: 4px; }
.buff-chip { font-size: 12.5px; background: rgba(20, 12, 40, 0.88); border: 1px solid var(--line-soft); border-radius: 10px; padding: 3px 8px; display: flex; align-items: center; gap: 4px; }

/* ---------------------------------------------------------------- battle HUD */
.battle-hud { position: absolute; inset: 0; pointer-events: none; }
.battle-hud > * { pointer-events: auto; }
.bh-top { position: absolute; top: calc(6px + var(--safe-t)); left: 8px; right: 8px; display: flex; align-items: center; gap: 6px; }
.bh-wave { font-family: var(--title); font-size: 17px; font-weight: 900; padding: 6px 12px; border-radius: 12px; background: rgba(10, 6, 24, 0.75); border: 1.5px solid var(--line); white-space: nowrap; }
.bh-turnbar { flex: 1; min-width: 0; height: 40px; position: relative; background: rgba(10, 6, 24, 0.6); border-radius: 20px; border: 1px solid var(--line-soft); overflow: hidden; }
.bh-turnbar .tb-unit { position: absolute; top: 3px; width: 34px; height: 34px; border-radius: 50%; overflow: hidden; border: 2px solid #fff; background: #2a2050; transform: translateX(-50%); transition: left 0.25s linear; }
.bh-turnbar .tb-unit.E { border-color: #ff5a6a; }
.bh-turnbar .tb-unit.A { border-color: #6ae0ff; }
.bh-turnbar .tb-unit img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; }
.bh-btns { display: flex; gap: 6px; }
.bh-btn { width: 46px; height: 46px; border-radius: 12px; border: 1.5px solid var(--line-soft); background: rgba(10, 6, 24, 0.75); display: grid; place-items: center; cursor: pointer; font-weight: 900; font-size: 14px; position: relative; }
.bh-btn .ico { width: 24px; height: 24px; }
.bh-btn.on { border-color: var(--gold); color: var(--gold-2); box-shadow: 0 0 10px rgba(242, 196, 90, 0.4); }
.bh-btn .lbl { position: absolute; bottom: 1px; font-size: 11px; }
.bh-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 8px calc(8px + var(--safe-b)); display: flex; align-items: flex-end; gap: 8px; background: linear-gradient(0deg, rgba(10, 6, 24, 0.85), rgba(10, 6, 24, 0)); }
.bh-spells { display: flex; gap: 8px; }
.spell-btn { width: 62px; height: 62px; border-radius: 50%; border: 2px solid var(--line); background: radial-gradient(circle at 50% 35%, #4a3a8a, #1a1030); position: relative; cursor: pointer; display: grid; place-items: center; font-size: 12px; font-weight: 900; text-align: center; line-height: 1.05; padding: 4px; overflow: hidden; color: #fff; text-shadow: 0 1px 2px #000; }
.spell-btn .sp-fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--sp, #7cf0e0); opacity: 0.35; transition: height 0.3s; }
.spell-btn.ready { border-color: var(--sp); box-shadow: 0 0 14px var(--sp); animation: pulse 1.2s ease-in-out infinite; }
.spell-btn span { position: relative; }
.spell-btn .sp-cost { position: absolute; bottom: 4px; font-size: 11.5px; color: var(--gold-2); }
@keyframes pulse { 50% { transform: scale(1.06); } }
.mana-bar { position: absolute; left: 8px; bottom: calc(76px + var(--safe-b)); width: 136px; }
.mana-bar .bar-fill { background: linear-gradient(180deg, #8af0ff, #3a7ae0); }
.bh-skills { margin-left: auto; display: flex; gap: 8px; align-items: flex-end; }
.skill-btn { width: 72px; height: 72px; border-radius: 16px; border: 2px solid var(--line); background: linear-gradient(180deg, #3a2a70, #1a1236); position: relative; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px; color: #fff; font-size: 12.5px; font-weight: 900; text-align: center; line-height: 1.05; }
.skill-btn .sk-kind { font-size: 11px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.skill-btn.ult { border-color: #ffc94a; background: linear-gradient(180deg, #6a3a90, #2a1240); }
.skill-btn.sel { outline: 3px solid var(--gold-2); transform: translateY(-4px); }
.skill-btn:disabled { filter: grayscale(0.8) brightness(0.55); }
.skill-btn .sk-cd { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; background: rgba(0, 0, 0, 0.55); border-radius: 14px; }
.turn-banner { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); font-family: var(--title); font-size: clamp(22px, 6vw, 36px); font-weight: 900; color: #fff; text-shadow: 0 3px 0 #3a1e70, 0 0 20px rgba(0, 0, 0, 0.8); pointer-events: none; white-space: nowrap; animation: banner 1.3s ease-out forwards; }
.turn-banner.ult { color: var(--gold-2); }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, 10px) scale(0.8); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -10px); } }
.manual-hint { position: absolute; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%); background: rgba(10, 6, 24, 0.85); border: 1.5px solid var(--gold); padding: 6px 14px; border-radius: 12px; font-size: 14.5px; pointer-events: none; white-space: nowrap; }

/* unit plates over 3D */
.uplate { position: absolute; transform: translate(-50%, -100%); width: 86px; pointer-events: auto; }
.uplate.boss { width: 120px; }
.up-name { position: relative; left: 50%; transform: translateX(-50%); width: max-content; max-width: 140px; font-size: 12.5px; line-height: 1.15; font-weight: 900; text-align: center; text-wrap: balance; overflow-wrap: anywhere; text-shadow: 0 1px 2px #000, 0 0 3px #000; margin-bottom: 1px; }
.uplate.boss .up-name { max-width: 190px; font-size: 13.5px; }
.up-name .ico { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; margin-right: 2px; }
.up-hp { position: relative; height: 10px; border-radius: 5px; background: rgba(0, 0, 0, 0.65); overflow: hidden; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6); }
.up-hp .lag { position: absolute; inset: 0 auto 0 0; background: #fff; transition: width 0.6s 0.2s; }
.up-hp .fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(180deg, #8af08a, #2a9a3a); transition: width 0.15s; }
.uplate.E .up-hp .fill { background: linear-gradient(180deg, #ff8a8a, #c82a3a); }
.up-hp .shield { position: absolute; inset: 0 auto 0 0; background: rgba(160, 230, 255, 0.85); }
.up-atb { height: 4px; margin-top: 1px; border-radius: 2px; background: rgba(0, 0, 0, 0.6); overflow: hidden; }
.up-atb .fill { height: 100%; background: #7cf0ff; }
.up-st { display: flex; flex-wrap: wrap; justify-content: center; gap: 1px; margin-top: 2px; min-height: 16px; }
.st-ico { min-width: 16px; height: 16px; padding: 0 3px; border-radius: 4px; font-size: 10.5px; line-height: 16px; letter-spacing: -0.02em; text-align: center; font-weight: 900; color: #fff; background: var(--c); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6); }
.st-ico.debuff { box-shadow: 0 0 0 1px #000, inset 0 -6px 0 rgba(0, 0, 0, 0.25); }
.uplate.turn .up-name { color: var(--gold-2); }
.uplate.target { filter: drop-shadow(0 0 6px #ff4a5a); }
.uplate.targetable::before { content: '▼'; position: absolute; left: 50%; top: -22px; transform: translateX(-50%); color: #ff4a5a; font-size: 20px; text-shadow: 0 0 6px #000; animation: bob 0.8s ease-in-out infinite; }
.dmg { position: absolute; transform: translate(-50%, -50%); font-weight: 900; font-size: 22px; color: #fff; text-shadow: 0 2px 0 #000, 0 0 4px #000, 1px 1px 0 #000, -1px -1px 0 #000; pointer-events: none; white-space: nowrap; animation: dmg 1s ease-out forwards; }
.dmg.crit { font-size: 30px; color: #ffd24a; }
.dmg.crit::before { content: 'CRIT '; font-size: 15px; }
.dmg.heal { color: #8af08a; }
.dmg.adv { color: #ffb08a; }
.dmg.dis { color: #b0b8c8; font-size: 18px; }
.dmg.glance::after { content: ' glance'; font-size: 12px; }
.dmg.dot { font-size: 17px; color: #ff9a5a; }
.dmg.txt { font-size: 15px; color: var(--gold-2); }
.dmg.txt.bad { color: #ff8a9a; }
.dmg.txt.good { color: #8af0c0; }
@keyframes dmg { 0% { opacity: 0; transform: translate(-50%, -20%) scale(0.6); } 12% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 30% { transform: translate(-50%, -80%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -190%); } }

/* results */
.result { text-align: center; }
.result-title { font-family: var(--title); font-size: 40px; font-weight: 900; letter-spacing: 0.08em; margin: 6px 0; }
.result-title.win { background: linear-gradient(180deg, #fff6d0, #f2c45a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result-title.lose { color: #c8a0b0; }
.result-stars { font-size: 44px; letter-spacing: 6px; }
.result-stars .star { display: inline-block; animation: pop 0.5s backwards; }
.result-stars .star:nth-child(2) { animation-delay: 0.25s; }
.result-stars .star:nth-child(3) { animation-delay: 0.5s; }
.mvp { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.mvp .hero-card { width: 72px; }
.xp-gain { font-size: 13px; color: var(--good); }

/* ---------------------------------------------------------------- team select */
.team-slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.team-slot { aspect-ratio: 3 / 4; border-radius: 12px; border: 1.5px dashed rgba(255, 255, 255, 0.25); display: grid; place-items: center; color: var(--dim); font-size: 13px; position: relative; }
.team-slot .hero-card { position: absolute; inset: 0; aspect-ratio: auto; }
.team-slot.leader::after { content: 'LEADER'; position: absolute; bottom: -18px; font-size: 11px; color: var(--gold); font-weight: 900; }
.matchup { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 14px; }

/* ---------------------------------------------------------------- hero detail */
.hd-top { position: absolute; left: 0; right: 0; top: calc(var(--top-h) + var(--safe-t)); display: flex; align-items: flex-start; justify-content: space-between; padding: 6px 10px; pointer-events: none; }
.hd-top > * { pointer-events: auto; }
.hd-title { text-align: center; flex: 1; text-shadow: 0 2px 6px #000; }
.hd-name { font-family: var(--title); font-size: 22px; font-weight: 900; line-height: 1.1; }
.hd-epithet { font-size: 14px; color: var(--muted); }
.hd-title .chips { gap: 4px; }
.hd-title .chip, .hd-title .el-badge, .hd-title .cls-badge { font-size: 13px; padding: 2px 8px 2px 4px; }
.hd-sheet { position: absolute; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b)); height: 48%; display: flex; flex-direction: column; background: linear-gradient(180deg, rgba(18, 12, 36, 0.94), rgba(12, 8, 26, 0.98)); border-top: 1.5px solid var(--line); border-radius: 18px 18px 0 0; }
.tabs { display: flex; gap: 4px; padding: 8px 8px 0; overflow-x: auto; flex: none; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs .tbtn { flex: 1 0 auto; min-height: 42px; padding: 6px 12px; border-radius: 10px 10px 0 0; border: 0; background: rgba(255, 255, 255, 0.06); color: var(--muted); font-weight: 900; font-size: 15px; cursor: pointer; }
.tabs .tbtn.on { background: var(--panel-3); color: var(--gold-2); }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.stat-row { display: flex; justify-content: space-between; font-size: 15px; padding: 4px 0; border-bottom: 1px solid var(--line-soft); }
.stat-row .k { color: var(--muted); }
.stat-row .v b { color: var(--good); font-size: 13px; margin-left: 4px; }
.skill-card { display: flex; gap: 10px; padding: 10px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-soft); }
.skill-card + .skill-card { margin-top: 8px; }
.sk-badge { flex: none; width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; font-size: 11px; font-weight: 900; text-align: center; background: linear-gradient(180deg, #4a3a8a, #241a48); border: 1.5px solid var(--line-soft); line-height: 1.1; }
.sk-badge.ult { border-color: #ffc94a; color: var(--gold-2); }
.sk-badge.passive { border-color: #7be08a; color: #b8f0c0; }
.sk-badge.leader { border-color: #ff8ad8; color: #ffc8ec; }
.sk-name { font-weight: 900; font-size: 16px; }
.sk-meta { font-size: 13px; color: var(--gold); }
.sk-desc { font-size: 14px; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.trait-chip { display: inline-flex; flex-direction: column; padding: 6px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-soft); }
.trait-chip b { font-size: 15px; }
.trait-chip span { font-size: 13px; color: var(--muted); }
.grade { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-weight: 900; font-size: 16px; }
.grade.S { background: linear-gradient(180deg, #ffe08a, #d8981c); color: #3a2204; }
.grade.A { background: linear-gradient(180deg, #d8a8ff, #7a3ad0); }
.grade.B { background: linear-gradient(180deg, #8ad0ff, #2a6ac8); }
.grade.C { background: linear-gradient(180deg, #b8c0c8, #5a6470); }

/* ---------------------------------------------------------------- summon */
.summon-ui { position: absolute; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b)); padding: 10px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.summon-ui > * { pointer-events: auto; }
.sigil-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; touch-action: pan-x; }
.sigil-tabs::-webkit-scrollbar { display: none; }
.sigil-tab { flex: none; width: 80px; border-radius: 12px; border: 1.5px solid var(--line-soft); background: rgba(14, 8, 30, 0.88); padding: 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; font-size: 12.5px; font-weight: 900; position: relative; }
.sigil-tab .ico { width: 32px; height: 32px; }
.sigil-tab.on { border-color: var(--gold); box-shadow: 0 0 12px rgba(242, 196, 90, 0.4); }
.sigil-tab .cnt { font-size: 14px; color: var(--gold-2); }
.summon-info { background: rgba(14, 8, 30, 0.9); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.summon-info h3 { margin: 0; font-family: var(--title); font-size: 19px; }
.odds { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13.5px; margin-top: 4px; }
.pity { margin-top: 6px; }
.featured { position: absolute; top: calc(var(--top-h) + var(--safe-t) + 6px); left: 10px; right: 10px; display: flex; justify-content: center; pointer-events: none; }
.featured-card { pointer-events: auto; background: linear-gradient(90deg, rgba(60, 30, 100, 0.92), rgba(30, 14, 60, 0.92)); border: 1.5px solid var(--gold); border-radius: 14px; padding: 6px 14px; text-align: center; font-size: 14px; }
.featured-card b { color: var(--gold-2); }
.reveal { position: absolute; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 16px 16px calc(var(--tab-h) + 16px + var(--safe-b)); pointer-events: auto; }
.reveal-card { text-align: center; text-shadow: 0 2px 6px #000; animation: pop 0.45s cubic-bezier(.2, 1.4, .5, 1); width: 100%; max-width: 480px; }
.reveal-stars { font-size: 34px; letter-spacing: 2px; }
.reveal-name { font-family: var(--title); font-size: 30px; font-weight: 900; }
.reveal-sub { font-size: 15px; color: var(--muted); margin: 2px 0 8px; }
.reveal-radiant { font-family: var(--title); color: #ff8ad8; font-size: 18px; animation: pulse 1s infinite; }
.reveal-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; width: 100%; max-width: 560px; margin-bottom: 10px; }
.reveal-grid .hero-card { animation: pop 0.4s backwards; }
.skip-btn { position: absolute; top: calc(10px + var(--safe-t)); right: 10px; z-index: 45; }

/* ---------------------------------------------------------------- adventure */
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.mode-tile { position: relative; min-height: 110px; border-radius: 16px; border: 1.5px solid var(--line); padding: 12px; text-align: left; cursor: pointer; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; background: var(--tile, linear-gradient(160deg, #4a3a8a, #1a1236)); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4); }
.mode-tile .mt-ico { position: absolute; right: 8px; top: 8px; opacity: 0.9; }
.mode-tile .mt-ico .ico { width: 40px; height: 40px; }
.mode-tile .mt-name { font-family: var(--title); font-size: 18px; font-weight: 900; text-shadow: 0 2px 4px #000; }
.mode-tile .mt-sub { font-size: 13.5px; color: #e8e0ff; text-shadow: 0 1px 3px #000; }
.mode-tile.locked { filter: grayscale(0.9) brightness(0.6); }
.region-card { border-radius: 16px; overflow: hidden; border: 1.5px solid var(--line); margin-bottom: 12px; background: var(--panel-2); }
.region-head { padding: 12px; background: var(--rbg); position: relative; }
.region-head h3 { margin: 0; font-family: var(--title); font-size: 20px; text-shadow: 0 2px 4px #000; }
.region-head p { margin: 2px 0 0; font-size: 13.5px; text-shadow: 0 1px 3px #000; }
.stage-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 10px; }
.stage-btn { min-height: 64px; border-radius: 12px; border: 1.5px solid var(--line-soft); background: rgba(0, 0, 0, 0.3); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-weight: 900; font-size: 15px; }
.stage-btn .ss { font-size: 12px; letter-spacing: -1px; }
.stage-btn.boss { border-color: #ff6a6a; background: rgba(120, 20, 40, 0.35); }
.stage-btn.next { border-color: var(--gold); box-shadow: 0 0 12px rgba(242, 196, 90, 0.45); }
.stage-btn:disabled { opacity: 0.4; }

/* ---------------------------------------------------------------- quests */
.quest { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-soft); }
.quest + .quest { margin-top: 8px; }
.quest.done { border-color: var(--good); }
.quest.claimed { opacity: 0.5; }
.quest .q-body { flex: 1; min-width: 0; }
.quest .q-text { font-size: 15px; font-weight: 800; }
.quest .bar { margin-top: 4px; }
.chest-row { display: flex; gap: 8px; justify-content: space-around; margin: 8px 0 12px; }
.chest-btn { width: 76px; border-radius: 12px; border: 1.5px solid var(--line-soft); background: rgba(0, 0, 0, 0.3); padding: 6px; display: flex; flex-direction: column; align-items: center; cursor: pointer; font-size: 13px; font-weight: 900; }
.chest-btn .ico { width: 36px; height: 36px; }
.chest-btn.ready { border-color: var(--gold); box-shadow: 0 0 12px rgba(242, 196, 90, 0.5); animation: bob 1s infinite; }
.chest-btn.got { opacity: 0.45; }

/* ---------------------------------------------------------------- creator */
.creator { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; pointer-events: none; }
.creator > * { pointer-events: auto; }
.creator-panel { height: 50%; display: flex; flex-direction: column; background: linear-gradient(180deg, rgba(18, 12, 36, 0.95), rgba(12, 8, 26, 0.99)); border-top: 1.5px solid var(--line); border-radius: 18px 18px 0 0; padding-bottom: var(--safe-b); }
.creator-top { position: absolute; top: calc(8px + var(--safe-t)); left: 8px; right: 8px; display: flex; gap: 8px; align-items: center; }
.opt-group { margin-bottom: 12px; }
.opt-label { font-size: 14px; color: var(--muted); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.opt-label .lock-btn { margin-left: auto; }
.opt-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; touch-action: pan-x; }
.opt { flex: none; min-height: 40px; min-width: 44px; padding: 6px 12px; border-radius: 10px; border: 1.5px solid var(--line-soft); background: rgba(255, 255, 255, 0.06); cursor: pointer; font-size: 14px; font-weight: 800; color: var(--ink); }
.opt.on { border-color: var(--gold); background: rgba(242, 196, 90, 0.18); color: var(--gold-2); }
.swatch { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); cursor: pointer; padding: 0; }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 3px var(--gold); }
.swatch.custom { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); position: relative; overflow: hidden; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.range { width: 100%; accent-color: var(--gold); height: 28px; }
.name-input { flex: 1; min-width: 0; min-height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: rgba(10, 6, 24, 0.85); color: var(--ink); font: inherit; font-size: 17px; font-weight: 900; padding: 0 12px; }

/* ---------------------------------------------------------------- mine / farm / misc HUDs */
.scene-hud { position: absolute; left: 0; right: 0; top: calc(var(--top-h) + var(--safe-t)); bottom: calc(var(--tab-h) + var(--safe-b)); pointer-events: none; }
.scene-hud > * { pointer-events: auto; }
.hud-head { position: absolute; top: 4px; left: 8px; right: 8px; display: flex; align-items: center; gap: 8px; }
.hud-title { font-family: var(--title); font-size: 21px; font-weight: 900; text-shadow: 0 2px 6px #000; color: var(--gold-2); }
.hud-card { background: rgba(14, 8, 30, 0.9); border: 1.5px solid var(--line); border-radius: 14px; padding: 8px 10px; }
.hud-bottom { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; flex-direction: column; gap: 8px; }
.loot-pop { position: absolute; transform: translate(-50%, -50%); pointer-events: none; font-weight: 900; font-size: 15px; display: flex; align-items: center; gap: 3px; text-shadow: 0 1px 2px #000, 0 0 4px #000; animation: dmg 1.2s ease-out forwards; white-space: nowrap; }
.loot-pop .ico { width: 22px; height: 22px; }
.plot-label { position: absolute; transform: translate(-50%, -100%); pointer-events: none; text-align: center; }
.plot-label .pl-t { font-size: 12.5px; font-weight: 900; background: rgba(0, 0, 0, 0.65); padding: 2px 7px; border-radius: 8px; white-space: nowrap; }
.plot-label .pl-t.ready { background: linear-gradient(180deg, #4ac06a, #1a7a3a); }
.plot-label .pl-t.golden { background: linear-gradient(180deg, #ffd978, #c88a1a); color: #3a2204; }
.plot-label .pl-w { font-size: 12px; margin-top: 2px; }

.wheel-wrap { position: relative; width: min(78vw, 340px); aspect-ratio: 1; margin: 0 auto; }
.wheel-wrap canvas { width: 100%; height: 100%; transition: transform 4.2s cubic-bezier(.12, .8, .2, 1); }
.wheel-ptr { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 28px solid var(--gold); filter: drop-shadow(0 2px 3px #000); z-index: 2; }

.talent { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-soft); }
.talent + .talent { margin-top: 8px; }
.talent .t-ico { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: rgba(242, 196, 90, 0.12); }
.talent .t-ico .ico { width: 28px; height: 28px; }
.pips { display: flex; gap: 3px; margin-top: 4px; }
.pip { width: 12px; height: 8px; border-radius: 2px; background: rgba(255, 255, 255, 0.15); }
.pip.on { background: var(--gold); box-shadow: 0 0 4px var(--gold); }

.empty { text-align: center; color: var(--muted); padding: 24px 12px; }
.sep { height: 1px; background: var(--line-soft); margin: 12px 0; }
.notice { padding: 10px 12px; border-radius: 12px; background: rgba(242, 196, 90, 0.1); border: 1px solid var(--line); font-size: 14.5px; }
.notice.good { background: rgba(123, 224, 138, 0.12); border-color: rgba(123, 224, 138, 0.5); }
.timer { font-variant-numeric: tabular-nums; }
select.sel { min-height: 40px; border-radius: 10px; background: rgba(255, 255, 255, 0.08); color: var(--ink); border: 1.5px solid var(--line-soft); font: inherit; font-size: 14px; padding: 0 8px; }
select.sel option { background: #1a1230; }
textarea.save-box { width: 100%; height: 110px; border-radius: 10px; background: rgba(0, 0, 0, 0.4); color: var(--ink); border: 1px solid var(--line-soft); font: 12px/1.3 monospace; padding: 8px; }

@media (min-width: 900px) {
    .sheet:not(.full) { left: 50%; transform: translateX(-50%); width: 820px; border-left: 1.5px solid var(--line); border-right: 1.5px solid var(--line); }
    .hd-sheet { left: 50%; transform: translateX(-50%); width: 760px; border-left: 1.5px solid var(--line); border-right: 1.5px solid var(--line); }
    .creator-panel { width: 760px; margin: 0 auto; border-left: 1.5px solid var(--line); border-right: 1.5px solid var(--line); }
    .creator-top { left: 50%; right: auto; width: 760px; transform: translateX(-50%); }
    .summon-ui { left: 50%; transform: translateX(-50%); width: 640px; }
}
@media (max-width: 480px) {
    .blabel-name { font-size: 12.5px; padding: 4px 9px; }
    .blabel-name .ico { width: 17px; height: 17px; }
    .blabel-sub:not(.ready) { display: none; }
    .tb-ol-text .tb-name { display: none; }
    .tb-ol { padding-right: 10px; }
    .tb-xp { left: 44px; right: 8px; }
    .res-chip { padding: 3px 8px 3px 5px; font-size: 14px; gap: 3px; }
    .res-chip .ico { width: 20px; height: 20px; }
    .res-chip small { display: none; }
}
@media (max-width: 380px) {
    html, body { font-size: 15px; }
    .res-chip { padding: 3px 7px 3px 4px; font-size: 14px; }
    .res-chip .ico { width: 19px; height: 19px; }
    .tb-name { display: none; }
    .skill-btn { width: 64px; height: 64px; }
    .spell-btn { width: 54px; height: 54px; }
}
@media (orientation: landscape) and (max-height: 500px) {
    :root { --tab-h: 54px; --top-h: 50px; }
    .tab .tab-label { font-size: 12px; }
    .hd-sheet, .creator-panel { height: 58%; }
    .tab.big .tab-ico { width: 46px; height: 46px; margin-top: -14px; }
}
