:root {
  --night: #15112b;
  --night-2: #1f1842;
  --ink: #0d0b18;
  --cream: #fff4e0;
  --paper: #fff8e8;
  --portal: #6dff8f;
  --portal-2: #c4ff4d;
  --fire: #ff6a2b;
  --win: #ffcf5a;
  --note: #ffe45c;
  --stamp: #e8432f;
  --display: "Rubik", system-ui, sans-serif;
  --hand: "Balsamiq Sans", "Comic Sans MS", system-ui, sans-serif;
  --body: "Golos Text", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --ART: 1.7921; /* пропорции кадров 2000×1116 */
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--night); color: var(--cream); font: 400 17px/1.55 var(--body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h2 { font: 900 clamp(34px, 5vw, 76px)/1 var(--display); letter-spacing: -.02em; text-shadow: 4px 4px 0 var(--ink); }
h3 { font: 800 clamp(26px, 2.6vw, 40px)/1.08 var(--display); letter-spacing: -.01em; text-shadow: 3px 3px 0 var(--ink); }
.kicker { font: 700 14px/1 var(--hand); letter-spacing: .06em; text-transform: uppercase; color: var(--portal); margin-bottom: 18px; }
.kicker--center { text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 56px; padding: 0 26px; border: 3px solid var(--ink); border-radius: 16px;
  background: var(--portal); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap;
  font: 800 18px/1 var(--display); box-shadow: 5px 5px 0 var(--ink); transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translate(-2px, -2px) rotate(-1deg); box-shadow: 7px 7px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.btn--sm { height: 44px; padding: 0 18px; font-size: 15px; box-shadow: 4px 4px 0 var(--ink); }
.btn--big { height: 64px; font-size: 21px; }
.btn--ghost { background: var(--cream); }
.btn--portal { position: relative; background: radial-gradient(circle at 30% 30%, var(--portal-2), var(--portal)); }
.btn--portal::before { content: ""; position: absolute; inset: -8px; border-radius: 22px; border: 3px dashed var(--portal); animation: spin 8s linear infinite; opacity: .6; }
@keyframes spin { to { transform: rotate(360deg); } }

/* шапка */
.top { position: fixed; inset: 0 0 auto; z-index: 50; display: flex; align-items: center; gap: 26px; height: 72px; padding: 0 clamp(16px, 3vw, 44px); transition: background .3s; }
.top.is-scrolled { background: rgba(21,17,43,.86); backdrop-filter: blur(10px); border-bottom: 3px solid var(--ink); }
.logo { display: inline-flex; align-items: center; gap: 10px; font: 800 24px/1 var(--display); letter-spacing: -.02em; text-decoration: none; text-shadow: 2px 2px 0 var(--ink); }
.logo b { color: var(--portal); font-weight: 900; }
.logo__cloud { width: 30px; height: 20px; border-radius: 12px; background: var(--cream); border: 3px solid var(--ink); position: relative; }
.logo__cloud::before { content: ""; position: absolute; left: 6px; top: -9px; width: 14px; height: 14px; border-radius: 50%; background: var(--cream); border: 3px solid var(--ink); border-bottom-color: transparent; border-right-color: transparent; transform: rotate(45deg); }
.top__nav { margin-left: auto; display: flex; gap: 24px; font: 700 16px var(--hand); }
.top__nav a { text-decoration: none; }
.top__nav a:hover { color: var(--portal); }

/* сцена 16:9, накрывающая контейнер; подписи позиционируются в % кадра */
.stage { position: absolute; left: 50%; top: 50%; width: max(100%, calc(100svh * var(--ART))); aspect-ratio: 2000 / 1116; transform: translate(-50%, -50%); }
.stage img { width: 100%; height: 100%; }

/* ── акт 1: ад ─────────────────────────────────────────── */
.hell { position: relative; height: 100svh; min-height: 620px; overflow: hidden; background: #2a2440; }
.hell .stage img { animation: breathe 18s ease-in-out infinite alternate; }
@keyframes breathe { to { transform: scale(1.04); } }
.embers { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hell__shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(13,11,24,.92) 0%, rgba(13,11,24,.72) 30%, rgba(13,11,24,0) 58%), linear-gradient(0deg, rgba(13,11,24,.6), transparent 30%); pointer-events: none; }
.hell__text { position: absolute; z-index: 3; left: clamp(16px, 4vw, 64px); top: 50%; transform: translateY(-48%); max-width: 600px; }
.hell h1 { font: 900 clamp(48px, 7.2vw, 118px)/.92 var(--display); letter-spacing: -.03em; color: var(--cream); text-shadow: 6px 6px 0 var(--ink); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
.lead { margin: 26px 0 30px; font-size: 19px; color: #f2e6d2; max-width: 30em; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 16px; }
.scroll-hint { position: absolute; z-index: 3; left: 50%; bottom: 22px; transform: translateX(-50%); font: 700 15px var(--hand); color: var(--cream); animation: hop 1.4s ease-in-out infinite; text-shadow: 2px 2px 0 var(--ink); }
@keyframes hop { 50% { transform: translate(-50%, 6px); } }

.bubble { position: absolute; z-index: 2; left: var(--x); top: var(--y); transform: translate(-50%, -100%) scale(0); transform-origin: 50% 120%; padding: 8px 14px; border-radius: 18px; background: #fff; color: var(--ink); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); font: 700 clamp(12px, 1.05vw, 17px)/1.2 var(--hand); white-space: nowrap; transition: transform .35s cubic-bezier(.3,1.6,.5,1); }
.bubble::after { content: ""; position: absolute; left: 22%; bottom: -14px; border: 8px solid transparent; border-top: 10px solid var(--ink); }
.bubble--r::after { left: auto; right: 22%; }
.bubble--hot { background: var(--note); }
.bubble.is-on { transform: translate(-50%, -100%) scale(1); animation: wob 3s ease-in-out infinite; }
@keyframes wob { 50% { rotate: -2deg; } }
.clock-tag { position: absolute; z-index: 2; left: var(--x); top: var(--y); transform: translate(-50%, 0); padding: 4px 10px; background: var(--stamp); color: #fff; border: 3px solid var(--ink); border-radius: 8px; font: 700 15px var(--mono); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* ── акт 2: портал ─────────────────────────────────────── */
.portal { position: relative; height: 340vh; background: var(--ink); }
.portal__stick { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.stage--portal { transform-origin: 79.4% 45.4%; will-change: transform; }
.portal__through { position: absolute; inset: 0; opacity: 0; clip-path: circle(0 at 50% 50%); will-change: clip-path; }
.portal__through img { width: 100%; height: 100%; object-fit: cover; }
.portal__through::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 120px 40px rgba(109,255,143,.55); pointer-events: none; }
.portal__cap { position: absolute; z-index: 3; left: clamp(16px, 4vw, 64px); bottom: 12vh; max-width: 760px; font: 900 clamp(34px, 5.4vw, 84px)/1 var(--display); letter-spacing: -.02em; color: var(--cream); text-shadow: 5px 5px 0 var(--ink); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; transition: opacity .25s, transform .25s; }
.portal__cap.is-swap { opacity: 0; transform: translateY(12px); }

/* ── акт 3: город ──────────────────────────────────────── */
.city { position: relative; height: 420vh; }
.city__stick { position: sticky; top: 0; height: 100svh; overflow: hidden; background: var(--night); }
.city__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.city__img--day { opacity: 0; }
.city__panel { position: absolute; z-index: 3; left: clamp(16px, 4vw, 64px); bottom: clamp(20px, 6vh, 64px); width: min(460px, calc(100% - 32px)); padding: 22px 24px; border-radius: 20px; background: var(--paper); color: var(--ink); border: 4px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); transform: rotate(-1deg); }
.city__panel .kicker { color: #7a4cff; margin-bottom: 8px; }
.city__time { font: 900 56px/1 var(--display); letter-spacing: -.03em; }
.city__cap { margin-top: 8px; font: 700 20px/1.3 var(--hand); min-height: 2.6em; }
.bill { margin-top: 14px; padding-top: 12px; border-top: 3px dashed rgba(13,11,24,.25); }
.bill__lbl { font: 400 14px var(--body); color: #4a4560; }
.bill__win { margin-top: 8px; display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.bill__win i { height: 26px; border-radius: 4px; border: 3px solid var(--ink); background: #3b3460; transition: background .3s, box-shadow .3s; }
.bill__win i.on { background: var(--win); box-shadow: 0 0 12px rgba(255,207,90,.9); }

/* ── акт 4: команда ────────────────────────────────────── */
.crew { position: relative; padding: 120px clamp(16px, 4vw, 64px) 100px; background:
  radial-gradient(2px 2px at 10% 20%, #fff8, transparent 60%), radial-gradient(2px 2px at 70% 10%, #fff8, transparent 60%),
  radial-gradient(1.5px 1.5px at 40% 60%, #fff6, transparent 60%), radial-gradient(2px 2px at 85% 75%, #fff7, transparent 60%),
  radial-gradient(1.5px 1.5px at 25% 85%, #fff5, transparent 60%), linear-gradient(var(--night), var(--night-2));
  background-size: 420px 420px, 380px 380px, 300px 300px, 460px 460px, 340px 340px, 100% 100%; }
.crew__h { text-align: center; max-width: 18ch; margin: 0 auto 90px; }
.scene { max-width: 1320px; margin: 0 auto 110px; display: grid; grid-template-columns: 1.25fr 1fr; gap: clamp(28px, 4vw, 64px); align-items: center; }
.scene--flip .scene__art { order: 2; }
.scene__art { border: 4px solid var(--ink); border-radius: 22px; overflow: hidden; box-shadow: 10px 10px 0 var(--ink); transform: rotate(-1deg); background: #000; }
.scene--flip .scene__art { transform: rotate(1deg); }
.scene__art img { transition: transform 6s ease; }
.scene:hover .scene__art img { transform: scale(1.05); }
.tag { display: inline-block; margin-bottom: 16px; padding: 6px 12px; border-radius: 999px; background: var(--portal); color: var(--ink); border: 3px solid var(--ink); font: 700 14px var(--hand); }
.scene__text h3 { margin-bottom: 14px; }
.scene__text > p:not(.tag) { color: #ddd3c4; font-size: 18px; }

.chat { margin-top: 24px; display: grid; gap: 10px; font: 400 16px/1.4 var(--body); }
.chat p { padding: 12px 16px; border-radius: 16px; border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); max-width: 90%; }
.chat__me { justify-self: end; background: var(--portal); color: var(--ink); font-weight: 600; }
.chat__bot { background: var(--paper); color: var(--ink); }
.chat__bot b { display: block; margin-top: 6px; font: 700 15px var(--mono); color: #1a7a3a; opacity: 0; transition: opacity .4s 1.8s; }
.chat.in .chat__bot b { opacity: 1; }
.typing { display: inline-block; overflow: hidden; white-space: nowrap; max-width: 0; vertical-align: bottom; transition: max-width 1.6s steps(48); }
.chat.in .typing { max-width: 100%; white-space: normal; }

.case { position: relative; margin-top: 24px; padding: 22px 24px; background: #f3e6c8; color: #2a2210; border: 3px solid var(--ink); border-radius: 6px; box-shadow: 6px 6px 0 var(--ink); transform: rotate(.6deg); font: 400 15px/1.45 var(--body); }
.case__no { font: 700 13px var(--mono); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 10px; }
.case dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
.case dt { font-weight: 600; }
.case dd { margin: 0; }
.case__stamp { position: absolute; right: 16px; top: 14px; padding: 4px 10px; border: 3px solid var(--stamp); color: var(--stamp); font: 900 18px var(--display); letter-spacing: .1em; transform: rotate(-12deg) scale(0); transition: transform .4s cubic-bezier(.3,1.8,.5,1) .3s; }
.case.in .case__stamp { transform: rotate(-12deg) scale(1); }

.notes { list-style: none; padding: 0; margin: 24px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.notes li { padding: 14px 16px 16px; background: var(--note); color: var(--ink); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); font: 700 15px/1.3 var(--hand); transform: rotate(var(--r, -1.5deg)); }
.notes li:nth-child(2) { --r: 1.5deg; } .notes li:nth-child(3) { --r: 1deg; } .notes li:nth-child(4) { --r: -2deg; }
.notes em { display: block; margin-top: 4px; font-style: normal; font-weight: 400; color: #4a3d00; }

.perks { list-style: none; padding: 0; margin: 0 auto; max-width: 1100px; display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.perks li { padding: 12px 18px; border-radius: 999px; background: var(--night-2); border: 3px solid var(--cream); font: 700 16px var(--hand); box-shadow: 4px 4px 0 var(--ink); }

/* ── финал: участок ────────────────────────────────────── */
.join { position: relative; min-height: 100svh; overflow: hidden; background: var(--night); display: flex; align-items: center; }
.plot { position: absolute; inset: 0; }
.plot img { width: 100%; height: 100%; object-fit: cover; object-position: 30% 50%; }
.plot__houses { position: absolute; inset: 0; pointer-events: none; }
.house { position: absolute; width: clamp(34px, 3.2vw, 56px); transform: translate(-50%, -100%); animation: build .7s cubic-bezier(.3,1.7,.5,1) both; filter: drop-shadow(3px 3px 0 var(--ink)); }
@keyframes build { from { transform: translate(-50%, -100%) scale(0); } }
.house--me { width: clamp(56px, 5vw, 84px); z-index: 2; }
.house--me::after { content: "твой"; position: absolute; left: 50%; top: -26px; transform: translateX(-50%); padding: 2px 8px; border-radius: 8px; background: var(--portal); color: var(--ink); border: 2px solid var(--ink); font: 700 13px var(--hand); white-space: nowrap; }
.join__card { position: relative; z-index: 3; margin-left: auto; margin-right: clamp(16px, 5vw, 80px); width: min(500px, calc(100% - 32px)); padding: 34px 32px; border-radius: 24px; background: var(--paper); color: var(--ink); border: 4px solid var(--ink); box-shadow: 10px 10px 0 var(--ink); transform: rotate(.8deg); }
.join__card h2 { color: var(--ink); text-shadow: 3px 3px 0 var(--portal); font-size: clamp(34px, 3.8vw, 56px); }
.join__card .kicker { color: #7a4cff; }
.join__sub { margin-top: 14px; color: #3d3852; }
.join__count { margin-top: 12px; font: 700 16px var(--hand); }
.join__count b { color: #7a4cff; }
.join__form { margin-top: 22px; display: grid; gap: 14px; }
.jf { display: grid; gap: 6px; }
.jf span { font: 700 13px var(--hand); text-transform: uppercase; letter-spacing: .05em; }
.jf input, .jf select { height: 54px; padding: 0 16px; border-radius: 14px; border: 3px solid var(--ink); background: #fff; color: var(--ink); font: 400 17px var(--body); outline: none; appearance: none; }
.jf select { background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 24px) 50%, calc(100% - 18px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.jf input:focus, .jf select:focus { box-shadow: 0 0 0 4px var(--portal); }
.consent { display: flex; gap: 10px; font-size: 14px; color: #3d3852; cursor: pointer; }
.consent input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: #7a4cff; flex: none; }
.join__msg { min-height: 1.3em; font: 700 15px var(--hand); }
.join__msg.err { color: var(--stamp); }
.join__form.is-done .jf, .join__form.is-done .consent, .join__form.is-done .btn { display: none; }
.join__form.is-done .join__msg { font: 900 26px/1.15 var(--display); color: var(--ink); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 34px; padding: 36px clamp(16px, 4vw, 64px) 52px; background: var(--ink); color: #b8b0c8; font-size: 14px; }
.foot ul { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; }
.foot ul a { text-decoration: none; color: var(--cream); font-weight: 600; }
.foot ul a:hover { color: var(--portal); }
.foot__legal { margin-left: auto; }
:focus-visible { outline: 3px solid var(--portal); outline-offset: 3px; }

.rv { opacity: 0; transform: translateY(30px); transition: opacity .8s, transform .8s cubic-bezier(.2,.8,.2,1); }
.rv.in { opacity: 1; transform: none; }

@media (max-width: 1000px) {
  .scene, .scene--flip { grid-template-columns: 1fr; }
  .scene--flip .scene__art { order: 0; }
  .join { flex-direction: column; align-items: stretch; }
  .plot { position: relative; inset: auto; height: 62svh; }
  .join__card { margin: -60px auto 60px; }
}
@media (max-width: 700px) {
  body { font-size: 16px; }
  .top__nav { display: none; }
  .top { justify-content: space-between; }
  .hell .stage { left: 42%; }
  .hell__shade { background: linear-gradient(180deg, rgba(13,11,24,.88) 0%, rgba(13,11,24,.55) 55%, rgba(13,11,24,.2)); }
  .hell__text { top: 96px; transform: none; right: 16px; }
  .lead { font-size: 17px; }
  .bubble { font-size: 12px; padding: 6px 10px; }
  .city__time { font-size: 42px; }
  .city__cap { font-size: 17px; }
  .notes { grid-template-columns: 1fr; }
  .crew { padding-top: 80px; }
  .crew__h { margin-bottom: 56px; }
  .scene { margin-bottom: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .bubble { transform: translate(-50%, -100%) scale(1); }
  .typing { max-width: 100%; white-space: normal; }
  .chat__bot b, .rv { opacity: 1; transform: none; }
}
