:root {
  --bg: #f4f0e8;
  --card: #fffdf8;
  --card-2: #f6f1e7;
  --ink: #1f1b29;
  --muted: #6d6676;
  --line: #e3dbcd;
  --accent: #6a47c2;
  --accent-ink: #ffffff;
  --accent-soft: #ebe2ff;
  --good: #1f7a57;
  --good-soft: #dff3e9;
  --warn: #9a6512;
  --warn-soft: #f8ecd4;
  --bad: #b23b3b;
  --bad-soft: #f8e1e0;
  --hero-1: #2a1d4b;
  --hero-2: #7351c8;
  --shadow: 0 6px 18px #4c3c2914;
  --radius: 18px;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14111c; --card: #1e1a29; --card-2: #262134; --ink: #efeaf7; --muted: #a59eb3; --line: #332c43;
    --accent: #a98bff; --accent-ink: #160f2b; --accent-soft: #2f2650; --good: #5fd3a2; --good-soft: #173a2d;
    --warn: #f0b75a; --warn-soft: #3b2e17; --bad: #ff8c8c; --bad-soft: #3d1f22; --hero-1: #241944; --hero-2: #5c3fb0;
    --shadow: 0 6px 18px #00000040;
  }
}
:root[data-theme="dark"] {
  --bg: #14111c; --card: #1e1a29; --card-2: #262134; --ink: #efeaf7; --muted: #a59eb3; --line: #332c43;
  --accent: #a98bff; --accent-ink: #160f2b; --accent-soft: #2f2650; --good: #5fd3a2; --good-soft: #173a2d;
  --warn: #f0b75a; --warn-soft: #3b2e17; --bad: #ff8c8c; --bad-soft: #3d1f22; --hero-1: #241944; --hero-2: #5c3fb0;
  --shadow: 0 6px 18px #00000040;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--sans); padding-bottom: calc(76px + env(safe-area-inset-bottom)); overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); margin: 0; letter-spacing: -.01em; }
p { margin: 8px 0; }
[hidden] { display: none !important; }

/* ---------- каркас ---------- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; border: 0; background: none; padding: 0; text-align: left; font: 700 18px/1.05 var(--serif); }
.brand small { display: block; color: var(--muted); font: 600 9.5px/1.5 var(--sans); text-transform: uppercase; letter-spacing: .09em; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, var(--hero-1), var(--hero-2)); color: #fff; font-size: 16px; }
main { max-width: 760px; margin: 0 auto; padding: 14px 16px 24px; outline: none; }
#banner { max-width: 760px; margin: 0 auto; padding: 0 16px; }
#banner:empty { display: none; }

.tabbar { position: fixed; z-index: 10; bottom: 0; left: 0; right: 0; display: flex; justify-content: center;
  background: color-mix(in srgb, var(--card) 94%, transparent); border-top: 1px solid var(--line); backdrop-filter: blur(12px);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
.tabbar button { position: relative; flex: 1; max-width: 140px; border: 0; background: none; color: var(--muted); padding: 4px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.tabbar .ico { display: block; font-size: 19px; line-height: 1.3; }
.tabbar button.active { color: var(--accent); }
.tabbar button:active { background: var(--accent-soft); }
.badge { position: absolute; top: 0; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font: 700 11px/18px var(--sans); }

/* ---------- элементы ---------- */
.chip, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 999px;
  padding: 9px 14px; background: var(--accent-soft); color: var(--ink); font-weight: 650; font-size: 14px; white-space: nowrap; transition: transform .08s, background .15s; }
.chip:active, .btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.small { padding: 6px 11px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.sign-chip.temp { background: var(--warn-soft); border-color: var(--warn); }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 10px 0; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; background: var(--card-2); }
.muted { color: var(--muted); font-size: 13px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 7px; background: var(--card-2); color: var(--muted); font-size: 11.5px; font-weight: 650; }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 26px 2px 6px; }
.section-title h2 { font-size: 21px; }
.section-title span { color: var(--muted); font-size: 13px; text-align: right; }
.section-hint { color: var(--muted); font-size: 13px; margin: 0 2px 6px; }

