:root {
  --bg: #f3efe6;
  --bg2: #e7f0ea;
  --ink: #1f2a24;
  --muted: #5d6b63;
  --card: rgba(255, 252, 247, 0.86);
  --line: rgba(47, 74, 58, 0.12);
  --sage: #3f6f58;
  --sage-2: #6f9b82;
  --blush: #d9848a;
  --blush-soft: #f3d5d4;
  --warn: #b85a3d;
  --shadow: 0 18px 50px rgba(41, 58, 48, 0.08);
  --radius: 22px;
  --font: "Manrope", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #f7e7e4 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #dceee4 0%, transparent 50%),
    linear-gradient(180deg, var(--bg), var(--bg2));
  min-height: 100vh;
  line-height: 1.45;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.5;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.eyebrow { margin: 0; color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 24px clamp(16px, 4vw, 40px) 8px;
}
.top.compact { padding-bottom: 0; }
.brand { display: flex; gap: 14px; align-items: center; }
.logo {
  width: 48px; height: 48px; border-radius: 16px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #eff7f1, #f8e9e7);
  color: var(--sage); font-size: 1.4rem; box-shadow: var(--shadow);
}
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back { color: var(--muted); font-weight: 600; }

.btn {
  border: 0; cursor: pointer; border-radius: 999px;
  padding: 12px 18px; font: inherit; font-weight: 600;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--sage); color: #f7fbf8; box-shadow: 0 10px 24px rgba(63,111,88,.28); }
.btn.soft { background: var(--blush-soft); color: #7a3d43; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn:disabled { opacity: .6; cursor: wait; transform: none; }

.hero-strip {
  margin: 8px clamp(16px, 4vw, 40px) 12px;
  padding: 22px 24px;
  border-radius: calc(var(--radius) + 4px);
  background: linear-gradient(120deg, rgba(255,252,247,.9), rgba(231,240,234,.75));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  animation: rise .5s ease both;
}
.hero-copy h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: 6px; }
.hero-copy p { margin: 0; color: var(--muted); max-width: 58ch; }
.stats { display: flex; gap: 10px; }
.stat {
  min-width: 76px; padding: 12px 14px; border-radius: 18px;
  background: rgba(255,255,255,.55); text-align: center;
}
.stat span { display: block; font-family: var(--display); font-size: 1.5rem; color: var(--sage); }
.stat small { color: var(--muted); }

.run-meta { margin: 0 clamp(16px, 4vw, 40px) 8px; color: var(--muted); font-size: .92rem; }

.tabs {
  display: flex; gap: 8px; padding: 8px clamp(16px, 4vw, 40px) 16px; flex-wrap: wrap;
}
.tabs a {
  padding: 10px 16px; border-radius: 999px; background: rgba(255,255,255,.45);
  border: 1px solid transparent; color: var(--muted); font-weight: 600;
}
.tabs a.active {
  background: #fffaf4; border-color: var(--line); color: var(--ink);
  box-shadow: var(--shadow);
}

.layout {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr);
  gap: 18px; padding: 0 clamp(16px, 4vw, 40px) 48px;
}
.feed { display: grid; gap: 14px; }
.card {
  display: grid; grid-template-columns: 220px minmax(0, 1fr);
  gap: 0; overflow: hidden; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: rise .55s ease both;
}
.card.is-new { outline: 2px solid rgba(217,132,138,.35); }
.card-media { position: relative; min-height: 180px; background: #dfe8e2; }
.card-media img, .gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph {
  height: 100%; min-height: 180px; display: grid; place-items: center; color: var(--muted);
  background: repeating-linear-gradient(-45deg, #e8efe9, #e8efe9 8px, #f4f7f4 8px, #f4f7f4 16px);
}
.ph.big { min-height: 280px; border-radius: var(--radius); }
.badge {
  position: absolute; top: 12px; right: 12px; padding: 6px 10px; border-radius: 999px;
  background: rgba(255,252,247,.92); font-size: .78rem; font-weight: 700;
}
.badge.new { left: 12px; right: auto; background: var(--blush); color: white; }
.badge.score { color: var(--sage); }
.card-body { padding: 16px 18px 18px; }
.price-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.price-row strong { font-size: 1.2rem; }
.source { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.card-body h3 { font-size: 1.15rem; margin: 6px 0; }
.meta, .hint { color: var(--muted); margin: 0; }
.summary { margin: 10px 0; color: #314038; }
.summary.big { font-size: 1.05rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.chips span {
  font-size: .78rem; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  background: #e8f1ec; color: var(--sage);
}
.chips span.warn { background: #f8e5dc; color: var(--warn); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.side { display: grid; gap: 14px; align-content: start; position: sticky; top: 16px; height: fit-content; }
.side-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.side-card h3 { margin-bottom: 10px; }
.soft-note ul { margin: 0; padding-left: 18px; color: var(--muted); }
.map { width: 100%; height: 320px; border-radius: 16px; overflow: hidden; background: #d7e4db; }
.map.tall { height: 360px; }

.empty {
  padding: 48px 28px; text-align: center; border-radius: var(--radius);
  background: var(--card); border: 1px dashed var(--line);
}

.detail { padding: 8px clamp(16px, 4vw, 40px) 48px; }
.gallery {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-bottom: 16px;
}
.gallery img {
  height: 180px; border-radius: 16px; border: 1px solid var(--line);
}
.gallery img:first-child { grid-column: span 2; grid-row: span 2; height: 368px; }
.detail-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; }
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.price-lg { font-family: var(--display); font-size: 2rem; color: var(--sage); }
.scoreboard {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0;
}
.scoreboard div {
  text-align: center; padding: 12px; border-radius: 16px; background: #eef5f0;
}
.scoreboard b { display: block; font-family: var(--display); font-size: 1.5rem; }
.scoreboard span { color: var(--muted); font-size: .8rem; }
.scoreboard .bad { background: #f8e5dc; }
.list { padding-left: 18px; }
.list.nice li::marker { color: var(--sage-2); }
.list.warn li::marker { color: var(--warn); }
.desc {
  white-space: pre-wrap; font-family: inherit; background: #f7f3eb;
  border-radius: 14px; padding: 14px; max-height: 280px; overflow: auto;
}
.status-forms { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.facts { list-style: none; padding: 0; margin: 14px 0 0; }
.facts li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.facts span { color: var(--muted); }
.facts b { text-align: right; font-weight: 600; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px;
  box-shadow: var(--shadow); z-index: 20;
}

.taste-line { margin: 10px 0 0; color: #3d5347; font-size: .95rem; max-width: 62ch; }
.settings-form h3 { margin: 18px 0 10px; }
.form-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
}
.form-grid label, .checks label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: var(--muted); font-size: .9rem; }
.form-grid input, .settings-form textarea, .dislike-form textarea {
  font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; background: #fffaf4;
}
.settings-form textarea, .dislike-form textarea { width: 100%; resize: vertical; }
.checks { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0 8px; }
.checks label { flex-direction: row; align-items: center; gap: 8px; }
.feedback-box {
  margin-top: 18px; padding: 16px; border-radius: 18px; background: #eef5f0;
}
.tg-box { margin-top: 12px; }
#tgQrWrap { margin-top: 14px; display: grid; gap: 8px; justify-items: start; }
#tgQr { border-radius: 16px; background: #fff; padding: 8px; border: 1px solid var(--line); }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.mobile-bar { display: none; }
.desktop-only { display: block; }
.detail-title {
  padding: 4px clamp(16px, 4vw, 40px) 12px;
}
.detail-title h1 { font-size: clamp(1.25rem, 4vw, 1.85rem); }
.detail-top { width: 100%; }
.source-btn { white-space: nowrap; }

@media (max-width: 960px) {
  .form-grid { grid-template-columns: 1fr; }
  .layout {
    grid-template-columns: 1fr;
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }
  .detail-grid { grid-template-columns: 1fr; }
  .side { position: static; order: -1; }
  .card { grid-template-columns: 1fr; }
  .card-media { min-height: 200px; max-height: 240px; }
  .card-media img { max-height: 240px; }
  .gallery { grid-template-columns: 1fr 1fr; }
  .gallery img, .gallery img:first-child { grid-column: auto; grid-row: auto; height: 140px; }
  .top {
    flex-direction: row;
    align-items: center;
    padding: 14px 16px 6px;
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
  }
  .top h1 { font-size: 1.35rem; }
  .logo { width: 40px; height: 40px; border-radius: 12px; font-size: 1.15rem; }
  .desktop-actions { display: none; }
  .desktop-only { display: none; }
  .hero-strip {
    margin: 6px 12px 8px;
    padding: 16px;
    flex-direction: column;
    gap: 12px;
  }
  .hero-copy h2 { font-size: 1.35rem; }
  .stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }
  .stat {
    min-width: 0;
    padding: 10px 6px;
    border-radius: 14px;
  }
  .stat span { font-size: 1.2rem; }
  .stat small { font-size: .68rem; }
  .run-meta { margin: 0 12px 4px; font-size: .85rem; }
  .tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 8px 12px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a {
    flex: 0 0 auto;
    padding: 12px 16px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .layout { padding: 0 12px 48px; gap: 12px; }
  .map { height: 220px; }
  .map.tall { height: 240px; }
  .card-body { padding: 14px; }
  .card-actions .btn {
    flex: 1 1 auto;
    text-align: center;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .btn {
    min-height: 44px;
    padding: 12px 16px;
    font-size: .95rem;
  }
  .scoreboard { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .scoreboard b { font-size: 1.25rem; }
  .detail { padding: 8px 12px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .panel { padding: 16px; }
  .price-lg { font-size: 1.6rem; }
  .status-forms .btn, .feedback-box .btn {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
  }
  .facts li { flex-direction: column; align-items: flex-start; gap: 2px; }
  .facts b { text-align: left; }
  .toast {
    left: 12px; right: 12px; transform: none; width: auto;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    text-align: center;
  }
  .mobile-bar {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    gap: 8px;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 252, 247, 0.94);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 28px rgba(41, 58, 48, 0.08);
  }
  .mobile-bar form { display: contents; }
  .mobile-bar .btn { width: 100%; justify-content: center; }
  #tgQr { max-width: 100%; height: auto; }
  .settings-form textarea { font-size: 16px; } /* без зума iOS */
  .form-grid input { font-size: 16px; }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .gallery { grid-template-columns: 1fr; }
  .gallery img, .gallery img:first-child { height: 200px; }
}
