/* Шрифты Golos Text и Unbounded (OFL), хранятся у нас — без внешних запросов */
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/golos-text-cyrillic-400-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/golos-text-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("/assets/fonts/golos-text-cyrillic-500-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("/assets/fonts/golos-text-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/assets/fonts/golos-text-cyrillic-600-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/assets/fonts/golos-text-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("/assets/fonts/unbounded-cyrillic-500-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("/assets/fonts/unbounded-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/assets/fonts/unbounded-cyrillic-700-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/assets/fonts/unbounded-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #F4F5F9;
  --surface: #FFFFFF;
  --ink: #141A33;
  --muted: #5F6784;
  --line: #E0E3EE;
  --soft: #EBEEF6;
  --on-ink: #FFFFFF;
  --cold: #4F6BED;
  --warm: #F2A33A;
  --hot: #E5484D;
  --ok: #1F8A5B;
  --font-ui: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Unbounded", "Golos Text", system-ui, sans-serif;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 20px;
  --tabbar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1124; --surface: #151A33; --ink: #ECEEF8; --muted: #979EBE;
    --line: #262C4C; --soft: #1D2344; --on-ink: #0D1124; --ok: #49C08A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1124; --surface: #151A33; --ink: #ECEEF8; --muted: #979EBE;
  --line: #262C4C; --soft: #1D2344; --on-ink: #0D1124; --ok: #49C08A;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cold); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom));
}
#view { outline: none; }

/* ---------- верхняя панель */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 0 14px;
}
.brand {
  font: 700 18px/1 var(--font-display);
  letter-spacing: -0.01em;
  text-decoration: none;
}
.plan-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 13px; font-weight: 500; text-decoration: none; color: var(--muted);
}
.plan-pill b { color: var(--ink); font-weight: 600; }
.plan-pill.pro b { color: var(--hot); }

/* ---------- нижние вкладки */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 500;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a[aria-current="page"] svg { stroke-width: 2.3; }

/* ---------- заголовки разделов */
.section-head { margin: 6px 0 14px; }
.section-head h1 { font: 600 24px/1.2 var(--font-ui); margin: 0; letter-spacing: -0.01em; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 14.5px; }

.notice {
  margin: 0 0 14px; padding: 10px 14px; border-radius: var(--r-md);
  background: var(--soft); color: var(--muted); font-size: 14px;
}

/* ---------- лента */
.sheet {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}
.story {
  display: grid; grid-template-columns: 56px 1fr; gap: 14px;
  padding: 16px 16px 16px 14px;
  border-top: 1px solid var(--line);
  transition: opacity .25s ease, transform .25s ease;
}
.story:first-child { border-top: 0; }
.story.leaving { opacity: 0; transform: translateX(24px); }

.heat { display: flex; flex-direction: column; align-items: center; padding-top: 2px; }
.heat-num {
  font: 700 22px/1 var(--font-display);
  color: var(--heat);
  font-variant-numeric: tabular-nums;
}
.fever { display: flex; gap: 3px; margin-top: 9px; }
.fever i { display: block; width: 8px; height: 16px; border-radius: 2px; background: var(--soft); }
.fever i.on { background: var(--heat); }

.story-title { margin: 0; font-size: 16.5px; line-height: 1.38; font-weight: 600; text-wrap: pretty; }
.story-title button {
  all: unset; cursor: pointer; display: block;
}
.story-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.chip {
  padding: 3px 9px; border-radius: 999px; background: var(--soft);
  font-size: 12.5px; color: var(--muted); font-weight: 500;
}
.age { font-size: 12.5px; color: var(--muted); }
.story-match { margin-top: 6px; font-size: 13px; color: var(--muted); }

.sources { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.sources a {
  display: block; font-size: 14px; line-height: 1.4; text-decoration: none;
  padding: 8px 10px; border-radius: var(--r-sm); background: var(--soft);
}
.sources small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }

