/* Скан-Право — крем / нежно-синий / чёрный, стилистика Apple/Claude */

:root {
  --bg: #F7F3EB;
  --surface: #FFFFFF;
  --ink: #16181D;
  --muted: #8A8F98;
  --accent: #6C8FD8;
  --accent-deep: #4F74C4;
  --accent-soft: #E8EFFA;
  --ok: #3FA268;
  --ok-soft: #E6F4EC;
  --danger: #C85A5A;
  --line: rgba(22, 24, 29, 0.08);
  --shadow: 0 1px 2px rgba(22,24,29,.04), 0 8px 24px rgba(22,24,29,.06);
  --tabbar-h: 62px;
  --glass: rgba(255, 255, 255, 0.6);          /* «жидкое стекло» iOS: полупрозрачный фон */
  --glass-brd: rgba(255, 255, 255, 0.75);     /* светлая грань-блик сверху */
}
:root[data-theme="dark"] {
  --bg: #101216;
  --surface: #1A1D24;
  --ink: #F2EFE7;
  --muted: #9BA1AB;
  --accent: #8FAEE8;
  --accent-deep: #6C8FD8;
  --accent-soft: #232B3C;
  --ok-soft: #1D2E24;
  --line: rgba(255, 255, 255, 0.08);
  --shadow: 0 1px 2px rgba(0,0,0,.2), 0 8px 24px rgba(0,0,0,.3);
  --glass: rgba(22, 25, 31, 0.55);
  --glass-brd: rgba(255, 255, 255, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}

#app {
  max-width: 480px; margin: 0 auto;
  padding: 12px 18px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 24px);
}
.tab, .screen { animation: fadeUp .35s ease both; }
.tab.hidden, .screen.hidden, .hidden { display: none; }
/* только opacity — НЕ трогаем transform: любой filling-transform на .tab/.mode-view создаёт
   containing block и ломает position:fixed у .chat-bar (бар «повисал» посреди экрана). */
@keyframes fadeUp { from { opacity: 0; } to { opacity: 1; } }

.muted { color: var(--muted); }

/* ---------- заставка при входе (~3 сек) ---------- */
#splash {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity .6s ease;
}
#splash.hide { opacity: 0; pointer-events: none; }
.splash-mascot {
  width: 168px; height: 168px; border-radius: 50%;
  box-shadow: var(--shadow);
  animation: splashPop .9s cubic-bezier(.34, 1.56, .64, 1) both,
             floaty 3s ease-in-out .9s infinite;
}
@keyframes splashPop {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}
.splash-title {
  font-size: 36px; font-weight: 800; letter-spacing: -0.03em; margin-top: 20px;
  animation: fadeUp .6s ease .5s both;
}
.splash-sub {
  color: var(--muted); font-size: 15px; text-align: center; margin-top: 8px; line-height: 1.45;
  animation: fadeUp .6s ease .8s both;
}
.splash-dots { display: flex; gap: 7px; margin-top: 28px; animation: fadeUp .5s ease 1.1s both; }
.splash-dots span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  animation: dotPulse 1.2s ease-in-out infinite;
}
.splash-dots span:nth-child(2) { animation-delay: .2s; }
.splash-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dotPulse { 0%,100% { opacity: .25; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.15); } }

/* ---------- онбординг (первый запуск) ---------- */
#onboarding {
  position: fixed; inset: 0; z-index: 95; background: var(--bg);
  display: flex; flex-direction: column;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  touch-action: manipulation;
}
/* ID-специфичность #onboarding перебивает .hidden — усиливаем скрытие */
#onboarding.hidden { display: none; }
#onboarding button { touch-action: manipulation; }
#onboarding .btn-primary { position: relative; z-index: 2; }
#ob-skip {
  align-self: flex-end; border: 0; background: transparent; cursor: pointer;
  color: var(--muted); font-family: inherit; font-size: 14px; font-weight: 600; padding: 8px;
}
.ob-viewport { flex: 1; overflow: hidden; display: flex; align-items: center; }
.ob-track { width: 100%; }
.ob-slide { display: none; text-align: center; padding: 0 10px; }
.ob-slide.active { display: block; animation: fadeUp .4s ease both; }
.ob-slide img {
  width: 240px; height: 240px; object-fit: cover; border-radius: 28px;
  box-shadow: var(--shadow); animation: floaty 5s ease-in-out infinite;
}
.ob-slide h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin-top: 22px; }
.ob-slide p { color: var(--muted); font-size: 15px; line-height: 1.5; margin-top: 10px; }
.ob-dots { display: flex; justify-content: center; gap: 7px; margin: 18px 0; }
.ob-dots span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--line);
  transition: all .3s ease;
}
.ob-dots span.active { background: var(--accent); width: 22px; border-radius: 5px; }

