/* Survival mode — hazard / toxic war-zone look */
body.surv { --toxic: #39FF88; --haz: #FFD23F; --blood: #FF2E4D; --ink: #F4F1FF; background: #08040F; touch-action: none; user-select: none; -webkit-user-select: none; }
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#dmgLayer { position: fixed; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.dmg { position: absolute; left: 0; top: 0; font-family: var(--display); font-weight: 700; font-size: 20px; color: #fff; text-shadow: 0 2px 0 #000, 0 0 8px rgba(0,0,0,.6); will-change: transform; }
.dmg.crit { color: var(--haz); font-size: 30px; }
.vignette { position: fixed; inset: 0; z-index: 4; pointer-events: none; box-shadow: inset 0 0 140px 40px rgba(255, 30, 60, .85); opacity: 0; }
.vignette.go { animation: vig .45s ease-out; } @keyframes vig { 0% { opacity: 1; } 100% { opacity: 0; } }
.flash { position: fixed; inset: 0; z-index: 9; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flashA .5s ease-out; } @keyframes flashA { 0% { opacity: .85; } 100% { opacity: 0; } }

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; color: var(--ink); }
.hud > * { pointer-events: auto; }
.hud.low::after { content: ''; position: fixed; inset: 0; pointer-events: none; box-shadow: inset 0 0 120px 20px rgba(255, 30, 60, .45); animation: pulse 1s infinite; }
.h-top { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); inset-inline: 12px; display: flex; gap: 8px; align-items: center; pointer-events: none; }
.h-top > * { pointer-events: auto; }
.h-top .sp { flex: 1; }
.h-stat { display: flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 12px; background: rgba(8, 4, 15, .72); border: 1px solid rgba(255, 255, 255, .15); backdrop-filter: blur(6px); }
.h-stat b { font-family: var(--display); font-size: 19px; direction: ltr; font-variant-numeric: tabular-nums; }
.h-stat.gold b { color: var(--haz); }
.h-btn { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; background: rgba(8, 4, 15, .72); border: 1px solid rgba(255, 255, 255, .2); }
.h-bars { position: absolute; top: calc(60px + env(safe-area-inset-top, 0px)); inset-inline: 12px; display: grid; gap: 5px; max-width: 420px; pointer-events: none; }
.hp, .xp { position: relative; height: 16px; border-radius: 6px; background: rgba(8, 4, 15, .75); border: 2px solid rgba(255, 255, 255, .25); overflow: hidden; }
.xp { height: 10px; border-width: 1px; }
.hp i, .xp i { position: absolute; inset-block: 0; inset-inline-start: 0; width: 100%; transition: width .15s; }
.hp i { background: linear-gradient(90deg, #FF2E4D, #FF7A59); box-shadow: 0 0 12px rgba(255, 46, 77, .7); }
.xp i { background: linear-gradient(90deg, #22E4FF, #39FF88); }
.hp span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 800; direction: ltr; text-shadow: 0 1px 2px #000; }
.xp .lvl { position: absolute; inset-inline-end: 6px; top: -1px; font-size: 9px; font-weight: 800; text-shadow: 0 1px 2px #000; }
.loadout { position: absolute; top: calc(98px + env(safe-area-inset-top, 0px)); inset-inline-start: 12px; display: flex; flex-wrap: wrap; gap: 4px; max-width: 70vw; pointer-events: none; }
.loadout span { position: relative; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: rgba(8, 4, 15, .7); border: 1px solid rgba(255, 210, 63, .45); }
.loadout span.pas { border-color: rgba(34, 228, 255, .45); }
.loadout i { position: absolute; bottom: -4px; inset-inline-end: -4px; font-style: normal; font-size: 10px; font-weight: 800; background: var(--haz); color: #08040F; border-radius: 6px; padding: 0 4px; }
.boss { position: absolute; top: calc(140px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); width: min(560px, 86vw); text-align: center; pointer-events: none; }
.boss b { font-family: var(--display); font-size: 18px; color: var(--blood); text-shadow: 0 2px 0 #000; letter-spacing: .5px; }
.boss div { height: 14px; border-radius: 4px; background: rgba(8, 4, 15, .8); border: 2px solid var(--blood); overflow: hidden; margin-top: 3px; }
.boss i { display: block; height: 100%; background: linear-gradient(90deg, #8B0012, #FF2E4D); transition: width .2s; }
.banner { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%) scale(.6); opacity: 0; pointer-events: none; white-space: nowrap;
  font-family: var(--display); font-weight: 700; font-size: clamp(28px, 7vw, 54px); color: #fff; text-shadow: 0 4px 0 #000, 0 0 30px rgba(255, 46, 77, .8); }
.banner.go { animation: ban 2.2s var(--ease) forwards; }
@keyframes ban { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.8) rotate(-4deg); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-2deg); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70%) scale(.95); } }
.joy { position: fixed; width: 120px; height: 120px; border-radius: 50%; transform: translate(-50%, -50%); background: rgba(255, 255, 255, .1); border: 2px solid rgba(255, 255, 255, .35); opacity: 0; transition: opacity .15s; pointer-events: none !important; }
.joy.on { opacity: 1; }
.joy i { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; border-radius: 50%; background: rgba(255, 255, 255, .85); transform: translate(-50%, -50%); }
.h-actions { position: absolute; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); inset-inline-end: 18px; display: flex; gap: 14px; align-items: flex-end; }
.dash { width: 70px; height: 70px; border-radius: 50%; font-size: 30px; background: radial-gradient(circle at 35% 30%, #fff, #22E4FF 70%); border: 3px solid #fff; box-shadow: 0 5px 0 #0A6E80, 0 10px 20px rgba(0,0,0,.4); transition: filter .2s; }
.dash.cool { filter: grayscale(1) brightness(.6); }
.ult { position: relative; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; align-content: center; color: #fff;
  background: conic-gradient(var(--haz) var(--p, 0%), rgba(8, 4, 15, .8) 0); border: 3px solid rgba(255, 255, 255, .5); }
.ult::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: #2A0A18; }
.ult span, .ult small { position: relative; } .ult span { font-size: 30px; line-height: 1; } .ult small { font-size: 11px; font-weight: 800; }
.ult.ready { animation: ultR .7s ease-in-out infinite alternate; border-color: #fff; }
.ult.ready::before { background: radial-gradient(circle, #FF2E4D, #7A0019); }
@keyframes ultR { to { transform: scale(1.1); box-shadow: 0 0 30px 6px rgba(255, 210, 63, .8); } }
.keys { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); margin: 0; font-size: 11px; color: rgba(255, 255, 255, .55); pointer-events: none; white-space: nowrap; }
@media (pointer: coarse) { .keys { display: none; } }
@media (pointer: fine) { .dash, .ult { transform: scale(.85); } }

/* ---------- LOBBY ---------- */
.lobby { position: fixed; inset: 0; z-index: 10; overflow-y: auto; padding: 16px 16px 30px; display: grid; justify-items: center; align-content: start; gap: 14px;
  background: linear-gradient(180deg, rgba(8, 4, 15, .2) 0%, rgba(8, 4, 15, .75) 45%, rgba(8, 4, 15, .95) 100%); }
.lb-top { width: 100%; max-width: 620px; display: flex; justify-content: flex-start; }
.lb-coins { padding: 8px 16px; border-radius: 999px; background: rgba(36, 24, 0, .85); border: 2px solid var(--haz); font-weight: 700; }
.lb-coins b { font-family: var(--display); color: var(--haz); font-size: 20px; }
.lb-hero { text-align: center; display: grid; gap: 10px; justify-items: center; margin-top: 4vh; }
.lb-kicker { margin: 0; font-weight: 800; letter-spacing: 2px; color: var(--haz); font-size: 13px; background: repeating-linear-gradient(-45deg, rgba(255,210,63,.18) 0 10px, transparent 10px 20px); padding: 5px 14px; border: 1px solid rgba(255,210,63,.5); }
.lb-title { margin: 0; font-family: var(--display); font-size: clamp(56px, 15vw, 104px); line-height: .9; color: #fff; text-shadow: 0 6px 0 #7A0019, 0 0 40px rgba(255, 46, 77, .5); }
.lb-title span { color: var(--blood); } .lb-title em { font-style: normal; color: var(--toxic); text-shadow: 0 6px 0 #0B4D2A, 0 0 40px rgba(57, 255, 136, .5); }
.lb-sub { margin: 0; color: #D9D2F0; line-height: 1.5; }
.lb-best { margin: 0; font-size: 13px; color: var(--haz); }
#playBtn { width: min(340px, 86vw); font-size: 22px; padding: 18px; background: linear-gradient(180deg, #FF5470, var(--blood)); border-color: #FF8FA0; box-shadow: 0 7px 0 #7A0019, 0 14px 30px rgba(255, 46, 77, .5); animation: pulse 1.6s infinite; }
.lb-tabs { display: flex; gap: 6px; padding: 4px; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); width: min(620px, 100%); }
.lb-tabs button { flex: 1; padding: 11px 6px; border-radius: 12px; font-weight: 700; color: #B9B0D8; }
.lb-tabs button.on { background: #fff; color: #08040F; }
.lb-panel { width: min(620px, 100%); }
.heroes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.hero-card { display: grid; justify-items: center; gap: 4px; padding: 10px 10px 12px; border-radius: 18px; text-align: center; background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.02)); border: 1px solid rgba(255, 255, 255, .12); }
.hero-card img, .hero-card .ph { width: 120px; height: 120px; object-fit: contain; display: grid; place-items: center; font-size: 50px; filter: drop-shadow(0 10px 14px rgba(0,0,0,.5)); }
.hero-card.sel { border-color: var(--toxic); box-shadow: 0 0 0 3px rgba(57, 255, 136, .2); }
.hero-card.locked img { filter: brightness(.45) saturate(.4); }
.hero-card b { font-family: var(--display); font-size: 20px; }
.hero-card small { color: #B9B0D8; font-size: 12px; min-height: 32px; line-height: 1.35; }
.hstats { display: flex; gap: 8px; font-size: 12px; font-weight: 700; }
.metas { display: grid; gap: 8px; }
.meta-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); }
.meta-row > div { flex: 1; display: grid; gap: 3px; } .meta-row small { color: #B9B0D8; font-size: 12px; }
.mi { font-size: 26px; }
.pips { display: flex; gap: 3px; } .pips i { width: 14px; height: 6px; border-radius: 2px; background: rgba(255, 255, 255, .15); } .pips i.on { background: var(--toxic); box-shadow: 0 0 6px var(--toxic); }
.credits { font-size: 11px; color: rgba(255, 255, 255, .35); margin: 6px 0 0; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 12; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 16px; text-align: center;
  background: rgba(8, 4, 15, .78); backdrop-filter: blur(6px); animation: screenIn .3s var(--ease); }
.overlay h2 { margin: 0; font-family: var(--display); font-size: clamp(30px, 8vw, 46px); color: #fff; text-shadow: 0 4px 0 #000; }
.lu-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 200px)); gap: 12px; }
@media (max-width: 640px) { .lu-cards { grid-template-columns: 1fr; width: min(360px, 92vw); } }
.lu-card { display: grid; justify-items: center; gap: 6px; padding: 18px 14px; border-radius: 20px; color: #fff; text-align: center; cursor: pointer;
  background: linear-gradient(180deg, #2A1650, #150A2E); border: 2px solid rgba(255, 210, 63, .6); box-shadow: 0 10px 30px rgba(0,0,0,.4);
  animation: cardIn .45s var(--ease) both; transition: transform .15s; }
.lu-card.passive { border-color: rgba(34, 228, 255, .6); }
.lu-card:hover { transform: translateY(-6px) scale(1.03); }
.lu-card:active { transform: scale(.96); }
@keyframes cardIn { from { opacity: 0; transform: translateY(40px) rotate(-3deg) scale(.8); } }
.lu-ico { font-size: 46px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.5)); }
.lu-card b { font-family: var(--display); font-size: 22px; }
.lu-lv { font-size: 12px; font-weight: 800; color: var(--haz); }
.lu-card small { color: #CFC6F0; font-size: 13px; line-height: 1.4; }
@media (max-width: 640px) { .lu-card { grid-template-columns: 54px 1fr; justify-items: start; text-align: start; column-gap: 12px; padding: 12px 14px; } .lu-ico { grid-row: 1 / 4; font-size: 38px; align-self: center; } }
.results .rs-time { font-family: var(--display); font-size: clamp(72px, 22vw, 130px); line-height: 1; color: var(--haz); text-shadow: 0 6px 0 #7A5200, 0 0 40px rgba(255, 210, 63, .5); }
.rs-best { margin: 0; color: #D9D2F0; }
.rs-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: min(460px, 92vw); }
.rs-grid div { display: grid; padding: 12px 4px; border-radius: 14px; background: rgba(255, 255, 255, .06); }
.rs-grid b { font-family: var(--display); font-size: 26px; } .rs-grid small { font-size: 11px; color: #B9B0D8; } .rs-grid .gold b { color: var(--haz); }
#againBtn { width: min(340px, 86vw); }
.rs-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.loading { position: fixed; inset: 0; z-index: 20; display: grid; place-content: center; justify-items: center; gap: 12px; background: rgba(8, 4, 15, .9); }
.loading div { width: 240px; height: 8px; border-radius: 9px; background: rgba(255,255,255,.15); overflow: hidden; }
.loading i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--toxic), var(--haz)); transition: width .2s; }
