/* Golden Gate Cup: раскладка «всё на одном экране» вокруг 3D-коробки (макеты One3-* на холсте).
   Компьютер: текст и панели слева, коробка справа. Телефон: коробка сверху, текст снизу,
   панели выезжают снизу. Масштаб всего интерфейса — --ui-scale (считает ui.js). */

[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { color: var(--ink); font-weight: var(--body-weight); overscroll-behavior: none; }
h1, h2, p { margin: 0; }
canvas#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* границы свободной части экрана (ставит ui.js); зарегистрированы, чтобы подсказка и затемнение
   переезжали плавно, когда текст меняет длину (например, при смене языка) */
@property --stage-left { syntax: "<length>"; inherits: true; initial-value: 600px; }
@property --stage-bottom { syntax: "<length>"; inherits: true; initial-value: 500px; }
:root.ui-ready { transition: --stage-left .6s cubic-bezier(.16, 1, .3, 1), --stage-bottom .6s cubic-bezier(.16, 1, .3, 1); }
:root {
  --ui-scale: 1;
  --stage-left: 600px;
  --stage-bottom: 60vh;
  --header-bottom: 80px;
  --stage-cx: 70%;
  --stage-cy: 50%;
  --vignette: 0.85;
  --grain: 0.06;
}

/* ---------- пары шрифтов: выбрана 2 (Poppins + Lora); 1 и 3 — только по ссылке ?font=ubuntu|classic ----------
   Правила для языков действуют и на корень, и на любой элемент со своим lang: так невидимые «мерки»
   заголовка на других языках (ui.js) получают свой шрифт и коробка не сдвигается при смене языка. */
/* 1. Ubuntu + Roboto — одинаково на английском и русском; заголовок — её настройки: 45 px, −1 px */
:root[data-font="ubuntu"] {
  --h1-words: normal;
  --gg-display: Ubuntu, system-ui, sans-serif;
  --gg-ui: Ubuntu, system-ui, sans-serif;
  --font-syne: Ubuntu, system-ui, sans-serif;
  --gg-body: Roboto, system-ui, sans-serif;
  --body-weight: 400;
  --h1-size: 45px; --h1-lh: 1.12; --h1-track: -1px; --h1-weight: 700; --h1-overhang: -17px; --h1-phone: 32px;
  --btn-weight: 500; --btn-track: 0.01em; --title-weight: 500; --num-weight: 500; --first-pct-weight: 700;
  --lead-size: 17px; --lead-lh: 1.6; --lead-phone: 15px;
  --sub-size: 13px; --small-size: 14px; --note-size: 15px; --step-size: 16px;
  --name-size: 15px; --name-small: 13px; --first-name: 17px; --hint-size: 15px;
}
/* 2. Poppins + Lora; у Poppins нет кириллицы — на русском и украинском его заменяет похожий Montserrat */
:root[data-font="poppins"], :root[data-font="poppins"] :lang(en) {
  --h1-words: normal;
  --gg-display: Poppins, system-ui, sans-serif;
  --gg-ui: Poppins, system-ui, sans-serif;
  --font-syne: Poppins, system-ui, sans-serif;
  --gg-body: Lora, Georgia, serif;
  --body-weight: 400;
  --h1-size: 45px; --h1-lh: 1.18; --h1-track: -1px; --h1-weight: 700; --h1-overhang: -64px; --h1-phone: 30px;
  --btn-weight: 600; --btn-track: 0; --title-weight: 600; --num-weight: 600; --first-pct-weight: 700;
  --lead-size: 18px; --lead-lh: 1.55; --lead-phone: 16px;
  --sub-size: 14px; --small-size: 15px; --note-size: 16px; --step-size: 17px;
  --name-size: 16px; --name-small: 14px; --first-name: 18px; --hint-size: 16px;
}
/* её выбор (2026-10-13): на русском и украинском заголовок жирнее (800), в две строки
   («Поддержи Golden Gate Cup» / «и выиграй приз»), буквы плотнее на 1 px, слова ближе друг к другу */
:root[data-font="poppins"]:is(:lang(ru), :lang(uk)), :root[data-font="poppins"] :is(:lang(ru), :lang(uk)) {
  --gg-display: Montserrat, system-ui, sans-serif;
  --gg-ui: Montserrat, system-ui, sans-serif;
  --font-syne: Montserrat, system-ui, sans-serif;
  --h1-lh: 1.15; --h1-weight: 800; --h1-overhang: -140px; --h1-words: -0.12em;
}
/* 3. Исходная: Syne + Cormorant на английском, Unbounded + Cormorant на русском и украинском */
:root[data-font="classic"], :root[data-font="classic"] :lang(en) {
  --h1-words: normal;
  --gg-display: Syne, system-ui, sans-serif;
  --gg-ui: Syne, system-ui, sans-serif;
  --font-syne: Syne, system-ui, sans-serif;
  --gg-body: var(--font-cormorant);
  --body-weight: 500;
  --h1-size: 37px; --h1-lh: 1.12; --h1-track: -0.01em; --h1-weight: 700; --h1-overhang: -24px; --h1-phone: 28px;
  --btn-weight: 700; --btn-track: 0; --title-weight: 700; --num-weight: 700; --first-pct-weight: 700;
  --lead-size: 20px; --lead-lh: 1.45; --lead-phone: 17px;
  --sub-size: 15px; --small-size: 17px; --note-size: 17px; --step-size: 18px;
  --name-size: 17px; --name-small: 15px; --first-name: 20px; --hint-size: 17px;
}
:root[data-font="classic"]:is(:lang(ru), :lang(uk)), :root[data-font="classic"] :is(:lang(ru), :lang(uk)) {
  --gg-display: var(--font-unbounded);
  --gg-ui: var(--font-unbounded);
  --font-syne: var(--font-unbounded);
  --h1-size: 38px; --h1-track: -0.02em; --h1-weight: 800; --h1-overhang: 0px; --h1-phone: 26px;
  --title-weight: 600; --first-pct-weight: 800;
}

/* ---------- фон и слои над сценой ---------- */
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse 72% 68% at var(--stage-cx) var(--stage-cy), rgba(0, 0, 0, 0) 38%, rgba(0, 0, 0, var(--vignette)) 100%);
}
/* затемнение под текстом: слева на компьютере, снизу на телефоне */
.shade {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(90deg, rgba(8, 1, 2, 0.9) 0, rgba(8, 1, 2, 0.62) 38%, rgba(8, 1, 2, 0) 52%);
}
.grain {
  position: fixed; inset: -50%; pointer-events: none; z-index: 30; opacity: var(--grain); mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.9s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}
