/* ==========================================================================
   зафиксируй.рф — общий стиль публичных страниц. Дизайн-система «Синяя печать»
   (цвета и шрифты — как в приложении: src/lib/theme.ts).
   ========================================================================== */

:root {
  --bg: #F2F4F9;
  --card: #FFFFFF;
  --ink: #0A1430;
  --ink2: #33405F;
  --mut: #56627F;
  --line: #E2E7F1;
  --fill: #F5F7FC;
  --blue: #1B4DD8;
  --blue-ink: #0F2E8A;
  --b50: #EAF0FF;
  --b100: #D6E1FF;
  --ok: #0B7A4B;
  --ok-bg: #E3F4EB;
  --amber: #8A4300;
  --amber-bg: #FFF1D6;
  --rec: #E0322A;
  --rec-bg: #FDE9E7;
  --on-blue: #FFFFFF;
  --seal: #1B4DD8;
  --shadow: 0 20px 50px -24px rgba(10, 20, 48, .28);

  --display: 'Unbounded', 'Golos Text', system-ui, sans-serif;
  --body: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #060A16;
    --card: #0E1428;
    --ink: #EDF1FF;
    --ink2: #C4CCE4;
    --mut: #98A4C4;
    --line: #212B4A;
    --fill: #141C35;
    --blue: #7A98FF;
    --blue-ink: #B9C8FF;
    --b50: #16214A;
    --b100: #22306A;
    --ok: #4FD79A;
    --ok-bg: #0E2A22;
    --amber: #FFB547;
    --amber-bg: #2E2210;
    --rec: #FF5A4F;
    --rec-bg: #3A1512;
    --seal: #2E58F0;
    --shadow: 0 20px 50px -24px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg, video { max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; }
.btn svg { width: 20px; height: 20px; flex: none; }
:focus-visible { outline: 3px solid var(--b100); outline-offset: 2px; }

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px calc(var(--safe-b) + 36px);
}
.page.wide { max-width: 720px; }

/* ── Шапка ─────────────────────────────────────────────────────────────── */
.head {
  display: flex; align-items: center; gap: 11px;
  padding: calc(var(--safe-t) + 16px) 0 18px;
  color: var(--ink);
}
.head:hover { text-decoration: none; }
.head .logo {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--seal); display: grid; place-items: center;
}
.head .logo svg { width: 25px; height: auto; transform: translate(-4%, -6%); }
.head .n, .head .s { display: block; }
.head .n { font: 700 16px/1.1 var(--display); letter-spacing: -.02em; }
.head .n span { color: var(--blue); }
.head .s {
  font: 600 10.5px/1 var(--body); letter-spacing: .1em; text-transform: uppercase;
  color: var(--mut); margin-top: 5px;
}

/* ── Типографика ───────────────────────────────────────────────────────── */
h1, .h1 { font: 700 26px/1.2 var(--display); letter-spacing: -.03em; margin: 6px 0 10px; }
h2, .h2 { font: 600 17px/1.3 var(--display); letter-spacing: -.02em; margin: 26px 0 12px; }
.lead { color: var(--ink2); font-size: 16px; line-height: 1.55; margin: 0 0 18px; }
.small { font-size: 14px; }
.cap { font-size: 12.5px; color: var(--mut); line-height: 1.45; }
.mut { color: var(--mut); }
.mono { font-family: var(--mono); font-weight: 500; }
.center { text-align: center; }
.kicker {
  font: 600 11px/1 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--blue);
}

