:root {
  --bg: #15121f;
  --panel: #221d33;
  --panel2: #2c2542;
  --line: rgba(255,255,255,0.08);
  --txt: #f4f1ff;
  --dim: #a69fbf;
  --orange: #ff7a1a;
  --blue: #3d7bff;
  --green: #22b573;
  --gold: #ffd32a;
  --red: #ff5a5a;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--txt);
  font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden;
  user-select: none; -webkit-user-select: none; touch-action: manipulation; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
[hidden] { display: none !important; }
.dim { color: var(--dim); }

.screen { position: absolute; inset: 0; display: none; flex-direction: column; overflow-y: auto; }
.screen.on { display: flex; }
.screen.tabbed { padding: 0 14px calc(78px + var(--safe-b)); }
.screen.full { padding: 0; overflow: hidden; background: #000; }

/* верх */
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 0 8px; }
.top .name { font-weight: 800; font-size: 18px; }
.top .league { color: var(--gold); font-size: 13px; font-weight: 600; }
.top .title { font-weight: 900; font-size: 22px; letter-spacing: .3px; }
.res { display: flex; gap: 6px; }
.pill { background: var(--panel); border-radius: 999px; padding: 6px 11px; font-size: 14px; white-space: nowrap; }
.pill b { font-weight: 800; }
.pill small { color: var(--dim); margin-left: 5px; font-size: 11px; }
.energy b { color: #7fe0ff; }

/* герой */
.hero { position: relative; flex: 1 1 auto; min-height: 220px; max-height: 42vh; margin: 4px -14px 10px;
  background: radial-gradient(120% 90% at 50% 100%, #3b1f4d 0%, rgba(21,18,31,0) 70%); }
.hero canvas { width: 100%; height: 100%; display: block; }
.record { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; color: var(--dim); font-size: 13px; }

.play { display: flex; flex-direction: column; gap: 10px; }
.big { display: flex; flex-direction: column; align-items: flex-start; padding: 14px 18px; border-radius: 18px;
  font-weight: 900; font-size: 19px; letter-spacing: .3px; box-shadow: 0 4px 0 rgba(0,0,0,.35); transition: transform .08s; }
.big small { font-weight: 500; font-size: 12.5px; opacity: .85; letter-spacing: 0; }
.big:active, .btn:active, .card:active { transform: translateY(2px); }
.orange { background: linear-gradient(180deg, #ff8f3a, #ef6400); }
.blue { background: linear-gradient(180deg, #5a90ff, #2d5fe0); }
.green { background: linear-gradient(180deg, #33c985, #179a5f); }
.btn { padding: 12px 18px; border-radius: 14px; font-weight: 800; }
.btn.ghost { background: var(--panel2); }
.btn.gold { background: linear-gradient(180deg, #ffe066, #f5b400); color: #3b2a00; }

/* нижние вкладки */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: rgba(21,18,31,.96);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); z-index: 5; backdrop-filter: blur(6px); }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--dim); gap: 2px; padding: 3px 0; }
.tabs button i { font-style: normal; font-size: 21px; filter: grayscale(.7); opacity: .75; }
.tabs button.on { color: var(--txt); }
.tabs button.on i { filter: none; opacity: 1; }
body.ingame .tabs { display: none; }

/* гардероб */
.wtop { display: flex; gap: 10px; align-items: stretch; }
#wardCv { width: 42%; height: 210px; background: radial-gradient(90% 80% at 50% 100%, #3b1f4d, rgba(0,0,0,0)); border-radius: 16px; }
.stats { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 7px; }
.stat { font-size: 12.5px; }
.stat .row { display: flex; justify-content: space-between; }
.stat .bar { height: 7px; background: var(--panel2); border-radius: 4px; overflow: hidden; display: flex; margin-top: 2px; }
.stat .bar i { display: block; height: 100%; background: #8f86b3; }
.stat .bar i.plus { background: var(--gold); }
.stat .bar i.try { background: #7CFC00; }
.slots { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 8px; scrollbar-width: none; }
.slots button { background: var(--panel); padding: 7px 12px; border-radius: 999px; font-size: 13px; white-space: nowrap; }
.slots button.on { background: var(--orange); font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; padding-bottom: 70px; }
.item { background: var(--panel); border-radius: 14px; padding: 6px; display: flex; flex-direction: column; align-items: center;
  border: 2px solid transparent; position: relative; }
.item canvas { width: 100%; height: 96px; }
.item .nm { font-size: 12px; font-weight: 700; text-align: center; min-height: 30px; display: flex; align-items: center; }
.item .bn { font-size: 10.5px; color: var(--gold); min-height: 14px; text-align: center; }
.item .pr { font-size: 12px; margin-top: 3px; font-weight: 800; }
.item.eq { border-color: #7CFC00; }
.item.sel { border-color: var(--orange); }
.item.rare { background: linear-gradient(180deg, #23305a, var(--panel)); }
.item.epic { background: linear-gradient(180deg, #43235e, var(--panel)); }
.item.legend { background: linear-gradient(180deg, #5e4412, var(--panel)); }
.item .own { color: var(--dim); font-weight: 600; }
.item .tag { position: absolute; top: 4px; right: 6px; font-size: 10px; color: #7CFC00; font-weight: 800; }
.buybar { position: fixed; left: 10px; right: 10px; bottom: calc(66px + var(--safe-b)); background: var(--panel2);
  border-radius: 16px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5); z-index: 4; }
.skins { display: flex; gap: 10px; padding: 8px 0; flex-wrap: wrap; align-items: center; }
.skins button { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; }
.skins button.on { border-color: #fff; }
.numpick { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.numpick button { background: var(--panel2); width: 40px; height: 40px; border-radius: 12px; font-size: 20px; font-weight: 800; }
.numpick b { font-size: 26px; min-width: 44px; text-align: center; }

/* тренировка */
.note { color: var(--dim); font-size: 13px; margin: 0 0 10px; }
.card { width: 100%; display: flex; align-items: center; gap: 12px; background: var(--panel); border-radius: 16px;
  padding: 12px 14px; margin-bottom: 8px; text-align: left; }
.card .ic { font-size: 26px; width: 40px; height: 40px; display: grid; place-items: center; background: var(--panel2); border-radius: 12px; }
.card .txt { flex: 1; display: flex; flex-direction: column; }
.card .txt span { color: var(--dim); font-size: 12.5px; }
.card .go { font-size: 26px; color: var(--dim); }
.card .rw { font-weight: 800; font-size: 13px; text-align: right; }
.card .rw .st { color: var(--gold); letter-spacing: 1px; font-size: 14px; }
.card.locked { opacity: .45; }
.card.free { background: linear-gradient(90deg, #3a2257, var(--panel)); }
.sub { margin: 14px 0 8px; font-size: 16px; }

/* рейтинг */
.leagues { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.leagues span { background: var(--panel); padding: 5px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap; color: var(--dim); }
.leagues span.on { background: var(--gold); color: #2b1d00; font-weight: 800; }
.toplist .row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--panel); border-radius: 12px; margin-bottom: 6px; }
.toplist .row.me { outline: 2px solid var(--orange); }
.toplist .pos { width: 26px; font-weight: 900; text-align: center; color: var(--dim); }
.toplist .row:nth-child(1) .pos { color: var(--gold); }
.toplist .row:nth-child(2) .pos { color: #d7d7e6; }
.toplist .row:nth-child(3) .pos { color: #e3a15f; }
.toplist canvas { width: 38px; height: 44px; }
.toplist .nm { flex: 1; min-width: 0; }
.toplist .nm b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toplist .nm small { color: var(--dim); }
.toplist .rt { font-weight: 900; }
.empty { color: var(--dim); text-align: center; padding: 30px 10px; }

/* матч */
.stage { position: absolute; inset: 0; }
.stage canvas { display: block; touch-action: none; }
.hud { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: flex-start; justify-content: center;
  padding: 8px 8px 0; gap: 8px; pointer-events: none; }
.hud .quit, .phud .quit { pointer-events: auto; position: absolute; left: 8px; top: 8px; width: 34px; height: 34px;
  border-radius: 50%; background: rgba(0,0,0,.45); font-size: 15px; }
.hud .side { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.5); padding: 4px 10px; border-radius: 12px; min-width: 0; }
.hud .side .sc { font-size: 26px; font-weight: 900; min-width: 30px; text-align: center; }
.hud .me .sc { color: #7CFC00; }
.hud .op .sc { color: #ff8a8a; }
.hud .nm { font-size: 11.5px; font-weight: 700; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud .nm small { display: block; color: var(--dim); font-weight: 500; font-size: 10px; }
.hud .me { margin-left: 34px; }
.hud .mid { display: flex; flex-direction: column; align-items: center; background: rgba(0,0,0,.6); padding: 3px 10px; border-radius: 10px; }
.hud .clock { font-weight: 900; font-size: 16px; font-variant-numeric: tabular-nums; }
.hud .shot { font-size: 12px; color: var(--gold); font-weight: 800; min-height: 14px; }
.hud .shot.low { color: var(--red); }
.banner { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.6); padding: 6px 14px;
  border-radius: 999px; font-weight: 800; font-size: 14px; white-space: nowrap; transition: opacity .2s; pointer-events: none; }
.ctl { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end;
  padding: 10px 12px calc(14px + var(--safe-b)); pointer-events: none; }
.ctl button { pointer-events: auto; touch-action: none; }
.move { display: flex; gap: 10px; }
.move button { width: 74px; height: 74px; border-radius: 22px; background: rgba(255,255,255,.14); font-size: 26px;
  border: 2px solid rgba(255,255,255,.18); }
.acts { display: flex; gap: 10px; align-items: flex-end; }
.acts button { border-radius: 50%; font-weight: 900; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 3px solid rgba(255,255,255,.25); line-height: 1.1; }
.acts .a { width: 94px; height: 94px; background: rgba(255,122,26,.75); font-size: 13px; }
.acts .a small { font-size: 9px; font-weight: 600; opacity: .85; }
.acts .b { width: 70px; height: 70px; background: rgba(61,123,255,.7); font-size: 11px; margin-bottom: 36px; }
.acts .b.cd { opacity: .45; }
.ctl button.on { transform: scale(.93); background-color: rgba(255,255,255,.35); }
.reconn { position: absolute; top: 60px; right: 10px; background: var(--red); padding: 4px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; }

.phud { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: flex-start; gap: 8px; padding: 8px 8px 0 50px; pointer-events: none; }
.ptxt { flex: 1; background: rgba(0,0,0,.5); border-radius: 12px; padding: 6px 10px; display: flex; flex-direction: column; }
.ptxt span { font-size: 12px; color: var(--dim); }
.pprog { background: rgba(0,0,0,.6); border-radius: 12px; padding: 6px 10px; font-weight: 800; font-size: 13px; text-align: right; }
.wind { color: #9be7ff; font-size: 12px; }

/* окна */
.overlay { position: fixed; inset: 0; background: rgba(8,6,14,.72); display: grid; place-items: center; z-index: 20; padding: 16px; }
.panel { background: var(--panel); border-radius: 22px; padding: 20px; width: 100%; max-width: 380px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.panel h2 { margin: 4px 0 8px; font-size: 22px; }
.panel p { margin: 6px 0; }
.panel .gain { font-size: 26px; font-weight: 900; color: var(--gold); }
.panel .btns { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.panel .btns .btn:first-child { background: linear-gradient(180deg, #ff8f3a, #ef6400); }
.panel .btns .btn { background: var(--panel2); }
.panel .lv { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.panel .lv button { display: flex; justify-content: space-between; align-items: center; background: var(--panel2); padding: 13px 14px; border-radius: 14px; font-weight: 800; }
.panel .lv button small { color: var(--gold); font-weight: 700; }
.panel .score { font-size: 44px; font-weight: 900; letter-spacing: 2px; }
.panel .score .w { color: #7CFC00; }
.panel .score .l { color: #ff8a8a; }
.panel table { width: 100%; font-size: 13px; margin: 8px 0; border-collapse: collapse; }
.panel td { padding: 3px 4px; border-bottom: 1px solid var(--line); }
.panel td:first-child { text-align: left; color: var(--dim); }
.stars { font-size: 34px; color: var(--gold); letter-spacing: 4px; }
.spin { font-size: 44px; animation: sp 1.2s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }
.codebox { font-size: 30px; font-weight: 900; letter-spacing: 6px; background: var(--panel2); border-radius: 12px; padding: 8px; margin: 8px 0; }
#waitExtra .btn { width: 100%; margin-top: 8px; }
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); background: #000d; padding: 10px 16px;
  border-radius: 14px; z-index: 30; font-weight: 600; max-width: 90%; text-align: center; }
.boot { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; align-content: center; z-index: 50; text-align: center; }

@media (min-width: 700px) and (orientation: landscape) {
  .screen.tabbed { max-width: 560px; margin: 0 auto; }
}

/* в колонке экрана ничего не сжимается - иначе вкладки слотов сплющивает */
.screen > * { flex-shrink: 0; }
.buybar .btn { white-space: nowrap; font-size: 15px; padding: 11px 14px; }
.buybar > div { min-width: 0; font-size: 14px; }
