:root {
  --bg: #070a14; --panel: rgba(10, 14, 30, .78); --line: rgba(120, 140, 220, .22); --text: #eef1ff; --muted: #8e98bd;
  --red: #ff3d5a; --red2: #ff7a3a; --cyan: #2ef0ff; --gold: #ffd23a; --green: #2ef0a0;
  --title: 'Russo One', 'Chakra Petch', system-ui, sans-serif; --ui: 'Chakra Petch', system-ui, sans-serif;
}
* { box-sizing: border-box }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 600 14px/1.35 var(--ui); -webkit-tap-highlight-color: transparent; user-select: none }
#c { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none }
button { font: inherit; color: inherit; cursor: pointer }
.muted { color: var(--muted) } .small { font-size: 12px }
[hidden] { display: none !important }

/* top bar */
#top { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: 12px 16px; z-index: 20; pointer-events: none }
#top > * { pointer-events: auto }
#top .grow { flex: 1; pointer-events: none }
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 8px; font: 400 22px var(--title); letter-spacing: .06em; margin-right: 6px; text-shadow: 0 0 18px rgba(255, 61, 90, .55) }
.brand img { width: 32px; height: 32px; border-radius: 8px }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; font-size: 13px; color: var(--text); text-decoration: none; backdrop-filter: blur(6px); white-space: nowrap }
.chip:hover { border-color: rgba(160, 180, 255, .5) }
.chip.icon { padding: 7px 10px }
.chip.x { font-weight: 700 }
.btn { background: linear-gradient(180deg, #ff4f68, #e0233f); border: 0; border-radius: 12px; padding: 9px 14px; font-weight: 700; color: #fff; box-shadow: 0 6px 24px rgba(255, 40, 70, .35), inset 0 1px 0 rgba(255, 255, 255, .25); white-space: nowrap }
.btn.ghost { background: rgba(255, 255, 255, .06); box-shadow: none; border: 1px solid var(--line) }
.btn.gold { background: linear-gradient(180deg, #ffd84a, #f0a81a); color: #2a1800 }
.btn.cyan { background: linear-gradient(180deg, #4af6ff, #12b8d8); color: #04202a }
.btn:disabled { opacity: .5; cursor: default }

/* boss bar */
#bossbar { position: fixed; top: 58px; left: 50%; transform: translateX(-50%); width: min(820px, calc(100vw - 32px)); z-index: 15; text-align: center; pointer-events: none }
.bossname { display: flex; align-items: center; justify-content: center; gap: 10px; font: 400 26px var(--title); letter-spacing: .03em; text-shadow: 0 2px 0 #000, 0 0 24px rgba(0, 0, 0, .8); margin-bottom: 6px }
.tag { font: 700 11px var(--ui); letter-spacing: .12em; padding: 4px 8px; border-radius: 6px; background: #3a4366; color: #fff; text-shadow: none; vertical-align: middle }
.tag.rare { background: #1f6fe0 } .tag.legendary { background: linear-gradient(90deg, #ff9a1a, #ffd23a); color: #2a1600 } .tag.world { background: linear-gradient(90deg, #ff3df0, #7a4aff) }
.tag.rage { background: #ff2a3a; animation: pulse .8s infinite alternate }
.tag.demo { background: rgba(255, 210, 58, .16); color: var(--gold); border: 1px solid rgba(255, 210, 58, .4); margin-left: 8px }
.tag.off { background: rgba(255, 61, 90, .2); color: #ff9aa8; margin-left: 6px }
@keyframes pulse { to { filter: brightness(1.5); transform: scale(1.05) } }
.hp { position: relative; height: 26px; border-radius: 8px; background: rgba(20, 6, 12, .85); border: 2px solid rgba(255, 255, 255, .14); overflow: hidden; box-shadow: 0 8px 30px rgba(0, 0, 0, .55), 0 0 0 1px #000 }
.hp .fill, .hp .lag { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; transform-origin: left }
.hp .lag { background: #fff3c4; opacity: .85 }
.hp .fill { background: linear-gradient(180deg, #ff6a7e 0%, #ff2a4a 45%, #b5102a 100%); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35) }
.hp.rage .fill { background: linear-gradient(180deg, #ffb06a 0%, #ff4a1a 45%, #a51a08 100%) }
.hp .ticks { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(0, 0, 0, .35) calc(10% - 2px) 10%) }
.hp span { position: absolute; inset: 0; display: grid; place-items: center; font: 700 14px var(--ui); letter-spacing: .04em; text-shadow: 0 1px 2px #000, 0 0 6px #000 }
.hp .mark { position: absolute; top: -2px; bottom: -2px; width: 3px; background: #fff; opacity: .55 }
.online { margin-top: 7px; font-size: 13px; color: #cfd6f6; text-shadow: 0 1px 3px #000; display: flex; align-items: center; justify-content: center; flex-wrap: wrap }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #2ef07a; box-shadow: 0 0 10px #2ef07a; margin-right: 7px; animation: pulse 1s infinite alternate }

/* feed */
#feed { position: fixed; left: 16px; bottom: 120px; width: min(380px, calc(100vw - 32px)); z-index: 12; display: flex; flex-direction: column; gap: 5px; pointer-events: none }
.fe { background: rgba(8, 10, 22, .72); border-left: 3px solid var(--line); padding: 6px 10px; border-radius: 8px; font-size: 13px; text-shadow: 0 1px 2px #000; animation: fin .35s ease-out; transition: opacity .6s }
.fe.crit { border-color: var(--gold) } .fe.phase, .fe.defeated { border-color: var(--red); color: #ffd0d6 } .fe.unlock { border-color: #ff3df0; color: #ffd6fb }
.fe.shield, .fe.adds, .fe.weak { border-color: var(--cyan) } .fe.join { border-color: #4a5a90; color: #b8c2e8 } .fe.spawn { border-color: var(--red2) } .fe.paid { border-color: var(--green); color: #c8ffe8 }
.fe.old { opacity: .45 }
@keyframes fin { from { transform: translateX(-20px); opacity: 0 } }

/* side panel */
#side { position: fixed; right: 16px; top: 168px; width: 230px; z-index: 12; display: flex; flex-direction: column; gap: 8px }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; backdrop-filter: blur(6px) }
.card .h { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; display: flex; justify-content: space-between }
.card .row { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 0 }
.card .row b { font-size: 17px }
.tierrow { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px }
.tierrow i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); box-shadow: 0 0 8px var(--c) }
.tierrow .cap { margin-left: auto; color: var(--muted) }
.tierrow.on { color: #fff } .tierrow.off { color: #6e789c } .tierrow.off i { opacity: .35; box-shadow: none }
.tierrow.cur::after { content: 'NOW'; font-size: 10px; letter-spacing: .1em; background: #ff3d5a; padding: 1px 5px; border-radius: 4px; margin-left: 6px }
.sp { display: flex; align-items: center; gap: 8px; padding: 3px 0 }
.sp i { width: 10px; height: 10px; border-radius: 50%; background: var(--c) }
.sp b { width: 34px }

/* player hud */
#hud { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 14; text-align: center; pointer-events: none; width: min(520px, calc(100vw - 32px)) }
.bars { display: flex; gap: 10px }
.pbar { flex: 1; position: relative; height: 16px; border-radius: 6px; background: rgba(0, 0, 0, .6); border: 1px solid rgba(255, 255, 255, .16); overflow: hidden }
.pbar div { position: absolute; inset: 0; transform-origin: left; transition: transform .12s }
.pbar.hp div { background: linear-gradient(180deg, #5aff9a, #18b85a) }
.pbar.sp div { background: linear-gradient(180deg, #7af8ff, #1aa8d8) }
.pbar.sp.ready div { background: linear-gradient(90deg, #7af8ff, #fff, #7af8ff); background-size: 200% 100%; animation: shine 1s linear infinite }
@keyframes shine { to { background-position: -200% 0 } }
.pbar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; letter-spacing: .12em; text-shadow: 0 1px 2px #000 }
#keys { margin-top: 7px; text-shadow: 0 1px 2px #000 }
#weakTag, #immuneTag { display: inline-block; font: 400 18px var(--title); letter-spacing: .05em; padding: 6px 14px; border-radius: 10px; margin-bottom: 8px; animation: pulse .45s infinite alternate }
#weakTag { background: rgba(255, 210, 58, .2); color: var(--gold); border: 1px solid rgba(255, 210, 58, .6) }
#immuneTag { background: rgba(46, 240, 255, .14); color: var(--cyan); border: 1px solid rgba(46, 240, 255, .5) }
#immuneTag.regen { background: rgba(77, 255, 154, .14); color: #4dff9a; border-color: rgba(77, 255, 154, .55) }
.fe.regen { border-color: #4dff9a } .fe.regen_end { border-color: var(--red) }
#comboTag { font: 400 20px var(--title); color: var(--gold); text-shadow: 0 0 14px rgba(255, 180, 40, .7), 0 2px 0 #000; min-height: 26px; margin-bottom: 4px }

#cta { position: fixed; left: 50%; bottom: 78px; transform: translateX(-50%); z-index: 16; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; text-align: center; backdrop-filter: blur(8px); width: max-content; max-width: calc(100vw - 32px) }
#ctaText { margin-bottom: 9px; font-size: 14px }
#cta .btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap }
#modeTag { position: fixed; left: 50%; top: 152px; transform: translateX(-50%); z-index: 13; font-size: 12px; letter-spacing: .12em; padding: 4px 10px; border-radius: 6px; background: rgba(255, 210, 58, .16); color: var(--gold); border: 1px solid rgba(255, 210, 58, .4) }
#koTag { position: fixed; left: 0; right: 0; top: 22vh; display: grid; place-content: center; text-align: center; z-index: 13; font: 400 46px var(--title); color: #ff6a7e; text-shadow: 0 0 30px #ff2a4a, 0 3px 0 #000; pointer-events: none }
#koTag small { display: block; font: 600 16px var(--ui); color: #fff; margin-top: 4px }

/* crosshair + ammo + leave */
#xhair { position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 14; pointer-events: none }
#xhair i, #xhair b { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); border-radius: 50% }
#xhair i { width: 34px; height: 34px; border: 2px solid rgba(255, 255, 255, .85); box-shadow: 0 0 8px rgba(0, 0, 0, .8), inset 0 0 6px rgba(0, 0, 0, .5) }
#xhair b { width: 5px; height: 5px; background: #fff; box-shadow: 0 0 6px #000 }
#xhair.weak i { border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 210, 58, .9) } #xhair.weak b { background: var(--gold) }
#xhair.empty i { border-color: #ff5a6a; border-style: dashed } #xhair.empty b { background: #ff5a6a }
body:not(.watching) #c { cursor: none }
.ammo { display: flex; align-items: baseline; gap: 3px; padding: 0 4px; white-space: nowrap; text-shadow: 0 1px 3px #000 }
.ammo b { font: 400 20px var(--title); color: var(--cyan) } .ammo span { font-size: 11px; letter-spacing: .1em; color: #cfd6f6 }
.ammo.low b { color: #ff5a6a; animation: pulse .4s infinite alternate }
.chip.leave { color: #ffb0bc; border-color: rgba(255, 61, 90, .4) }
/* damage numbers */
#nums { position: fixed; inset: 0; pointer-events: none; z-index: 11; overflow: hidden }
.num { position: absolute; left: 0; top: 0; font: 700 18px var(--ui); color: #fff; text-shadow: 0 2px 0 #000, 0 0 8px rgba(0, 0, 0, .8); white-space: nowrap; will-change: transform }
.num.crit { font: 400 30px var(--title); color: var(--gold); text-shadow: 0 3px 0 #6a3a00, 0 0 18px rgba(255, 180, 40, .9) }
.num.big { font: 400 40px var(--title); color: #7af8ff; text-shadow: 0 3px 0 #003a4a, 0 0 22px rgba(80, 230, 255, .9) }
.num.ghost { font-size: 13px; color: #b8c4f0; opacity: .7 }
.num.imm { font-size: 14px; color: var(--cyan) }
.num.hurt { color: #ff5a6a; font-size: 22px }

#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 10; box-shadow: inset 0 0 160px rgba(255, 20, 40, 0); transition: box-shadow .25s }
#vignette.hurt { box-shadow: inset 0 0 160px rgba(255, 20, 40, .65); transition: none }
#impactFlash { position: fixed; inset: 0; pointer-events: none; z-index: 10; opacity: 0; background: radial-gradient(ellipse at center, rgba(255, 150, 40, 0) 40%, rgba(255, 120, 30, .55) 100%) }
#weakFlash { position: fixed; inset: 0; pointer-events: none; z-index: 10; box-shadow: inset 0 0 120px rgba(255, 210, 58, .0); transition: box-shadow .3s }
#weakFlash.on { box-shadow: inset 0 0 120px rgba(255, 210, 58, .35) }

/* touch controls */
#touch { display: none }
@media (pointer: coarse) {
  #touch { display: block }
  #keys { display: none }
  #hud { top: 132px; bottom: auto; width: calc(100vw - 32px) }
  #hud .bars { gap: 8px; width: 100%; align-self: stretch } .pbar { height: 12px } .pbar span { font-size: 9px }
  #weakTag, #immuneTag { font-size: 14px; padding: 4px 10px; margin: 8px 0 0 }
  #hud { display: flex; flex-direction: column-reverse; align-items: center }
  #comboTag { font-size: 16px; margin: 6px 0 0 }
  #modeTag { top: 170px }
  #feed { bottom: 158px; width: calc(100vw - 150px) }
  #feed .fe:nth-last-child(n+3) { display: none }
  #cta { bottom: 210px }
  #stick { position: fixed; left: 22px; bottom: 26px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .06); border: 2px solid rgba(255, 255, 255, .16); z-index: 17; touch-action: none }
  #knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px; border-radius: 50%; background: rgba(255, 255, 255, .22); border: 2px solid rgba(255, 255, 255, .35) }
  .tbtn { position: fixed; z-index: 17; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); font: 700 11px var(--ui); letter-spacing: .06em; touch-action: none }
  .tbtn.atk { right: 22px; bottom: 30px; width: 86px; height: 86px; background: rgba(255, 61, 90, .45) }
  .tbtn.dash { right: 118px; bottom: 22px; width: 62px; height: 62px; background: rgba(255, 255, 255, .12) }
  .tbtn.spec { right: 40px; bottom: 128px; width: 62px; height: 62px; background: rgba(46, 240, 255, .3) }
  .tbtn.ready { box-shadow: 0 0 20px var(--cyan) }
}

/* intro cinematic: everything else steps aside for 3 seconds */
#top, #bossbar, #side, #feed, #hud, #cta, #modeTag { transition: opacity .45s }
body.cine #top, body.cine #bossbar, body.cine #side, body.cine #feed, body.cine #hud, body.cine #cta, body.cine #modeTag, body.cine #touch { opacity: 0; pointer-events: none }
body.won #hud, body.won #side, body.won #cta, body.won #modeTag, body.won #touch, body.won #koTag { opacity: 0; pointer-events: none }
/* intro cinematic */
#intro { position: fixed; inset: 0; z-index: 30; pointer-events: none }
#intro .bars-top, #intro .bars-bot { position: absolute; left: 0; right: 0; height: 11vh; background: #000; animation: bars .5s ease-out }
#intro .bars-top { top: 0 } #intro .bars-bot { bottom: 0 }
@keyframes bars { from { height: 0 } }
#intro .card { position: absolute; left: 50%; bottom: 17vh; transform: translateX(-50%); background: none; border: 0; text-align: center; backdrop-filter: none; width: 100% }
.itier { font: 700 15px var(--ui); letter-spacing: .4em; color: var(--c, #9fb4c8); opacity: 0; animation: up .5s .2s forwards }
.iname { font: 400 clamp(36px, 8vw, 84px) var(--title); line-height: 1; text-shadow: 0 4px 0 #000, 0 0 40px var(--c, #ff3d5a); opacity: 0; animation: slam .45s .55s cubic-bezier(.2, 1.6, .4, 1) forwards }
.ihp { font: 700 20px var(--ui); letter-spacing: .1em; margin-top: 10px; opacity: 0; animation: up .4s 1.05s forwards }
.iatk { margin-top: 8px; font-size: 14px; color: #c8d0f0; opacity: 0; animation: up .4s 1.35s forwards }
@keyframes up { from { transform: translateY(14px); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes slam { from { transform: scale(2.4); opacity: 0; filter: blur(8px) } to { transform: none; opacity: 1; filter: none } }
#intro.out { animation: fadeout .45s forwards }
@keyframes fadeout { to { opacity: 0 } }

/* victory */
#victory { position: fixed; inset: 0; z-index: 25; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: radial-gradient(ellipse at center, rgba(40, 8, 16, .55), rgba(4, 4, 10, .85)); padding: 16px }
.vtitle { font: 400 clamp(44px, 10vw, 110px) var(--title); line-height: 1; color: #fff; letter-spacing: .03em; text-shadow: 0 5px 0 #6a0a1a, 0 0 50px rgba(255, 50, 80, .9); animation: slam .6s cubic-bezier(.2, 1.6, .4, 1); text-align: center }
.vcard { background: rgba(10, 14, 30, .9); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; width: min(520px, 100%); animation: up .5s .4s both }
.vsub { color: var(--muted); text-align: center; margin-bottom: 12px }
.vpool { text-align: center; font: 400 28px var(--title); margin-bottom: 12px }
.vpool small { display: block; font: 600 12px var(--ui); color: var(--muted); letter-spacing: .12em; text-transform: uppercase }
.vrow { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; background: rgba(255, 255, 255, .04); margin-bottom: 6px; opacity: 0; animation: up .4s forwards }
.vrow .pct { font: 400 20px var(--title); color: var(--c) }
.vrow .what small { display: block; color: var(--muted); font-size: 12px }
.vrow .amt { font: 700 16px var(--ui) }
.vme { margin-top: 8px; text-align: center; color: #cfe }
.vnext { margin-top: 12px; text-align: center; font: 700 15px var(--ui); color: var(--gold) }
.vnote { color: var(--muted); font-size: 12px; text-align: center; margin-top: 6px }

/* modal */
#modal { position: fixed; inset: 0; z-index: 40; background: rgba(2, 3, 8, .7); display: grid; place-items: center; padding: 16px; backdrop-filter: blur(4px) }
.mcard { position: relative; background: #0c1124; border: 1px solid var(--line); border-radius: 18px; padding: 22px; width: min(620px, 100%); max-height: calc(100vh - 32px); overflow: auto; user-select: text }
.mclose { position: absolute; right: 12px; top: 10px; background: none; border: 0; font-size: 18px; color: var(--muted) }
.mcard h2 { font: 400 26px var(--title); margin: 0 0 12px }
.mcard h3 { font: 700 13px var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 16px 0 6px }
.mcard p, .mcard li { color: #d4daf4; font-weight: 500 }
.mcard ul { padding-left: 18px; margin: 6px 0 }
.mcard .bossgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px }
.mcard .bg { background: rgba(255, 255, 255, .04); border-radius: 10px; padding: 8px 10px; font-size: 12px; color: #c8d0ec }
.mcard .bg b { display: block; font-size: 14px; color: #fff }
.mcard .disc { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; margin-top: 14px }
.raid { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px }
.raid .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline }
.raid .nums { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 4px }
.raid a { color: var(--cyan) }
.kbd { display: inline-block; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; font-size: 12px }

#toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%) translateY(-80px); z-index: 50; background: #141a34; border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; transition: transform .3s; max-width: calc(100vw - 32px); text-align: center }
#toast.on { transform: translateX(-50%) }
#loading { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: grid; place-content: center; text-align: center; transition: opacity .6s }
#loading .lt { font: 400 64px var(--title); letter-spacing: .1em; text-shadow: 0 0 40px rgba(255, 61, 90, .7) }
#loading .ls { color: var(--muted); margin-top: 6px }
#loading.done { opacity: 0; pointer-events: none }

/* phones */
@media (max-width: 720px) {
  #top { padding: 10px 12px; gap: 6px; flex-wrap: nowrap }
  .brand img { width: 26px; height: 26px }
  .brand span { display: none }
  #howBtn, #raidsBtn { display: none }
  .chip { padding: 6px 10px; font-size: 12px }
  .btn { padding: 8px 11px; font-size: 13px }
  #caChip { max-width: 132px; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; min-width: 0 }
  #walletBtn { flex-shrink: 0 }
  #bossbar { top: 54px }
  .bossname { font-size: 18px; gap: 6px }
  .hp { height: 20px }
  .hp span { font-size: 12px }
  #side { display: none }
  #modeTag { top: 128px }
  #feed { width: calc(100vw - 32px); font-size: 12px }
  .fe { font-size: 12px; padding: 5px 8px }
  #feed .fe:nth-last-child(n+4) { display: none }
}
@media (max-width: 720px) and (pointer: fine) { #feed { bottom: 110px } }
