/* Go4Rex, страница тестового звонка.
   Тёмная сцена это разговор, светлая бумага это то, что нужно заполнить. Когда звонит
   телефон, сцена занимает весь экран. Лайм: только действие и голос агента. Лёд: партнёр.
   Шрифт системный: у фирменного Funnel нет кириллицы, а основной язык страницы русский. */
:root {
  color-scheme: light dark;
  --stage: #050506;
  --stage-3: #1c1f21;
  --on-stage: #f3f4ef;
  --on-stage-soft: #cfd1ca;
  --lime: #c9ea0b;
  --lime-hover: #d8f53a;
  --on-lime: #0b0d00;
  --ice: #9cc4f5;
  --red: #d3301c;
  --red-hover: #b92714;

  --paper: #f7f8f5;
  --surface: #ffffff;
  --sunk: #e9ece5;
  --ink: #0b0c0d;
  --ink-soft: #45483f;
  --field: #7d8078;
  --error: #b3261e;
  --ok: #556400;

  --radius: 12px;
  --pill: 999px;
  --pad: 20px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --head-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121415;
    --surface: #1c1f21;
    --sunk: #24282a;
    --ink: #f3f4ef;
    --ink-soft: #cfd1ca;
    --field: #858981;
    --error: #ff9480;
    --ok: #c9ea0b;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--stage); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
h1, h2, p, ul, ol, fieldset, legend { margin: 0; padding: 0; border: 0; }
button, input, textarea { font: inherit; color: inherit; }
button, a, label, summary { touch-action: manipulation; }
button, summary { cursor: pointer; }
.defs { position: absolute; width: 0; height: 0; }
.sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.center { text-align: center; }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.top :focus-visible, .screen-call :focus-visible { outline-color: var(--lime); }
h1:focus, .saved:focus { outline: none; }

/* шапка */
.top {
  position: absolute;
  z-index: 2;
  inset: 0 0 auto;
  height: calc(var(--head-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) calc(var(--pad) - 8px) 0 var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--on-stage);
}
.logo { height: 20px; width: 108px; }
.logo-x { fill: var(--lime); }
.langs { display: flex; }
.langs button {
  min-width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--on-stage-soft);
  font-size: .9375rem;
  font-weight: 600;
}
.langs button:hover { color: var(--on-stage); }
.langs button[aria-pressed="true"] {
  color: var(--on-stage);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

/* экран: сцена + бумага */
.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
}
.head {
  position: relative;
  overflow: hidden;
  background: var(--stage);
  color: var(--on-stage);
  padding: calc(var(--head-h) + env(safe-area-inset-top) + 8px) var(--pad) 24px;
}
.head h1 {
  font-size: 1.875rem;
  line-height: 1.12;
  font-weight: 750;
  letter-spacing: -.025em;
  text-wrap: balance;
  overflow-wrap: break-word;
}
.head p { margin-top: 10px; color: var(--on-stage-soft); text-wrap: pretty; max-width: 34em; }
.body {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 24px var(--pad) calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}
#s-boot { background: var(--stage); }
#s-boot .head { display: grid; place-content: center; min-height: 60vh; text-align: center; }
#s-boot .cross { margin: 0 auto 24px; }
#s-boot h1 { font-size: 1.25rem; letter-spacing: -.01em; }
#s-boot noscript { color: var(--on-stage); text-align: center; }

/* X: две черты, два голоса */
.cross { position: relative; width: 208px; flex: none; }
.cross svg { display: block; width: 100%; overflow: visible; }
.x-track { fill: var(--stage-3); }
.x-gap { fill: var(--stage); }
.x-you { fill: var(--ice); }
.x-agent { fill: var(--lime); }
#xYou, #xAgent { transition: transform .5s var(--ease); }
.x-name { position: absolute; top: -22px; font-size: .9375rem; font-weight: 600; white-space: nowrap; opacity: 0; }
.x-name-you { left: 8%; color: var(--ice); }
.x-name-agent { right: 8%; color: var(--lime); }
[data-screen="mic"] .x-name-you,
[data-screen="talk"] .x-name,
[data-screen="wait"] .x-name { opacity: 1; }
[data-screen="stop"] #xYou, [data-screen="blocked"] #xYou { transform: translateX(-112px); }
[data-screen="stop"] #xAgent, [data-screen="blocked"] #xAgent { transform: translateX(112px); }

/* поля */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -11px 0; }
.field label, .field legend { font-weight: 600; }
.field legend { margin-bottom: 6px; }
input[type="text"], textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--field);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.0625rem;
  appearance: none;
}
textarea { resize: vertical; display: block; min-height: 92px; line-height: 1.4; }
::placeholder { color: var(--ink-soft); opacity: .85; }
input[type="text"]:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
input[aria-invalid="true"] { border-color: var(--error); box-shadow: inset 0 0 0 1px var(--error); }
.err, .alert { color: var(--error); font-size: 1rem; font-weight: 500; }
.hint { color: var(--ink-soft); font-size: .9375rem; text-wrap: balance; }
.hint:empty { display: none; }
.note { padding: 12px 14px; border-radius: var(--radius); background: var(--sunk); font-size: 1rem; text-wrap: pretty; }
.link {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 1rem;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}
.link:hover { text-decoration-thickness: 2px; }

