/* AquaRecognize — мобильный флоу активации SIM.
   Тема: вода/аква. Мягкие градиенты, каскадное появление, крупные тач-цели. */

:root {
  --bg: #f2f7fb;
  --bg-2: #e7f1f8;
  --ink: #0c2231;
  --ink-2: #40607a;
  --muted: #7d99ad;
  --brand: #0aa0d8;
  --brand-2: #22c3ec;
  --brand-dark: #0672a6;
  --ok: #12a150;
  --warn: #d98207;
  --err: #dc3d3d;
  --card: #fff;
  --line: #e0ecf4;
  --shadow: 0 10px 30px -12px rgba(11, 60, 90, .28);
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Атрибут hidden должен побеждать любые display из правил ниже (иначе элемент с
   display:flex остаётся видимым, несмотря на hidden). */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  color: var(--ink);
  background: radial-gradient(1200px 600px at 50% -10%, var(--bg-2), var(--bg) 60%);
  font: 16px/1.5 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 460px; margin: 0 auto; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 14px) 20px calc(env(safe-area-inset-bottom) + 22px);
}

/* ---------- шапка и шаги ---------- */

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: flex; align-items: center; gap: 11px; }
.logo {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand-2), var(--brand-dark));
  color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: 0 6px 16px -6px rgba(10, 160, 216, .8);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 15px; letter-spacing: .2px; }
.brand-text small { color: var(--muted); font-size: 11.5px; }

.steps { display: flex; gap: 6px; align-items: center; }
.steps i {
  width: 22px; height: 4px; border-radius: 3px; background: var(--line);
  transition: background .35s ease, width .35s ease;
}
.steps i.done { background: var(--brand); }
.steps i.now { background: linear-gradient(90deg, var(--brand), var(--brand-2)); width: 30px; }

/* ---------- сцена и переходы между экранами ---------- */

.stage { flex: 1; display: flex; flex-direction: column; padding-top: 18px; }

.screen { display: none; flex: 1; flex-direction: column; }
.screen.active { display: flex; animation: screen-in .42s cubic-bezier(.16, 1, .3, 1); }
@keyframes screen-in {
  from { opacity: 0; transform: translate3d(26px, 0, 0); }
  to   { opacity: 1; transform: none; }
}

/* каскад: элементы экрана всплывают по очереди */
.screen.active > * { animation: rise .5s cubic-bezier(.16, 1, .3, 1) backwards; }
.screen.active > *:nth-child(1) { animation-delay: .04s; }
.screen.active > *:nth-child(2) { animation-delay: .09s; }
.screen.active > *:nth-child(3) { animation-delay: .14s; }
.screen.active > *:nth-child(4) { animation-delay: .19s; }
.screen.active > *:nth-child(5) { animation-delay: .24s; }
.screen.active > *:nth-child(6) { animation-delay: .29s; }
@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 14px, 0); }
  to   { opacity: 1; transform: none; }
}

.center-screen { text-align: center; align-items: center; }
.center-screen h1 { text-align: center; }

/* ---------- типографика ---------- */

h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.4px; margin: 6px 0 10px; }
.lead { color: var(--ink-2); margin: 0 0 20px; }
.kicker {
  align-self: flex-start; font-size: 11.5px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--brand);
  background: rgba(10, 160, 216, .1); padding: 5px 10px; border-radius: 999px;
}
.note { font-size: 13.5px; color: var(--muted); margin: 0 0 14px; }
.note.center { text-align: center; }
.note.err { color: var(--err); }

/* ---------- герой на старте ---------- */

.hero { position: relative; display: grid; place-items: center; padding: 26px 0 10px; }
.hero-glow {
  position: absolute; width: 190px; height: 190px; border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 195, 236, .38), transparent 68%);
  animation: pulse-glow 3.4s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { transform: scale(1); opacity: .85; }
  50%      { transform: scale(1.14); opacity: 1; }
}
.hero-sim {
  width: 108px; height: 108px; position: relative;
  filter: drop-shadow(0 14px 22px rgba(6, 114, 166, .34));
  animation: float 4.6s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-9px) rotate(3deg); }
}

