:root {
  --lime: #B2F500;
  --lime-glow: #B9FF00;
  --paper: #FEFEFE;
  --paper-warm: #FFF7F7;
  --paper-olive: #F2F3ED;
  --white: #FFFFFF;
  --ink: #000000;
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html {
  background: var(--ink);
  scrollbar-color: var(--lime) var(--ink);
  scrollbar-width: thin;
  /* v19: «удлинение» сцены после остановки скролла не должно триггерить scroll-anchoring
     браузера (компенсация scrollY при росте контента выше viewport = видимый прыжок) */
  overflow-anchor: none;
  /* НЕ overflow-x: hidden/clip на html/body: hidden делает html scroll-container и ломает
     position:sticky у .pin; в mobile Safari clip мешает резиновой прокрутке. Горизонтального
     pan нет, потому что всё, что шире экрана, лежит внутри .stage (overflow: hidden). */
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: "ODNI Medeo Sans", "Helvetica Neue", Arial, sans-serif;
  font-weight: 500;
  font-synthesis: none;
  font-optical-sizing: none;
  font-kerning: normal;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  min-height: 100dvh;
  overflow-wrap: break-word;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--lime); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--lime-glow); }

::selection { background: var(--lime); color: var(--ink); }

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: var(--ar, 1900 / 900);
  overflow: hidden;
  background: var(--ink);
}

/* Входное затемнение — оверлей, а НЕ анимация самой .stage: с animation-fill-mode:both
   сцена навсегда оставалась композитным слоем с прозрачной группой, и iOS растеризовала
   текст внутри неё, а не как обычный текст. Вуаль снимается по animationend (.entered). */
.stage::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 6;
  background: var(--ink);
  pointer-events: none;
  animation: veil 0.45s var(--ease-out) both;
}
.stage.entered::before { display: none; }
@keyframes veil {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* живой art-слой: свечение + арки дословно из экспорта, цвета — токены */
.art-svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.hits { position: absolute; inset: 0; }

.hit {
  position: absolute;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hit:focus-visible {
  outline: 2px solid var(--lime-glow);
  outline-offset: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- scroll journey ---- */

/* full-bleed ambient-подложка на весь viewport (урок соседей: «нет боковых полей»).
   Тот же art-svg, cover+blur: заполняет letterbox-поля вокруг пропорциональной сцены
   непрерывным свечением/аркой, без жёстких чёрных полос по краям. Внутри сцены её
   не видно: .stage имеет непрозрачный background. */
.bleed {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.bleed svg {
  width: 100%;
  height: 100%;
  filter: blur(28px) brightness(0.75);
  transform: scale(1.08);
}

.journey { position: relative; z-index: 1; height: calc(var(--vvh, 100dvh) * 7.3); }
.pin {
  position: sticky;
  top: 0;
  /* динамическая высота видимого viewport (iOS тулбар), не 100vh=large */
  height: var(--vvh, 100dvh);
  display: grid;
  place-items: center;
  /* safe: если сцена выше видимого viewport (телефон с тулбаром), она прижимается к верху,
     а не центрируется — иначе верх кадра с заголовком срезается и недоступен */
  place-items: safe center;
}


.layer { position: absolute; inset: 0; pointer-events: none; }
.ign-name, .ign-rule, .ign-white-rule { position: absolute; display: block; opacity: 0; }
.ign-name { overflow: visible; }

/* живой текст — обычный HTML (не SVG <text>): кегль задаётся в итоговых CSS-px из JS,
   без масштабирования viewBox/transform, поэтому движок растеризует его штатно.
   Позиция: left в % ширины сцены; baseline — через inline-маркер .tl-b (замер в движке). */
.tl {
  position: absolute;
  display: block;
  width: max-content;
  margin: 0;
  padding: 0;
  border: 0;
  font-family: "ODNI Medeo Sans", "Helvetica Neue", Arial, sans-serif;
  font-weight: 500;
  font-style: normal;
  font-synthesis: none;
  line-height: 1;
  letter-spacing: 0;
  white-space: pre;
  color: var(--paper);
}
.tl-b {
  display: inline-block;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  vertical-align: baseline;
}
/* v17: мобильная параметрическая сцена — высота из JS (max(vvh, needed)), не aspect-ratio;
   строки получают ширину зоны в px и переносятся по её краю (кегль — от ширины сцены) */
.stage[data-bp='m400'] .tl,
.stage[data-bp='m490'] .tl {
  white-space: pre-line;
}
/* SVG-пути (подчёркивания, стрелка, логотипы) и диагностический режим ?renderer=svg */
.st-line, .st-extra { position: absolute; display: block; }
.st-line { overflow: visible; }
.st-line text, .ign-name text {
  font-family: "ODNI Medeo Sans", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
  font-weight: 500;
}

/* шар: свечение и текст — разные элементы; transform (scale/translate) применяется только
   к .orb-glow, текст не масштабируется */
.orb {
  position: absolute;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  opacity: 0;
}
.orb-glow { position: absolute; inset: 0; pointer-events: none; }
.orb-text {
  position: relative;
  width: max-content;
  max-width: 92%;
  color: var(--ink);
  text-align: center;
  font-size: var(--fs, 28px);
  line-height: var(--lh, 1.4286);
  font-weight: 500;
  white-space: pre-line;
  opacity: 0;
}

/* ---- диагностика на устройстве: ?debug=nobg,notext,noanim ---- */
.debug-nobg #art, .debug-nobg .bleed { display: none !important; }
.debug-notext #static, .debug-notext #ign, .debug-notext #orbs { visibility: hidden !important; }
.debug-static #ign, .debug-static #orbs, .debug-static #hits { display: none !important; }
.debug-static #static > * { opacity: 1 !important; }
.debug-static #art g[filter] { opacity: 1 !important; }
.debug-noanim .stage::before, .debug-noanim .cue { display: none !important; }
/* элемент бейджа — класс build-badge, НЕ debug-badge: debug-* попадает на <html> */
.build-badge {
  position: fixed;
  left: 8px;
  bottom: 8px;
  z-index: 9999;
  padding: 6px 8px;
  background: #000;
  color: var(--lime);
  font: 11px/1.4 ui-monospace, Menlo, monospace;
  white-space: pre;
  pointer-events: none;
}

.cue {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 35;
  pointer-events: none;
}
.cue-line {
  position: relative;
  display: block;
  width: 1px;
  height: 56px;
  background: rgba(178, 245, 0, 0.28);
  overflow: hidden;
}
.cue-line i {
  position: absolute;
  left: 0;
  top: -40%;
  width: 1px;
  height: 40%;
  background: var(--lime-glow);
  animation: cue-drop 1.9s var(--ease-out) infinite;
}
@keyframes cue-drop {
  0% { top: -40%; }
  70%, 100% { top: 110%; }
}

@media (prefers-reduced-motion: reduce) {
  .stage::before, .hit::after { animation: none; transition: none; }
  .stage::before { display: none; }
  .cue-line i { animation: none; top: 30%; }
}
