/* шрифты внутри игры: Russo One и Rubik (OFL), без запросов к Google */
@font-face { font-family: 'Rubik'; font-style: normal; font-weight: 500 900; font-display: swap; src: url(fonts/rubik-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: 'Rubik'; font-style: normal; font-weight: 500 900; font-display: swap; src: url(fonts/rubik-cyrillic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Rubik'; font-style: normal; font-weight: 500 900; font-display: swap; src: url(fonts/rubik-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Rubik'; font-style: normal; font-weight: 500 900; font-display: swap; src: url(fonts/rubik-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; }
@font-face { font-family: 'Russo One'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/russo-one-cyrillic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Russo One'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/russo-one-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Russo One'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/russo-one-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 {
  --gold: #ffcf3a; --gold2: #e08a12; --ink: #1c140c; --cream: #fff7e6;
  --blue: #2f8cff; --red: #ff4a3d; --green: #3fc35a;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #cfe3ef; color: #fff; font: 600 15px/1.25 'Rubik', system-ui, sans-serif; -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; overscroll-behavior: none; }
#stage { position: fixed; inset: 0; overflow: hidden; }
canvas#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
.disp { font-family: 'Russo One', 'Rubik', system-ui, sans-serif; font-weight: 400; letter-spacing: .02em; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.iconbtn { width: 44px; height: 44px; border-radius: 14px; background: rgba(20, 14, 8, .45); display: grid; place-items: center; backdrop-filter: blur(4px); }
.iconbtn svg { width: 24px; height: 24px; fill: #fff; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 19px; background: rgba(20, 14, 8, .45); font-size: 14px; font-weight: 700; text-decoration: none; backdrop-filter: blur(4px); white-space: nowrap; }
.coins { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px 0 8px; border-radius: 19px; background: rgba(20, 14, 8, .5); font-size: 18px; backdrop-filter: blur(4px); }
.coins b { font-family: 'Russo One', sans-serif; font-weight: 400; }
.coin { width: 24px; height: 24px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3a8, #ffcf3a 40%, #d98a10 100%); box-shadow: inset 0 -2px 0 rgba(0,0,0,.2), 0 1px 2px rgba(0,0,0,.3); position: relative; flex: none; }
.coin::after { content: '₸'; position: absolute; inset: 0; display: grid; place-items: center; font: 400 14px 'Russo One', sans-serif; color: #8a4a00; }
.coins.bump { animation: bump .35s; }
@keyframes bump { 40% { transform: scale(1.18); } }

.big { display: block; width: 100%; height: 64px; border-radius: 20px; font-size: 26px; color: #3a2400; background: linear-gradient(180deg, #ffe066, #ffb21a); box-shadow: 0 6px 0 #c57a06, 0 10px 24px rgba(0,0,0,.25); text-shadow: 0 1px 0 rgba(255,255,255,.5); transition: transform .08s; }
.big:active { transform: translateY(4px); box-shadow: 0 2px 0 #c57a06, 0 6px 14px rgba(0,0,0,.25); }

/* —— загрузка —— */
#loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; background: linear-gradient(180deg, #3f86d8 0%, #cfe3ef 60%, #c8b25c 60.5%, #b7a052 100%); z-index: 50; transition: opacity .4s; }
#loading.out { opacity: 0; pointer-events: none; }
#loadT { font-size: 64px; color: #fff; text-shadow: 0 4px 0 #b5302a, 0 8px 20px rgba(0,0,0,.25); }
#loadBar { width: 220px; height: 12px; border-radius: 6px; background: rgba(0,0,0,.2); overflow: hidden; }
#loadBar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .2s; }
#loadS { margin: 0; color: #3a2a14; font-weight: 700; max-width: 320px; text-align: center; }

/* —— игра —— */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
#pauseBtn { position: absolute; left: 12px; top: calc(12px + var(--safe-t)); }
#hudCoins { position: absolute; right: 12px; top: calc(15px + var(--safe-t)); }
#prog { position: absolute; left: 50%; top: calc(18px + var(--safe-t)); transform: translateX(-50%); display: flex; align-items: center; gap: 8px; width: min(46vw, 320px); pointer-events: none; }
#progLvl { font-size: 15px; text-shadow: 0 1px 3px rgba(0,0,0,.5); white-space: nowrap; }
#progBar { flex: 1; height: 12px; border-radius: 6px; background: rgba(20,14,8,.45); position: relative; overflow: visible; }
#progBar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 6px; background: linear-gradient(90deg, #ffe066, #ffb21a); }
#progBar b { position: absolute; top: 50%; left: 0; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: #fff; border: 3px solid #ffb21a; }
#progFlag { font-size: 18px; }
#hint { position: absolute; left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%); max-width: min(92vw, 460px); padding: 10px 16px; border-radius: 14px; background: rgba(20,14,8,.66); font-size: 16px; text-align: center; pointer-events: none; animation: hintIn .3s; }
@keyframes hintIn { from { opacity: 0; transform: translate(-50%, -8px); } }
#dragHint { position: absolute; left: 50%; bottom: calc(14% + var(--safe-b)); transform: translateX(-50%); display: grid; justify-items: center; gap: 10px; pointer-events: none; }
#dragHint span { padding: 8px 16px; border-radius: 14px; background: rgba(20,14,8,.6); font-size: 17px; white-space: nowrap; }
.hand { width: 56px; height: 56px; border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: 0 0 0 10px rgba(255,255,255,.25); animation: swipe 1.6s ease-in-out infinite; }
@keyframes swipe { 0%, 100% { transform: translateX(-70px); } 50% { transform: translateX(70px); } }

/* подписи над табунами и всплывашки */
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tag { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); padding: 4px 14px 5px; border-radius: 14px; font: 400 26px/1 'Russo One', sans-serif; color: #fff; background: #2f8cff; box-shadow: 0 3px 0 #1559b5, 0 6px 14px rgba(0,0,0,.25); white-space: nowrap; will-change: transform; }
.tag::after { content: ''; position: absolute; left: 50%; bottom: -7px; margin-left: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: #2f8cff; }
.tag.rival { background: #e0393e; box-shadow: 0 3px 0 #8f1418, 0 6px 14px rgba(0,0,0,.25); }
.tag.rival::after { border-top-color: #e0393e; }
.tag.pop { animation: pop .25s; }
@keyframes pop { 40% { scale: 1.3; } }
.float { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); font: 400 34px/1 'Russo One', sans-serif; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.35), 0 0 12px rgba(0,0,0,.25); white-space: nowrap; animation: floatUp 1.1s ease-out forwards; }
.float.good { color: #fff; text-shadow: 0 3px 0 #1559b5, 0 0 3px #1559b5, 0 6px 14px rgba(0,0,0,.3); }
.float.bad { color: #fff; text-shadow: 0 3px 0 #9e1a14, 0 0 3px #9e1a14, 0 6px 14px rgba(0,0,0,.3); }
.float.gold { color: #ffe066; text-shadow: 0 3px 0 #a35a00, 0 0 3px #a35a00, 0 6px 14px rgba(0,0,0,.3); }
.float.huge { font-size: 54px; }
@keyframes floatUp { 0% { opacity: 0; translate: 0 10px; scale: .6; } 12% { opacity: 1; scale: 1.15; } 28% { scale: 1; } 72% { opacity: 1; } 100% { opacity: 0; translate: 0 -70px; } }
.banner { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%); font: 400 56px/1 'Russo One', sans-serif; color: #fff; text-shadow: 0 4px 0 #b5302a, 0 8px 24px rgba(0,0,0,.35); white-space: nowrap; animation: banner 1.4s ease-out forwards; }
@keyframes banner { 0% { opacity: 0; scale: 2.2; } 15% { opacity: 1; scale: 1; } 80% { opacity: 1; } 100% { opacity: 0; scale: .9; } }

/* —— меню —— */
#menu { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-start; padding: calc(12px + var(--safe-t)) 14px calc(14px + var(--safe-b)); background: linear-gradient(180deg, rgba(0,0,0,.18) 0%, transparent 22%, transparent 55%, rgba(30,18,6,.45) 100%); }
.topbar { display: flex; align-items: center; gap: 8px; }
.topbar .coins { margin-left: auto; }
#logo { text-align: center; margin-top: 2px; }
#menuBottom { margin-top: auto !important; }
#logo h1 { margin: 0; font-size: clamp(54px, 15vw, 92px); line-height: .95; color: #fff; text-shadow: 0 5px 0 #b5302a, 0 10px 26px rgba(0,0,0,.3); letter-spacing: .04em; }
#logo p { margin: 6px 0 0; font-size: 17px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; text-shadow: 0 2px 6px rgba(0,0,0,.4); }
#menuBottom { width: 100%; max-width: 460px; margin: 0 auto; display: grid; gap: 12px; }
#lvlRow { display: flex; justify-content: center; align-items: center; gap: 10px; }
#lvlName { font-size: 22px; text-shadow: 0 2px 6px rgba(0,0,0,.45); }
#bossTag { padding: 4px 10px; border-radius: 10px; background: #e0393e; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
#ups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.up { position: relative; border-radius: 16px; padding: 8px 6px 8px; background: rgba(255,247,230,.94); color: var(--ink); display: grid; justify-items: center; gap: 2px; box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.up .ic { width: 34px; height: 34px; }
.up .nm { font-size: 14px; font-weight: 800; }
.up .lv { font-size: 12px; color: #7a6650; font-weight: 700; }
.up .buy { margin-top: 4px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; width: 100%; height: 32px; border-radius: 10px; background: linear-gradient(180deg, #57d36d, #2fa847); color: #fff; font: 400 15px 'Russo One', sans-serif; box-shadow: 0 3px 0 #1f7a33; }
.up .buy .coin { width: 18px; height: 18px; }
.up .buy .coin::after { font-size: 11px; }
.up.poor .buy { background: #b9ab96; box-shadow: 0 3px 0 #8f826f; }
.up.flash { animation: bump .35s; }
#menuRow2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#aulInfo { font-size: 13px; font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.5); }

/* —— итоги и окна —— */
#result, #modal { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(20,12,4,.35); }
.card { width: min(100%, 400px); border-radius: 24px; padding: 22px 20px 20px; background: var(--cream); color: var(--ink); text-align: center; box-shadow: 0 8px 0 rgba(0,0,0,.15), 0 20px 50px rgba(0,0,0,.35); animation: cardIn .35s cubic-bezier(.2,1.4,.4,1); }
@keyframes cardIn { from { transform: scale(.7); opacity: 0; } }
.card h2 { margin: 0; font-size: 38px; color: #e0393e; }
#result.win .card h2 { color: #2fa847; }
.card p { margin: 6px 0 0; color: #6a5844; font-weight: 700; }
#resMult { margin-top: 12px; font-size: 22px; color: #e08a12; }
#resCoins { display: inline-flex; align-items: center; gap: 10px; margin: 8px 0 16px; font-size: 46px; }
#resCoins .coin { width: 42px; height: 42px; }
#resCoins .coin::after { font-size: 24px; }
.card .row { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; }
.card .pill { background: #e9dcc4; color: var(--ink); height: 52px; border-radius: 16px; justify-content: center; }
.card .big { height: 58px; font-size: 22px; }
.mtitle { margin: 0 0 12px; font: 400 26px 'Russo One', sans-serif; }
.mrow > div:first-child { text-align: left; display: grid; gap: 4px; }
.mrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 4px; border-top: 1px solid #ecdfc8; font-weight: 700; }
.mrow:first-of-type { border-top: 0; }
.mrow button { min-width: 110px; height: 40px; border-radius: 12px; background: #e9dcc4; font-weight: 800; }
.mrow button.on { background: linear-gradient(180deg, #57d36d, #2fa847); color: #fff; }
.mrow button.gold { background: linear-gradient(180deg, #ffe066, #ffb21a); color: #3a2400; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.mrow button:disabled { opacity: .5; }
.dots { display: flex; gap: 4px; }
.dots i { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 -2px 0 rgba(0,0,0,.2); }
.mbtns { display: grid; gap: 10px; margin-top: 14px; }
.mbtns .pill { width: 100%; }
.daily { font: 400 52px 'Russo One', sans-serif; display: inline-flex; gap: 10px; align-items: center; margin: 10px 0 16px; }
.daily .coin { width: 46px; height: 46px; }
.daily .coin::after { font-size: 26px; }

/* узкие экраны: прогресс под верхним рядом, чтобы не наезжал на монеты */
@media (max-width: 560px) {
  #prog { top: calc(66px + var(--safe-t)); width: min(78vw, 340px); }
  #hint { top: calc(96px + var(--safe-t)); }
}
.card { max-height: calc(100% - 8px); overflow: auto; }

/* низкие экраны (телефон лёжа) */
@media (max-height: 460px) {
  #logo h1 { font-size: 46px; }
  #logo p { font-size: 13px; margin-top: 2px; }
  #menuBottom { max-width: 640px; grid-template-columns: 1fr 1.6fr; align-items: end; gap: 8px 12px; }
  #lvlRow { grid-column: 1; justify-content: flex-start; }
  #playBtn { grid-column: 1; grid-row: 2; height: 56px; font-size: 22px; }
  #ups { grid-column: 2; grid-row: 1 / span 2; align-self: end; }
  #menuRow2 { grid-column: 1 / span 2; }
  .up { padding: 6px 4px; }
  .up .ic { width: 26px; height: 26px; }
  .card { padding: 14px 16px; }
  .card.wide { width: min(100%, 660px); }
  .card.wide .rows { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; }
  .card.wide .mrow { padding: 6px 2px; }
  .card.wide .mrow:nth-child(2) { border-top: 0; }
  .mtitle { margin-bottom: 6px; font-size: 22px; }
  .mbtns { margin-top: 8px; }
  .mbtns .pill { height: 42px; }
  .card h2 { font-size: 30px; }
  #resCoins { font-size: 36px; margin: 4px 0 10px; }
  .tag { font-size: 22px; }
  .banner { font-size: 44px; }
}

/* кадры для обложек: без интерфейса */
html.shot #hud, html.shot #hint, html.shot #dragHint, html.shot .float, html.shot .banner { display: none !important; }

/* после проигрыша — подсветка доступных улучшений */
.up.glow { animation: glow 1s ease-in-out 3; }
@keyframes glow { 50% { box-shadow: 0 4px 0 rgba(0,0,0,.18), 0 0 0 4px #ffe066, 0 0 22px #ffcf3a; transform: translateY(-3px); } }

/* —— эффекты —— */
#flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
#flash.good { box-shadow: inset 0 0 90px 10px rgba(47,140,255,.75); animation: flash .55s ease-out; }
#flash.bad { box-shadow: inset 0 0 110px 16px rgba(255,50,40,.8); animation: flash .6s ease-out; }
#flash.gold { box-shadow: inset 0 0 110px 16px rgba(255,200,40,.8); animation: flash .8s ease-out; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
.banner small { display: block; margin-top: 8px; font-size: .55em; text-align: center; letter-spacing: .06em; text-shadow: 0 3px 0 rgba(0,0,0,.3); }
.banner.intro { top: 36%; font-size: 46px; text-shadow: 0 4px 0 #1559b5, 0 8px 24px rgba(0,0,0,.35); animation-duration: 1.6s; }
.banner.clash { font-size: 64px; }
.float.combo { font-size: 26px; }
#starTotal { padding: 4px 10px; border-radius: 10px; background: rgba(20,14,8,.45); color: var(--gold); font-size: 16px; }
#resStars { display: flex; justify-content: center; gap: 10px; margin: 10px 0 0; min-height: 0; }
#resStars:empty { display: none; }
#resStars i { font-style: normal; font: 400 52px/1 'Russo One', sans-serif; color: #d9ccb4; opacity: 0; animation: starIn .45s cubic-bezier(.2,1.6,.4,1) forwards; }
#resStars i.on { color: #ffc21a; text-shadow: 0 3px 0 #c57a06, 0 0 18px rgba(255,200,40,.7); }
#resStars i:nth-child(2) { font-size: 64px; margin-top: -8px; }
@keyframes starIn { from { opacity: 0; transform: scale(2.4) rotate(-30deg); } to { opacity: 1; transform: none; } }
.coin.fly { position: absolute; z-index: 60; width: 28px; height: 28px; pointer-events: none; animation: coinFly .75s cubic-bezier(.5,-0.3,.7,1) forwards; }
@keyframes coinFly { to { transform: translate(var(--dx), var(--dy)) scale(.6); opacity: .9; } }
#playBtn { position: relative; overflow: hidden; }
#playBtn::after { content: ''; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.65), transparent); transform: skewX(-20deg); animation: shine 2.6s ease-in-out infinite 1s; }
@keyframes shine { 0% { left: -60%; } 45%, 100% { left: 130%; } }
#menu:not(.hidden) #logo { animation: logoIn .7s cubic-bezier(.2,1.5,.4,1); }
@keyframes logoIn { from { opacity: 0; transform: translateY(-30px) scale(.8); } }
#menu:not(.hidden) #menuBottom { animation: rise .5s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
@media (max-height: 460px) { #resStars i { font-size: 38px; } #resStars i:nth-child(2) { font-size: 46px; } .banner.clash { font-size: 48px; } }

.banner.clash { top: 17%; }
#hud.result-mode #pauseBtn, #hud.result-mode #prog, #hud.result-mode #hint, #hud.result-mode #dragHint { display: none; }
#hud.result-mode { z-index: 5; }
#result { z-index: 4; }

/* низкий широкий экран: итоги левее, справа виден счётчик монет */
@media (max-height: 460px) and (min-aspect-ratio: 3/2) { #result { justify-items: start; padding-left: max(16px, calc(50% - 300px)); } }

/* баннеры не шире экрана */
.banner { font-size: clamp(30px, 10.5vw, 56px); }
.banner.intro { font-size: clamp(28px, 9vw, 46px); }
.banner.clash { font-size: clamp(36px, 12vw, 64px); }

.banner.gold { color: #ffe066; text-shadow: 0 4px 0 #a35a00, 0 8px 24px rgba(0,0,0,.35); }

#dailyBtn { background: linear-gradient(180deg, #3b3f8f, #22245a); box-shadow: 0 0 0 2px rgba(255,220,120,.5) inset; }
#dailyBtn.done { background: rgba(20,14,8,.45); box-shadow: none; opacity: .85; }
#menuRow2 { flex-wrap: nowrap; }

/* узкий экран: нижний ряд меню в одну строку */
#aulInfo { white-space: nowrap; }
@media (max-width: 400px) { #menuRow2 .pill { padding: 0 10px; font-size: 13px; gap: 4px; } #aulInfo { font-size: 11px; } }

/* гроза */
#flash.white { background: rgba(235,242,255,.45); animation: flash .35s ease-out; }
/* достижения */
#achBtn { position: relative; }
#achBtn::after { content: attr(data-n); position: absolute; right: -6px; bottom: -6px; padding: 1px 5px; border-radius: 8px; background: #ffc21a; color: #3a2400; font: 800 10px Rubik, sans-serif; }
#toast { position: absolute; left: 50%; top: calc(108px + var(--safe-t)); z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 12px; border-radius: 18px; background: linear-gradient(180deg, #3a2a14, #1e140a); border: 2px solid #ffc21a; box-shadow: 0 8px 24px rgba(0,0,0,.35); pointer-events: none; white-space: nowrap; transform: translateX(-50%); }
#toast.go { animation: toastIn 2.9s cubic-bezier(.2,1.3,.4,1) forwards; }
@keyframes toastIn { 0% { opacity: 0; transform: translate(-50%, -30px) scale(.8); } 10% { opacity: 1; transform: translate(-50%, 0) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -12px); } }
#toast b { font-size: 30px; }
#toast span { display: grid; font: 400 18px 'Russo One', sans-serif; color: #fff; }
#toast span i { font: 700 11px Rubik, sans-serif; font-style: normal; color: #ffc21a; text-transform: uppercase; letter-spacing: .12em; }
#toast em { font: 400 18px 'Russo One', sans-serif; font-style: normal; color: #ffe066; }
.achs .ach { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 8px 2px; border-top: 1px solid #ecdfc8; text-align: left; opacity: .55; }
.achs .ach.got { opacity: 1; }
.achs .ach b { font-size: 24px; }
.achs .an { font-weight: 800; }
.achs .ad { font-size: 12px; color: #7a6650; }
.achs .ach span { font: 400 14px 'Russo One', sans-serif; color: #c57a06; }
/* поделиться */
.card .share { margin: 10px auto 0; height: 40px; background: #3b6fd8; color: #fff; display: inline-flex; gap: 8px; }
.card .share svg { width: 18px; height: 18px; fill: #fff; }
@media (max-height: 460px) { .card.wide .achs { grid-template-columns: 1fr 1fr; } .achs .ach { padding: 4px 2px; } .achs .ad { font-size: 11px; } .card .share { height: 34px; margin-top: 6px; } #toast { top: calc(60px + var(--safe-t)); } }

/* ===== меню: профессиональная раскладка ===== */
#menu { padding: calc(10px + var(--safe-t)) 12px calc(12px + var(--safe-b)); background: radial-gradient(120% 70% at 50% 40%, transparent 55%, rgba(0,0,0,.35) 100%), linear-gradient(180deg, rgba(0,0,0,.28) 0%, transparent 18%, transparent 52%, rgba(10,6,2,.55) 100%); }
.topbar { gap: 8px; }
.topbar .spacer { flex: 1; }
.topbar .coins { margin-left: 0; }
.iconbtn, .pill, .coins { background: rgba(14,10,6,.5); border: 1px solid rgba(255,255,255,.14); box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.pill.stars { color: #ffd24a; font-size: 16px; padding: 0 12px; }
#logo h1 { font-size: clamp(50px, 14vw, 84px); letter-spacing: .06em; text-shadow: 0 4px 0 #a8231d, 0 9px 24px rgba(0,0,0,.35); }
#logo .orn { width: min(240px, 60vw); height: 14px; margin: 6px auto 0; background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 14'%3E%3Cg fill='none' stroke='%23ffd24a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M2 7h80M158 7h80'/%3E%3Cpath d='M120 2c-6 0-8 5-4 7s6-2 2-3M120 2c6 0 8 5 4 7s-6-2-2-3M120 12c-6 0-8-5-4-7M120 12c6 0 8-5 4-7'/%3E%3Cpath d='M92 7c4-5 10-5 12 0s-6 5-6 0M148 7c-4-5-10-5-12 0s6 5 6 0'/%3E%3C/g%3E%3C/svg%3E"); filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
#logo p { margin-top: 4px; font-size: 13px; letter-spacing: .34em; opacity: .95; }
/* правая колонка: круглые кнопки с подписью */
#rail { position: absolute; right: 12px; top: 38%; display: grid; gap: 14px; justify-items: center; }
.railbtn { position: relative; width: 62px; display: grid; justify-items: center; gap: 4px; background: none; padding: 0; }
.railbtn svg { width: 54px; height: 54px; padding: 13px; border-radius: 50%; fill: #fff; background: linear-gradient(180deg, rgba(60,44,26,.85), rgba(24,16,8,.85)); border: 2px solid rgba(255,210,74,.7); box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.railbtn.night svg { background: linear-gradient(180deg, #4b4fae, #1f2160); fill: #ffe28a; }
.railbtn .lbl { font-size: 11px; font-weight: 800; text-shadow: 0 1px 3px rgba(0,0,0,.8); white-space: nowrap; }
.railbtn .badge { position: absolute; top: -4px; right: 0; padding: 2px 6px; border-radius: 9px; background: #e0393e; color: #fff; font: 800 11px Rubik, sans-serif; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.railbtn:active svg { transform: scale(.94); }
/* нижняя стеклянная панель */
.glass { background: linear-gradient(180deg, rgba(20,14,8,.62), rgba(12,8,4,.78)); border: 1px solid rgba(255,255,255,.12); border-radius: 24px; box-shadow: 0 12px 34px rgba(0,0,0,.35); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
#menuBottom { padding: 12px 12px 12px; gap: 10px; max-width: 480px; }
#lvlRow { justify-content: center; }
#path { display: flex; align-items: center; justify-content: center; gap: 0; }
#path s { display: block; width: 22px; height: 4px; background: rgba(255,255,255,.18); border-radius: 2px; }
#path s.done { background: #ffc21a; }
#path .node { position: relative; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.22); font: 400 14px 'Russo One', sans-serif; color: rgba(255,255,255,.7); }
#path .node.done { background: #ffc21a; border-color: #ffe28a; color: #4a2c00; }
#path .node.cur { width: 44px; height: 44px; background: linear-gradient(180deg, #3fa9ff, #1563c9); border: 3px solid #fff; color: #fff; font-size: 18px; box-shadow: 0 0 0 4px rgba(63,169,255,.3), 0 4px 12px rgba(0,0,0,.35); }
#path .node.boss { border-color: #ff6a5a; }
#path .node.boss.next { background: rgba(224,57,62,.35); color: #fff; }
#path .node em { position: absolute; top: -13px; font-style: normal; font-size: 9px; color: #ffd24a; letter-spacing: -1px; text-shadow: 0 1px 2px rgba(0,0,0,.7); white-space: nowrap; }
#playBtn { height: 70px; display: grid; place-content: center; line-height: 1; gap: 4px; }
#playBtn .pl { font-size: 30px; letter-spacing: .06em; }
#playBtn .sub { font: 800 12px Rubik, sans-serif; letter-spacing: .14em; text-transform: uppercase; opacity: .7; text-shadow: none; }
.upsHead { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px 0; }
#upsTitle { font: 400 14px 'Russo One', sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #ffd24a; }
#aulInfo { font-size: 11px; opacity: .8; text-shadow: none; }
.up { background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.04)); border: 1px solid rgba(255,255,255,.12); color: #fff; box-shadow: none; padding: 8px 8px 8px; justify-items: stretch; text-align: left; gap: 5px; }
.up .top { display: flex; align-items: center; gap: 7px; }
.up .ic { width: 30px; height: 30px; flex: none; }
.up .nm { font-size: 13px; font-weight: 800; line-height: 1.1; }
.up .lv { font-size: 11px; color: rgba(255,255,255,.6); }
.up .ds { font-size: 10.5px; color: rgba(255,255,255,.72); line-height: 1.2; min-height: 2.4em; }
.up .pips { display: flex; gap: 3px; }
.up .pips i { flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,.15); }
.up .pips i.on { background: #3fc35a; }
.up .buy { margin-top: 2px; height: 30px; }
.up.poor .buy { background: rgba(255,255,255,.14); box-shadow: none; color: rgba(255,255,255,.6); }
@media (max-width: 400px) { #rail { right: 8px; } .up .ds { display: none; } #path .node { width: 30px; height: 30px; } #path s { width: 16px; } }
/* низкий широкий экран: панель горизонтальная, колонка кнопок слева */
@media (max-height: 460px) {
  #logo h1 { font-size: 40px; }
  #logo .orn { height: 10px; margin-top: 2px; }
  #logo p { display: none; }
  #rail { left: 12px; right: auto; top: 30%; gap: 8px; }
  .railbtn svg { width: 44px; height: 44px; padding: 10px; }
  #menuBottom { max-width: 700px; grid-template-columns: 1fr 1.7fr; padding: 8px 10px; gap: 6px 12px; }
  #lvlRow { grid-column: 1; grid-row: 1; }
  #playBtn { grid-column: 1; grid-row: 2 / span 2; height: 62px; align-self: end; }
  .upsHead { grid-column: 2; grid-row: 1; align-self: end; }
  #ups { grid-column: 2; grid-row: 2 / span 2; }
  .up .ds, .up .pips { display: none; }
  #path .node { width: 26px; height: 26px; font-size: 12px; } #path .node.cur { width: 34px; height: 34px; } #path s { width: 12px; }
}

#dailyBtn, #dailyBtn.done { background: none; box-shadow: none; opacity: 1; }

/* ===== окна в стиле меню: тёмное стекло с золотом ===== */
.card { background: linear-gradient(180deg, rgba(42,31,20,.97), rgba(22,16,10,.98)); color: #fff; border: 1px solid rgba(255,210,74,.35); box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 24px 60px rgba(0,0,0,.5); }
.card h2 { color: #ff6a5a; text-shadow: 0 3px 0 rgba(0,0,0,.35); }
#result.win .card h2 { color: #6fe08a; }
.card p { color: rgba(255,255,255,.72); }
#resMult { color: #ffd24a; }
.card .pill { background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.14); }
.card .share { background: linear-gradient(180deg, #4f86ec, #2c5fc4); border: 0; }
.mtitle { color: #ffd24a; letter-spacing: .04em; }
.mrow { border-top-color: rgba(255,255,255,.1); }
.mrow button { background: rgba(255,255,255,.12); color: #fff; }
.mrow button.on { background: linear-gradient(180deg, #57d36d, #2fa847); }
.achs .ach { border-top-color: rgba(255,255,255,.1); }
.achs .ad { color: rgba(255,255,255,.6); }
.achs .ach span { color: #ffd24a; }
#resStars i { color: rgba(255,255,255,.18); }

/* узкий телефон: «Все игры» — только стрелка */
@media (max-width: 420px) { #allGames { font-size: 0; padding: 0 12px; } #allGames::before { content: '←'; font-size: 18px; } .topbar { gap: 6px; } .pill.stars { padding: 0 9px; } }
/* короткий экран стоя: боковые кнопки выше */
@media (max-height: 700px) and (max-aspect-ratio: 1/1) { #rail { top: 25%; gap: 8px; } .railbtn svg { width: 46px; height: 46px; padding: 11px; } }
/* очень низкий экран лёжа: боковые кнопки в ряд под верхней панелью слева */
@media (max-height: 380px) { #rail { top: 58px; left: 12px; display: flex; gap: 10px; } .railbtn { width: 54px; } .railbtn svg { width: 38px; height: 38px; padding: 8px; } .railbtn .lbl { font-size: 10px; } #logo h1 { font-size: 34px; } #logo .orn { display: none; } }
/* итоги: «Поделиться» в одном ряду с кнопками */
.card .row:has(.share:not(.hidden)) { grid-template-columns: auto 1fr auto; }
.card .row .share { margin: 0; height: 52px; width: 52px; padding: 0; justify-content: center; }
.card .row .share span { display: none; }
.card .row .share svg { width: 22px; height: 22px; }

/* логотип — по ширине текста, а не на весь экран */
#logo { width: fit-content; max-width: 100%; margin-left: auto; margin-right: auto; }

/* тост достижения не закрывает подсказку о препятствии */
@media (max-width: 560px) { #toast { top: calc(156px + var(--safe-t)); } }
@media (max-height: 460px) { #toast { top: auto; bottom: calc(14px + var(--safe-b)); } }

/* вырез экрана слева и справа (iPhone лёжа) */
:root { --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); }
#pauseBtn { left: calc(12px + var(--safe-l)); }
#hudCoins { right: calc(12px + var(--safe-r)); }
#menu { padding-left: calc(12px + var(--safe-l)); padding-right: calc(12px + var(--safe-r)); }
@media (max-height: 460px) { #rail { left: calc(12px + var(--safe-l)); } }
#rail { right: calc(12px + var(--safe-r)); }
@media (max-height: 460px) { #rail { right: auto; } } /* лёжа колонка слева — не растягивать на всю ширину */
/* казахские буквы: запасной шрифт тот же, что у остального текста */
.banner, #toast span, #toast em, .mtitle, .disp { font-family: 'Russo One', 'Rubik', system-ui, sans-serif; }
/* длинные тексты на узких экранах переносятся, а не обрезаются */
#toast { white-space: normal; max-width: calc(100vw - 24px); }
#toast span { white-space: normal; }
#dragHint span { white-space: normal; max-width: calc(100vw - 40px); text-align: center; display: block; }
.up .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.up .top > div { min-width: 0; }
.up .buy { font-size: 14px; white-space: nowrap; overflow: hidden; }
/* iPhone SE и подобные: 320 px по ширине */
@media (max-width: 340px) {
  .topbar { gap: 5px; }
  .iconbtn { width: 38px; height: 38px; border-radius: 12px; }
  .iconbtn svg { width: 20px; height: 20px; }
  .coins { height: 34px; font-size: 15px; padding: 0 10px 0 6px; }
  .coins .coin { width: 20px; height: 20px; }
  .pill.stars { height: 34px; font-size: 14px; padding: 0 8px; }
  #allGames { padding: 0 10px; height: 34px; }
  #menuBottom { padding: 8px; gap: 7px; }
  #ups { gap: 5px; }
  .up { padding: 6px 5px; }
  .up .ic { width: 24px; height: 24px; }
  .up .nm { font-size: 12px; }
  .up .buy { font-size: 12px; height: 28px; }
  #aulInfo { display: none; }
  #playBtn { height: 60px; }
  #playBtn .pl { font-size: 26px; }
  #rail { top: 24%; }
  .railbtn svg { width: 42px; height: 42px; padding: 10px; }
}
/* короткий вертикальный экран (568 и меньше) */
@media (max-height: 600px) and (max-aspect-ratio: 1/1) {
  #logo h1 { font-size: 44px; }
  #logo p { display: none; }
  #logo .orn { height: 10px; margin-top: 2px; }
  #path .node { width: 28px; height: 28px; font-size: 12px; } #path .node.cur { width: 36px; height: 36px; font-size: 15px; } #path s { width: 14px; }
  .up .pips { display: none; }
}
/* «×2 монеты за рекламу» на итогах (только в порталах) */
.card .adx2 { display: flex; width: fit-content; margin: -6px auto 12px; height: 40px; padding: 0 16px; border: 0; color: #3a2400; background: linear-gradient(180deg, #ffd96a, #f0a924); box-shadow: 0 2px 10px rgba(240,169,36,.35); font-weight: 800; }
.card .adx2 svg { width: 16px; height: 16px; fill: currentColor; }
.card .adx2:disabled { opacity: .6; }
.card .adx2.done { opacity: 1; background: rgba(111,224,138,.2); color: #6fe08a; box-shadow: none; }
.card .adx2.done svg { display: none; }
@media (max-height: 460px) { .card .adx2 { height: 32px; margin: 0 auto 6px; font-size: 13px; } }

/* задания и сундук */
.railbtn.qrail svg { background: linear-gradient(180deg, #7a5a2a, #3a2410); fill: #ffe7a8; }
.railbtn.done .badge { background: #2fa847; }
#resGoals { display: grid; gap: 4px; margin: -4px 0 12px; font-size: 13px; font-weight: 700; color: rgba(255,255,255,.8); }
#resGoals:empty { display: none; }
#resGoals .g { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; }
#resGoals .g.gold { color: #ffd24a; }
#resGoals b { color: #fff; }
#resGoals .g.gold b { color: #ffd24a; }
.pips { display: inline-flex; gap: 4px; vertical-align: middle; }
.pips i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.2); }
.pips i.on { background: #ffc21a; box-shadow: 0 0 6px rgba(255,194,26,.7); }
.quests { display: grid; gap: 10px; margin: 12px 0; text-align: left; }
.quest { padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); }
.quest.done { border-color: rgba(111,224,138,.5); background: rgba(111,224,138,.1); }
.quest .qt { font-weight: 800; font-size: 14px; }
.quest .qbar { height: 8px; margin: 8px 0 6px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; }
.quest .qbar i { display: block; height: 100%; background: linear-gradient(90deg, #ffd24a, #f0a924); border-radius: 4px; }
.quest.done .qbar i { background: #6fe08a; }
.quest .qr { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: rgba(255,255,255,.7); font-weight: 700; }
.quest .qr span { display: inline-flex; align-items: center; gap: 4px; color: #ffd24a; }
.quest .coin, .chestRow .coin { width: 16px; height: 16px; }
.chestRow { display: flex; justify-content: center; align-items: center; gap: 8px; font-weight: 800; }
.chestRow b { display: inline-flex; align-items: center; gap: 4px; color: #ffd24a; }
.qnote { font-size: 12px; margin: 6px 0 12px !important; }
@media (max-height: 460px) { #resGoals { font-size: 12px; margin: -6px 0 6px; gap: 2px; } .quests { gap: 6px; margin: 8px 0; } .quest { padding: 6px 10px; } .quest .qbar { margin: 5px 0 4px; } }
/* три кнопки сбоку: стоя колонка начинается выше, чтобы не заходить на нижнюю панель */
@media (max-aspect-ratio: 1/1) { #rail { top: 20%; } }
@media (max-aspect-ratio: 1/1) and (max-height: 700px) { #rail { top: 148px; gap: 4px; } }
@media (max-aspect-ratio: 1/1) and (max-height: 600px) { #rail { top: 120px; gap: 2px; } .railbtn svg { width: 40px; height: 40px; padding: 9px; } }
@media (max-height: 360px) { #resGoals .g:nth-child(n+2) { display: none; } #resGoals { margin: -8px 0 4px; } }
@media (max-height: 460px) { .quests { grid-template-columns: repeat(3, 1fr); gap: 8px; } .quest .qt { font-size: 12px; min-height: 30px; } .quest .qr { font-size: 11px; } .qnote { display: none; } #modalCard:has(.quests) { width: min(100%, 640px); } #modalCard:has(.quests) .mtitle { margin: 0; } }
.qbtns { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; } .qbtns .pill { height: 52px; padding: 0 22px; }