/* ── Карточка ──────────────────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 26px;
  padding: 18px; margin: 0 0 12px;
}
.card.raised { box-shadow: var(--shadow); }
.card + .h2 { margin-top: 22px; }

/* ── Кнопки ────────────────────────────────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; min-height: 54px; padding: 12px 20px; margin: 10px 0 0;
  border: 0; border-radius: 18px; cursor: pointer;
  background: var(--blue); color: var(--on-blue);
  font: 600 16px/1.2 var(--body); text-align: center; text-decoration: none;
  transition: transform .12s ease, opacity .12s ease;
  -webkit-tap-highlight-color: transparent;
}
@media (prefers-color-scheme: dark) { .btn { background: var(--seal); } }
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }
.btn.soft { background: var(--b50); color: var(--blue); }
.btn.ghost { background: transparent; color: var(--blue); border: 1.5px solid var(--b100); }
.btn.small { min-height: 42px; padding: 8px 14px; font-size: 14.5px; border-radius: 14px; margin: 0; width: auto; }
.btn.loading { pointer-events: none; color: transparent !important; position: relative; }
.btn.loading::after {
  content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: spin .8s linear infinite;
}
.btn.soft.loading::after, .btn.ghost.loading::after { border-color: var(--b100); border-top-color: var(--blue); }
.link-btn {
  display: block; width: 100%; background: none; border: 0; padding: 10px 0 2px; cursor: pointer;
  color: var(--blue); font: 600 14.5px/1.3 var(--body); text-align: center;
}

/* ── Поля ──────────────────────────────────────────────────────────────── */
.inp {
  width: 100%; min-height: 54px; padding: 12px 16px;
  border: 1.5px solid var(--line); border-radius: 16px; background: var(--fill); color: var(--ink);
  font-size: 16px; outline: none; -webkit-appearance: none; appearance: none;
}
.inp:focus { border-color: var(--blue); background: var(--card); }
textarea.inp { min-height: 96px; resize: vertical; line-height: 1.45; }
.inp.pin {
  text-align: center; font: 600 28px/1 var(--mono); letter-spacing: .35em; padding-left: calc(16px + .35em);
}
.field { margin: 0 0 14px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink2); margin: 0 0 6px; }
.err { color: var(--rec); font-size: 14px; margin: 8px 0 0; }
.row-inp { display: flex; gap: 8px; }
.row-inp .inp { flex: 1; min-width: 0; }
.row-inp .btn { width: auto; margin: 0; flex: none; padding: 0 20px; }

/* ── Вердикт (как VerifyCard в приложении) ─────────────────────────────── */
.verdict { display: flex; align-items: center; gap: 14px; }
.seal { position: relative; width: 86px; height: 86px; flex: none; color: var(--blue); }
.seal .ros { position: absolute; inset: 0; width: 100%; height: 100%; }
.seal .ros .spin1 { transform-origin: 0 0; animation: spin 60s linear infinite; }
.seal .ros .spin2 { transform-origin: 0 0; animation: spin 90s linear infinite reverse; }
.seal .ros .draw { stroke-dasharray: 800; stroke-dashoffset: 800; animation: draw 2.2s cubic-bezier(.65, 0, .35, 1) forwards; }
.seal .disc {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border-radius: 50%; display: grid; place-items: center; background: var(--b50);
}
.seal .disc svg { width: 24px; height: 24px; }
.seal .brand {
  position: absolute; right: 0; bottom: 2px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--seal); border: 2.5px solid var(--card); display: grid; place-items: center;
}
.seal .brand svg { width: 16px; height: auto; transform: translate(-4%, -6%); }
.seal.pop .disc { animation: pop .5s .35s cubic-bezier(.3, 1.6, .5, 1) both; }
.seal.pop .brand { animation: pop .5s .6s cubic-bezier(.3, 1.6, .5, 1) both; }
.verdict .word {
  font: 700 26px/1.2 var(--display); letter-spacing: -.03em; margin: 0 0 3px;
  overflow-wrap: anywhere;
}
.verdict .word.long { font-size: 20px; }
.verdict .sub { font-size: 14px; line-height: 1.45; color: var(--ink2); }
.verdict .sub b { color: var(--ink); font-weight: 600; }

.tone-ok { --tone: var(--ok); --tone-bg: var(--ok-bg); }
.tone-amber { --tone: var(--amber); --tone-bg: var(--amber-bg); }
.tone-rec { --tone: var(--rec); --tone-bg: var(--rec-bg); }
.tone-grey { --tone: var(--mut); --tone-bg: var(--fill); }
.tone-blue { --tone: var(--blue); --tone-bg: var(--b50); }
[class*="tone-"] .seal { color: var(--tone); }
[class*="tone-"] .seal .disc { background: var(--tone-bg); color: var(--tone); border: 2px solid var(--tone); }
.tone-blue .seal .disc, .tone-grey .seal .disc { border: 0; }
[class*="tone-"] .word { color: var(--tone); }

