/* Шрифты захостены локально, а не через Google Fonts CDN: в вебвью
   Telegram и в браузерах со строгой защитой приватности сторонние
   font-запросы могут блокироваться, и текст без предупреждения откатывался
   на системный serif — рунная тема теряла «резной» характер. */
@font-face {
  font-family: 'Yeseva One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/yesevaone-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122;
}
@font-face {
  font-family: 'Yeseva One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/yesevaone-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Forum';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/forum-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122;
}
@font-face {
  font-family: 'Forum';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/forum-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  --wood-1: #C68B4E; --wood-2: #A9713F; --wood-stroke: #7A4B24;
  --cream: #FFF6DF; --cream-stroke: #E2CFA8;
  --btn-g1: #7ED447; --btn-g2: #58B32C; --btn-gs: #3F8F1F;
  --gold-1: #FFD34D; --gold-2: #E8A21D;
  --ink: #5C3A18; --ink-soft: #8A6A45;
  --danger: #E85B4A;
  /* SF Pro везде: на Apple-устройствах -apple-system/BlinkMacSystemFont
     сами резолвятся в системный SF Pro (Display для крупного текста,
     Text — для мелкого, это встроенное поведение ОС); на прочих —
     аккуратный системный сан-сериф как запасной вариант */
  --font-round: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--font-round);
  background: #0d130a;
  color: var(--ink);
}

#app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  /* --tg-vh — реальный viewportStableHeight из Telegram WebApp (см. perf.js).
     Ставим его ПОСЛЕ dvh, так что там, где JS ещё не отработал или это не
     Telegram, работает обычный dvh; там, где Telegram даёт свою высоту
     (актуально для части Android WebView, которые дают неверный dvh при
     появлении/скрытии системных баров) — она побеждает по каскаду. */
  height: var(--tg-vh, 100dvh);
  /* На узких телефонных экранах ширина упирается в 100%, как и раньше.
     На планшете/десктопе экран становится шире, чем высокий — тогда
     без этого ограничения сцена (.scene-bg, object-fit:cover) кадрировала
     бы фон иначе, чем на телефоне, а грядки-проценты (PLOTS в data.js)
     остаются рассчитаны под "телефонный" кадр — отсюда деревья "съезжали"
     мимо своих мест на траве. Ограничиваем ширину по пропорции фона
     (1440x2560 у island-1.mp4/jpg), центрируем — лишнее место уходит в
     тёмные поля по бокам вместо перекадрирования сцены. */
  max-width: calc(100vh * 1440 / 2560);
  max-width: calc(100dvh * 1440 / 2560);
  max-width: calc(var(--tg-vh, 100dvh) * 1440 / 2560);
  margin: 0 auto;
  display: block;
  background: #0d130a;
  overflow: hidden;
}

/* ---------- Слой производительности (см. perf.js) ---------- */
/* app-paused: приложение свёрнуто/вкладка скрыта — глушим ВСЕ CSS-анимации
   разом (светлячки, дождь, покачивание кроны и т.д.), а не только видео.
   Раньше они продолжали крутиться в фоне и грузили процессор/батарею
   слабых телефонов, пока Telegram был свёрнут. */
html.app-paused *,
html.app-paused *::before,
html.app-paused *::after {
  animation-play-state: paused !important;
}

/* perf-lite: JS в perf.js включает этот класс на слабых устройствах
   (мало памяти/ядер, saveData) или при системном prefers-reduced-motion.
   Отключаем самые дорогие эффекты, оставляя игру визуально узнаваемой. */
html.perf-lite .screen-drop {
  /* backdrop-filter — один из самых тяжёлых GPU-эффектов; десяток таких
     капель одновременно поверх видео душит слабые Android-чипы. На
     perf-lite капли остаются (просто блики без преломления фона). */
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
html.perf-lite .tree-sway,
html.perf-lite .tree-img-wrap img {
  animation: none !important;
}

/* Спрятано по запросу — зелёные плашки не вписывались в сцену.
   display:none чисто визуально, элементы остаются в DOM для JS. */
.hidden-chrome { display: none; }

/* ---------- Telegram chrome ---------- */
.tg-chrome {
  display: flex; align-items: center; justify-content: space-between;
  padding: env(safe-area-inset-top, 8px) 16px 6px;
  font-size: 15px; font-weight: 700; color: #FFFFFF;
  background: linear-gradient(180deg, rgba(43,110,53,.85), rgba(43,110,53,0));
  text-shadow: 0 1.5px 0 rgba(43,80,30,.6);
  position: relative; z-index: 6;
}
.tg-chrome .side { width: 40px; }

/* ---------- HUD ---------- */
.hud {
  position: relative; z-index: 6;
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 0;
}
.chip {
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(180deg, #FFFDF4, var(--cream));
  border: 2.5px solid var(--wood-stroke); border-radius: 99px;
  padding: 5px 12px 5px 6px; font-size: 13.5px; font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 2px 0 #FFF, 0 3px 0 rgba(92,58,24,.3);
  cursor: pointer; border: none;
  font-family: var(--font-round);
  transition: transform .12s;
}
.chip:active { transform: scale(.94); }
.chip .shield { width: 24px; height: 24px; }
.chip.money { margin-left: auto; cursor: default; }
.chip.money svg { width: 24px; height: 24px; }

/* ---------- Banner ---------- */
.banner {
  position: relative; z-index: 5; margin: 12px auto 0; width: fit-content;
  background: linear-gradient(180deg, var(--wood-1), var(--wood-2));
  border: 3px solid var(--wood-stroke); border-radius: 12px;
  padding: 7px 18px; font-size: 12px; font-weight: 800;
  color: #FFF3DC; text-shadow: 0 1.5px 0 rgba(92,58,24,.55);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.35), 0 4px 0 rgba(92,58,24,.3);
  max-width: 88%;
  text-align: center;
}

/* ---------- Scene ---------- */
.scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  /* грядки внутри получают z-index до ~110 для сортировки по глубине
     (см. render.js) — без своего стекингового контекста этот z-index
     сравнивался бы напрямую с оверлеями (магазин и т.п., z-index 25) и
     "пробивал" их собой */
  isolation: isolate;
}
.scene-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: filter 2.2s ease;
  /* собственный composite-слой — видео декодируется отдельно от остальной
     сцены (дождь, светлячки), не переснимает их при каждом кадре */
  will-change: transform;
  transform: translateZ(0);
}
.scene.storming .scene-bg {
  filter: brightness(0.68) saturate(0.75) contrast(1.08) hue-rotate(6deg);
}
.plots {
  position: absolute; inset: 0;
  transition: filter 2.2s ease;
}
.scene.storming .plots {
  filter: brightness(0.75) saturate(0.8);
}

/* ---------- Storm effect (полив) ---------- */
.storm-overlay {
  position: absolute; inset: 0;
  z-index: 8;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.8s ease;
}
.scene.storming .storm-overlay { opacity: 1; }

/* Видимость всей грозы (тучи+дождь+вспышка) управляется ТОЛЬКО
   через .storm-overlay выше — единая точка правды для затухания,
   чтобы всё гасло синхронно. У туч ниже — только своё движение
   (наплыв/откат), опacity они больше не трогают сами. */
.storm-clouds {
  position: absolute;
  top: 0; left: -95%;
  width: 290%;
  transform: translateY(-30%) scale(1.06);
}
.storm-clouds img {
  width: 100%; display: block;
}
.scene.storming .storm-clouds {
  animation: cloudsRollIn 2.8s cubic-bezier(.2,.75,.3,1) forwards;
}
.scene:not(.storming) .storm-clouds {
  transition: transform 2.2s ease;
}
@keyframes cloudsRollIn {
  0%   { transform: translateY(-32%) scale(1.06); }
  100% { transform: translateY(0) scale(1); }
}

.storm-rain {
  position: absolute; inset: 0;
  overflow: hidden;
  opacity: 1;
  /* тонкие яркие полоски дождя на глаз "держатся" дольше туч при той же
     прозрачности (контраст) — гасим дождь отдельно и быстрее, ease-in,
     чтобы обе части грозы визуально заканчивались одновременно */
  transition: opacity 0.9s ease-in;
}
.scene:not(.storming) .storm-rain {
  opacity: 0;
}
.raindrop {
  will-change: transform, opacity;
  position: absolute;
  top: -14%;
  left: 0;
  width: var(--rw, 2px);
  height: var(--rh, 8%);
  background: linear-gradient(180deg, rgba(200,225,255,0), rgba(200,225,255,var(--ro, .55)));
  transform: rotate(var(--ra, 12deg));
  animation-name: rainFall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes rainFall {
  0%   { transform: translateY(0) translateX(0) rotate(var(--ra, 12deg)); opacity: 0; }
  10%  { opacity: var(--ro, .8); }
  100% { transform: translateY(120vh) translateX(var(--rx, 4vh)) rotate(var(--ra, 12deg)); opacity: .25; }
}

/* всплески от капель на земле/траве/дереве — это и продаёт ощущение
   "дождь реально льёт на сцену", а не просто линии поверх картинки */
.storm-splashes {
  position: absolute; inset: 0;
  overflow: hidden;
}
.splash {
  position: absolute;
  width: var(--sw, 14px);
  height: calc(var(--sw, 14px) * 0.4);
  border-radius: 50%;
  border: 1.4px solid rgba(210, 230, 255, 0.65);
  transform: translate(-50%, -50%) scale(0.2);
  opacity: 0;
  animation: splashPop 0.55s ease-out forwards;
  pointer-events: none;
}
.splash::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: rgba(220, 235, 255, 0.85);
  transform: translate(-50%, -50%);
}
@keyframes splashPop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  20%  { opacity: 0.8; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
}

.storm-flash {
  position: absolute; inset: 0;
  background: #EAF3FF;
  opacity: 0;
}
.storm-flash.flash-now {
  animation: lightningFlash 0.45s ease-out;
}
@keyframes lightningFlash {
  0%   { opacity: 0; }
  8%   { opacity: .85; }
  16%  { opacity: .1; }
  26%  { opacity: .6; }
  40%  { opacity: 0; }
  100% { opacity: 0; }
}

/* капли прямо на "стекле" экрана, поверх всей сцены — как будто дождь
   бьёт по камере, а не только идёт где-то в глубине сцены */
.screen-drops {
  position: absolute; inset: 0;
  z-index: 9;
  overflow: hidden;
}
.screen-drop {
  position: absolute;
  left: 0; top: 0;
  width: var(--dsz, 16px);
  height: calc(var(--dsz, 16px) * 1.35);
  border-radius: 50% 50% 50% 50% / 58% 58% 42% 42%;
  /* тело капли почти не красит фон — только слегка преломляет его
     (backdrop-filter), плюс один чёткий блик и тонкий контур снизу */
  background:
    radial-gradient(circle at 30% 22%, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.95) 6%, rgba(255,255,255,0) 16%),
    radial-gradient(ellipse at 50% 55%, rgba(210,230,245,0.10) 0%, rgba(210,230,245,0.04) 65%, rgba(210,230,245,0) 100%);
  -webkit-backdrop-filter: blur(0.6px) brightness(1.08);
  backdrop-filter: blur(0.6px) brightness(1.08);
  box-shadow:
    inset 0 -1.5px 2px rgba(10,20,25,0.18),
    inset 0 1px 1px rgba(255,255,255,0.25);
  opacity: 0;
  transform: translate(-50%, -50%);
}
.screen-drop.sitting {
  animation: dropSit 3.5s ease-in-out forwards;
}
.screen-drop.sliding {
  animation: dropSlide linear forwards;
}
@keyframes dropSit {
  0%   { opacity: 0; transform: translate(-50%, -60%) scale(0.4); }
  10%  { opacity: 0.9; transform: translate(-50%, -50%) scale(1); }
  85%  { opacity: 0.85; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}
@keyframes dropSlide {
  0%   { opacity: 0; transform: translate(-50%, -50%) translateY(0) scale(0.5); }
  8%   { opacity: 0.9; transform: translate(-50%, -50%) translateY(1vh) scale(1); }
  92%  { opacity: 0.7; }
  100% { opacity: 0; transform: translate(-50%, -50%) translateY(var(--dfall, 30vh)) scale(0.85); }
}

@media (prefers-reduced-motion: reduce) {
  .screen-drop { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .raindrop { animation: none; display: none; }
  .splash { animation: none; display: none; }
  .storm-flash.flash-now { animation: none; }
  .scene.storming .scene-bg, .scene.storming .plots { filter: brightness(0.8); }
  .tree-img-wrap img, .tree-sway { animation: none !important; }
}

/* scale от --plot-scale (задаётся в renderPlots по ряду) с origin у корней:
   дерево растёт вверх от своей точки посадки, а не расползается от центра,
   поэтому основание остаётся ровно там, куда посажено */
.plot {
  position: absolute;
  transform: translate(-50%, 0) scale(var(--plot-scale, 1));
  transform-origin: 50% 100%;
  width: 24vw;
  height: 24vw;
  max-width: 112px;
  max-height: 112px;
  cursor: pointer;
}
.plot.empty, .plot.locked {
  pointer-events: none;
}

/* Тень в два слоя: плотное тёмное «пятно контакта» точно под стволом —
   оно и сажает дерево в траву, — плюс широкий мягкий ореол вокруг, как
   рассеянная тень кроны. Одним градиентом это читалось как серый овал
   под наклейкой. */
.contact-shadow {
  position: absolute;
  left: 50%; bottom: 1%;
  width: 96%; height: 26%;
  transform: translate(-50%, 0) scale(1);
  border-radius: 50%;
  background:
    radial-gradient(ellipse 34% 46% at 50% 62%, rgba(2,7,2,.72), rgba(2,7,2,0) 100%),
    radial-gradient(ellipse 62% 58% at 50% 55%, rgba(4,12,5,.42), rgba(4,12,5,0) 100%);
  filter: blur(4px);
  opacity: 0;
  transition: opacity .3s ease, transform .16s cubic-bezier(.3, .9, .4, 1.4);
}
/* трава, поднимающаяся к корням: узкая тёмно-зелёная дымка поверх стыка
   спрайта с землёй — прячет ровный «срез» низа PNG, из-за которого дерево
   выглядело приставленным к фону, а не растущим из него */
.contact-shadow::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 18%;
  width: 46%; height: 52%;
  transform: translate(-50%, 0);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, rgba(46, 82, 34, .55), rgba(46, 82, 34, 0) 72%);
  filter: blur(2.5px);
}
/* тап по дереву — крона чуть приседает, тень под ней слегка растекается,
   как будто дерево реально качнулось под пальцем; отпустили — пружинит
   обратно за счёт той же кривой с небольшим перелётом */
