/* ksaix Jump! - стиль: маркер, толстый контур, рваная бумага, максимум цвета */

@font-face {
  font-family: 'Balsamiq';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('assets/fonts/balsamiq-lat.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+2074, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Balsamiq';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('assets/fonts/balsamiq-cyr.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  --ink: #241a24;
  --paper: #f1e0c2;
  --paper-2: #e3cea6;
  --cream: #f9edd6;
  --red: #a63228;
  --red-dark: #7d2119;
  --ochre: #cf8f2e;
  --yellow: #e8b64a;
  --pink: #ff5fa2;
  --blue: #4ec8ff;
  --green: #35d64a;
  --violet: #7b4dff;
  --orange: #ff8a3d;
  --stroke: 4px;

  /* Отступы от краёв экрана. env() знает только про вырез и домашнюю полоску,
     а клиент Telegram отдаёт ещё и «контентную» безопасную зону: она включает
     его собственные панели — шапку с крестиком, нижнюю панель, полосу жеста.
     Берём максимум из трёх: в обычном браузере переменных Telegram нет и
     остаётся env(), в полноэкранном режиме работает контентная зона.
     Иначе в fullscreen HUD и кнопки уезжают под крестик клиента. */
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px), var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px), var(--tg-content-safe-area-inset-left, 0px));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px), var(--tg-content-safe-area-inset-right, 0px));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #b8e9ff;
  font-family: 'Balsamiq', 'Comic Sans MS', system-ui, sans-serif;
  color: var(--ink);
  overscroll-behavior: none;
}

/* фон вокруг телефона: лучи и точки, как на референсе */
.page {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 0%, #fff6c9 0%, rgba(255, 246, 201, 0) 55%),
    linear-gradient(160deg, #8fe3ff 0%, #b9a4ff 48%, #ff9ed2 100%);
}

.page::before {
  content: '';
  position: absolute;
  inset: -20%;
  background: repeating-conic-gradient(
    from 0deg at 50% 45%,
    rgba(255, 255, 255, 0.22) 0deg 7deg,
    rgba(255, 255, 255, 0) 7deg 14deg
  );
  pointer-events: none;
}

/* за сценой продолжается тот же город, размытый: поля перестают быть пустыми */
.backdrop {
  position: absolute;
  inset: -20%;
  background-image: url('assets/city/sobor.webp');
  background-size: cover;
  background-position: center 45%;
  filter: blur(14px) saturate(1.1) brightness(0.92);
  transform: scale(1.06);
  pointer-events: none;
}

.stage {
  position: relative;
  width: min(100vw, 62dvh);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background: #9fe7ff;
}

/* точечная сетка поверх всего, даёт печатную фактуру */
.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  background-image: radial-gradient(rgba(20, 17, 24, 0.5) 1px, transparent 1.2px);
  background-size: 5px 5px;
  opacity: 0.045;
  mix-blend-mode: multiply;
}

/* сцена занимает всё окно; предел по ширине только чтобы не растягивало
   на очень широких экранах (иначе картинка искажается) */
.stage {
  width: min(100vw, 62dvh);
  height: 100dvh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ---------- Счёт ---------- */

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 10px) calc(var(--safe-right) + 12px) 0 calc(var(--safe-left) + 14px);
  pointer-events: none;
}

.hud[hidden] { display: none; }

.hud__score {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 6px 16px 8px;
  background: var(--yellow);
  border: var(--stroke) solid var(--ink);
  border-radius: 16px 20px 14px 22px;
  box-shadow: 0 5px 0 var(--ink);
  font-size: 27px;
  line-height: 1;
  transform: rotate(-2deg);
}

.hud__score i {
  font-style: normal;
  font-size: 15px;
  opacity: 0.75;
}

.hud__buttons { display: flex; gap: 8px; pointer-events: auto; }