.checks { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 11px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; animation: rise .45s both; }
.checks li:nth-child(2) { animation-delay: .09s; }
.checks li:nth-child(3) { animation-delay: .18s; }
.checks li:nth-child(4) { animation-delay: .27s; }
.checks .ic { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.checks .ok { color: var(--ok); }
.checks .fail { color: var(--rec); }
.checks .warn { color: var(--amber); }
.checks .skip, .checks .wait { color: var(--mut); }
.checks .t { font-weight: 600; font-size: 14.5px; line-height: 19px; }
.checks .d { font-size: 12.5px; line-height: 1.45; color: var(--mut); }
.checks.pending .t { color: var(--mut); }
.checks.pending li { animation: none; }

/* ── Строки «ключ — значение» ─────────────────────────────────────────── */
.kv { display: grid; gap: 0; }
.kv > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14.5px;
}
.kv > div:last-child { border-bottom: 0; padding-bottom: 0; }
.kv > div:first-child { padding-top: 0; }
.kv .k { color: var(--mut); flex: none; max-width: 45%; }
.kv .v { font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
  font: 600 12.5px/1.2 var(--body); background: var(--ok-bg); color: var(--ok); white-space: nowrap;
}
.tag svg { width: 13px; height: 13px; }
.tag.blue { background: var(--b50); color: var(--blue); }
.tag.amber { background: var(--amber-bg); color: var(--amber); }