.plot.filled:active .tree-img-wrap,
.plot.wilted:active .tree-img-wrap { transform: translate(-50%, 0) scale(.94); }
.plot.filled:active .contact-shadow,
.plot.wilted:active .contact-shadow { transform: translate(-50%, 0) scale(1.08, .92); }

.tree-img-wrap {
  position: absolute;
  left: 50%; bottom: 4%;
  width: 96%;
  transform: translate(-50%, 0) scale(1);
  transform-origin: 50% 100%;
  opacity: 0;
  transition: opacity .3s ease, transform .16s cubic-bezier(.3, .9, .4, 1.4);
}
/* Ветер собран из двух слоёв, чтобы дерево гнулось, а не ездило целиком:
   .tree-sway — медленный наклон всего ствола от корней,
   img — быстрый мелкий «шелест» кроны поверх него.
   Разные периоды у слоёв дают неповторяющийся рисунок движения. */
.tree-sway {
  display: block;
  transform-origin: 50% 100%;
  animation: treeSway var(--sway-dur, 6s) ease-in-out infinite;
  animation-delay: var(--sway-delay, 0s);
}
.tree-img-wrap img {
  width: 100%; height: auto; display: block;
  image-rendering: -webkit-optimize-contrast;
  /* Тон подгоняется под ночной свет сцены: приглушённая насыщенность,
     сниженная яркость и лёгкий уход в холод — спрайты нарисованы для
     дневного света и без этого «светятся» поверх тёмной поляны.
     Тень одна и мягкая: прежние две жёсткие давали контур-ореол, из-за
     которого дерево читалось как вырезанная наклейка. */
  filter:
    drop-shadow(0 6px 7px rgba(0,0,0,.42))
    saturate(0.76) brightness(0.8) hue-rotate(-8deg) contrast(1.04);
  transform-origin: 50% 100%;
  animation: leafRustle calc(var(--sway-dur, 6s) * 0.42) ease-in-out infinite;
  animation-delay: var(--sway-delay, 0s);
}
/* наклон всего дерева: skewX добавлен к rotate намеренно — он уводит
   верх сильнее низа, поэтому ствол читается гибким, а не как жёсткая
   картинка, повёрнутая целиком */
@keyframes treeSway {
  0%, 100% { transform: rotate(-1.3deg) skewX(0.9deg); }
  50%      { transform: rotate(1.3deg) skewX(-0.9deg); }
}
/* шелест листвы: мелкая быстрая деформация верхушки поверх наклона */
@keyframes leafRustle {
  0%, 100% { transform: skewX(0.5deg) scale(1, 1); }
  33%      { transform: skewX(-0.35deg) scale(1.004, 0.997); }
  66%      { transform: skewX(0.25deg) scale(0.997, 1.003); }
}

.plot.filled .contact-shadow,
.plot.filled .tree-img-wrap {
  opacity: 1;
}
.plot.wilted .tree-img-wrap img {
  filter: brightness(0.72) saturate(0.35) hue-rotate(20deg);
}

/* planting animation */
.plot.planting .contact-shadow { animation: shadowPop .9s cubic-bezier(.2,1.7,.35,1) forwards; }
.plot.planting .tree-img-wrap { animation: treePop .9s cubic-bezier(.2,1.7,.35,1) forwards; }
@keyframes shadowPop {
  0%   { opacity: 0; transform: translate(-50%,0) scale(.1); }
  45%  { opacity: .5; transform: translate(-50%,0) scale(.85); }
  100% { opacity: 1; transform: translate(-50%,0) scale(1); }
}
@keyframes treePop {
  0%   { opacity: 0; transform: translate(-50%, 20px) scale(.08); }
  45%  { opacity: 1; transform: translate(-50%, -6px) scale(1.04); }
  70%  { transform: translate(-50%, 2px) scale(.98); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
.plant-flash {
  position: absolute; left: 50%; bottom: 6%;
  width: 70%; height: 20%;
  transform: translate(-50%, 50%) scale(.3);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,230,150,0.95), rgba(255,230,150,0) 70%);
  opacity: 0; pointer-events: none;
}
.plot.planting .plant-flash { animation: flashPop .7s ease-out forwards; }
@keyframes flashPop {
  0%   { opacity: 0; transform: translate(-50%,50%) scale(.3); }
  30%  { opacity: 1; transform: translate(-50%,50%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%,50%) scale(1.7); }
}
.burst-particle {
  position: absolute; left: 50%; bottom: 8%;
  width: 8px; height: 8px;
  border-radius: 40% 60% 55% 45%;
  opacity: 0; pointer-events: none;
  transform: translate(-50%, 50%);
}
.plot.planting .burst-particle { animation: burst .75s cubic-bezier(.15,.7,.3,1) forwards; }
@keyframes burst {
  0%   { opacity: 1; transform: translate(-50%,50%) translate(0,0) rotate(0deg) scale(1); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%,50%) translate(var(--dx),var(--dy)) rotate(var(--rot)) scale(.4); }
}

/* status label above tree — тонкая подпись, вписанная в сцену,
   а не плашка поверх (не спорит с ночной атмосферой) */
.status-pill {
  position: absolute;
  left: 50%; top: -4%;
  transform: translate(-50%, -100%);
  background: none; border: none; box-shadow: none;
  padding: 0; font-size: 8.5px; font-weight: 700;
  letter-spacing: .02em;
  color: rgba(240, 235, 210, 0.92);
  text-shadow: 0 0 6px rgba(160, 225, 255, 0.35), 0 1px 2px rgba(0,0,0,.75);
  white-space: nowrap;
  opacity: 0; transition: opacity .3s ease .1s;
}
.plot.filled .status-pill { opacity: 1; }
.plot.wilted .status-pill {
  color: #F0B097;
  text-shadow: 0 0 6px rgba(217,106,59,.5), 0 1px 2px rgba(0,0,0,.75);
}

/* пустые/заблокированные грядки ничем не отмечены на поле —
   посадка теперь идёт только через магазин, дерево появляется само */
.plot-marker { display: none; }
.plot.filled .plot-marker, .plot.wilted .plot-marker { display: none; }

.plot-label {
  position: absolute; left: 50%; bottom: -14px;
  transform: translate(-50%, 100%);
  font-size: 9.5px; font-weight: 800; color: #FFF3DC;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
  white-space: nowrap;
}

/* ---------- Side menu (right edge) ---------- */
.side-menu {
  position: absolute;
  right: 10px; top: 14px;
  z-index: 6;
  display: flex; flex-direction: column; gap: 8px;
}
.side-btn {
  width: 46px; height: 44px; border-radius: 14px;
  background: rgba(10, 20, 14, 0.22);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  border: none;
  box-shadow: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-family: var(--font-round); font-size: 7.5px; font-weight: 700; letter-spacing: .01em;
  color: rgba(240, 235, 210, 0.92);
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
  cursor: pointer; transition: transform .12s, background .12s;
}
.side-btn svg { width: 21px; height: 21px; }
.side-btn svg path, .side-btn svg rect, .side-btn svg circle { stroke: rgba(240, 235, 210, 0.92) !important; }
.side-btn:active {
  transform: scale(.93);
  background: rgba(12, 24, 16, 0.55);
}

/* ---------- Bottom bar ---------- */
.bottom {
  position: relative; z-index: 6;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: flex-end; justify-content: center; gap: 10px;
  background: linear-gradient(180deg, rgba(87,163,46,0), rgba(63,120,32,.35));
}