.hero { position: relative; overflow: hidden; padding: 20px; border-radius: 24px; background: linear-gradient(140deg, var(--hero-1), var(--hero-2)); color: #fff; box-shadow: 0 14px 32px #34215a30; }
.hero::after { content: "✦  ✧  ✦"; position: absolute; right: 16px; top: 12px; opacity: .25; letter-spacing: 6px; }
.hero h1 { font-size: 28px; line-height: 1.1; margin: 6px 0 8px; }
.hero p { opacity: .9; margin: 0; }
.eyebrow { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; opacity: .8; font-weight: 700; }
.hero .row { margin-top: 14px; }
.hero .chip { background: #ffffff22; color: #fff; border-color: #ffffff33; }
.period-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 0; }
.period-nav button { border: 0; background: #ffffff1f; color: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.period-nav button[disabled] { opacity: .35; }

.notice { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; margin: 10px 0; background: var(--warn-soft); color: var(--ink); font-size: 14px; }
.notice.accent { background: var(--accent-soft); }
.notice.good { background: var(--good-soft); }
.notice .grow strong { display: block; }

.highlights { list-style: none; padding: 0; margin: 0; }
.highlights li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.highlights li:first-child { border-top: 0; padding-top: 2px; }
.highlights .t { font-weight: 700; font-size: 13px; }
.highlights .lead { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.highlights .kind-conflict .lead { color: var(--warn); }
.highlights .kind-agreement .lead { color: var(--good); }
.highlights .kind-caution .lead { color: var(--warn); }

.filters { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters .chip { background: var(--card); border-color: var(--line); font-weight: 600; font-size: 13px; padding: 7px 12px; }
.filters .chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* автор и утверждения */
.author-head { display: flex; gap: 12px; align-items: center; }
.avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font: 700 17px var(--serif); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 68px; height: 68px; font-size: 26px; }
.author-head .name { font-weight: 700; font-size: 16px; border: 0; background: none; padding: 0; text-align: left; }
.claim { padding: 12px 0; border-top: 1px dashed var(--line); }
.claim:first-of-type { border-top: 0; }
.claim-text { font-size: 16px; line-height: 1.4; margin: 6px 0 8px; }
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; color: var(--muted); font-size: 12px; }
.meter { height: 5px; border-radius: 5px; background: var(--card-2); overflow: hidden; margin-top: 4px; }
.meter i { display: block; height: 100%; border-radius: 5px; background: var(--accent); transition: width .5s; }
.meter.low i { background: var(--warn); }
.claim-actions { display: flex; gap: 6px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.vote { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 11px; font-size: 14px; }
.vote.on { background: var(--accent-soft); border-color: var(--accent); }
.claim-actions .spacer { flex: 1; }
.details { margin-top: 10px; padding: 12px; border-radius: 12px; background: var(--card-2); font-size: 14px; animation: fade .2s; }
.details blockquote { margin: 0 0 8px; padding-left: 10px; border-left: 3px solid var(--accent); font-style: italic; }
.result-pill { font-weight: 700; font-size: 13px; }

.insight { border-left: 3px solid var(--good); }
.insight.caution { border-left-color: var(--warn); }
.conflict { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; }
.conflict > div { background: var(--card-2); border-radius: 13px; padding: 12px; font-size: 14px; }
.conflict .vs { align-self: center; background: none; padding: 0; color: var(--muted); font-weight: 700; font-size: 12px; }
.ai-block h3 { font: 700 14px var(--sans); margin: 14px 0 6px; }
.ai-block ul { margin: 0; padding-left: 18px; }
.ai-block li { margin: 4px 0; }
.forecast { font: 17px/1.45 var(--serif); margin: 8px 0; }

/* статистика */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-grid .card { margin: 0; padding: 12px; }
.stat { font: 700 26px/1.1 var(--serif); }
.stat small { font-size: 14px; }
.metric-groups { display: grid; gap: 8px; margin-top: 12px; }
.metric-group { padding: 10px 12px; border-radius: 12px; background: var(--card-2); }
.metric-group b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.bars { display: flex; height: 8px; border-radius: 8px; overflow: hidden; background: var(--card-2); margin: 10px 0 4px; }
.bars i { display: block; height: 100%; }

/* проверка */
.verify-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.verify-buttons button { border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 12px 8px; font-weight: 650; font-size: 14px; }
.verify-buttons button:active { transform: scale(.97); }
.verify-buttons button.on { border-color: var(--accent); background: var(--accent-soft); }
.progress { height: 4px; border-radius: 4px; background: var(--card-2); overflow: hidden; margin: 6px 0 14px; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.leaving { animation: leave .3s forwards; }

.toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.switch { flex: none; width: 50px; height: 30px; border-radius: 20px; border: 0; background: var(--line); padding: 3px; transition: background .2s; }
.switch i { display: block; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0003; transition: transform .2s; }
.switch.on { background: var(--good); }
.switch.on i { transform: translateX(20px); }

.empty { text-align: center; padding: 40px 18px; }
.empty .big { font-size: 42px; }
.empty h2 { margin: 8px 0; font-size: 22px; }
.empty .btn { margin-top: 10px; }
.loader { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 80px 20px; color: var(--muted); }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.skeleton { height: 90px; border-radius: var(--radius); background: linear-gradient(90deg, var(--card) 0%, var(--card-2) 50%, var(--card) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; margin: 10px 0; }

.sheet { border: 0; padding: 0; width: 100%; max-width: 560px; max-height: 88vh; margin: auto auto 0; border-radius: 24px 24px 0 0; background: var(--card); color: var(--ink); }
.sheet[open] { animation: up .22s ease-out; }
.sheet::backdrop { background: #110c1a99; }
#sheetBody { padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); overflow: auto; max-height: 88vh; }
.sheet h2 { font-size: 22px; margin-bottom: 4px; }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: -6px auto 12px; }
.sign-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.sign-grid button { border: 1px solid var(--line); background: var(--card-2); border-radius: 14px; padding: 12px 4px; font-weight: 600; font-size: 13px; }
.sign-grid button .s { display: block; font-size: 24px; }
.sign-grid button.on { border-color: var(--accent); background: var(--accent-soft); }
.sign-grid button.primary-sign::after { content: "мой"; display: block; color: var(--accent); font-size: 10px; text-transform: uppercase; }

#toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 30; font-weight: 600; font-size: 14px; transition: all .2s; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.offer { border: 1px dashed var(--line); border-radius: 14px; padding: 12px; margin-top: 8px; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 9px 0; border-top: 1px solid var(--line); }
.list-plain li:first-child { border-top: 0; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes fade { from { opacity: 0; transform: translateY(-4px); } }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@keyframes leave { to { opacity: 0; transform: translateX(40px); height: 0; margin: 0; padding: 0; } }
@media (max-width: 420px) {
  .brand small { display: none; }
  .sign-chip { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; }
  .conflict { grid-template-columns: 1fr; }
  .conflict .vs { text-align: center; }
  .hero h1 { font-size: 25px; }
  .highlights li { grid-template-columns: 1fr; gap: 2px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid .card:last-child:nth-child(odd) { grid-column: span 2; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* иконки */
.i { flex: none; vertical-align: -3px; }
.tabbar .ico { display: grid; place-items: center; height: 26px; }
.tabbar .ico .i { vertical-align: 0; }
.link, .chip, .btn, .tag, a { display: inline-flex; align-items: center; gap: 5px; }
.vote { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 34px; padding: 0; color: var(--muted); }
.vote.on { color: var(--accent); }
.empty .big { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 0; }
.verify-buttons button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.verify-buttons .r-fulfilled .i { color: var(--good); }
.verify-buttons .r-partial .i { color: var(--warn); }
.verify-buttons .r-not_fulfilled .i { color: var(--bad); }
.verify-buttons .r-cannot_evaluate .i { color: var(--muted); }
.z { font-family: "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols", sans-serif; font-variant-emoji: text; color: var(--accent); font-weight: 400; }
.hero .z { color: #fff; }
.sign-grid .z { color: var(--accent); }
.author-head .name { display: flex; align-items: center; gap: 2px; text-align: left; }
.author-head .grow .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero::after { content: none; }