.loader {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; pointer-events: none;
  font: 600 13px/1 var(--gg-ui); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-muted);
  transition: opacity .8s ease;
}
.loader.done { opacity: 0; }

/* ---------- шапка ---------- */
.site-hdr {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5; zoom: var(--ui-scale);
  height: 80px; padding: 0 64px; display: flex; align-items: center; justify-content: space-between;
  pointer-events: none;
}
.site-hdr > * { pointer-events: auto; }
.site-hdr .gg-lockup__mark { width: 64px; }
.site-hdr .gg-lockup__name { font-weight: var(--title-weight); }
.site-hdr .gg-lockup__sub { font-size: var(--sub-size); }
/* переключатель языка: светлая «таблетка» переезжает под выбранный язык (позицию ставит ui.js) */
.gg-lang { position: relative; isolation: isolate; }
.gg-lang button { position: relative; z-index: 1; font-weight: var(--num-weight); transition: color .35s ease; }
.gg-lang button[aria-pressed="true"] { background: transparent; color: var(--on-bone); }
.gg-lang button:not([aria-pressed="true"]):hover { color: var(--ink); }
.lang-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; z-index: 0;
  border-radius: var(--radius-full); background: var(--bone);
  transition: transform .45s cubic-bezier(.16, 1, .3, 1), width .45s cubic-bezier(.16, 1, .3, 1);
}
.lil-gui.autoPlace { top: 84px !important; max-height: calc(100% - 96px) !important; }

