/* КИТиС — общие стили (страницы 2–7)
   Структура: переменные → база → фон/подвал/лого → окна → формы → кнопки →
   страница 5 (загрузка фото) → страница 6 (анализ) → страница 7 → адаптив */

@font-face {
  font-family: 'AGBengaly';
  src: url('assets/AGBengaly.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* =============== Переменные =============== */

:root {
  --blue: #6d83b6;
  --blue-soft: #dbe2ef;
  --blue-line: #c7d2e8;
  --bg-soft: #f6f8fb;
  --ink: #0f172a;
  --text: #111;
  --muted: #1e293b;

  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-brand: "AGBengaly", "Inter", system-ui, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;

  --footer-h: 80px;
  --gutter: clamp(20px, 6vw, 32px);
  --radius-pill: 35px;
  --card-w: 440px;
  --app-w: 480px;      /* только мобильная версия: на широких экранах колонка по центру */
}

/* =============== База =============== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  min-height: 100%;
  background: #eef2f8;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: transparent;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

img { display: block; max-width: 100%; }
button, input { font: inherit; border: none; background: none; color: inherit; }
button, a { cursor: pointer; }
a { color: inherit; text-decoration: none; }
input { user-select: text; -webkit-user-select: text; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Страница: колонка на всю высоту экрана, место под фиксированный подвал */
.page {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: var(--app-w);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: var(--footer-h);
  background: #fff;
  isolation: isolate;
}

.page--soft { background: var(--bg-soft); }

/* =============== Фон (волны) =============== */

.fon {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  z-index: -1;
  width: 100%;
  max-width: var(--app-w);
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.fon-wave {
  filter: url(#waterFilter);
  transform-origin: center;
  will-change: transform;
  animation: waveMove 14s ease-in-out infinite alternate;
}

@keyframes waveMove {
  0%   { transform: scale(1.06) translate(0, 0); }
  25%  { transform: scale(1.08) translate(-1%, 0.5%); }
  50%  { transform: scale(1.07) translate(0.5%, -1%); }
  75%  { transform: scale(1.09) translate(-0.5%, 0.5%); }
  100% { transform: scale(1.06) translate(0, 0); }
}

/* =============== Логотип и подвал =============== */

.imya {
  align-self: stretch;
  padding: 23px var(--gutter) 0;
  font-family: var(--font-brand);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
}

.podval {
  position: fixed;
  left: 0;
  right: 0;
  margin: 0 auto;
  bottom: 0;
  z-index: 55;
  max-width: var(--app-w);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--footer-h);
  padding: 10px var(--gutter);
  background: var(--blue-soft);
}

.podval p {
  font-size: 12px;
  line-height: 1.3;
  color: var(--muted);
  white-space: pre-line;
}

.podval p:first-child { text-align: left; }
.podval p:last-child  { text-align: right; }

/* Появление после заставки (управляется js/app.js) */
[data-delayed] { transition: opacity 1.2s ease-out; }
.js [data-delayed] { opacity: 0; }
.js [data-delayed].is-visible { opacity: 1; }

/* =============== Логотип-заставка (страница 3) =============== */

.logo-splash {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 20;
  width: 216px;
  max-width: 70vw;
  height: auto;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: logoSplashPulse 2s ease-in-out infinite;
}

@keyframes logoSplashPulse {
  0%   { transform: translate(-50%, -50%) scale(1); }
  25%  { transform: translate(-50%, -50%) scale(1.08); }
  50%  { transform: translate(-50%, -50%) scale(0.96); }
  75%  { transform: translate(-50%, -50%) scale(1.05); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* =============== Окно с формой (страницы 2, 3) =============== */

.okno {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: auto 0 0;               /* прижато к подвалу, на широких экранах — по центру */
  padding: 24px 0;
  background: var(--bg-soft);
  border-radius: var(--radius-pill) var(--radius-pill) 0 0;
}

.forma {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  width: 100%;
  max-width: var(--card-w);
  padding: 0 var(--gutter);
}

.zagolovok {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.pole { position: relative; display: flex; flex-direction: column; }

.pole input {
  width: 100%;
  padding: 12px 18px;
  background: var(--blue-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 16px;               /* 16px — чтобы iOS не зумил страницу при фокусе */
  line-height: 1.5;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

.pole--parol input { padding-right: 52px; }

.pole input:focus { border-color: var(--blue); outline: none; }

/* Ошибка: плейсхолдер скрывается, поле «трясётся», текст краснеет */
input.has-error::placeholder,
input:focus::placeholder { color: transparent; opacity: 0; transition: opacity 300ms ease; }

.pole.shake { animation: shake 400ms ease-in-out; }
.pole.shake input { color: #dc2626; }

@keyframes shake {
  0%   { transform: translateX(0); }
  15%  { transform: translateX(-6px); }
  30%  { transform: translateX(6px); }
  45%  { transform: translateX(-4px); }
  60%  { transform: translateX(4px); }
  75%  { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

/* Убираем встроенные кнопки браузеров в полях */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear { display: none; }
input[type="password"]::-webkit-credentials-auto-fill-button,
input[type="password"]::-webkit-contacts-auto-fill-button { display: none !important; visibility: hidden; pointer-events: none; }

.eye-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #64748b;
  transition: color 200ms ease;
}
.eye-btn:hover { color: var(--blue); }
.eye-btn svg { display: block; pointer-events: none; }

.form-row {
  display: flex;
  gap: 12px;
}

.form-row > * { flex: 1 1 0; min-width: 0; }

/* =============== Кнопки =============== */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-brand);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  transition: filter 150ms ease, transform 150ms ease;
}

.btn:active { filter: brightness(0.85); }

.btn--primary { background: var(--blue); color: #fff; }
.btn--ghost   { background: #fff; color: var(--text); border-color: var(--text); }

.btn--link {
  min-height: 0;
  padding: 4px 0;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 400;
}

.btn--wide { width: 70%; max-width: 320px; align-self: center; min-height: 52px; font-size: 17px; }

/* =============== Страница 4 (заглушка) =============== */

.page--stub { justify-content: center; }
.page--stub .btn { width: min(320px, calc(100% - 2 * var(--gutter))); }

/* =============== Страницы 5–6: «окно» с прогрессом =============== */

.okno--flow {
  align-items: stretch;
  margin: 0;
  padding: 30px var(--gutter) 22px;
  background: #fff;
  border-radius: 0 0 var(--radius-pill) var(--radius-pill);
  overflow: hidden;               /* волна не вылезает за скругления */
}

.okno--clear { background: transparent; border-radius: 0; padding-bottom: 40px; overflow: visible; }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
}

.header .imya { padding: 0; font-size: 17px; line-height: 1; }

.burger {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 18px;
  padding: 0;
  transition: transform 150ms ease;
}
.burger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: background-color 200ms ease;
}
.burger:active { transform: scale(0.92); }
.burger:active span { background: #555; }

.progress {
  position: relative;
  display: flex;
  gap: 8px;
  margin-top: 22px;
}

.step {
  flex: 1 1 0;
  height: 5px;
  border-radius: 3px;
  background: var(--blue-line);
}

.step-indicator {
  position: absolute;
  left: 0;
  top: 0;
  width: calc((100% - 24px) / 4);
  height: 5px;
  border-radius: 3px;
  background: var(--blue);
  transition: transform 500ms cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}
.step-indicator.step-2 { transform: translateX(calc(100% + 8px)); }
.step-indicator.step-3 { transform: translateX(calc((100% + 8px) * 2)); }

.nazad {
  align-self: flex-start;
  margin-top: 28px;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 200ms ease;
}
.nazad:active { opacity: 0.5; }

.zagolovok-flow {
  margin-top: 28px;
  font-family: var(--font-serif);
  font-size: clamp(28px, 8.5vw, 34px);
  font-weight: 400;
  line-height: 1.15;
  color: var(--ink);
  text-align: left;
}

.opisanie {
  margin-top: 22px;
  font-size: 15px;
  line-height: 1.4;
}

.snoska {
  margin-top: 22px;
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
}

/* ---------- Шаги на странице 5 ---------- */

.shag { position: relative; isolation: isolate; display: none; flex-direction: column; }

.okno[data-step="choose"]   .shag--choose,
.okno[data-step="personal"] .shag--personal,
.okno[data-step="pair1"]    .shag--pair1,
.okno[data-step="pair2"]    .shag--pair2 {
  display: flex;
  animation: shagIn 400ms ease both;
}

@keyframes shagIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.shag--choose .btn--wide:first-of-type { margin-top: 40px; }
.shag--choose .btn--wide + .btn--wide  { margin-top: 16px; }

/* Блок загрузки + волна позади него */
.upload-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  margin-top: 24px;
}

.upload-stage > .btn { margin-top: 22px; width: 90%; max-width: 340px; align-self: center; font-size: 16px; padding: 0 16px; }

.upload-body {
  border-radius: 18px;
  overflow: hidden;
}

.upload-image { width: 100%; height: auto; pointer-events: none; }

/* PNG с волной (assets/water-effect.png): центрируется за карточкой и кнопкой */
.volna {
  position: absolute;
  left: 50%;
  top: 56%;
  z-index: -1;
  width: 150%;
  max-width: none;
  height: auto;
  transform: translate(-50%, -50%);
  pointer-events: none;
  user-select: none;
}

.upload-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 20px;
  background: var(--blue-soft);
  border-radius: 18px;
}
.upload-done p { font-size: 14px; line-height: 1.3; text-align: center; }
.upload-done .btn { width: 100%; max-width: 320px; margin-top: 6px; min-height: 48px; font-size: 16px; }

/* ---------- Страница 6: анализ ---------- */

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 60px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--blue-line);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading h2 {
  margin-top: 22px;
  font-family: var(--font-serif);
  font-size: clamp(26px, 8vw, 30px);
  font-weight: 400;
  line-height: 1.15;
  color: var(--ink);
  text-align: center;
}

.loading .podska { margin-top: 8px; font-size: 14px; line-height: 1.4; text-align: center; }

.loading .tsitata {
  margin-top: 50px;
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.4;
  text-align: center;
}

.stages {
  align-self: center;
  list-style: none;
  margin-top: 56px;
  padding: 0;
}

.stage {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  line-height: 1.4;
  opacity: 0;
  transition: opacity 400ms ease;
}
.stage + .stage { margin-top: 32px; }
.stage.done { opacity: 1; }

.check {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-top: 3px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") center / contain no-repeat;
  opacity: 0.4;
  transition: opacity 400ms ease;
}
.stage.done .check { opacity: 1; }

/* =============== Страница 7 =============== */

.page--center { justify-content: center; }

.zagolovok-7 {
  padding: 0 var(--gutter);
  font-family: var(--font-serif);
  font-size: clamp(32px, 9vw, 40px);
  font-weight: 400;
  line-height: 1.15;
  color: var(--ink);
  text-align: center;
}

/* =============== Адаптив =============== */

/* Низкие экраны (телефон в альбомной ориентации и т.п.) — компактнее */
@media (max-height: 700px) {
  .okno { padding-block: 18px; }
  .forma { gap: 12px; }
  .pole input { padding-top: 10px; padding-bottom: 10px; }
  .btn { min-height: 44px; }
  .btn--wide { min-height: 46px; font-size: 16px; }
  .okno--flow { padding-top: 22px; padding-bottom: 18px; }
  .okno--clear { padding-bottom: 24px; }
  .nazad, .zagolovok-flow, .opisanie, .snoska { margin-top: 18px; }
  .loading { margin-top: 36px; }
  .loading .tsitata, .stages { margin-top: 32px; }
}

/* Очень узкие экраны */
@media (max-width: 340px) {
  .form-row { flex-direction: column; }
  .btn--wide { width: 100%; }
}

/* Уважаем системную настройку «меньше движения» */
@media (prefers-reduced-motion: reduce) {
  .fon-wave, .logo-splash { animation: none; }
  .step-indicator, .stage, [data-delayed] { transition: none; }
}

/* =============== Страницы результата (7, 7-pair) =============== */

.page--result { padding-bottom: 0; }

.okno--result {
  flex: 1 0 auto;
  margin-top: 0;
  padding-top: 90px; /* Уменьшили отступ, так как шапка стала ниже */
  padding-bottom: 32px;
  border-radius: 28px 28px 0 0; /* Вернули скругление верхним углам белого окна */
  overflow: visible;
  animation: sheetUp 900ms cubic-bezier(0.22, 0.8, 0.24, 1) 150ms both;
}

@keyframes sheetUp {
  from { transform: translateY(100vh); }
  to   { transform: none; }
}

.step-indicator.step-4 { transform: translateX(calc((100% + 8px) * 3)); }

.podval--static { position: static; margin: 0 auto; width: 100%; }

/* Серые пустые рамки — сюда позже подставятся фото, оттенки и т.п. (data-slot) */
.ph { display: block; background: #d9d9d9; border-radius: 20px; }
.ph--round { width: 48px; height: 48px; border-radius: 50%; flex: 0 0 auto; }
.ph--thumb { width: 78px; height: 78px; flex: 0 0 auto; }

.rez-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.rez-title .zagolovok-flow { flex: 1 1 auto; min-width: 0; margin-top: 28px; }
.rez-thumbs { display: flex; gap: 10px; margin-top: 28px; }

.rez-h {
  margin-top: 28px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text);
}
.rez-h--light { font-weight: 400; }
.rez-sub { margin-top: 6px; font-size: 16px; line-height: 1.3; }

.palette {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
  list-style: none;
  padding: 0;
}
.swatch { display: flex; flex-direction: column; min-width: 0; }
.swatch .ph { width: 100%; aspect-ratio: 1; }
.swatch-name { margin-top: 8px; font-size: 14px; line-height: 1.2; }
.swatch-code { margin-top: 6px; font-size: 12px; line-height: 1.2; }

.combos { display: flex; justify-content: space-around; gap: 12px; margin-top: 12px; }
.combo { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.combo-frame { display: flex; gap: 4px; padding: 5px; background: #d9d9d9; border-radius: 14px; border: none; }
.combo-cell { 
  width: 32px; 
  height: 36px; 
  border-radius: 8px; 
  border: 2px solid transparent;
}
.combo figcaption { font-size: 14px; line-height: 1.2; }

.features { list-style: none; padding: 0 0 0 clamp(8px, 9vw, 40px); margin-top: 16px; }
.feature { display: flex; align-items: center; gap: 18px; }
.feature + .feature { margin-top: 24px; }
.feature-title { font-size: 16px; line-height: 1.3; }
.feature-value { margin-top: 2px; font-size: 14px; line-height: 1.3; }
.hint-i { font-size: 11px; color: #9aa3b2; vertical-align: middle; }

.info-card {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  min-height: 150px;
  margin-top: 28px;
  padding: 18px 20px;
  background: var(--blue-soft);
  border-radius: 28px;
}
.info-dot { flex: 0 0 auto; width: 48px; height: 48px; background: #888; border-radius: 50%; }
.ph {
  /* border: 3px solid transparent; */
  background:
    linear-gradient(#d9d9d9, #d9d9d9) padding-box,
    linear-gradient(135deg, #6d83b6 0%, #a8c4e8 50%, #6d83b6 100%) border-box;
  box-shadow: none;
  box-sizing: border-box;
}
.info-dot {
  /* border: 2px solid transparent; */
  background:
    linear-gradient(#888, #888) padding-box,
    linear-gradient(135deg, #6d83b6 0%, #a8c4e8 50%, #6d83b6 100%) border-box;
}
.info-card p { font-size: 13px; line-height: 1.35; }

.wallpapers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.ph--wall { width: 100%; aspect-ratio: 9 / 16; border-radius: 14px; padding: 0; }
.wall-note { 
  grid-column: 3 / 5;
  align-self: center;
  font-size: 15px; 
  line-height: 1.35; 
  text-align: left; 
  padding-left: 4px;
}

.hint { margin-top: 22px; font-size: 12px; line-height: 1.3; }

.poster-text { 
  margin-top: 14px; 
  font-size: 16px; 
  line-height: 1.4;
  margin-bottom: 20px;
}

.ph--poster {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 146px;
  margin-top: 20px; /* Уменьшили верхний отступ, так как добавили margin-bottom у текста */
  border-radius: 28px;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0; /* Запрещаем блоку сжиматься, если текста много */
}
.okno--result > .btn--wide { margin-top: 22px; }

@media (prefers-reduced-motion: reduce) { .okno--result { animation: none; } }

/* =============== Просмотр обоев =============== */

.viewer {
  position: fixed;
  top: 0; bottom: 0; left: 0; right: 0;
  z-index: 100;
  width: 100%;
  max-width: var(--app-w);
  margin: 0 auto;
  background: #0f172a;
  animation: viewerIn 250ms ease both;
  overflow: hidden; /* Обрезаем всё, что вылезает */
}
.viewer[hidden] { display: none; }

@keyframes viewerIn { from { opacity: 0; } to { opacity: 1; } }

.viewer-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: pan-y;
  cursor: grab;
}

/* Слайды для листания */
.viewer-slide {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background-color: #d9d9d9; /* Цвет заглушки, если картинка не загрузилась */
  background-size: cover;
  background-position: center;
  will-change: transform;
}

.viewer-btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: #111;
  background: rgba(255, 255, 255, 0.45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-radius: 50%;
  transition: background-color 150ms ease;
  z-index: 10;
}
.viewer-btn:active { background: rgba(255, 255, 255, 0.75); }
.viewer-close { top: max(16px, env(safe-area-inset-top)); right: 16px; }
.viewer-prev, .viewer-next { top: 50%; transform: translateY(-50%); }
.viewer-prev { left: 8px; }
.viewer-next { right: 8px; }

.viewer-download {
  position: absolute;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  width: 160px;
  min-height: 46px;
  transform: translateX(-50%);
  z-index: 10;
}

.ph--wall { cursor: pointer; }

/* =============== Бургер-меню =============== */

.menu {
  position: fixed;
  top: 0; bottom: 0; left: 0; right: 0;
  z-index: 90;
  width: 100%;
  max-width: var(--app-w);
  margin: 0 auto;
}
.menu[hidden] { display: none; }

.menu-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  opacity: 0;
  transition: opacity 250ms ease;
}

.menu-panel {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 18px var(--gutter) 30px;
  background: var(--blue);
  color: #fff;
  border-radius: 0 0 var(--radius-pill) var(--radius-pill);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.25);
  transform: translateY(-105%);
  transition: transform 300ms cubic-bezier(0.22, 0.8, 0.24, 1);
}

.menu.is-open .menu-backdrop { opacity: 1; }
.menu.is-open .menu-panel { transform: none; }

.menu-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0 -8px 0 auto;
  color: #fff;
}

.menu-list { list-style: none; margin: 6px 0 0; padding: 0; }
.menu-list a {
  display: block;
  padding: 11px 0;
  font-size: 16px;
  line-height: 1.3;
  color: #fff;
  transition: opacity 150ms ease;
}
.menu-list a:active { opacity: 0.6; }

/* =============== Мои результаты =============== */

.okno--list { flex: 1 0 auto; }
.btn--start { width: auto; align-self: flex-start; margin-top: 18px; padding: 0 32px; min-height: 48px; }

.rez-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 12px;
  margin-top: 22px;
}
.rez-list[hidden], #myResultsEmpty[hidden] { display: none; }

.rez-card { display: flex; flex-direction: column; min-width: 0; transition: transform 150ms ease; }
.rez-card:active { transform: scale(0.97); }
.rez-card-img {
  display: block;
  aspect-ratio: 1.45;
  background: #fff;
  border: 1px solid var(--blue);
  border-radius: 20px;
}
.rez-card-title { margin-top: 6px; font-size: 15px; line-height: 1.25; }
.rez-card-sub { font-size: 13px; line-height: 1.25; }

/* =============== Постер =============== */
/* Пропорции сняты с макетов «постер персональный / парный»; размеры в cqw — постер масштабируется целиком */

.viewer--poster { display: flex; align-items: center; justify-content: center; }
.viewer--poster[hidden] { display: none; }
.poster-wrap { width: 100%; display: flex; justify-content: center; padding: 0 16px; }

.poster {
  position: relative;
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  width: min(100%, calc((100dvh - 150px) * 0.75));
  aspect-ratio: 3 / 4;
  padding: 5.5cqw 0 0;
  background: linear-gradient(160deg, #f0f3fc 0%, #e3e9f8 100%);
  color: #111;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.poster * { margin: 0; }

.poster-logo,
.poster-title,
.poster-h-left { padding-left: 4cqw; }

.poster-logo  { font-family: var(--font-brand); font-size: 2cqw; line-height: 1; }
.poster-title { margin-top: 1.8cqw; padding-right: 4cqw; font-family: var(--font-serif); font-size: 4.2cqw; font-weight: 400; line-height: 1.15; color: var(--ink); }

.poster h3 { font-family: var(--font-serif); font-size: 3.3cqw; font-weight: 400; line-height: 1.2; }
.poster-cols h3 { text-align: center; }

.poster-cols { display: grid; grid-template-columns: 42cqw 1fr; margin-top: 6cqw; }
.poster-cols > section:first-child { padding: 0 6cqw; }
.poster-cols > section:last-child  { padding-left: 10cqw; }

.poster-palette { display: grid; list-style: none; padding: 0; margin-top: 1.8cqw; }
.poster-palette--2 { grid-template-columns: repeat(2, 1fr); gap: 3cqw 2.2cqw; }
.poster-palette--3 { grid-template-columns: repeat(3, 1fr); gap: 2cqw; }
.poster-palette li { display: flex; flex-direction: column; min-width: 0; }
.poster-palette .ph { width: 100%; aspect-ratio: 1; border-radius: 22%; }
.pn { margin-top: 1cqw; font-size: 1.9cqw; line-height: 1.15; }
.pc { font-size: 1.7cqw; line-height: 1.15; }

.poster-info { list-style: none; padding: 0; margin-top: 3.5cqw; display: grid; gap: 4.4cqw; }
.poster-info li { display: flex; align-items: center; gap: 1.6cqw; }
.poster-info .ph--round { width: 7.6cqw; height: 7.6cqw; }
.poster-info b { display: block; font-size: 2.7cqw; font-weight: 400; line-height: 1.2; }
.poster-info span { display: block; font-size: 2.3cqw; line-height: 1.25; }

/* Парный: два блока, выровнены по строкам палитры */
.poster--pair .poster-cols { grid-template-columns: 54cqw 1fr; }
.poster--pair .poster-cols > section:first-child { padding: 0 8cqw; }
.poster--pair .poster-cols > section:last-child  { padding-left: 3cqw; }
.poster--pair .poster-palette--3 { height: 22cqw; align-content: start; margin-top: 2.5cqw; }
.poster--pair .poster-palette + .poster-palette { margin-top: 5cqw; }
.poster-text { height: 22cqw; margin-top: 2.5cqw; }
.poster-text + .poster-text { margin-top: 5cqw; }
.poster-text b { display: block; margin-top: 0.8cqw; font-size: 2.7cqw; font-weight: 500; line-height: 1.2; }
.poster-text b:first-child { margin-top: 0; }
.poster-text span { display: block; font-size: 2.4cqw; line-height: 1.25; }

/* Обои — прижаты к низу, три панели */
.poster-h-left { margin-top: auto; }
.poster-walls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1cqw;
  margin: 2cqw 9cqw 7cqw 4cqw;
}
.poster-walls .ph { aspect-ratio: 0.59; border-radius: 1.6cqw; }

.poster-date {
  position: absolute;
  right: 2.4cqw;
  bottom: 4.5cqw;
  font-size: 1.9cqw;
  writing-mode: vertical-rl;
  color: #111;
}
.viewer--poster .viewer-download { bottom: max(24px, env(safe-area-inset-bottom)); }

/* =============== Правки V1.0 =============== */

/* Экран анализа: этапы прижаты к низу, над подвалом */
.okno--clear { flex: 1 0 auto; }
.okno--clear .stages { margin-top: auto; padding-top: 32px; padding-bottom: 28px; }
.okno--clear .loading { margin-bottom: 0; }

/* Загрузка фото: белый блок уходит под подвал, без срезов и скруглений снизу */
.okno--flow[data-step]:not([data-step="choose"]) {
  flex: 1 0 auto;
  margin-bottom: calc(var(--footer-h) * -1);
  padding-bottom: calc(var(--footer-h) + 22px);
  border-radius: 0;
}

/* Вход / регистрация: белое окно от ~27% высоты до самого подвала */
.okno--auth {
  flex: 1 0 auto;
  align-items: stretch;
  margin: max(27vh, 150px) 0 calc(var(--footer-h) * -1);
  padding: 46px 0 calc(var(--footer-h) + 40px);
  background: #fff;
  border-radius: var(--radius-pill) var(--radius-pill) 0 0;
  overflow: hidden;
}

/* Волнистый орнамент (assets/water-effect.png): позиция снята с макета Figma —
   блок ≈110% ширины окна, сдвиг влево на ~10%, наклон 8.33° против часовой,
   верхний край поднимается над подвалом на ~115px; остальное уходит под подвал */
.okno--auth::after {
  content: "";
  position: absolute;
  left: -10%;
  top: calc(100% - var(--footer-h) - 115px);
  width: 110%;
  aspect-ratio: 442 / 373;
  background: url("assets/water-effect.png") center top / 100% auto no-repeat;
  transform: rotate(-8.33deg);
  transform-origin: 50% 0;
  pointer-events: none;
}

.okno--auth .forma { position: relative; z-index: 1; align-self: center; gap: 10px; padding: 0 30px; }

.okno--auth .zagolovok {
  margin-bottom: 14px;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.okno--auth .pole input { padding: 9px 18px; font-size: 15px; }
.okno--auth .pole input::placeholder { color: #8591ad; }

.btn--center { align-self: center; width: 48%; min-width: 160px; margin-top: 12px; min-height: 44px; font-size: 17px; }

.auth-note { margin-top: 2px; font-size: 13px; line-height: 1.3; text-align: center; }
.auth-note a { text-decoration: underline; text-underline-offset: 2px; }


/* =============== Toast + ошибки полей =============== */
.toast-root {
  position: fixed;
  left: 50%;
  top: max(16px, env(safe-area-inset-top));
  z-index: 200;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  border-radius: 14px;
  background: #1e293b;
  color: #fff;
  font-size: 14px;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 250ms ease, transform 250ms ease;
  pointer-events: auto;
}
.toast.is-visible { opacity: 1; transform: none; }
.toast--error   { background: #dc2626; }
.toast--success { background: #16a34a; }
.toast--info    { background: #1e293b; }

/* Inline-ошибка поля */
.pole.has-error input { border-color: #dc2626; }
.pole .field-error {
  display: none;
  margin: 6px 4px 0;
  font-size: 12px;
  color: #dc2626;
  line-height: 1.2;
}
.pole.has-error .field-error { display: block; }

/* Баннер ошибок на странице результата */
.result-errors {
  margin: 12px 0;
  padding: 12px 16px;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.35;
}
/* =============== Чекбокс соглашения =============== */
.agreement {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 12px 4px;
  cursor: pointer;
  user-select: none;
}

.agreement input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.agreement-box {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--blue);
  border-radius: 6px;
  background: #fff;
  transition: background-color 200ms ease, border-color 200ms ease;
  position: relative;
}

.agreement-box::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 200ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.agreement input:checked ~ .agreement-box {
  background: var(--blue);
}

.agreement input:checked ~ .agreement-box::after {
  transform: rotate(45deg) scale(1);
}

.agreement-text {
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
}

.agreement-link {
  display: inline;
  padding: 0;
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: inherit;
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
  transition: opacity 150ms ease;
}
.agreement-link:active { opacity: 0.6; }

.agreement.has-error .agreement-box {
  border-color: #dc2626;
}

/* =============== Модальное окно соглашения =============== */
.agreement-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;       /* Жестко на всю ширину экрана */
  height: 100vh;      /* Жестко на всю высоту экрана */
  height: 100dvh;     /* Для мобильных браузеров (чтобы не обрезалось меню) */
  z-index: 9999;      /* Повышаем z-index, чтобы перекрыть вообще всё */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
  /* Убеждаемся, что тут нет max-width */
}
.agreement-modal[hidden] { display: none; }

.agreement-modal__backdrop {
  position: absolute;
  inset: 0;
  background: transparent; /* Убрали затемнение, но оставили кликабельным для закрытия */
  opacity: 0;
  transition: opacity 250ms ease;
}

.agreement-modal__content {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.15), 0 8px 16px rgba(15, 23, 42, 0.1);
  transform: translateY(20px);
  opacity: 0;
  transition: transform 250ms ease, opacity 250ms ease;
}

.agreement-modal.is-open .agreement-modal__backdrop { opacity: 1; }
.agreement-modal.is-open .agreement-modal__content {
  transform: none;
  opacity: 1;
}

.agreement-modal__title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  text-align: center;
  margin-bottom: 16px;
  color: var(--ink);
}

.agreement-modal__body {
  overflow-y: auto;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  padding-right: 8px;
}

.agreement-modal__body::-webkit-scrollbar { width: 4px; }
.agreement-modal__body::-webkit-scrollbar-track { background: transparent; }
.agreement-modal__body::-webkit-scrollbar-thumb { background: var(--blue-line); border-radius: 4px; }

/* =============== Фиксированная шапка на страницах результатов =============== */
.top-bar {
  position: fixed;
  top: 0; /* Прижимаем к самому верху экрана */
  left: 50%; 
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--app-w);
  z-index: 10;
  background: #fff;
  padding: calc(30px + env(safe-area-inset-top)) var(--gutter) 20px; 
  border-radius: 0 0 28px 28px; 
}

/* Мягкая тень-градиент снизу, чтобы контент красиво уходил под шапку */
.top-bar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -15px;
  height: 15px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
  pointer-events: none;
}

/* Возвращаем заголовку отступ сверху, так как мы добавили padding-top окну */
.rez-title .zagolovok-flow {
  margin-top: 0; 
}


/* Градиентная рамка через inset box-shadow — ровная на любом border-radius,
   не ломается при изменении background-image / background-color из JS. */

.ph {
  position: relative;
  display: block;
  border-radius: 20px;
  background: #d9d9d9;
  overflow: hidden;
  /* Два inset-слоя: верхний — градиентная рамка 3px, нижний — внутренняя тень */
}

/* Градиентная рамка поверх inset-тени, для цвета используем ::before */
.ph::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 0.8px;
  background: #000;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  box-sizing: border-box;
  /* ставим НИЖЕ контента, чтобы не мешать картинке — но выше фона */
  z-index: 1;
}

/* Чтобы картинка не закрывала рамку, содержимое тоже поднимаем */
.ph > * { position: relative; z-index: 2; }

/* Для круглых плиток — увеличиваем z-index псевдоэлемента, чтобы рамка
   рисовалась поверх фона, но под содержимым */
.ph--round::before {
  z-index: 1;
}

/* Тоньше рамка для info-dot и combo-cell */
.info-dot {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #888;
  overflow: hidden;
}
.info-dot::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 0.8px;
  background: #000;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  box-sizing: border-box;
  z-index: 1;
}

.combo-cell {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  overflow: hidden;
}


.ph--poster {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 146px;
  margin-top: 20px;
  border-radius: 28px;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
  background-color: #d9d9d9;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

/* Текст «Предпросмотр» поверх фона */
.ph--poster > span {
  position: relative;
  z-index: 2;
  pointer-events: none;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Если постер уже сгенерирован — прячем текст */
.ph--poster.has-poster > span {
  display: none;
}