.round {
  position: relative;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  font-family: inherit;
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.round.is-off::after {
  content: '';
  position: absolute;
  left: 10%;
  right: 10%;
  top: 50%;
  height: 4px;
  background: currentColor;
  border-radius: 2px;
  transform: rotate(-38deg);
}

.round:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.round.is-off { background: #d8d3c9; color: #6b6570; }


/* ---------- прелоадер ---------- */

.loader {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: linear-gradient(160deg, #8fe3ff, #b9a4ff 55%, #ff9ed2);
  transition: opacity 0.24s ease;
}

.loader[hidden] { display: none; }
.loader.is-hidden { opacity: 0; pointer-events: none; }

.loader__logo {
  font-size: clamp(38px, 12vw, 52px);
  line-height: 0.86;
  color: #fff;
  transform: rotate(-6deg);
  -webkit-text-stroke: 8px var(--ink);
  paint-order: stroke fill;
  text-align: center;
}

.loader__logo span { display: block; }
.loader__logo .is-yellow { color: var(--yellow); }

.loader__bar {
  width: 190px;
  height: 18px;
  border: 4px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  overflow: hidden;
  box-shadow: 0 5px 0 rgba(20, 17, 24, 0.25);
}

.loader__bar i {
  display: block;
  width: 42%;
  height: 100%;
  background: var(--yellow);
  border-radius: 6px;
  animation: load-slide 1.1s ease-in-out infinite;
}

.loader__hint {
  margin: 0;
  font-size: 16px;
  padding: 6px 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 4px solid var(--ink);
  border-radius: 12px;
}

@keyframes load-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(250%); }
}

@media (prefers-reduced-motion: reduce) {
  .loader__bar i { animation: none; width: 100%; }
}

/* ---------- занавес переходов ---------- */

.veil {
  position: absolute;
  inset: 0;
  z-index: 55;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: linear-gradient(160deg, #8fe3ff, #b9a4ff 55%, #ff9ed2);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.veil[hidden] { display: none; }
.veil.is-on { opacity: 1; }

.loader__logo--small {
  font-size: clamp(24px, 8vw, 32px);
  -webkit-text-stroke: 6px var(--ink);
}

.loader__bar--small {
  width: 132px;
  height: 14px;
  border-width: 3px;
  border-radius: 10px;
}

.loader__bar--small i { border-radius: 5px; }

/* появление экранов: меню, проигрыш, пауза */
.screen:not([hidden]) {
  animation: screen-in 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

/* счётчики в игре появляются мягко, а не прыжком */
.hud:not([hidden]) {
  animation: hud-in 0.28s ease both;
}

@keyframes hud-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  /* длительность перехода задаёт скрипт: здесь её не трогаем, иначе занавес мигает */
  .screen:not([hidden]),
  .hud:not([hidden]) { animation: none; }
}

/* ---------- монеты ---------- */

.hud__left { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }

.hud__coins {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px 5px;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 4px 0 var(--ink);
  font-size: 18px;
  line-height: 1;
  transform: rotate(1.5deg);
}

.hud__coin {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: radial-gradient(circle at 35% 30%, #fff6b0, #ffd93d 55%, #e8a400);
  display: inline-block;
}

/* ---------- Экраны ---------- */

.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--safe-top) + 18px) calc(var(--safe-right) + 18px) calc(var(--safe-bottom) + 18px) calc(var(--safe-left) + 18px);
}

.screen[hidden] { display: none; }

/* ---------- Меню ---------- */

.screen--menu { justify-content: space-between; }

.logo {
  align-self: flex-start;
  margin: 6px 0 0 4px;
  line-height: 0.82;
  font-size: clamp(46px, 15vw, 68px);
  letter-spacing: -1px;
  transform: rotate(-7deg);
  color: #fff;
  -webkit-text-stroke: 9px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 7px 0 rgba(20, 17, 24, 0.35);
}

.logo span { display: block; }

.logo__bottom {
  margin-left: 26px;
  color: var(--yellow);
}

.paper {
  position: relative;
  width: 100%;
  max-width: 340px;
  margin-top: -10px;
  padding: 34px 26px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  background: var(--paper);
  border: 6px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 10px 0 rgba(20, 17, 24, 0.25);
  transform: rotate(-1.2deg);
}

.paper--small { padding: 30px 24px 26px; gap: 14px; max-width: 280px; }

.pause__title {
  margin: 0 0 4px;
  font-size: 30px;
  transform: rotate(-2deg);
}

/* кнопки */

.btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
  padding: 14px 30px;
  background: var(--paper);
  border: var(--stroke) solid var(--ink);
  border-radius: 18px 24px 16px 22px;
  box-shadow: 0 7px 0 var(--ink);
  cursor: pointer;
  transform: rotate(-1.5deg);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn:active { transform: translateY(5px) rotate(-1.5deg); box-shadow: 0 2px 0 var(--ink); }

.btn--play {
  font-size: 30px;
  padding: 16px 38px;
  background: var(--yellow);
  transform: rotate(-2deg);
}

.btn--play:active { transform: translateY(5px) rotate(-2deg); }

.btn--ghost {
  font-size: 17px;
  padding: 10px 22px;
  background: #fff;
  box-shadow: 0 5px 0 var(--ink);
  transform: rotate(1.5deg);
}

.btn--ghost:active { transform: translateY(4px) rotate(1.5deg); box-shadow: 0 1px 0 var(--ink); }

/* радужный кружок рекорда */

.badge {
  width: 104px;
  height: 104px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: 5px solid var(--ink);
  border-radius: 50%;
  transform: rotate(5deg);
  background: conic-gradient(from 210deg, #ffd93d, #ff5fa2, #b06bff, #4ec8ff, #35d64a, #ffd93d);
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.55), 0 6px 0 var(--ink);
}

.badge__label { font-size: 13px; opacity: 0.8; }
.badge__value { font-size: 27px; line-height: 1; }

.hint {
  margin: 0 0 4px;
  padding: 8px 18px;
  font-size: 15px;
  background: rgba(255, 255, 255, 0.92);
  border: 4px solid var(--ink);
  border-radius: 14px;
  transform: rotate(1deg);
}

/* Ксаикс заглядывает в меню и держится за нижний правый угол таблички */
.menu-ksaix {
  position: absolute;
  right: -30px;
  bottom: -46px;
  width: 148px;
  transform-origin: 40% 90%;
  transform: rotate(9deg);
  filter: drop-shadow(0 9px 0 rgba(20, 17, 24, 0.22));
  pointer-events: none;
  animation: ksaix-float 3.6s ease-in-out infinite;
}

@keyframes ksaix-float {
  0%, 100% { transform: rotate(9deg); }
  50% { transform: rotate(6deg) translateY(-6px); }
}

@media (prefers-reduced-motion: reduce) {
  .menu-ksaix { animation: none; }
}

/* ---------- Проигрыш ---------- */

.screen--over { justify-content: center; gap: 10px; }
.screen--pause { justify-content: center; }

.screen--over::before,
.screen--pause::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 253, 247, 0.66);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  pointer-events: none;
}