/* смена языка: текст гаснет, меняется невидимым и проявляется снова — без прыжков */
.stage-ui, .site-hdr .gg-lockup__sub { transition: opacity .3s ease; }
body.lang-out .stage-ui, body.lang-out .site-hdr .gg-lockup__sub, body.lang-out .hint { opacity: 0 !important; transition-duration: .2s; }

/* ---------- левая колонка (компьютер) ---------- */
.stage-ui {
  position: fixed; left: 64px; top: 116px; width: 520px; z-index: 4; zoom: var(--ui-scale);
  display: flex; flex-direction: column; gap: 18px; max-height: var(--stage-max, none);
}
.stage-ui > * { flex-shrink: 0; }
.hero-title {
  margin-right: var(--h1-overhang);
  font-size: var(--h1-size); line-height: var(--h1-lh); letter-spacing: var(--h1-track); font-weight: var(--h1-weight);
  word-spacing: var(--h1-words, normal);
}
/* первая строка заголовка — целиком («Support Golden Gate Cup»); по-русски так только у Montserrat,
   у остальных пар русская строка шире колонки */
.hero-title .keep { white-space: nowrap; }
/* невидимые копии заголовка на всех языках — по ним ui.js ставит коробку правее самого длинного */
.title-probe { position: absolute; top: 0; left: 0; right: 0; visibility: hidden; pointer-events: none; }
:root:is(:lang(ru), :lang(uk)):not([data-font="poppins"]) .hero-title .keep { white-space: normal; }
.gold { white-space: nowrap; }
.lead { font-size: var(--lead-size); line-height: var(--lead-lh); color: var(--ink-muted); }
.cta { display: flex; align-items: center; gap: 16px; margin: 4px 0 40px; }
.gg-btn { font-weight: var(--btn-weight); letter-spacing: var(--btn-track); }
.gg-title { font-weight: var(--title-weight); }
.gg-small { font-size: var(--small-size); }
.only-phone { display: none; }
/* следующий шаг светится: после «Участвовать» ободок уходит с кнопки на «Откуда ты?» */
body[data-panel="region"] .cta-main::before, body[data-panel="region"] .cta-main::after { display: none; }
/* на компьютере открытая панель встаёт на место топа */
body:not([data-panel="top"]) .top-panel { display: none; }

/* топ участников */
.top-panel { display: flex; flex-direction: column; gap: 14px; padding: 20px 24px; }
.top-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.goal { font-size: var(--small-size); line-height: 1.4; color: var(--ink-muted); }
.goal b { color: var(--ink); font-weight: 600; }
.lb { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.lb li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 32px; }
.lb .crown { display: block; width: 28px; height: 28px; margin: 0 auto; fill: var(--signal); }
.lb-rank { font: var(--num-weight) 15px/1 var(--font-syne); color: var(--ink-muted); text-align: center; }
.lb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--name-size); color: var(--ink); }
.lb-name small { margin-left: 8px; font-size: var(--name-small); color: var(--ink-muted); }
.lb-pct { font: var(--num-weight) 16px/1 var(--font-syne); color: var(--ink); font-variant-numeric: tabular-nums; }
.lb .lb-first { min-height: 56px; margin: 0 -12px 6px; padding: 0 12px; border-radius: 14px; background: var(--glass-fill-strong); }
.lb-first .lb-name { font-size: var(--first-name); }
.lb-first .lb-pct { font-size: 26px; font-weight: var(--first-pct-weight); }
.top-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* панели: «Откуда ты?», правила, все участники */
.panel { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 22px 24px 24px; animation: panel-in .35s cubic-bezier(.16, 1, .3, 1); }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } }
.panel-head p { margin-top: 4px; }
.panel-close {
  position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border: 0; border-radius: var(--radius-full);
  background: none; color: var(--ink-muted); font: 400 26px/1 system-ui, sans-serif; cursor: pointer;
}
.panel-close:hover { color: var(--ink); }
.panel-close:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.grab { display: none; }
.panel-note { font-size: var(--note-size); line-height: 1.45; color: var(--ink-muted); }
.panel-note b { color: var(--ink); font-weight: 600; }
.tg { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--control-line); text-underline-offset: 3px; }
.tg:hover { text-decoration-color: var(--signal); }

