/* ==========================================================================
   «Путь iO: 2017 → 2030» — страница игры
   ========================================================================== */

:root {
  --blue: #2EA2FF;
  --blue-hi: #7CC6FF;
  --blue-deep: #1679E8;
  --ink: #05080F;
  --ink-2: #0A1120;
  --on-dark: #EEF4FF;
  --on-dark-2: rgba(226, 236, 255, .7);
  --on-dark-3: rgba(226, 236, 255, .42);
  --line-dark: rgba(255, 255, 255, .1);
  --ok: #34D399;
  --bad: #FF6B6B;
  --glass: rgba(7, 12, 24, .82);

  --f-display: "Unbounded", "Onest", system-ui, sans-serif;
  --f-body: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --gutter: clamp(16px, 3vw, 28px);
  --panel-w: min(440px, 36vw);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  color: var(--on-dark);
  font: 400 16px/1.55 var(--f-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
h1, h2, p, ol, ul, dl, dd { margin: 0; }
ol, ul { list-style: none; padding: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 8px; }
[hidden] { display: none !important; }
.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- сцена ---------- */
.g-stage { position: fixed; inset: 0; }
.g-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.g-canvas:active { cursor: grabbing; }
.g-flat {
  position: absolute; inset: 0; display: none; place-items: center; overflow: hidden;
  background:
    radial-gradient(60% 50% at 30% 30%, rgba(46,162,255,.35), transparent 70%),
    radial-gradient(50% 40% at 80% 80%, rgba(124,198,255,.18), transparent 70%),
    var(--ink);
}
.g-flat__year {
  font: 700 clamp(120px, 26vw, 360px)/1 var(--f-display); letter-spacing: -.05em;
  color: transparent; -webkit-text-stroke: 1.5px rgba(124,198,255,.28);
  transform: translateX(-12vw);
}
.no-3d .g-canvas { display: none; }
.no-3d .g-flat { display: grid; }
.g-flat-note { display: none; }
.no-3d.is-intro .g-flat-note {
  display: block; position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  font-size: 13px; color: var(--on-dark-3); text-align: center; width: calc(100% - 32px);
}

/* загрузка и вход в мир */
.g-loader {
  position: fixed; inset: 0; z-index: 20; display: grid; place-content: center; justify-items: center; gap: 18px;
  background: radial-gradient(60% 50% at 50% 45%, #0d1a33 0%, var(--ink) 70%);
  transition: opacity 1.1s var(--ease), visibility 1.1s;
}
.g-loader svg { width: 74px; height: 64px; fill: var(--blue); animation: pulse 1.6s ease-in-out infinite; }
.g-loader p { font-size: 14px; letter-spacing: .08em; color: var(--on-dark-2); }
.g-loader__bar { width: 140px; height: 2px; border-radius: 2px; background: rgba(255,255,255,.1); overflow: hidden; }
.g-loader__bar i { display: block; width: 40%; height: 100%; background: var(--blue); animation: load 1.2s ease-in-out infinite; }
.is-ready .g-loader { opacity: 0; visibility: hidden; }
@keyframes pulse { 50% { opacity: .5; transform: scale(.94); } }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

.g-stage::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(5,8,15,.38) 100%);
}
.g-intro, .is-intro .g-top { opacity: 0; transition: opacity 1s var(--ease); }
.is-landed .g-intro, .is-landed .g-top, .is-playing .g-top { opacity: 1; }
.g-intro { visibility: hidden; }
.is-landed .g-intro { visibility: visible; animation: rise-intro 1s var(--ease) both; }

/* киношные полосы во время пролёта камеры */
.g-bars i {
  position: fixed; left: 0; right: 0; z-index: 6; height: 9vh; background: #000; pointer-events: none;
  transform: scaleY(0); transition: transform .9s var(--ease);
}
.g-bars i:first-child { top: 0; transform-origin: top; }
.g-bars i:last-child { bottom: 0; transform-origin: bottom; }
.is-cinematic .g-bars i { transform: scaleY(1); }
.is-cinematic .g-top { opacity: 0; pointer-events: none; }

/* город проявляется */
.g-stage { transition: filter .8s var(--ease); }
.is-intro .g-stage { filter: saturate(.9); }
.g-stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.2s var(--ease); }
.is-intro.is-landed .g-stage::after { opacity: 1; }
.is-intro .g-stage::after {
  background: linear-gradient(90deg, rgba(5,8,15,.82) 0%, rgba(5,8,15,.55) 38%, rgba(5,8,15,0) 70%);
}

