/* Веб-анкета: сначала телефон, потом всё остальное */
:root {
  --brand: #4F46E5;
  --bg: #f4f5f9;
  --card: #ffffff;
  --text: #1c1f2a;
  --muted: #6b7083;
  --line: #e3e5ee;
  --option: #f7f8fb;
  --option-hover: #eef0f7;
  --danger: #c2372c;
  --danger-bg: #fdecea;
  --notice-bg: #eef7ee;
  --notice: #25693a;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(20, 24, 40, .06);
  --link: var(--brand);
}
:root.tg-dark {
  --line: #3a3f4d; --option-hover: color-mix(in srgb, var(--option) 85%, #ffffff);
  --danger-bg: #3a1d1b; --danger: #ff8a7f; --notice-bg: #1d3324; --notice: #8fd6a3; --shadow: none;
  --link: color-mix(in srgb, var(--brand) 55%, #ffffff);
}
@media (prefers-color-scheme: dark) {
  :root:not(.tg) {
    --bg: #12141b; --card: #1b1e27; --text: #eceef4; --muted: #9aa0b4; --line: #2c303d;
    --option: #232733; --option-hover: #2a2f3d; --danger-bg: #3a1d1b; --danger: #ff8a7f;
    --notice-bg: #1d3324; --notice: #8fd6a3; --shadow: none;
    --link: color-mix(in srgb, var(--brand) 55%, #ffffff);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.app { max-width: 600px; margin: 0 auto; padding: 12px 16px 24px; min-height: 100dvh; display: flex; flex-direction: column; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; min-width: 0; }
.logo { height: 32px; width: auto; border-radius: 8px; }
.studio { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0 14px; }
.progress-bar { height: 100%; width: 0; background: var(--brand); border-radius: 99px; transition: width .35s ease; }

.card {
  background: var(--card); border-radius: 20px; box-shadow: var(--shadow);
  padding: 22px 18px 18px; display: flex; flex-direction: column; min-height: 260px;
}
.screen { display: flex; flex-direction: column; gap: 14px; flex: 1; animation: enter .28s ease both; }
.screen.leave { animation: leave .14s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes leave { to { opacity: 0; transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .screen, .screen.leave { animation: none; } .progress-bar { transition: none; } }

.intro { color: var(--muted); }
.title { font-size: 21px; line-height: 1.3; font-weight: 700; margin: 0; }
.title.plain { font-size: 18px; font-weight: 500; }
.caption { color: var(--muted); font-size: 15px; margin-top: -6px; }
.rich a, .caption a { color: var(--link); }
.rich p { margin: 0 0 .6em; }
.text-block { white-space: pre-line; }

.alert { border-radius: 12px; padding: 10px 14px; font-size: 15px; }
.alert.error { background: var(--danger-bg); color: var(--danger); }
.alert.notice { background: var(--notice-bg); color: var(--notice); }

.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  width: 100%; text-align: left; border: 1.5px solid var(--line); background: var(--option); color: var(--text);
  border-radius: var(--radius); padding: 14px 16px; font: inherit; cursor: pointer; display: flex; align-items: center;
  gap: 12px; min-height: 52px; transition: border-color .15s, background .15s, transform .05s;
}
.opt:active { transform: scale(.99); }
.opt:focus-visible, .btn:focus-visible, .field:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 40%, transparent); outline-offset: 2px; }
.opt.selected { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 9%, var(--card)); }
.opt .mark {
  flex: 0 0 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); display: grid; place-items: center;
  font-size: 14px; color: #fff; transition: background .15s, border-color .15s;
}
.opt.radio .mark { border-radius: 50%; }
.opt.selected .mark { background: var(--brand); border-color: var(--brand); }
.opt.selected .mark::after { content: "✓"; font-weight: 700; }
.opt .label { flex: 1; }
.opt .badge { font-size: 13px; color: var(--brand); font-weight: 600; }
.opt.secondary { background: transparent; }

.field {
  width: 100%; border: 1.5px solid var(--line); background: var(--option); color: var(--text); border-radius: var(--radius);
  padding: 14px 16px; font: inherit; font-size: 17px;
}
textarea.field { min-height: 120px; resize: vertical; }
.field:focus { border-color: var(--brand); outline: none; background: var(--card); }
.hint { color: var(--muted); font-size: 14px; }

.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; padding: 6px 0; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--brand); flex: 0 0 auto; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.examples { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 520px) { .examples { grid-template-columns: 1fr 1fr; } }
.example { border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--option); display: flex; flex-direction: column; }
.example img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; background: var(--line); }
.example .ph { aspect-ratio: 16 / 10; display: grid; place-items: center; font-size: 34px; background: color-mix(in srgb, var(--brand) 10%, var(--option)); }
.example .body { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.example a { color: var(--link); font-size: 14px; text-decoration: none; }

.nav { display: flex; gap: 10px; padding-top: 6px; }
.btn {
  border: 0; border-radius: var(--radius); padding: 14px 18px; font: inherit; font-weight: 600; cursor: pointer; min-height: 52px;
}
.btn.primary { background: var(--brand); color: #fff; flex: 1; }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--option); color: var(--text); }
.link { background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; padding: 6px 0; }

.file-box { border: 2px dashed var(--line); border-radius: var(--radius); padding: 18px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.file-box .name { font-weight: 600; word-break: break-all; }

.loading { flex: 1; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (hover: hover) {
  .opt:hover { background: var(--option-hover); }
  .btn.ghost:hover { background: var(--option-hover); }
  .link:hover { color: var(--text); }
}
.opt:active { background: var(--option-hover); }
.busy .card { pointer-events: none; }
.busy .screen { opacity: .65; transition: opacity .2s .15s; }

.done-icon { font-size: 52px; line-height: 1; }
.foot { margin-top: auto; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 13px; padding: 16px 0 4px; }
.foot a { color: var(--muted); }

@media (min-width: 640px) {
  .app { padding-top: 32px; }
  .card { padding: 30px 30px 24px; }
  .title { font-size: 24px; }
}