.regions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.reg {
  display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 20px;
  border: 1px solid var(--control-line); border-radius: 18px; background: var(--glass-fill-strong);
  color: var(--ink); text-decoration: none; transition: border-color .2s ease, transform .2s cubic-bezier(.16, 1, .3, 1);
}
.reg:hover { border-color: var(--bone); transform: translateY(-1px); }
.reg:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.reg-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.reg b { display: block; font: var(--btn-weight) 20px/1.2 var(--font-syne); }
.reg small { display: block; margin-top: 4px; font-size: var(--sub-size); color: var(--ink-muted); }
.reg-arrow { flex: none; width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.qr { display: block; width: 104px; height: 104px; padding: 8px; border-radius: 12px; background: var(--bone); }

.rules-panel { gap: 12px; padding: 20px 24px 22px; }
.steps { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.step { display: grid; grid-template-columns: 60px minmax(0, 1fr); align-items: center; gap: 14px; }
.step-tile { display: grid; place-items: center; width: 60px; height: 56px; border-radius: 14px; background: var(--bone); }
.step img { display: block; width: 48px; height: auto; }
.step p { font-size: var(--step-size); line-height: 1.35; }

.stage-ui > .all-panel { flex-shrink: 1; min-height: 0; }
.all-panel .lb {
  min-height: 0; overflow-y: auto; padding: 0 6px 18px 0; margin-right: -6px; scrollbar-width: thin; scrollbar-color: var(--glass-line) transparent;
  /* низ списка мягко гаснет: видно, что дальше ещё есть строки */
  -webkit-mask-image: linear-gradient(#000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(#000 calc(100% - 40px), transparent);
}
.all-panel .lb .lb-first { margin: 0 0 6px; }

/* подсказка под коробкой */
.hint {
  position: fixed; left: var(--stage-left); right: 0; bottom: calc(78px * var(--ui-scale)); z-index: 3;
  padding: 0 24px; text-align: center; pointer-events: none;
  font-size: calc(var(--hint-size) * var(--ui-scale)); line-height: 1.4; color: var(--ink-muted);
  text-wrap: balance; transition: opacity .6s ease;
}

/* ================== ТЕЛЕФОН ================== */
@media (max-width: 819px), (max-aspect-ratio: 9/10) {
  .shade {
    background: linear-gradient(180deg, rgba(8, 1, 2, 0) calc(var(--stage-bottom) - 50px),
      rgba(8, 1, 2, 0.75) calc(var(--stage-bottom) + 52px), #080102 calc(var(--stage-bottom) + 187px));
  }
  .site-hdr { height: 64px; padding: 0 16px; }
  .site-hdr .gg-lockup { gap: 10px; }
  .site-hdr .gg-lockup__mark { width: 44px; }
  .site-hdr .gg-lockup__name { font-size: 14px; }
  .site-hdr .gg-lockup__sub { font-size: 13px; white-space: nowrap; }
  .gg-lang button { min-width: 36px; height: 30px; padding: 0 6px; }

  .stage-ui { left: 16px; right: 16px; top: auto; bottom: 20px; width: auto; max-width: 520px; max-height: none; margin: 0 auto; gap: 12px; }
  .hero-title { margin-right: 0; font-size: var(--h1-phone); line-height: 1.15; letter-spacing: -0.01em; }
  .hero-title .keep { white-space: normal; }
  .lead { font-size: var(--lead-phone); line-height: 1.4; }
  .cta { display: contents; }
  /* её порядок (с холста): главная кнопка, «Правила», потом топ */
  .cta-main { order: 3; width: 100%; }
  .cta-rules { order: 4; width: 100%; min-height: 48px; }
  .top-panel { order: 5; }
  .only-desk { display: none; }
  .only-phone { display: revert; }

  /* мини-топ: три строки */
  .top-panel { gap: 10px; padding: 12px 14px; border-radius: var(--radius-md); }
  .top-head .gg-title { font-size: 15px; }
  .top-panel .lb li:nth-child(n+4) { display: none; }
  .lb { gap: 2px; }
  .lb li { grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; min-height: 26px; }
  .lb .crown { width: 20px; height: 20px; }
  .lb-rank { font-size: 13px; }
  .lb-pct { font-size: 15px; }
  .lb .lb-first { min-height: 36px; margin: 0 -8px 2px; padding: 0 8px; border-radius: 10px; }
  .lb-first .lb-pct { font-size: 18px; }
  .lb-name { font-size: calc(var(--name-size) - 1px); }
  .lb-name small { margin-left: 6px; font-size: calc(var(--name-small) - 1px); }
  .lb-first .lb-name { font-size: calc(var(--first-name) - 3px); }

  /* панели — снизу, поверх текста; текст под ними прячем, а затемнение убираем —
     сквозь стекло панели видна красная студия, как на макете */
  .shade { transition: opacity .35s ease; }
  body:not([data-panel="top"]) .shade { opacity: 0; }
  body:not([data-panel="top"]) .top-panel { display: flex; }
  body:not([data-panel="top"]) .stage-ui > :not(.panel) { visibility: hidden; }
  .panel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; max-height: 86vh; overflow-y: auto;
    gap: 14px; padding: 6px 16px 24px; border-bottom: 0; border-radius: 24px 24px 0 0;
    background: var(--glass-shade); box-shadow: inset 0 1px 0 #ffffff33, 0 -24px 48px -16px #050001e6;
    /* выезжает снизу целиком; уезжает вниз при закрытии (.sheet-out) и тянется за пальцем (.dragging) */
    animation: sheet-in .42s cubic-bezier(.16, 1, .3, 1);
    transition: transform .32s cubic-bezier(.16, 1, .3, 1);
    overscroll-behavior: contain;
  }
  @keyframes sheet-in { from { transform: translateY(100%); } }
  .panel.dragging { transition: none; }
  .panel.sheet-out { transform: translateY(105%); transition: transform .28s cubic-bezier(.4, 0, 1, 1); }
  /* полоска сверху: за неё можно потянуть вниз или нажать — окно закроется */
  .grab { position: relative; display: block; width: 40px; height: 4px; margin: 14px auto 6px; border-radius: 999px; background: var(--control-line); cursor: pointer; }
  .grab::before { content: ""; position: absolute; inset: -16px -80px; }
  .panel-close { top: 4px; right: 6px; }
  .panel .gg-title { font-size: 22px; }
  .regions { grid-template-columns: 1fr; }
  .reg { flex-direction: row; align-items: center; min-height: 72px; padding: 0 18px; }
  .reg-top { flex: 1; align-items: center; }
  .reg b { font-size: 19px; }
  .qr { display: none; }
  .all-panel .lb { max-height: none; overflow: visible; -webkit-mask-image: none; mask-image: none; }
  .all-panel .lb li:nth-child(n+4) { display: grid; }

  .hint {
    left: 16px; right: 16px; bottom: auto; top: calc(var(--stage-bottom) - 44px); padding: 0;
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .panel { animation: none; transition: none; }
}