.story-actions { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14.5px; font-weight: 600; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-hot { background: var(--hot); color: #fff; }
.btn-block { width: 100%; height: 48px; font-size: 16px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-wait { color: var(--muted); font-size: 14px; display: inline-flex; gap: 8px; align-items: center; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); display: inline-grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.icon-btn[aria-pressed="true"] { color: var(--cold); border-color: var(--cold); background: var(--soft); }
.story-actions .spacer { flex: 1; }

.locked {
  display: flex; gap: 14px; align-items: center; justify-content: space-between;
  padding: 16px; border-top: 1px solid var(--line); background: var(--soft);
}
.locked p { margin: 0; font-size: 14.5px; }
.locked b { font-weight: 600; }

.empty { text-align: center; padding: 40px 20px; }
.empty p { color: var(--muted); margin: 0 0 16px; }

/* ---------- ожидание: шкала «разогревается» */
.warming { display: flex; gap: 5px; align-items: flex-end; height: 34px; }
.warming i { width: 10px; border-radius: 3px; animation: warm 1.4s ease-in-out infinite; }
.warming i:nth-child(1) { height: 12px; background: var(--cold); }
.warming i:nth-child(2) { height: 20px; background: #8A6FD8; animation-delay: .15s; }
.warming i:nth-child(3) { height: 27px; background: var(--warm); animation-delay: .3s; }
.warming i:nth-child(4) { height: 34px; background: var(--hot); animation-delay: .45s; }
.warming.small { height: 16px; gap: 3px; }
.warming.small i { width: 4px; }
.warming.small i:nth-child(1) { height: 6px; } .warming.small i:nth-child(2) { height: 9px; }
.warming.small i:nth-child(3) { height: 12px; } .warming.small i:nth-child(4) { height: 16px; }
@keyframes warm { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .warming i { animation: none; opacity: .8; } .story { transition: none; } }

.skeleton { height: 120px; border-top: 1px solid var(--line); background: linear-gradient(90deg, transparent, var(--soft), transparent); }
.skeleton:first-child { border-top: 0; }

/* ---------- статья */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 14.5px; margin: 2px 0 14px; }
.article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 20px; }
.article-version { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.article h1 { font: 500 22px/1.3 var(--font-display); margin: 0 0 10px; letter-spacing: -0.01em; text-wrap: balance; }
.article .dek { font-size: 17px; line-height: 1.5; color: var(--muted); margin: 0 0 18px; }
.article-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 22px; }
.prose { font-size: 17px; line-height: 1.65; }
.prose h2 { font-size: 19px; line-height: 1.35; margin: 26px 0 8px; font-weight: 600; }
.prose h3 { font-size: 17px; margin: 20px 0 6px; font-weight: 600; }
.prose p { margin: 0 0 14px; max-width: 68ch; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose a { color: var(--cold); }
.prose code { background: var(--soft); padding: 1px 5px; border-radius: 5px; font-size: .92em; }
.src-list { margin: 22px 0 0; padding: 16px 0 0; border-top: 1px solid var(--line); }
.src-list h2 { font-size: 15px; margin: 0 0 8px; font-weight: 600; }
.src-list ol { margin: 0; padding-left: 20px; font-size: 14px; color: var(--muted); }
.src-list a { color: var(--muted); word-break: break-all; }

.checklist {
  margin-top: 16px; padding: 18px 18px 8px; border-radius: var(--r-lg);
  background: var(--soft);
}
.checklist h2 { font-size: 16px; margin: 0 0 4px; font-weight: 600; }
.checklist > p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.checklist h3 { font-size: 14px; margin: 14px 0 6px; font-weight: 600; color: var(--muted); }
.checklist ul { margin: 0 0 10px; padding-left: 20px; font-size: 15px; }

.rewrite { margin-top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; }
.rewrite h2 { font-size: 16px; margin: 0 0 10px; font-weight: 600; }
.rewrite p { margin: 0 0 12px; color: var(--muted); font-size: 14.5px; }

.waiting { display: grid; justify-items: center; gap: 16px; text-align: center; padding: 56px 20px; }
.waiting p { margin: 0; color: var(--muted); max-width: 32ch; }

/* ---------- списки и формы */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li + li { border-top: 1px solid var(--line); }
.rows a { display: grid; gap: 4px; padding: 14px 16px; text-decoration: none; }
.rows .row-title { font-weight: 600; line-height: 1.35; }
.rows .row-meta { display: flex; gap: 10px; font-size: 13px; color: var(--muted); }
.status-done { color: var(--ok); }
.status-error { color: var(--hot); }

.form { display: grid; gap: 22px; }
.field { display: grid; gap: 8px; }
.field > label, .field > .label { font-weight: 600; font-size: 15px; }
.field .hint { font-size: 13.5px; color: var(--muted); margin-top: -4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface);
  font-size: 16px; line-height: 1.4;
}
.field textarea { min-height: 96px; resize: vertical; }
.topic-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-chips button {
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 14.5px; cursor: pointer; font-weight: 500;
}
.topic-chips button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; }
.card + .card { margin-top: 12px; }
.card h2 { font-size: 16px; margin: 0 0 10px; font-weight: 600; }
.card p { margin: 0 0 10px; color: var(--muted); font-size: 14.5px; }
.account { display: flex; gap: 12px; align-items: center; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--soft); object-fit: cover; display: grid; place-items: center; font-weight: 600; }