/* выбор языка и оценки: одна и та же деталь */
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { position: relative; flex: 1 1 auto; min-width: 48px; }
.opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.opt span {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--field);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.opt:hover span { border-color: var(--ink); }
.opt input:checked + span, .opt.on span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.opt input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 3px; }

/* кнопки */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 12px 24px;
  border: 1px solid var(--field);
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: background-color .15s, border-color .15s, transform .15s;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: scale(.985); }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn-main { background: var(--lime); border-color: var(--lime); color: var(--on-lime); font-size: 1.1875rem; min-height: 60px; }
.btn-main:hover { background: var(--lime-hover); border-color: var(--lime-hover); }
.btn-ghost { background: none; border-color: transparent; text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.btn-ghost:hover { border-color: transparent; text-decoration-thickness: 2px; }
.btn-light { background: var(--on-stage); border-color: var(--on-stage); color: var(--stage); }
.btn[aria-busy="true"], .round[aria-busy="true"] { opacity: .6; pointer-events: none; }

#s-form .head h1, #s-result .head h1, #s-stop .head h1, #s-blocked .head h1 { max-width: 12.5em; }

/* очередь и микрофон */
#s-mic .head, #s-wait .head { padding-bottom: 28px; text-align: center; }
#s-mic .cross, #s-wait .cross { margin: 32px auto 20px; width: 152px; }
#s-mic .head p, #s-wait .head p { margin-inline: auto; }
.num { display: block; font-size: 4.5rem; line-height: 1; margin-top: 8px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.tips h2, #fb h2 { font-size: 1.1875rem; line-height: 1.3; letter-spacing: -.01em; }
.tips ul { margin-top: 8px; padding-left: 1.2em; display: grid; gap: 6px; }
.tips li::marker { color: var(--ink-soft); }

/* звонок: сцена во весь экран */
.screen-call { background: var(--stage); color: var(--on-stage); }
.screen-call .head { display: flex; flex-direction: column; align-items: center; text-align: center; padding-bottom: 0; }
.screen-call .cross { margin: clamp(32px, 7vh, 72px) 0 clamp(20px, 4vh, 40px); width: min(232px, 30vh); }
.screen-call .body { justify-content: flex-end; gap: clamp(20px, 4vh, 36px); padding-bottom: calc(clamp(24px, 6vh, 56px) + env(safe-area-inset-bottom)); }
.as { text-align: center; color: var(--on-stage-soft); overflow-wrap: anywhere; }
.as strong { color: var(--on-stage); font-weight: 650; }
.timer { font-size: 3.25rem; line-height: 1; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.head .timer { margin: 0; color: var(--on-stage); }
.head .who { font-size: 1.25rem; min-height: 1.45em; }
.who[data-who="agent"] { color: var(--lime); }
.who[data-who="you"] { color: var(--ice); }
.dial { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
.round {
  justify-self: center;
  width: 100%;
  max-width: 180px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--on-stage);
  font-weight: 600;
  line-height: 1.25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  border-radius: 24px;
}
.disc { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; transition: background-color .15s, transform .15s; }
.disc svg { width: 36px; height: 36px; }
.disc svg.down { transform: rotate(135deg); }
.round:active .disc { transform: scale(.95); }
.round-go .disc { background: var(--lime); color: var(--on-lime); }
.round-go:hover .disc { background: var(--lime-hover); }
.round-end .disc { background: var(--red); color: #fff; }
.round-end:hover .disc { background: var(--red-hover); }
.round-mute .disc { background: #303437; color: var(--on-stage); }
.round-mute:hover .disc { background: #42474b; }
.round-mute.off .disc { background: var(--on-stage); color: var(--stage); }
.warn { padding: 16px; border-radius: var(--radius); background: var(--stage-3); display: grid; gap: 12px; text-align: center; }

/* итог */
#fb { display: flex; flex-direction: column; gap: 20px; }
.rate legend { display: flex; width: 100%; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.rate legend b { font-weight: 650; }
.rate legend span { font-weight: 400; color: var(--ink-soft); }
.rate .seg { flex-wrap: nowrap; gap: 6px; }
.rate .opt { flex: 1 1 0; min-width: 44px; }
.rate .opt span { padding: 0; }
.rate + .rate { margin-top: 20px; }
.ends { display: flex; justify-content: space-between; font-size: .9375rem; color: var(--ink-soft); margin-top: 4px; }
.saved { font-size: 1.1875rem; font-weight: 600; color: var(--ok); }
.pair { display: grid; gap: 8px; }

/* инструкция по микрофону */
.bar { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 8px; border-radius: var(--pill); background: var(--sunk); margin-bottom: 20px; }
.bar-icon { position: relative; width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--ink); }
.bar-icon::before, .bar-icon::after { content: ""; position: absolute; background: var(--paper); }
/* десктоп и Android: значок настроек сайта, два ползунка */
.bar-icon::before { left: 9px; top: 13px; width: 18px; height: 2px; box-shadow: 0 9px var(--paper); }
.bar-icon::after { left: 20px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); border: 2px solid var(--paper); box-shadow: none; }
/* iPhone: меню страницы, лист и строки под ним */
.bar[data-os="ios"] .bar-icon::before { left: 9px; top: 9px; width: 18px; height: 11px; border-radius: 3px; background: none; border: 2px solid var(--paper); box-shadow: none; }
.bar[data-os="ios"] .bar-icon::after { left: 9px; top: 23px; width: 18px; height: 2px; border: 0; border-radius: 0; background: var(--paper); box-shadow: 0 4px var(--paper); clip-path: inset(0 0 -6px 0); }
.bar-host { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }
.steps { padding-left: 1.5em; display: grid; gap: 10px; }
.steps li { padding-left: 4px; }
.steps li::marker { font-weight: 700; font-variant-numeric: tabular-nums; }
details { border-top: 1px solid var(--sunk); padding-top: 4px; }
summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; font-weight: 600; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: ""; width: 9px; height: 9px; margin-right: 6px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); }
details[open] summary::after { transform: rotate(225deg); }
details h2 { font-size: 1.0625rem; margin: 16px 0 8px; }
.copy-manual { display: grid; gap: 6px; }

/* телефон: там, где нужно читать и заполнять, X не занимает место */
@media (max-width: 899px) {
  .top, .head { padding-inline: max(var(--pad), calc((100vw - 520px) / 2 + var(--pad))); }
  .top { padding-right: max(calc(var(--pad) - 8px), calc((100vw - 520px) / 2 + var(--pad) - 8px)); }
  #s-form .cross, #s-result .cross, #s-stop .cross, #s-blocked .cross { display: none; }
}

/* невысокий экран (Safari с панелями): главная кнопка и кнопки звонка видны без прокрутки */
@media (max-width: 899px) and (max-height: 700px) {
  :root { --head-h: 56px; }
  #s-form .head { padding-top: calc(var(--head-h) + env(safe-area-inset-top)); padding-bottom: 16px; }
  #s-form .head p { margin-top: 6px; }
  #leadForm { padding-top: 16px; gap: 12px; }
  #leadForm input[type="text"] { min-height: 48px; padding-block: 10px; }
  #leadForm .note { padding-block: 8px; }
  #callMe { min-height: 56px; }
}
@media (max-height: 640px) and (orientation: portrait) {
  .screen-call .cross { width: 20vh; margin-top: 28px; }
  .screen-call .body { gap: 16px; padding-top: 12px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* низкий телефон в горизонтальном положении */
@media (max-height: 560px) and (orientation: landscape) {
  .screen-call .cross { display: none; }
  .screen-call .head { padding-top: calc(var(--head-h) + 4px); }
}

@media (min-width: 900px) {
  :root { --pad: 48px; --head-h: 88px; }
  .top { right: auto; width: 46vw; padding-right: 32px; }
  .logo { height: 24px; width: 130px; }
  .screen { grid-template: 1fr / 46vw 1fr; }
  .head, #s-mic .head, #s-wait .head {
    display: flex;
    flex-direction: column;
    text-align: left;
    padding-top: calc(var(--head-h) + 40px);
    padding-bottom: 56px;
  }
  .head h1 { font-size: clamp(2.25rem, 3.4vw, 3.25rem); line-height: 1.06; letter-spacing: -.035em; max-width: 12em; }
  .head p { margin-top: 16px; font-size: 1.1875rem; max-width: 27em; }
  #s-mic .head p, #s-wait .head p { margin-inline: 0; }
  .head .cross, #s-mic .head .cross, #s-wait .head .cross { order: 1; width: min(24vw, 42vh); margin: auto; }
  #s-stop .head .cross, #s-blocked .head .cross { width: min(16vw, 32vh); }
  .num { font-size: 6rem; }
  /* заголовок слева и поля справа начинаются на одной высоте */
  .body { max-width: 560px; padding: calc(var(--head-h) + 44px) 48px 56px; gap: 20px; }

  .screen-call { grid-template: auto 1fr / 1fr; }
  .screen-call .head { align-items: center; text-align: center; padding-top: var(--head-h); padding-bottom: 0; }
  [data-screen="ring"] .top, [data-screen="talk"] .top { width: 100%; }
  .screen-call .head .cross { order: 0; width: min(300px, 32vh); margin: clamp(24px, 6vh, 72px) 0 clamp(20px, 4vh, 40px); }
  .screen-call .body { align-self: end; padding-top: 24px; }
  .timer { font-size: 4rem; }
  .head .timer { font-size: 4rem; max-width: none; }
  #s-boot { grid-template: 1fr / 1fr; }
  #s-boot .head { align-items: center; justify-content: center; text-align: center; }
  #s-boot .head .cross { order: 0; margin: 0 auto 24px; width: 208px; }
  #s-boot .head h1 { font-size: 1.25rem; letter-spacing: -.01em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
