/* Merge Defense — єдина дизайн-система «чистий sci-fi неон»:
   темний космос, скляні панелі з тонкою рамкою, один акцент (бірюзовий), лінійні SVG-іконки, шрифт Exo 2 (з кирилицею).
   Orbitron — лише для латинського логотипа. */
:root {
    --bg: #060814; --bg2: #0b0f22;
    --glass: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018));
    --glass2: linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.03));
    --line: rgba(150, 168, 255, 0.14); --line2: rgba(150, 168, 255, 0.26);
    --text: #e9edff; --mute: #949dc2; --dim: #5e6789;
    --acc: #2ee6ff; --acc-d: #13a9d6; --acc-ink: #03141c;
    --pink: #ff4d9d; --green: #3ee59a; --gold: #ffcc4d; --red: #ff5a6e; --violet: #9b7bff;
    --cyan: var(--acc);
    --r: 14px; --r2: 18px;
    --font: 'Exo 2', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --logo: 'Orbitron', 'Exo 2', sans-serif;
    --pad: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { position: fixed; inset: 0; background: radial-gradient(120% 70% at 50% -10%, #141a3d 0%, var(--bg) 60%); color: var(--text); font-family: var(--font); font-size: 14px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; display: flex; justify-content: center; }
button, input { font-family: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; opacity: 0.42; }
a { color: inherit; text-decoration: none; }
.off { display: none !important; }
.sans { font-family: var(--font); }
.num { font-variant-numeric: tabular-nums; }
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.chip, .chestic { display: block; flex: none; }
.coin { color: var(--gold); font-weight: 800; }
.trophy { color: #ffb347; font-weight: 800; }
.cur { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-weight: 800; font-variant-numeric: tabular-nums; }
.cur .ic { width: 1.05em; height: 1.05em; }
.cur.c { color: var(--gold); } .cur.x { color: #ffe08a; } .cur.e { color: var(--acc); } .cur.t { color: #ffb347; }

/* ================= БІЙ ================= */
#app { width: min(520px, 100%); height: 100%; display: flex; flex-direction: column; gap: 8px; padding: max(10px, env(safe-area-inset-top)) 12px max(10px, env(safe-area-inset-bottom)); }
#side { display: flex; flex-direction: column; gap: 8px; flex: none; }
.panel { background: var(--glass), rgba(10, 13, 30, 0.82); border: 1px solid var(--line); border-radius: var(--r); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.hrow { display: flex; align-items: center; gap: 8px; }
.ibtn { width: 44px; height: 44px; flex: none; border-radius: 12px; border: 1px solid var(--line2); background: var(--glass), rgba(10, 13, 30, 0.82); display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 13px; font-weight: 800; color: var(--text); transition: border-color 0.15s, background 0.15s; }
.ibtn .ic { width: 20px; height: 20px; }
.ibtn:hover:not(:disabled) { border-color: var(--acc); }
.stats { flex: 1; display: flex; justify-content: space-around; align-items: center; padding: 5px 8px; min-height: 44px; }
.stat { text-align: center; min-width: 0; }
.stat small { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.12em; color: var(--mute); }
.stat b { display: block; font-size: 19px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.corerow { gap: 8px; padding: 0 2px; font-size: 11px; font-weight: 700; color: #ff8cbf; letter-spacing: 0.08em; }
.corerow .ic { width: 14px; height: 14px; }
#coreBar { height: 6px; border-radius: 3px; background: rgba(255, 77, 157, 0.16); overflow: hidden; }
#coreBar i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), #ff9a5a); border-radius: 3px; transition: width 0.2s; }
#coreText { color: var(--text); font-variant-numeric: tabular-nums; min-width: 18px; text-align: right; }
#stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; }
canvas { display: block; border-radius: var(--r); touch-action: none; }
#controls { display: flex; flex-direction: column; gap: 8px; flex: none; }
/* телефон: покращення над призовом — «Призвати» найближче до пальця; невеликий відступ від низу екрана */
body:not(.wide) #ups { order: -1; }
body:not(.wide) #controls { margin-bottom: 14px; }
.ctl { display: flex; gap: 8px; }
.ctl .ibtn { width: 56px; height: 54px; }
#summonBtn { flex: 1; height: 54px; border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 17px; font-weight: 800; letter-spacing: 0.06em; color: var(--acc-ink); background: linear-gradient(180deg, #5cf0ff, var(--acc-d)); box-shadow: 0 8px 22px -8px rgba(46, 230, 255, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.45); transition: transform 0.1s, filter 0.15s; }
#summonBtn .ic { width: 20px; height: 20px; }
#summonBtn:active:not(:disabled) { transform: scale(0.98); }
#summonBtn small { font-size: 13px; font-weight: 700; opacity: 0.85; display: inline-flex; align-items: center; gap: 2px; }
#summonBtn small .ic { width: 14px; height: 14px; }
#ups { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.up { min-height: 60px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass), rgba(10, 13, 30, 0.82); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 5px 2px; font-size: 10px; }
.up .chip { width: 26px; height: 26px; }
.up b { font-size: 10.5px; font-weight: 700; color: var(--mute); }
.up .c { display: inline-flex; align-items: center; gap: 1px; font-size: 11px; font-weight: 800; color: var(--acc); font-variant-numeric: tabular-nums; }
.up .c .ic { width: 11px; height: 11px; }
.up:not(:disabled):hover { border-color: var(--acc); }
#tip { position: absolute; left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -100%); width: min(560px, calc(100% - 12px)); max-width: calc(100% - 12px); padding: 10px 10px 10px 12px; border-radius: 12px; background: rgba(8, 11, 26, 0.95); border: 1px solid var(--line2); font-size: 12px; pointer-events: none; display: flex; align-items: center; gap: 10px; color: var(--text) !important; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
#tip > span { flex: 1; min-width: 0; white-space: normal; line-height: 1.4; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
#tip .thd { font-size: 13px; }
#tip .tsk { font-size: 12px; color: #c7d2fe; }
#tip .tbf { font-size: 12px; color: #ffb08f; }
#tip .rm { pointer-events: auto; flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 9px; border: 1px solid rgba(255, 90, 110, 0.6); background: rgba(255, 90, 110, 0.12); color: #ffc2ca; font-size: 12px; font-weight: 800; }
#toast { position: fixed; top: max(14%, calc(env(safe-area-inset-top) + 64px)); left: 50%; transform: translateX(-50%); z-index: 80; max-width: calc(100% - 32px); display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px; background: rgba(8, 11, 26, 0.96); border: 1px solid var(--line2); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); font-size: 13px; font-weight: 700; pointer-events: none; }
#toast .ic { width: 18px; height: 18px; color: var(--acc); }

.up .nm, .wideOnly { display: none; }
/* Широкий екран: пульт ліворуч і праворуч, поле по центру */
body.wide #app { width: auto; flex-direction: row; gap: 16px; align-items: center; justify-content: center; }
body.wide #stage { flex: none; }
#right { display: none; }
body.wide #side, body.wide #right { width: var(--pw, 270px); flex: none; height: var(--fieldH, 560px); padding: 14px; gap: 12px; display: flex; flex-direction: column; background: var(--glass), rgba(10, 13, 30, 0.78); border: 1px solid var(--line); border-radius: var(--r2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 20px 50px rgba(0, 0, 0, 0.45); }
body.wide #hud .stat b { font-size: 21px; }
body.wide #hud .hrow:first-child { flex-wrap: wrap; }
body.wide #hud .hrow:first-child .ibtn:first-child { order: 1; }
body.wide #sideTitle { order: 2; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-align: center; font-family: var(--logo); font-weight: 900; font-size: clamp(11px, calc(var(--pw, 270px) / 21), 15px); letter-spacing: 0.04em; color: var(--text); }
body.wide #sideTitle b { color: var(--acc); font-weight: 900; }
body.wide #hud .hrow:first-child button.ibtn { order: 3; }
body.wide #hud .stats { order: 4; flex: 1 1 100%; }
body.wide #deckInfo { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 6px; }
#deckInfo .di { display: flex; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 11px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
#deckInfo .di .chip { width: 30px; height: 30px; }
#deckInfo .di b { font-size: 12px; display: block; font-weight: 700; }
#deckInfo .di b i { font-style: normal; font-weight: 600; }
#deckInfo .di span { font-size: 11px; color: var(--mute); line-height: 1.3; display: block; }
.lbl, #deckInfo .dl, .upLbl { font-size: 10.5px; font-weight: 700; letter-spacing: 0.16em; color: var(--mute); text-transform: uppercase; }
body.wide #controls .ctl { flex-wrap: wrap; }
body.wide #controls .ctl #summonBtn { order: -1; flex: 1 1 100%; height: 62px; font-size: 18px; }
body.wide #controls .ctl .ibtn { flex: 1; }
body.wide.slim #sideTitle { visibility: hidden; }
body.wide.slim .up .nm { display: none; }
body.wide .wideOnly { display: block; }
body.wide #controls { flex: 1; min-height: 0; }
body.wide #ups { grid-template-columns: 1fr; gap: 6px; flex: 1; min-height: 0; align-content: start; }
body.wide .up { min-height: 46px; flex-direction: row; justify-content: flex-start; gap: 10px; padding: 0 12px 0 8px; font-size: 12px; }
body.wide .up .chip { width: 32px; height: 32px; }
body.wide .up .nm { display: block; flex: 1; text-align: left; font-size: 12.5px; font-weight: 700; color: var(--text); }
body.wide .up b { font-size: 11px; }
body.wide .up .c { min-width: 54px; justify-content: flex-end; font-size: 12px; }
body.wide #hints { margin-top: auto; font-size: 11.5px; line-height: 1.6; color: var(--mute); border-top: 1px solid var(--line); padding-top: 10px; }
body.wide #hints kbd { font-family: var(--font); font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line2); color: var(--text); background: rgba(255, 255, 255, 0.04); }
@media (max-height: 600px) {
    body.wide #ups { gap: 4px; }
    body.wide .up { min-height: 36px; gap: 8px; }
    body.wide .up .chip { width: 26px; height: 26px; }
    body.wide #hints, body.wide .upLbl, body.wide #deckInfo .di div span { display: none; }
    body.wide #deckInfo .di { padding: 4px 8px; }
    body.wide #controls .ctl #summonBtn { height: 50px; }
}

/* ================= ЕКРАНИ Й ВІКНА ================= */
.screen { position: fixed; inset: 0; z-index: 50; background: rgba(3, 4, 12, 0.8); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: max(16px, env(safe-area-inset-top)) var(--pad) max(16px, env(safe-area-inset-bottom)); overflow: hidden; }
/* вікна поверх екрана результату (скриня, новий рівень) — вище за нього */
#towerScreen, #chestScreen, #msgScreen, #mmScreen { z-index: 60; }
.box { background: var(--glass), rgba(11, 14, 32, 0.97); border: 1px solid var(--line2); border-radius: 20px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 30px 80px rgba(0, 0, 0, 0.6); padding: 20px; width: min(420px, 100%); max-height: 100%; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; text-align: center; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.box.wide { width: min(760px, 100%); }
.title { margin: 0; font-size: clamp(22px, 6vmin, 30px); font-weight: 800; letter-spacing: 0.04em; color: var(--text); }
.logoT { font-family: var(--logo); font-weight: 900; letter-spacing: 0.03em; }
.logoT b { color: var(--acc); font-weight: 900; }
.sub { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.26em; color: var(--mute); text-transform: uppercase; }
.btn { min-height: 46px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.045); color: var(--text); font-size: 14px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; transition: background 0.15s, border-color 0.15s, filter 0.15s, transform 0.1s; }
.btn .ic { width: 18px; height: 18px; }
.btn:hover:not(:disabled) { border-color: var(--acc); background: rgba(46, 230, 255, 0.08); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn.pink, .btn.go, .btn.pri { border: 0; color: var(--acc-ink); background: linear-gradient(180deg, #5cf0ff, var(--acc-d)); box-shadow: 0 8px 20px -10px rgba(46, 230, 255, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.btn.go { --mc2: var(--mc, var(--acc)); background: linear-gradient(180deg, color-mix(in srgb, var(--mc2) 70%, #fff), color-mix(in srgb, var(--mc2) 88%, #000)); box-shadow: 0 8px 20px -10px var(--mc2), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.btn.pink:hover:not(:disabled), .btn.go:hover:not(:disabled), .btn.pri:hover:not(:disabled) { filter: brightness(1.08); background: linear-gradient(180deg, #5cf0ff, var(--acc-d)); }
.btn.go:hover:not(:disabled) { background: linear-gradient(180deg, color-mix(in srgb, var(--mc2) 70%, #fff), color-mix(in srgb, var(--mc2) 88%, #000)); }
.btn.dim { background: transparent; border-color: var(--line); color: var(--mute); }
.btn.dim:hover:not(:disabled) { color: var(--text); border-color: var(--line2); background: rgba(255, 255, 255, 0.04); }
.btn.danger { border-color: rgba(255, 90, 110, 0.55); color: #ffb3bd; }
.btn small { display: block; font-size: 11px; font-weight: 600; opacity: 0.8; text-transform: none; letter-spacing: 0; }
.btn.stack { flex-direction: column; gap: 1px; }
.rowb { display: flex; gap: 10px; }
.rowb > * { flex: 1; }
.note { font-size: 12.5px; line-height: 1.45; color: var(--mute); }
.note b { color: var(--text); }
.rules { text-align: left; display: flex; flex-direction: column; gap: 8px; font-size: 13px; line-height: 1.45; overflow-y: auto; min-height: 0; }
.rules div { display: flex; gap: 10px; align-items: flex-start; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; }
.rules div > .ic { width: 18px; height: 18px; margin-top: 1px; color: var(--acc); }
.rules b { color: var(--acc); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-grid > div { background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); border-radius: 12px; padding: 8px 4px; min-width: 0; }
.stat-grid small { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: var(--mute); }
.stat-grid b { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.big { font-size: clamp(38px, 11vmin, 54px); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); text-shadow: 0 0 24px rgba(46, 230, 255, 0.35); }
.badge { align-self: center; padding: 4px 12px; border-radius: 999px; background: var(--gold); color: #1a1200; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; }
.rewards { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.rewards .cur { padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); font-size: 15px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; overflow-y: auto; min-height: 0; text-align: left; }
.ach { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.025); opacity: 0.5; }
.ach.got { opacity: 1; border-color: color-mix(in srgb, var(--gold) 45%, transparent); background: linear-gradient(180deg, rgba(255, 204, 77, 0.07), rgba(255, 204, 77, 0.015)); }
.ach .icw { flex: none; width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line2); color: var(--mute); }
.ach.got .icw { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 50%, transparent); background: rgba(255, 204, 77, 0.08); }
.ach .icw .ic { width: 20px; height: 20px; }
.ach .nm { font-size: 13px; font-weight: 700; }
.ach .ds { font-size: 11.5px; color: var(--mute); line-height: 1.3; }
@media (max-width: 440px) { .grid { grid-template-columns: 1fr; } .box { padding: 18px 14px; } .stat b { font-size: 17px; } }
@media (max-height: 520px) {
    .box { gap: 8px; padding: 12px 16px; width: min(600px, 100%); }
    .box.wide { width: min(820px, 100%); }
    .btn { min-height: 38px; }
    .rules { display: grid; grid-template-columns: 1fr 1fr; font-size: 12px; }
    .ctl .ibtn, #summonBtn { height: 44px; } .up { min-height: 48px; }
}

/* ================= ВЕЖІ: колода, колекція, картка ================= */
.slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.slot { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--glass); min-width: 0; transition: border-color 0.15s, transform 0.12s; }
.slot::after { content: ''; position: absolute; left: 22%; right: 22%; bottom: -1px; height: 2px; border-radius: 2px; background: var(--rc); opacity: 0.9; }
.slot:hover { border-color: color-mix(in srgb, var(--tc) 55%, transparent); }
.slot .chip { width: 44px; height: 44px; }
.slot b { font-size: 11.5px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot small { font-size: 10.5px; color: var(--mute); display: inline-flex; align-items: center; gap: 3px; }
.slot small .ic { width: 11px; height: 11px; color: var(--green); }
.slot.empty { border-style: dashed; justify-content: center; color: var(--dim); min-height: 96px; }
.slot.empty::after { display: none; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.rhead { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
.rhead::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, currentColor, transparent); opacity: 0.35; }
.tc { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--glass); transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s; min-width: 0; }
.tc::before { content: ''; position: absolute; inset: 0 0 auto; height: 2px; border-radius: var(--r) var(--r) 0 0; background: linear-gradient(90deg, transparent, var(--rc), transparent); opacity: 0.85; }
.tc:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--tc) 45%, transparent); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45); }
.tc .chip { width: 58px; height: 58px; margin-bottom: 2px; }
.tc b { font-size: 12.5px; font-weight: 700; }
.tc small { font-size: 11px; font-weight: 600; color: var(--mute); }
.tc.locked b { color: var(--mute); }
.tc.can { border-color: color-mix(in srgb, var(--green) 55%, transparent); }
.tc.sel { border-color: color-mix(in srgb, var(--acc) 70%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--acc) 40%, transparent); }
.tc em { position: absolute; top: 7px; left: 7px; display: inline-flex; align-items: center; gap: 3px; font-style: normal; font-size: 9.5px; font-weight: 800; letter-spacing: 0.06em; padding: 3px 6px; border-radius: 6px; }
.tc em .ic { width: 11px; height: 11px; }
.tc em.nw { background: var(--pink); color: #fff; }
.tc em.dk5 { background: rgba(46, 230, 255, 0.14); color: var(--acc); }
.tc em.upx { left: auto; right: 7px; background: var(--green); color: #032015; padding: 3px 4px; }
.cbar { position: relative; width: 100%; height: 16px; border-radius: 8px; background: rgba(255, 255, 255, 0.07); overflow: hidden; margin-top: 4px; }
.cbar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 8px; background: linear-gradient(90deg, #1688c4, var(--acc)); }
.cbar.full i { background: linear-gradient(90deg, #1f9e6a, var(--green)); }
.cbar span { position: relative; display: flex; align-items: center; justify-content: center; gap: 4px; height: 100%; font-size: 10.5px; font-weight: 800; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.cbar.lock { background: rgba(255, 255, 255, 0.04); } .cbar.lock span { color: var(--mute); font-weight: 700; }
.cbar span .ic { width: 11px; height: 11px; }
/* картка вежі */
.tbox { width: min(560px, 100%); text-align: left; }
.th { display: flex; gap: 16px; align-items: center; }
.th .chip { width: 86px; height: 86px; filter: drop-shadow(0 0 14px color-mix(in srgb, var(--tc) 30%, transparent)); }
.th h2 { margin: 0; font-size: 22px; font-weight: 800; }
.th small { font-size: 12px; font-weight: 700; }
.th p { margin: 4px 0 0; font-size: 13px; line-height: 1.4; color: var(--mute); }
.tstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.tstats > div { padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); }
.tstats small { display: block; font-size: 11px; color: var(--mute); }
.tstats b { font-size: 15px; font-weight: 800; }
.upbox { display: flex; gap: 10px; align-items: center; }
.upbox .cbar { flex: 1; height: 26px; margin: 0; border-radius: 10px; } .upbox .cbar i { border-radius: 10px; } .upbox .cbar span { font-size: 12px; }
.upbox .btn { flex: none; }
.tree { display: flex; flex-direction: column; gap: 8px; }
.tier { display: grid; grid-template-columns: 70px 1fr auto 1fr; gap: 8px; align-items: stretch; }
.tier .tl { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; color: var(--mute); display: flex; align-items: center; gap: 4px; }
.tier .tl .ic { width: 13px; height: 13px; }
.tier.shut .tl { color: var(--gold); }
.tier .or { font-style: normal; font-size: 11px; color: var(--dim); align-self: center; }
.node { text-align: left; padding: 9px 11px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.025); display: flex; flex-direction: column; gap: 3px; transition: border-color 0.15s, background 0.15s; }
.node b { font-size: 12.5px; font-weight: 700; display: flex; align-items: center; gap: 5px; }
.node b .ic { width: 13px; height: 13px; color: var(--green); }
.node span { font-size: 11.5px; color: var(--mute); line-height: 1.35; }
.node:not(:disabled):hover { border-color: var(--line2); }
.node.on { border-color: color-mix(in srgb, var(--green) 60%, transparent); background: rgba(62, 229, 154, 0.08); }
.tier.shut .node { opacity: 0.4; }
@media (max-width: 480px) { .tier { grid-template-columns: 1fr 1fr; } .tier .tl { grid-column: 1 / -1; } .tier .or { display: none; } }

/* ================= СКРИНІ ================= */
.chests { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.chest { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px 12px; border-radius: var(--r); border: 1px solid var(--line); background: radial-gradient(90% 60% at 50% 0%, color-mix(in srgb, var(--cc) 12%, transparent), transparent 70%), var(--glass); text-align: center; }
.chest .chestic { width: 64px; height: 64px; filter: drop-shadow(0 6px 14px color-mix(in srgb, var(--cc) 30%, transparent)); }
.chest b { font-size: 13px; font-weight: 700; }
.chest small { font-size: 11.5px; color: var(--mute); line-height: 1.35; }
.chest .btn { width: 100%; min-height: 40px; margin-top: auto; }
.cbig { width: 110px; height: 110px; margin: 0 auto; animation: chestPop 0.5s ease-out; filter: drop-shadow(0 10px 26px color-mix(in srgb, var(--cc) 45%, transparent)); }
.cbig .chestic, .cbig .ic { width: 100%; height: 100%; }
.cbig.lvl { color: var(--gold); width: 84px; height: 84px; }
.coinline { display: flex; justify-content: center; gap: 12px; font-size: 22px; font-weight: 800; }
.loot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.lc { position: relative; width: 96px; padding: 12px 4px 9px; border-radius: var(--r); border: 1px solid color-mix(in srgb, var(--rc) 50%, transparent); background: var(--glass); display: flex; flex-direction: column; align-items: center; gap: 3px; opacity: 0; animation: cardIn 0.4s ease-out forwards; }
.lc .chip { width: 50px; height: 50px; }
.lc b { font-size: 11.5px; font-weight: 700; } .lc small { font-size: 15px; font-weight: 800; color: var(--text); }
.lc em { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 9.5px; font-weight: 800; padding: 2px 7px; border-radius: 6px; background: var(--pink); white-space: nowrap; }
@keyframes chestPop { 0% { transform: scale(0.3) rotate(-10deg); } 70% { transform: scale(1.12) rotate(3deg); } 100% { transform: scale(1); } }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) rotateY(80deg); } to { opacity: 1; transform: none; } }

/* ================= ХАБ ================= */
.screen.hub { background: radial-gradient(120% 60% at 50% -10%, #161d45 0%, var(--bg) 60%); backdrop-filter: none; -webkit-backdrop-filter: none; padding: 0; justify-content: stretch; }
.hubBox { width: min(1000px, 100%); height: 100%; display: flex; flex-direction: column; min-height: 0; }
.hubTop { display: flex; align-items: center; gap: 12px; padding: max(12px, env(safe-area-inset-top)) var(--pad) 12px; border-bottom: 1px solid var(--line); background: rgba(6, 8, 20, 0.6); }
.pfl { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; text-align: left; }
.pfl .av { flex: none; width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 800; color: var(--acc); background: rgba(46, 230, 255, 0.08); border: 1px solid color-mix(in srgb, var(--acc) 45%, transparent); position: relative; }
.pfl .av i { position: absolute; right: -7px; bottom: -7px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 8px; background: var(--bg2); border: 1px solid var(--gold); color: var(--gold); font-style: normal; font-size: 11px; font-weight: 800; line-height: 20px; text-align: center; }
.pfl .nm { display: block; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
.xpbar { position: relative; width: 130px; max-width: 34vw; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 5px; }
.xpbar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #ffb347, var(--gold)); border-radius: 3px; }
.pfl small { display: block; font-size: 11px; color: var(--mute); margin-top: 3px; font-variant-numeric: tabular-nums; }
.wallet { display: flex; gap: 8px; flex: none; }
.wallet span { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); font-size: 14px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wallet span .ic { width: 17px; height: 17px; }
.hubMain { flex: 1; min-height: 0; position: relative; }
.mtab { position: absolute; inset: 0; overflow-y: auto; padding: var(--pad) var(--pad) 24px; display: flex; flex-direction: column; gap: 14px; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.mtab::-webkit-scrollbar { width: 6px; } .mtab::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 3px; }
.hubNav { display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; gap: 4px; padding: 8px 10px max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(6, 8, 20, 0.92); }
.hubNav > button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px 6px; border-radius: 12px; color: var(--dim); transition: color 0.15s, background 0.15s; }
.hubNav > button .ic { width: 24px; height: 24px; }
.hubNav > button span { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; }
.hubNav > button.on { color: var(--acc); }
.hubNav > button.on::before { content: ''; position: absolute; top: -9px; left: 30%; right: 30%; height: 2px; border-radius: 2px; background: var(--acc); box-shadow: 0 0 10px var(--acc); }
.hubNav button.main { justify-self: center; width: min(100%, 92px); padding: 9px 2px 7px; color: var(--acc-ink); background: linear-gradient(180deg, #5cf0ff, var(--acc-d)); box-shadow: 0 8px 22px -10px rgba(46, 230, 255, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.hubNav button.main.on::before { display: none; }
.hubNav button.main:not(.on) { filter: saturate(0.75) brightness(0.9); }
.bdg { position: absolute; top: 2px; right: 18%; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--pink); color: #fff; font-style: normal; font-size: 10.5px; font-weight: 800; line-height: 18px; text-align: center; }
.sect { font-size: 11px; font-weight: 700; letter-spacing: 0.16em; color: var(--mute); text-transform: uppercase; text-align: left; display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.sect::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.sect .tmr { letter-spacing: 0; text-transform: none; font-weight: 600; color: var(--dim); }
.card { border-radius: var(--r2); border: 1px solid var(--line); background: var(--glass); padding: 14px; text-align: left; }

/* ---------- Бій: логотип і режими ---------- */
.logo { text-align: center; padding: 6px 0 2px; }
.logo .title { font-size: clamp(26px, 7.4vw, 40px); }
.logo .sub { margin-top: 6px; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 760px) { .modes { grid-template-columns: 1fr; } }
.mode { --mc: var(--acc); position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r2); border: 1px solid color-mix(in srgb, var(--mc) 30%, var(--line)); background: radial-gradient(110% 90% at 100% 0%, color-mix(in srgb, var(--mc) 13%, transparent), transparent 60%), var(--glass); overflow: hidden; text-align: left; }
.mode .mh { display: flex; align-items: center; gap: 12px; }
.mode .mi { flex: none; width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; color: var(--mc); background: color-mix(in srgb, var(--mc) 10%, transparent); border: 1px solid color-mix(in srgb, var(--mc) 40%, transparent); }
.mode .mi .ic { width: 24px; height: 24px; }
.mode h3 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: 0.04em; }
.mode .md { font-size: 13px; color: var(--mute); line-height: 1.45; }
.mode .ms { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--mc); font-weight: 700; margin-top: 1px; }
.mode .ms .ic { width: 14px; height: 14px; }
.mode .btns { display: flex; gap: 8px; margin-top: auto; }
.mode .btns .btn { flex: 1; }
.mode.lock { filter: saturate(0.35); }
.mode .lockTag { position: absolute; top: 14px; right: 14px; display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 8px; background: rgba(0, 0, 0, 0.5); border: 1px solid color-mix(in srgb, var(--gold) 60%, transparent); color: var(--gold); font-size: 11px; font-weight: 800; }
.mode .lockTag .ic { width: 12px; height: 12px; }

/* ---------- щоденні завдання ---------- */
.quests { display: flex; flex-direction: column; gap: 8px; }
.quest { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--glass); border: 1px solid var(--line); }
.quest .qt { flex: 1; min-width: 0; }
.quest .qt b { display: block; font-size: 13.5px; font-weight: 700; }
.quest .qbar { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 8px; }
.quest .qbar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--acc-d), var(--acc)); }
.quest .qr { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12px; font-weight: 800; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.quest .qr .rw { display: flex; gap: 8px; font-size: 11.5px; }
.quest.done { border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.quest.done .qbar i { background: linear-gradient(90deg, #1f9e6a, var(--green)); }
.quest.claimed { opacity: 0.45; }
.quest.claimed .qr { color: var(--green); }
.quest .btn { min-height: 38px; padding: 0 14px; font-size: 12.5px; }

/* ---------- колода й пресети ---------- */
.deckHead { display: flex; align-items: center; gap: 10px; }
.deckHead .sect { margin-top: 0; }
.presets { display: flex; gap: 6px; margin-left: auto; }
.presets button { width: 36px; height: 32px; border-radius: 9px; border: 1px solid var(--line2); font-size: 13px; font-weight: 800; color: var(--mute); }
.presets button.on { color: var(--acc-ink); background: var(--acc); border-color: var(--acc); }
.footrow { display: flex; gap: 8px; }
.footrow .btn { flex: 1; min-height: 44px; padding: 0 8px; font-size: 12px; }
.footrow .btn.sq { flex: 0 0 48px; }

/* ---------- кейси ---------- */
.cslots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 560px) { .cslots { grid-template-columns: repeat(2, 1fr); } }
.cslot { position: relative; min-height: 168px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px 10px; border-radius: var(--r); border: 1px dashed var(--line2); background: rgba(255, 255, 255, 0.015); text-align: center; }
.cslot.full { border: 1px solid color-mix(in srgb, var(--cc) 35%, var(--line)); background: radial-gradient(90% 60% at 50% 0%, color-mix(in srgb, var(--cc) 12%, transparent), transparent 70%), var(--glass); }
.cslot.ready { border-color: color-mix(in srgb, var(--green) 60%, transparent); animation: rdy 1.8s ease-in-out infinite; }
@keyframes rdy { 50% { transform: translateY(-3px); } }
.cslot .chestic { width: 58px; height: 58px; }
.cslot b { font-size: 12.5px; font-weight: 700; }
.cslot .tm { display: inline-flex; align-items: center; gap: 4px; font-size: 15px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.cslot .tm .ic { width: 14px; height: 14px; color: var(--mute); }
.cslot .tm.ok { color: var(--green); }
.cslot .tbar { width: 100%; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.cslot .tbar i { display: block; height: 100%; background: var(--cc); }
.cslot .btn { width: 100%; min-height: 38px; padding: 0 6px; font-size: 11.5px; }
.cslot .empty { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); line-height: 1.4; }
.cslot .empty .ic { width: 28px; height: 28px; opacity: 0.6; }

/* ---------- магазин ---------- */
.offers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 520px) { .offers { grid-template-columns: repeat(2, 1fr); } }
.offer { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 10px 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--glass); text-align: center; }
.offer::before { content: ''; position: absolute; inset: 0 0 auto; height: 2px; border-radius: var(--r) var(--r) 0 0; background: linear-gradient(90deg, transparent, var(--rc), transparent); }
.offer .chip { width: 58px; height: 58px; margin-bottom: 2px; }
.offer b { font-size: 13px; font-weight: 700; }
.offer .n { font-size: 17px; font-weight: 800; }
.offer small { font-size: 11px; font-weight: 700; }
.offer .btn { width: 100%; min-height: 40px; margin-top: 4px; }
.offer.sold { opacity: 0.4; }

/* ---------- рейтинг ---------- */
.subtabs { display: flex; gap: 8px; }
.subtabs button { flex: 1; min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 11px; border: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--mute); }
.subtabs button .ic { width: 16px; height: 16px; }
.subtabs button.on { color: var(--text); border-color: color-mix(in srgb, var(--acc) 60%, transparent); background: rgba(46, 230, 255, 0.08); }
.board { display: flex; flex-direction: column; gap: 6px; }
.brow { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid transparent; font-size: 13.5px; }
.brow .rk { width: 26px; text-align: center; font-weight: 800; color: var(--dim); font-variant-numeric: tabular-nums; }
.brow:nth-child(1) .rk { color: var(--gold); } .brow:nth-child(2) .rk { color: #cbd5e1; } .brow:nth-child(3) .rk { color: #e0904a; }
.brow .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.brow .v { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.brow .v .ic { width: 14px; height: 14px; color: #ffb347; }
.brow.me { border-color: color-mix(in srgb, var(--acc) 50%, transparent); background: rgba(46, 230, 255, 0.06); }
.arena { --ac: var(--gold); display: flex; align-items: center; gap: 14px; }
.arena .ai { flex: none; width: 58px; height: 58px; border-radius: 16px; display: flex; align-items: center; justify-content: center; color: var(--ac); border: 1px solid color-mix(in srgb, var(--ac) 50%, transparent); background: color-mix(in srgb, var(--ac) 10%, transparent); }
.arena .ai .ic { width: 30px; height: 30px; }
.arena b { font-size: 16px; color: var(--ac); }
.arena .md { font-size: 12.5px; color: var(--mute); line-height: 1.45; margin-top: 2px; }

/* ---------- пошук / кімната ---------- */
.mm { width: min(420px, 100%); }
.mm .spin { width: 64px; height: 64px; margin: 6px auto; border-radius: 50%; border: 3px solid rgba(46, 230, 255, 0.14); border-top-color: var(--acc); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.mm .code { font-size: 34px; font-weight: 800; letter-spacing: 0.3em; color: var(--gold); font-variant-numeric: tabular-nums; }
.mm input { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(0, 0, 0, 0.35); color: var(--text); font: 800 22px var(--font); letter-spacing: 0.3em; text-align: center; text-transform: uppercase; outline: none; }
.mm input:focus { border-color: var(--acc); }
.mm .pl { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); font-size: 13.5px; text-align: left; }
.mm .pl .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.mm .pl.wait .dot { background: var(--dim); box-shadow: none; }
.mm .pl .ic { width: 14px; height: 14px; color: var(--gold); }
.vs { display: flex; align-items: center; justify-content: center; gap: 14px; }
.vs .side { flex: 1; text-align: center; min-width: 0; }
.vs .side b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs .side small { display: inline-flex; align-items: center; gap: 4px; color: var(--gold); font-weight: 800; }
.vs .side small .ic { width: 13px; height: 13px; }
.vs .x { font-size: 26px; font-weight: 800; color: var(--pink); }
.mmh { display: flex; align-items: center; justify-content: center; gap: 10px; }
.mmh .ic { width: 24px; height: 24px; color: var(--acc); }

/* ================= ХАБ НА ПК: бічна панель ================= */
.sideLogo, .navExtra, .wl { display: none; }
@media (min-width: 1000px) {
    :root { --pad: 26px; }
    .screen.hub { padding: 16px; justify-content: center; }
    .hubBox { width: min(1600px, 100%); height: min(100%, 980px); display: grid; grid-template-columns: 260px 1fr; grid-template-rows: auto 1fr; grid-template-areas: "top main" "nav main";
        border: 1px solid var(--line); border-radius: 24px; background: var(--glass), rgba(8, 10, 24, 0.72); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 30px 80px rgba(0, 0, 0, 0.55); overflow: hidden; }
    .hubTop { grid-area: top; flex-direction: column; align-items: stretch; gap: 16px; padding: 22px 18px 14px; border-bottom: 0; border-right: 1px solid var(--line); background: transparent; }
    .sideLogo { display: block; text-align: center; padding-bottom: 4px; }
    .sideLogo .title { display: block; font-size: 20px; }
    .sideLogo .sub { display: block; margin-top: 6px; font-size: 9.5px; letter-spacing: 0.2em; }
    .pfl { padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); transition: border-color 0.15s; }
    .pfl:hover { border-color: var(--line2); }
    .pfl .nm { max-width: 150px; }
    .xpbar { width: 150px; max-width: 150px; }
    .wallet { flex-direction: column; gap: 6px; }
    .wallet span { height: 40px; padding: 0 14px; font-size: 15px; }
    .hubNav { grid-area: nav; display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 6px 14px 16px; border-top: 0; border-right: 1px solid var(--line); background: transparent; }
    .hubNav > button { flex-direction: row; justify-content: flex-start; align-items: center; gap: 12px; padding: 12px 14px; color: var(--mute); }
    .hubNav > button span { font-size: 13px; letter-spacing: 0.08em; }
    .hubNav > button:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
    .hubNav > button.on { color: var(--text); background: rgba(46, 230, 255, 0.08); }
    .hubNav > button.on::before { top: 10px; bottom: 10px; left: 0; right: auto; width: 3px; height: auto; }
    .hubNav > button.on .ic { color: var(--acc); }
    .hubNav button.main { order: -1; justify-self: stretch; width: auto; margin: 0 0 8px; padding: 14px; justify-content: center; }
    .hubNav button.main .ic { color: var(--acc-ink) !important; }
    .hubNav .bdg { position: static; margin-left: auto; }
    .navExtra { display: flex; gap: 6px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
    .navExtra > * { flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px; height: 42px; border-radius: 11px; border: 1px solid var(--line); color: var(--mute); font-size: 11px; font-weight: 700; }
    .navExtra > * .ic { width: 18px; height: 18px; }
    .navExtra > *:hover { color: var(--text); border-color: var(--line2); }
    .hubMain { grid-area: main; }
    .mtab { gap: 18px; }
    #tab_play { display: grid; grid-template-columns: 1.1fr 1fr; grid-template-areas: "modes modes" "q d"; align-content: start; column-gap: 24px; row-gap: 22px; }
    #tab_play .logo, #tab_play .footrow { display: none; }
    #tab_play .modes { grid-area: modes; }
    #tab_play .modes .mode { min-height: 240px; padding: 20px; gap: 12px; }
    #tab_play .mode .mi { width: 56px; height: 56px; border-radius: 15px; }
    #tab_play .mode .mi .ic { width: 28px; height: 28px; }
    #tab_play .mode h3 { font-size: 22px; }
    #tab_play .mode .md { font-size: 14px; }
    .wl { display: inline; flex: 1; font-size: 11px; letter-spacing: 0.1em; color: var(--mute); text-transform: uppercase; font-weight: 700; }
    .playQ { grid-area: q; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
    .playD { grid-area: d; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
    .playD .slot { padding: 20px 4px 16px; gap: 6px; }
    .playD .slot .chip { width: 62px; height: 62px; }
    .playD .slot b { font-size: 13px; }
    #tab_deck { display: grid; grid-template-columns: 300px 1fr; column-gap: 26px; align-items: start; }
    .deckCol { position: sticky; top: 0; display: flex; flex-direction: column; gap: 10px; }
    .deckCol .slots { grid-template-columns: 1fr; gap: 6px; }
    .deckCol .slot { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; text-align: left; }
    .deckCol .slot::after { left: 0; right: auto; top: 22%; bottom: 22%; width: 2px; height: auto; }
    .deckCol .slot .chip { width: 38px; height: 38px; }
    .deckCol .slot b { font-size: 13px; flex: 1; }
    .deckCol .slot.empty { justify-content: center; min-height: 58px; }
    #tab_deck .tgrid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); align-content: start; }
    #tab_rank { display: grid; grid-template-columns: 340px 1fr; column-gap: 26px; align-items: start; }
    .rankL { display: flex; flex-direction: column; gap: 12px; }
    .rankL .arena { flex-direction: column; text-align: center; }
    .rankL .subtabs { flex-direction: column; }
    .cslot { min-height: 200px; }
    .offers { grid-template-columns: repeat(4, minmax(0, 210px)); }
    .chests { grid-template-columns: repeat(auto-fill, minmax(200px, 230px)); }
}
@media (max-width: 420px) {
    :root { --pad: 14px; }
    .tgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .tc { padding: 13px 4px 9px; }
    .tc .chip { width: 48px; height: 48px; }
    .tc b { font-size: 11.5px; }
    .slots { gap: 6px; }
    .slot { padding: 10px 2px 9px; }
    .slot .chip { width: 38px; height: 38px; }
    .slot b { font-size: 10.5px; }
    .wallet span { padding: 0 10px; font-size: 13px; }
    .hubNav > button span { font-size: 10px; letter-spacing: 0.03em; }
    .footrow .btn { font-size: 11px; }
}
@media (max-height: 520px) { .slot small, .tc small { display: none; } }

/* ---------- бій: панель партнера / суперника ---------- */
#mpBar { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; border-radius: 12px; background: var(--glass), rgba(10, 13, 30, 0.82); border: 1px solid var(--line); font-size: 12px; }
#mpBar #mpIcon .ic { width: 16px; height: 16px; color: var(--mute); }
#mpBar .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
#mpBar .hpb { width: 70px; height: 5px; border-radius: 3px; background: rgba(255, 77, 157, 0.16); overflow: hidden; }
#mpBar .hpb i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), #ff9a5a); }
#mpBar .btn { min-height: 32px; padding: 0 10px; font-size: 11px; }
#netWarn { position: fixed; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 85; display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px; background: rgba(80, 14, 26, 0.95); border: 1px solid rgba(255, 90, 110, 0.7); font-size: 12px; font-weight: 700; }
#tip .tipchip { width: 30px; height: 30px; }

/* ---------- «Рівні умови»: колода в картці режиму й вибір веж ---------- */
.eqdeck { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-radius: 12px; border: 1px dashed color-mix(in srgb, var(--mc) 45%, transparent); background: rgba(255, 255, 255, 0.02); }
.eqdeck .chip { width: 34px; height: 34px; }
.eqdeck span { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--mc); }
.eqdeck span .ic { width: 15px; height: 15px; }
.eqdeck:hover { border-style: solid; }
.eqgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.eqt { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 4px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass); min-width: 0; }
.eqt .chip { width: 44px; height: 44px; }
.eqt b { font-size: 11.5px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eqt small { font-size: 10px; font-weight: 600; }
.eqt.on { border-color: color-mix(in srgb, var(--acc) 70%, transparent); background: rgba(46, 230, 255, 0.07); }
.eqt em { position: absolute; top: 5px; right: 6px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--acc); color: var(--acc-ink); font-style: normal; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; }
#auraLine { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 2px; font-size: 11.5px; font-weight: 700; color: var(--mute); }
#auraLine .cur { font-size: 11.5px; }
#auraLine .cur.d { color: #e2e8f0; } #auraLine .cur.r { color: #a5b4fc; }
@media (min-width: 1300px) { .modes { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 761px) and (max-width: 1299px) { .modes { grid-template-columns: repeat(2, 1fr); } }

/* ---------- хрестик закриття, що лишається вгорі довгого вікна ---------- */
.box .boxx { position: sticky; top: -8px; align-self: flex-end; z-index: 3; flex: none; width: 40px; height: 40px; margin: -8px -8px -44px 0; display: flex; align-items: center; justify-content: center; border-radius: 12px; border: 1px solid var(--line2); background: rgba(11, 14, 32, 0.92); color: var(--text); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45); }
.box .boxx .ic { width: 20px; height: 20px; }
.box .boxx:hover { border-color: var(--acc); }
.box .th, .box > .title:first-of-type { padding-right: 44px; }
.eqt { -webkit-touch-callout: none; touch-action: manipulation; }

/* ---------- картка покращення (затиснути кнопку під «Призвати») ---------- */
/* кнопка покращення: сума рівнів веж цього типу на полі */
.up { position: relative; }
.up .lvn { position: absolute; top: 3px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: rgba(46, 230, 255, 0.16); border: 1px solid rgba(46, 230, 255, 0.45); color: var(--acc); font-size: 10px; font-weight: 800; font-style: normal; line-height: 14px; text-align: center; font-variant-numeric: tabular-nums; }
body.wide .up .lvn { top: 2px; right: auto; left: 26px; }
/* екран результату: шкода веж */
.dmgStats:empty { display: none; }
.dmgStats { display: flex; flex-direction: column; gap: 5px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); text-align: left; }
.dmgH { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: var(--mute); text-transform: uppercase; }
.dmgR { display: grid; grid-template-columns: 22px 92px 1fr 48px 34px; align-items: center; gap: 8px; font-size: 12px; }
.dmgR .chip { width: 22px; height: 22px; }
.dmgR .dn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dmgR .db { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.dmgR .db i { display: block; height: 100%; border-radius: 3px; background: var(--tc); }
.dmgR b { text-align: right; font-variant-numeric: tabular-nums; }
.dmgR small { text-align: right; color: var(--mute); font-variant-numeric: tabular-nums; }
@media (max-width: 400px) { .dmgR { grid-template-columns: 20px 74px 1fr 42px 30px; gap: 6px; font-size: 11px; } }
.up { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.up.dis { opacity: 0.42; cursor: default; }
.up.dis:hover { border-color: var(--line); }
#upInfo { position: fixed; z-index: 45; width: min(340px, calc(100vw - 16px)); padding: 12px; border-radius: 14px; background: rgba(8, 11, 26, 0.97); border: 1px solid var(--line2); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6); font-size: 13px; color: var(--text); display: flex; flex-direction: column; gap: 8px; }
#upInfo .uh { display: flex; align-items: center; gap: 10px; }
#upInfo .uh .chip { width: 36px; height: 36px; flex: none; }
#upInfo .uh b { font-size: 15px; }
#upInfo .uh small { display: block; color: var(--mute); font-size: 12px; }
#upInfo p { margin: 0; color: #c7d2fe; line-height: 1.4; }
#upInfo .ur { display: grid; grid-template-columns: 56px 1fr; gap: 6px; line-height: 1.35; font-size: 12.5px; }
#upInfo .ur > span { color: var(--mute); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding-top: 2px; }
#upInfo .ur.nx { color: #7dffb2; margin-top: -4px; }
#upInfo .ur small { color: #7dffb2; }
#upInfo .unote { color: var(--mute); font-size: 12px; }
#upInfo .btn { margin: 2px 0 0; }
.eqold { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; line-height: 1.45; color: var(--mute); }
.eqold .mini { display: flex; gap: 6px; }
.eqold .mini .chip { width: 26px; height: 26px; }
.eqwarn { color: #fcd38d; }

/* ---------- дрібні виправлення відступів ---------- */
.deckCol { display: flex; flex-direction: column; gap: 12px; }
.tc { padding-top: 30px; }
.tc em { top: 8px; }
.stat-grid .mini { display: flex; justify-content: center; gap: 2px; }
.stat-grid .mini .chip { width: 20px; height: 20px; }
@media (max-width: 560px) {
    .offers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .offer { padding: 12px 6px 8px; }
    .offer .chip { width: 46px; height: 46px; }
    .offer b { font-size: 12px; } .offer .n { font-size: 15px; } .offer small { font-size: 10px; }
    .offer .btn { padding: 0 4px; min-height: 38px; font-size: 13px; }
}
@media (min-width: 1000px) {
    .hubNav > button.main, .hubNav > button.main:hover { color: var(--acc-ink); background: linear-gradient(180deg, #5cf0ff, var(--acc-d)); }
    .hubNav > button.main.on::before { display: none; }
    .tc { padding-top: 30px; }
}
.btn { white-space: nowrap; }
.mode .btns .btn { padding: 0 10px; }
.eqdeck { gap: 3px; padding: 7px 8px; }
.eqdeck span { white-space: nowrap; }
@media (min-width: 1300px) {
    .eqdeck .chip { width: 28px; height: 28px; }
    .mode .btns .btn { font-size: 12.5px; gap: 6px; }
}
.rankL { display: flex; flex-direction: column; gap: 12px; }

/* ---------- челендж ---------- */
.chdeck .chsep { width: 1px; align-self: stretch; margin: 2px 4px; background: color-mix(in srgb, var(--mc) 55%, transparent); }
.chtop { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 12px; color: var(--mute); }
.chtop:empty { display: none; }
.chtop .me { color: var(--mc); font-weight: 700; }
.chman { display: flex; gap: 10px; flex-wrap: wrap; }
.chman span { display: flex; align-items: center; gap: 6px; padding: 6px 10px 6px 6px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--tc) 45%, transparent); background: rgba(255, 255, 255, 0.03); font-size: 13px; }
.chman .chip { width: 30px; height: 30px; }