.shout {
  align-self: flex-start;
  margin: 0 0 0 2px;
  font-size: clamp(30px, 10vw, 44px);
  line-height: 0.94;
  color: var(--yellow);
  transform: rotate(-6deg);
  -webkit-text-stroke: 8px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 5px 0 rgba(20, 17, 24, 0.3);
}

.star {
  position: relative;
  width: min(58vw, 228px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  animation: star-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.star svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.star__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transform: rotate(-4deg);
}

.star__value {
  font-size: clamp(52px, 16vw, 74px);
  line-height: 0.9;
  color: var(--ink);
  text-shadow: 3px 4px 0 var(--orange);
}

.star__unit { font-size: 16px; opacity: 0.8; }

.over__coins {
  margin: 2px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 18px;
  padding: 4px 16px 5px;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 14px;
  transform: rotate(-1.5deg);
}

.over__record {
  margin: 4px 0 0;
  font-size: 20px;
  padding: 6px 18px;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 14px;
  transform: rotate(1.5deg);
}

.over__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.ribbon {
  position: absolute;
  top: calc(var(--safe-top) + 12px);
  right: 10px;
  padding: 8px 16px;
  font-size: 16px;
  color: #fff;
  background: var(--pink);
  border: 4px solid var(--ink);
  border-radius: 12px;
  transform: rotate(4deg);
  animation: ribbon-in 0.4s 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes star-pop {
  from { transform: scale(0.2) rotate(-25deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes ribbon-in {
  from { transform: translateY(-30px) rotate(12deg); opacity: 0; }
  to { transform: translateY(0) rotate(4deg); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .star, .ribbon { animation: none; }
  .btn, .round { transition: none; }
}


/* телефон в альбомной ориентации: игра вертикальная, честнее попросить повернуть */
.rotate-hint {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  background: linear-gradient(170deg, #171430 0%, #3b2450 45%, #8a4148 78%, #d0813f 100%);
}

.rotate-hint__phone {
  width: 74px;
  height: 120px;
  border: 6px solid var(--ink);
  border-radius: 14px;
  background: var(--ochre);
  animation: rotate-phone 2.4s ease-in-out infinite;
}

.rotate-hint__text {
  font-size: 22px;
  padding: 10px 20px;
  background: var(--paper);
  border: 5px solid var(--ink);
  border-radius: 14px;
  transform: rotate(-2deg);
}

@keyframes rotate-phone {
  0%, 45% { transform: rotate(0deg); }
  60%, 100% { transform: rotate(90deg); }
}

@media (prefers-reduced-motion: reduce) {
  .rotate-hint__phone { animation: none; transform: rotate(90deg); }
}

@media (orientation: landscape) and (max-height: 520px) and (max-width: 760px) and (pointer: coarse) and (hover: none) {
  .rotate-hint { display: flex; }
}

/* ============================================================
   Кыштым: городская афиша
   Бумага вместо рваного листа, жестяные таблички вместо комикс-кнопок,
   штамп вместо радужного кружка. Город за экраном остаётся виден.
   ============================================================ */

.page {
  background: #2a1b2e;   /* ровный тон: если где-то и выглянет край, это не градиент */
}
.page::before { opacity: 0.14; }

.stage { background: #171430; }

.loader,
.veil {
  background: linear-gradient(170deg, #171430 0%, #3b2450 45%, #8a4148 78%, #d0813f 100%);
}

.loader__logo { -webkit-text-stroke: 6px var(--ink); }
.loader__hint {
  background: rgba(241, 224, 194, 0.94);
  border: 2px solid var(--ink);
  border-radius: 2px;
  letter-spacing: 0.06em;
}
.loader__bar { border-width: 3px; border-radius: 2px; }
.loader__bar i { background: var(--ochre); border-radius: 1px; }

/* ---------- меню ---------- */

.screen--menu {
  justify-content: flex-start;
  padding-bottom: calc(var(--safe-bottom) + 12px);
}

.logo {
  margin: 46px 0 auto 2px;
  font-size: clamp(31px, 10.5vw, 48px);
  color: var(--cream);
  -webkit-text-stroke: 6px var(--ink);
  text-shadow: 0 6px 0 rgba(12, 6, 16, 0.35);
  transform: rotate(-5deg);
}
.logo__bottom { color: var(--yellow); margin-left: 0; }

.paper {
  position: relative;
  width: 100%;
  max-width: 336px;
  margin: 0 auto 10px;
  padding: 34px 22px 24px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 58%),
    linear-gradient(180deg, #f4e5c9, #e6d0a9);
  border: 2px solid var(--ink);
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 5px rgba(244, 229, 201, 0.95),
    inset 0 0 0 6px rgba(36, 26, 36, 0.5),
    inset 0 0 70px rgba(150, 110, 70, 0.26),
    0 18px 30px rgba(10, 5, 14, 0.45);
  transform: rotate(-0.7deg);
}

/* бумажное зерно */
.paper::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(120, 90, 60, 0.055) 0 1px,
    transparent 1px 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.55;
}

.paper--small { max-width: 288px; padding: 28px 22px 22px; gap: 14px; }

.btn {
  font-size: 19px;
  color: var(--ink);
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 2px;
  box-shadow: 0 4px 0 rgba(36, 26, 36, 0.85);
  transform: none;
  letter-spacing: 0.03em;
}

.btn--play {
  width: 100%;
  font-size: 25px;
  padding: 15px 18px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cream);
  background: linear-gradient(180deg, #b8402f, #8d2419);
  box-shadow:
    inset 0 0 0 2px rgba(249, 237, 214, 0.5),
    0 4px 0 rgba(36, 26, 36, 0.9);
  transform: none;
}
.btn--play:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 0 0 2px rgba(249, 237, 214, 0.5),
    0 1px 0 rgba(36, 26, 36, 0.9);
}

.btn--ghost {
  font-size: 15px;
  padding: 10px 20px;
  background: transparent;
  box-shadow: none;
  border-color: rgba(36, 26, 36, 0.6);
  transform: none;
}
.btn--ghost:active { transform: translateY(2px); box-shadow: none; }

/* штамп рекорда на углу афиши */
.badge {
  position: absolute;
  top: -44px;
  right: -14px;
  width: 88px;
  height: 96px;
  gap: 0;
  color: var(--red);
  background: #e8d4ae;
  border: 3px solid var(--red);
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 3px rgba(232, 212, 174, 0.95),
    inset 0 0 0 5px rgba(166, 50, 40, 0.7),
    0 6px 10px rgba(10, 5, 14, 0.3);
  transform: rotate(-11deg);
}
.badge__label {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.9;
}
.badge__value { font-size: 30px; color: var(--red-dark); }

.menu-ksaix {
  width: 124px;
  right: -22px;
  bottom: -26px;
  filter: drop-shadow(0 8px 0 rgba(20, 10, 20, 0.28));
}

.hint {
  margin: 0 0 2px;
  padding: 7px 14px;
  max-width: 100%;
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
  white-space: normal;
  color: var(--cream);
  background: rgba(20, 14, 24, 0.42);
  border: 1px solid rgba(249, 237, 214, 0.32);
  border-radius: 2px;
  transform: none;
}

/* ---------- счёт в игре ---------- */

.hud__score {
  font-size: 24px;
  padding: 6px 14px 7px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 3px;
  box-shadow: 0 3px 0 rgba(36, 26, 36, 0.72);
  transform: rotate(-1.2deg);
}
.hud__score i { font-size: 13px; opacity: 0.55; }

.hud__coins {
  padding: 4px 12px 5px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 3px;
  box-shadow: 0 3px 0 rgba(36, 26, 36, 0.72);
  transform: rotate(1deg);
}
.hud__coin { border-width: 2px; }

.round {
  border-width: 3px;
  box-shadow: 0 3px 0 var(--ink);
  background: var(--paper);
}

/* ---------- проигрыш и пауза ---------- */

.screen--over::before,
.screen--pause::before {
  z-index: -1;
  background: linear-gradient(180deg, rgba(16, 9, 20, 0.38), rgba(16, 9, 20, 0.66));
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.screen--over .btn--ghost {
  color: var(--cream);
  border-color: rgba(249, 237, 214, 0.45);
}

.screen--pause .btn--ghost {
  color: rgba(36, 26, 36, 0.75);
  border-color: rgba(36, 26, 36, 0.35);
}

.shout {
  color: var(--cream);
  -webkit-text-stroke: 7px var(--ink);
  text-shadow: 0 5px 0 rgba(12, 6, 16, 0.4);
}

.star__value { text-shadow: 2px 3px 0 rgba(36, 26, 36, 0.3); }

.over__record,
.over__coins {
  border-width: 2px;
  border-radius: 2px;
  box-shadow: 0 3px 0 rgba(36, 26, 36, 0.5);
}

.ribbon {
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--red);
  border-width: 2px;
  border-radius: 2px;
}

.pause__title { font-size: 26px; transform: none; letter-spacing: 0.04em; }

/* ---------- название локации ---------- */

.place {
  position: absolute;
  top: calc(var(--safe-top) + 58px);
  left: 50%;
  z-index: 18;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 16px 7px;
  background: rgba(20, 14, 24, 0.45);
  border: 1px solid rgba(249, 237, 214, 0.3);
  border-radius: 2px;
  color: var(--cream);
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%);
  animation: place-in 3.4s ease forwards;
}
.place[hidden] { display: none; }

.place__city {
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0.6;
}
.place__name {
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@keyframes place-in {
  0% { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  10% { opacity: 1; transform: translateX(-50%) translateY(0); }
  76% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-4px); }
}

.over__place {
  align-self: flex-start;
  margin: 12px 0 0 6px;
  padding: 5px 12px 6px;
  font-size: 10.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cream);
  background: rgba(20, 14, 24, 0.45);
  border: 1px solid rgba(249, 237, 214, 0.28);
  border-radius: 2px;
  transform: rotate(-3deg);
}
.over__place[hidden] { display: none; }

/* статус отправки рекорда: строка вместо кнопки, нажимать нечего */
.over__sent {
  margin: 10px 0 0;
  min-height: 16px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cream);
  opacity: 0.65;
}
.over__sent[hidden] { display: none; }
.over__sent.is-ok { opacity: 1; color: var(--yellow); }
.over__sent.is-fail { opacity: 0.9; color: #ffb4a2; }

@media (prefers-reduced-motion: reduce) {
  .place { animation-duration: 2.4s; }
}

/* ---------- меню списком, как на референсе ---------- */

.paper--menu { padding: 20px 18px 18px; gap: 0; }

.menu-list { display: flex; flex-direction: column; }

.menu-item {
  position: relative;
  isolation: isolate;
  display: block;
  width: calc(100% + 16px);
  margin: 0 -8px;
  padding: 11px 14px;
  font-family: inherit;
  font-weight: 700;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-align: left;
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  transition: transform 0.08s ease, color 0.12s ease;
}
.menu-item + .menu-item { box-shadow: inset 0 1px 0 rgba(36, 26, 36, 0.16); }

/* активный пункт — подклеен полоской скотча с рваными краями */
.menu-item.is-active {
  font-size: 33px;
  color: var(--red-dark);
  transform: rotate(-1.4deg);
}
.menu-item.is-active::before {
  content: '';
  position: absolute;
  inset: 2px -26px 3px -22px;
  z-index: -1;
  background: linear-gradient(180deg, #f0d699 0%, #e7c67f 55%, #dcb96e 100%);
  clip-path: polygon(
    0% 16%, 3% 3%, 14% 8%, 27% 1%, 41% 7%, 56% 0%, 70% 6%, 84% 2%, 96% 8%, 100% 18%,
    99% 84%, 96% 97%, 84% 92%, 70% 99%, 55% 94%, 40% 100%, 26% 93%, 13% 99%, 3% 94%, 0% 82%
  );
}
.menu-item.is-active:active { transform: translateY(2px) rotate(-1.4deg); }
.menu-item:not(.is-active):active { transform: translateY(1px); }

/* подпись внизу бумаги */
.menu__caption {
  margin: 12px 0 0;
  font-size: 9.5px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(36, 26, 36, 0.42);
}

/* след от чашки — бумага становится бумагой */
.paper--menu::before {
  content: '';
  position: absolute;
  right: 26px;
  bottom: -14px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 7px solid rgba(150, 105, 60, 0.09);
  box-shadow: inset 0 0 0 2px rgba(150, 105, 60, 0.05);
  transform: rotate(-12deg) scaleY(0.94);
  pointer-events: none;
}

/* низкое окно — всё компактнее, иначе меню не влезает */
@media (max-height: 620px) {
  .logo { font-size: clamp(23px, 6.4vw, 34px); margin-top: 12px; }
  .paper--menu { padding: 14px 14px 10px; }
  .menu-item { font-size: 20px; padding: 7px 12px; }
  .menu-item.is-active { font-size: 25px; }
  .menu__caption { display: none; }
  .hint { display: none; }
  .menu-ksaix { width: 96px; bottom: -18px; }
  .badge { width: 66px; height: 66px; top: -30px; right: -8px; }
  .badge__label { font-size: 8px; letter-spacing: 0.1em; }
  .badge__value { font-size: 22px; }
}

/* ---------- карточка «как играть» ---------- */

.modal {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12, 7, 16, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.modal[hidden] { display: none; }

.modal__card {
  width: 100%;
  max-width: 332px;
  padding: 22px 20px 18px;
  background: linear-gradient(180deg, #f4e5c9, #e6d0a9);
  border: 2px solid var(--ink);
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 5px rgba(244, 229, 201, 0.95),
    inset 0 0 0 6px rgba(36, 26, 36, 0.5),
    0 18px 30px rgba(10, 5, 14, 0.45);
  transform: rotate(-0.6deg);
}

.modal__title {
  margin: 0 0 12px;
  font-size: 24px;
  letter-spacing: 0.02em;
}

.modal__text {
  margin: 0 0 11px;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(36, 26, 36, 0.88);
}

.modal__card .btn--play {
  margin-top: 6px;
  font-size: 21px;
  padding: 12px 16px;
}

/* ---------- всплывающая плашка ---------- */

.toast {
  position: absolute;
  left: 50%;
  top: 150px;
  z-index: 65;
  padding: 8px 16px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cream);
  background: rgba(20, 14, 24, 0.75);
  border: 1px solid rgba(249, 237, 214, 0.3);
  border-radius: 2px;
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.toast[hidden] { display: none; }
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- иконки в углу меню: профиль и настройки ---------- */

.corner {
  position: absolute;
  top: calc(var(--safe-top) + 12px);
  right: 12px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.round--avatar {
  padding: 0;
  overflow: hidden;
}
.round--avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.round--avatar span {
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

/* ---------- профиль и настройки ---------- */

.screen--sub {
  justify-content: center;
}

.paper--profile {
  width: 100%;
  max-width: 336px;
  margin: 0;
  padding: 22px 18px 18px;
  gap: 12px;
}

.prof {
  display: flex;
  align-items: center;
  gap: 12px;
}

.prof__ava {
  width: 64px;
  height: 64px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--ochre);
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.prof__ava img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.prof__ava span {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
}

.prof__who { min-width: 0; }

.prof__name {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prof__tag {
  margin: 2px 0 0;
  font-size: 12px;
  color: rgba(36, 26, 36, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prof__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.prof__stat {
  padding: 8px 4px 7px;
  text-align: center;
  border: 1px dashed rgba(36, 26, 36, 0.28);
  border-radius: 2px;
}
.prof__stat b {
  display: block;
  font-size: 20px;
  line-height: 1.1;
  color: var(--ink);
}
.prof__stat span {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(36, 26, 36, 0.55);
}

.prof__note {
  margin: 0;
  font-size: 10.5px;
  line-height: 1.35;
  text-align: center;
  color: rgba(36, 26, 36, 0.55);
}
.prof__note[hidden] { display: none; }

@media (max-height: 620px) {
  .corner { top: 8px; right: 8px; gap: 8px; }
  .paper--profile { padding: 16px 14px 14px; gap: 9px; }
  .prof__ava { width: 52px; height: 52px; }
  .prof__name { font-size: 17px; }
  .prof__stat b { font-size: 17px; }
}

/* На телефоне сцена занимает всю ширину, размытый фон под ней не виден,
   а стоит он дорого: полноэкранное размытие пересчитывается на каждом кадре. */
@media (max-width: 760px), (pointer: coarse) {
  .backdrop {
    filter: brightness(0.9) saturate(1.05);
  }
}

/* ---------- маршрут: куда идём дальше ---------- */

.route {
  width: 148px;
  padding: 5px 9px 7px;
  border: 1px solid rgba(241, 224, 194, 0.5);
  border-radius: 3px;
  background: rgba(23, 20, 48, 0.62);
  color: #f1e0c2;
}
.route[hidden] { display: none; }
.route__text {
  display: block;
  margin-bottom: 4px;
  font-size: 10px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.route__bar {
  display: block;
  height: 4px;
  border-radius: 4px;
  background: rgba(241, 224, 194, 0.3);
  overflow: hidden;
}
.route__bar i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--yellow);
  transition: width 0.18s linear;
}

.prof__extra {
  margin: 0;
  font-size: 10.5px;
  text-align: center;
  color: rgba(36, 26, 36, 0.6);
}

/* ---------- гардероб ---------- */

.paper--wardrobe {
  max-width: 360px;
  max-height: calc(100dvh - 80px);
  overflow-y: auto;
  gap: 10px;
}
.wardrobe__note {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
  color: rgba(36, 26, 36, 0.6);
}
.skin-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}
.skin {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px;
  text-align: left;
  font-family: inherit;
  color: var(--ink);
  background: rgba(255, 251, 240, 0.75);
  border: 2px solid rgba(36, 26, 36, 0.28);
  border-radius: 3px;
  cursor: pointer;
}
.skin canvas { width: 52px; height: 52px; flex: none; }
.skin__name { display: block; font-size: 13px; font-weight: 700; }
.skin__hint { display: block; margin-top: 2px; font-size: 10px; color: rgba(36, 26, 36, 0.6); }
.skin.is-current { border-color: #8d3b28; background: #f4dfb4; }
.skin.is-locked { opacity: 0.55; }
@media (max-height: 620px) {
  .skin canvas { width: 40px; height: 40px; }
  .skin__name { font-size: 11px; }
  .skin__hint { font-size: 9px; }
}

/* ---------- таблица лидеров ---------- */

.round__icon { width: 20px; height: 20px; display: block; }
.round__icon rect { fill: currentColor; }

.paper--leaders {
  width: 100%;
  max-width: 336px;
  /* карточка не должна вылезать за экран: длинный топ прокручивается внутри */
  max-height: 100%;
  margin: 0;
  padding: 22px 16px 16px;
  gap: 8px;
}
.paper--leaders > * { flex: none; }
.paper--leaders > .leaders { flex: 1 1 auto; min-height: 0; }

.leaders__note {
  margin: -4px 0 2px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(36, 26, 36, 0.55);
}
.leaders__note.is-fail { color: #8d3b28; }

.leaders {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.leader {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  background: rgba(255, 251, 240, 0.75);
  border: 2px solid rgba(36, 26, 36, 0.22);
  border-radius: 3px;
  font-size: 14px;
  color: var(--ink);
}
.leader__place {
  flex: none;
  width: 22px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: rgba(36, 26, 36, 0.45);
}
/* первая тройка — тёплый акцент вместо медалей: они мелкие и не читаются */
.leader.is-podium .leader__place { color: #8d3b28; font-size: 16px; }
.leader__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}
.leader__score { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.leader.is-me { border-color: #8d3b28; background: #f4dfb4; }
.leader--empty {
  justify-content: center;
  padding: 14px 9px;
  font-size: 12px;
  color: rgba(36, 26, 36, 0.55);
}

@media (max-height: 620px) {
  .paper--leaders { padding: 18px 14px 12px; gap: 6px; }
  .leader { padding: 5px 8px; font-size: 12px; }
}
