:root { --bg: #070a14; --panel: rgba(12, 18, 34, .82); --line: rgba(255,255,255,.1); --text: #eef3ff; --muted: #9fb0c8; --gold: #ffe9a8; --teal: #7cf0d8; --pink: #ff8fb1; --font-d: "Unbounded", "Rubik", system-ui, sans-serif; --font-b: "Rubik", system-ui, sans-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(--text); font-family: var(--font-b); overflow: hidden; overscroll-behavior: none; }
canvas#game { position: fixed; inset: 0; display: block; touch-action: none; }
button { font: inherit; color: inherit; }
b { font-weight: 600; }
#loading { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; color: var(--muted); z-index: 50; transition: opacity .6s; font-size: 14px; letter-spacing: .06em; }
#loading.gone { opacity: 0; pointer-events: none; }
#loading .spore { width: 18px; height: 18px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 30px var(--teal), 0 0 60px rgba(124,240,216,.5); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(.7); opacity: .6 } 50% { transform: scale(1.2); opacity: 1 } }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud .xpbar { position: absolute; left: 0; right: 0; top: 0; height: 8px; background: rgba(0,0,0,.45); }
#xpfill { height: 100%; width: 100%; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, #7cf0d8, #9fe3a4, #ffe9a8); box-shadow: 0 0 14px rgba(124,240,216,.6); transition: transform .12s linear; }
#hud .topbar { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; justify-content: space-between; align-items: flex-start; padding-top: env(safe-area-inset-top); }
#hud .tl, #hud .tr { display: flex; align-items: center; gap: 10px; }
#lvl { font-family: var(--font-d); font-size: 13px; color: var(--gold); text-shadow: 0 0 10px rgba(0,0,0,.8); }
#timer { font-family: var(--font-d); font-size: clamp(22px, 3.4vw, 30px); font-weight: 800; letter-spacing: .04em; text-shadow: 0 0 20px rgba(0,0,0,.9), 0 0 30px rgba(124,240,216,.25); }
#timer.endless { color: var(--pink); }
#kills-wrap { font-weight: 600; text-shadow: 0 0 10px rgba(0,0,0,.8); } #kills-wrap i { font-style: normal; opacity: .7; }
.ibtn { pointer-events: auto; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: rgba(10,14,28,.65); backdrop-filter: blur(6px); color: #fff; font-weight: 800; cursor: pointer; }
#slots { display: flex; gap: 6px; flex-wrap: wrap; max-width: 60vw; }
.slot { position: relative; width: 34px; height: 34px; border-radius: 10px; background: rgba(8,12,24,.7); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.slot.p { width: 28px; height: 28px; border-radius: 8px; }
.slot.evo { border-color: rgba(255,233,168,.8); box-shadow: 0 0 14px rgba(255,233,168,.5); }
.slot .lv { position: absolute; right: -4px; bottom: -5px; font-size: 10px; font-weight: 700; background: #1b2440; border-radius: 6px; padding: 0 4px; border: 1px solid var(--line); }
#bossbar { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); width: min(560px, 80vw); text-align: center; }
#bossbar .bname { font-family: var(--font-d); font-size: 13px; color: #ff8a9a; letter-spacing: .08em; text-transform: uppercase; text-shadow: 0 0 12px rgba(0,0,0,.9); margin-bottom: 4px; }
#bossbar .btrack { height: 10px; border-radius: 6px; background: rgba(0,0,0,.55); border: 1px solid rgba(255,90,106,.5); overflow: hidden; }
#bossbar .bfill { height: 100%; width: 100%; transform-origin: left; background: linear-gradient(90deg, #ff5a6a, #ff9d4a); box-shadow: 0 0 12px rgba(255,90,106,.7); transition: transform .1s linear; }
#fairies { position: absolute; left: 14px; bottom: 16px; display: flex; gap: 4px; }
#joystick { position: absolute; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); background: rgba(255,255,255,.06); opacity: 0; transition: opacity .15s; }
#joystick.active { opacity: 1; }
#joystick .stick { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255,255,255,.55); box-shadow: 0 0 20px rgba(124,240,216,.6); }

/* ---------- экраны ---------- */
.screen { position: fixed; inset: 0; z-index: 10; overflow-y: auto; -webkit-overflow-scrolling: touch; background: radial-gradient(120% 90% at 50% 0%, rgba(20,30,55,.92), rgba(6,9,18,.96)); padding: 24px 18px 40px; padding-top: max(24px, env(safe-area-inset-top)); }
.screen.overlay { background: rgba(4,6,14,.72); backdrop-filter: blur(8px); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.shead { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.shead h2 { margin: 0; font-family: var(--font-d); font-size: 22px; }
.shead .mode { color: var(--muted); font-size: 13px; }
h2, h3 { font-family: var(--font-d); font-weight: 700; }
.btn { pointer-events: auto; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 14px 26px; border-radius: 16px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.07); color: #fff; font-weight: 600; font-size: 16px; cursor: pointer; transition: transform .12s, background .15s, box-shadow .15s; text-decoration: none; }
.btn:hover { background: rgba(255,255,255,.13); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .4; cursor: default; transform: none; }
.btn small { font-weight: 400; font-size: 12px; color: var(--muted); }
.btn.primary { background: linear-gradient(135deg, #e23a2e, #ff7a4a); border-color: rgba(255,150,120,.5); box-shadow: 0 8px 30px rgba(226,58,46,.35); font-family: var(--font-d); letter-spacing: .04em; }
.btn.primary:hover { box-shadow: 0 10px 40px rgba(226,58,46,.55); }
.btn.accent { background: linear-gradient(135deg, #1d9e75, #7cf0d8); color: #06241c; border-color: rgba(124,240,216,.5); }
.btn.ghost { background: transparent; }
.btn.small { padding: 9px 14px; font-size: 14px; border-radius: 12px; }
.btn.big { font-size: 20px; padding: 18px 40px; }
.btn.tg { background: #229ED9; border-color: #4fb8ea; } .btn.vk { background: #0077ff; border-color: #3d95ff; }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.hint { color: var(--muted); font-size: 12px; text-align: center; }
.muted { color: var(--muted); }
.legal { color: #7d8aa3; font-size: 11px; line-height: 1.5; max-width: 720px; margin: 28px auto 0; text-align: center; }
.legal.small { font-size: 11px; }
.legal a { color: #a9b8d3; }

/* титул */
#s-title { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.title-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 560px; width: 100%; }
.big-portrait { width: 160px; height: 160px; filter: drop-shadow(0 0 30px rgba(255,120,80,.35)); }
.logo { font-family: var(--font-d); font-weight: 800; font-size: clamp(40px, 9vw, 72px); line-height: .95; margin: 0; letter-spacing: .02em; background: linear-gradient(180deg, #fff6dc, #ffd98a 60%, #ff9a5a); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 6px 30px rgba(255,180,90,.25)); }
.tagline { color: var(--muted); margin: 4px 0 8px; font-size: 15px; }
.challenge { background: rgba(124,240,216,.12); border: 1px solid rgba(124,240,216,.4); border-radius: 14px; padding: 10px 14px; font-size: 14px; }
.menu { display: flex; flex-direction: column; gap: 10px; width: min(360px, 100%); }
.menu .btn { width: 100%; }
.menu .row .btn { flex: 1; }
.best { color: var(--gold); font-size: 14px; margin: 6px 0 0; } .streak { color: #ffb347; font-size: 13px; margin: 0; }
.brand-link { font-weight: 700; letter-spacing: .08em; }

/* интро */
#s-intro { display: flex; align-items: center; justify-content: center; }
.intro { max-width: 640px; text-align: center; font-family: var(--font-d); font-size: clamp(20px, 3.6vw, 30px); line-height: 1.5; }
.intro .line { opacity: 0; transform: translateY(14px); transition: opacity 1.2s, transform 1.2s; margin: 0 0 26px; color: #fff; text-shadow: 0 0 30px rgba(180,140,255,.5); }
.intro .line.in { opacity: 1; transform: none; }
.skip { position: fixed; right: 18px; bottom: 18px; }

/* герои */
.hero-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; max-width: 980px; }
.hero-card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 12px 10px; text-align: center; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; }
.hero-card:hover { transform: translateY(-3px); }
.hero-card.sel { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 10px 40px rgba(255,233,168,.15); }
.hero-card.locked { opacity: .55; cursor: not-allowed; }
.hero-card .portrait { width: 120px; height: 120px; }
.hero-card .name { font-family: var(--font-d); font-size: 15px; margin-top: 4px; }
.hero-card .role { color: var(--gold); font-size: 12px; } .hero-card .latin { color: var(--muted); font-size: 11px; font-style: italic; }
.hero-card .stats { display: flex; justify-content: center; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.hero-card .lock { font-size: 11px; color: #ffb3b3; margin-top: 6px; line-height: 1.3; }
.hero-details { max-width: 980px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px 18px; margin-top: 14px; }
.hero-details h3 { margin: 0 0 6px; font-size: 18px; } .hero-details h3 small { color: var(--gold); font-family: var(--font-b); font-weight: 500; font-size: 13px; margin-left: 8px; }
.hero-details .desc { margin: 0 0 8px; color: #d8e2f4; } .hero-details .weapon { color: var(--teal); font-size: 14px; } .hero-details .hbest { color: var(--muted); font-size: 12px; margin-top: 8px; }
.fairy-h { margin: 22px 0 8px; font-size: 16px; } .fairy-h small { display: block; font-family: var(--font-b); font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 2px; }
.fairy-pick, .fgrid { display: flex; gap: 10px; flex-wrap: wrap; max-width: 980px; }
.fairy-opt { width: 96px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px 6px; text-align: center; cursor: pointer; font-size: 12px; transition: border-color .15s; }
.fairy-opt.sel { border-color: var(--pink); box-shadow: 0 0 0 1px var(--pink); } .fairy-opt.locked { opacity: .55; }
.fairy-opt .fp { width: 56px; height: 56px; display: block; margin: 0 auto 4px; } .fairy-opt .fp.none { line-height: 56px; color: var(--muted); font-size: 20px; }
.fairy-opt .fd { color: var(--muted); font-size: 10px; margin-top: 4px; line-height: 1.3; }
.start-row { margin-top: 22px; display: flex; justify-content: center; }

/* карточки прокачки */
.lv-title { font-size: 20px; color: var(--gold); margin: 0 0 14px; letter-spacing: .06em; text-transform: uppercase; }
.cards { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; width: 100%; max-width: 1000px; }
.card { position: relative; width: min(300px, 100%); background: linear-gradient(180deg, rgba(28,36,64,.95), rgba(14,18,34,.97)); border: 1px solid rgba(255,233,168,.3); border-radius: 20px; padding: 16px 16px 14px; cursor: pointer; animation: cardIn .45s cubic-bezier(.2,.9,.3,1.3) both; transition: transform .12s, border-color .12s, box-shadow .12s; }
.card:hover { transform: translateY(-4px) scale(1.02); border-color: var(--gold); box-shadow: 0 14px 50px rgba(255,233,168,.18); }
.card.passive { border-color: rgba(124,240,216,.35); } .card.passive:hover { border-color: var(--teal); }
.card.evo { border-color: #fff; box-shadow: 0 0 40px rgba(255,255,255,.25); background: linear-gradient(180deg, rgba(70,40,90,.95), rgba(20,14,40,.97)); }
@keyframes cardIn { from { opacity: 0; transform: translateY(30px) scale(.9); } to { opacity: 1; transform: none; } }
.card .head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.card .sub { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); } .card.evo .sub { color: #fff; }
.card .title { font-family: var(--font-d); font-size: 17px; line-height: 1.2; }
.card .desc { font-size: 14px; color: #dfe7f7; line-height: 1.4; }
.card .fact { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(0,0,0,.3); font-size: 12.5px; line-height: 1.45; color: #cfd9ea; border-left: 3px solid var(--gold); }
.card .fact span { display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin-bottom: 3px; }
.card .key { position: absolute; top: 10px; right: 12px; width: 22px; height: 22px; border-radius: 7px; background: rgba(255,255,255,.1); font-size: 12px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.lv-actions { display: flex; gap: 10px; margin-top: 16px; }

/* пауза, результат */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 26px 30px; display: flex; flex-direction: column; gap: 10px; min-width: 260px; text-align: center; }
.panel h2 { margin: 0 0 6px; }
.result { width: min(640px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 16px 20px 20px; text-align: center; max-height: 100%; overflow-y: auto; }
.res-portrait { width: 100px; height: 100px; }
#res-title { margin: 4px 0 2px; font-size: clamp(28px, 5vw, 40px); color: #cfe3ff; } #res-title.win { color: #ffd98a; text-shadow: 0 0 30px rgba(255,200,120,.5); }
.result .sub { color: var(--muted); margin: 0 0 12px; }
.flags { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.flag { background: rgba(255,233,168,.14); border: 1px solid rgba(255,233,168,.4); border-radius: 10px; padding: 5px 10px; font-size: 13px; color: var(--gold); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 12px; }
.stat { background: rgba(0,0,0,.25); border-radius: 12px; padding: 8px 6px; } .stat span { display: block; font-size: 11px; color: var(--muted); } .stat b { font-family: var(--font-d); font-size: 16px; }
.result .fact { text-align: left; background: rgba(0,0,0,.3); border-left: 3px solid var(--teal); border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.45; margin-bottom: 10px; } .result .fact span { display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--teal); margin-bottom: 3px; }
.shop-link { display: inline-block; color: var(--gold); font-size: 13px; margin-bottom: 12px; }
.namebox { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.namebox input { flex: 1; max-width: 300px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.35); color: #fff; font: inherit; }
.share { background: rgba(0,0,0,.25); border-radius: 14px; padding: 10px; margin-bottom: 14px; }
.share pre { white-space: pre-wrap; font: 13px/1.45 var(--font-b); text-align: left; margin: 0 0 8px; color: #dfe7f7; }
.row.main { margin-top: 4px; }

/* атлас, лидеры */
.atlas { display: flex; flex-direction: column; gap: 14px; max-width: 900px; }
.atlas-hero { display: flex; gap: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.atlas-hero.locked { opacity: .6; }
.atlas-hero .portrait { width: 110px; height: 110px; flex: none; }
.atlas-hero h3 { margin: 0 0 4px; font-size: 18px; } .atlas-hero h3 small { color: var(--muted); font-family: var(--font-b); font-weight: 400; font-style: italic; font-size: 12px; margin-left: 6px; }
.atlas .role { color: #d8e2f4; font-size: 13px; margin: 0 0 8px; }
.facts { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 5px; }
.facts li { font-size: 13px; line-height: 1.4; padding-left: 14px; position: relative; } .facts li::before { content: '🍄'; position: absolute; left: -6px; top: 0; font-size: 10px; opacity: .8; }
.facts li.unseen { color: #5f6b85; } .facts li.unseen::before { content: '·'; }
.progress { color: var(--muted); font-size: 12px; margin: 8px 0; }
.atlas-fairies, .atlas-general, .atlas-ach { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px; } .atlas h3 { margin: 0 0 10px; font-size: 16px; }
.achs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.ach { background: rgba(0,0,0,.25); border-radius: 10px; padding: 8px 10px; font-size: 12px; opacity: .55; } .ach.got { opacity: 1; border: 1px solid rgba(124,240,216,.3); } .ach b { display: block; color: var(--gold); } .ach span { color: var(--muted); }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; } .tab { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: transparent; cursor: pointer; } .tab.sel { background: rgba(255,255,255,.12); }
.leaders table { width: 100%; max-width: 720px; border-collapse: collapse; font-size: 14px; } .leaders th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 6px; } .leaders td { padding: 7px 6px; border-top: 1px solid var(--line); } .leaders tr.me td { background: rgba(255,233,168,.1); }

/* тосты */
#toasts { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 40; pointer-events: none; align-items: center; }
.toast { background: rgba(12,18,34,.92); border: 1px solid rgba(255,233,168,.35); border-radius: 14px; padding: 10px 16px; font-size: 14px; opacity: 0; transform: translateY(16px); transition: opacity .3s, transform .3s; max-width: 90vw; text-align: center; }
.toast.in { opacity: 1; transform: none; } .toast.big { border-color: var(--gold); font-family: var(--font-d); font-size: 15px; box-shadow: 0 0 40px rgba(255,233,168,.25); }

@media (max-width: 640px) {
  .screen { padding: 16px 12px 30px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .card { padding: 12px; } .card .fact { font-size: 12px; }
  .cards { gap: 10px; } .hero-card .portrait { width: 96px; height: 96px; }
  .atlas-hero { flex-direction: column; align-items: center; text-align: left; }
  #slots { max-width: 40vw; }
}