/* ---------- верхний переключатель режимов ---------- */
.mode-switch {
  position: sticky; top: 8px; z-index: 30; display: flex; border-radius: 15px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--glass-brd);
  padding: 4px; box-shadow: var(--shadow); margin: 8px 0 14px;
}
.ms-btn {
  position: relative; z-index: 2; flex: 1; border: 0; background: transparent; cursor: pointer;
  padding: 11px 8px; font-family: inherit; font-size: 14px; font-weight: 650; color: var(--muted);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: color .25s ease; letter-spacing: -0.01em;
}
.ms-btn span { font-size: 16px; }
.ms-btn.active { color: var(--accent-deep); }
.ms-pill {
  position: absolute; top: 4px; left: 4px; bottom: 4px; width: calc(50% - 4px);
  background: var(--accent-soft); border-radius: 12px; z-index: 1;
  transition: transform .32s cubic-bezier(.34, 1.3, .5, 1);
}
.mode-switch.mode-chat .ms-pill { transform: translateX(100%); }
.mode-view { animation: fadeUp .3s ease both; transition: opacity .14s ease; }
.mode-view.mode-leaving { opacity: 0; animation: none; } /* плавный уход старого режима перед сменой */

/* ---------- чат ИИ-юриста ---------- */
.chat-messages { display: flex; flex-direction: column; gap: 10px; padding: 6px 0 4px; min-height: 46vh; }
.chat-msg {
  max-width: 84%; padding: 11px 14px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap;
  word-wrap: break-word; animation: msgIn .3s ease both;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.chat-msg.user {
  align-self: flex-end; color: #fff; border-radius: 18px 18px 5px 18px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  box-shadow: 0 4px 14px rgba(108,143,216,.3);
}
.chat-msg.ai {
  align-self: flex-start; background: var(--surface); color: var(--ink);
  border-radius: 18px 18px 18px 5px; box-shadow: var(--shadow);
}
.chat-msg.ai b { color: var(--accent-deep); }
.chat-typing {
  align-self: flex-start; background: var(--surface); box-shadow: var(--shadow);
  border-radius: 18px 18px 18px 5px; padding: 14px 16px; display: flex; gap: 5px;
}
.chat-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: dotPulse 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: .2s; }
.chat-typing span:nth-child(3) { animation-delay: .4s; }

.chat-suggests { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chat-suggests button {
  border: 1px solid var(--line); background: var(--surface); color: var(--accent-deep);
  border-radius: 20px; padding: 8px 13px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.chat-suggests button:active { opacity: .7; }
.chat-suggests.hidden { display: none; }

/* строка ввода закреплена внизу страницы, прямо над нижними вкладками (просто и надёжно) */
.chat-bar {
  position: fixed; left: 0; right: 0; z-index: 45;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  max-width: 480px; margin: 0 auto;
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--bg); padding: 8px 18px; border-top: 1px solid var(--line);
}
.chat-bar textarea {
  flex: 1; resize: none; max-height: 110px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); color: var(--ink); padding: 11px 15px; font-size: 15px;
  font-family: inherit; outline: none; line-height: 1.4;
}
.chat-bar textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-bar textarea:focus { border-color: var(--accent); }
#chat-send {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: #fff;
  font-size: 18px; box-shadow: 0 4px 14px rgba(108,143,216,.35);
  display: flex; align-items: center; justify-content: center; transition: transform .12s ease;
}
#chat-send:active { transform: scale(.9); }
#chat-send:disabled { opacity: .5; }
.chat-disclaimer { color: var(--muted); font-size: 11px; text-align: center; margin-top: 6px; line-height: 1.4; }
/* место под фиксированную строку ввода, чтобы последнее сообщение и дисклеймер не прятались */
#mode-chat { padding-bottom: 74px; }
.chat-messages { min-height: 38vh; }

