/* =========================================================
   История при прокрутке: имена → полёт → аэропорт → выбор отеля
   ========================================================= */

/* Буквы рукописного шрифта вылезают за свою рамку — даём запас, чтобы градиент их не обрезал */
.intro-inner { width: min(1100px, 100%); }
.intro-names { white-space: nowrap; font-size: clamp(60px, 12vw, 160px); }
.intro-names .ch { padding: .14em .14em .22em; margin: 0 -.14em; }
.intro-names .heart { padding: 0 .06em; }
.brand-names .nm, .trip-hero .names .nm { display: inline-block; padding: .12em .12em .16em; margin: -.12em -.1em -.16em; }

.intro { display: block; place-items: normal; padding: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: none; background: var(--bg); outline: none; }
.intro::-webkit-scrollbar { display: none; }
.intro::before, .intro::after { content: none; }
.story-track { position: relative; height: 820vh; }
.story-stage { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: hidden; }
.story-stage::before, .story-stage::after {
  content: ""; position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; filter: blur(70px); opacity: .55; pointer-events: none;
}
.story-stage::before { background: radial-gradient(circle, #f59ab4, transparent 65%); left: -20vmax; top: -25vmax; animation: orbitA 14s ease-in-out infinite alternate; }
.story-stage::after { background: radial-gradient(circle, #a693ff, transparent 65%); right: -25vmax; bottom: -30vmax; animation: orbitB 16s ease-in-out infinite alternate; }
:root[data-theme="dark"] .story-stage::before, :root[data-theme="dark"] .story-stage::after { opacity: .32; }
.story-stars {
  position: absolute; inset: 0; opacity: 0; pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 22%, #fff, transparent), radial-gradient(1px 1px at 35% 70%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 58% 18%, #fff, transparent), radial-gradient(1px 1px at 78% 42%, #fff, transparent),
    radial-gradient(2px 2px at 90% 80%, #ffd6e6, transparent), radial-gradient(1px 1px at 22% 88%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 66% 58%, #d9ccff, transparent);
  background-size: 520px 520px;
  animation: twinkle 3.5s ease-in-out infinite alternate;
}
:root[data-theme="dark"] .story-stars { opacity: .7; }
@keyframes twinkle { from { opacity: .35; } }

.scene { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; will-change: opacity, transform; z-index: 1; }
.intro-skip {
  position: absolute; z-index: 10; top: calc(18px + env(safe-area-inset-top, 0px)); right: 20px; padding: 8px 14px; border-radius: 999px;
  background: var(--surface); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line);
}
.story-dots { position: absolute; z-index: 10; right: 22px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 10px; }
.story-dots i { width: 8px; height: 8px; border-radius: 6px; background: var(--line); transition: height .5s var(--ease-spring), background .3s; }
:root[data-theme="dark"] .story-dots i { background: rgba(255, 255, 255, .2); }
.story-dots i.on { height: 28px; background: var(--grad); }

.scroll-hint { display: inline-flex; flex-direction: column; align-items: center; gap: 10px; color: var(--ink-soft); font-weight: 800; margin-top: 4px; }
.scroll-hint .mouse { width: 28px; height: 44px; border: 2.5px solid currentColor; border-radius: 16px; position: relative; opacity: .8; }
.scroll-hint .mouse i { position: absolute; left: 50%; top: 8px; width: 4px; height: 9px; margin-left: -2px; border-radius: 2px; background: var(--rose); animation: wheel 1.6s ease-in-out infinite; }
@keyframes wheel { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(16px); } }

/* ----- Имя, которое садится в самолёт ----- */
.intro-days { margin-top: 18px; }
.fly-layer { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.fly-plane, .fly-name { position: absolute; left: 0; top: 0; will-change: transform, opacity; transform-origin: 50% 50%; }
.fly-plane svg { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 6px 6px rgba(30, 20, 50, .3)); }
.fly-plane .pl-body { fill: url(#plFuselage); stroke: #9aa3b3; stroke-width: 1; }
.fly-plane .pl-wing { fill: url(#plWing); stroke: #9aa3b3; stroke-width: 1; stroke-linejoin: round; }
.fly-plane .pl-engine { fill: url(#plEngine); stroke: #5d6576; stroke-width: .8; }
.fly-plane .pl-fin { fill: var(--rose); opacity: .9; }
.fly-plane .pl-stripe { stroke: var(--rose); stroke-width: 1.4; opacity: .55; stroke-linecap: round; }
.fly-plane .pl-cockpit { fill: none; stroke: #2e3a52; stroke-width: 2.4; stroke-linecap: round; }
.intro-names.fly-name { margin: 0; line-height: .95; white-space: nowrap; }
.fly-name .ch { background-size: 300% 100%; }

/* ----- Глобус ----- */
.scene-globe { padding: 0; }
#globe { position: absolute; inset: 0; width: 100%; height: 100%; }
.globe-caption {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; text-align: center; pointer-events: none;
  padding: calc(64px + env(safe-area-inset-top, 0px)) 24px calc(34px + env(safe-area-inset-bottom, 0px));
}
.gc-kicker { font: italic 600 20px/1.2 var(--serif); color: var(--ink-soft); }
.gc-title { font: 700 clamp(34px, 5vw, 60px)/1.05 var(--serif); margin-top: 4px; text-shadow: 0 2px 24px color-mix(in srgb, var(--bg) 80%, transparent); }
html:lang(zh-Hant) .gc-title { font: 700 clamp(28px, 4vw, 46px)/1.2 "Noto Serif TC", var(--serif); }
.gc-km {
  margin-top: auto; display: flex; align-items: baseline; gap: 8px; background: var(--surface);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--glass-border);
  border-radius: 999px; padding: 8px 22px; box-shadow: var(--shadow-sm);
}
.gc-km b { font: 900 clamp(32px, 5vw, 52px)/1 var(--font); font-variant-numeric: tabular-nums; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gc-km span { font-weight: 800; color: var(--muted); }

/* ----- Аэропорт ----- */
.scene-airport {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: calc(60px + env(safe-area-inset-top, 0px)) 20px calc(30px + env(safe-area-inset-bottom, 0px));
}
.ap-window {
  position: relative; width: min(640px, 92vw); aspect-ratio: 16 / 6.2; overflow: hidden; flex: none;
  border-radius: 140px 140px 26px 26px; border: 7px solid var(--surface-solid); box-shadow: var(--shadow);
  background: linear-gradient(180deg, #ffc4d3 0%, #ffe3d1 55%, #fff3e6 100%);
}
:root[data-theme="dark"] .ap-window { background: linear-gradient(180deg, #221c49 0%, #5d4488 55%, #d9829f 100%); }
.ap-sun { position: absolute; width: 96px; height: 96px; border-radius: 50%; right: 16%; top: 18%; background: radial-gradient(circle, #fff7cf 0 35%, #ffc98f 60%, transparent 72%); }
:root[data-theme="dark"] .ap-sun { background: radial-gradient(circle, #fff 0 30%, #e8dcff 50%, transparent 70%); width: 60px; height: 60px; }
.ap-city {
  position: absolute; left: 0; right: 0; bottom: 17%; height: 34%; background: rgba(110, 70, 120, .28);
  clip-path: polygon(0 100%, 0 62%, 5% 62%, 5% 45%, 8% 45%, 8% 62%, 13% 62%, 13% 35%, 15% 22%, 17% 35%, 17% 62%, 24% 62%, 24% 50%, 29% 50%, 29% 62%, 36% 62%, 36% 28%, 37.5% 8%, 39% 28%, 39% 62%, 47% 62%, 47% 44%, 52% 38%, 57% 44%, 57% 62%, 64% 62%, 64% 52%, 70% 52%, 70% 62%, 76% 62%, 76% 30%, 78% 22%, 80% 30%, 80% 62%, 88% 62%, 88% 48%, 94% 48%, 94% 62%, 100% 62%, 100% 100%);
}
.ap-runway {
  position: absolute; left: 0; right: 0; bottom: 0; height: 17%;
  background: #7b7184 linear-gradient(90deg, #fff 50%, transparent 50%) 0 50% / 46px 3px repeat-x;
  animation: runway 1.2s linear infinite;
}
:root[data-theme="dark"] .ap-runway { background-color: #3a3346; }
@keyframes runway { to { background-position: -46px 50%; } }
.ap-plane { position: absolute; font-size: clamp(30px, 5vw, 46px); left: -14%; top: 6%; animation: landing 5.5s ease-in-out infinite; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .2)); }
@keyframes landing {
  0% { left: -14%; top: 4%; transform: rotate(60deg); }
  58% { left: 50%; top: 58%; transform: rotate(47deg); }
  100% { left: 116%; top: 58%; transform: rotate(45deg); }
}
.ap-board {
  width: min(640px, 92vw); background: #1b1726; color: #ffd98a; border-radius: 16px; padding: 10px 18px 12px; flex: none;
  font-family: "Consolas", ui-monospace, "SFMono-Regular", monospace; box-shadow: var(--shadow);
}
.ap-board-head {
  display: flex; justify-content: space-between; color: #fff; font: 800 12px/1.2 var(--font); letter-spacing: .14em; text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, .1); padding-bottom: 7px; margin-bottom: 8px;
}
.ap-row { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; font-size: clamp(13px, 1.8vw, 17px); letter-spacing: .05em; }
.ap-from { color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-status { padding: 3px 10px; border-radius: 6px; font-weight: 900; text-transform: uppercase; white-space: nowrap; }
.ap-status.enroute { color: #ffd98a; animation: blink 1s steps(2) infinite; }
.ap-status.landed { background: #2fa07f; color: #fff; animation: popIn .5s var(--ease-spring); }
.ap-people { position: relative; display: flex; align-items: flex-end; justify-content: center; height: 140px; width: 100%; flex: none; }
.ap-person { display: flex; align-items: flex-end; gap: 4px; position: relative; will-change: transform; }
.ap-person .avatar.big { width: clamp(70px, 10vw, 96px); height: clamp(70px, 10vw, 96px); font-size: clamp(24px, 3.4vw, 34px); box-shadow: 0 0 0 5px var(--surface-solid), var(--shadow); }
.ap-prop { font-size: clamp(34px, 5vw, 48px); line-height: 1; }
.ap-name { position: absolute; left: 50%; bottom: -30px; transform: translateX(-50%); font: 700 24px/1 var(--hand); white-space: nowrap; }
.ap-person.walking .avatar, .ap-person.walking .ap-prop { animation: walkBob .38s ease-in-out infinite alternate; }
.ap-person.walking .ap-prop { animation-delay: .19s; }
@keyframes walkBob { to { transform: translateY(-10px) rotate(4deg); } }
.ap-heart { align-self: center; font-size: clamp(40px, 6vw, 58px); margin: 0 -14px; z-index: 2; transform: scale(0); transition: transform .7s var(--ease-spring); }
.scene-airport.met .ap-heart { transform: scale(1); }
.ap-caption { text-align: center; opacity: 0; transform: translateY(20px); transition: opacity .8s var(--ease-out), transform .8s var(--ease-out); margin-top: 38px; }
.scene-airport.met .ap-caption { opacity: 1; transform: none; }
.ap-caption h2 { font: 700 clamp(30px, 4.6vw, 54px)/1.05 var(--serif); margin: 0; }
html:lang(zh-Hant) .ap-caption h2 { font: 700 clamp(26px, 3.6vw, 42px)/1.2 "Noto Serif TC", var(--serif); }
.ap-caption p { color: var(--ink-soft); margin: 8px 0 0; font-weight: 700; }

/* ----- Финал: выбираем отель ----- */
.scene-final { align-content: center; justify-items: center; text-align: center; gap: 16px; }
.final-emoji { font-size: clamp(60px, 9vw, 90px); animation: floaty 3s ease-in-out infinite; }
.scene-final h2 { font: 700 clamp(40px, 6.4vw, 80px)/1.02 var(--serif); margin: 0; max-width: 940px; }
.scene-final h2 em { font-style: italic; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; padding: 0 .08em; }
html:lang(zh-Hant) .scene-final h2 { font: 700 clamp(32px, 5vw, 58px)/1.2 "Noto Serif TC", var(--serif); }
.scene-final p { color: var(--ink-soft); font-size: 18px; max-width: 560px; margin: 0; }
.final-go { font-size: 20px; padding: 17px 36px; margin-top: 10px; }

@media (max-width: 520px) {
  .story-dots { display: none; }
  .ap-window { aspect-ratio: 16 / 8; }
  .ap-people { height: 120px; }
}

/* ----- Выбор языка перед историей ----- */
.lang-pick {
  position: fixed; inset: 0; z-index: 9700; display: grid; place-items: center; padding: 24px;
  background: var(--bg); overflow: hidden;
}
.lang-pick::before, .lang-pick::after {
  content: ""; position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; filter: blur(70px); opacity: .5; pointer-events: none;
}
.lang-pick::before { background: radial-gradient(circle, #f59ab4, transparent 65%); left: -25vmax; top: -30vmax; animation: orbitA 14s ease-in-out infinite alternate; }
.lang-pick::after { background: radial-gradient(circle, #a693ff, transparent 65%); right: -25vmax; bottom: -30vmax; animation: orbitB 16s ease-in-out infinite alternate; }
:root[data-theme="dark"] .lang-pick::before, :root[data-theme="dark"] .lang-pick::after { opacity: .3; }
.lp-inner { position: relative; z-index: 1; text-align: center; width: min(720px, 100%); }
.lp-names { font: 700 clamp(40px, 7vw, 72px)/1 var(--hand); }
.lp-names .nm { display: inline-block; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; padding: .12em .14em .16em; margin: 0 -.1em; }
.lp-heart { color: var(--rose); display: inline-block; animation: beat 1.8s ease-in-out infinite; }
.lp-title { font: 700 clamp(34px, 5vw, 54px)/1.1 var(--serif); margin: 18px 0 30px; }
.lp-title span { display: block; font: 700 clamp(24px, 3.4vw, 36px)/1.3 "Noto Serif TC", var(--serif); color: var(--ink-soft); margin-top: 4px; }
.lp-options { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.lp-option {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 28px 18px 24px; border-radius: 28px; border: 1px solid var(--glass-border);
  background: var(--surface); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow); color: var(--ink);
  transition: transform .45s var(--ease-spring), box-shadow .35s, border-color .35s;
}
.lp-option:hover, .lp-option:focus-visible { transform: translateY(-6px) scale(1.02); box-shadow: 0 0 0 2px var(--rose), var(--shadow-glow); }
.lp-option.remembered { box-shadow: 0 0 0 2px color-mix(in srgb, var(--lav) 55%, transparent), var(--shadow); }
.lp-glyph {
  width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 6px;
  font: 800 36px/1 var(--font); color: #fff; background: var(--grad); box-shadow: var(--shadow-glow);
}
.lp-option[data-pick-lang="zh"] .lp-glyph { font-family: "Noto Serif TC", serif; font-size: 40px; }
.lp-option b { font-size: 22px; font-weight: 900; }
.lp-option[data-pick-lang="zh"] b { font-family: "Noto Sans TC", var(--font); }
.lp-option small { color: var(--muted); font-weight: 700; }
@media (max-width: 520px) {
  .lp-options { grid-template-columns: 1fr; }
  .lp-option { flex-direction: row; justify-content: flex-start; gap: 16px; padding: 16px 20px; text-align: left; }
  .lp-glyph { width: 60px; height: 60px; font-size: 26px; margin: 0; }
  .lp-option small { display: none; }
}
