/* Стиль интерфейса под новую графику (pastel kawaii): пастельные цвета, сливовая обводка #894E6D,
   мягкие глянцевые кнопки, лавандовые окна с узором из лапок. Шрифт — Montserrat Black. */
/* основной шрифт — Nunito Black: пухлый и округлый, как буквы логотипа (OFL); Montserrat — запасной для ★, ∞ и редких знаков */
@font-face { font-family: "TS"; src: url("../assets/ts/fonts/Nunito-Black.ttf") format("truetype"); font-weight: 900; font-display: swap; }
@font-face { font-family: "TS2"; src: url("../assets/ts/fonts/Montserrat-Black.ttf") format("truetype"); font-weight: 900; font-display: swap; }

:root {
  --ink: #894e6d;      /* обводка и тени — как у спрайтов */
  --ink-d: #6e3a57;
  --cream: #fff8ec;
  --lilac: #c9b6f2;
  --text: #ffffff;
  /* обводка для всего текста в игре, наследуется от body */
  --outline: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink),
    0 -2px 0 var(--ink), -2px 0 0 var(--ink), 2px 0 0 var(--ink), 0 3px 0 var(--ink);
  /* для мелкого текста: с обводкой 2px буквы слипаются */
  --outline-sm: -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink), 1px 1px 0 var(--ink),
    0 -1px 0 var(--ink), -1px 0 0 var(--ink), 1px 0 0 var(--ink), 0 2px 0 var(--ink);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #f3e9f2;
  font-family: "TS", "TS2", "Arial Rounded MT Bold", "Arial Black", Arial, sans-serif; font-weight: 900;
  color: var(--text);
  text-shadow: var(--outline);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: none; overscroll-behavior: none;
}

#app { position: fixed; top: 0; right: 0; bottom: 0; left: 0; overflow: hidden; }
#game, #menuBg { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }
img { pointer-events: none; -webkit-user-drag: none; }

/* белый текст со сливовой обводкой */
.ts-text {
  color: #fff;
  text-shadow: var(--outline);
  letter-spacing: .5px;
}

button {
  font: inherit; color: inherit; text-shadow: inherit; border: 0; background: none; padding: 0; cursor: pointer;
  touch-action: manipulation; transition: transform .08s;
}
button:active { transform: translateY(3px) scale(.96); }
button:disabled { filter: grayscale(.5) brightness(.95); cursor: default; transform: none; }

/* ------------------------------------------------------------ кнопки -- */
/* мягкая глянцевая кнопка: светлый верх, тёмная полоса снизу, сливовая обводка, блик */
.btn {
  --c1: #c9ecaa; --c2: #9fd47a; --c3: #74ad55;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-width: 140px; height: 62px; padding: 0 22px 6px;
  border: 2.5px solid var(--ink); border-radius: 22px;
  background: linear-gradient(var(--c1) 0 48%, var(--c2) 52% 100%);
  box-shadow: inset 0 -8px 0 var(--c3), inset 0 3px 0 rgba(255,255,255,.65), 0 4px 0 -1px var(--ink);
  font-size: 24px; text-transform: uppercase; line-height: 1; overflow: hidden;
}
.btn::before {
  content: ""; position: absolute; left: 10px; top: 7px; width: 18px; height: 9px; border-radius: 50%;
  background: rgba(255,255,255,.9); transform: rotate(-25deg);
}
.btn > * { position: relative; }
.btn.violet { --c1: #e2d6ff; --c2: #bea6f3; --c3: #9a80d6; }
.btn.yellow { --c1: #fff2b0; --c2: #ffd970; --c3: #eab24a; }
.btn.pink { --c1: #ffd6e6; --c2: #ffadc9; --c3: #e886a8; }
.btn.big { height: clamp(70px, 12vh, 96px); font-size: clamp(28px, 5vh, 42px); min-width: min(420px, 70vw); border-radius: 30px; border-width: 3px; }
.btn.big::before { left: 16px; top: 9px; width: 28px; height: 13px; }
.btn.small { height: 46px; min-width: 110px; font-size: 18px; padding: 0 14px 5px; border-radius: 16px; box-shadow: inset 0 -6px 0 var(--c3), inset 0 3px 0 rgba(255,255,255,.65), 0 3px 0 -1px var(--ink); }
.btn small { font-size: .55em; opacity: .95; }
.play-tri {
  width: 0; height: 0; border-style: solid; border-width: .42em 0 .42em .68em; border-color: transparent transparent transparent #fff;
  filter: drop-shadow(2px 0 0 var(--ink)) drop-shadow(-2px 0 0 var(--ink)) drop-shadow(0 2px 0 var(--ink)) drop-shadow(0 -2px 0 var(--ink));
}
.btn img { height: 1.15em; }
.inline-ico { height: 1.1em; vertical-align: -0.2em; margin-right: 6px; }

.icon-only { width: clamp(50px, 8.5vh, 70px); height: clamp(50px, 8.5vh, 70px); }
.icon-only img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 0 rgba(137,78,109,.35)); }

/* ----------------------------------------------------------- монеты -- */
.coins-pill {
  display: inline-flex; align-items: center; gap: 8px; height: clamp(40px, 6vh, 50px);
  padding: 0 16px 0 6px; border-radius: 999px; background: rgba(255, 248, 236, .92);
  border: 2px solid var(--ink); box-shadow: 0 3px 0 -1px var(--ink);
  font-size: clamp(18px, 3vh, 26px);
}
.coins-pill > img { height: 125%; margin-left: -12px; }
.coins-pill.big { height: clamp(46px, 7vh, 58px); font-size: clamp(22px, 3.6vh, 30px); padding-right: 6px; }
.plus-btn { height: 92%; margin-left: 6px; }
.plus-btn img { width: 100%; height: 100%; }

/* ---------------------------------------------------------------- HUD -- */
#hud {
  --h: clamp(34px, 5.6vh, 46px);
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; align-items: center; gap: 12px;
  padding: max(6px, env(safe-area-inset-top)) 12px 0; pointer-events: none;
}
#hud > * { pointer-events: auto; }
.hud-btn {
  flex: 0 0 auto; width: var(--h); height: var(--h); border-radius: 14px;
  background: linear-gradient(#e2d6ff 0 48%, #bea6f3 52%);
  border: 2px solid var(--ink); box-shadow: inset 0 -5px 0 #9a80d6, inset 0 2px 0 rgba(255,255,255,.65), 0 3px 0 -1px var(--ink);
  display: grid; place-items: center; padding: 0 0 3px;
}
.hud-btn svg { width: 62%; height: 62%; fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 0 var(--ink)); }
.hud-progress { flex: 1; max-width: 520px; margin: 0 auto; display: flex; align-items: center; }
.lvl-badge {
  position: relative; z-index: 1; flex: 0 0 auto; width: calc(var(--h) * 1.05); height: calc(var(--h) * 1.05); margin-right: calc(var(--h) * -0.35);
  border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6c4, #ffd970 60%, #eab24a);
  border: 2px solid var(--ink); box-shadow: 0 3px 0 -1px var(--ink);
  display: grid; place-items: center; font-size: calc(var(--h) * .5);
}
.progress {
  position: relative; flex: 1; height: calc(var(--h) * .62);
  background: #f4e6f0; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden;
  box-shadow: 0 3px 0 -1px var(--ink), inset 0 3px 0 rgba(137,78,109,.18);
}
.progress-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%; border-radius: 999px;
  background: linear-gradient(#ffb8d2 0 45%, #ff8fb8 55% 100%);
  box-shadow: inset 0 -3px 0 #e46f9c; transition: width .15s linear;
}
.progress span { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: grid; place-items: center; font-size: calc(var(--h) * .34); padding-left: calc(var(--h) * .3); }
#hud .coins-pill { flex: 0 0 auto; height: var(--h); font-size: calc(var(--h) * .45); }