/* ---------- тариф */
.compare { width: 100%; border-collapse: collapse; font-size: 15px; }
.compare th, .compare td { padding: 11px 0; border-top: 1px solid var(--line); text-align: left; }
.compare thead th { border-top: 0; font-size: 13px; color: var(--muted); font-weight: 500; padding-top: 0; }
.compare td:nth-child(2), .compare th:nth-child(2) { color: var(--muted); }
.compare td:nth-child(2), .compare td:nth-child(3), .compare th:nth-child(2), .compare th:nth-child(3) { text-align: right; width: 22%; }
.compare td:nth-child(3) { font-weight: 600; }
.pro-title { font: 700 30px/1.1 var(--font-display); margin: 6px 0 8px; }
.pro-title span { color: var(--hot); }
.pay { display: grid; gap: 10px; margin-top: 18px; }
.pay small { color: var(--muted); text-align: center; font-size: 13px; }

/* ---------- вход */
.login { min-height: 88vh; display: grid; align-content: center; gap: 18px; padding: 24px 4px; }
.login .mark { display: flex; gap: 7px; align-items: flex-end; height: 64px; }
.login .mark i { width: 18px; border-radius: 4px; }
.login h1 { font: 700 36px/1.05 var(--font-display); margin: 0; letter-spacing: -0.02em; }
.login p { margin: 0; font-size: 18px; line-height: 1.5; color: var(--muted); max-width: 34ch; }
.login .small { font-size: 14px; }
.login-actions { display: grid; gap: 12px; justify-items: start; margin-top: 8px; }

/* ---------- уведомления */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom)); z-index: 20;
  width: min(560px, calc(100% - 32px));
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: 12px 14px 12px 16px; border-radius: var(--r-md);
  background: var(--ink); color: var(--on-ink); font-size: 14.5px;
  box-shadow: 0 8px 24px rgba(20, 26, 51, .25);
}
.toast button { background: none; border: 0; color: var(--on-ink); font-weight: 600; text-decoration: underline; cursor: pointer; padding: 4px; white-space: nowrap; }

.company { text-align: center; color: var(--muted); font-size: 13px; margin: 20px 0 0; }

/* обложка статьи */
.cover { margin: 0 0 18px; }
.cover img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; background: var(--line, #e6e8f0); }
.cover .btn { margin-top: 10px; }
.cover-wait { display: flex; align-items: center; justify-content: center; gap: 10px; aspect-ratio: 16 / 9; border-radius: 12px; background: var(--line, #e6e8f0); color: var(--muted, #5b6280); }
.cover-err { margin: 0 0 14px; }