/* ---------- нижние вкладки ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-around;
  max-width: 480px; margin: 0 auto;
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%);
  border-top: 1px solid var(--glass-brd);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
}
.tabbar button {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 11px; font-weight: 600;
  color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: color .2s ease, transform .15s ease;
}
.tabbar button span { font-size: 21px; }
.tabbar button.active { color: var(--accent-deep); }
.tabbar button:active { transform: scale(.92); }
body.overlay-open .tabbar { display: none; }

/* ---------- герой ---------- */
.hero { text-align: center; padding: 22px 0 6px; }
.mascot {
  width: 132px; height: 132px; border-radius: 50%;
  box-shadow: var(--shadow);
  animation: floaty 5s ease-in-out infinite;
}
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.hero h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; margin-top: 12px; }
.tagline { color: var(--muted); font-size: 15px; margin: 8px 0 18px; letter-spacing: -0.01em; }

/* ---------- кнопки ---------- */
.btn-primary {
  display: block; width: 100%; border: 0; cursor: pointer;
  border-radius: 16px; padding: 16px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; font-family: inherit;
  box-shadow: 0 6px 20px rgba(108,143,216,.35);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn-primary:active { transform: scale(.98); box-shadow: 0 3px 10px rgba(108,143,216,.3); }
.btn-ghost {
  display: block; width: 100%; border: 1px solid var(--line); cursor: pointer;
  border-radius: 16px; padding: 13px; background: var(--surface);
  color: var(--ink); font-size: 15px; font-weight: 550; font-family: inherit;
}
.btn-ghost:active { opacity: .7; }
.row-2 { display: flex; gap: 10px; margin-top: 10px; }
.row-2 > * { flex: 1; }
.btn-qr {
  display: block; width: 100%; margin-top: 10px; cursor: pointer;
  border: 1px dashed var(--accent); border-radius: 16px; padding: 13px;
  background: var(--accent-soft); color: var(--accent-deep);
  font-size: 15px; font-weight: 600; font-family: inherit;
}
.btn-qr:active { opacity: .75; }
.free-note {
  margin-top: 12px; background: var(--ok-soft); color: var(--ink);
  border-radius: 14px; padding: 11px 14px; font-size: 13px; line-height: 1.45; text-align: left;
}
.free-note b { color: var(--ok); }
.btn-example {
  display: block; width: 100%; border: 0; background: transparent; cursor: pointer;
  color: var(--accent-deep); font-family: inherit; font-size: 14px; font-weight: 650;
  padding: 12px 0 2px;
}
.btn-example:active { opacity: .6; }

/* мерцающий блик на главной кнопке */
#btn-hero-upload { position: relative; overflow: hidden; }
#btn-hero-upload::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 55%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,.35), transparent);
  animation: sheen 3.2s ease-in-out infinite;
}
@keyframes sheen { 0% { left: -70%; } 45%, 100% { left: 120%; } }

/* СПОТЛАЙТ: при открытом окне загрузки фон размыт и притушен, чёткое — только окно загрузки.
   Размываем сами соседние блоки (а не оверлей-бэкдроп) — так окно НИКОГДА не «залипает» под
   размытием и остаётся кликабельным (в отличие от старого backdrop, который его перекрывал). */
#backdrop, .focus-close { display: none !important; }
#mode-scan > *, #mode-switch { transition: filter .25s ease, opacity .25s ease; }
body.picker-open #mode-scan > :not(#picker),
body.picker-open #mode-switch {
  filter: blur(5px); opacity: .5; pointer-events: none;
}
.hero-actions .btn-qr { margin-top: 10px; }

