:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #efebe4;
  --text: #1d1b18;
  --muted: #6f6a62;
  --line: #e2ddd4;
  --accent: #e0461d;
  --accent-ink: #ffffff;
  --good: #1f7a4d;
  --good-bg: #e3f2e9;
  --bad: #b3261e;
  --bad-bg: #fbe6e4;
  --info: #255f9c;
  --info-bg: #e4eef9;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 14px rgb(0 0 0 / 5%);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151412;
    --surface: #1f1d1a;
    --surface-2: #2a2723;
    --text: #f1ede6;
    --muted: #a39d93;
    --line: #34302b;
    --accent: #ff6a3d;
    --accent-ink: #1a0c06;
    --good: #6fd09b;
    --good-bg: #17301f;
    --bad: #ff8a80;
    --bad-bg: #3a1a17;
    --info: #8ab8ec;
    --info-bg: #182638;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Noto Sans CJK SC", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
main { max-width: 760px; margin: 0 auto; padding: 12px 16px 48px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
code { font: 14px ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Шапка */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.back { font-size: 30px; line-height: 1; padding: 0 6px 4px 0; color: var(--accent); }
.logo { font-weight: 800; letter-spacing: -0.02em; color: var(--accent); font-size: 19px; }
.search { flex: 1; min-width: 0; }
.search input, .filter {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface-2); border: 1px solid transparent; border-radius: 10px;
  padding: 8px 12px; outline: none;
}
.search input:focus, .filter:focus { border-color: var(--accent); }
.filter { margin: 8px 0 4px; }

.h1 { font-size: 24px; line-height: 1.2; margin: 12px 0 14px; letter-spacing: -0.01em; }
.h2 { font-size: 17px; margin: 22px 0 10px; }

/* Главная */
.cat { margin-bottom: 26px; }
.cat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 18px 0 10px; }
.cat-head h2 { font-size: 19px; margin: 0; }
.empty { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; margin: 0; }

/* Карточка рейтинга */
.rank {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 10px; overflow: hidden; border: 1px solid var(--line);
}
.rank-link { display: grid; grid-template-columns: auto 72px 1fr; gap: 12px; padding: 12px; align-items: start; }
.num {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px;
}
.rank h3 { font-size: 16px; margin: 0 0 2px; line-height: 1.3; }
.why { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: var(--surface-2); }
.thumb.sm { width: 56px; height: 56px; }
.thumb.ph { display: grid; place-items: center; font-weight: 700; color: var(--muted); font-size: 22px; }
.price { font-weight: 700; font-size: 17px; }

/* Кнопки */
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.actions.compact { margin: 0; padding: 0 12px 12px; }
.btn {
  flex: 1 1 auto; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 14px; border-radius: 12px; font: inherit; font-size: 15px; font-weight: 600;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; flex-basis: 100%; }
.btn:active { transform: scale(0.98); }

/* Список */
.rows { display: grid; gap: 8px; }
.row {
  display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
}
.row-title { font-weight: 600; font-size: 15px; line-height: 1.3; }
.row-meta { font-size: 14px; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; }
.row-meta .price { font-size: 15px; }
.row[hidden] { display: none; }

.tag {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}
.tag.good { background: var(--good-bg); color: var(--good); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.info, .tag.link { background: var(--info-bg); color: var(--info); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); }
.chip b { font-weight: 700; }

.avoid { background: var(--bad-bg); border-radius: var(--radius); padding: 2px 16px 6px; margin-top: 18px; }
.avoid .h2 { color: var(--bad); margin-top: 14px; }
.avoid ul { padding-left: 18px; margin: 0 0 10px; }
.avoid li { margin-bottom: 6px; font-size: 15px; }

/* Товар */
.gallery {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory;
  margin: 0 -16px; padding: 4px 16px 8px; scrollbar-width: none;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery img {
  flex: 0 0 86%; max-width: 420px; aspect-ratio: 1; object-fit: contain; scroll-snap-align: center;
  background: #fff; border-radius: var(--radius); border: 1px solid var(--line);
}
.gallery img:only-child { flex-basis: 100%; }
.crumbs { margin: 8px 0 0; font-size: 14px; }
.crumbs a { color: var(--accent); }
.crumbs + .h1 { margin-top: 4px; }
.price-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.price-row .price { font-size: 24px; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 14px 10px; margin: 12px 0; }
.box .h2 { margin-top: 12px; }
.verdict { border-left: 4px solid var(--accent); padding-top: 10px; }
.verdict p { margin: 0 0 6px; }
.facts { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 6px 12px; margin: 10px 0; font-size: 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.quotes { padding-left: 18px; font-size: 15px; }
.quotes li { margin-bottom: 6px; }

details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 14px 0; }
summary { cursor: pointer; font-weight: 600; }
.queries ul { padding-left: 18px; font-size: 15px; }
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 10px; }
.shot-grid img { width: 100%; aspect-ratio: 9 / 19; object-fit: cover; object-position: top; border-radius: 8px; background: var(--surface-2); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 640px) {
  .btn.primary { flex-basis: auto; }
  .gallery img { flex-basis: 60%; }
}
