@font-face { font-family: 'Cinzel'; src: url(../fonts/cinzel-var.woff2) format('woff2'); font-weight: 400 900; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url(../fonts/alegreya-sans-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url(../fonts/alegreya-sans-500.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url(../fonts/alegreya-sans-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --bg: #0e0908; --bg2: #160e0c; --panel: #1c1310; --panel2: #251814; --panel3: #2f1f19;
  --line: rgba(255, 196, 120, 0.14); --line2: rgba(255, 196, 120, 0.28);
  --gold: #ffd166; --gold2: #f0a93b; --gold3: #b8741c; --ember: #ff6a2a; --ember2: #ff9a3c;
  --text: #f4e7d2; --muted: #b8a287; --dim: #7d6a57; --good: #8fe07e; --bad: #ff6b5b; --soul: #c99bff; --sky: #7fd4ff;
  --r: 10px; --shadow: 0 10px 30px rgba(0,0,0,.45);
  --display: 'Cinzel', Georgia, 'Times New Roman', serif;
  --body: 'Alegreya Sans', 'Segoe UI', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 16px/1.35 var(--body); overflow: hidden; }
body { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
b { color: var(--gold); font-weight: 700; }
[hidden] { display: none !important; }
.m-only { display: none; }

#app { height: 100%; display: grid; grid-template-rows: auto 1fr; }

/* ---------- header ---------- */
#top {
  display: flex; align-items: center; gap: 18px; padding: 8px 16px; min-height: 66px;
  background: linear-gradient(#1f1411, #140d0b); border-bottom: 1px solid var(--line2);
  box-shadow: 0 4px 18px rgba(0,0,0,.5); position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font: 800 22px var(--display); letter-spacing: .06em; color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 140, 40, .45); white-space: nowrap; }
.brand img { width: 40px; height: 40px; border-radius: 9px; box-shadow: 0 0 0 1px var(--line2), 0 0 16px rgba(255,120,30,.35); }
.goldbox { min-width: 0; }
.gold-line { display: flex; align-items: center; gap: 8px; font: 700 28px/1.05 var(--display); color: #ffe39a; text-shadow: 0 2px 0 #4a2a06, 0 0 22px rgba(255,190,70,.35); white-space: nowrap; }
.coin-ico { width: 22px; height: 22px; border-radius: 50%; flex: none; background: radial-gradient(circle at 35% 35%, #fff3b5, #ffcc33 40%, #a8650a 100%); box-shadow: 0 0 0 2px #7a4a06 inset, 0 0 10px rgba(255,200,60,.5); }
.gps-line { color: var(--muted); font-size: 14px; margin-left: 30px; white-space: nowrap; }
#gps { color: var(--text); font-weight: 700; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: rgba(255,200,120,.07); border: 1px solid var(--line); font-size: 13.5px; color: var(--muted); white-space: nowrap; cursor: default; }
.chip strong { color: var(--text); font-weight: 700; }
.chip.soul strong { color: var(--soul); }
.chip.hoard strong { color: var(--gold); }
.topnav { display: flex; gap: 6px; margin-left: auto; }
.nav-btn { position: relative; display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--text); font-weight: 500; }
.nav-btn:hover { background: rgba(255,200,120,.1); border-color: var(--line2); }
.nav-btn.icon-only { padding: 8px 9px; }
.nav-btn .badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--soul); color: #1b0b2a; font: 700 12px/20px var(--body); text-align: center; box-shadow: 0 0 12px rgba(201,155,255,.7); }
.ni { width: 18px; height: 18px; display: inline-block; background: currentColor; -webkit-mask: var(--m) center/contain no-repeat; mask: var(--m) center/contain no-repeat; color: var(--gold); }

/* ---------- main grid ---------- */
#main { display: grid; grid-template-columns: 320px minmax(0, 1fr) 410px; min-height: 0; }
.panel { background: linear-gradient(180deg, var(--panel), var(--bg2)); min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: #4a3426 transparent; }
#left { border-right: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
#right { border-left: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
#stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #0b0706; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- cards ---------- */
.card { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; box-shadow: 0 1px 0 rgba(255,255,255,.03) inset; }
.card h3 { margin: 0 0 8px; font: 700 13px var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--gold2); display: flex; align-items: center; gap: 8px; }
.card h3 .sub { margin-left: auto; font: 500 13px var(--body); letter-spacing: 0; text-transform: none; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.tiny { font-size: 12px; }

.stage-card .stage-name { font: 800 22px var(--display); color: var(--text); letter-spacing: .03em; }
.stage-card .stage-desc { color: var(--muted); font-size: 14px; margin: 4px 0 10px; }
.pips { display: flex; gap: 5px; margin: 6px 0 2px; }
.pip { flex: 1; height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); }
.pip.on { background: linear-gradient(90deg, var(--gold2), var(--gold)); box-shadow: 0 0 8px rgba(255,190,70,.5); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; border-radius: 9px; border: 1px solid #7a4d17;
  background: linear-gradient(180deg, #f6c35c, #d18a23 55%, #b06a14); color: #2a1503; font-weight: 700; text-shadow: 0 1px 0 rgba(255,240,200,.5);
  box-shadow: 0 2px 0 #5a3408, 0 0 0 1px rgba(255,240,200,.25) inset; transition: transform .06s, filter .15s; }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 #5a3408; }
.btn:disabled, .btn.off { background: linear-gradient(180deg, #3a2a20, #2a1d16); color: #8c7a66; border-color: #3e2c20; text-shadow: none; box-shadow: none; cursor: not-allowed; }
.btn.ghost { background: rgba(255,255,255,.04); color: var(--text); border-color: var(--line2); text-shadow: none; box-shadow: none; font-weight: 500; }
.btn.ghost:hover { background: rgba(255,200,120,.1); }
.btn.danger { background: linear-gradient(180deg, #ff7d6b, #c7372a); border-color: #6b1a12; color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.3); box-shadow: 0 2px 0 #4a120c; }
.btn.soul { background: linear-gradient(180deg, #e2c4ff, #9b62e8 55%, #7440c0); border-color: #3e1f6b; color: #1a0830; box-shadow: 0 2px 0 #2c1450, 0 0 18px rgba(170,110,255,.35); }
.btn.wide { width: 100%; }
.btn.big { padding: 12px 18px; font-size: 17px; }
.btn .cost { font-weight: 700; }

/* molt */
.molt { position: relative; overflow: hidden; }
.molt .bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.08); margin: 8px 0 10px; overflow: hidden; }
.molt .bar > i { display: block; height: 100%; background: linear-gradient(90deg, #b8741c, #ffd166); border-radius: 4px; transition: width .2s; }
.molt.ready { border-color: rgba(255, 209, 102, .6); box-shadow: 0 0 22px rgba(255, 170, 60, .2); }
.molt.ready .btn { animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 2px 0 #5a3408, 0 0 22px rgba(255,200,80,.7); } }

/* fury & powers */
.fury-bar { position: relative; height: 18px; border-radius: 9px; background: #120a09; border: 1px solid var(--line2); overflow: hidden; }
.fury-bar > i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #8a1d0e, #ff4d1f 60%, #ffb347); box-shadow: 0 0 14px rgba(255,90,30,.6); transition: width .12s linear; }
.fury-bar > span { position: absolute; inset: 0; text-align: center; font: 700 12px/16px var(--body); color: #fff; text-shadow: 0 1px 2px #000; }
.fury-bar.heat > i { background: linear-gradient(90deg, #7a2a00, #ff9a3c, #fff0a0); }
.powers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.power { position: relative; aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--line2); background: radial-gradient(circle at 50% 35%, #3a2218, #1a100d); display: grid; place-items: center; overflow: hidden; padding: 0; }
.power svg { width: 58%; height: 58%; fill: var(--ember2); filter: drop-shadow(0 0 6px rgba(255,120,40,.6)); position: relative; z-index: 1; }
.power .key { position: absolute; top: 4px; left: 6px; font: 700 11px var(--body); color: var(--muted); z-index: 2; }
.power .cdmask { position: absolute; inset: 0; background: conic-gradient(rgba(10,5,4,.82) var(--p, 0%), transparent 0); z-index: 2; }
.power .cdtxt { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font: 700 12px var(--body); z-index: 3; color: #fff; text-shadow: 0 1px 2px #000; }
.power.ready { border-color: rgba(255,170,70,.75); box-shadow: 0 0 16px rgba(255,120,40,.35), 0 0 0 1px rgba(255,200,120,.2) inset; }
.power.ready:hover { filter: brightness(1.15); }
.power.active { border-color: var(--gold); box-shadow: 0 0 20px rgba(255,210,100,.6); animation: pulse 0.8s ease-in-out infinite; }
.power.locked { opacity: .35; filter: grayscale(1); cursor: not-allowed; }
.power.poor svg { fill: #7a5a48; filter: none; }
@keyframes pulse { 50% { transform: scale(1.04); } }

.buffs { display: flex; flex-direction: column; gap: 6px; }
.buff { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 6px 9px; border-radius: 8px; background: rgba(255,200,120,.06); border: 1px solid var(--line); font-size: 14px; }
.buff .bt { font-weight: 700; color: var(--gold); }
.buff .bx { color: var(--text); font-weight: 700; }
.buff .bbar { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.08); overflow: hidden; }
.buff .bbar > i { display: block; height: 100%; background: var(--gold); }
.buff.bad .bt { color: var(--bad); }

.aspect-pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px 5px 6px; border-radius: 99px; border: 1px solid; font-weight: 700; font-size: 14px; }
.aspect-pill .dot { width: 18px; height: 18px; border-radius: 50%; box-shadow: 0 0 10px currentColor; }

/* ---------- right panel ---------- */
.tabs { display: flex; padding: 10px 8px 0; gap: 4px; border-bottom: 1px solid var(--line); background: rgba(0,0,0,.18); flex: none; }
.tab { flex: 1; position: relative; padding: 10px 6px 9px; border: 1px solid transparent; border-bottom: none; border-radius: 9px 9px 0 0; background: none; color: var(--muted);
  font: 700 13px var(--display); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--gold); background: linear-gradient(180deg, var(--panel3), var(--panel)); border-color: var(--line2); }
.tab-badge { position: absolute; top: -7px; right: -3px; z-index: 2; min-width: 18px; height: 18px; border-radius: 9px; background: var(--ember); color: #fff; font: 700 11px/18px var(--body); padding: 0 5px; letter-spacing: 0; box-shadow: 0 0 0 2px var(--panel); }
#tabbody { flex: 1; overflow: auto; padding: 10px; scrollbar-width: thin; scrollbar-color: #4a3426 transparent; }
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 9px; overflow: hidden; }
.seg button { padding: 6px 11px; background: none; border: none; color: var(--muted); font-weight: 700; font-size: 14px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: rgba(255,200,120,.14); color: var(--gold); }
.toolbar .spacer { flex: 1; }
.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { accent-color: var(--gold2); width: 16px; height: 16px; }

/* buildings */
.bld { display: grid; grid-template-columns: 62px 1fr auto; gap: 4px 12px; align-items: center; padding: 9px 10px; margin-bottom: 7px; border-radius: var(--r);
  background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); cursor: pointer; transition: border-color .15s, background .15s; position: relative; }
.bld:hover { border-color: var(--line2); background: linear-gradient(180deg, #2c1d17, #1f1511); }
.bld.can { border-color: rgba(255, 200, 100, .38); }
.bld.can .bcost { color: var(--gold); }
.bld .bicon { grid-row: span 3; width: 62px; height: 62px; border-radius: 10px; background: radial-gradient(circle at 50% 40%, #3a2a20, #150d0a); border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; }
.bld .bicon img { width: 100%; height: 100%; object-fit: contain; }
.bld .bname { font: 700 16px var(--display); letter-spacing: .01em; }
.bld .bcount { grid-row: span 2; font: 800 28px var(--display); color: rgba(255, 220, 160, .85); text-align: right; min-width: 44px; }
.bld .bcost { font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 6px; font-size: 15px; }
.bld .bcost .coin-ico { width: 14px; height: 14px; }
.bld .bmeta { grid-column: 2 / 4; font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.bld .bmeta span b { color: var(--text); font-weight: 700; }
.bld .bms { grid-column: 2 / 4; height: 4px; border-radius: 2px; background: rgba(255,255,255,.06); overflow: hidden; }
.bld .bms > i { display: block; height: 100%; background: linear-gradient(90deg, #6e4a1a, var(--gold2)); }
.bld.locked { cursor: default; opacity: .7; }
.bld.locked .bicon img { filter: brightness(0) drop-shadow(0 0 1px rgba(255,200,120,.4)); opacity: .7; }
.bld.mystery .bname { color: var(--dim); }
.bld.best::after { content: 'best value'; position: absolute; top: -7px; right: 10px; padding: 1px 7px; border-radius: 6px; background: #3c5a2a; color: #d7ffc6; font: 700 10.5px var(--body); text-transform: uppercase; letter-spacing: .06em; border: 1px solid #5f8a45; }
.bld.flash { animation: bflash .35s ease-out; }
@keyframes bflash { from { box-shadow: 0 0 0 2px var(--gold), 0 0 24px rgba(255,200,80,.5); } }

/* upgrades */
.upg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 7px; }
.upg { position: relative; aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--line2); background: radial-gradient(circle at 50% 40%, #33241b, #160e0b); padding: 0; display: grid; place-items: center; overflow: hidden; }
.upg img, .upg svg { width: 76%; height: 76%; object-fit: contain; }
.upg svg { fill: var(--gold2); }
.upg .tier { position: absolute; bottom: 2px; right: 4px; font: 800 12px var(--display); color: var(--gold); text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.upg.can { border-color: var(--gold); box-shadow: 0 0 12px rgba(255,190,70,.35), 0 0 0 1px rgba(255,220,140,.25) inset; }
.upg:not(.can) { filter: saturate(.45) brightness(.7); }
.upg:hover { filter: none; transform: translateY(-1px); }
.upg.c-aspect { border-color: var(--acol, var(--line2)); }
.upg-list .row { display: flex; gap: 10px; align-items: center; }
.section-title { font: 700 12.5px var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--gold2); margin: 14px 2px 8px; display: flex; gap: 8px; align-items: center; }
.section-title .sub { margin-left: auto; letter-spacing: 0; text-transform: none; font: 500 13px var(--body); color: var(--muted); }
.empty { padding: 18px; text-align: center; color: var(--muted); border: 1px dashed var(--line2); border-radius: var(--r); font-size: 14.5px; }
.upg.owned { filter: none; opacity: .9; cursor: default; }

/* raids */
.raid { padding: 12px; margin-bottom: 8px; border-radius: var(--r); background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); }
.raid .rh { display: flex; align-items: baseline; gap: 8px; }
.raid .rn { font: 700 17px var(--display); }
.raid .rt { margin-left: auto; color: var(--muted); font-size: 14px; }
.raid .rd { color: var(--muted); font-size: 14px; margin: 3px 0 8px; }
.raid .rstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 9px; }
.raid .rs { background: rgba(0,0,0,.22); border-radius: 7px; padding: 5px 8px; font-size: 12.5px; color: var(--muted); }
.raid .rs b { display: block; font-size: 15px; }
.raid .rs.risk b { color: var(--bad); }
.raid .rs.relic b { color: var(--sky); }
.raid.locked { opacity: .55; }
.raid.active { border-color: var(--gold2); box-shadow: 0 0 18px rgba(255,170,60,.18); }
.progress { height: 10px; border-radius: 5px; background: rgba(255,255,255,.07); overflow: hidden; margin: 8px 0; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #b8741c, #ffd166); transition: width .25s linear; }

/* relics */
.relic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.relic { border-radius: var(--r); border: 1px solid var(--line); background: linear-gradient(180deg, var(--panel2), var(--panel)); padding: 9px 8px; text-align: center; }
.relic .ri { width: 64px; height: 64px; margin: 0 auto 4px; border-radius: 50%; background: radial-gradient(circle, rgba(120,200,255,.18), transparent 70%); display: grid; place-items: center; }
.relic .ri img { width: 60px; height: 60px; object-fit: contain; }
.relic .rn2 { font: 700 13px var(--display); line-height: 1.2; min-height: 2.4em; }
.relic .lv { display: flex; justify-content: center; gap: 3px; margin: 5px 0; }
.relic .lv i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.1); }
.relic .lv i.on { background: var(--sky); box-shadow: 0 0 6px var(--sky); }
.relic .rx { font-size: 12.5px; color: var(--muted); }
.relic.unknown .ri img { filter: brightness(0); opacity: .45; }
.relic.unknown .rn2 { color: var(--dim); }
.relic.max { border-color: rgba(127,212,255,.5); }

/* ---------- stage overlays ---------- */
#hint { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); max-width: min(92%, 560px); padding: 10px 16px; border-radius: 12px; background: rgba(18,10,8,.88); border: 1px solid var(--gold2);
  color: var(--text); font-size: 15.5px; text-align: center; box-shadow: var(--shadow), 0 0 22px rgba(255,170,60,.2); pointer-events: none; animation: hintIn .4s ease-out; z-index: 3; }
#hint b { color: var(--gold); }
@keyframes hintIn { from { opacity: 0; transform: translate(-50%, -8px); } }
#banner { position: absolute; left: 0; right: 0; top: 34%; text-align: center; pointer-events: none; z-index: 3; animation: banner 3.2s ease-out forwards; }
#banner .b1 { font: 600 16px var(--display); letter-spacing: .3em; color: var(--muted); text-transform: uppercase; }
#banner .b2 { font: 800 clamp(30px, 5vw, 56px) var(--display); color: #ffe39a; text-shadow: 0 3px 0 #4a2a06, 0 0 40px rgba(255,150,40,.8); }
#banner .b3 { color: var(--text); margin-top: 6px; text-shadow: 0 1px 4px #000; }
@keyframes banner { 0% { opacity: 0; transform: scale(.9); } 12% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
#trialbar { position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 8px 12px; border-radius: 10px; background: rgba(30,12,40,.85); border: 1px solid #7a4fc0; font-size: 14px; z-index: 3; pointer-events: none; }
#trialbar b { color: var(--soul); }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column-reverse; gap: 8px; z-index: 60; pointer-events: none; max-width: min(360px, calc(100vw - 32px)); }
.toast { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(28,18,14,.96); border: 1px solid var(--line2); box-shadow: var(--shadow);
  animation: toastIn .3s ease-out; pointer-events: auto; }
.toast.out { animation: toastOut .35s ease-in forwards; }
.toast .ti { width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; background: rgba(255,200,120,.08); overflow: hidden; }
.toast .ti img { width: 100%; height: 100%; object-fit: contain; }
.toast .ti svg { width: 26px; height: 26px; fill: var(--gold); }
.toast .tt { font: 700 14.5px var(--display); color: var(--gold); }
.toast .tx { font-size: 14px; color: var(--text); }
.toast.ach { border-color: var(--gold2); }
.toast.relic { border-color: var(--sky); }
.toast.relic .tt { color: var(--sky); }
.toast.bad { border-color: var(--bad); }
.toast.bad .tt { color: var(--bad); }
.toast.soul { border-color: var(--soul); }
.toast.soul .tt { color: var(--soul); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* ---------- tooltip ---------- */
#tip { position: fixed; z-index: 80; max-width: 320px; padding: 10px 12px; border-radius: 10px; background: rgba(20,12,10,.97); border: 1px solid var(--line2); box-shadow: var(--shadow); pointer-events: none; font-size: 14px; }
#tip .tt { font: 700 15px var(--display); color: var(--gold); margin-bottom: 3px; }
#tip .tq { color: var(--muted); font-style: italic; margin-top: 6px; font-size: 13px; }
#tip .tc { margin-top: 6px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
#tip .tc .coin-ico { width: 14px; height: 14px; }
#tip .tl { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
#tip .tl b { color: var(--text); }
#tip hr { border: none; border-top: 1px solid var(--line); margin: 7px 0; }

/* ---------- modal ---------- */
#modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal-back { position: absolute; inset: 0; background: rgba(5,2,2,.72); backdrop-filter: blur(3px); animation: fade .2s; }
.modal-box { position: relative; width: min(880px, 100%); max-height: min(88vh, 900px); overflow: auto; border-radius: 16px; background: linear-gradient(180deg, #24170f, #150d0a); border: 1px solid var(--line2);
  box-shadow: 0 30px 80px rgba(0,0,0,.7), 0 0 0 1px rgba(255,220,160,.06) inset; padding: 22px 24px; animation: pop .25s ease-out; scrollbar-width: thin; scrollbar-color: #4a3426 transparent; }
.modal-box.narrow { width: min(520px, 100%); }
.modal-box h2 { margin: 0 0 4px; font: 800 26px var(--display); color: var(--gold); letter-spacing: .04em; }
.modal-box .lead { color: var(--muted); margin: 0 0 16px; }
.modal-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line2); background: rgba(255,255,255,.04); font-size: 20px; line-height: 1; color: var(--muted); }
.modal-close:hover { color: var(--text); background: rgba(255,200,120,.1); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } }

/* aspects picker */
.aspect-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.aspect-card { position: relative; border-radius: 14px; border: 1px solid var(--line2); background: linear-gradient(180deg, #2a1b14, #160e0b); padding: 10px 10px 12px; text-align: left; display: flex; flex-direction: column; gap: 6px; transition: transform .12s, border-color .15s, box-shadow .15s; }
.aspect-card:hover { transform: translateY(-2px); border-color: var(--ac); box-shadow: 0 0 24px color-mix(in srgb, var(--ac) 35%, transparent); }
.aspect-card .ad { height: 120px; display: grid; place-items: center; border-radius: 10px; background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--ac) 30%, transparent), transparent 70%); }
.aspect-card .ad img, .aspect-card .ad canvas { max-height: 118px; max-width: 100%; }
.aspect-card .an { font: 800 18px var(--display); color: var(--ac); }
.aspect-card .as { font: 700 12px var(--body); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.aspect-card .ap { font-size: 13.5px; color: var(--text); }
.aspect-card.taken { opacity: .4; pointer-events: none; }

/* bloodline */
.soul-head { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.soul-stat { padding: 10px 12px; border-radius: 12px; background: rgba(160,100,255,.08); border: 1px solid rgba(190,140,255,.25); }
.soul-stat .k { font-size: 13px; color: var(--muted); }
.soul-stat .v { font: 800 24px var(--display); color: var(--soul); }
.rebirth-box { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 12px; border: 1px solid rgba(190,140,255,.3); background: linear-gradient(90deg, rgba(120,60,200,.15), rgba(0,0,0,0)); margin-bottom: 16px; flex-wrap: wrap; }
.rebirth-box .rbt { flex: 1; min-width: 220px; }
.tree { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px 14px; position: relative; padding: 6px 0 4px; }
.tree svg.links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.talent { position: relative; z-index: 1; border-radius: 12px; border: 1px solid var(--line2); background: linear-gradient(180deg, #24182a, #140d17); padding: 10px; text-align: left; min-height: 96px; display: flex; flex-direction: column; gap: 3px; }
.talent .tn { font: 700 14.5px var(--display); color: var(--text); }
.talent .tx2 { font-size: 13px; color: var(--muted); flex: 1; }
.talent .tc2 { font: 700 13px var(--body); color: var(--soul); display: flex; align-items: center; gap: 5px; }
.talent.owned { border-color: var(--soul); background: linear-gradient(180deg, #3b2353, #1f1230); box-shadow: 0 0 18px rgba(170,110,255,.25); }
.talent.owned .tc2 { color: var(--good); }
.talent.buyable { border-color: rgba(201,155,255,.7); animation: tglow 1.6s ease-in-out infinite; }
.talent.buyable:hover { filter: brightness(1.15); }
.talent.locked { opacity: .45; }
.talent.poor { opacity: .8; }
@keyframes tglow { 50% { box-shadow: 0 0 18px rgba(201,155,255,.45); } }
.talent.wide { grid-column: 2; }
.soul-gem { width: 14px; height: 14px; display: inline-block; background: radial-gradient(circle at 35% 30%, #fff, #c99bff 45%, #6a2fc0); border-radius: 3px; transform: rotate(45deg); box-shadow: 0 0 8px rgba(201,155,255,.7); }

/* trials */
.trial { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line2); background: linear-gradient(180deg, #221626, #150d17); margin-bottom: 9px; }
.trial .tn { font: 700 17px var(--display); }
.trial .tr { color: var(--text); font-size: 14.5px; }
.trial .tg { color: var(--muted); font-size: 13.5px; }
.trial .trw { font-size: 14px; }
.trial .act { grid-row: 1 / span 4; grid-column: 2; align-self: center; }
.trial.done { border-color: var(--good); }
.trial.done .tn::after { content: ' ✓'; color: var(--good); }
.trial.current { border-color: var(--soul); box-shadow: 0 0 20px rgba(170,110,255,.3); }

/* achievements */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ach { padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.02); font-size: 13px; color: var(--muted); }
.ach .an2 { font: 700 13.5px var(--display); color: var(--dim); margin-bottom: 2px; }
.ach.got { border-color: rgba(255,200,100,.4); background: linear-gradient(180deg, rgba(255,200,100,.09), rgba(255,200,100,.02)); color: var(--text); }
.ach.got .an2 { color: var(--gold); }

/* stats & settings */
.stat-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.stat-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.stat-table td:last-child { text-align: right; font-weight: 700; }
.stat-table tr.h td { font: 700 12.5px var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--gold2); padding-top: 16px; border-bottom-color: var(--line2); }
.set-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.set-row .sl { flex: 1; }
.set-row .sl small { display: block; color: var(--muted); }
.set-row input[type=range] { width: 160px; accent-color: var(--gold2); }
textarea.save-text { width: 100%; min-height: 110px; background: #0f0907; color: var(--text); border: 1px solid var(--line2); border-radius: 10px; padding: 10px; font: 12px/1.4 ui-monospace, Consolas, monospace; resize: vertical; }
.help h3 { font: 700 16px var(--display); color: var(--gold2); margin: 18px 0 6px; }
.help p, .help li { color: var(--text); font-size: 15px; }
.help ul { padding-left: 20px; margin: 6px 0; }
.kbd { display: inline-block; padding: 1px 7px; border-radius: 5px; border: 1px solid var(--line2); background: rgba(255,255,255,.05); font: 700 12.5px var(--body); }
.welcome-back { text-align: center; }
.welcome-back .wb-dragon { width: 150px; margin: -6px auto 2px; display: block; filter: drop-shadow(0 0 26px rgba(255,120,30,.45)); }
.wb-rows { text-align: left; margin: 12px 0; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,.22); border: 1px solid var(--line); display: grid; gap: 5px; }
.wb-rows .tl { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 14px; }
.wb-rows .tl b { color: var(--text); }
.offline-big { font: 800 40px var(--display); color: #ffe39a; text-shadow: 0 0 30px rgba(255,170,60,.5); margin: 8px 0; }

/* loading */
#loading { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 16px; background: radial-gradient(circle at 50% 45%, #2a160d, #0b0605 70%); color: var(--muted); font: 600 18px var(--display); letter-spacing: .12em; transition: opacity .5s; }
#loading img { width: 96px; height: 96px; border-radius: 20px; box-shadow: 0 0 40px rgba(255,120,30,.45); animation: pulse 1.4s ease-in-out infinite; }
#loading.done { opacity: 0; pointer-events: none; }

/* ---------- responsive ---------- */
@media (max-width: 1250px) {
  #main { grid-template-columns: 280px minmax(0, 1fr) 370px; }
  .chips .chip.opt { display: none; }
}
@media (max-width: 1020px) {
  .nav-btn .nl { display: none; }
  .nav-btn { padding: 8px 9px; }
  .brand span { display: none; }
}
@media (max-width: 900px) {
  html, body { font-size: 15px; }
  .m-only { display: block; }
  #top { gap: 10px; padding: 6px 10px; min-height: 0; flex-wrap: wrap; padding-top: max(6px, env(safe-area-inset-top)); }
  .brand img { width: 32px; height: 32px; }
  .gold-line { font-size: 22px; }
  .gps-line { margin-left: 30px; font-size: 13px; }
  .chips { order: 3; flex-basis: 100%; gap: 5px; }
  .chip { font-size: 12.5px; padding: 3px 8px; }
  .topnav { gap: 4px; }
  #main { grid-template-columns: 1fr; grid-template-rows: minmax(220px, 40vh) 1fr; }
  #stage { grid-row: 1; }
  #left, #right { grid-row: 2; grid-column: 1; border: none; border-top: 1px solid var(--line2); }
  #left { display: none; padding: 52px 10px 14px; }
  body.tab-dragon #left { display: flex; }
  body.tab-dragon #tabbody { display: none; }
  body.tab-dragon #right { pointer-events: none; background: none; z-index: 2; overflow: visible; }
  body.tab-dragon #right .tabs { pointer-events: auto; background: var(--panel); }
  .tab { font-size: 11.5px; padding: 9px 2px; letter-spacing: .02em; }
  #toasts { left: 10px; right: 10px; bottom: 10px; max-width: none; align-items: stretch; }
  .modal-box { padding: 18px 14px; max-height: 92vh; }
  .soul-head { grid-template-columns: 1fr 1fr; }
  .tree { gap: 18px 8px; }
  .talent { padding: 8px; min-height: 0; }
  .talent .tx2 { font-size: 12px; }
  .raid .rstats { grid-template-columns: repeat(3, 1fr); }
  #hint { font-size: 14px; top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