.tap-hint {
  position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
  font-size: clamp(20px, 4vh, 34px); text-transform: uppercase; text-align: center; white-space: nowrap;
}
.tap-hand { width: clamp(60px, 11vh, 96px); animation: press 1.1s ease-in-out infinite; transform-origin: 50% 90%; }
.orientation-gate {
  position: fixed; inset: 0; z-index: 10000; display: none;
  overflow: hidden; background: linear-gradient(180deg, #a1ebed 0%, #d8f6ec 55%, #f6e8ff 100%);
  color: #fff; text-shadow: var(--outline);
  flex-direction: column; align-items: center; justify-content: center;
  padding: 28px; text-align: center; font-size: clamp(20px, 5vw, 30px);
}
.orientation-gate.active { display: flex; }
.reset-progress-confirm { padding: 14px; border: 2px solid #b777a1; border-radius: 16px; background: #fff8ec;
  color: #683e58; text-shadow: none; font-size: 14px; line-height: 1.4; }
.reset-progress-confirm .btn { width: 100%; margin-top: 8px; }
#btnResetProgress { margin-top: 16px; width: 100%; }
.orientation-gate p { position: relative; z-index: 1; max-width: 390px; margin: 12px 0 0;
  font-size: clamp(26px, 7vw, 38px); line-height: 1.35; }
.orientation-title { position: relative; z-index: 1; font-size: clamp(48px, 13vw, 86px);
  letter-spacing: -1px; color: #fff3aa; transform: rotate(-4deg); }
.orientation-device { position: relative; z-index: 1; width: 170px; height: 170px; margin-top: 25px;
  display: grid; place-items: center; }
.orientation-phone { width: 160px; height: 160px; overflow: visible; fill: #fff8ec;
  stroke: #894e6d; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.orientation-phone-body { transform-origin: 80px 80px; animation: rotatePhone 2.8s ease-in-out infinite; }
.orientation-turn-arrow { fill: none; stroke: #b177a4; }
.orientation-window { position: relative; display: none; width: 95px; height: 95px;
  border: 6px solid #894e6d; border-radius: 12px; background: #fff8ec;
  animation: expandWindow 2.8s ease-in-out infinite; }
.orientation-window span { position: absolute; top: 12px; left: 0; right: 0; border-top: 4px solid #894e6d; }
.orientation-window b { display: block; margin-top: 23px; font: bold 54px Arial,sans-serif; color: #894e6d; text-shadow: none; }
.orientation-gate[data-device="desktop"] .orientation-phone { display: none; }
.orientation-gate[data-device="desktop"] .orientation-window { display: block; }
@keyframes rotatePhone { 0%,15% { transform: rotate(0); } 55%,80% { transform: rotate(90deg); } 100% { transform: rotate(0); } }
@keyframes expandWindow { 0%,15%,100% { width: 95px; } 55%,80% { width: 160px; } }
.orientation-clouds { position: absolute; inset: 0; pointer-events: none; }
.orientation-clouds img { position: absolute; width: 65%; height: auto; object-fit: contain;
  animation: orientationCloud 9s ease-in-out infinite alternate; }
.orientation-clouds img:nth-child(1) { left: -18%; top: 8%; }
.orientation-clouds img:nth-child(2) { right: -20%; top: 22%; animation-delay: -4s; }
.orientation-clouds img:nth-child(3) { left: -20%; bottom: 22%; animation-delay: -2s; }
.orientation-clouds img:nth-child(4) { right: -22%; bottom: 5%; animation-delay: -6s; }
.orientation-clouds img:nth-child(5) { left: 10%; bottom: -6%; width: 100%; }
.orientation-blocked #app { visibility: hidden; }
@keyframes orientationCloud { to { transform: translateX(24px); } }
@media (prefers-reduced-motion: reduce) {
  .orientation-clouds img, .orientation-phone-body, .orientation-window { animation: none; }
}
@media (max-aspect-ratio: 999/1000) {
  .orientation-gate { display: flex; }
  #app { visibility: hidden; }
}
.tutorial { position: absolute; inset: 0; z-index: 12; pointer-events: none; }
.tutorial-header { position: absolute; top: 60px; left: 24px; right: 24px; text-align: center;
  padding: 6px 220px 10px; background: linear-gradient(90deg, transparent, #4e294b99, transparent);
  color: white; text-shadow: var(--outline-sm); }
#tutorialTitle { font-size: 20px; letter-spacing: 2px; }
#tutorialStep { margin-left: 10px; font-size: 12px; }
.tutorial-progress { height: 4px; width: min(300px, 80%); margin: 6px auto; background: #ffffff44; border-radius: 4px; }
#tutorialProgress { display: block; height: 100%; background: #ffe56d; border-radius: 4px; transition: width .25s; }
#tutorialBody { margin: 4px 0 0; font-size: clamp(13px, 2.3vh, 19px); line-height: 1.25; }
#tutorialSkip { position: absolute; right: 0; top: 0; pointer-events: auto; min-height: 60px;
  width: 195px; padding: 12px 18px; border: 3px solid #b777a1; border-radius: 16px;
  box-shadow: 0 4px 0 #9f6689; background: #eeddf5; color: #633651; text-shadow: none;
  font: inherit; font-size: 17px; cursor: pointer; }
.tutorial-prompt { position: absolute; left: 50%; bottom: 10%; transform: translateX(-50%);
  display: flex; align-items: center; justify-content: center; gap: 12px; width: max-content; max-width: calc(100% - 30px);
  text-align: center; font-size: clamp(18px, 3.5vh, 28px); line-height: 1.25; }
#tutorialIcon { width: 48px; height: 64px; object-fit: contain; animation: press 1s ease-in-out infinite; }
#tutorialCounter { width: 42px; height: 42px; flex-shrink: 0; display: grid; place-items: center;
  border: 3px solid white; border-radius: 50%; font-size: 22px; }
.tutorial-marker { position: fixed; z-index: 10; width: 64px; height: 64px; margin: -32px;
  border: 3px dashed #fff; border-radius: 50%; box-shadow: 0 0 14px #ffda65;
  pointer-events: none; animation: tutorialPulse 1s ease-in-out infinite; }
.tutorial-shade { position: absolute; inset: 0; z-index: 9; background: #22132933; pointer-events: none; }
.tutorial-marker.portal-highlight { border: 3px solid #fff3b0; border-radius: 50%;
  box-shadow: 0 0 18px #ffdf77, 0 0 35px #fff4bd88; animation: none; }
@keyframes tutorialPulse { 50% { transform: scale(1.18); } }
@media (max-height: 480px) {
  .tutorial-header { top: 46px; left: 12px; right: 12px; padding: 4px 155px 6px 20px; }
  #tutorialTitle { font-size: 15px; }
  #tutorialBody { font-size: 12px; }
  #tutorialSkip { width: 145px; min-height: 50px; font-size: 13px; padding: 8px; border-radius: 12px; }
  .tutorial-prompt { bottom: 9%; font-size: 17px; gap: 8px; }
  #tutorialIcon { width: 32px; height: 42px; }
  #tutorialCounter { width: 32px; height: 32px; font-size: 17px; }
}
@keyframes press { 50% { transform: translateY(10px) scale(.92); } }

/* --------------------------------------------------------------- Меню -- */
.screen {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; flex-direction: column; align-items: center;
  padding: max(10px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom));
}
.menu-top { width: 100%; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.menu-center { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
.menu-logo { display: block; height: min(46vh, 420px); max-height: 100%; max-width: min(88vw, 820px); object-fit: contain; animation: logo 3s ease-in-out infinite; }
@keyframes logo { 50% { transform: scale(1.03) rotate(-1deg); } }

.menu-hero { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; width: 100%; }
.hero-glow {
  position: absolute; width: min(42vh, 64vw); aspect-ratio: 1;
  background: url("../assets/art/ui/rays.webp") center / contain no-repeat; opacity: .55;
  animation: spin 22s linear infinite;
}
#heroCanvas { position: relative; height: min(100%, 34vh); width: auto; max-width: 90vw; }

.menu-bottom { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 10px; }
.menu-bottom > .side-btn:first-child { justify-self: start; }
.menu-bottom > .side-btn:last-child { justify-self: end; }
.menu-buttons { display: flex; flex-direction: column; gap: 1.4vh; align-items: center; }
.menu-buttons .btn.violet { min-width: min(320px, 56vw); height: clamp(54px, 9vh, 72px); font-size: clamp(20px, 3.6vh, 30px); }
.side-btn { width: clamp(90px, 16vh, 140px); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: clamp(14px, 2.4vh, 20px); text-transform: uppercase; }
.side-btn > img { width: 100%; animation: bob 2.4s ease-in-out infinite; }
.side-btn:last-child > img { animation-delay: -1.2s; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-3deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
#btnPlay { animation: beat 1.4s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* ------------------------------------------------------------- Панели -- */
.overlay { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(110, 58, 87, .45); backdrop-filter: blur(2px); }
.panel {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(560px, 94vw); max-height: 92vh; display: flex; flex-direction: column;
  background: url("../assets/art/ui/panel_bg.webp") 0 0 / 256px 256px repeat, #d9cdf6;
  border: 3px solid var(--ink); border-radius: 30px;
  box-shadow: inset 0 -8px 0 rgba(137,78,109,.18), inset 0 4px 0 rgba(255,255,255,.5), 0 5px 0 -1px var(--ink), 0 24px 50px rgba(110,58,87,.35);
  padding: 0 16px 18px;
  animation: panelin .28s cubic-bezier(.2, 1.5, .4, 1);
}
@keyframes panelin { from { transform: translate(-50%, -50%) scale(.6); opacity: 0; } }
.panel.wide { width: min(900px, 96vw); }
.panel-head {
  position: relative; display: flex; align-items: center; justify-content: center;
  height: 64px; margin: 0 -16px 12px; border-radius: 25px 25px 0 0;
  background: linear-gradient(#ffd0e2, #ffadc9); border-bottom: 3px solid var(--ink);
  font-size: clamp(24px, 4.4vh, 34px); text-transform: uppercase;
}
.close-btn { position: absolute; right: -18px; top: -18px; width: 60px; height: 60px; }
.close-btn img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 0 rgba(137,78,109,.35)); }

/* карточки категорий */
.category-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; overflow-y: auto; padding: 6px 4px 10px; }
.cat-card {
  position: relative; flex: 0 0 auto; cursor: pointer;
  width: min(156px, 15vw, calc((92vh - 100px) * 0.78)); height: calc(min(156px, 15vw, calc((92vh - 100px) * 0.78)) * 1.25);
  background: url("../assets/art/ui/card.webp") center / 100% 100% no-repeat;
  padding: 8px 10px; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  transition: transform .1s;
}
.cat-card:not(.locked) { background-image: url("../assets/art/ui/card_sel.webp"); }
.cat-card:active { transform: scale(.96); }
.cat-card .cat-img { width: 84%; height: auto; object-fit: contain; margin-top: 6%; }
.cat-card .cat-name { font-size: clamp(13px, 2vw, 19px); text-transform: uppercase; }
.cat-card .cat-progress { width: 84%; height: 20px; border-radius: 999px; background: #f4e6f0; position: relative; overflow: hidden; border: 2px solid var(--ink); margin-bottom: 10px; }
.cat-card .cat-progress i { position: absolute; top: 0; bottom: 0; left: 0; right: auto; background: linear-gradient(#ffb8d2 0 45%, #ff8fb8 55%); }
.cat-card .cat-progress b { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: grid; place-items: center; font-size: 12px; }
.cat-card.locked .cat-img { filter: grayscale(.85) brightness(.85) opacity(.8); }
.cat-card .lock { position: absolute; top: 32%; left: 50%; width: 34%; transform: translate(-50%, -50%); }
.cat-card .lock.shake { animation: shake .5s linear; }
.cat-card .cost { display: inline-flex; align-items: center; gap: 4px; padding: 2px 12px 2px 4px; margin-bottom: 10px; border-radius: 999px; background: var(--cream); border: 2px solid var(--ink); font-size: 18px; }
.cat-card .cost img { width: 28px; }
.cat-card .hint { position: absolute; left: 6px; right: 6px; top: 48%; text-align: center; font-size: 13px; background: #ff8fb8; border: 2px solid var(--ink); border-radius: 12px; padding: 4px; }
@keyframes shake {
  0%, 100% { transform: translate(-50%, -50%) rotate(0); }
  15% { transform: translate(-50%, -50%) rotate(15deg); } 30% { transform: translate(-50%, -50%) rotate(-12deg); }
  45% { transform: translate(-50%, -50%) rotate(9deg); } 60% { transform: translate(-50%, -50%) rotate(-6deg); } 80% { transform: translate(-50%, -50%) rotate(3deg); }
}

/* магазин */
.shop-top { display: flex; justify-content: center; align-items: center; gap: 16px; margin-bottom: 12px; }
.skin-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 22vh), 1fr)); gap: 14px; overflow-y: auto; padding: 6px 4px 10px; }
.skin-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px 18px;
  background: url("../assets/art/ui/card.webp") center / 100% 100% no-repeat;
}
.skin-card.selected { background-image: url("../assets/art/ui/card_sel.webp"); }
.skin-card .skin-ico { width: 100%; max-width: min(120px, 18vh); height: auto; object-fit: contain; }
.skin-card .skin-name { font-size: 15px; text-transform: uppercase; text-align: center; }
.skin-card .btn { min-width: 108px; }

/* настройки */
.toggle-row { display: flex; align-items: center; gap: 14px; font-size: 26px; padding: 16px 12px; cursor: pointer; text-transform: uppercase; }
.toggle-row .row-ico { height: 48px; }
.toggle-row span { flex: 1; }
.toggle-row input { display: none; }
.toggle-row i { width: 86px; height: 46px; border-radius: 999px; background: #e6d9e4; border: 2.5px solid var(--ink); position: relative; transition: background .2s; box-shadow: inset 0 4px 0 rgba(137,78,109,.18); }
.toggle-row i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 32px; height: 32px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); transition: left .2s; }
.toggle-row input:checked + i { background: #9fd47a; }
.toggle-row input:checked + i::after { left: 41px; }

/* ----------------------------------------------------------- Результат -- */
.result { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(110, 58, 87, .45); display: grid; place-items: center; animation: fadein .25s ease-out; overflow: hidden; }
.result-rays {
  position: absolute; left: 50%; top: 42%; width: 130vmax; height: 130vmax; margin: -65vmax 0 0 -65vmax;
  background: url("../assets/art/ui/rays.webp") center / contain no-repeat; opacity: .7;
  animation: spin 18s linear infinite;
}
.result.lose .result-rays { opacity: .2; }
.result-card {
  position: relative; width: min(480px, 92vw); padding: 62px 22px 26px; text-align: center;
  background: url("../assets/art/ui/panel_bg.webp") 0 0 / 256px 256px repeat, #d9cdf6;
  border: 3px solid var(--ink); border-radius: 32px;
  box-shadow: inset 0 -8px 0 rgba(137,78,109,.18), inset 0 4px 0 rgba(255,255,255,.5), 0 5px 0 -1px var(--ink);
  transform: scale(var(--rs, 1)); margin-top: calc(70px * var(--rs, 1));
  animation: popin .35s cubic-bezier(.2, 1.6, .4, 1);
}
.result-plate { position: absolute; left: 50%; top: 0; width: 122%; transform: translate(-50%, -58%); }
.plate-img { width: 100%; display: block; }
.result-title {
  position: absolute; left: 14%; right: 14%; top: 38%; bottom: 14%; display: grid; place-items: center;
  font-size: clamp(24px, 5vh, 40px); text-transform: uppercase;
}
.result-text { margin: 4px 0 18px; font-size: 20px; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 30px; }
.result-text img { width: 34px; }
.result-buttons { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.result-buttons .btn { width: min(340px, 78vw); height: 66px; font-size: 24px; }
.result-buttons .btn img { height: 32px; }
@keyframes fadein { from { opacity: 0; } }
@keyframes popin { from { transform: scale(calc(var(--rs, 1) * .6)); opacity: 0; } }
@media (max-height: 640px) { .result { --rs: .86; } }
@media (max-height: 540px) { .result { --rs: .74; } }
@media (max-height: 440px) { .result { --rs: .64; } }
@media (max-height: 360px) { .result { --rs: .55; } }

/* ----------------------------------------------------------- Служебное -- */
.ad-wait { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(110,58,87,.75); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; font-size: 24px; z-index: 50; text-align: center; }
.toast {
  position: absolute; left: 50%; bottom: 12%; transform: translateX(-50%); padding: 12px 22px; border-radius: 18px;
  background: #ff9cc1; border: 2.5px solid var(--ink); font-size: 20px; z-index: 60; text-align: center; max-width: 90vw; box-shadow: 0 3px 0 -1px var(--ink);
}
.loading {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; font-size: 24px;
  background: linear-gradient(#c9f2e3, #fff6dc);
}
.loading-logo { width: min(520px, 80vw); }
.spinner { width: 56px; height: 56px; border-radius: 50%; border: 7px solid rgba(137,78,109,.2); border-top-color: var(--ink); animation: spin .9s linear infinite; }

@media (max-height: 480px) {
  .btn.big { height: 62px; font-size: 26px; }
  .menu-buttons .btn.violet { height: 50px; font-size: 18px; }
  .panel-head { height: 52px; font-size: 22px; }
  .side-btn { width: 84px; font-size: 13px; }
  .result-card { padding-top: 48px; }
  .result-buttons .btn { height: 54px; font-size: 20px; }
  .result-buttons { gap: 10px; }
}

/* прокрутка списков пальцем */
.category-list, .skin-list { touch-action: pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.category-list *, .skin-list * { touch-action: pan-y; }

/* =================================================================== */
/* Читаемость: контрастные карточки, тёмный текст на светлом, спокойный фон окон */
:root { --card: #fffaf2; --card-locked: #ece4f4; --good: #6cc24a; --plum-text: #5c2c48; }

/* фон окна: насыщеннее, узор из лапок приглушён */
.panel, .result-card { background: #a88fe3; isolation: isolate; }
.panel::before, .result-card::before {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: inherit; z-index: -1;
  background: url("../assets/art/ui/panel_bg.webp") 0 0 / 256px 256px repeat; opacity: .28;
}
.panel-head { background: linear-gradient(#ff9fc3, #ff7aab); }

/* тёмный текст без обводки — для светлых карточек и плашек */
.dark-text { color: #fff; letter-spacing: .3px; }

/* карточки категорий и скинов: сплошные, светлые, с толстой сливовой обводкой */
.cat-card, .skin-card {
  background: var(--card) !important; border: 2.5px solid var(--ink); border-radius: 22px;
  box-shadow: 0 4px 0 -1px var(--ink), inset 0 -6px 0 rgba(137,78,109,.12);
}
.cat-card:not(.locked), .skin-card.selected {
  border-color: var(--ink); box-shadow: 0 4px 0 -1px var(--ink), inset 0 0 0 4px var(--good), inset 0 -6px 0 rgba(137,78,109,.12);
}
.cat-card.locked { background: var(--card-locked) !important; }
.cat-card .cat-name, .skin-card .skin-name { color: #fff; font-size: clamp(13px, 1.9vw, 18px); }
.cat-card .cat-progress { background: #f0dfe9; }
.cat-card .cat-progress b { color: #fff; }
.cat-card .cost, .shop-top .coins-pill { background: var(--plum-text); border-color: var(--ink); color: #fff; }
.cat-card.locked .cat-img { filter: grayscale(1) brightness(.9) contrast(.9) opacity(.75); }
.cat-card .lock { filter: drop-shadow(0 3px 0 rgba(92,44,72,.45)); }

/* счётчик монет: тёмная плашка, белые цифры — читается и на небе, и на земле */
.coins-pill { background: var(--plum-text); border-color: var(--ink); box-shadow: 0 3px 0 -1px var(--ink); }
.coins-pill .ts-text, .coins-pill span { color: #fff; }

/* подписи под иконками меню — на тёмной подложке */
.side-btn > span { background: var(--plum-text); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 12px; }

/* кнопки: текст с обводкой потемнее, чтобы не сливался со светлой заливкой */
.btn .ts-text {
  text-shadow: -2px -2px 0 var(--plum-text), 2px -2px 0 var(--plum-text), -2px 2px 0 var(--plum-text), 2px 2px 0 var(--plum-text),
    0 -2px 0 var(--plum-text), 0 2px 0 var(--plum-text), -2px 0 0 var(--plum-text), 2px 0 0 var(--plum-text), 0 3px 0 var(--plum-text);
}
.btn.violet { --c1: #c8b4ff; --c2: #9c7ff0; --c3: #7457cc; }
.btn.green { --c1: #b6e98f; --c2: #7fcb55; --c3: #5ca63a; }
.btn.yellow { --c1: #ffe680; --c2: #ffc93d; --c3: #e0a020; }

/* настройки и текст результата — на светлых плашках */
.toggle-row { background: var(--card); border: 2.5px solid var(--ink); border-radius: 20px; margin: 4px 0; box-shadow: 0 3px 0 -1px var(--ink); }
.toggle-row span { color: #fff; }
.result-text { background: var(--card); border: 2px solid var(--ink); border-radius: 16px; padding: 8px 12px; }
.result-text.ts-text { color: #fff; }

/* анимация награды: летящие монетки и «+N» */
.fly-coin { position: absolute; left: 0; top: 0; opacity: 0; width: clamp(30px, 5vh, 44px); z-index: 80; pointer-events: none; filter: drop-shadow(0 3px 0 rgba(92,44,72,.4)); }
.coins-pill.pulse { animation: pillpulse .25s ease-out; }
@keyframes pillpulse { 50% { transform: scale(1.15); } }

/* «бабл» счётчика монет при подборе монетки в уровне */
.coins-pill.bubble { animation: bubble .42s cubic-bezier(.2, 1.8, .4, 1); }
.coins-pill.bubble > img { animation: coinwiggle .42s ease-out; }
@keyframes bubble { 0% { transform: scale(1); } 35% { transform: scale(1.22, 1.12); } 60% { transform: scale(.94, 1.04); } 100% { transform: scale(1); } }
@keyframes coinwiggle { 0% { transform: rotate(0) scale(1); } 30% { transform: rotate(-18deg) scale(1.25); } 65% { transform: rotate(10deg) scale(1.05); } 100% { transform: rotate(0) scale(1); } }


/* ====================================================================== */
/* Тексты на любых языках: направление строки определяется по первому сильному символу (арабский и др.),
   запасные шрифты — для арабского, китайского, японского, хинди. Раскладка интерфейса остаётся слева направо. */
html { direction: ltr; }
.ts-text, [data-i18n], .lang-chip, .skin-name, .cat-name { unicode-bidi: plaintext; }
html, body, button, input { font-family: "TS", "TS2", "Noto Sans", "Noto Sans Arabic", "Noto Sans JP", "Noto Sans SC", "Segoe UI", "Microsoft YaHei", "Yu Gothic", "Arial Black", Arial, sans-serif; }
.btn, .cat-name, .skin-name, .result-title, .panel-head { overflow-wrap: anywhere; }
.btn { text-align: center; }

/* ----------------------------------------------- кнопки наград с подписью «реклама» */
.btn .reward-copy { display: flex; min-width: 0; flex: 0 1 auto; flex-direction: column; align-items: center; line-height: 1.05; }
.btn .reward-caption { font-size: .5em; letter-spacing: .3px; margin-top: 3px; opacity: .95; }
.result-buttons .btn.reward-action { height: 76px; }
.result-buttons .btn.reward-action > img { height: 38px; }
.ad-pill { display: inline-flex; align-items: center; gap: 6px; height: 84%; padding: 0 12px 0 8px; margin-left: 8px; border-radius: 999px;
  background: linear-gradient(#e2d6ff 0 48%, #bea6f3 52%); border: 2px solid var(--ink); box-shadow: inset 0 -4px 0 #9a80d6, 0 3px 0 -1px var(--ink); font-size: .55em; }
.ad-pill img { height: 1.3em; width: auto; }
.side-btn .inline-ico { margin-right: 4px; }

/* ежедневный подарок в меню */
/* правый верхний угол меню: под монетами — подарок дня; он висит под строкой и не уменьшает логотип.
   z-index не задаём: окна (уровни, магазин) должны перекрывать меню целиком */
.menu-top-left { display: flex; align-items: center; gap: 10px; }
.menu-top-right { position: relative; display: flex; }
.menu-top-right > #btnDaily { position: absolute; top: calc(100% + 8px); right: 0; }
.daily-btn { display: flex; align-items: center; gap: 6px; height: clamp(50px, 8.5vh, 70px); padding: 0 12px 0 6px; border-radius: 999px;
  background: linear-gradient(#d9c9ff 0 48%, #a98cf0 52%); border: 2.5px solid #4a2540; box-shadow: inset 0 -5px 0 #7c5fcf, inset 0 3px 0 rgba(255,255,255,.55), 0 3px 0 -1px #4a2540; }
.daily-btn > img { height: 82%; width: auto; }
.daily-col { display: flex; flex-direction: column; align-items: center; line-height: 1.05; font-size: clamp(16px, 2.8vh, 22px); }
.daily-amt img { height: 1em; margin-right: 3px; vertical-align: -0.15em; }
.daily-timer { font-size: .62em; }
.daily-ad { font-size: .55em; text-transform: uppercase; margin-top: 2px; }
.daily-amt .ad-mark { margin-right: 4px; }
.daily-btn.wait .daily-ad { display: none; }
.daily-btn.ready { animation: beat 1.2s ease-in-out infinite; }
.daily-btn.wait { filter: grayscale(.75) brightness(.95); }
.daily-btn.wait .daily-amt { display: none; }
.daily-btn.ready .daily-timer { display: none; }
.skin-note { font-size: 11px; text-transform: uppercase; opacity: .95; }

/* ------------------------------------------------------------ настройки */
.settings-body { overflow-y: auto; max-height: calc(92vh - 96px); touch-action: pan-y; padding: 4px 2px 6px; }
.vol-row { display: flex; align-items: center; gap: 12px; margin: 6px 0; padding: 12px 14px; font-size: 22px; text-transform: uppercase;
  background: var(--card); border: 2.5px solid var(--ink); border-radius: 20px; box-shadow: 0 3px 0 -1px var(--ink); }
.vol-row > .ts-text:first-child { flex: 0 0 auto; color: #fff; }
.vol-row #volVal { flex: 0 0 2.4em; text-align: right; color: #fff; }
#volRange { --v: 100%; -webkit-appearance: none; appearance: none; flex: 1; min-width: 80px; height: 30px; background: transparent; touch-action: pan-x; cursor: pointer; }
#volRange::-webkit-slider-runnable-track { height: 18px; border-radius: 999px; border: 2px solid var(--ink);
  background: linear-gradient(90deg, #ff8fb8 var(--v), #f0dfe9 var(--v)); }
#volRange::-moz-range-track { height: 12px; border-radius: 999px; border: 2px solid var(--ink); background: #f0dfe9; }
#volRange::-moz-range-progress { height: 12px; border-radius: 999px; background: #ff8fb8; }
#volRange::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 34px; height: 34px; margin-top: -11px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c4, #ffd970 60%, #eab24a); border: 2.5px solid var(--ink); box-shadow: 0 3px 0 -1px var(--ink); }
#volRange::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: #ffd970; border: 2.5px solid var(--ink); box-shadow: 0 3px 0 -1px var(--ink); }
.lang-title { margin: 12px 4px 6px; font-size: 20px; text-transform: uppercase; }
.lang-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px; }
.lang-chip { min-width: 98px; padding: 8px 12px; border-radius: 14px; background: var(--card); border: 2px solid var(--ink); box-shadow: 0 3px 0 -1px var(--ink);
  font-size: 15px; color: #fff; }
.lang-chip.on { background: #b6e98f; box-shadow: 0 3px 0 -1px var(--ink), inset 0 0 0 3px #5ca63a; }
@media (max-height: 480px) {
  .vol-row { padding: 8px 12px; font-size: 18px; }
  .lang-chip { min-width: 84px; padding: 6px 8px; font-size: 13px; }
  .settings-body { max-height: calc(92vh - 70px); }
}

/* длинные слова на маленьких кнопках не рвутся: кнопка в одну строку, шрифт чуть меньше */
.btn.small { white-space: nowrap; overflow-wrap: normal; }
.skin-card .btn { min-width: 0; max-width: 100%; font-size: 13px; padding: 0 10px 5px; }
.skin-card .btn img { height: 20px; }
.skin-card .skin-note.ts-text { color: #fff; font-size: 11px; text-align: center; line-height: 1.1; }
.skin-card .skin-name { overflow-wrap: normal; }

/* карточки категорий: картинка, название и одна полоса прогресса с крупным процентом внутри */
.cat-card { min-height: calc(min(156px, 15vw, calc((92vh - 100px) * 0.78)) * 1.5); justify-content: space-between; gap: 4px; padding: 10px 10px 22px; }
.cat-card .cat-img { width: 80%; margin-top: 0; }
.cat-card .cat-progress { width: 100%; height: 26px; margin: 0; border: 2px solid var(--ink); background: #fff; flex: 0 0 auto; }
.cat-card .cat-progress i { background: #a8e8b4; min-width: 0; }
.cat-card .cat-progress.full i { background: #6fd388; }
.cat-card .cat-progress b { font-size: 16px; font-weight: 900; color: #fff; }

/* эффект открытия категории */
.cat-card.unlocking .lock { animation: lockPop .42s ease-out forwards; }
.cat-card.unlocking .cost { animation: fadeOutUp .3s ease-out forwards; }
.cat-card.unlock-pop { animation: cardPop .7s ease-out; }
@keyframes lockPop { 0% { transform: translate(-50%, -50%) scale(1) rotate(0); } 35% { transform: translate(-50%, -50%) scale(1.35) rotate(-14deg); } 100% { transform: translate(-50%, -80%) scale(.2) rotate(30deg); opacity: 0; } }
@keyframes fadeOutUp { to { transform: translateY(-10px); opacity: 0; } }
@keyframes cardPop { 0% { transform: scale(.9); box-shadow: 0 4px 0 -1px var(--ink), 0 0 0 0 rgba(255,214,90,.9); } 40% { transform: scale(1.1); box-shadow: 0 4px 0 -1px var(--ink), 0 0 0 14px rgba(255,214,90,0); } 100% { transform: scale(1); box-shadow: 0 4px 0 -1px var(--ink), 0 0 0 0 rgba(255,214,90,0); } }
.unlock-fx { position: fixed; inset: 0; z-index: 200; pointer-events: none; overflow: hidden; }
.ufx-p { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; opacity: 0; animation: ufxFly .9s cubic-bezier(.15,.7,.3,1) forwards; }
.ufx-ring { position: absolute; width: 60px; height: 60px; margin: -30px 0 0 -30px; opacity: .9; animation: ufxRing .6s ease-out forwards; }
@keyframes ufxFly { 0% { transform: translate(0,0) scale(.2); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(var(--s)) rotate(160deg); opacity: 0; } }
@keyframes ufxRing { to { transform: scale(4.2); opacity: 0; } }

/* подарочный временный скин на экране победы (парящий кружок справа от окна) */
.skin-gift { position: absolute; right: clamp(8px, 6vw, 90px); top: 50%; transform: translateY(-50%); width: clamp(120px, 20vh, 170px);
  display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 2; }
.gift-orb { position: relative; width: clamp(96px, 17vh, 140px); aspect-ratio: 1; border-radius: 50%; background: #fff;
  border: 3px solid var(--ink); box-shadow: 0 4px 0 -1px var(--ink), 0 0 26px rgba(255, 230, 128, .85); animation: giftfloat 2.6s ease-in-out infinite; }
.gift-orb canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; }
.gift-ad { z-index: 1; position: absolute; left: -10px; bottom: -6px; height: 36%; filter: drop-shadow(0 2px 0 rgba(92,44,72,.5)); }
.gift-ok { display: none; position: absolute; right: -6px; bottom: -4px; width: 34px; height: 34px; border-radius: 50%; background: #7fcb55; border: 2px solid var(--ink);
  color: #fff; font-style: normal; font-weight: 900; line-height: 28px; text-align: center; }
.skin-gift.active .gift-ok { display: block; }
.skin-gift.active .gift-ad { display: none; }
.gift-text small { display: block; font-size: .62em; opacity: .9; margin-top: 2px; text-transform: uppercase; }
.gift-text { font-size: clamp(15px, 2.8vh, 20px); text-transform: uppercase; line-height: 1.15; text-align: center; background: var(--plum-text); border: 2px solid var(--ink); border-radius: 14px; padding: 4px 8px; }
@keyframes giftfloat { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-12px) rotate(3deg); } }
.skin-gift:active .gift-orb { transform: scale(.94); }
@media (max-width: 760px) { .skin-gift { right: 2px; width: 104px; } .gift-orb { width: 84px; } }

/* подсказка про мультфильм в панели уровней */
.levels-note { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 14px 4px 4px; padding: 12px 16px;
  background: var(--card); border: 2.5px solid var(--ink); border-radius: 20px; box-shadow: 0 3px 0 -1px var(--ink); }
.levels-note .ts-text { color: #fff; font-size: clamp(15px, 2.8vh, 22px); text-align: center; text-transform: uppercase; }
.note-ico { font-size: clamp(24px, 4vh, 34px); }

/* ---------------------------------------------------------------- звёзды, выбор уровня */
.cat-card .cat-stars { font-size: 13px; line-height: 1.1; color: #fff; margin: 0; letter-spacing: .04em; }
.level-grid { display: flex; flex-direction: column; gap: 12px; padding: 6px 4px 10px; }
.grid-head { display: flex; align-items: center; gap: 12px; }
.grid-head .btn { min-width: 64px; }
.grid-title { font-size: clamp(18px, 3.4vh, 26px); text-transform: uppercase; flex: 1; text-align: center; }
.grid-stars { font-size: clamp(16px, 3vh, 22px); }
.grid-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; overflow-y: auto; max-height: calc(92vh - 230px); padding: 2px; touch-action: pan-y; }
.lv-tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; aspect-ratio: 1; min-height: 64px;
  background: var(--card); border: 2.5px solid var(--ink); border-radius: 18px; box-shadow: 0 3px 0 -1px var(--ink); padding: 4px; }
.lv-tile b { font-size: clamp(20px, 3.6vh, 28px); color: #fff; }
.lv-tile.next { background: #fff2b0; animation: beat 1.4s ease-in-out infinite; }
.lv-tile.locked { background: var(--card-locked); }
.lv-tile.locked img { width: 44%; opacity: .75; }
.lv-tile:active:not(.locked) { transform: scale(.95); }
.lv-stars { display: flex; align-items: flex-end; gap: 0; line-height: 1; }
.lv-stars i, .res-stars i, .grid-stars i { font-style: normal; }

/* результат: звёзды */
.result-text { flex-direction: column; gap: 6px; }
.res-line { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.res-line img { width: 28px; }
.res-stars { display: flex; align-items: flex-end; gap: 2px; line-height: 1; margin-top: 2px; }
/* звёзды результата: SVG, средняя крупнее и выше; заработанные влетают с поворотом и вспышкой */
.res-stars i { position: relative; display: block; width: clamp(46px, 8vh, 62px); height: clamp(46px, 8vh, 62px); transform: scale(0);
  animation: starpop .55s cubic-bezier(.2, 1.9, .4, 1) forwards; }
.res-stars i:nth-child(2) { width: clamp(58px, 10vh, 78px); height: clamp(58px, 10vh, 78px); margin-bottom: 10px; }
.res-stars i:nth-child(1) { --rot: -14deg; } .res-stars i:nth-child(3) { --rot: 14deg; }
.lv-stars svg, .grid-stars svg { display: block; width: 100%; height: 100%; overflow: visible; }
.res-stars svg { width: 100%; height: 100%; overflow: visible; transform: rotate(var(--rot, 0deg)); }
.lv-stars .st-base, .grid-stars .st-base, .res-stars .st-base { fill: #d9c6e8; stroke: var(--ink); stroke-width: 7; stroke-linejoin: round; }
.lv-stars .st-top, .res-stars .st-top { fill: #e9dcf3; }
.lv-stars .st-hi, .res-stars .st-hi { fill: rgba(255,255,255,.7); }
.lv-stars i.on .st-base, .grid-stars i.on .st-base, .res-stars i.on .st-base { fill: #f2a91f; }
.lv-stars i.on .st-top, .grid-stars i.on .st-top, .res-stars i.on .st-top { fill: #ffd84a; }
.lv-stars i.on .st-hi, .grid-stars i.on .st-hi, .res-stars i.on .st-hi { fill: #fff; }
.res-stars i.on { animation-name: starpopOn; }
.res-stars i.on::after { content: ""; position: absolute; inset: -30%; border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, rgba(255,236,140,.95) 0 25%, rgba(255,214,90,0) 65%); animation: starflash .6s ease-out forwards; animation-delay: inherit; }
@keyframes starpopOn { 0% { transform: scale(0) rotate(-180deg); } 60% { transform: scale(1.3) rotate(10deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes starflash { 0% { opacity: 0; transform: scale(.3); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1.6); } }

/* «x2 монеты» подпрыгивает, чтобы на неё нажимали */
.btn.bounce { animation: btnbounce 1.4s ease-in-out infinite; animation-delay: 1.2s; }
@keyframes btnbounce {
  0%, 50%, 100% { transform: translateY(0) scale(1, 1); }
  10% { transform: translateY(0) scale(1.06, .92); }
  22% { transform: translateY(-12px) scale(.97, 1.04); }
  34% { transform: translateY(0) scale(1.04, .95); }
  42% { transform: translateY(-4px) scale(1, 1); }
}
.btn.bounce:active { animation: none; transform: scale(.97); }
@keyframes starpop { to { transform: scale(1); } }

/* задание дня и бесконечный режим в панели уровней */
.quest-row, .endless-btn { display: flex; align-items: center; gap: 12px; margin: 10px 4px 0; padding: 8px 12px; background: var(--card);
  border: 2.5px solid var(--ink); border-radius: 20px; box-shadow: 0 3px 0 -1px var(--ink); }
.quest-row .q-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.quest-row .q-title { align-self: flex-start; font-size: 13px; line-height: 1; text-transform: uppercase; color: #fff; letter-spacing: .5px; padding: 3px 10px 4px; border-radius: 10px;
  background: #ff8fb8; border: 2px solid var(--ink); }
.quest-row .q-line { display: flex; align-items: center; gap: 12px; min-width: 0; }
.quest-row .q-body { flex: 0 1 auto; min-width: 0; font-size: clamp(17px, 3vh, 22px); line-height: 1.1; color: #fff; white-space: nowrap; }
.quest-row .q-bar { position: relative; flex: 1 1 auto; min-width: 90px; max-width: 340px; height: 26px; border-radius: 13px; background: #ead9f0; border: 2.5px solid var(--ink); overflow: hidden;
  box-shadow: inset 0 3px 0 rgba(137,78,109,.15); }
.quest-row .q-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 8px; background: linear-gradient(#ffe680 0 50%, #ffc93d 50%); transition: width .4s; }
.quest-row .q-bar b { position: relative; height: 100%; display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 15px; line-height: 1; color: #fff; text-shadow: var(--outline-sm); }
.quest-row .q-bar b img { height: 16px; }
.q-chip { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; height: 42px; padding: 0 14px 3px; border-radius: 21px;
  background: linear-gradient(#fff 0 50%, #f3e6ff 50%); border: 2.5px solid var(--ink); box-shadow: 0 3px 0 -1px var(--ink);
  font-size: 20px; color: #fff; white-space: nowrap; }
.q-chip img { height: 1.2em; }
.q-chip.got { background: linear-gradient(#b6e98f 0 50%, #7fcb55 50%); min-width: 56px; justify-content: center; font-size: 24px; }
.quest-row .q-claim { flex: 0 1 auto; min-width: 0; max-width: 46%; animation: claimpulse 1.1s ease-in-out infinite; }
@keyframes claimpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
.quest-row.done:not(.claimed) { background: #fff6cf; }
.quest-row.claimed { opacity: .75; }

.endless-btn { position: relative; width: calc(100% - 8px); text-align: left; padding: 8px 10px 12px; gap: 14px; overflow: hidden;
  background: linear-gradient(#ffb0cf 0 48%, #ff6fa5 52% 100%); border-width: 3px;
  box-shadow: inset 0 -7px 0 #d9447f, inset 0 3px 0 rgba(255,255,255,.6), 0 4px 0 -1px var(--ink), 0 0 0 0 rgba(255,111,165,0);
  animation: endglow 1.8s ease-in-out infinite; }
@keyframes endglow { 50% { box-shadow: inset 0 -7px 0 #d9447f, inset 0 3px 0 rgba(255,255,255,.6), 0 4px 0 -1px var(--ink), 0 0 18px 5px rgba(255,111,165,.7); } }
.endless-btn::after { content: ""; position: absolute; top: -20%; bottom: -20%; width: 60px; left: -80px; transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); animation: endshine 3.2s ease-in-out infinite; pointer-events: none; }
@keyframes endshine { 0%, 55% { left: -80px; } 100% { left: 110%; } }
.endless-btn > * { position: relative; }
.endless-btn .inf { flex: 0 0 auto; width: clamp(44px, 7.5vh, 58px); height: clamp(44px, 7.5vh, 58px); border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #fff3b0, #ffc93d 75%); border: 2.5px solid var(--ink); box-shadow: 0 3px 0 -1px var(--ink); }
.endless-btn .inf .ts-text { font-size: clamp(30px, 5vh, 40px); line-height: 1; margin-top: -4px; color: #fff; font-weight: 900; }
.endless-btn .endless-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.endless-btn .endless-text .ts-text { font-size: clamp(18px, 3.2vh, 24px); text-transform: uppercase; color: #fff; white-space: nowrap; }
.endless-btn small { font-size: 14px; color: #ffe680; }
.endless-btn small:empty { display: none; }
.endless-go { flex: 0 0 auto; width: clamp(40px, 6.5vh, 50px); height: clamp(40px, 6.5vh, 50px); border-radius: 50%; display: grid; place-items: center; padding-left: 4px;
  background: linear-gradient(#b6e98f 0 50%, #7fcb55 50%); border: 2.5px solid var(--ink); box-shadow: inset 0 -4px 0 #5ca63a, 0 3px 0 -1px var(--ink); font-size: 22px; }
.endless-btn:active { transform: scale(.98); }

/* панель уровней длиннее экрана (низкие телефоны в ландшафте): прокручивается целиком, карточки не сжимаются */
#levelsPanel .panel-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; touch-action: pan-y; }
#levelsPanel .panel-scroll > * { flex-shrink: 0; }
#levelsPanel .category-list { overflow: visible; }
@media (max-height: 520px) {
  .quest-row, .endless-btn { margin-top: 6px; padding: 6px 12px; }
  .levels-note { margin-top: 8px; padding: 8px 12px; }
  .grid-tiles { max-height: none; }
}

/* ---- мультфильм ---- */
#toon { position: fixed; inset: 0; z-index: 300; background: #1a0f24; opacity: 0; transition: opacity .6s; overflow: hidden; cursor: pointer; }
#toon.on { opacity: 1; }
.toon-stage, .toon-slide { position: absolute; inset: 0; }
.toon-slide { opacity: 0; transition: opacity 1.2s ease; overflow: hidden; }
.toon-slide.on { opacity: 1; }
.toon-slide img { position: absolute; inset: 0; width: 100%; height: 100%; }
.toon-slide .bg { object-fit: cover; filter: blur(28px) brightness(.7); transform: scale(1.15); }
.toon-slide .fg { object-fit: contain; animation: toonkb0 11s ease-out forwards; }
.toon-slide.k1 .fg { animation-name: toonkb1; }
.toon-slide.k2 .fg { animation-name: toonkb2; }
.toon-slide.k3 .fg { animation-name: toonkb3; }
@keyframes toonkb0 { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.1) translate(-1.2%, -1%); } }
@keyframes toonkb1 { from { transform: scale(1.1) translate(1%, 0); } to { transform: scale(1) translate(0, 0); } }
@keyframes toonkb2 { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.1) translate(1.2%, -1%); } }
@keyframes toonkb3 { from { transform: scale(1.1) translate(-1%, 1%); } to { transform: scale(1) translate(0, 0); } }
.toon-cap { position: absolute; left: 0; right: 0; bottom: max(14px, 5vh); display: flex; justify-content: center; padding: 0 5vw;
  opacity: 0; transform: translateY(8px); transition: opacity .6s, transform .6s; pointer-events: none; }
.toon-cap.on { opacity: 1; transform: none; }
.toon-cap .ts-text { max-width: 900px; text-align: center; font-size: clamp(18px, 3.6vh, 32px); line-height: 1.25; padding: 10px 20px;
  background: rgba(40, 20, 52, .62); border-radius: 16px; }
.toon-skip { position: absolute; top: max(10px, env(safe-area-inset-top, 0px)); right: max(12px, env(safe-area-inset-right, 0px));
  display: flex; align-items: center; gap: 8px; height: clamp(34px, 6vh, 44px); padding: 0 14px 0 16px; border-radius: 999px; cursor: pointer;
  background: rgba(30, 14, 40, .55); border: 2px solid rgba(255, 255, 255, .85); color: #fff; font-weight: 800; font-size: clamp(13px, 2.4vh, 17px);
  font-family: inherit; letter-spacing: .4px; backdrop-filter: blur(4px); box-shadow: 0 2px 8px rgba(0, 0, 0, .35); transition: background .15s, transform .1s; }
.toon-skip svg { width: 1.3em; height: 1.3em; fill: #ffd23f; flex: none; }
.toon-skip:hover { background: rgba(30, 14, 40, .8); }
.toon-skip:active { transform: scale(.95); }
.toon-dots { position: absolute; top: max(14px, env(safe-area-inset-top, 0px)); left: 0; right: 0; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.toon-dots i { width: 22px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .28); }
.toon-dots i.done { background: rgba(255, 255, 255, .8); }
.toon-dots i.cur { background: #ffd23f; }
.levels-note.playable { cursor: pointer; background: #ffe27a; }
.levels-note.playable:active { transform: translateY(2px); }

/* мелкий текст: обводка тоньше */
.cat-card .cat-stars, .quest-row .q-title, .endless-btn small, .skin-card .skin-note.ts-text, .btn small, .side-btn > span, .lang-chip { text-shadow: var(--outline-sm); }

/* магазин: крупные подписи и кнопки, надетый скин выделен и анимирован */
.skin-card { gap: 8px; padding: 12px 10px 16px; justify-content: space-between; }
.skin-card .skin-name { font-size: clamp(14px, 2.3vh, 19px); line-height: 1.1; letter-spacing: 0; padding: 0 4px; white-space: nowrap; max-width: 100%; }
.skin-card .btn { width: 88%; height: clamp(44px, 7vh, 54px); font-size: clamp(18px, 3vh, 24px); padding: 0 8px 5px; gap: 6px; white-space: nowrap; }
.skin-card .btn .ts-text, .skin-badge { white-space: nowrap; }
.skin-card .btn > img { height: 1.15em; }
.skin-ico-wrap { position: relative; width: 100%; max-width: min(120px, 18vh); display: grid; place-items: center; }
.skin-ico-wrap .skin-ico { position: relative; z-index: 1; max-width: 100%; }

.skin-card.selected { transform: scale(1.04); z-index: 1;
  box-shadow: 0 4px 0 -1px var(--ink), inset 0 0 0 5px var(--good), 0 0 0 4px #fff3a6, 0 0 22px 6px rgba(255, 214, 90, .75);
  animation: skinglow 1.6s ease-in-out infinite; }
.skin-card.selected .skin-ico { animation: skinhop 1.4s ease-in-out infinite; transform-origin: 50% 100%; }
.skin-rays { position: absolute; z-index: 0; left: 50%; top: 50%; width: 135%; aspect-ratio: 1; margin: -67.5% 0 0 -67.5%; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 214, 90, .55) 0 12deg, transparent 12deg 30deg);
  -webkit-mask: radial-gradient(circle, #000 35%, transparent 70%); mask: radial-gradient(circle, #000 35%, transparent 70%);
  animation: spin 9s linear infinite; }
.skin-spark { position: absolute; z-index: 2; color: #ffd23f; font-size: 22px; line-height: 1; text-shadow: var(--outline-sm); animation: sparkle 1.8s ease-in-out infinite; }
.skin-spark.s1 { left: 2%; top: 8%; }
.skin-spark.s2 { right: 0; top: 30%; font-size: 16px; animation-delay: .6s; }
.skin-spark.s3 { left: 12%; bottom: 4%; font-size: 14px; animation-delay: 1.2s; }
.skin-badge { width: 88%; height: clamp(44px, 7vh, 54px); display: grid; place-items: center; border-radius: 16px;
  font-size: clamp(18px, 3vh, 24px); text-transform: uppercase;
  background: linear-gradient(#ffd6e6 0 48%, #ff9fc4 52% 100%); border: 2px solid var(--ink);
  box-shadow: inset 0 -6px 0 #e3779f, inset 0 3px 0 rgba(255,255,255,.65), 0 3px 0 -1px var(--ink); }
@keyframes skinhop { 0%, 100% { transform: translateY(0) scale(1, 1); } 40% { transform: translateY(-9px) scale(.97, 1.04); } 60% { transform: translateY(-9px) scale(1.02, .98); } 85% { transform: translateY(0) scale(1.06, .94); } }
@keyframes skinglow { 50% { box-shadow: 0 4px 0 -1px var(--ink), inset 0 0 0 5px var(--good), 0 0 0 4px #fff3a6, 0 0 32px 10px rgba(255, 214, 90, .95); } }
@keyframes sparkle { 0%, 100% { transform: scale(.4) rotate(0); opacity: 0; } 50% { transform: scale(1.1) rotate(25deg); opacity: 1; } }
.skin-list { padding: 16px 14px 18px; gap: 16px; }
@media (max-width: 600px) and (orientation: portrait) {
  .skin-list { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px 10px 16px; gap: 14px; }
  .skin-card .btn, .skin-badge { font-size: 17px; height: 44px; width: 94%; }
}

/* открытие скина: кот выпрыгивает в центре на фоне лучей, вокруг салют, потом улетает в карточку */
.skin-unlock { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: radial-gradient(circle at 50% 45%, rgba(255, 236, 170, .55), rgba(57, 23, 73, .72) 65%); animation: fadein .25s ease-out; overflow: hidden; }
.skin-unlock.out { opacity: 0; transition: opacity .45s ease-in .05s; }
.su-rays { position: absolute; left: 50%; top: 45%; width: 150vmax; height: 150vmax; margin: -75vmax 0 0 -75vmax;
  background: repeating-conic-gradient(rgba(255, 226, 122, .5) 0 9deg, transparent 9deg 22.5deg);
  -webkit-mask: radial-gradient(circle, #000 8%, transparent 45%); mask: radial-gradient(circle, #000 8%, transparent 45%);
  animation: spin 12s linear infinite; }
.su-cat { position: absolute; left: 50%; top: 45%; width: min(46vmin, 300px); margin-left: calc(min(46vmin, 300px) / -2); transform: translateY(-50%); transition: transform .45s cubic-bezier(.5, 0, .75, 0); }
.su-cat img { width: 100%; display: block; filter: drop-shadow(0 6px 0 rgba(92, 44, 72, .35)); animation: supop .75s cubic-bezier(.2, 1.6, .4, 1) both, skinhop 1.4s ease-in-out .8s infinite; transform-origin: 50% 100%; }
.su-name { position: absolute; left: 0; right: 0; top: calc(45% + min(25vmin, 165px) + 8px); text-align: center; font-size: clamp(28px, 6vh, 52px); text-transform: uppercase; animation: suname .5s cubic-bezier(.2, 1.6, .4, 1) .35s both; }
.skin-unlock.out .su-name, .skin-unlock.out .su-rays { opacity: 0; transition: opacity .2s; }
.su-p { width: 34px; height: 34px; margin: -17px 0 0 -17px; animation-duration: 1.2s; }
.skin-card.unlock-pop { animation: cardPop .7s ease-out; }
@keyframes supop { 0% { transform: scale(0) rotate(-20deg); } 60% { transform: scale(1.15) rotate(6deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes suname { from { transform: translateY(20px) scale(.6); opacity: 0; } }

/* кнопка «Воскреснуть»: ярко-розовая и пульсирует, чтобы отличалась от «В меню» */
.btn.revive { --c1: #ffc2db; --c2: #ff77ab; --c3: #d94a82; animation: revivepulse 1.1s ease-in-out infinite; }
@keyframes revivepulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(255,119,171,0)); }
  50% { transform: scale(1.06); filter: drop-shadow(0 0 12px rgba(255,119,171,.9)); }
}
.btn.revive:active { animation: none; transform: scale(.97); }

/* звёзды в сетке уровней — те же, что на экране победы, только мелкие; средняя чуть крупнее и выше */
.lv-stars i { display: block; width: clamp(15px, 2.7vh, 21px); height: clamp(15px, 2.7vh, 21px); }
.lv-stars i:nth-child(2) { width: clamp(18px, 3.3vh, 26px); height: clamp(18px, 3.3vh, 26px); margin-bottom: 4px; }
.lv-stars .st-base, .grid-stars .st-base { stroke-width: 9; }
.grid-stars { display: flex; align-items: center; gap: 6px; }
.grid-stars i { display: block; width: 1.3em; height: 1.3em; }

/* кнопка закрытия окон: красно-розовый круг с крестиком, видна на розовой шапке */
.close-btn { border-radius: 50%; display: grid; place-items: center; padding: 0;
  background: radial-gradient(circle at 35% 30%, #ff9fb5, #f0466e 70%); border: 3px solid var(--ink);
  box-shadow: inset 0 -5px 0 #c42f55, 0 4px 0 -1px var(--ink); }
.close-btn img { width: 62%; height: 62%; filter: none; }
.close-btn:hover { transform: scale(1.06); }
.close-btn:active { transform: scale(.94); }

/* «назад» в сетке уровней: крупная жёлтая кнопка со стрелкой */
.grid-head .grid-back { height: clamp(48px, 8vh, 58px); min-width: clamp(64px, 11vh, 80px); padding: 0 12px 6px; border-radius: 18px; }
.grid-head .grid-back img { height: 72%; }

/* окно «Новый мир!»: монет хватает на следующий мир — открыть и сразу играть */
.world-offer { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 50% 45%, rgba(255, 236, 170, .45), rgba(57, 23, 73, .75) 65%); animation: fadein .25s ease-out; overflow: hidden; }
.world-offer.out { opacity: 0; transition: opacity .3s ease-in; }
.wo-rays { position: absolute; left: 50%; top: 45%; width: 150vmax; height: 150vmax; margin: -75vmax 0 0 -75vmax; pointer-events: none;
  background: repeating-conic-gradient(rgba(255, 240, 180, .22) 0 10deg, transparent 10deg 20deg); animation: spin 18s linear infinite;
  -webkit-mask: radial-gradient(circle, #000 0 18%, transparent 55%); mask: radial-gradient(circle, #000 0 18%, transparent 55%); }
.wo-card { position: relative; width: min(440px, 92vw); max-height: 96vh; display: flex; flex-direction: column; align-items: center; gap: clamp(4px, 1.2vh, 10px);
  padding: clamp(14px, 3vh, 24px) 22px clamp(14px, 3vh, 22px); background: linear-gradient(#cdb8f7, #b29ae9); border: 3px solid var(--ink); border-radius: 28px;
  box-shadow: 0 6px 0 -1px var(--ink), 0 18px 40px rgba(40, 10, 50, .45); animation: supop .55s cubic-bezier(.2, 1.6, .4, 1) both; }
.wo-title { font-size: clamp(28px, 5.4vh, 40px); color: #ffe680; text-transform: uppercase; line-height: 1; }
.wo-img { width: clamp(110px, 24vh, 170px); aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 6px 0 rgba(137, 78, 109, .35)); animation: skinhop 1.6s ease-in-out infinite; }
.wo-text { width: 100%; text-align: center; font-size: clamp(14px, 2.4vh, 18px); color: #fff; white-space: nowrap; }
.wo-name { width: 100%; text-align: center; font-size: clamp(24px, 4.4vh, 34px); color: #fff; text-transform: uppercase; line-height: 1; white-space: nowrap; }
.wo-card .btn { width: 100%; min-width: 0; white-space: nowrap; }
.wo-open { height: clamp(58px, 10vh, 72px); font-size: clamp(20px, 3.6vh, 26px); gap: 12px; animation: btnbounce 1.4s ease-in-out .7s infinite; }
.wo-open > .ts-text { min-width: 0; overflow: hidden; }
.wo-cost { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; padding: 2px 10px 2px 4px; border-radius: 999px; background: var(--plum-text); border: 2px solid var(--ink); font-size: .85em; }
.wo-cost img { height: 1.3em; }
.wo-later { height: clamp(44px, 7vh, 52px); font-size: clamp(16px, 2.8vh, 20px); }
.world-offer.opened .wo-img { animation: cardPop .6s ease-out; }
.world-offer.opened .wo-open { animation: none; transform: scale(.96); }

/* Visible early goal, away from the main controls. */
#earlyJourney { position:absolute;right:2%;top:37%;width:clamp(120px,17vw,220px);display:flex;flex-direction:column;align-items:center;gap:5px;padding:9px;border:2px solid #93658a;border-radius:18px;background:#fff7df;box-shadow:0 4px 0 #a883b4;color:#77416d;cursor:pointer;font:inherit;font-size:clamp(10px,1.3vw,17px); }
#earlyJourney.hidden { display:none; }
#earlyJourney img { width:clamp(50px,6.8vw,90px);height:clamp(50px,6.8vw,90px);object-fit:contain; }
#earlyJourney strong,#earlyJourney span,.early-result strong,.early-result span { display:block; }
#earlyJourney span { font-size:.8em;line-height:1.25; }
#earlyJourney progress,.early-result progress { width:100%;height:8px;accent-color:#8cc85d; }
.early-result { display:flex;align-items:center;gap:8px;font-size:clamp(10px,1.7vh,14px);line-height:1.2;max-width:100%; }
.result-text .early-result img { width:clamp(28px,5vh,42px);height:clamp(28px,5vh,42px);object-fit:contain; }
.early-result span { font-size:.85em; }
.early-equip { background:#b5e583;border:1px solid #719746;border-radius:8px;padding:5px 8px;color:#543353;font:inherit;cursor:pointer; }
.next-teaser { font-size:clamp(10px,1.7vh,14px);line-height:1.2; }
@media (min-aspect-ratio:999/1000) and (max-aspect-ratio:6/5) { #earlyJourney {top:14%;right:2%;width:140px;} }

#earlyJourney, #earlyJourney *, .early-result, .early-result *, .next-teaser { -webkit-text-stroke:0 !important; text-shadow:none !important; color:#67395d; }
.early-result { font-size:clamp(12px,2.1vh,16px); }
.next-teaser { font-size:clamp(11px,1.9vh,15px); }

.result-card { position:absolute;left:50%;top:calc(50% + 40px * var(--rs,1));margin-top:0;transform:translate(-50%,-50%) scale(var(--rs,1));animation:journey-pop .2s ease-out; }
@keyframes journey-pop {from {transform:translate(-50%,-50%) scale(calc(var(--rs,1) * .9));opacity:0;} }


#starTrailStatus{position:absolute;top:65px;left:50%;transform:translateX(-50%);background:#fff5cddd;color:#703c66;border:1px solid #d9ae51;border-radius:12px;padding:5px 12px;font:700 clamp(11px,1.5vw,17px) sans-serif;text-shadow:none;-webkit-text-stroke:0;white-space:nowrap;pointer-events:none;}

/* ---- Layout QA 2026-11-17: тач-зоны, кнопка закрытия, подпись подарка (docs/qa/layout-20261117) ---- */
/* кнопка «назад» в HUD не меньше 40px даже на низких экранах */
#hud { --h: clamp(40px, 5.6vh, 46px); }
/* ползунок громкости: высота зоны касания 40px (дорожка рисуется псевдоэлементами) */
#volRange { height: 40px; }
/* подпись «Временный скин» не шире кружка; длинные слова уменьшает UI.fitGift() */
.gift-text { display: block; max-width: 100%; box-sizing: border-box; overflow-wrap: normal; }
@media (max-width: 760px) { .gift-text { font-size: 13px; padding: 3px 5px; } }
/* на узких окнах крестик широкой панели не вылезает за край экрана */
@media (max-width: 960px) { .panel.wide .close-btn { right: -6px; top: -6px; } }
@media (max-height: 480px) {
  .lang-chip { min-height: 40px; }
  /* карточка результата масштабируется под высоту (--rs), поэтому кнопкам даём больший запас по высоте */
  .result-buttons { gap: 6px; }
  .result-buttons .btn { height: 64px; }
  .result-buttons .btn.reward-action { height: 72px; }
}
/* низкий ландшафт (телефоны): кнопки победы в один ряд — карточка ниже, масштаб крупнее, тач-зоны ≥ 40px */
@media (max-height: 420px) and (min-aspect-ratio: 3/2) {
  .result.win .result-card { width: min(640px, 92vw); }
  .result.win .result-buttons { flex-direction: row; align-items: stretch; justify-content: center; gap: 10px; }
  .result.win .result-buttons .btn { flex: 1 1 0; width: auto; min-width: 0; height: 72px; font-size: 20px; }
}

/* Туториал: жест «нажми» (короткий тык) и «держи» (рука прижата, кольцо заполняется) */
.tutorial-gesture { position: relative; flex: 0 0 auto; display: grid; justify-items: center; gap: 2px; }
.tutorial-gesture .hold-ring { position: absolute; left: 50%; top: 4px; width: 58px; height: 58px; margin-left: -29px; border-radius: 50%;
  border: 4px solid #ffffff66; display: none; }
.tutorial-gesture-label { font-size: 13px; letter-spacing: 1px; line-height: 1; padding: 3px 7px; border-radius: 999px; background: #6b3d68; border: 2px solid #fff; color: #fff; }
.tutorial[data-stage=tap] #tutorialIcon { animation: tap-quick 1s ease-in-out infinite; }
.tutorial[data-stage=practice] #tutorialIcon, .tutorial[data-stage=coins] #tutorialIcon,
.tutorial[data-stage=portal] #tutorialIcon { animation: hold-long 2.2s ease-in-out infinite; }
.tutorial[data-stage=practice] .hold-ring { display: block; animation: hold-ring 2.2s linear infinite; }
.tutorial[data-stage=practice] .tutorial-gesture-label { background: #3f8f3a; }
.tutorial.holding #tutorialIcon { animation: none; transform: translateY(10px) scale(.9); }
.tutorial.holding .hold-ring { animation: hold-fill .35s linear forwards; }
.tutorial.held .hold-ring { animation: none; border-color: #8ee36a; box-shadow: 0 0 14px #8ee36a; }
@keyframes tap-quick { 0%, 30%, 100% { transform: none; } 15% { transform: translateY(10px) scale(.9); } }
@keyframes hold-long { 0%, 12%, 88%, 100% { transform: none; } 22%, 78% { transform: translateY(10px) scale(.9); } }
@keyframes hold-ring { 0%, 20% { border-color: #ffffff66; box-shadow: none; } 70%, 80% { border-color: #8ee36a; box-shadow: 0 0 12px #8ee36a; } 90%, 100% { border-color: #ffffff66; box-shadow: none; } }
@keyframes hold-fill { from { border-color: #ffffff66; transform: scale(.8); } to { border-color: #c9f5a8; transform: scale(1.05); } }
.tutorial-flash { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); white-space: nowrap; padding: 4px 12px; border-radius: 999px;
  background: #ff8fb8; border: 2px solid #fff; color: #fff; font-size: .8em; animation: flash-pop .9s ease-out forwards; }
.tutorial-flash.ok { background: #5cb44a; }
@keyframes flash-pop { 0% { opacity: 0; transform: translate(-50%, 8px) scale(.8); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -6px); } }
@media (max-height: 480px) {
  .tutorial-gesture .hold-ring { width: 40px; height: 40px; margin-left: -20px; top: 2px; border-width: 3px; }
  .tutorial-gesture-label { font-size: 10px; padding: 2px 5px; }
}
@media (prefers-reduced-motion: reduce) { .tutorial #tutorialIcon, .tutorial .hold-ring { animation: none !important; } }
/* магазин на низких ландшафтных экранах: колонки не уже 96px, чтобы длинные имена скинов влезали */
@media (max-height: 480px) and (orientation: landscape) {
  .skin-list { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .skin-card { padding-left: 6px; padding-right: 6px; }
  .skin-card .skin-name { padding: 0; }
}
@media (max-height: 420px) and (min-aspect-ratio: 3/2) {
  .result.win .result-buttons .btn { overflow-wrap: normal; word-break: normal; font-size: 18px; padding-left: 8px; padding-right: 8px; }
  .result.win .result-buttons .btn.reward-action { flex-grow: 1.6; gap: 6px; }
  .result.win .result-buttons .btn.reward-action > img { height: 30px; }
  .result.win .reward-copy .ts-text { white-space: nowrap; }
  .result.win .reward-caption { font-size: 11px; }
}
@media (max-height: 480px) and (orientation: landscape) { .skin-badge { width: 100%; padding: 0 4px; text-align: center; } }

/* Пауза при потере фокуса и конфликт облачных сохранений */
.pause-hint, .reload-prompt { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; background: #4b2b4a66; }
.pause-hint { pointer-events: none; z-index: 8000; }
.pause-hint.hidden, .reload-prompt.hidden { display: none; }
.pause-hint i { width: 84px; height: 84px; border-radius: 50%; background: #fff7df; border: 4px solid #93658a; position: relative; }
.pause-hint i::after { content: ''; position: absolute; left: 32px; top: 22px; border-left: 28px solid #93658a; border-top: 20px solid transparent; border-bottom: 20px solid transparent; }
.reload-card { width: min(440px, 86vw); padding: 22px; border-radius: 22px; background: #fff7df; border: 3px solid #93658a; color: #67395d; text-align: center; font-size: clamp(14px, 2.6vh, 19px); line-height: 1.35; }
.reload-card p { margin: 0 0 16px; -webkit-text-stroke: 0; text-shadow: none; }
.reload-card .btn { width: auto; min-width: 200px; margin: 0 auto; }
