/* Bubble Peak — стилі. Шрифт Nunito (OFL-1.1), вбудований. */
@font-face { font-family: 'Nunito'; font-weight: 200 1000; font-display: swap; src: url(../fonts/nunito-cyrillic-ext.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Nunito'; font-weight: 200 1000; font-display: swap; src: url(../fonts/nunito-cyrillic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Nunito'; font-weight: 200 1000; font-display: swap; src: url(../fonts/nunito-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Nunito'; font-weight: 200 1000; font-display: swap; src: url(../fonts/nunito-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg1: #23185a; --bg2: #0f0b29; --ink: #fff; --muted: #b8b0e8; --dim: #8f86c4;
  --panel: #2b2168; --panel2: #382b85; --line: #ffffff1f;
  --good: #5be38a; --perfect: #ffd84a; --burst: #ff5470; --under: #a3a8d3;
  --r0: #b9bfd8; --r1: #4fb0ff; --r2: #c27dff; --r3: #ffab3d;
  --ff: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg2);
  background-image:
    radial-gradient(circle at 12% 18%, #ffffff10 0 22px, transparent 23px),
    radial-gradient(circle at 86% 30%, #ffffff0c 0 34px, transparent 35px),
    radial-gradient(circle at 70% 82%, #ffffff0a 0 46px, transparent 47px),
    radial-gradient(circle at 22% 70%, #ffffff08 0 14px, transparent 15px),
    radial-gradient(120% 75% at 50% 0%, #46309e 0%, var(--bg1) 45%, var(--bg2) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font: 700 15px/1.35 var(--ff);
  user-select: none; -webkit-user-select: none;
  overscroll-behavior: none;
}
#app {
  max-width: 480px; margin: 0 auto; min-height: 100dvh;
  padding: max(10px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
button:disabled { cursor: default; opacity: .42; }
h2 { margin: 0 0 10px; font-size: 22px; font-weight: 900; }
h3 { margin: 16px 0 8px; font-size: 15px; font-weight: 900; color: var(--muted); }
h3 small { font-weight: 800; color: var(--dim); }
p { margin: 0 0 10px; }
.ico { width: 1.2em; height: 1.2em; display: inline-block; vertical-align: -.22em; flex: none; }
.muted { color: var(--dim); }

/* ---------- кнопки ---------- */
.big {
  display: block; width: 100%; margin-top: 10px; padding: 14px 16px; border-radius: 18px;
  background: var(--panel2); font-size: 17px; font-weight: 900;
  box-shadow: 0 4px 0 #0005; transition: transform .08s;
}
.big:active { transform: translateY(3px); box-shadow: 0 1px 0 #0005; }
.big.primary { background: linear-gradient(180deg, #ff7aa8, #ff4f7e); box-shadow: 0 4px 0 #b02857; }
.big.danger { background: linear-gradient(180deg, #ff6b6b, #e23d55); box-shadow: 0 4px 0 #8f1f33; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px;
  background: #ffffff14; font-size: 13px; font-weight: 800;
}
.pill.on { background: #5be38a33; color: #b8ffd0; }
.link { align-self: center; margin: -2px 0 6px; padding: 4px 10px; color: var(--dim); font-size: 13px; text-decoration: underline; }
.ib { width: 40px; height: 40px; border-radius: 14px; background: #ffffff14; display: grid; place-items: center; font-size: 20px; }
.coins { display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px 6px 7px; border-radius: 999px; background: #0004; font-weight: 900; }
.coins .ico { width: 20px; height: 20px; }
.buy {
  display: inline-flex; align-items: center; gap: 4px; padding: 7px 11px; border-radius: 12px;
  background: linear-gradient(180deg, #ffd65a, #f3a712); color: #4a2a00; font-weight: 900; box-shadow: 0 3px 0 #a06300;
}
.buy .ico { width: 16px; height: 16px; }
.buy:disabled { background: #ffffff1c; color: #fff9; box-shadow: none; }

/* ---------- головна ---------- */
.home { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.htop { display: flex; align-items: center; justify-content: space-between; padding-top: 6px; }
.logo { position: relative; padding-left: 58px; font-size: 26px; line-height: .95; font-weight: 1000; letter-spacing: -.5px; }
.logo b { background: linear-gradient(180deg, #fff, #ffd1ea); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lb { position: absolute; border-radius: 50%; box-shadow: inset -3px -4px 0 #0002, inset 3px 3px 0 #fff6; }
.lb.b1 { width: 30px; height: 30px; left: 0; top: 14px; background: #ff5d73; }
.lb.b2 { width: 22px; height: 22px; left: 22px; top: 2px; background: #3fa7ff; }
.lb.b3 { width: 18px; height: 18px; left: 30px; top: 28px; background: #ffc23c; }
.rankcard {
  display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: 22px;
  background: linear-gradient(135deg, #ffffff18, #ffffff08); border: 1px solid var(--line);
}
.rk-name { font-size: 22px; font-weight: 1000; }
.rk-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stars { display: flex; gap: 2px; margin-top: 3px; }
.st .ico { width: 24px; height: 24px; color: #ffffff2a; }
.st.on .ico { color: #ffd84a; filter: drop-shadow(0 0 6px #ffd84a88); }
.lp { color: #ffd84a; font-weight: 900; }

.emb { position: relative; width: 54px; height: 54px; flex: none; }
.emb.big { width: 70px; height: 70px; }
.emb-g { position: absolute; inset: 0; clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); background: var(--tg); }
.emb-b { position: absolute; inset: 24%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 14%, #ffffffaa 15%, #ffffff33 55%, #ffffff11); box-shadow: inset 0 -3px 6px #0003; }
.tier-bronze { --tg: linear-gradient(160deg, #f0a46a, #a35a2b 60%, #6e3815); }
.tier-silver { --tg: linear-gradient(160deg, #f4f7fc, #a9b3c6 60%, #6f7a8f); }
.tier-gold { --tg: linear-gradient(160deg, #fff09a, #f0b322 55%, #a86d00); }
.tier-platinum { --tg: linear-gradient(160deg, #b8fff4, #3cc7b6 55%, #157a70); }
.tier-diamond { --tg: linear-gradient(160deg, #d6e8ff, #6f86ff 55%, #5a2fd6); }
.tier-legend { --tg: conic-gradient(from 30deg, #ff5d73, #ffc23c, #4fcf6a, #3fa7ff, #c27dff, #ff5d73); }
.rankcard.tier-legend { border-color: #ffd84a66; }

.mode {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; border-radius: 22px; text-align: left;
  box-shadow: 0 5px 0 #0005; transition: transform .08s;
}
.mode:active { transform: translateY(3px); box-shadow: 0 2px 0 #0005; }
.mode .mi { width: 46px; height: 46px; border-radius: 15px; background: #ffffff2e; display: grid; place-items: center; flex: none; }
.mode .mi .ico { width: 26px; height: 26px; }
.mode .mt { display: flex; flex-direction: column; gap: 2px; }
.mode .mt b { font-size: 19px; font-weight: 1000; }
.mode .mt small { font-size: 13px; opacity: .85; font-weight: 700; }
.mode.ranked { background: linear-gradient(135deg, #ff7aa8, #ff5470 55%, #ff8a3d); }
.mode.tower { background: linear-gradient(135deg, #3fa7ff, #5b6dff 60%, #8a4dff); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.row3 .mode.small { flex-direction: column; justify-content: center; gap: 6px; padding: 12px 6px; text-align: center; }
.row3 .mode.small b { font-size: 13px; line-height: 1.1; }
.rk { min-width: 0; }
.rk-who { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; margin-bottom: 1px; color: var(--muted); font-size: 14px; font-weight: 900; }
.rk-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-who .ico { width: 14px; height: 14px; opacity: .7; }
.emb.sm { width: 34px; height: 34px; }
.emb.unknown .emb-g { background: #ffffff26; }
.emb.unknown { animation: seek 1.1s ease-in-out infinite; }
@keyframes seek { 0%, 100% { transform: scale(1); opacity: .6; } 50% { transform: scale(1.08); opacity: 1; } }
.vs-side.seek { animation-delay: 0s; }
.tagp { padding: 4px 12px; border-radius: 999px; background: #5be38a26; color: #b8ffd0; font-size: 13px; font-weight: 900; }
.up { color: var(--good); font-weight: 900; } .down { color: var(--burst); font-weight: 900; }

/* поле імені */
.inp {
  display: block; width: 100%; margin: 6px 0 6px; padding: 13px 14px; border-radius: 14px; border: 2px solid #ffffff2a;
  background: #0004; color: #fff; font: 900 18px var(--ff); outline: none; user-select: text; -webkit-user-select: text;
}
.inp:focus { border-color: #ff9ad7; }
.nm-hint { font-size: 12px; color: var(--muted) !important; }
.nm-hint.bad { color: #ffb3c0 !important; }
.mode.small { background: var(--panel); padding: 12px; gap: 10px; }
.mode.small .mi { width: 36px; height: 36px; border-radius: 12px; }
.mode.small .mi .ico { width: 20px; height: 20px; }
.mode.small b { font-size: 15px; font-weight: 900; }
.hset { margin-top: auto; display: flex; gap: 8px; justify-content: center; padding-top: 8px; }

/* ---------- верх екрана гри ---------- */
.phead { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 10px; min-height: 44px; }
.pt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.pt b { font-size: 18px; font-weight: 1000; }
.pt small { color: var(--muted); font-size: 12px; }
.rule { padding: 2px 9px; border-radius: 999px; background: #ff547033; color: #ffb3c0; font-size: 12px; font-weight: 900; }
.sb { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12px; color: var(--muted); }
.sb b { color: #fff; font-size: 15px; margin: 0 5px; }
.sb .op { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud { display: flex; align-items: center; gap: 8px; }
.hearts { display: inline-flex; gap: 1px; }
.hrt .ico { width: 19px; height: 19px; color: #ffffff26; }
.hrt.on .ico { color: #ff5d7d; filter: drop-shadow(0 0 4px #ff5d7d88); }
.hearts.big .hrt .ico { width: 30px; height: 30px; }

.charms { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.ch {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 18px;
  background: radial-gradient(circle at 35% 30%, #ffffff3a, #ffffff10 70%); border: 2px solid var(--rc, var(--r0));
}
.ch.r0 { --rc: var(--r0); } .ch.r1 { --rc: var(--r1); } .ch.r2 { --rc: var(--r2); } .ch.r3 { --rc: var(--r3); }

/* ---------- шкала тиску ---------- */
.gauge { margin: 6px 0 8px; }
.g-track { position: relative; height: 16px; border-radius: 999px; background: #0006; overflow: hidden; box-shadow: inset 0 2px 4px #0006; }
.g-burst { position: absolute; top: 0; bottom: 0; right: 0; background: repeating-linear-gradient(135deg, #ff547055 0 6px, #ff547022 6px 12px); }
.g-win { position: absolute; top: 0; bottom: 0; background: #5be38a40; }
.g-perf { position: absolute; top: 0; bottom: 0; background: #ffd84a66; }
.g-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, #8f7bff, #ff7ad0); box-shadow: 0 0 10px #ff7ad088; transition: width .45s cubic-bezier(.2, .8, .3, 1.2); }
.g-ghost { position: absolute; top: 0; bottom: 0; opacity: 0; border-radius: 999px; transition: opacity .1s; }
.g-ghost.on { opacity: 1; }
.g-ghost.z-under { background: #ffffff66; }
.g-ghost.z-good { background: var(--good); }
.g-ghost.z-perfect { background: var(--perfect); }
.g-ghost.z-burst { background: var(--burst); }
.g-tick { position: absolute; top: -2px; bottom: -2px; width: 3px; margin-left: -1px; background: #fff; border-radius: 2px; }
.g-txt { display: flex; justify-content: space-between; margin-top: 4px; font-size: 13px; color: var(--muted); }
.g-p b { color: #fff; font-size: 17px; font-weight: 1000; }

/* ---------- поле-попіт ---------- */
.play { flex: 1; display: flex; flex-direction: column; }
.bwrap { position: relative; flex: 1; display: flex; justify-content: center; align-items: center; margin: 2px 0; }
.board {
  --bs: min(calc(100vw - 28px), 452px, calc(100dvh - 372px));
  width: var(--bs); min-width: 250px; aspect-ratio: 1;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 3.4%; padding: 4.4%;
  border-radius: 13%;
  background:
    radial-gradient(circle at 30% 20%, #ffffff55, transparent 45%),
    linear-gradient(135deg, #ffd3e3, #e2d6ff 35%, #cfeeff 65%, #d9ffe3);
  box-shadow: inset 0 -7px 0 #0000001f, inset 0 5px 0 #ffffff80, 0 14px 30px #0008;
  touch-action: manipulation;
}
.play.vs .board { --bs: min(calc(100vw - 28px), 452px, calc(100dvh - 420px)); }

/* суперник наживо: міні-поле, шкала, тиск */
.opp { display: flex; align-items: center; gap: 10px; margin: 4px 0 2px; padding: 6px 10px 6px 6px; border-radius: 14px; background: #0000002e; min-height: 46px; }
.o-mb { display: grid; grid-template-columns: repeat(5, 6px); gap: 1.5px; padding: 3px; border-radius: 6px; background: #ffffffd9; flex: none; }
.o-mb i { width: 6px; height: 6px; border-radius: 50%; background: var(--base); }
.o-mb i.stn { background: #8d899c; }
.o-mb i.pp { background: var(--lo); opacity: .35; transform: scale(.8); }
.o-mb i.nw { animation: opop .5s ease-out; }
@keyframes opop { 0% { transform: scale(1.6); opacity: 1; box-shadow: 0 0 6px var(--base); } 100% { transform: scale(.8); opacity: .35; } }
.o-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.o-nm { display: flex; align-items: baseline; gap: 6px; font-size: 12px; min-width: 0; }
.o-nm b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-nm small { color: var(--dim); font-size: 11px; white-space: nowrap; }
.o-g { position: relative; height: 7px; border-radius: 999px; background: #0006; overflow: hidden; }
.o-win { position: absolute; top: 0; bottom: 0; background: #5be38a40; }
.o-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, #6f8bff, #b78cff); transition: width .4s ease-out; }
.o-fill.z-good { background: var(--good); } .o-fill.z-perfect { background: var(--perfect); } .o-fill.z-burst { background: var(--burst); } .o-fill.z-under { background: var(--under); }
.o-st { flex: none; display: flex; flex-direction: column; align-items: flex-end; font-size: 11px; color: var(--muted); line-height: 1.1; min-width: 44px; }
.o-st b { font-size: 16px; font-weight: 1000; color: #fff; }
.o-st.z-good b { color: var(--good); } .o-st.z-perfect b { color: var(--perfect); } .o-st.z-burst b { color: var(--burst); } .o-st.z-under b { color: var(--under); }

.bossfl .board { background: radial-gradient(circle at 30% 20%, #ffffff40, transparent 45%), linear-gradient(135deg, #ffc1c9, #f0c7ff 45%, #ffd8b0); }
.b {
  --base: #ccc; --hi: #eee; --lo: #888;
  position: relative; aspect-ratio: 1; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 34% 28%, #ffffffd0 0 9%, #ffffff00 22%),
    radial-gradient(circle at 50% 58%, var(--hi) 0%, var(--base) 55%, var(--lo) 100%);
  box-shadow: 0 calc(var(--bs) * .011) 0 var(--lo), 0 calc(var(--bs) * .018) calc(var(--bs) * .02) #0000003a;
  transition: transform .12s, filter .12s;
}
.c0 { --base: #ff5d73; --hi: #ff9cab; --lo: #c42c4b; }
.c1 { --base: #3fa7ff; --hi: #94d2ff; --lo: #1d68c2; }
.c2 { --base: #45c964; --hi: #9bf0aa; --lo: #23903e; }
.c3 { --base: #ffc23c; --hi: #ffe5a0; --lo: #cf8a05; }
.b .v {
  position: relative; z-index: 2; font-size: calc(var(--bs) * .074); font-weight: 1000; color: #fff;
  text-shadow: 0 2px 0 #0004, 0 0 6px #0002;
}
.ki { position: absolute; z-index: 3; right: -4%; top: -4%; width: 40%; height: 40%; filter: drop-shadow(0 1px 1px #0005); }
.ki svg { width: 100%; height: 100%; display: block; }
.k-gold::before { content: ''; position: absolute; inset: -5%; border-radius: 50%; border: calc(var(--bs) * .008) solid #ffd54a; box-shadow: 0 0 calc(var(--bs) * .02) #ffd54aaa; }
.k-ice::after {
  content: ''; position: absolute; inset: 3%; border-radius: 50%; z-index: 1;
  background: linear-gradient(140deg, #f2fbffee, #bfe6ffb0 45%, #ffffff90 70%, #d8f1ffcc);
  border: 2px solid #ffffffcc; box-shadow: inset 0 -4px 8px #6fb6e655;
}
.k-ice .v { color: #3a7fb5; text-shadow: 0 1px 0 #fff; }
.k-ice.crk::after {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M20 4l-3 9 6 4-5 7 4 6-3 7M17 13l-9 2M23 17l10-3M18 24l-9 5M22 30l9 3' fill='none' stroke='%234a8fc4' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") center/100% 100%,
    linear-gradient(140deg, #f2fbffcc, #bfe6ff90 45%, #ffffff70 70%, #d8f1ffaa);
}
.k-stone { --base: #8d899c; --hi: #c3bfd0; --lo: #5b5869; cursor: not-allowed; }
.k-stone::after { content: ''; position: absolute; inset: 18%; border-radius: 40% 55% 45% 60%; background: radial-gradient(circle at 30% 30%, #0000 0 30%, #0002 31% 36%, #0000 37%), radial-gradient(circle at 70% 65%, #0000 0 20%, #0002 21% 27%, #0000 28%); }
.b.pp {
  background: radial-gradient(circle at 50% 62%, var(--lo) 0%, var(--base) 70%, var(--hi) 100%);
  box-shadow: inset 0 calc(var(--bs) * .016) calc(var(--bs) * .02) #0000006a, inset 0 calc(var(--bs) * -.008) 0 #ffffff55;
  transform: scale(.93); cursor: default;
}
.b.pp .v { opacity: .0; }
.b.pp .ki { opacity: .35; filter: grayscale(.4); }
.b.pp.k-ice::after { display: none; }
.b.pp.k-gold::before { opacity: .3; }
.b.just { animation: pop .42s ease-out; }
.b.jcrk { animation: wob .35s ease-out; }
@keyframes pop { 0% { transform: scale(1.14); } 35% { transform: scale(.78); } 70% { transform: scale(.98); } 100% { transform: scale(.93); } }
@keyframes wob { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-8deg); } 60% { transform: rotate(6deg); } }

.b.foot { filter: brightness(1.06); }
.b.foot::before, .b.hl::before, .b.hlc::before, .b.bad::before {
  content: ''; position: absolute; inset: -9%; border-radius: 50%; z-index: 4; pointer-events: none;
}
.board.aiming .b:not(.hl):not(.hlc):not(.foot) { filter: brightness(.62) saturate(.55); }
.b.foot::before { border: 3px dashed #4a2fa8aa; }
.b.hl { transform: scale(.9) translateY(2px); filter: brightness(1.12) saturate(1.1); }
.b.hl::before { border: 3px solid #fff; box-shadow: 0 0 0 2px #4a2fa8, 0 0 14px #fff; }
.b.hlc::before { border: 3px dashed #bff0ff; }
.b.bad::before { border: 3px solid var(--burst); background: #ff547022; }
.k-gold.hl::before, .k-gold.foot::before { inset: -9%; }

.float {
  position: absolute; z-index: 10; transform: translate(-50%, -60%); pointer-events: none;
  font-size: 30px; font-weight: 1000; color: #fff; white-space: nowrap; text-align: center;
  text-shadow: 0 3px 0 #0006, 0 0 14px #ff7ad0; animation: rise 1.15s ease-out forwards;
}
.float small { display: block; font-size: 16px; color: #ffe27a; }
.float.z-perfect { text-shadow: 0 3px 0 #0006, 0 0 16px var(--perfect); }
.float.z-burst { color: #ffd0d8; text-shadow: 0 3px 0 #0006, 0 0 16px var(--burst); }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -80%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -190%) scale(1); } }
.spark { position: absolute; z-index: 9; width: 7px; height: 7px; margin: -3.5px; border-radius: 50%; pointer-events: none; background: var(--base); animation: spark .6s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }

.end-burst .board { animation: shake .45s; }
.end-perfect .board { box-shadow: inset 0 -7px 0 #0000001f, 0 0 0 4px var(--perfect), 0 0 40px #ffd84a99; }
.end-good .board { box-shadow: inset 0 -7px 0 #0000001f, 0 0 0 4px var(--good), 0 0 30px #5be38a77; }
.end-under .board { filter: saturate(.5) brightness(.9); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-9px) rotate(-1deg); } 40% { transform: translateX(8px) rotate(1deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }

/* ---------- підказка / прогноз ---------- */
.info { min-height: 56px; display: flex; align-items: center; margin: 8px 0 6px; }
.hint { width: 100%; text-align: center; color: var(--muted); font-size: 14px; }
.hint b { color: #fff; }
.hint.bad { color: #ffb3c0; }
.pv { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; border-radius: 16px; background: #00000038; }
.pv-l { display: flex; flex-direction: column; line-height: 1.05; min-width: 64px; }
.pv-s { font-size: 24px; font-weight: 1000; }
.pv-f { font-size: 12px; color: var(--muted); }
.pv-m { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pv-z { font-size: 14px; font-weight: 900; }
.z-under { color: #d7dcff; } .z-good { color: var(--good); } .z-perfect { color: var(--perfect); } .z-burst { color: var(--burst); }
.pv-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { padding: 1px 7px; border-radius: 999px; background: #ffffff1c; font-size: 11px; font-weight: 900; }
.tag-mono { background: #ffffff2e; } .tag-rainbow { background: linear-gradient(90deg, #ff5d7366, #ffc23c66, #45c96466, #3fa7ff66); }
.tag-line { background: #ffd84a44; color: #ffe9a0; } .tag-star { background: #fff4a833; } .tag-bomb { background: #ff8a1f44; }
.go { padding: 10px 14px; border-radius: 13px; font-weight: 1000; background: #fff; color: #2b1c6b; box-shadow: 0 3px 0 #0005; }
.go.z-good { background: var(--good); color: #0b3d1d; } .go.z-perfect { background: var(--perfect); color: #4d3600; } .go.z-burst { background: var(--burst); color: #fff; }

/* ---------- рука ---------- */
.hand { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.card {
  --rc: var(--r0);
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 4px;
  aspect-ratio: .8; padding: 8px 3px 6px; border-radius: 14px;
  background: linear-gradient(180deg, #fffdf8, #ece6ff); color: #2b1c6b;
  border-top: 4px solid var(--rc); box-shadow: 0 4px 0 #0006;
  transition: transform .14s, box-shadow .14s;
}
.card.r1 { --rc: var(--r1); } .card.r2 { --rc: var(--r2); } .card.r3 { --rc: var(--r3); }
.card.sel { transform: translateY(-9px); box-shadow: 0 0 0 3px #fff, 0 0 18px #ff9ad7, 0 8px 0 #0005; }
.card.fresh { animation: deal .35s ease-out; }
@keyframes deal { 0% { transform: translateY(30px) rotate(6deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.cn { font-size: 11px; font-weight: 900; line-height: 1.05; text-align: center; overflow: hidden; text-overflow: ellipsis; max-width: 100%; white-space: nowrap; }
.shape {
  --cs: min(12px, calc(50px / max(var(--w), var(--h))));
  flex: 1; display: grid; grid-template-columns: repeat(var(--w), var(--cs)); grid-auto-rows: var(--cs); gap: 2px; place-content: center;
}
.shape i { border-radius: 50%; }
.shape i.on { background: radial-gradient(circle at 35% 30%, #fff 0 14%, #ff9ad7 20%, #c03c95 100%); box-shadow: 0 1px 0 #7a1d5c; }
.card.sel .shape i.on { background: radial-gradient(circle at 35% 30%, #fff 0 14%, #7fd0ff 20%, #2a62d6 100%); }
.fx { position: absolute; top: 3px; right: 4px; font-size: 13px; }
.lvl { position: absolute; top: 3px; left: 5px; font-size: 11px; font-weight: 1000; color: #fff; background: #ff4f7e; border-radius: 7px; padding: 0 4px; }

.acts { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-top: 10px; }
.ab { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; border-radius: 14px; background: #ffffff14; font-size: 13px; font-weight: 900; }
.presses { display: flex; gap: 5px; }
.presses i { width: 15px; height: 15px; border-radius: 50%; background: #ffffff18; box-shadow: inset 0 2px 3px #0006; }
.presses i.on { background: radial-gradient(circle at 35% 30%, #fff 0 15%, #ff9ad7 25%, #d6408f); box-shadow: 0 2px 0 #7a1d5c; }

/* ---------- шторка ---------- */
#sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
#sheet[hidden] { display: none; }
.scrim { position: absolute; inset: 0; background: #08061acc; opacity: 0; transition: opacity .2s; }
.panel {
  position: relative; width: 100%; max-width: 480px; max-height: 88dvh; overflow: auto;
  padding: 22px 18px max(18px, env(safe-area-inset-bottom)); border-radius: 26px 26px 0 0;
  background: linear-gradient(180deg, #3a2c8c, #251a63); box-shadow: 0 -10px 40px #0008;
  transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .9, .3, 1);
}
#sheet.on .scrim { opacity: 1; }
#sheet.on .panel { transform: none; }
.panel p { color: #e6e1ff; font-weight: 600; }
.panel p b { color: #fff; font-weight: 900; }
.q { font-size: 17px; text-align: center; margin: 6px 0 10px; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 4px; }
.lg { --bs: 380px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.lg .b { width: 38px; flex: none; cursor: default; }
.lg .b .v { font-size: 17px; }

.fres { text-align: center; }
.fres-z { font-size: 34px; font-weight: 1000; margin-bottom: 12px; }
.fres.z-perfect .fres-z { color: var(--perfect); text-shadow: 0 0 20px #ffd84a88; }
.fres.z-good .fres-z { color: var(--good); }
.fres.z-burst .fres-z { color: var(--burst); }
.fres.z-under .fres-z { color: var(--under); }
.fres-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fside { display: flex; flex-direction: column; gap: 2px; padding: 12px 8px; border-radius: 18px; background: #0003; }
.fside span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fside b { font-size: 32px; font-weight: 1000; }
.fside small { font-size: 12px; color: var(--muted); }
.fside em { font-style: normal; font-size: 11px; color: #ffe27a; }
.fside.me { box-shadow: inset 0 0 0 2px #ff7aa866; }
.fres-tot { margin: 12px 0 4px; font-size: 16px; color: var(--muted); }
.fres-tot b { color: #fff; font-size: 20px; }
.fres-tot b.lead { color: var(--good); }
.fres-dots { display: flex; justify-content: center; gap: 6px; margin: 6px 0 4px; }
.fres-dots i { width: 12px; height: 12px; border-radius: 50%; background: #ffffff1c; }
.fres-dots i.w { background: var(--good); } .fres-dots i.l { background: var(--burst); } .fres-dots i.d { background: var(--under); }
.fres-one { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.fres-one span { color: var(--muted); }
.fres-one b { font-size: 28px; font-weight: 1000; }
.note { color: #ffd0d8 !important; }

/* ---------- суперник ---------- */
.versus { flex: 1; display: grid; grid-template-rows: 1fr auto 1fr auto; place-items: center; gap: 10px; padding: 30px 0; text-align: center; }
.vs-side { display: flex; flex-direction: column; align-items: center; gap: 6px; animation: slide .5s ease-out both; }
.vs-side.op { animation-delay: .9s; }
.vs-side b { font-size: 22px; font-weight: 1000; }
.vs-side small { color: var(--muted); }
.vs-ch { display: flex; gap: 6px; margin-top: 4px; }
.vs-mid span { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; font-size: 15px; font-weight: 1000; background: linear-gradient(135deg, #ff7aa8, #8a4dff); box-shadow: 0 0 30px #ff7aa877; }
.vs-load { display: flex; gap: 8px; }
.vs-load i { width: 12px; height: 12px; border-radius: 50%; background: #fff; animation: bob 1s infinite ease-in-out; }
.vs-load i:nth-child(2) { animation-delay: .15s; } .vs-load i:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 0%, 100% { transform: translateY(0); opacity: .4; } 50% { transform: translateY(-8px); opacity: 1; } }
@keyframes slide { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }

/* ---------- підсумок ---------- */
.result { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; text-align: center; }
.res-title { font-size: 40px; font-weight: 1000; animation: slide .5s ease-out both; }
.out-win .res-title { background: linear-gradient(180deg, #fff3a8, #ffb72e); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 16px #ffc23c77); }
.out-loss .res-title { color: #c9c3f0; }
.res-score { display: flex; align-items: center; justify-content: center; gap: 10px; }
.res-score span { color: var(--muted); font-size: 13px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-score b { font-size: 34px; font-weight: 1000; }
.res-score i { font-style: normal; color: var(--dim); font-size: 26px; }
.res-tab { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: 14px; }
.res-tab th { color: var(--dim); font-size: 12px; font-weight: 800; }
.res-tab td { padding: 6px 8px; background: #0003; }
.res-tab td:first-child { border-radius: 12px 0 0 12px; color: var(--dim); width: 34px; }
.res-tab td:last-child { border-radius: 0 12px 12px 0; }
.res-tab td small { display: block; font-size: 11px; color: var(--muted); font-weight: 700; }
.res-tab tr.w td:nth-child(2) b { color: var(--good); }
.res-tab tr.l td:nth-child(3) b { color: var(--good); }
.res-coins { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 18px; margin: 4px 0; }
.res-coins .ico { width: 24px; height: 24px; }
.res-sub { color: var(--muted); }
.banner { padding: 10px 14px; border-radius: 16px; background: linear-gradient(90deg, #ffc23c, #ff7aa8); color: #3a1600; font-weight: 1000; animation: slide .5s .3s ease-out both; }
.banner.alt { background: linear-gradient(90deg, #5be38a, #3fa7ff); color: #08281a; }
.tower-big { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 64px; font-weight: 1000; }
.tower-big .ico { width: 60px; height: 60px; color: #8fa2ff; }

/* ---------- крамниця ---------- */
.shop { display: flex; flex-direction: column; }
.si-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.si { --rc: var(--r0); display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; border-radius: 18px; background: var(--panel); border-left: 4px solid var(--rc); }
.si.r1, .ct.r1, .hc.r1, .dchip.r1 { --rc: var(--r1); } .si.r2, .ct.r2, .hc.r2, .dchip.r2 { --rc: var(--r2); } .si.r3, .ct.r3, .hc.r3, .dchip.r3 { --rc: var(--r3); }
.si.sold { opacity: .5; }
.si-art { width: 64px; height: 64px; flex: none; border-radius: 14px; background: linear-gradient(180deg, #fffdf8, #ece6ff); display: grid; place-items: center; }
.si-art .shape { --cs: min(11px, calc(46px / max(var(--w), var(--h)))); }
.big-ico { font-size: 30px; }
.si .big-ico { line-height: 1; }
.upart { position: relative; display: grid; place-items: center; }
.upart b { position: absolute; right: -14px; top: -14px; padding: 0 5px; border-radius: 8px; background: #ff4f7e; font-size: 12px; }
.si-t { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.si-t b { font-size: 16px; font-weight: 1000; }
.si-t small, .ct small, .hc-t small { color: var(--muted); font-size: 12px; font-weight: 700; }
.si-t em, .ct em, .hc-t em { font-style: normal; font-size: 11px; color: var(--rc); font-weight: 900; }
.svc { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.svc .pill .ico { width: 16px; height: 16px; }
.deckrow { display: flex; flex-wrap: wrap; gap: 5px; }
.dchip { --rc: var(--r0); padding: 3px 9px; border-radius: 999px; background: #ffffff12; border: 1px solid var(--rc); font-size: 12px; }
.dchip b { color: #ff9ad7; }
.shop .big.primary { margin-top: 18px; }
.rmgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 6px; }

/* ---------- колекція ---------- */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; margin: 10px 0 8px; border-radius: 16px; background: #0003; }
.tabs button { padding: 9px; border-radius: 12px; font-weight: 900; color: var(--muted); }
.tabs button.on { background: var(--panel2); color: #fff; }
.coll-sub { color: var(--muted); font-size: 13px; }
.coll-sub small { color: var(--dim); }
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 8px; }
.ct { --rc: var(--r0); display: flex; flex-direction: column; gap: 3px; padding: 10px; border-radius: 18px; background: var(--panel); border-top: 4px solid var(--rc); }
.ct.locked .ct-art { filter: grayscale(.8) opacity(.6); }
.ct-art { position: relative; height: 70px; border-radius: 12px; background: linear-gradient(180deg, #fffdf8, #ece6ff); display: grid; place-items: center; margin-bottom: 4px; }
.ct-art .shape { --cs: min(13px, calc(56px / max(var(--w), var(--h)))); }
.ct b { font-size: 15px; font-weight: 1000; }
.ct-row { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 6px; }
.mini { width: 30px; height: 30px; border-radius: 10px; background: #ffffff1c; font-size: 18px; font-weight: 1000; }
.cnt { min-width: 30px; text-align: center; font-size: 13px; }
.ct-row .buy { margin-left: auto; }
.hlist { display: flex; flex-direction: column; gap: 8px; }
.hc { --rc: var(--r0); display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 18px; background: var(--panel); border-left: 4px solid var(--rc); }
.hc.locked .big-ico { filter: grayscale(1) opacity(.5); }
.hc.eq { box-shadow: inset 0 0 0 2px #5be38a66; }
.hc-t { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hc-t b { font-size: 15px; font-weight: 1000; }

/* ---------- таблиця лідерів ---------- */
.top { display: flex; flex-direction: column; }
.ldr { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.lr { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border-radius: 16px; background: var(--panel); }
.lr.me { background: linear-gradient(90deg, #ff7aa840, #ffffff10); box-shadow: inset 0 0 0 2px #ff7aa877; }
.lpos { width: 30px; text-align: center; font-size: 15px; font-weight: 1000; color: var(--muted); flex: none; }
.lr:nth-child(1) .lpos { color: #ffd84a; } .lr:nth-child(2) .lpos { color: #e3e8f4; } .lr:nth-child(3) .lpos { color: #f0a46a; }
.lname { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lname b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lname small { font-size: 12px; color: var(--muted); }
.lwl { font-size: 13px; color: var(--muted); flex: none; }
.lgap { text-align: center; color: var(--dim); }
.ldr-me { margin: 10px 0 0; text-align: center; color: var(--muted); }
.ldr-msg { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 60px; color: var(--muted); text-align: center; }
.fres .vs-load { justify-content: center; margin: 14px 0 12px; }

/* ---------- тост ---------- */
#toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 60; max-width: min(440px, calc(100vw - 32px));
  padding: 11px 16px; border-radius: 16px; background: #120d33f0; border: 1px solid #ffffff22; box-shadow: 0 10px 30px #0008;
  font-size: 14px; font-weight: 700; text-align: center;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: transform .2s, opacity .2s;
}
#toast.on { transform: translate(-50%, 0); opacity: 1; }

@media (max-height: 700px) {
  .charms { margin: 2px 0 0; }
  .ch { width: 28px; height: 28px; font-size: 15px; }
  .gauge { margin: 4px 0 4px; }
  .info { min-height: 50px; margin: 4px 0; }
  .acts { margin-top: 6px; }
  .ab { padding: 8px; }
}