/* ---------- карточки ---------- */

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 4px 16px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.row { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; gap: 12px; }
.row span { color: var(--muted); font-size: 14px; }
.row b { font-variant-numeric: tabular-nums; letter-spacing: .2px; }
.divider { height: 1px; background: var(--line); }

/* ---------- оферта ---------- */

.offer {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; max-height: 40vh; overflow-y: auto;
  font-size: 14.5px; color: var(--ink-2); box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}
.offer p { margin: 0 0 12px; }
.offer p:last-child { margin: 0; }

.check { display: flex; gap: 13px; align-items: flex-start; margin: 20px 0; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .box {
  flex: 0 0 24px; width: 24px; height: 24px; border-radius: 8px;
  border: 2px solid #c6dbe8; background: #fff; position: relative; transition: all .2s;
}
.check .box::after {
  content: ""; position: absolute; inset: 0; border-radius: 6px;
  background: no-repeat center/13px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M2 8.5l4 4 8-9' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  opacity: 0; transform: scale(.5); transition: all .2s;
}
.check input:checked + .box { background: var(--brand); border-color: var(--brand); }
.check input:checked + .box::after { opacity: 1; transform: scale(1); }
.check-text { font-size: 14.5px; color: var(--ink-2); }

/* ---------- поля ввода ---------- */

.fields { display: flex; flex-direction: column; gap: 13px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: .2px; }
.field > span em { font-style: normal; font-weight: 400; opacity: .8; }
.field input {
  border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 15px;
  font-size: 16.5px; background: #fff; color: var(--ink); transition: all .18s;
  box-shadow: 0 2px 8px -6px rgba(11, 60, 90, .3);
}
.field input::placeholder { color: #b9cddb; }
.field input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(10, 160, 216, .13);
}

/* ---------- подсказки-инструктаж ---------- */

.tips { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tips li {
  display: flex; gap: 13px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 15px;
  padding: 13px 15px; box-shadow: 0 4px 14px -10px rgba(11, 60, 90, .35);
}
.tips.compact li { padding: 10px 13px; }
.tip-ic {
  flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px; display: grid;
  place-items: center; font-size: 19px;
  background: linear-gradient(140deg, rgba(34, 195, 236, .16), rgba(6, 114, 166, .1));
}
.tips b { display: block; font-size: 14.5px; font-weight: 600; }
.tips small { color: var(--muted); font-size: 13px; }

/* ---------- камера ---------- */

.viewport {
  position: relative; width: 100%; aspect-ratio: 3/4; background: #08161f;
  border-radius: 22px; overflow: hidden; margin-bottom: 16px;
  box-shadow: 0 18px 40px -20px rgba(8, 22, 31, .8);
}
.viewport.doc { aspect-ratio: 4/3; }
video { width: 100%; height: 100%; object-fit: cover; display: block; }
#live-video { transform: scaleX(-1); }

.oval {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 63%; aspect-ratio: 3/4; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .82);
  box-shadow: 0 0 0 2000px rgba(6, 22, 32, .42);
  animation: breathe 2.8s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 2000px rgba(6, 22, 32, .42), 0 0 0 0 rgba(34, 195, 236, .5); }
  50%      { box-shadow: 0 0 0 2000px rgba(6, 22, 32, .42), 0 0 0 14px rgba(34, 195, 236, 0); }
}
.scanline {
  position: absolute; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--brand-2), transparent);
  opacity: .8; animation: scan 2.6s ease-in-out infinite;
}
@keyframes scan { 0%, 100% { top: 12%; } 50% { top: 86%; } }

.prompt {
  position: absolute; left: 14px; right: 14px; bottom: 16px; text-align: center;
  color: #fff; font-size: 19px; font-weight: 700; letter-spacing: -.2px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .7);
  animation: prompt-in .3s ease;
}
@keyframes prompt-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; } }