.picker {
  background: var(--surface); border-radius: 18px; padding: 14px 16px; margin-top: 14px;
  box-shadow: var(--shadow); border: 2px solid var(--accent); animation: fadeUp .3s ease both;
}
.picker-focus-hint { color: var(--muted); font-size: 12px; margin: -4px 0 10px; }
.picker-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.picker-head b { font-size: 15px; }
.picker-head span { color: var(--muted); font-size: 12px; }
.picker-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.picker-comment {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); color: var(--ink);
  padding: 12px 14px; font-size: 14px; font-family: inherit; outline: none; margin-bottom: 4px;
}
.picker-comment:focus { border-color: var(--accent); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-soft); color: var(--accent-deep);
  border-radius: 10px; padding: 7px 10px; font-size: 12.5px; font-weight: 600;
  animation: fadeUp .25s ease both;
}
.chip button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 14px; padding: 0; }
.picker .btn-primary { margin-top: 10px; }
.picker-hint { color: var(--muted); font-size: 12px; margin-top: 10px; text-align: center; }

/* ---------- статистика ---------- */
.stats { display: flex; gap: 8px; margin: 22px 0 6px; }
.stat {
  flex: 1; background: var(--surface); border-radius: 16px; padding: 12px 10px;
  text-align: center; box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 18px; letter-spacing: -0.02em; color: var(--accent-deep); }
.stat span { font-size: 11px; color: var(--muted); line-height: 1.3; display: block; margin-top: 3px; }

/* ---------- секции ---------- */
.sect { font-size: 20px; font-weight: 750; letter-spacing: -0.02em; margin: 26px 0 12px; }
.sect-sub { color: var(--muted); font-size: 13px; margin: -6px 0 12px; }
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-top: 18px; }
.page-sub { color: var(--muted); margin: 6px 0 20px; }

