/* Дизайн: docs/design/MiniApp.dc.html (вариант А).
   Фон, поверхности и текст — из темы Telegram; свой только оранжевый акцент.
   Запасные значения — для открытия вне Telegram. */
:root {
  color-scheme: light;
  --page: var(--tg-theme-secondary-bg-color, #F1F1F5);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #FFFFFF));
  --text: var(--tg-theme-text-color, #0B0B0C);
  --hint: var(--tg-theme-hint-color, #74747C);
  --sep: var(--tg-theme-section-separator-color, #E3E3E8);
  --error: var(--tg-theme-destructive-text-color, #D92D20);
  --accent: #FF7A1A;
  --accent-press: #E8650A;
  --on-accent: #1A0D00;
  --accent-text: #B85000;
  --accent-soft: #FFF0E3;
  --error-soft: #FDECEA;
  --success: #1A8A4A;
  --success-soft: #E6F6EC;
  --press: #E8E8ED;
  --seg: #DCDCE2;
  --skel: #E4E4EA;
  --disabled: #E4E4EA;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: var(--tg-theme-secondary-bg-color, #101012);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #1C1C1F));
  --text: var(--tg-theme-text-color, #F4F4F5);
  --hint: var(--tg-theme-hint-color, #8E8E96);
  --sep: var(--tg-theme-section-separator-color, #2C2C30);
  --error: var(--tg-theme-destructive-text-color, #FF6B5E);
  --accent-text: #FF9A4D;
  --accent-soft: #33220F;
  --error-soft: #3A1714;
  --success: #3CCF7A;
  --success-soft: #12301F;
  --press: #26262A;
  --seg: #2E2E33;
  --skel: #26262A;
  --disabled: #2A2A2E;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 21px;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden; /* сдвиг при смене экрана не должен давать горизонтальную прокрутку */
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

h1, h2, p { margin: 0; }
button { font-family: inherit; -webkit-tap-highlight-color: transparent; cursor: pointer; }
.pretty { text-wrap: pretty; }

/* --- Значки (вместо аватара персонажа) --- */
.icon {
  flex: none;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; line-height: 1;
}
.icon.sm { width: 28px; height: 28px; font-size: 15px; }
.icon.lg { width: 64px; height: 64px; font-size: 30px; }

.hello {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--card); border-radius: 16px; padding: 14px;
}
.hello-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hello-title { font-weight: 600; font-size: 16px; line-height: 21px; text-wrap: pretty; }
.hello-sub { font-size: 15px; line-height: 20px; text-wrap: pretty; }

/* --- Шаг и прогресс --- */
.step-head { display: flex; flex-direction: column; gap: 8px; }
.step-label { font-size: 13px; line-height: 16px; font-weight: 600; color: var(--hint); }
.segs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.seg { height: 4px; border-radius: 2px; background: var(--seg); transition: background .2s; }
.seg.on { background: var(--accent); }
.question { font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -0.01em; }

/* --- Варианты ответа --- */
.options { display: grid; gap: 8px; }
.cols-1 { grid-template-columns: 1fr; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.tile {
  appearance: none;
  min-height: 52px; padding: 10px 12px;
  border-radius: 14px; border: 1.5px solid transparent;
  background: var(--card); color: var(--text);
  font-size: 15px; line-height: 19px; font-weight: 500;
  text-align: center; text-wrap: balance;
  transition: transform .12s, background .12s;
}
.cols-1 .tile { text-align: left; }
.tile:active { transform: scale(0.97); background: var(--press); }
.tile.selected { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.tile.other { border: 1.5px dashed var(--sep); background: transparent; }
.tile.other.selected { border-color: var(--accent); background: var(--accent-soft); }

/* --- Кнопки --- */
.btn {
  appearance: none; border: 0;
  min-height: 52px; padding: 8px 16px;
  border-radius: 14px;
  background: var(--accent); color: var(--on-accent);
  font-size: 17px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s, background .12s;
}
.btn:active { transform: scale(0.98); background: var(--accent-press); }
.btn:disabled { background: var(--disabled); color: var(--hint); transform: none; cursor: default; }
.btn.sm { min-height: 48px; font-size: 16px; }
.btn.tonal { min-height: 50px; background: var(--accent-soft); color: var(--accent-text); font-size: 16px; font-weight: 600; }
.btn.tonal:active { opacity: .8; }
.btn.outline { background: transparent; border: 1.5px solid var(--sep); color: var(--text); font-weight: 500; }
.btn.outline:active { background: var(--press); }
.btn.plain { min-height: 50px; padding: 8px 10px; background: var(--card); color: var(--text); font-size: 16px; font-weight: 600; }
.btn.plain:active { background: var(--press); }
.btn.cta { min-height: 50px; font-size: 16px; font-weight: 600; }

.link {
  appearance: none; border: 0; background: transparent;
  color: var(--accent-text); font-size: 15px; font-weight: 600;
  min-height: 44px; padding: 0 0 0 8px; flex: none;
}
.link:active { opacity: .5; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Ввод города --- */
.field-wrap { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 15px; line-height: 20px; color: var(--hint); }
.field {
  height: 52px; width: 100%; padding: 0 14px;
  border-radius: 14px; border: 1.5px solid var(--sep);
  background: var(--card); color: var(--text);
  font: inherit; font-size: 17px; outline: none;
  transition: border-color .15s;
}
.field:focus { border-color: var(--accent); }
.field.invalid { border-color: var(--error); }
.field::placeholder { color: var(--hint); }
.error-text { font-size: 14px; line-height: 19px; color: var(--error); text-wrap: pretty; }

/* --- Выдача --- */
.intro { font-size: 17px; line-height: 23px; font-weight: 600; text-wrap: pretty; }
.summary-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: -8px; }
.summary { font-size: 14px; line-height: 19px; color: var(--hint); min-width: 0; text-wrap: pretty; }

.card {
  background: var(--card); border-radius: 18px; padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.chip {
  align-self: flex-start;
  font-size: 12px; line-height: 16px; font-weight: 600;
  padding: 4px 9px; border-radius: 999px;
  background: var(--success-soft); color: var(--success);
}
.v-title { font-size: 18px; line-height: 23px; font-weight: 700; letter-spacing: -0.01em; text-wrap: pretty; }
.comment { font-size: 15px; line-height: 21px; text-wrap: pretty; }

.money {
  background: var(--accent-soft); border-radius: 14px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.money-label {
  font-size: 13px; line-height: 16px; font-weight: 700;
  color: var(--accent-text); text-transform: uppercase; letter-spacing: 0.03em;
}
.money-text { font-size: 15px; line-height: 21px; text-wrap: pretty; }
.money.none { background: transparent; border: 1.5px dashed var(--sep); }
.money.none .money-label, .money.none .money-text { color: var(--hint); }

.req { display: flex; flex-direction: column; gap: 4px; }
.req-label { font-size: 13px; line-height: 16px; font-weight: 600; color: var(--hint); }
.req-text { font-size: 15px; line-height: 21px; text-wrap: pretty; }

.ad {
  font-size: 12px; line-height: 16px; color: var(--hint);
  padding-top: 10px; margin-top: -2px;
  border-top: 0.5px solid var(--sep); text-wrap: pretty;
}

/* --- Подписка --- */
.sub-row { display: flex; gap: 10px; align-items: flex-start; }
.sub-text { font-size: 16px; line-height: 22px; text-wrap: pretty; min-width: 0; }
.sub-text.ask { font-weight: 500; }
.sub-text.muted { color: var(--hint); }
.sub-buttons { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 8px; }
.ok-dot {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--success-soft);
  display: flex; align-items: center; justify-content: center;
}
.ok-dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--success); }

/* --- Низ экрана --- */
.bottom { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }

/* --- Пусто, младше 18, ошибки --- */
.empty-art {
  height: 150px; border-radius: 18px; background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; font-size: 56px;
}
.empty-title { font-size: 20px; line-height: 26px; font-weight: 700; text-wrap: pretty; }
.u18 { padding: 18px; }
.u18-text { font-size: 18px; line-height: 25px; font-weight: 500; text-wrap: pretty; }

.error-screen {
  padding: 32px 8px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center;
}
.error-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--error-soft); color: var(--error);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700;
}
.error-message { font-size: 18px; line-height: 25px; font-weight: 500; text-wrap: balance; max-width: 300px; }
.error-screen .btn { align-self: stretch; padding: 0 24px; }

/* --- Скелетон --- */
.skel { background: var(--skel); border-radius: 7px; }
.skel-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skel-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.skel-tile { height: 52px; border-radius: 14px; }

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