.doc-frame { position: absolute; inset: 9% 6%; }
.doc-frame .c { position: absolute; width: 30px; height: 30px; border: 3px solid #fff; }
.doc-frame .tl { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.doc-frame .tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; }
.doc-frame .bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 8px; }
.doc-frame .br { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }

.track { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.track-fill {
  height: 100%; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width .35s cubic-bezier(.16, 1, .3, 1);
}

/* ---------- кнопки ---------- */

button.primary {
  margin-top: auto; width: 100%; border: 0; cursor: pointer;
  padding: 17px 20px; border-radius: 16px; font-size: 17px; font-weight: 650;
  color: #fff; letter-spacing: .1px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand-dark));
  box-shadow: 0 12px 26px -12px rgba(10, 160, 216, .95);
  display: flex; align-items: center; justify-content: center; gap: 9px;
  transition: transform .14s ease, box-shadow .2s ease, opacity .2s;
}
button.primary:active { transform: translateY(2px) scale(.99); box-shadow: 0 6px 14px -10px rgba(10, 160, 216, .9); }
button.primary:disabled { opacity: .42; box-shadow: none; }
.arrow { transition: transform .2s; }
button.primary:active .arrow { transform: translateX(4px); }

button.shutter .dot {
  width: 15px; height: 15px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .35);
}

/* ---------- сравнение при расхождении ---------- */

.compare {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center;
  margin-bottom: 18px;
}
.compare-col {
  background: var(--card); border: 1px solid var(--line); border-radius: 15px;
  padding: 13px; text-align: center; box-shadow: var(--shadow);
}
.compare-col small { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 5px; }
.compare-col b { font-size: 14.5px; word-break: break-word; }
.compare-col.bad { border-color: #f6cccc; background: #fff6f6; }
.compare-col.bad b { color: var(--err); }
.compare-arrow { color: var(--muted); font-size: 18px; font-weight: 700; }

/* ---------- индикаторы состояния ---------- */

.icon-badge {
  width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center;
  font-size: 36px; font-weight: 700; color: #fff; margin: 26px auto 8px;
  animation: pop .45s cubic-bezier(.2, 1.4, .4, 1) backwards;
}
.icon-badge.warn { background: linear-gradient(140deg, #f5a623, var(--warn)); }
.icon-badge.bad { background: linear-gradient(140deg, #f06a6a, var(--err)); }
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.loader { display: flex; gap: 9px; margin: 46px auto 20px; }
.loader i {
  width: 13px; height: 13px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-2), var(--brand-dark));
  animation: bounce 1.15s ease-in-out infinite;
}
.loader i:nth-child(2) { animation-delay: .15s; }
.loader i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .45; }
  40%           { transform: translateY(-13px); opacity: 1; }
}

/* галочка результата — рисуется штрихом */
.result-mark { width: 96px; height: 96px; margin: 26px auto 10px; }
.result-mark svg { width: 100%; height: 100%; }
.rm-circle {
  fill: none; stroke: var(--ok); stroke-width: 3;
  stroke-dasharray: 152; stroke-dashoffset: 152;
  animation: draw .7s cubic-bezier(.5, 0, .3, 1) forwards;
}
.rm-check {
  fill: none; stroke: var(--ok); stroke-width: 4;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 40; stroke-dashoffset: 40;
  animation: draw .4s cubic-bezier(.5, 0, .3, 1) .55s forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.result-mark.review .rm-circle, .result-mark.review .rm-check { stroke: var(--warn); }
.result-mark.reject .rm-circle, .result-mark.reject .rm-check { stroke: var(--err); }

/* ---------- техническая информация об ошибке ---------- */

.tech {
  width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 15px; margin-bottom: 16px; font-size: 13px;
}
.tech summary { color: var(--muted); cursor: pointer; }
.tech pre { white-space: pre-wrap; word-break: break-word; color: #9a4444; font-size: 12px; margin: 9px 0 0; }

/* ---------- уважение к настройкам доступности ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; }
}