/* ---------- карусель сценариев ---------- */
.carousel {
  display: flex; gap: 12px; overflow-x: auto; padding: 8px 18px 16px;
  -webkit-overflow-scrolling: touch;
  margin: 0 -18px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 94%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 94%, transparent 100%);
}
.carousel::-webkit-scrollbar { display: none; }
.carousel { cursor: grab; user-select: none; -webkit-user-select: none; }
.carousel img { -webkit-user-drag: none; user-drag: none; pointer-events: none; }
.scene-card {
  flex: 0 0 244px; scroll-snap-align: start; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 0; overflow: hidden; text-align: left; font-family: inherit; color: var(--ink);
  box-shadow: var(--shadow);
  animation: cardFloat 7s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * -1.2s);
  transition: transform .15s ease;
}
@keyframes cardFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.scene-card:active { transform: scale(.97); animation-play-state: paused; }
.scene-card .img-wrap { display: block; height: 152px; overflow: hidden; }
.scene-card img {
  width: 100%; height: 152px; object-fit: cover; display: block; background: #FAF7E8;
  animation: kenburns 14s ease-in-out infinite alternate;
  animation-delay: calc(var(--i, 0) * -2.3s);
}
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.08) translateX(-6px); } }
.sc-body { display: block; padding: 12px 14px 14px; }
.sc-body b { display: block; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.sc-body span { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.4; margin-top: 4px; min-height: 50px; }
.sc-body i { display: block; font-style: normal; font-size: 13px; font-weight: 650; color: var(--accent-deep); margin-top: 8px; }

/* ---------- карточка-ссылка ---------- */
.card-link {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 12px;
  background: var(--accent-soft); border: 0; border-radius: 18px; padding: 14px 16px;
  cursor: pointer; font-family: inherit; color: var(--ink); text-align: left;
}
.card-link:active { opacity: .8; }
.t-ico { font-size: 26px; }
.cl-text b { display: block; font-size: 15px; font-weight: 650; }
.cl-text span { font-size: 12px; color: var(--muted); }
.chev { margin-left: auto; font-size: 22px; color: var(--muted); }

/* ---------- как это работает ---------- */
.steps-how { list-style: none; counter-reset: n; }
.steps-how li { counter-increment: n; position: relative; padding: 0 0 18px 46px; }
.steps-how li::before {
  content: counter(n);
  position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-deep);
  font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.steps-how li:not(:last-child)::after {
  content: ""; position: absolute; left: 14px; top: 34px; bottom: 2px;
  width: 2px; background: var(--line);
}
.steps-how b { display: block; font-size: 15px; letter-spacing: -0.01em; }
.steps-how span { font-size: 13px; color: var(--muted); }

/* ---------- FAQ ---------- */
.faq { background: var(--surface); border-radius: 16px; margin-bottom: 8px; box-shadow: var(--shadow); overflow: hidden; }
.faq summary {
  list-style: none; cursor: pointer; padding: 14px 16px;
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
  display: flex; justify-content: space-between; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "＋"; color: var(--accent-deep); font-size: 17px;
  transition: transform .4s cubic-bezier(.4, 0, .2, 1);
}
.faq.expanded summary::after { transform: rotate(135deg); }
.faq .faq-wrap { height: 0; overflow: hidden; transition: height .4s cubic-bezier(.4, 0, .2, 1); }
.faq p { padding: 0 16px 14px; font-size: 14px; color: var(--muted); line-height: 1.5; }

/* ---------- история ---------- */
.history-item {
  background: var(--surface); border: 0; border-left: 4px solid var(--line);
  width: 100%; text-align: left; font-family: inherit; color: var(--ink);
  border-radius: 14px; padding: 13px 15px; margin-bottom: 9px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px;
  box-shadow: var(--shadow); transition: transform .12s ease;
}
.history-item:active { transform: scale(.98); }
.history-item.mark-bad { border-left-color: var(--danger); }
.history-item.mark-clean { border-left-color: var(--ok); }
.history-item.mark-pending { border-left-color: #E8A13C; }
.history-item.mark-fail { border-left-color: var(--muted); }
.hi-main { min-width: 0; flex: 1; }
.hi-title {
  font-weight: 600; font-size: 14px; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hi-badges { display: flex; align-items: center; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
.hi-date { color: var(--muted); font-size: 12px; }
.history-item .refund { color: var(--ok); font-weight: 700; white-space: nowrap; font-size: 15px; }
.badge { font-size: 11px; font-weight: 700; border-radius: 7px; padding: 3px 9px; }
.badge.pending { background: #FFF3D6; color: #B07D18; }
.badge.error { background: #FBE9E9; color: var(--danger); }
.badge.clean { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: #FBE9E9; color: var(--danger); }
.empty { text-align: center; padding: 30px 10px; }
.empty-img { width: 180px; border-radius: 20px; margin-bottom: 14px; box-shadow: var(--shadow); }
.empty p { color: var(--muted); margin-bottom: 16px; }

/* ---------- профиль ---------- */
.user-card { display: flex; align-items: center; gap: 14px; }
.user-avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff; font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.segmented {
  display: flex; background: var(--surface); border-radius: 14px; padding: 4px;
  box-shadow: var(--shadow);
}
.segmented button {
  flex: 1; border: 0; border-radius: 11px; padding: 10px 6px; cursor: pointer;
  background: transparent; color: var(--muted); font-family: inherit; font-size: 13px; font-weight: 600;
  transition: all .25s ease;
}
.segmented button.active { background: var(--accent-soft); color: var(--accent-deep); }
.link-card {
  display: flex; align-items: center; width: 100%; text-decoration: none; cursor: pointer;
  font-family: inherit; font-size: 15px; font-weight: 600; color: var(--ink); border: 0; text-align: left;
}
.link-card:active { opacity: .7; }
.about-card { display: flex; gap: 12px; align-items: flex-start; }
.about-card p { font-size: 13px; color: var(--muted); line-height: 1.5; }
.support-mascot { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; }

/* ---------- калькулятор ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field i { color: var(--muted); font-weight: 400; font-style: normal; }
.field input {
  width: 100%; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink);
  padding: 14px; font-size: 18px; font-family: inherit; outline: none;
}
.field input:focus { border-color: var(--accent); }
.kb-done {
  display: block; width: 100%; border: 0; cursor: pointer; margin-bottom: 12px;
  border-radius: 12px; padding: 11px; background: var(--accent-soft);
  color: var(--accent-deep); font-size: 14px; font-weight: 650; font-family: inherit;
}
.calc-out { background: var(--surface); border-radius: 18px; padding: 6px 16px; margin: 6px 0 16px; box-shadow: var(--shadow); }
.calc-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.calc-row i { color: var(--muted); font-style: normal; font-size: 12px; }
.calc-total { display: flex; justify-content: space-between; align-items: baseline; padding: 13px 0 11px; font-size: 15px; font-weight: 700; }
.calc-total b { color: var(--accent-deep); font-size: 20px; letter-spacing: -0.02em; }
.calc-note { color: var(--muted); font-size: 12px; padding-bottom: 12px; }
#calc-upload { margin-top: 4px; margin-bottom: 10px; }

/* ---------- прогресс ---------- */
#screen-progress { text-align: center; padding-top: 16px; }
.progress-art {
  width: 100%; max-width: 320px; border-radius: 22px; box-shadow: var(--shadow);
  animation: floaty 5s ease-in-out infinite;
}
/* анимированный сканер (SVG): лупа проверяет документ, без галочки */
.scan-anim {
  width: 230px; max-width: 72vw; margin: 0 auto; border-radius: 24px;
  background: #FAF7E8; box-shadow: var(--shadow); padding: 10px;
}
:root[data-theme="dark"] .scan-anim { background: #20232B; }
.scan-svg { width: 100%; display: block; }
.sa-doc { fill: #fff; stroke: #16181D; stroke-width: 3; }
.sa-line { fill: #C7D6F0; }
.sa-lens { fill: rgba(108,143,216,.18); stroke: none; }
.sa-lens-ring { fill: none; stroke: #16181D; stroke-width: 4; }
.sa-handle { stroke: #16181D; stroke-width: 6; stroke-linecap: round; }
.sa-glint { fill: rgba(255,255,255,.85); }
.sa-spark circle { fill: var(--accent); animation: saTwinkle 1.8s ease-in-out infinite; }
.sa-spark circle:nth-child(2) { animation-delay: .5s; }
.sa-spark circle:nth-child(3) { animation-delay: 1s; }
@keyframes saTwinkle { 0%,100% { opacity: .2; } 50% { opacity: 1; } }
.steps { list-style: none; text-align: left; max-width: 320px; margin: 24px auto 0; }
.steps li {
  position: relative; padding: 9px 0 9px 34px; color: var(--muted); font-size: 15px;
  transition: color .3s ease;
}
.steps li::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--line);
  transition: all .3s ease;
}
.steps li.active { color: var(--ink); font-weight: 600; }
.steps li.active::before {
  border-color: var(--accent); border-top-color: transparent;
  animation: spin .8s linear infinite;
}
.steps li.done { color: var(--ink); }
.steps li.done::before {
  border-color: var(--ok); background: var(--ok);
  content: "✓"; color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  animation: none;
}
@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }
.fact-card {
  background: var(--accent-soft); border-radius: 18px; padding: 14px 18px;
  max-width: 320px; margin: 22px auto 0; text-align: left;
}
.fact-label {
  font-size: 11px; font-weight: 700; color: var(--accent-deep);
  text-transform: uppercase; letter-spacing: .06em;
}
/* фикс. высота под 3 строки — карточка не «прыгает» при смене факта разной длины */
#fact-text {
  font-size: 14px; margin-top: 5px; line-height: 1.45;
  min-height: 3.9em; display: flex; align-items: center;
  transition: opacity .3s ease, transform .3s ease, filter .3s ease;
}
/* мягкий свайп: факт тихо уходит вверх */
#fact-text.fading { opacity: 0; transform: translateY(-10px); }
/* новый факт плавно выезжает снизу вверх — без резкости, не бросается в глаза */
@keyframes factIn {
  0%   { opacity: 0; transform: translateY(14px); }
  100% { opacity: 1; transform: translateY(0); }
}
#fact-text.entering { animation: factIn .7s cubic-bezier(.25, .8, .3, 1); }
.progress-note { color: var(--muted); font-size: 12px; margin-top: 18px; }

/* ---------- результат ---------- */
.card { background: var(--surface); border-radius: 18px; padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
.doc-card { margin-top: 18px; }
.doc-card .doc-type { font-weight: 750; font-size: 17px; letter-spacing: -0.01em; }
.doc-card .doc-meta { color: var(--muted); font-size: 13px; margin-top: 4px; line-height: 1.45; }

.clean-banner {
  background: var(--ok-soft); border-radius: 20px; padding: 24px 20px; text-align: center;
  margin-top: 18px; animation: fadeUp .4s ease both;
}
.clean-ico { font-size: 42px; margin-bottom: 8px; }
.clean-banner b { font-size: 19px; letter-spacing: -0.01em; }
.clean-banner p { font-size: 14px; color: var(--muted); margin-top: 8px; line-height: 1.5; }

.refund-banner {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff; border-radius: 18px; padding: 18px; text-align: center; margin-bottom: 14px;
  box-shadow: 0 6px 20px rgba(108,143,216,.35);
}
.refund-banner .amount { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.refund-banner .label { font-size: 12px; opacity: .9; margin-top: 3px; }

.violation {
  background: var(--surface); border-radius: 16px; padding: 14px 16px; margin-bottom: 10px;
  border-left: 3px solid var(--danger); box-shadow: var(--shadow);
  animation: fadeUp .35s ease both;
}
.violation .v-head { display: flex; justify-content: space-between; gap: 8px; }
.violation .v-title { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.violation .v-refund { color: var(--ok); font-weight: 700; white-space: nowrap; }
.violation .v-desc { font-size: 14px; opacity: .85; margin-top: 6px; }
.violation .v-norm {
  display: inline-block; margin-top: 8px; font-size: 12px;
  background: var(--accent-soft); color: var(--accent-deep);
  border-radius: 7px; padding: 3px 9px; font-weight: 550;
}
/* кликабельная норма → открывает официальный текст статьи */
.violation .v-norm-link {
  border: 0; cursor: pointer; font-family: inherit;
  transition: filter .15s ease, transform .1s ease;
}
.violation .v-norm-link:hover { filter: brightness(.95); }
.violation .v-norm-link:active { transform: scale(.96); }
.violation .v-norm-ext { font-size: 10px; opacity: .75; }
.prospects { font-size: 14px; border-left: 3px solid var(--accent); }
#btn-claim { margin-top: 4px; }

.disclaimer { font-size: 11px; color: var(--muted); text-align: center; margin-top: 20px; line-height: 1.45; }

/* ---------- экран ошибки ---------- */
#screen-error { text-align: center; padding-top: 10px; }
.error-hero { position: relative; display: inline-block; margin-top: 8px; }
.error-photo {
  width: 150px; max-width: 45vw; border-radius: 20px;
  box-shadow: var(--shadow); display: block;
}
.error-x {
  position: absolute; right: -10px; top: -10px;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  animation: xPulse 2s ease-in-out .9s infinite;
}
.error-x svg { width: 34px; height: 34px; }
.x-circle {
  stroke-dasharray: 164; stroke-dashoffset: 164;
  animation: draw .5s ease-out .1s forwards;
}
.x-line1, .x-line2 {
  stroke-dasharray: 30; stroke-dashoffset: 30;
}
.x-line1 { animation: draw .25s ease-out .55s forwards; }
.x-line2 { animation: draw .25s ease-out .75s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes xPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.error-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin-top: 18px; }
.error-sub { color: var(--muted); font-size: 14px; margin: 8px 0 14px; line-height: 1.5; }
.error-tips {
  list-style: none; text-align: left; background: var(--surface);
  border-radius: 16px; padding: 8px 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.error-tips li { padding: 9px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.error-tips li:last-child { border-bottom: 0; }
#error-support { margin-top: 10px; }

.demo-badge {
  background: #E8A13C; color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 7px; padding: 2px 8px; display: inline-block; margin-bottom: 8px;
}

.ob-version { text-align: center; color: var(--muted); font-size: 11px; opacity: .6; }
.splash-slogan {
  position: absolute; bottom: calc(34px + env(safe-area-inset-bottom, 0px));
  left: 0; right: 0; text-align: center; font-size: 14px; font-weight: 600;
  letter-spacing: .01em; color: var(--accent-deep);
}
.splash-ver {
  position: absolute; bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  left: 0; right: 0; text-align: center; font-size: 10px; color: var(--muted); opacity: .55;
}