.water-wrap { position: relative; width: 100%; max-width: 320px; }
.water-btn {
  width: 100%; border: 3px solid var(--btn-gs); border-radius: 99px;
  padding: 15px 10px;
  font-family: var(--font-round); font-size: 15.5px; font-weight: 900;
  color: #FFF; text-shadow: 0 2px 0 rgba(63,143,31,.7);
  background: linear-gradient(180deg, var(--btn-g1) 0%, #6BC93B 55%, var(--btn-g2) 100%);
  box-shadow: inset 0 4px 0 rgba(255,255,255,.45), inset 0 -4px 0 rgba(63,143,31,.35), 0 6px 0 rgba(63,143,31,.6);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.water-btn svg { width: 22px; height: 22px; }
.water-btn:active { transform: translateY(4px); box-shadow: inset 0 4px 0 rgba(255,255,255,.45), inset 0 -4px 0 rgba(63,143,31,.35), 0 2px 0 rgba(63,143,31,.6); }

.streak-tag {
  position: absolute; top: -14px; right: -4px; z-index: 2;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  border: 2.5px solid #B37A12; border-radius: 999px;
  padding: 3px 9px; font-size: 10.5px; font-weight: 900; color: #6B4408;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.5), 0 3px 0 rgba(92,58,24,.3);
  white-space: nowrap;
}

/* ---------- Popup: карточка дерева/покупки ----------
   Раньше это был отдельный "лист снизу" на системном шрифте — рядом с
   рунными артбордами кабинета/друзей/кошелька он читался как чужеродный,
   дешёвый кусок обычного мобильного приложения. Теперь тот же язык:
   центрированная карточка, тёплое свечение сверху как у алтаря/ниш,
   фирменный гравированный шрифт на цифрах и заголовке. */
.popup-overlay {
  position: fixed; inset: 0;
  background: rgba(4, 9, 5, 0.78);
  display: flex;
  align-items: center; justify-content: center;
  z-index: 20;
  padding: 24px 16px;
  /* всегда в разметке, скрыт через opacity/visibility — это и даёт плавный
     переход вместо жёсткого display:none↔flex, который анимировать нельзя */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .28s ease, visibility 0s linear .28s, background-color .28s ease;
}
.popup-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .28s ease, visibility 0s linear 0s, background-color .28s ease;
}
.popup {
  position: relative;
  width: min(360px, 92vw);
  border-radius: 22px;
  padding: 24px 20px calc(20px + env(safe-area-inset-bottom,0px));
  max-height: min(78vh, 640px);
  overflow-y: auto;
  /* карточка идёт с лёгкой задержкой и своей кривой — выезжает и
     "оседает" с небольшим перелётом, а не просто гаснет вместе с фоном */
  transform: scale(.92) translateY(14px);
  transition: transform .32s cubic-bezier(.22, 1.12, .32, 1);
  border: 1px solid rgba(214, 176, 104, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 226, 172, .14),
    inset 0 0 46px rgba(0, 0, 0, .5),
    0 30px 70px rgba(0, 0, 0, .65);
  background-color: #16110a;
  background-image:
    radial-gradient(120% 55% at 50% -4%, rgba(255, 178, 86, 0.18), rgba(255, 178, 86, 0) 62%),
    radial-gradient(90% 60% at 50% 108%, rgba(90, 180, 130, 0.06), rgba(90, 180, 130, 0) 70%),
    linear-gradient(180deg, #1C1810 0%, #12100B 42%, #0A0907 100%);
}
.popup-overlay.open .popup { transform: scale(1) translateY(0); }
.popup-x {
  position: absolute; top: 14px; right: 15px; z-index: 3;
  width: 29px; height: 29px; border-radius: 50%;
  border: 1px solid rgba(214, 176, 104, 0.22);
  background: rgba(8, 7, 5, 0.6);
  color: rgba(243,230,196,.75); font-size: 13px; line-height: 1;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.popup-x:active { color: #FFF1CE; border-color: rgba(240, 204, 132, .5); }

.popup-head {
  display: flex; align-items: center; gap: 14px;
  margin: 2px 34px 20px 0;
  padding-bottom: 16px;
  position: relative;
}
/* разделитель-нить под шапкой, гаснущая к краям — как на артбордах */
.popup-head::after {
  content: "";
  position: absolute; left: 0; right: -34px; bottom: 0; height: 1px;
  background: linear-gradient(90deg,
    rgba(214,176,104,0), rgba(240,204,132,.4) 30%,
    rgba(240,204,132,.4) 70%, rgba(214,176,104,0));
}
.popup-thumb {
  position: relative; flex: none;
  width: 66px; height: 66px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle, rgba(255,190,92,.22), rgba(255,190,92,0) 72%);
  box-shadow: 0 0 0 1px rgba(255, 228, 176, .17), 0 4px 12px rgba(0,0,0,.5);
}
.popup-thumb img { width: 78%; height: 78%; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)); }
.popup h2 {
  margin: 0 0 4px;
  font-family: var(--font-rune, 'Forum', 'Palatino Linotype', Georgia, serif);
  font-size: 21px; font-weight: 400;
  letter-spacing: .01em;
  color: #F7DFAE;
  text-shadow: 0 0 16px rgba(255, 186, 92, .3), 0 -1px 0 rgba(255,214,150,.18), 0 1px 2px rgba(0,0,0,.85);
}
.popup .sub { font-size: 12px; color: rgba(212, 186, 142, 0.55); margin: 0; }

.popup-stats {
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(214, 176, 104, 0.14);
  box-shadow: inset 0 2px 10px rgba(0,0,0,.45);
  padding: 2px 14px;
  margin-bottom: 18px;
}
.popup .row {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 0; font-size: 13px; color: #F0EBD2;
  border-bottom: 1px solid rgba(214, 176, 104, 0.12);
}
.popup .row:last-child { border-bottom: none; }
.popup .row-icon {
  flex: none; width: 30px; height: 30px;
  padding: 6px;
  border-radius: 50%;
  background: rgba(255, 200, 120, 0.07);
  color: rgba(240, 206, 140, 0.85);
}
.popup .row-label { flex: 1; color: rgba(230, 220, 195, 0.58); }
.popup .row-value {
  font-family: var(--font-rune, 'Forum', 'Palatino Linotype', Georgia, serif);
  font-size: 15px; font-weight: 400;
  color: #EFD6A4;
}
.popup .row-value.gold {
  color: #F7DFAE;
  text-shadow: 0 0 12px rgba(255, 186, 92, .35);
  font-variant-numeric: tabular-nums;
}
.popup .progress-track { background: rgba(0,0,0,0.35); border-radius: 99px; height: 7px; overflow: hidden; margin: 10px 0 16px; box-shadow: inset 0 1px 3px rgba(0,0,0,.5); }
.popup .progress-fill { height: 100%; background: linear-gradient(90deg, #C99A4E, #F0CE84); border-radius: 99px; }
.popup .buy-btn {
  width: 100%; border: 1px solid rgba(255, 210, 140, 0.45); border-radius: 14px; padding: 14px;
  font-family: var(--font-rune, 'Forum', 'Palatino Linotype', Georgia, serif);
  font-weight: 400; font-size: 16px; letter-spacing: .02em;
  background:
    radial-gradient(120% 160% at 50% -20%, rgba(255,232,190,.22), rgba(255,232,190,0) 55%),
    linear-gradient(180deg, #4a3417, #2c1f0e);
  color: #FFEBC0;
  text-shadow: 0 0 14px rgba(255, 196, 110, .35), 0 1px 2px rgba(0,0,0,.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 226, 172, .2),
    0 6px 18px rgba(0,0,0,.45);
  cursor: pointer; margin-top: 6px;
  transition: transform .12s;
}
.popup .buy-btn:active { transform: scale(.98); }
.popup .close-btn {
  width: 100%; border: 1px solid rgba(214, 176, 104, 0.22); border-radius: 12px;
  background: rgba(255,255,255,0.02); padding: 12px;
  font-family: var(--font-round); font-weight: 700; font-size: 13px; color: rgba(230, 220, 195, 0.7);
  cursor: pointer; margin-top: 4px;
  transition: border-color .15s, color .15s;
}
.popup .close-btn:active { color: #FFF1CE; border-color: rgba(240, 204, 132, .4); }

/* ---------- Экран выбора способа оплаты (openBuyConfirm) ----------
   Цена нарочно спрятана до этого шага — на самой кнопке «Посадить
   сейчас» она вела к тапу не глядя, чем платишь. */

/* крупная плашка со стоимостью в грн — якорь блока, задаёт масштаб
   остальным цифрам (доходности) под ней */
.buy-price {
  display: flex; align-items: center; justify-content: space-between;
  border-radius: 14px;
  background:
    radial-gradient(140% 100% at 50% -30%, rgba(255, 200, 120, .10), rgba(255,200,120,0) 60%),
    rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(214, 176, 104, 0.2);
  box-shadow: inset 0 2px 10px rgba(0,0,0,.4);
  padding: 13px 16px;
  margin-bottom: 8px;
}
.buy-price-label {
  font-family: var(--font-round);
  font-size: 12px; font-weight: 700;
  color: rgba(230, 220, 195, 0.6);
}
.buy-price-value {
  font-family: var(--font-rune, 'Forum', 'Palatino Linotype', Georgia, serif);
  font-size: 20px; font-weight: 400;
  color: #F7DFAE;
  text-shadow: 0 0 16px rgba(255, 186, 92, .4);
  font-variant-numeric: tabular-nums;
}

/* три меньшие плашки — доходность; в один ряд, чтобы читались как единая
   цепочка «день → неделя → год», а не как три отдельных факта */
.buy-income-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px;
  margin-bottom: 16px;
}
.buy-income {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(214, 176, 104, 0.12);
  box-shadow: inset 0 2px 8px rgba(0,0,0,.35);
  padding: 9px 4px;
  text-align: center;
}
.buy-income-label {
  font-family: var(--font-round);
  font-size: 9px; font-weight: 700;
  color: rgba(230, 220, 195, 0.5);
  text-transform: uppercase; letter-spacing: .04em;
}
.buy-income-value {
  font-family: var(--font-rune, 'Forum', 'Palatino Linotype', Georgia, serif);
  font-size: 13px; font-weight: 400;
  color: #EFD6A4;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pay-methods-label {
  margin: 0 0 10px !important;
  text-align: center;
  position: relative;
  padding-top: 14px;
}
/* тонкая нить-разделитель над «выбери способ оплаты» — тот же приём, что
   у .popup-head::after, отделяет цифры дохода от блока выбора оплаты */
.pay-methods-label::before {
  content: "";
  position: absolute; left: 10%; right: 10%; top: 0; height: 1px;
  background: linear-gradient(90deg,
    rgba(214,176,104,0), rgba(240,204,132,.35) 30%,
    rgba(240,204,132,.35) 70%, rgba(214,176,104,0));
}
.pay-methods {
  display: flex; gap: 10px;
  margin-bottom: 4px;
}
.pay-method-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 1px solid rgba(255, 210, 140, 0.4); border-radius: 16px;
  padding: 18px 8px;
  background:
    radial-gradient(120% 160% at 50% -20%, rgba(255,232,190,.18), rgba(255,232,190,0) 55%),
    linear-gradient(180deg, #4a3417, #2c1f0e);
  box-shadow:
    inset 0 1px 0 rgba(255, 226, 172, .2),
    0 6px 16px rgba(0,0,0,.4);
  cursor: pointer;
  transition: transform .12s, border-color .15s, box-shadow .15s;
}
.pay-method-btn:active {
  transform: scale(.96);
  box-shadow:
    inset 0 1px 0 rgba(255, 226, 172, .28),
    0 3px 10px rgba(0,0,0,.4);
}
.pay-method-icon {
  width: 27px; height: 27px;
  color: #FFD34D;
  filter: drop-shadow(0 0 10px rgba(255, 200, 120, .5));
}
.pay-method-value {
  font-family: var(--font-rune, 'Forum', 'Palatino Linotype', Georgia, serif);
  font-size: 17px; font-weight: 400;
  color: #F7DFAE;
  text-shadow: 0 0 12px rgba(255, 186, 92, .35);
}
.pay-method-label {
  font-family: var(--font-round);
  font-size: 11px; font-weight: 700;
  color: rgba(230, 220, 195, 0.6);
  text-transform: uppercase; letter-spacing: .04em;
}
.pay-method-ton { border-color: rgba(150, 200, 255, 0.35); }
.pay-method-ton .pay-method-icon { color: #8FC7FF; filter: drop-shadow(0 0 10px rgba(150, 200, 255, .55)); }
.pay-method-ton .pay-method-value { color: #D7EAFF; text-shadow: 0 0 12px rgba(150, 200, 255, .35); }
.pay-method-ton:active { border-color: rgba(180, 215, 255, 0.6); }

/* живые светлячки поверх сцены — те же .firefly, что и в саду/карточке
   дерева, летают по краям карточки, не мешая цифрам по центру */
.popup-buy-fireflies {
  position: absolute; inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: 22px;
}

/* фон экрана оплаты — арка руин со светлячками, приглушена тёмным
   градиентом (картинка сама по себе была слишком контрастной под
   мелкими плашками — резьба и лианы просвечивали и рябили под цифрами) */
.popup.popup-buy {
  background-color: #0c1210;
  background-image:
    linear-gradient(180deg, rgba(7,10,9,.62) 0%, rgba(7,10,9,.5) 22%, rgba(7,10,9,.6) 55%, rgba(5,7,6,.82) 100%),
    url("../assets/decor/buy-confirm-bg.png");
  background-size: cover, cover;
  background-position: center, center 20%;
  background-repeat: no-repeat, no-repeat;
}
.popup-buy .popup-thumb {
  background: radial-gradient(circle, rgba(255,190,92,.28), rgba(255,190,92,0) 72%);
  box-shadow: 0 0 0 1px rgba(255, 228, 176, .28), 0 4px 14px rgba(0,0,0,.55);
}
/* плашки — сплошные, с лёгким размытием подложки, чтобы читались как
   отдельные таблички поверх сцены, а не полупрозрачное окно в резьбу */
.popup-buy .buy-price,
.popup-buy .buy-income,
.popup-buy .pay-method-btn {
  background-color: rgba(10, 8, 6, 0.86);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.popup-buy .buy-price {
  background-image: radial-gradient(140% 100% at 50% -30%, rgba(255, 200, 120, .12), rgba(255,200,120,0) 60%);
}
.popup-buy .pay-method-btn {
  background-image:
    radial-gradient(120% 160% at 50% -20%, rgba(255,232,190,.14), rgba(255,232,190,0) 55%),
    linear-gradient(180deg, rgba(74,52,23,.9), rgba(44,31,14,.9));
}
.popup-buy .pay-method-ton {
  background-image:
    radial-gradient(120% 160% at 50% -20%, rgba(190,220,255,.12), rgba(190,220,255,0) 55%),
    linear-gradient(180deg, rgba(74,52,23,.9), rgba(44,31,14,.9));
}

/* ---------- Карточка выросшего дерева — резной артборд tree-info-bg.png,
   те же пропорции 896×1200, что и у самой картинки, весь контент разложен
   по вырезанным в дереве нишам абсолютным позиционированием (тот же приём,
   что у .friends-modal/.cabinet-modal). ---------- */
/* Артборд обрезан ровно по каменной плите (658×996), без лесного фона по
   краям — иначе карточка «плавала» в собственном фоне поверх сцены.
   Координаты ниш сняты по обрезанной картинке: медальон — центр
   25.5%/16.2%; ниша имени — центр 67.5%/16%; три капсулы — центр x 48.5%,
   центры y 41.8 / 57.0 / 72.4%; кнопка — центр 50.5%/89.5%. */
.popup.popup-info {
  position: relative;
  /* Ширину считаем ОТ высоты экрана, а не только от ширины: иначе на
     невысоких экранах карточка упирается в предел по высоте, теряет
     пропорцию, фон обрезается — и текст, размеченный в % от бокса,
     уезжает мимо ниш. 48px — вертикальный padding .popup-overlay. */
  /* сначала vh-фолбэк для вебвью без поддержки dvh (в них расчёт по dvh
     невалиден, и без запасного варианта карточка теряет ограничение по
     высоте и садится не по центру экрана), затем dvh поверх — там, где
     поддерживается, он точнее учитывает адресную строку/панели. */
  width: min(360px, 92vw, calc((100vh - 48px) * 658 / 996));
  width: min(360px, 92vw, calc((100dvh - 48px) * 658 / 996));
  aspect-ratio: 658 / 996;
  /* max-height базового .popup (78vh) обязателен к сбросу: он обрезал
     высоту раньше, чем срабатывал aspect-ratio, и вся разметка ниш
     съезжала вверх относительно фона */
  max-height: none;
  flex: none;
  padding: 0;
  overflow: visible;
  border: none;
  border-radius: 18px;
  box-shadow: 0 30px 70px rgba(0,0,0,.65);
  background-color: transparent;
  background-image: url("../assets/decor/tree-info-bg.png?v=2");
  /* строго по боксу, а не cover — так ниши на картинке и проценты
     позиционирования совпадают даже если пропорция чуть уедет */
  background-size: 100% 100%;
  background-position: center;
  container-type: inline-size;
  /* Yeseva One — декоративная антиква с полной кириллицей: высокий
     контраст штриха и «резной» характер попадают в руническую тему, чего
     не давал нейтральный Forum. */
  --font-rune: 'Yeseva One', 'Forum', 'Palatino Linotype', Georgia, serif;
  --ink-gold: #EFD6A4;
  --ink-bronze: rgba(212, 178, 126, 0.78);

  /* Геометрия карточки вынесена в переменные — их живьём крутит
     редактор ?editpopup=1 (см. popup-editor.js), значения ниже это
     дефолты на случай, если сохранённых правок в localStorage нет. */
  --pi-thumb-left: 25.2%; --pi-thumb-top: 16.9%; --pi-thumb-size: 23%;
  --pi-name-left: 71.2%; --pi-name-top: 16.8%; --pi-name-width: 40%; --pi-name-height: 22%;
  --pi-name-h2-size: 5cqw; --pi-name-sub-size: 3cqw;
  --pi-row-left: 46.3%; --pi-row-width: 70%; --pi-row-height: 8%;
  --pi-row-gap: 1.4cqw; --pi-row-pad: 2.6%;
  --pi-row1-top: 43.7%; --pi-row2-top: 59%; --pi-row3-top: 74.6%;
  --pi-icon-size: 5.6cqw; --pi-label-size: 3.5cqw; --pi-value-size: 3.9cqw;
  --pi-close-left: 49.1%; --pi-close-top: 90.5%; --pi-close-width: 58%; --pi-close-height: 6.4%;
  --pi-close-size: 4.3cqw;
}

/* «врезанный в дерево» текст — общий приём карточки: тёплый отсвет
   изнутри (как у самих рун), тонкий светлый ободок сверху (край выреза
   ловит свет) и плотная тень вниз (глубина паза). */
.popup-info-name h2,
.popup-info-name .sub,
.popup-info-row .row-label,
.popup-info-row .row-value,
.popup-info-close-btn {
  font-family: var(--font-rune);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* блюр сведён к минимуму — крупный мягкий ореол на мелком тексте читался
     как «нечёткий» шрифт; резкая тёмная тень снизу + тонкий светлый
     ободок сверху всё ещё дают эффект резьбы, но контур остаётся чётким */
  text-shadow:
    0 -1px 0 rgba(255, 214, 150, .3),
    0 1px 1px rgba(0, 0, 0, .95),
    0 1px 2px rgba(0, 0, 0, .6);
}

/* живые светлячки поверх артборда — те же, что летают по сцене сада,
   pointer-events отключены, чтобы не перехватывали тап по кнопкам */
.popup-info-fireflies {
  position: absolute; inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: 22px;
  z-index: 2;
}

/* целиком над карточкой, а не внахлёст на её угол — иначе перекрывает
   резьбу рамы и читается как случайно налепленный элемент */
.popup-info-x {
  position: absolute; top: -6.5%; right: 0; z-index: 4;
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid rgba(214, 176, 104, 0.3);
  background: rgba(8, 7, 5, 0.65);
  color: rgba(243,230,196,.8); font-size: 13px; line-height: 1;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.popup-info-x:active { color: #FFF1CE; border-color: rgba(240, 204, 132, .5); }

/* overflow:hidden обязателен — кроны у крупных деревьев (мифическое,
   божественное) шире своего медальона и без обрезки наползали на рамку и
   на название справа */
.popup-info-thumb {
  position: absolute; left: var(--pi-thumb-left); top: var(--pi-thumb-top);
  width: var(--pi-thumb-size); aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  overflow: hidden;
  display: grid; place-items: center;
  z-index: 3;
}
.popup-info-thumb img {
  width: 88%; height: 88%; object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.65)) drop-shadow(0 0 12px rgba(255, 190, 100, .25));
}

.popup-info-name {
  position: absolute; left: var(--pi-name-left); top: var(--pi-name-top);
  transform: translate(-50%, -50%);
  width: var(--pi-name-width); height: var(--pi-name-height);
  display: flex; flex-direction: column; justify-content: center;
  align-items: center;
  text-align: center;
  overflow: hidden;
  z-index: 3;
}
/* «Божественное дерево» в одну строку в эту нишу не влезает никак —
   разрешаем перенос, но балансируем строки, чтобы не было «сироты» */
.popup-info-name h2 {
  margin: 0 0 .35em;
  font-size: var(--pi-name-h2-size);
  letter-spacing: .01em;
  color: #F7DFAE;
  line-height: 1.15;
  text-wrap: balance;
}
.popup-info-name .sub {
  font-size: var(--pi-name-sub-size);
  color: var(--ink-bronze);
  margin: 0; line-height: 1.2;
}

/* капсула: иконка слева, подпись, значение прижато вправо — padding
   отступает от резных «пробок» на концах капсулы. overflow:hidden —
   подстраховка: даже если текст не влезет по ширине, он обрежется
   многоточием внутри капсулы, а не вылезет поверх резьбы карточки. */
.popup-info-row {
  position: absolute; left: var(--pi-row-left);
  transform: translate(-50%, -50%);
  width: var(--pi-row-width); height: var(--pi-row-height);
  display: flex; align-items: center; gap: var(--pi-row-gap);
  padding: 0 var(--pi-row-pad);
  overflow: hidden;
  z-index: 3;
}
.popup-info-row-1 { top: var(--pi-row1-top); }
.popup-info-row-2 { top: var(--pi-row2-top); }
.popup-info-row-3 { top: var(--pi-row3-top); }
/* иконка без своей круглой подложки — «бейдж» под ней выдавал наложение
   поверх картинки; голый контур цвета рун садится в резьбу */
.popup-info-row .row-icon {
  flex: none; width: var(--pi-icon-size); height: var(--pi-icon-size);
  color: rgba(236, 196, 128, 0.85);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.85));
}
/* flex-shrink у подписи — иначе длинное значение справа сжимает её и
   «Получено» превращается в «Получе…»; сжиматься первым должен пробел
   между ними, а не значение (оно важнее — это цифра) */
.popup-info-row .row-label {
  flex: 1 1 auto; min-width: 0;
  font-size: var(--pi-label-size);
  color: var(--ink-bronze);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.popup-info-row .row-value {
  flex: none; margin-left: auto;
  font-size: var(--pi-value-size);
  color: var(--ink-gold);
  white-space: nowrap;
}
.popup-info-row .row-value.gold {
  color: #F7DFAE;
  font-variant-numeric: tabular-nums;
}

.popup-info-close-btn {
  position: absolute; left: var(--pi-close-left); top: var(--pi-close-top);
  transform: translate(-50%, -50%);
  width: var(--pi-close-width); height: var(--pi-close-height);
  border: none; background: none; padding: 0;
  font-size: var(--pi-close-size);
  letter-spacing: .03em;
  text-indent: .015em; /* половина letter-spacing — центрирует буквы, а не бокс */
  color: #F3DCAC;
  cursor: pointer;
  z-index: 3;
  transition: color .15s, text-shadow .15s;
}
.popup-info-close-btn:active {
  color: #FFF1CE;
  text-shadow: 0 0 14px rgba(255, 196, 110, .6);
}
.popup .nudge {
  font-family: var(--font-rune, 'Forum', 'Palatino Linotype', Georgia, serif);
  font-size: 12.5px; color: #E0C089; text-align: center; margin-top: 9px;
}

/* ---------- Магазин / Питомник деревьев ---------- */
.shop-overlay {
  position: fixed; inset: 0;
  background: rgba(4, 9, 5, 0.78);
  display: flex;
  align-items: center; justify-content: center;
  z-index: 25;
  padding: 24px 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .28s ease, visibility 0s linear .28s;
}
.shop-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .28s ease, visibility 0s linear 0s;
}

.shop-modal {
  position: relative;
  width: min(380px, 92vw);
  max-height: 100%;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(.92) translateY(14px);
  transition: transform .32s cubic-bezier(.22, 1.12, .32, 1);
  border: 1px solid rgba(180, 150, 90, 0.28);
  box-shadow: 0 24px 60px rgba(0,0,0,.55);
  /* картинка на весь магазин как есть, без размытия — карточки и шапка
     ложатся поверх на полупрозрачных панелях, чтобы текст оставался
     читаемым, но сама рама с рунами видна чётко */
  background-color: #1a1309;
  background-image:
    linear-gradient(180deg, rgba(10,7,4,0.15) 0%, rgba(10,7,4,0.28) 55%, rgba(8,6,3,0.48) 100%),
    url("../assets/decor/shop-bg.jpg?v=2");
  /* cover, а не "во весь рост" — картинка идёт на всю высоту модалки без
     разрывов внизу, даже если список длиннее исходной картинки */
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}
.shop-overlay.open .shop-modal { transform: scale(1) translateY(0); }

.shop-header {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: flex-start;
  padding: 16px 18px 20px;
  min-height: 128px;
  background-image: linear-gradient(180deg, rgba(8,6,3,0.15) 0%, rgba(8,6,3,0.55) 100%);
  border-bottom: 1px solid rgba(180, 150, 90, 0.28);
}
.shop-header h2 {
  margin: 0; font-size: 17px; font-weight: 800;
  color: #F3E6C4;
  text-shadow: 0 2px 5px rgba(0,0,0,.85);
  letter-spacing: .01em;
}
.shop-close {
  position: absolute; top: 12px; right: 14px; z-index: 3;
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: rgba(10,7,4,0.55);
  color: rgba(243,230,196,.9); font-size: 14px; line-height: 1;
  cursor: pointer;
  transition: transform .12s, color .15s;
}
.shop-close:active { transform: scale(.88); color: #FFF1CE; }

.shop-list {
  position: relative; z-index: 2;
  overflow-y: auto;
  /* карточки уже, чем модалка, и стоят по центру — резные колонны с
     рунами и кристаллами остаются видны по бокам, как оконный проём */
  padding: 14px 15% calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shop-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 15px;
  overflow: hidden;
  /* без этого overflow:hidden выше даёт карточке min-height:0 и flex
     сжимает её ниже содержимого внутри скролл-списка — обрезая текст */
  flex-shrink: 0;
  /* резная деревянная ниша, как .wallet-row — тёплый градиент вместо
     плоской чёрной заливки, чтобы карточка читалась частью той же рамы,
     а не наклеенным поверх UI-блоком */
  background:
    linear-gradient(180deg, rgba(74, 48, 26, 0.88), rgba(28, 17, 9, 0.92)),
    linear-gradient(180deg, rgba(255, 238, 205, 0.05), rgba(255, 238, 205, 0));
  border: 1px solid rgba(214, 176, 104, 0.24);
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 194, .1),
    inset 0 -14px 22px rgba(0,0,0,.4),
    0 6px 16px rgba(0,0,0,.4);
}
/* тонкая рунная нить сверху — та же деталь, что делит шапки модалок */
.shop-card::before {
  content: "";
  position: absolute; left: 14px; right: 14px; top: 0; height: 1px;
  background: linear-gradient(90deg,
    rgba(214, 176, 104, 0), rgba(240, 204, 132, .5) 22%,
    rgba(240, 204, 132, .5) 78%, rgba(214, 176, 104, 0));
}

.shop-card-thumb {
  position: relative;
  flex: none;
  width: 58px; height: 58px;
  border-radius: 12px;
  background: radial-gradient(circle, rgba(140, 219, 85, 0.16), rgba(20,15,9,0) 70%);
  display: grid; place-items: center;
}
.shop-card-thumb img {
  width: 92%; height: 92%; object-fit: contain;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,.5));
}

.shop-card-body { flex: 1; min-width: 0; }
.shop-card-name {
  margin: 0 0 2px; font-size: 14px; font-weight: 800;
  color: #F3E6C4;
}
.shop-card-rate {
  margin: 0 0 8px; font-size: 11px; color: rgba(230, 220, 195, 0.62);
}

.shop-card .progress-track {
  background: rgba(255,255,255,0.1); border-radius: 99px; height: 7px;
  overflow: hidden; margin: 0 0 6px;
}
.shop-card .progress-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #7ED447, #58B32C);
}
.shop-card-progress-label {
  font-size: 10.5px; color: rgba(230, 220, 195, 0.6);
  margin: 0 0 6px;
}
.shop-card-firefly-note {
  font-size: 10.5px; color: rgba(255, 210, 130, 0.75);
  margin: 0 0 6px;
  line-height: 1.4;
}

.shop-nudge-btn {
  border: none; background: none; padding: 0;
  font-family: var(--font-round); font-size: 11.5px; font-weight: 700;
  color: #FFD27A;
  cursor: pointer;
  text-align: left;
}
.shop-nudge-btn:active { opacity: .7; }

.shop-buy-btn {
  display: block;
  margin-top: 8px;
  border: 1px solid rgba(214, 176, 104, 0.28); border-radius: 10px;
  background: rgba(255,255,255,0.03); padding: 8px 10px;
  font-family: var(--font-round); font-size: 11px; font-weight: 700;
  color: rgba(230, 220, 195, 0.8);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, color .15s;
}
.shop-buy-btn:active { color: #FFF1CE; border-color: rgba(240, 204, 132, .45); }

/* карточка остаётся полностью активной (не притушена) — деревья за деньги
   можно докупать неограниченно, это больше не «готовое» неактивное состояние */
.shop-card.filled .shop-card-name {
  opacity: 0.9;
}
.shop-card.filled .shop-card-thumb { background: radial-gradient(circle, rgba(126,212,71,0.28), rgba(20,15,9,0) 70%); }
.shop-card-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 800; color: #B7F0A0;
}

/* дерево без предыдущего в очереди всё равно продаётся за ⭐/TON — эта
   строка просто поясняет, что бесплатным поливом оно пока не растёт */
.shop-card-note {
  font-size: 10.5px; color: rgba(230, 220, 195, 0.55);
  margin: 0 0 8px;
  line-height: 1.4;
}

/* ---------- Личный кабинет: деревянный стенд с 3 ярусами на артборде ---------- */
.cabinet-overlay {
  position: fixed; inset: 0;
  background: rgba(4, 9, 5, 0.78);
  display: flex;
  align-items: center; justify-content: center;
  z-index: 25;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .28s ease, visibility 0s linear .28s;
}
.cabinet-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .28s ease, visibility 0s linear 0s;
}

.cabinet-modal {
  position: relative;
  /* во весь экран: фон растягивается 100% 100% в сам бокс, поэтому
     процентная привязка контента к нишам не зависит от формы бокса —
     можно смело занимать весь вьюпорт без леттербоксинга по бокам */
  width: 100vw;
  height: 100dvh;
  height: 100vh;
  border-radius: 0;
  overflow: hidden;
  transform: scale(.98);
  transition: transform .32s cubic-bezier(.22, 1.12, .32, 1);
  border: none;
  box-shadow: none;
  background-color: #16110a;
  background-image: url("../assets/decor/cabinet-bg-v2.png");
  /* строго по боксу — фон и проценты позиционирования не расходятся */
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}
.cabinet-overlay.open .cabinet-modal { transform: scale(1); }

.cabinet-close {
  position: absolute; top: 3.2%; right: 5%; z-index: 3;
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: rgba(10,7,4,0.55);
  color: rgba(243,230,196,.9); font-size: 13px; line-height: 1;
  cursor: pointer;
  transition: transform .12s, color .15s;
}
.cabinet-close:active { transform: scale(.88); color: #FFF1CE; }

/* Forum — антиквенные капитель-формы с полной кириллицей: одинаково
   выглядят и цифры, и русские подписи (у Cinzel кириллицы нет, из-за
   чего подписи проваливались в Times и всё расползалось).
   cqw-размеры привязывают текст к ширине артборда, поэтому надписи
   всегда попадают в свои выемки, на любом экране. */
.cabinet-modal, .friends-modal {
  --font-rune: 'Forum', 'Palatino Linotype', Georgia, serif;
  --ink-gold: #EFD6A4;
  --ink-bronze: rgba(206, 170, 118, 0.62);
  container-type: inline-size;
}

/* общий приём для всех надписей: тёплый отсвет сверху (будто их
   подсвечивает фонарь артборда) + плотная тень вниз, как у резьбы */
/* «врезанный в дерево» текст — тёплый внутренний отсвет как у самих рун
   рамки (амбер-glow), сверху тонкий светлый ободок (будто край выреза
   ловит свет лампы), снизу плотная тёмная тень (глубина паза) — читается
   как часть резьбы, а не наклейка поверх картинки. */
.cabinet-balance-value,
.cabinet-balance-unit,
.cabinet-rank,
.cabinet-niche-label,
.cabinet-niche-value,
.cabinet-withdraw-btn {
  font-family: var(--font-rune);
  font-weight: 400;
  text-shadow:
    0 -1px 0 rgba(255, 214, 150, .3),
    0 1px 1px rgba(0, 0, 0, .9),
    0 2px 5px rgba(0, 0, 0, .7),
    0 0 10px rgba(255, 176, 90, .35);
}

/* большая ниша сверху — сумма баланса (тёмное поле ~19%..44% из 1568) */
.cabinet-balance {
  position: absolute; left: 50%; top: 31.5%;
  transform: translate(-50%, -50%);
  width: 46%;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
.cabinet-balance-value {
  font-size: 37px; font-size: 10.3cqw;
  color: #F7DFAE;
  text-shadow:
    0 0 26px rgba(255, 186, 92, .55),
    0 -1px 0 rgba(255, 214, 150, .3),
    0 1px 2px rgba(0,0,0,.9),
    0 3px 8px rgba(0,0,0,.6);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.cabinet-balance-unit {
  margin-top: 0.35em;
  font-size: 10.5px; font-size: 2.9cqw;
  color: var(--ink-bronze);
  letter-spacing: .22em;
  text-transform: uppercase;
  /* letter-spacing добавляет отступ ПОСЛЕ каждой буквы, включая
     последнюю — из-за этого центрированная строка визуально съезжает
     влево на половину letter-spacing. text-indent должен компенсировать
     ровно половину, а не всю величину (иначе текст просто уедет вправо
     вместо того чтобы встать по центру). */
  text-indent: .11em;
}

/* узкая прорезь под балансом (~46.5%..52.5% из 1568) — ранг садовника */
.cabinet-rank {
  position: absolute; left: 50%; top: 49.5%;
  transform: translate(-50%, -50%);
  width: 52%;
  text-align: center;
  font-size: 11.5px; font-size: 3.2cqw;
  color: rgba(224, 190, 138, 0.8);
  letter-spacing: .2em;
  text-transform: uppercase;
  text-indent: .1em; /* половина letter-spacing, см. комментарий выше */
  white-space: nowrap; overflow: hidden;
}

/* три резные ниши (тёмный интерьер ~58.5%..75.2% по вертикали, центр
   66.9% — замерено по пикселям картинки, а не на глаз; центры x
   27.5 / 50 / 72.5 %) */
.cabinet-niche {
  position: absolute; left: var(--nx); top: 66.9%;
  transform: translate(-50%, -50%);
  width: 19%;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
.cabinet-niche-label {
  /* letter-spacing тянет строку влево от центра на свою половину — тут
     это было заметнее всего (короткие «в день»/«в год» против длинного
     «в неделю»). text-indent компенсирует ровно половину letter-spacing,
     не всю величину — иначе получится перекомпенсация в другую сторону. */
  font-size: 8.5px; font-size: 2.35cqw;
  color: var(--ink-bronze);
  letter-spacing: .05em;
  text-indent: .025em;
  text-transform: uppercase;
  white-space: nowrap;
}
.cabinet-niche-value {
  margin-top: 0.35em;
  font-size: 16px; font-size: 4.4cqw;
  color: var(--ink-gold);
  text-shadow:
    0 0 14px rgba(255, 186, 92, .4),
    0 -1px 0 rgba(255, 214, 150, .3),
    0 1px 2px rgba(0,0,0,.9);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

/* капсула внизу (~80.5%..87% из 1568) уже нарисована на артборде — кнопка
   не рисует свою рамку и фон, иначе читается как наклейка поверх */
.cabinet-withdraw-btn {
  position: absolute; left: 50%; top: 83.7%;
  transform: translate(-50%, -50%);
  width: 60%; height: 6.5%;
  border: none; background: none; padding: 0;
  color: #F6E3B8;
  font-size: 17px; font-size: 4.7cqw;
  font-weight: 700;
  letter-spacing: .05em;
  text-indent: .025em; /* половина letter-spacing — центрирует видимый текст, не бокс */
  cursor: pointer;
  transition: color .15s, text-shadow .15s;
}
.cabinet-withdraw-btn:active {
  color: #FFF1CE;
  text-shadow:
    0 0 16px rgba(255, 196, 110, .75),
    0 1px 2px rgba(0,0,0,.9);
}

/* ---------- Переключатель звука ---------- */
.sfx-toggle {
  position: absolute;
  left: 10px; top: 14px;
  z-index: 6;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: none; border-radius: 50%;
  background: rgba(10, 20, 14, 0.22);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: transform .12s, background .12s;
}
.sfx-toggle:active { transform: scale(.92); background: rgba(12, 24, 16, 0.55); }
.sfx-toggle svg { width: 19px; height: 19px; }
.sfx-toggle svg path { stroke: rgba(240, 235, 210, 0.92) !important; }
/* включён — видны волны, крестик спрятан; выключен — наоборот и тусклее */
.sfx-toggle .sfx-cross { display: none; }
.sfx-toggle.off .sfx-wave { display: none; }
.sfx-toggle.off .sfx-cross { display: block; }
.sfx-toggle.off svg path { stroke: rgba(240, 235, 210, 0.45) !important; }

/* второй тумблер — музыка, сидит вплотную справа от тумблера звука */
.music-toggle {
  position: absolute;
  left: 52px; top: 14px;
  z-index: 6;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: none; border-radius: 50%;
  background: rgba(10, 20, 14, 0.22);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: transform .12s, background .12s;
}
.music-toggle:active { transform: scale(.92); background: rgba(12, 24, 16, 0.55); }
.music-toggle svg { width: 18px; height: 18px; }
.music-toggle svg path { stroke: rgba(240, 235, 210, 0.92) !important; }
.music-toggle .music-cross { display: none; }
.music-toggle.off .music-cross { display: block; }
.music-toggle.off svg path { stroke: rgba(240, 235, 210, 0.45) !important; }

/* ---------- "Живой" слой поверх статичных артбордов (кабинет/друзья) ----------
   Вместо видео — дешёвые CSS-анимации: мерцание нарисованного фонаря и
   несколько дрейфующих светлячков. GPU почти не грузит (compositing
   маленьких слоёв), декодер видео вообще не участвует, поэтому можно
   держать одновременно с видео-фоном сцены без риска тормозов. */
.modal-life {
  position: absolute; inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.modal-lantern-glow {
  position: absolute; left: 50%; top: 10%;
  width: 26%; height: 12%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 186, 100, .4), rgba(255, 186, 100, 0) 72%);
  mix-blend-mode: screen;
  animation: lanternFlicker 3.6s ease-in-out infinite;
}
@keyframes lanternFlicker {
  0%, 100% { opacity: .55; transform: translate(-50%, -50%) scale(1); }
  18%      { opacity: .78; }
  33%      { opacity: .5;  }
  47%      { opacity: .82; transform: translate(-50%, -50%) scale(1.05); }
  63%      { opacity: .6;  }
  78%      { opacity: .72; }
  91%      { opacity: .56; }
}

.firefly {
  will-change: transform, opacity;
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: #FFE9AE;
  box-shadow: 0 0 6px 2px rgba(255, 220, 140, .9), 0 0 14px 5px rgba(255, 190, 90, .4);
  opacity: 0;
  animation-name: fireflyDrift;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}
@keyframes fireflyDrift {
  0%   { opacity: 0; transform: translate(0, 0) scale(.6); }
  12%  { opacity: 1; }
  50%  { transform: translate(var(--dx, 12px), var(--dy, -18px)) scale(1); }
  88%  { opacity: .75; }
  100% { opacity: 0; transform: translate(var(--dx2, -10px), var(--dy2, -32px)) scale(.6); }
}

@media (prefers-reduced-motion: reduce) {
  .modal-lantern-glow, .firefly { animation: none !important; opacity: .5; }
}

/* ---------- Кошелёк: чип сверху сцены + выбор кошелька ---------- */
.wallet-chip {
  position: absolute;
  left: 50%; top: 14px;
  transform: translateX(-50%);
  z-index: 6;
  max-width: 62%;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: none; border-radius: 99px;
  background: rgba(10, 20, 14, 0.22);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  font-family: var(--font-round);
  font-size: 11px; font-weight: 700; letter-spacing: .01em;
  color: rgba(240, 235, 210, 0.92);
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
  white-space: nowrap;
  cursor: pointer;
  transition: transform .12s, background .12s;
}
.wallet-chip:active { transform: translateX(-50%) scale(.95); background: rgba(12, 24, 16, 0.55); }
.wallet-chip svg { width: 17px; height: 17px; flex: none; }
.wallet-chip svg path { stroke: rgba(240, 235, 210, 0.92) !important; }
.wallet-chip span { overflow: hidden; text-overflow: ellipsis; }
/* подключён — подсвечиваем адрес тёплым, как руны на артбордах */
.wallet-chip.connected { color: #F3DDAE; }
.wallet-chip.connected svg path { stroke: #F3DDAE !important; }

.wallet-overlay {
  position: fixed; inset: 0;
  background: rgba(4, 9, 5, 0.78);
  display: flex;
  align-items: center; justify-content: center;
  z-index: 30;
  padding: 24px 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .28s ease, visibility 0s linear .28s;
}
.wallet-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .28s ease, visibility 0s linear 0s;
}

.wallet-sheet {
  position: relative;
  width: min(348px, 92vw);
  max-height: 100%;
  display: flex; flex-direction: column;
  border-radius: 22px;
  overflow: hidden;
  transform: scale(.92) translateY(14px);
  transition: transform .32s cubic-bezier(.22, 1.12, .32, 1);
  /* не плоская коричневая заливка, а глубина как на артбордах: тёплый
     свет «фонаря» сверху, уходящий в почти чёрную лесную темноту */
  background:
    radial-gradient(115% 55% at 50% -4%, rgba(255, 178, 86, 0.20), rgba(255, 178, 86, 0) 62%),
    radial-gradient(90% 60% at 50% 108%, rgba(90, 180, 130, 0.07), rgba(90, 180, 130, 0) 70%),
    linear-gradient(180deg, #1C1810 0%, #12100B 42%, #0A0907 100%);
  border: 1px solid rgba(214, 176, 104, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 226, 172, .16),
    inset 0 0 46px rgba(0, 0, 0, .55),
    0 30px 70px rgba(0, 0, 0, .68);
}
.wallet-overlay.open .wallet-sheet { transform: scale(1) translateY(0); }
/* подсказка, что список листается — низ панели растворяется в темноте */
.wallet-sheet::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 46px;
  background: linear-gradient(180deg, rgba(10,9,7,0), rgba(10,9,7,.92));
  pointer-events: none;
}

.wallet-sheet-head {
  position: relative;
  padding: 17px 50px 14px 20px;
}
/* разделитель-нить, гаснущая к краям — как рунные полосы на артбордах */
.wallet-sheet-head::after {
  content: "";
  position: absolute; left: 14px; right: 14px; bottom: 0; height: 1px;
  background: linear-gradient(90deg,
    rgba(214,176,104,0), rgba(240,204,132,.45) 22%,
    rgba(240,204,132,.45) 78%, rgba(214,176,104,0));
}
.wallet-sheet-head h2 {
  margin: 0;
  font-family: 'Forum', 'Palatino Linotype', Georgia, serif;
  font-size: 17px; font-weight: 400;
  letter-spacing: .16em; text-transform: uppercase; text-indent: .08em;
  color: #F7DFAE;
  text-shadow:
    0 0 20px rgba(255, 186, 92, .38),
    0 -1px 0 rgba(255,214,150,.18),
    0 1px 2px rgba(0,0,0,.85);
}
.wallet-sheet-sub {
  margin: 4px 0 0;
  font-family: var(--font-round);
  font-size: 11px;
  color: rgba(212, 186, 142, 0.5);
}
.wallet-close {
  position: absolute; top: 15px; right: 15px;
  width: 29px; height: 29px; border-radius: 50%;
  border: 1px solid rgba(214, 176, 104, 0.22);
  background: rgba(8, 7, 5, 0.6);
  color: rgba(243,230,196,.75); font-size: 13px; line-height: 1;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.wallet-close:active { color: #FFF1CE; border-color: rgba(240, 204, 132, .5); }

.wallet-list {
  overflow-y: auto;
  padding: 12px 12px 20px;
  display: flex; flex-direction: column; gap: 7px;
}

/* строка кошелька — приподнятая плашка со скошенным светом сверху,
   а не плоский коричневый прямоугольник */
.wallet-row {
  display: flex; align-items: center; gap: 13px;
  width: 100%;
  padding: 10px 14px 10px 11px;
  border-radius: 15px;
  border: 1px solid rgba(214, 176, 104, 0.15);
  background: linear-gradient(180deg,
    rgba(255, 238, 205, 0.062), rgba(255, 238, 205, 0.014));
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 194, .09),
    0 2px 7px rgba(0, 0, 0, .38);
  font-family: var(--font-round);
  color: #F3E6C4;
  cursor: pointer;
  text-align: left;
  transition: transform .12s, border-color .15s, background .15s;
}
.wallet-row:active {
  transform: scale(.985);
  border-color: rgba(244, 206, 134, 0.46);
  background: linear-gradient(180deg,
    rgba(255, 226, 170, 0.13), rgba(255, 226, 170, 0.04));
}
.wallet-row-icon {
  flex: none; width: 40px; height: 40px;
  border-radius: 13px; overflow: hidden;
  background: #0C0A07;
  box-shadow:
    0 0 0 1px rgba(255, 228, 176, .17),
    0 4px 10px rgba(0, 0, 0, .5);
}
.wallet-row-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wallet-row-name {
  flex: 1; min-width: 0;
  font-size: 14px; font-weight: 700; letter-spacing: .005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* уголок-шеврон справа: строка читается как «ведёт дальше» */
.wallet-row-go {
  flex: none; width: 7px; height: 7px;
  margin-right: 2px;
  border-right: 1.7px solid rgba(240, 214, 164, 0.42);
  border-top: 1.7px solid rgba(240, 214, 164, 0.42);
  transform: rotate(45deg);
}

.wallet-note {
  margin: 0; padding: 22px 12px;
  text-align: center; line-height: 1.6;
  font-family: var(--font-round);
  font-size: 12px;
  color: rgba(230, 220, 195, 0.62);
}

.wallet-account {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 16px 12px 6px;
  text-align: center;
}
.wallet-account-label {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  font-family: var(--font-round);
  color: rgba(230, 220, 195, 0.55);
}
.wallet-account-addr {
  font-family: 'Forum', 'Palatino Linotype', Georgia, serif;
  font-size: 19px; color: #F7DFAE;
  text-shadow: 0 0 18px rgba(255, 186, 92, .35), 0 1px 2px rgba(0,0,0,.9);
}
.wallet-disconnect {
  margin: 10px 0 4px;
  padding: 10px 0;
  border-radius: 10px;
  border: 1px solid rgba(232, 91, 74, 0.45);
  background: rgba(232, 91, 74, 0.12);
  color: #F0A99C;
  font-family: var(--font-round);
  font-size: 12.5px; font-weight: 700;
  cursor: pointer;
}
.wallet-disconnect:active { transform: scale(.98); }

/* ---------- Друзья: рунная доска приглашений ----------
   Координаты зон замерены по пикселям артборда friends-bg (688x1568):
   прорезь ссылки 170..510 / 318..360, плашка условий (иконка+текст) —
   строка 1 (награда) 478..548, строка 2 (скидка другу) 590..660, иконки
   150..218 по x; две выемки 190..310 и 375..495 / 730..830; прорезь
   кнопки 165..515 / 902..935; доска 155..520 / 1010..1500. */
.friends-overlay {
  position: fixed; inset: 0;
  background: rgba(4, 9, 5, 0.78);
  display: flex;
  align-items: center; justify-content: center;
  z-index: 25;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .28s ease, visibility 0s linear .28s;
}
.friends-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .28s ease, visibility 0s linear 0s;
}

.friends-modal {
  position: relative;
  /* во весь экран: фон растягивается 100% 100% в сам бокс, поэтому
     процентная привязка контента к нишам не зависит от формы бокса —
     можно смело занимать весь вьюпорт без леттербоксинга по бокам */
  width: 100vw;
  height: 100dvh;
  height: 100vh;
  border-radius: 0;
  overflow: hidden;
  transform: scale(.98);
  transition: transform .32s cubic-bezier(.22, 1.12, .32, 1);
  border: none;
  box-shadow: none;
  background-color: #16110a;
  background-image: url("../assets/decor/friends-bg.jpg");
  /* строго по боксу — фон и проценты позиционирования не расходятся */
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;

  /* геометрия вкладки вынесена в переменные — их живьём крутит редактор
     ?editfriends=1 (см. friends-editor.js); значения ниже — дефолты на
     случай, если сохранённых правок в localStorage нет. */
  --fl-link-left: 50.8%; --fl-link-top: 21.6%; --fl-link-width: 50%; --fl-link-height: 2.7%;
  --fl-link-font: 3.5cqw;
  --fl-rule-left: 56.8%; --fl-rule-top: 33.2%; --fl-rule2-top: 39.6%; --fl-rule-width: 40%;
  --fl-rule-font: 2.75cqw;
  --fl-stat-top: 50.5%; --fl-stat1-left: 36.3%; --fl-stat2-left: 64.2%; --fl-stat-width: 9.5%;
  --fl-stat-value-font: 7cqw; --fl-stat-label-font: 2.4cqw;
  --fl-invite-left: 50%; --fl-invite-top: 58.6%; --fl-invite-width: 46%; --fl-invite-height: 2.1%;
  --fl-invite-font: 3.9cqw;
  --fl-board-left: 50%; --fl-board-top: 65%; --fl-board-width: 50%; --fl-board-height: 29.7%;
}
.friends-overlay.open .friends-modal { transform: scale(1); }

.friends-close {
  position: absolute; top: 3.2%; right: 5%; z-index: 3;
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: rgba(10,7,4,0.55);
  color: rgba(243,230,196,.9); font-size: 13px; line-height: 1;
  cursor: pointer;
  transition: transform .12s, color .15s;
}
.friends-close:active { transform: scale(.88); color: #FFF1CE; }

.friends-link,
.friends-stat-value,
.friends-stat-label,
.friends-invite,
.friends-row {
  font-family: var(--font-rune);
  font-weight: 400;
  text-shadow:
    0 -1px 0 rgba(255, 214, 150, .18),
    0 1px 2px rgba(0, 0, 0, .85),
    0 2px 6px rgba(0, 0, 0, .5);
}

/* верхняя прорезь — реферальная ссылка, тап копирует */
.friends-link {
  position: absolute; left: var(--fl-link-left); top: var(--fl-link-top);
  transform: translate(-50%, -50%);
  /* ниша замерена по артборду: x 155..545 из 688 = 22.5%..79.2% —
     отступаем ещё по паре % от резного края с обеих сторон */
  width: var(--fl-link-width); height: var(--fl-link-height);
  border: none; background: none; padding: 0 1%;
  box-sizing: border-box;
  color: var(--ink-gold);
  font-size: var(--fl-link-font);
  letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
  transition: color .15s, text-shadow .15s;
}
.friends-link:active,
.friends-link.copied { color: #FFF1CE; }
.friends-link.copied {
  text-shadow: 0 0 16px rgba(255, 196, 110, .8), 0 1px 2px rgba(0,0,0,.9);
}

/* две строки плашки условий — награда пригласившему / скидка другу.
   Иконка (%/щит) нарисована в артборде слева от плашки, текст кладём
   справа от неё, в резной табличке 250..520 из 688 по x. */
.friends-rule {
  /* ниша замерена по артборду: x 242..525 из 688 = 35.2%..76.3% —
     центр box сдвинут левее и сужен, чтобы у правого края всегда
     оставался запас (прежняя разметка упиралась ровно в резьбу) */
  position: absolute; left: var(--fl-rule-left); top: var(--fl-rule-top);
  transform: translate(-50%, -50%);
  width: var(--fl-rule-width);
  margin: 0;
  font-family: var(--font-rune);
  font-weight: 400;
  color: var(--ink-gold);
  font-size: var(--fl-rule-font);
  line-height: 1.32;
  text-align: left;
  overflow-wrap: break-word;
  text-shadow:
    0 -1px 0 rgba(255, 214, 150, .18),
    0 1px 2px rgba(0, 0, 0, .85),
    0 2px 6px rgba(0, 0, 0, .5);
}
.friends-rule b {
  color: #FFEAC0;
  font-weight: 700;
}
.friends-rule-discount { top: var(--fl-rule2-top); }

/* две квадратные выемки — счётчики. Ниша замерена по артборду ~18.5%
   шириной — берём почти всю её, но значение всё равно может стать
   длиннее ниши (3+ цифры друзей, "999.9K" заработано), поэтому сама
   цифра ужимается по ширине через clamp с шириной в ch (см. JS-хелпер
   fitStatValue в render.js, который считает scrollWidth и уменьшает
   font-size, если цифра не влезает). */
.friends-stat {
  position: absolute; top: var(--fl-stat-top);
  transform: translate(-50%, -50%);
  width: var(--fl-stat-width);
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
.friends-stat-1 { left: var(--fl-stat1-left); }
.friends-stat-2 { left: var(--fl-stat2-left); }
.friends-stat-value {
  display: inline-block;
  max-width: 100%;
  font-size: var(--fl-stat-value-font);
  color: #F7DFAE;
  text-shadow: 0 0 18px rgba(255, 186, 92, .4), 0 1px 2px rgba(0,0,0,.9);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}
.friends-stat-label {
  margin-top: 0.5em;
  font-size: var(--fl-stat-label-font);
  color: var(--ink-bronze);
  letter-spacing: .1em; text-indent: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* тонкая прорезь под выемками — кнопка приглашения */
.friends-invite {
  position: absolute; left: var(--fl-invite-left); top: var(--fl-invite-top);
  transform: translate(-50%, -50%);
  width: var(--fl-invite-width); height: var(--fl-invite-height);
  border: none; background: none; padding: 0;
  color: #F6E3B8;
  font-size: var(--fl-invite-font);
  letter-spacing: .06em;
  cursor: pointer;
  transition: color .15s, text-shadow .15s;
}
.friends-invite:active {
  color: #FFF1CE;
  text-shadow: 0 0 16px rgba(255, 196, 110, .75), 0 1px 2px rgba(0,0,0,.9);
}

/* большая доска — список друзей; строка = две нарисованные линейки
   разлиновки (62px артборда), поэтому текст садится ровно по резьбе */
.friends-board {
  position: absolute; left: var(--fl-board-left); top: var(--fl-board-top);
  transform: translate(-50%, 0);
  /* резная ниша на артборде — x 155..520 из 688 (22.5%..75.6%, ширина
     53.1%); отступаем от её краёв ещё по ~3%, иначе буквы садятся прямо
     на раму */
  width: var(--fl-board-width); height: var(--fl-board-height);
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.friends-board::-webkit-scrollbar { display: none; }

.friends-row {
  height: 10.6cqw;
  display: flex; align-items: center; gap: 0.5em;
  color: rgba(238, 222, 190, 0.92);
  font-size: 13px; font-size: 3.6cqw;
}
.friends-row-name {
  flex: none; max-width: 36%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.friends-row-tree {
  flex: 1; min-width: 0;
  color: var(--ink-bronze);
  font-size: 0.82em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.friends-row-sum {
  flex: none;
  color: var(--ink-gold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.friends-empty {
  padding-top: 12%;
  text-align: center;
  font-family: var(--font-rune);
  font-size: 11px; font-size: 3.0cqw;
  line-height: 1.7;
  color: var(--ink-bronze);
  text-shadow: 0 1px 2px rgba(0,0,0,.85);
}

/* ---------- Алтарь: физический объект в сцене, вкопан в грязевое пятно слева ---------- */
/* Было 18vw/84px — на фоне ряда деревьев (24vw/112px) алтарь читался
   мелкой игрушкой, отдельной от масштаба сцены. Поднял ближе к дереву
   переднего плана, не сравнивая с ним: алтарь ниже дерева по смыслу
   (по колено), но должен быть весомым камнем, а не сувениром. */
.altar-prop {
  position: absolute;
  transform: translate(-50%, 0);
  width: 23vw;
  height: 23vw;
  max-width: 108px;
  max-height: 108px;
  z-index: 4;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Тень в два слоя, как у деревьев (.contact-shadow): плотное пятно
   контакта под самим основанием + широкий мягкий ореол вокруг. Один
   плоский эллипс раньше читался как подложенный под картинку кружок,
   а не как тень от объёма камня. */
.altar-contact-shadow {
  position: absolute;
  left: 50%; bottom: 0%;
  width: 98%; height: 26%;
  transform: translate(-50%, 0);
  border-radius: 50%;
  background:
    radial-gradient(ellipse 32% 42% at 50% 60%, rgba(2,6,2,.75), rgba(2,6,2,0) 100%),
    radial-gradient(ellipse 60% 55% at 50% 52%, rgba(4,10,4,.4), rgba(4,10,4,0) 100%);
  filter: blur(3px);
  z-index: 0;
  pointer-events: none;
}
/* трава, наползающая на нижний камень постамента — прячет ровный срез
   низа PNG, из-за которого алтарь выглядел не вросшим в землю, а
   поставленным на неё сверху */
.altar-contact-shadow::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 14%;
  width: 58%; height: 48%;
  transform: translate(-50%, 0);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 45%, rgba(44, 80, 33, .5), rgba(44, 80, 33, 0) 72%);
  filter: blur(2px);
}

.altar-img {
  position: absolute;
  left: 50%; bottom: 6%;
  width: 92%;
  transform: translate(-50%, 0);
  transform-origin: 50% 100%;
  object-fit: contain;
  /* лёгкое размытие снимает резкий "вырезанный" контур спрайта, которого
     нет у нарисованного фона, плюс приглушаем цвет под тёмный угол сцены —
     та же тональность, что у деревьев (saturate/brightness/hue-rotate),
     чтобы камень не светился холоднее травы вокруг */
  image-rendering: -webkit-optimize-contrast;
  filter:
    drop-shadow(0 3px 3px rgba(0,0,0,.5))
    drop-shadow(0 10px 8px rgba(0,0,0,.4))
    saturate(.62) brightness(.72) hue-rotate(-8deg) contrast(1.03);
  transition: filter .7s ease, transform .16s cubic-bezier(.3, .9, .4, 1.4);
  pointer-events: none;
  z-index: 1;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
/* палец лёг на алтарь — камень чуть "приседает", тот же приём, что и у
   деревьев; :active сам поднимается по цепочке предков от ritual-well */
.altar-prop:active .altar-img { transform: translate(-50%, 0) scale(.96); }
/* руны и вода на артборде "загораются" общим светом поверх картинки —
   точечной маски под каждую руну нет, читается как пробуждение алтаря */
.altar-prop.charged .altar-img {
  filter:
    drop-shadow(0 3px 3px rgba(0,0,0,.5))
    drop-shadow(0 10px 8px rgba(0,0,0,.4))
    saturate(.9) brightness(.82) hue-rotate(-5deg) contrast(1.03)
    drop-shadow(0 0 10px rgba(120,215,255,.55)) drop-shadow(0 0 20px rgba(90,195,255,.3));
}

.altar-blend-mask {
  position: absolute;
  left: 50%; bottom: 4%;
  width: 76%; height: 46%;
  transform: translate(-50%, 0);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(10,22,10,0.4) 0%, rgba(10,22,10,0.18) 55%, transparent 78%);
  mix-blend-mode: multiply;
  z-index: 2;
  pointer-events: none;
}

/* radial-gradient(circle, …) в приплюснутом боксе (46%×20%) рисовал
   геометрически круглое пятно света в эллиптической (по изометрии) чаше
   — несовпадение формы и было тем самым «наклеенным бликом». ellipse
   вместо circle заставляет сам градиент повторять пропорции бокса. */
.altar-basin-glow {
  position: absolute;
  left: 50%; top: 25%;
  width: 44%; height: 17%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(150,225,255,.8), rgba(90,190,255,.22) 58%, rgba(90,190,255,0) 78%);
  opacity: 0;
  filter: blur(2.5px);
  transition: opacity 0.7s ease;
  z-index: 2;
  pointer-events: none;
}
.altar-prop.charged .altar-basin-glow {
  opacity: 0.85;
  animation: basinPulse 2.6s ease-in-out infinite;
}
@keyframes basinPulse {
  0%, 100% { opacity: 0.65; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  .altar-prop.charged .altar-basin-glow { animation: none; }
}

/* руны на переднем поясе и по бокам постамента — светятся вместе с чашей,
   пока доступен полив; в состоянии покоя просто не видны на камне */
.altar-rune-band {
  position: absolute;
  left: 50%; top: 47%;
  width: 78%; height: 9%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(130,220,255,.6), rgba(90,190,255,.18) 55%, rgba(90,190,255,0) 78%);
  opacity: 0;
  filter: blur(1.5px);
  transition: opacity 0.7s ease;
  z-index: 2;
  pointer-events: none;
}
.altar-side-glow {
  position: absolute;
  top: 60%;
  width: 18%; height: 16%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(130,220,255,.55), rgba(90,190,255,0) 75%);
  opacity: 0;
  filter: blur(2px);
  transition: opacity 0.7s ease;
  z-index: 2;
  pointer-events: none;
}
.altar-side-glow.left { left: 10%; }
.altar-side-glow.right { right: 10%; }
.altar-prop.charged .altar-rune-band,
.altar-prop.charged .altar-side-glow {
  opacity: 0.8;
  animation: basinPulse 2.6s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .altar-prop.charged .altar-rune-band,
  .altar-prop.charged .altar-side-glow { animation: none; }
}

.altar-toast {
  position: absolute;
  left: 50%; bottom: 100%;
  transform: translate(-50%, 8px);
  margin-bottom: 8px;
  width: max-content;
  max-width: 34vw;
  min-width: 120px;
  padding: 7px 11px;
  border-radius: 12px;
  background: rgba(8, 16, 11, 0.88);
  border: 1px solid rgba(160, 220, 150, 0.2);
  color: #F0EBD2;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 5;
}
.altar-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.altar-prop.denied .altar-img {
  animation: altarShake .4s ease;
}
@keyframes altarShake {
  0%, 100% { transform: translate(-50%, 0); }
  25% { transform: translate(calc(-50% - 5px), 0); }
  75% { transform: translate(calc(-50% + 5px), 0); }
}
@media (prefers-reduced-motion: reduce) {
  .altar-prop.denied .altar-img { animation: none; }
}

/* базовые стили самой кнопки-колодца (переиспользуются внутри .altar-prop) */
.ritual-well {
  position: absolute;
  width: 44%; height: 44%;
  z-index: 3;
  border: none;
  border-radius: 50%;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.ritual-ring {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  transform: rotate(-90deg);
}
.ritual-ring-bg, .ritual-ring-fill {
  fill: none;
  stroke-width: 5;
}
.ritual-ring-bg { stroke: rgba(255,255,255,0.12); }
/* на алтаре в сцене кольцо-подсказка не должно быть видно в состоянии
   покоя — иначе читается как UI-кружок поверх картинки, а не часть сцены */
.altar-prop .ritual-ring-bg { stroke: transparent; }
.altar-prop .ritual-well.charging .ritual-ring-bg,
.altar-prop .ritual-well.cancelling .ritual-ring-bg { stroke: rgba(255,255,255,0.16); }
.ritual-ring-fill {
  stroke: #7FD4FF;
  stroke-linecap: round;
  stroke-dasharray: 276.5;
  stroke-dashoffset: 276.5;
  filter: drop-shadow(0 0 4px rgba(127, 212, 255, 0.7));
}
.ritual-well.charging .ritual-ring-fill {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset var(--charge-ms, 1300ms) linear;
}
.ritual-well.cancelling .ritual-ring-fill {
  transition: stroke-dashoffset 0.35s ease-out;
}
.ritual-glow {
  position: absolute;
  width: 60%; height: 60%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(127,212,255,0.35), rgba(127,212,255,0) 70%);
  opacity: 0.3;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.ritual-well.charging .ritual-glow {
  opacity: 1;
  transform: scale(1.25);
  transition: opacity var(--charge-ms, 1300ms) linear, transform var(--charge-ms, 1300ms) linear;
}
.ritual-icon {
  position: relative;
  width: 26px; height: 26px;
  filter: drop-shadow(0 0 3px rgba(127,212,255,0.5));
}
.ritual-well.released .ritual-glow {
  animation: ritualBurst 0.6s ease-out;
}
@keyframes ritualBurst {
  0%   { opacity: 1; transform: scale(1.25); }
  40%  { opacity: 1; transform: scale(2.4); }
  100% { opacity: 0; transform: scale(3.2); }
}

.altar-prop .ritual-glow { opacity: 0; }
.altar-prop .ritual-well.charging .ritual-glow { opacity: 1; }

.altar-prop .ritual-well {
  left: 50%; bottom: auto; top: 30%;
  z-index: 3;
  transform: translate(-50%, -50%);
}
.altar-prop .ritual-well:active { transform: translate(-50%, -50%) scale(0.9); }
.altar-prop .ritual-well.charging { transform: translate(-50%, -50%); }

@media (prefers-reduced-motion: reduce) {
  .ritual-well.charging .ritual-ring-fill,
  .ritual-well.charging .ritual-glow,
  .ritual-well.released .ritual-glow {
    transition: none; animation: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .plot.planting .contact-shadow,
  .plot.planting .tree-img-wrap,
  .plot.planting .plant-flash,
  .plot.planting .burst-particle { animation: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .popup-overlay, .shop-overlay, .cabinet-overlay, .friends-overlay, .wallet-overlay,
  .popup, .shop-modal, .cabinet-modal, .friends-modal, .wallet-sheet {
    transition: none !important;
  }
  .popup, .shop-modal, .cabinet-modal, .friends-modal, .wallet-sheet {
    transform: none !important;
  }
}

/* ---------- «Добыча»: рубим лианы топором, чтобы освободить дерево ---------- */
/* «Добыча» открывается на весь экран (не карточкой по центру) — сцена с
   деревом получает максимум места */
/* ---------- Видео-интро «Добычи»: короткая сцена перед рубкой ---------- */
.extract-intro-overlay {
  position: fixed; inset: 0;
  background: #000;
  display: flex;
  align-items: center; justify-content: center;
  z-index: 31;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  /* та же длительность, что у .extract-overlay — оба угасают/проявляются
     синхронно, крест-накрест, вместо жёсткой склейки кадров */
  transition: opacity .5s ease, visibility 0s linear .5s;
}
.extract-intro-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .5s ease, visibility 0s linear 0s;
}
.extract-intro-video {
  width: 100%; height: 100%;
  object-fit: cover;
  cursor: pointer;
}
.extract-intro-skip {
  position: absolute; right: 14px; bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 2;
  padding: 8px 14px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(8, 7, 5, 0.5);
  color: rgba(243, 230, 196, 0.9);
  font-family: var(--font-round);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
}
.extract-intro-skip:active { color: #FFF1CE; border-color: rgba(240, 204, 132, .5); }

.extract-overlay {
  position: fixed; inset: 0;
  background: rgba(4, 9, 5, 0.82);
  display: flex;
  align-items: stretch; justify-content: stretch;
  z-index: 30;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .5s ease, visibility 0s linear .5s;
}
.extract-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .5s ease, visibility 0s linear 0s;
}

/* Никакого отдельного scale/opacity-попа у самой модалки — сцену и так
   выводит на экран плавный fade .extract-overlay (см. выше), совпадающий
   по длительности с угасанием .extract-intro-overlay: две прозрачности
   крест-накрест дают единый кросс-фейд, а не наплыв + отдельный «попап». */
.extract-modal {
  position: relative;
  width: 100%; height: 100%; height: 100dvh;
  display: flex; flex-direction: column;
  overflow: hidden;
  border-radius: 0;
  background: #0A0907;
}

.extract-close {
  position: absolute; top: 13px; right: 13px; z-index: 5;
  width: 29px; height: 29px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 7, 5, 0.5);
  color: rgba(243,230,196,.85); font-size: 13px; line-height: 1;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.extract-close:active { color: #FFF1CE; border-color: rgba(240, 204, 132, .5); }

.extract-title {
  position: absolute; left: 18px; top: 15px; z-index: 3;
  margin: 0; right: 46px;
  font-family: var(--font-rune, 'Forum', 'Palatino Linotype', Georgia, serif);
  font-weight: 400; font-size: 18px; color: #F3E6C4;
  text-shadow: 0 1px 3px rgba(0,0,0,.9), 0 2px 10px rgba(0,0,0,.6);
}

/* сцена — ночной сад, тот же задник, что и на грядках, но затемнённый
   under a night wash, чтобы светлячки читались как источник света */
.extract-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.extract-bg-layer {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
}
/* Нижний слой — чистая кора без светлячка, видна всегда. Верхний слой —
   точный стоп-кадр extract-intro.mp4 (с тем же жуком в кольце, что и в
   ролике), лежит поверх и первые секунды скрывает нижний целиком, поэтому
   в момент склейки видео → геймплей картинка не меняется НИ ПИКСЕЛЕМ. Он
   плавно растворяется (см. .faded) только после того, как первый
   светлячок пойман/улетел — то есть уже после того, как внимание игрока
   переключилось, а не в момент самого перехода. */
.extract-bg-clean { background-image: url("../assets/decor/extract-bg-bark.jpg?v=1"); }
.extract-bg-intro {
  background-image: url("../assets/decor/extract-bg-bark-intro.jpg?v=1");
  opacity: 1;
  transition: opacity 1.1s ease;
}
.extract-bg-intro.faded { opacity: 0; }
/* лёгкая виньетка по краям коры — кадр уже тёмный сам по себе (это стоп-кадр
   ролика extract-intro.mp4), плотная ночная дымка тут ни к чему */
/* Виньетки по краям НЕТ специально — в видео её тоже нет, а любое CSS-
   затемнение поверх статичного кадра, которого не было в самом ролике,
   в момент кросс-фейда читается как резкий скачок насыщенности/яркости. */
/* мягкий переход от сцены к панели снизу, чтобы стык не резал глаз */
.extract-stage::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 13%;
  background: linear-gradient(180deg, rgba(10,9,7,0) 0%, rgba(10,9,7,.8) 70%, #0A0907 100%);
  pointer-events: none;
}

/* Светлячок для поимки — тёплое пятно света с мягким ореолом, крупнее и
   заметнее фоновых декоративных .firefly, чтобы тап пальцем не мазал. */
/* Обёртка — тёплое кольцо-ореол (как на коре в extract-intro.mp4) с
   настоящим рисованным светлячком (firefly-bug.png) поверх, вместо
   плоского CSS-градиента без деталей. */
.catch-firefly {
  position: absolute;
  width: 150px; height: 150px;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  opacity: 0;
  z-index: 2;
}
.catch-firefly::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 225, 170, .32) 0%, rgba(255, 190, 100, .16) 48%, rgba(255, 180, 90, 0) 72%);
}
.catch-firefly::after {
  content: "";
  position: absolute; inset: 14%;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 200, 120, .65);
  box-shadow: 0 0 10px rgba(255, 190, 110, .5);
}
.catch-firefly img {
  position: relative;
  width: 68%; height: auto;
  z-index: 1;
  filter: drop-shadow(0 0 3px rgba(120, 70, 10, .35));
}
.catch-firefly.active {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
  animation: fireflyGlow 1s ease-in-out infinite, fireflyAppear .22s ease-out;
}
/* Первый светлячок после интро: сам рисунок уже есть на .extract-bg-intro
   (тот самый кадр видео), поэтому спрайт здесь — просто невидимая зона
   тапа поверх него, без своей анимации появления/мерцания, которая иначе
   спорила бы с картинкой фона и выдавала стык. */
.catch-firefly.active.ghost {
  opacity: 0;
  animation: none;
}
@keyframes fireflyAppear {
  0%   { transform: translate(-50%, -50%) scale(.3); }
  100% { transform: translate(-50%, -50%) scale(1); }
}
@keyframes fireflyGlow {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(255, 205, 120, .8)); transform: translate(-50%, -50%) scale(.92); }
  50%      { filter: drop-shadow(0 0 14px rgba(255, 225, 160, 1)); transform: translate(-50%, -50%) scale(1.08); }
}
.catch-firefly.caught {
  opacity: 1;
  pointer-events: none;
  animation: fireflyCaught .4s ease-out forwards;
}
@keyframes fireflyCaught {
  0%   { transform: translate(-50%, -50%) scale(1); }
  40%  { transform: translate(-50%, -50%) scale(1.7); }
  100% { transform: translate(-50%, -50%) scale(2.6); opacity: 0; }
}
.catch-firefly.escaping {
  opacity: 1;
  pointer-events: none;
  animation: fireflyEscape .26s ease-in forwards;
}
/* Первый (ghost) светлячок остаётся невидимым и когда его ловят/он улетает
   — сам рисунок для него не спрайт, а .extract-bg-intro, растворяющийся
   отдельно и медленнее (см. spawnFirefly), не эта короткая CSS-анимация. */
.catch-firefly.caught.ghost,
.catch-firefly.escaping.ghost {
  opacity: 0;
  animation: none;
}
@keyframes fireflyEscape {
  0%   { transform: translate(-50%, -50%) scale(1); }
  100% { transform: translate(-50%, -50%) scale(.2); opacity: 0; }
}

.extract-stage.hit-shake { animation: extractShake .22s ease; }
.extract-stage.hit-shake-crit { animation: extractShake .28s ease; }
@keyframes extractShake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-4px, 1px); }
  50% { transform: translate(4px, -1px); }
  75% { transform: translate(-2px, 0); }
}

.extract-tap-hint {
  /* фикс. отступ, а не %, — плавающая .extract-panel теперь занимает
     нижние ~130px сцены поверх неё (см. .extract-panel), подсказка должна
     стоять выше этой полосы независимо от высоты экрана */
  position: absolute; left: 0; right: 0; bottom: 140px; z-index: 2;
  margin: 0; text-align: center;
  font-family: var(--font-round);
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: rgba(255, 230, 190, 0.75);
  text-shadow: 0 1px 3px rgba(0,0,0,.9);
  pointer-events: none;
}

.extract-spark { z-index: 2; }

/* Плавающая панель поверх сцены (не в потоке flex), а не блок под ней —
   так .extract-stage растягивается на всю высоту модалки, кадр совпадает
   с полноэкранным видео 1:1, и склейка не «прыгает» масштабом. Фон под
   текстом даёт свой градиент-подложку, .extract-stage::after больше не
   единственная защита читаемости. */
.extract-panel {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  padding: 14px 20px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(10,9,7,0) 0%, rgba(10,9,7,.55) 35%, rgba(10,9,7,.92) 75%, #0A0907 100%);
}
.extract-progress-label {
  margin: 0 0 6px; font-size: 11px; color: rgba(230, 220, 195, 0.65);
  text-align: center;
}
.extract-modal .progress-track {
  background: rgba(0,0,0,0.35); border-radius: 99px; height: 7px;
  overflow: hidden; margin: 0 0 16px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.5);
}
.extract-modal .progress-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #7ED447, #58B32C);
  transition: width .25s ease;
}

.extract-daily-label {
  margin: 0 0 6px; font-size: 11px; color: rgba(230, 220, 195, 0.65);
  text-align: center;
}
.extract-daily-track { margin-bottom: 6px; }
.extract-daily-fill {
  background: linear-gradient(90deg, #FFCE6E, #E8A93F);
}

.extract-daily-timer {
  margin: 0; text-align: center; min-height: 13px;
  font-size: 10.5px; color: rgba(230, 220, 195, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  .extract-stage.hit-shake, .extract-stage.hit-shake-crit { animation: none !important; }
  .catch-firefly.active { animation: none !important; opacity: 1 !important; }
  .catch-firefly.active.ghost { opacity: 0 !important; }
  .extract-bg-intro { transition: none !important; }
  .catch-firefly.caught, .catch-firefly.escaping { animation: none !important; opacity: 0 !important; }
  .extract-overlay, .extract-modal { transition: none !important; }
  .extract-modal { transform: none !important; }
}

/* ---------- Режим расстановки деревьев (?edit=1, см. editor.js) ---------- */
.plots-editing .plot {
  cursor: grab;
  touch-action: none; /* иначе браузер сам скроллит сцену вместо drag */
}
.plots-editing .plot:active { cursor: grabbing; }
.plots-editing .plot-selected .tree-img-wrap {
  outline: 2px dashed rgba(255, 214, 120, .85);
  outline-offset: 6px;
  border-radius: 8px;
}
.plots-editing .status-pill { opacity: 1 !important; }

.plot-editor {
  position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 999;
  background: rgba(10, 9, 7, 0.92);
  border: 1px solid rgba(214, 176, 104, 0.35);
  border-radius: 14px;
  font-family: var(--font-round, sans-serif);
  color: #F0EBD2;
  box-shadow: 0 10px 30px rgba(0,0,0,.6);
}
/* по умолчанию свёрнута до одной строки-шапки — раньше разложенная
   панель перекрывала нижний ряд грядок, и тащить их было некуда */
.plot-editor-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  width: 100%; box-sizing: border-box;
  padding: 12px 14px;
  border: none; background: none; color: inherit;
  font-size: 13px; font-weight: 700;
  cursor: pointer;
}
.plot-editor-toggle-icon {
  color: rgba(230,220,195,.55);
  transition: transform .2s ease;
}
.plot-editor-collapsed .plot-editor-toggle-icon { transform: rotate(180deg); }
.plot-editor-body {
  overflow: hidden;
  max-height: 60vh;
  padding: 0 12px calc(10px + env(safe-area-inset-bottom, 0px));
  transition: max-height .2s ease, padding .2s ease;
}
.plot-editor-collapsed .plot-editor-body {
  max-height: 0;
  padding-top: 0; padding-bottom: 0;
}
.plot-editor-hint { font-size: 11px; color: rgba(230,220,195,.55); }
.plot-editor-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 6px; font-size: 12px;
}
.plot-editor-size { display: flex; align-items: center; gap: 6px; }
.plot-editor-size button {
  width: 26px; height: 26px; border-radius: 8px;
  border: 1px solid rgba(214,176,104,.4); background: rgba(255,255,255,.04);
  color: #F0EBD2; font-size: 15px; line-height: 1; cursor: pointer;
}
.plot-editor-size button:active { background: rgba(255,255,255,.1); }
.plot-editor textarea {
  width: 100%; box-sizing: border-box;
  background: rgba(0,0,0,.35); border: 1px solid rgba(214,176,104,.25);
  border-radius: 8px; color: #D8CBA8; font-family: monospace; font-size: 11px;
  padding: 6px; margin-bottom: 6px; resize: none;
}
.plot-editor-row button:not(.plot-editor-size button) {
  flex: 1; padding: 9px; border-radius: 10px;
  border: 1px solid rgba(214,176,104,.4); background: rgba(255,255,255,.04);
  color: #F0EBD2; font-weight: 700; font-size: 12px; cursor: pointer;
}
.plot-editor-row button:active { background: rgba(255,255,255,.1); }

/* ---------- Редактор карточки дерева (?editpopup=1) ---------- */
body.pi-editing .popup-info-thumb,
body.pi-editing .popup-info-name,
body.pi-editing .popup-info-row,
body.pi-editing .popup-info-close-btn {
  cursor: grab;
  touch-action: none; /* иначе браузер скроллит сцену вместо drag */
}
body.pi-editing .popup-info-thumb:active,
body.pi-editing .popup-info-name:active,
body.pi-editing .popup-info-row:active,
body.pi-editing .popup-info-close-btn:active {
  cursor: grabbing;
}
.pie-outline {
  outline: 2px dashed rgba(255, 214, 120, .9);
  outline-offset: 3px;
}
.pie-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pie-tabs button {
  padding: 6px 10px; border-radius: 8px;
  border: 1px solid rgba(214,176,104,.4); background: rgba(255,255,255,.04);
  color: #F0EBD2; font-size: 11px; cursor: pointer;
}
.pie-tabs button.pie-tab-active { background: rgba(255,214,120,.25); border-color: rgba(255,214,120,.7); }
.pie-controls { margin-bottom: 8px; }
.pie-stepper-row .pie-val { min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Экран загрузки ---------- */
/* Резной рунный портал с лучом света (preloader-bg.jpg) — дерево,
   заголовок и бар сидят прямо в луче и на тропе арки. */
.preloader {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: #0b0705;
  overflow: hidden;
  transition: opacity .7s ease;
}
.preloader.hide {
  opacity: 0;
  pointer-events: none;
}
.preloader-bg {
  position: absolute; inset: -4%;
  background: url("../assets/decor/preloader-bg.jpg?v=1") center / cover no-repeat;
  transform: scale(1.02);
}
.preloader-beam {
  position: absolute; inset: 0;
  background: radial-gradient(60% 46% at 50% 40%, rgba(255, 224, 160, .16) 0%, rgba(255, 224, 160, 0) 68%);
  animation: preloaderBeamPulse 3.6s ease-in-out infinite;
  mix-blend-mode: screen;
}
@keyframes preloaderBeamPulse {
  0%, 100% { opacity: .7; }
  50%      { opacity: 1; }
}
.preloader-fireflies { position: absolute; inset: 0; z-index: 1; }

.preloader-body {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  padding: 0 32px;
  text-align: center;
}

.preloader-title {
  margin: 0;
  font-family: var(--font-rune, 'Yeseva One', 'Forum', Georgia, serif);
  font-weight: 400;
  font-size: 29px;
  letter-spacing: .07em;
  color: #F7DFAE;
  text-shadow:
    0 0 24px rgba(255, 186, 92, .5),
    0 -1px 0 rgba(255,214,150,.2),
    0 2px 3px rgba(0,0,0,.9);
  animation: preloaderTitleGlow 2.6s ease-in-out infinite;
}
@keyframes preloaderTitleGlow {
  0%, 100% {
    text-shadow:
      0 0 24px rgba(255, 186, 92, .5),
      0 -1px 0 rgba(255,214,150,.2),
      0 2px 3px rgba(0,0,0,.9);
  }
  50% {
    text-shadow:
      0 0 34px rgba(255, 200, 120, .75),
      0 -1px 0 rgba(255,214,150,.25),
      0 2px 3px rgba(0,0,0,.9);
  }
}
.preloader-rune-rule {
  width: 128px; height: 1px; margin: 10px 0;
  background: linear-gradient(90deg,
    rgba(214, 176, 104, 0), rgba(240, 204, 132, .65) 22%,
    rgba(240, 204, 132, .65) 78%, rgba(214, 176, 104, 0));
}
.preloader-subtitle {
  margin: 0 0 20px;
  font-family: var(--font-round);
  font-size: 12.5px; font-weight: 600;
  color: rgba(224, 205, 165, 0.78);
  letter-spacing: .02em;
  min-height: 16px;
  text-shadow: 0 1px 3px rgba(0,0,0,.7);
  transition: opacity .3s ease;
}

.preloader-bar-track {
  position: relative;
  width: min(210px, 60vw);
  height: 13px;
  border-radius: 99px;
  background: linear-gradient(180deg, var(--wood-2, #A9713F), #6E4526);
  border: 2px solid var(--wood-stroke, #7A4B24);
  overflow: hidden;
  box-shadow: inset 0 2px 3px rgba(0,0,0,.45), 0 3px 0 rgba(0,0,0,.3);
}
.preloader-bar-fill {
  position: absolute; inset: 2px; right: auto;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(180deg, var(--gold-1, #FFD34D), var(--gold-2, #E8A21D));
  box-shadow: 0 0 10px rgba(255, 200, 100, .6), inset 0 1px 0 rgba(255,255,255,.5);
  transition: width .35s ease-out;
}
.preloader-bar-fill::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.6), rgba(255,255,255,0));
  width: 36%;
  animation: preloaderShimmer 1.4s linear infinite;
}
@keyframes preloaderShimmer {
  0%   { transform: translateX(-140%); }
  100% { transform: translateX(360%); }
}
.preloader-pct {
  display: block;
  margin-top: 9px;
  font-family: var(--font-round);
  font-variant-numeric: tabular-nums;
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em;
  color: rgba(224, 205, 165, 0.6);
  text-shadow: 0 1px 3px rgba(0,0,0,.7);
}

@media (prefers-reduced-motion: reduce) {
  .preloader-beam, .preloader-title, .preloader-bar-fill::after {
    animation: none !important;
  }
}
#peReset { color: #E6A9A0; }

/* ---------- Переключатель островов: зажимаешь сцену — она "отдаляется"
   и открывается горизонтальная лента островов. Пока доступен только
   остров №1, остальные — заглушки "Скоро" со своим фоном/темой позже. ---------- */

/* лёгкое "приседание" сцены в момент, когда палец ещё держит экран, но
   таймер долгого нажатия уже тикает — даёт понять, что что-то происходит,
   до того как откроется лента (иначе жест ощущается «глухим») */
.scene.scene-holding {
  transform: scale(0.985);
  filter: brightness(0.94);
  transition: transform .5s cubic-bezier(.2,.8,.3,1), filter .5s ease;
}
.scene {
  transition: transform .22s ease, filter .22s ease;
}

.island-switcher-overlay {
  position: fixed; inset: 0;
  background: rgba(3, 7, 4, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
  z-index: 30;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .3s ease, visibility 0s linear .3s;
}
.island-switcher-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .3s ease, visibility 0s linear 0s;
}

.island-switcher-hint {
  margin: 0;
  font-family: var(--font-round);
  font-size: 13px; font-weight: 700;
  letter-spacing: .02em;
  color: rgba(240, 235, 210, 0.85);
  text-shadow: 0 2px 6px rgba(0,0,0,.6);
  transform: translateY(8px);
  opacity: 0;
  transition: transform .32s ease .05s, opacity .32s ease .05s;
}
.island-switcher-overlay.open .island-switcher-hint {
  transform: translateY(0);
  opacity: 1;
}

.island-track {
  display: flex;
  gap: 16px;
  padding: 4px 32px;
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.island-track::-webkit-scrollbar { display: none; }

.island-card {
  position: relative;
  flex: none;
  width: min(62vw, 240px);
  aspect-ratio: 9 / 16;
  border-radius: 22px;
  overflow: hidden;
  scroll-snap-align: center;
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(180, 150, 90, 0.28);
  box-shadow: 0 18px 40px rgba(0,0,0,.55);
  cursor: pointer;
  transform: scale(.94);
  opacity: .55;
  transition: transform .28s cubic-bezier(.22,1.12,.32,1), opacity .28s ease, filter .28s ease;
}
/* карточка по центру ленты читается "выбранной" — крупнее и ярче соседей,
   как активный слайд в сторис-подобной карусели */
.island-card.centered {
  transform: scale(1);
  opacity: 1;
}
.island-switcher-overlay.open .island-card {
  animation: islandCardIn .38s cubic-bezier(.22,1.12,.32,1) backwards;
}
@keyframes islandCardIn {
  from { transform: scale(.94) translateY(18px); opacity: 0; }
}

.island-card-label {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 10px 12px 12px;
  background: linear-gradient(0deg, rgba(4,9,5,.88), rgba(4,9,5,0));
  font-family: var(--font-round);
}
.island-card-name {
  margin: 0;
  font-size: 14px; font-weight: 800;
  color: #F3E6C4;
  text-shadow: 0 2px 6px rgba(0,0,0,.7);
}
.island-card-sub {
  margin: 2px 0 0;
  font-size: 10.5px; font-weight: 600;
  color: rgba(230, 220, 195, 0.72);
}

.island-card.locked {
  background-color: #1a1712;
  filter: grayscale(0.55) brightness(0.55);
}
.island-card.locked:active { filter: grayscale(0.55) brightness(0.42); }
.island-card-lock {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  z-index: 1;
}
.island-card-lock svg {
  width: 30px; height: 30px;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.6));
}
.island-card-soon {
  position: absolute; top: 10px; right: 10px;
  padding: 3px 9px;
  border-radius: 99px;
  background: rgba(8, 7, 5, 0.7);
  border: 1px solid rgba(214, 176, 104, 0.3);
  font-family: var(--font-round);
  font-size: 9.5px; font-weight: 800;
  letter-spacing: .04em;
  color: #FFD27A;
}

.island-card.active-island::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 22px;
  box-shadow: inset 0 0 0 2px rgba(127, 212, 255, 0.7);
  pointer-events: none;
}

.island-switcher-close {
  position: absolute; top: max(16px, env(safe-area-inset-top)); right: 16px;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid rgba(214, 176, 104, 0.3);
  background: rgba(8, 7, 5, 0.65);
  color: rgba(243,230,196,.9); font-size: 14px; line-height: 1;
  cursor: pointer;
  transition: transform .12s, color .15s;
}
.island-switcher-close:active { transform: scale(.88); color: #FFF1CE; }

@media (prefers-reduced-motion: reduce) {
  .scene, .scene.scene-holding, .island-card {
    transition: none !important;
    animation: none !important;
  }
}

.island-card.denied {
  animation: islandDeny .4s ease;
}
@keyframes islandDeny {
  0%, 100% { filter: grayscale(0.55) brightness(0.55); }
  30%, 70% { filter: grayscale(0.3) brightness(0.75) saturate(1.3); }
}
@media (prefers-reduced-motion: reduce) {
  .island-card.denied { animation: none !important; }
}

/* ---------- Обязательный онбординг для новых игроков: тёмная маска с
   "окном" на нужном элементе + подсказка со стрелкой. Пока шаг не
   выполнен, тапнуть можно только по подсвеченному элементу — остальное
   перекрыто маской. Проходится один раз, дальше не показывается. ---------- */
.onboard-mask {
  position: fixed; inset: 0;
  z-index: 60;
  background: rgba(3, 7, 4, 0.74);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .3s ease, visibility 0s linear .3s, clip-path .32s cubic-bezier(.22,1.12,.32,1);
}
.onboard-mask.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .3s ease, visibility 0s linear 0s, clip-path .32s cubic-bezier(.22,1.12,.32,1);
}

.onboard-ring {
  position: fixed;
  z-index: 61;
  border-radius: 16px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  box-shadow: 0 0 0 3px rgba(255, 210, 130, 0.95), 0 0 26px 6px rgba(255, 210, 130, 0.5);
  transition: top .32s cubic-bezier(.22,1.12,.32,1), left .32s cubic-bezier(.22,1.12,.32,1),
              width .32s cubic-bezier(.22,1.12,.32,1), height .32s cubic-bezier(.22,1.12,.32,1),
              opacity .2s ease, visibility 0s linear .2s;
}
.onboard-ring.show {
  opacity: 1;
  visibility: visible;
  transition: top .32s cubic-bezier(.22,1.12,.32,1), left .32s cubic-bezier(.22,1.12,.32,1),
              width .32s cubic-bezier(.22,1.12,.32,1), height .32s cubic-bezier(.22,1.12,.32,1),
              opacity .2s ease, visibility 0s linear 0s;
  animation: onboardPulse 1.6s ease-in-out infinite;
}
@keyframes onboardPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(255, 210, 130, 0.95), 0 0 26px 6px rgba(255, 210, 130, 0.5); }
  50%      { box-shadow: 0 0 0 5px rgba(255, 210, 130, 1), 0 0 36px 10px rgba(255, 210, 130, 0.75); }
}

.onboard-tooltip {
  position: fixed;
  z-index: 62;
  max-width: min(78vw, 260px);
  padding: 12px 15px 13px;
  border-radius: 14px;
  background: rgba(8, 16, 11, 0.96);
  border: 1px solid rgba(255, 210, 130, 0.4);
  box-shadow: 0 14px 30px rgba(0,0,0,.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s,
              top .32s cubic-bezier(.22,1.12,.32,1), left .32s cubic-bezier(.22,1.12,.32,1);
}
.onboard-tooltip.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity .22s ease, transform .22s ease, visibility 0s linear 0s,
              top .32s cubic-bezier(.22,1.12,.32,1), left .32s cubic-bezier(.22,1.12,.32,1);
}
.onboard-tooltip-step {
  display: block;
  margin: 0 0 4px;
  font-family: var(--font-round);
  font-size: 10px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase;
  color: #FFD27A;
}
.onboard-tooltip-text {
  margin: 0;
  font-family: var(--font-round);
  font-size: 13.5px; font-weight: 700; line-height: 1.42;
  color: #F3E6C4;
}

@media (prefers-reduced-motion: reduce) {
  .onboard-ring, .onboard-ring.show { animation: none !important; }
}

/* пока идёт слежение за целью кадр-в-кадр (см. onboard.js) — без
   transition, иначе плавность тянет рамку через неверные промежуточные
   координаты и она визуально "гуляет" вместо того чтобы просто стоять
   на месте, пока цель ещё доигрывает собственную анимацию открытия */
.onboard-mask.tracking,
.onboard-ring.tracking,
.onboard-tooltip.tracking {
  transition: none !important;
}