/* ---------- шапка ---------- */
.g-top {
  position: fixed; z-index: 5; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) var(--gutter) 14px;
  pointer-events: none;
}
.g-top > * { pointer-events: auto; }
.g-back {
  display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px 0 12px;
  border-radius: 999px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line-dark); font-weight: 500; font-size: 14px;
  transition: background .25s;
}
.g-back:hover { background: rgba(10,17,32,.95); }
.g-back svg { width: 26px; height: 22px; fill: var(--blue); }

.g-hud {
  display: flex; align-items: stretch; gap: 2px; padding: 4px;
  border-radius: 18px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line-dark);
  margin-right: auto; margin-left: 4px;
}
.g-hud > div { padding: 6px 14px; border-radius: 14px; min-width: 76px; }
.g-hud dt { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--on-dark-3); }
.g-hud dd { font: 600 17px/1.25 var(--f-display); font-variant-numeric: tabular-nums; }
.g-hud__year { background: rgba(46,162,255,.16); }
.g-hud__year dd { color: var(--blue-hi); }

.lang { display: flex; padding: 4px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line-dark); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.lang a { display: grid; place-items: center; width: 40px; height: 34px; border-radius: 999px; font: 600 12.5px/1 var(--f-body); letter-spacing: .04em; color: var(--on-dark-3); transition: color .25s, background .25s; }
.lang a:hover { color: #fff; }
.lang a[aria-current="true"] { background: #fff; color: var(--ink); }

/* ---------- кнопки ---------- */
.g-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px; border-radius: 999px;
  font: 600 15.5px/1.2 var(--f-body); text-align: center;
  transition: transform .25s var(--ease), background .25s, box-shadow .25s, opacity .25s;
}
.g-btn:active { transform: scale(.97); }
.g-btn:disabled { opacity: .55; cursor: default; }
.g-btn--primary { background: var(--blue); color: #fff; box-shadow: 0 12px 36px -12px rgba(46,162,255,.8), inset 0 1px 0 rgba(255,255,255,.3); }
.g-btn--primary:hover:not(:disabled) { background: #47AEFF; }
.g-btn--primary:hover .ico { transform: translateX(2px); }
.g-btn--primary .ico { transition: transform .25s var(--ease); }
.g-btn--ghost { border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.04); }
.g-btn--ghost:hover { border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.08); }
.g-btn--link { min-height: 44px; padding: 0 8px; color: var(--on-dark-2); font-weight: 500; }
.g-btn--link:hover { color: #fff; }
.g-btn--lg { min-height: 60px; padding: 0 30px; font-size: 17px; }

/* ---------- заставка ---------- */
.g-main { position: relative; z-index: 3; height: 100%; pointer-events: none; }
.g-main > * { pointer-events: auto; }
.g-intro {
  position: absolute; left: var(--gutter); top: 50%; transform: translateY(-46%);
  width: min(560px, calc(100% - var(--gutter) * 2));
}
.g-eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--blue-hi); margin-bottom: 22px; }
.g-eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 5px rgba(46,162,255,.2); }
.g-title { font: 700 clamp(44px, 7vw, 92px)/1 var(--f-display); letter-spacing: -.035em; margin-bottom: 26px; }
.g-title em {
  display: block; font-style: normal; font-weight: 600; font-size: .48em; letter-spacing: -.02em; margin-top: .35em;
  background: linear-gradient(90deg, var(--blue-hi), var(--blue)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.g-intro__text { font-size: clamp(17px, 1.6vw, 20px); color: var(--on-dark-2); max-width: 30em; margin-bottom: 34px; text-wrap: pretty; }
.g-note { margin-top: 16px; font-size: 13.5px; color: var(--on-dark-3); }
.is-loading [data-start] span::after { content: ""; display: inline-block; width: 1em; }

/* ---------- панель шага ---------- */
.g-panel {
  position: absolute; right: var(--gutter); top: 50%; transform: translateY(-50%);
  width: var(--panel-w); max-height: calc(100% - 180px);
  display: flex;
}
.g-card {
  width: 100%; overflow-y: auto; overscroll-behavior: contain;
  padding: 28px 28px 26px; border-radius: 28px;
  background: var(--glass); backdrop-filter: blur(20px) saturate(1.2); -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid var(--line-dark);
  box-shadow: 0 30px 80px -30px rgba(5,8,15,.6);
  scrollbar-width: thin;
}
.g-card.is-in > * { animation: rise .55s var(--ease) both; }
.g-card.is-in > *:nth-child(2) { animation-delay: .05s; }
.g-card.is-in > *:nth-child(3) { animation-delay: .1s; }
.g-card.is-in > *:nth-child(4) { animation-delay: .15s; }
.g-card.is-in > *:nth-child(n+5) { animation-delay: .2s; }

.g-kicker { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 13px; color: var(--on-dark-3); }
.g-kicker b { font: 600 13px/1 var(--f-display); color: var(--blue-hi); padding: 7px 11px; border-radius: 999px; background: rgba(46,162,255,.16); letter-spacing: .02em; }
.g-h { font: 600 clamp(21px, 1.9vw, 27px)/1.22 var(--f-display); letter-spacing: -.015em; text-wrap: balance; outline: none; }
.g-sub { margin-top: 10px; color: var(--on-dark-3); font-size: 14px; }
.g-text { margin-top: 12px; color: var(--on-dark-2); text-wrap: pretty; }

.g-opts { display: grid; gap: 10px; margin-top: 20px; }
.g-opt {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  min-height: 60px; padding: 12px 16px; border-radius: 18px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1);
  font-weight: 500; line-height: 1.35;
  transition: background .2s, border-color .2s, transform .2s var(--ease), opacity .3s;
}
.g-opt:hover:not(:disabled) { background: rgba(46,162,255,.14); border-color: rgba(46,162,255,.55); }
.g-opt:active:not(:disabled) { transform: scale(.985); }
.g-opt kbd {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px;
  font: 600 12px/1 var(--f-display); background: rgba(255,255,255,.08); color: var(--on-dark-2);
}
.g-opt:disabled { cursor: default; opacity: .45; }
.g-opt.is-right { opacity: 1; background: rgba(52,211,153,.14); border-color: rgba(52,211,153,.7); }
.g-opt.is-right kbd { background: var(--ok); color: var(--ink); }
.g-opt.is-wrong { opacity: 1; background: rgba(255,107,107,.12); border-color: rgba(255,107,107,.6); animation: shake .4s; }
.g-opt.is-wrong kbd { background: var(--bad); color: var(--ink); }

.g-verdict { margin-top: 12px; font-weight: 600; font-size: 15px; }
.g-verdict.is-right { color: var(--ok); }
.g-verdict.is-wrong { color: #FFB4B4; font-weight: 500; }
.g-kicker + .g-verdict { margin: 0 0 10px; }

.g-build { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line-dark); animation: rise .5s var(--ease) both; }
.g-build__l { display: flex; align-items: center; gap: 10px; font: 600 16px/1.3 var(--f-display); }
.g-build__l i { width: 12px; height: 12px; border-radius: 4px; background: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 25%, transparent); }
.g-build__hint { margin: 8px 0 16px; font-size: 14px; color: var(--on-dark-3); }
.no-3d .g-build__hint { display: none; }
.g-build .g-btn { width: 100%; }
.g-card > .g-btn { width: 100%; margin-top: 22px; }