/* ── Подробнее ─────────────────────────────────────────────────────────── */
details.more { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 4px; }
details.more > summary {
  list-style: none; cursor: pointer; padding: 10px 0 4px; color: var(--blue);
  font: 600 14.5px/1.3 var(--body); display: flex; align-items: center; gap: 6px;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary svg { width: 16px; height: 16px; transition: transform .2s; }
details.more[open] > summary svg { transform: rotate(180deg); }
.hash {
  font: 500 12px/1.55 var(--mono); color: var(--ink2); background: var(--fill);
  border-radius: 12px; padding: 10px 12px; word-break: break-all; margin: 4px 0 0;
}
.tech { display: grid; gap: 12px; margin-top: 8px; }
.tech .lbl { font-size: 12.5px; color: var(--mut); }
.frow { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.frow svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }

/* ── Подсказка ─────────────────────────────────────────────────────────── */
.note {
  display: flex; gap: 11px; align-items: flex-start; padding: 14px; border-radius: 18px;
  background: var(--b50); color: var(--ink2); font-size: 14px; line-height: 1.5;
}
.note svg { width: 20px; height: 20px; flex: none; color: var(--blue); margin-top: 1px; }
.note.warn { background: var(--amber-bg); }
.note.warn svg { color: var(--amber); }

/* ── Состояния: пусто / ошибка / загрузка ──────────────────────────────── */
.state { text-align: center; padding: 26px 18px 22px; }
.state .ic {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; background: var(--b50); color: var(--blue);
}
.state .ic svg { width: 28px; height: 28px; }
.state.bad .ic { background: var(--rec-bg); color: var(--rec); }
.state.grey .ic { background: var(--fill); color: var(--mut); }
.state h3 { font: 700 19px/1.3 var(--display); letter-spacing: -.02em; margin: 0 0 6px; }
.state p { margin: 0 auto; color: var(--ink2); font-size: 14.5px; line-height: 1.55; max-width: 380px; }

.spinner {
  width: 30px; height: 30px; margin: 40px auto; border-radius: 50%;
  border: 3px solid var(--b100); border-top-color: var(--blue); animation: spin .8s linear infinite;
}

/* ── Файлы ─────────────────────────────────────────────────────────────── */
.files { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.file {
  display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 20px;
  background: var(--card); border: 1px solid var(--line); min-width: 0;
}
.file .th {
  width: 64px; height: 64px; border-radius: 14px; flex: none; overflow: hidden; position: relative;
  background: var(--b50); color: var(--blue); display: grid; place-items: center; cursor: pointer; border: 0; padding: 0;
}
.file .th img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; display: block; }
.file .th svg { width: 24px; height: 24px; }
.file .th .play {
  position: absolute; inset: auto 4px 4px auto; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(6, 10, 22, .6); color: #fff; display: grid; place-items: center;
}
.file .th .play svg { width: 11px; height: 11px; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 14px; }
.shot { aspect-ratio: 1; border: 0; padding: 0; border-radius: 14px; overflow: hidden; background: var(--b50); cursor: pointer; }
.shot img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; display: block; }
.file .meta { flex: 1; min-width: 0; }
.file .nm { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .sz { font-size: 12.5px; color: var(--mut); }
.file .acts { display: flex; gap: 6px; flex: none; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 14px; border: 0; cursor: pointer;
  background: var(--b50); color: var(--blue); display: grid; place-items: center; text-decoration: none;
}
.icon-btn:hover { text-decoration: none; }
.icon-btn svg { width: 19px; height: 19px; }

/* ── Просмотр ──────────────────────────────────────────────────────────── */
.lb {
  position: fixed; inset: 0; z-index: 50; background: #04070F;
  display: flex; flex-direction: column; color: #fff;
}
.lb .bar {
  display: flex; align-items: center; gap: 8px; padding: calc(var(--safe-t) + 10px) 12px 10px;
}
.lb .bar .t { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb .bar .t small { display: block; color: rgba(255, 255, 255, .6); font-size: 12px; }
.lb .icon-btn { background: rgba(255, 255, 255, .12); color: #fff; }
.lb .seg { display: flex; flex: none; padding: 3px; gap: 2px; border-radius: 12px; background: rgba(255, 255, 255, .12); }
.lb .seg button { font: 600 12.5px/1 var(--body, inherit); color: rgba(255, 255, 255, .75); background: transparent; border: 0; border-radius: 9px; padding: 9px 10px; cursor: pointer; min-height: 36px; }
.lb .seg button.on { background: #fff; color: #0A1430; }
.lb .stage { flex: 1; min-height: 0; min-width: 0; display: grid; place-items: center; padding: 8px; position: relative; overflow: hidden; }
/* Снимок и видео вписываются в экран целиком (без прокрутки и выхода за края) */
.lb .stage img, .lb .stage video {
  position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px);
  object-fit: contain; border-radius: 6px; background: transparent;
}
.lb .stage audio { width: min(460px, 100%); }
.lb .nav {
  position: absolute; top: 50%; margin-top: -22px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(6, 10, 22, .55); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 0 0 1px rgba(255, 255, 255, .25);
}
.lb .nav svg { width: 22px; height: 22px; }
.lb .nav.prev { left: 10px; }
.lb .nav.next { right: 10px; }
.lb .foot { padding: 8px 12px calc(var(--safe-b) + 14px); text-align: center; font-size: 11.5px; color: rgba(255, 255, 255, .65); word-break: break-all; }

/* ── Протокол на странице материалов ── */
.prot { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.prot .pi { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--b50); color: var(--blue); }
.prot .pi svg { width: 22px; height: 22px; }

/* ── Главная ───────────────────────────────────────────────────────────── */
.hero { display: flex; flex-direction: column; align-items: flex-start; padding: 10px 0 8px; }
.hero .seal { width: 112px; height: 112px; margin: 0 0 18px; }
.hero .seal .disc { width: 60px; height: 60px; margin: -30px 0 0 -30px; background: var(--seal); border: 0; }
.hero .seal .disc svg { width: 36px; height: auto; transform: translate(-4%, -6%); }
.hero h1 { font-size: 30px; margin: 0 0 12px; }
.steps { display: grid; gap: 10px; counter-reset: s; }
.step { display: flex; gap: 14px; align-items: flex-start; }
.step .n {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--b50); color: var(--blue); font: 700 14px/1 var(--display);
}
.step b { display: block; font-size: 15.5px; margin: 5px 0 2px; }
.step p { margin: 0; font-size: 14px; color: var(--ink2); line-height: 1.5; }
.stores { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.store {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink); min-width: 0;
}
.store svg { width: 26px; height: 26px; flex: none; }
.store b { display: block; font-size: 14.5px; line-height: 1.2; }
.store span { font-size: 12px; color: var(--mut); }
.or { display: flex; align-items: center; gap: 10px; margin: 16px 0 6px; color: var(--mut); font-size: 13px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

footer.foot {
  text-align: center; color: var(--mut); font-size: 12.5px; line-height: 1.7; padding: 30px 12px 0;
}
footer.foot b { color: var(--ink2); font-weight: 600; }
footer.foot a { color: var(--mut); text-decoration: underline; text-underline-offset: 2px; }

/* ── Анимации ──────────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.fade-in { animation: rise .35s both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition: none !important; }
  .seal .ros .draw { stroke-dashoffset: 0; }
}

@media (min-width: 600px) {
  .page { padding-left: 24px; padding-right: 24px; }
  .card { padding: 22px; }
  .hero h1 { font-size: 36px; }
}
@media (max-width: 360px) {
  .verdict .word { font-size: 22px; }
  .verdict .word.long { font-size: 17px; }
  .seal { width: 74px; height: 74px; }
  .stores { grid-template-columns: 1fr; }
}