/* сегодня */
.g-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.g-stats li { padding: 14px 16px; border-radius: 18px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); }
.g-stats li:first-child { grid-column: 1 / -1; background: linear-gradient(135deg, rgba(46,162,255,.28), rgba(46,162,255,.08)); border-color: rgba(46,162,255,.4); }
.g-stats b { display: block; font: 600 26px/1.1 var(--f-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.g-stats li:first-child b { font-size: 40px; color: #fff; }
.g-stats span { font-size: 13.5px; color: var(--on-dark-2); }
.g-products { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.g-products li { display: flex; align-items: center; height: 40px; padding: 0 14px; border-radius: 12px; background: #fff; }
.g-products img { height: 20px; width: auto; }
.g-products span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* финал */
.g-goal { font: 500 17px/1.45 var(--f-display); letter-spacing: -.01em; color: #fff; text-wrap: balance; }
.g-result { margin-top: 20px; padding: 20px; border-radius: 22px; background: linear-gradient(140deg, rgba(46,162,255,.26), rgba(46,162,255,.06)); border: 1px solid rgba(46,162,255,.35); }
.g-score { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; color: var(--on-dark-2); font-size: 14px; }
.g-score b { font: 700 48px/1 var(--f-display); color: #fff; letter-spacing: -.03em; }
.g-actions { display: grid; gap: 10px; margin-top: 20px; }
.g-actions .g-btn { width: 100%; }

/* ---------- лента лет ---------- */
.g-line {
  position: fixed; z-index: 4; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; gap: 4px; padding: 6px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line-dark); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.g-line li { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; font: 600 11.5px/1 var(--f-display); color: var(--on-dark-3); white-space: nowrap; transition: background .4s, color .4s; }
.g-line i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .6; transition: background .4s, box-shadow .4s; }
.g-line .is-done { color: var(--on-dark-2); }
.g-line .is-done i { background: var(--blue); opacity: 1; }
.g-line .is-now { background: var(--blue); color: #fff; }
.g-line .is-now i { background: #fff; opacity: 1; box-shadow: 0 0 0 3px rgba(255,255,255,.3); }
@media (min-width: 901px) {
  .g-line { left: calc((100% - var(--panel-w) - var(--gutter)) / 2); }
}

.g-drag {
  position: fixed; z-index: 4; left: calc((100% - var(--panel-w) - var(--gutter)) / 2); top: 96px; transform: translateX(-50%);
  padding: 9px 16px; border-radius: 999px; background: var(--glass); font-size: 13px; color: var(--on-dark-2);
  animation: rise .5s var(--ease) both, fadeout .6s 3.6s forwards; pointer-events: none;
}
.g-toast {
  position: fixed; z-index: 9; left: 50%; bottom: 90px; transform: translate(-50%, 20px); opacity: 0;
  padding: 12px 18px; border-radius: 14px; background: #fff; color: var(--ink); font-weight: 600; font-size: 14px;
  transition: opacity .3s, transform .3s var(--ease); pointer-events: none;
}
.g-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- телефоны и планшеты ---------- */
@media (max-width: 900px) {
  :root { --panel-w: 100%; }
  .g-top { padding-top: calc(10px + env(safe-area-inset-top)); flex-wrap: wrap; }
  .g-back span { display: none; }
  .g-back { padding: 0 12px; }
  .g-hud { order: 3; margin: 0; }
  .is-playing .g-top .lang { display: none; }
  .is-playing .g-top { justify-content: flex-start; }
  .g-hud > div { min-width: 0; padding: 5px 12px; }
  .g-hud dd { font-size: 15px; }

  .is-intro .g-stage::after { background: linear-gradient(0deg, rgba(5,8,15,.92) 0%, rgba(5,8,15,.7) 45%, rgba(5,8,15,.1) 75%); }
  .g-intro { top: auto; bottom: calc(28px + env(safe-area-inset-bottom)); transform: none; }
  .g-intro .g-btn { width: 100%; }
  .g-flat__year { transform: translateY(-18vh); }

  .g-panel {
    left: 0; right: 0; top: auto; bottom: 0; transform: none; width: auto;
    max-height: 60%;
  }
  .g-card {
    border-radius: 26px 26px 0 0; border-bottom: 0;
    padding: 22px var(--gutter) calc(20px + env(safe-area-inset-bottom));
  }
  .g-card::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.18); margin: -8px auto 14px; }
  .g-opt { min-height: 54px; padding: 10px 14px; }
  .g-opts { gap: 8px; margin-top: 16px; }
  .g-line { display: none; }
  .g-drag { left: 50%; top: auto; bottom: 62%; }
  .g-stats li:first-child b { font-size: 32px; }
  .g-stats b { font-size: 22px; }
}
@media (max-width: 380px) {
  .g-hud > div:last-child { display: none; }
}

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes rise-intro { from { opacity: 0; translate: 0 18px; } }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
@keyframes fadeout { to { opacity: 0; } }

/* ==========================================================================
   Окно с информацией о машине, скутере или человеке
   ========================================================================== */
.g-pop {
  position: fixed; left: 0; top: 0; z-index: 5; width: 264px; padding: 14px 16px 15px;
  border-radius: 18px; background: rgba(7,12,24,.9); border: 1px solid rgba(46,162,255,.32);
  box-shadow: 0 18px 44px -18px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.03) inset;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-size: 13.5px; line-height: 1.45; color: var(--on-dark);
  will-change: transform; opacity: 0; transition: opacity .15s var(--ease);
}
.g-pop.is-on { opacity: 1; }
/* хвостик к объекту */
.g-pop::after {
  content: ""; position: absolute; left: var(--tail, 50%); bottom: -7px; width: 12px; height: 12px; margin-left: -6px;
  background: rgba(7,12,24,.95); border-right: 1px solid rgba(46,162,255,.32); border-bottom: 1px solid rgba(46,162,255,.32);
  transform: rotate(45deg);
}
.g-pop.is-below::after { bottom: auto; top: -7px; transform: rotate(225deg); }
.g-pop.is-free::after { display: none; }
.g-pop__head { display: flex; align-items: center; gap: 11px; padding-right: 26px; }
.g-pop__ico { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: rgba(46,162,255,.16); color: var(--blue-hi); }
.g-pop__ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.g-pop__ico i { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px rgba(255,255,255,.2); }
.g-pop h3 { margin: 0; font: 600 15px/1.25 var(--f-display); letter-spacing: -.01em; }
.g-pop__meta { display: block; margin-top: 2px; font-size: 12.5px; color: var(--on-dark-2); }
.g-pop__status { display: flex; align-items: center; gap: 7px; margin-top: 11px; font-size: 12.5px; color: var(--on-dark-2); }
.g-pop__status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 3px rgba(46,162,255,.22); flex: none; }
.g-pop__status b { color: #fff; font-weight: 600; }
.g-pop q { display: block; margin-top: 10px; padding: 9px 11px; border-radius: 12px; background: rgba(46,162,255,.1); color: var(--on-dark); quotes: "«" "»" "“" "”"; }
.g-pop q + small { display: block; margin-top: 6px; font-size: 11.5px; color: var(--on-dark-3); }
.g-pop__x { position: absolute; right: 8px; top: 8px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--on-dark-3); }
.g-pop__x:hover { background: rgba(255,255,255,.08); color: #fff; }
.g-pop__x svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
@media (max-width: 900px) { .g-pop { width: min(264px, calc(100vw - 24px)); padding: 12px 14px 13px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}
