:root {
  --bg: #fff6f5;
  --ink: #1c1915;
  --muted: #6f675e;
  --line: #f0d6d4;
  --card: #fff;
  --accent: #e02e24;
  --accent-dark: #c01610;
  --ok: #1f7a4d;
  --danger: #9d2c2c;
  --shadow: 0 10px 30px rgba(120, 30, 20, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #ffe1dc 0%, transparent 55%),
    radial-gradient(900px 420px at 100% 0%, #fff0c9 0%, transparent 50%),
    var(--bg);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

a { color: inherit; }

.wrap {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 calc(32px + env(safe-area-inset-bottom));
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin-bottom: 22px;
}

.brand {
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
  margin-right: auto;
}

.nav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.nav a[aria-current="page"] { color: var(--accent-dark); font-weight: 650; }

h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.lead {
  max-width: 42em;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.searchbar, .filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 22px;
}

.searchbar input[type="search"],
.searchbar input[type="url"],
.filters input[type="number"] {
  flex: 1;
  min-width: 180px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 12px 16px;
  font: inherit;
  color: inherit;
}

.filters input[type="number"] { flex: 0 0 120px; min-width: 0; border-radius: 12px; }

button, .btn {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font: inherit;
  padding: 12px 18px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.ghost, .btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

button:disabled { opacity: 0.55; cursor: not-allowed; }

.chips, .tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tabs { margin-top: 14px; margin-bottom: 10px; }

button.tab, button.chip {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
}

button.tab[aria-selected="true"],
button.chip[aria-pressed="true"] {
  background: #ffecec;
  border-color: #f0b2ad;
  color: var(--accent-dark);
}

.check {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

#activities {
  display: grid;
  gap: 4px;
  margin-top: 14px;
}

#activities .activity-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 0;
}

#activities .activity-row h2 {
  margin: 0;
  min-width: 4.5em;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
  color: var(--muted);
}

#activities .activity-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

#activities .activity-links button {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 13px;
  line-height: 1.35;
}

.section { margin-top: 34px; }

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}

.section-head h2 { margin: 0; font-size: 20px; }
.section-head a { color: var(--accent-dark); font-size: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.thumb {
  aspect-ratio: 1;
  background: #fff1ef center/cover no-repeat;
}

.thumb.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.card .body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 12px;
}

.card.rich .gallery { padding: 8px 8px 0; gap: 6px; }
.card.rich .hero { border-radius: 12px; }
.card.rich .thumbs button { flex-basis: 40px; width: 40px; height: 40px; border-radius: 8px; }
.card.rich .body { padding: 10px; gap: 6px; }
.card.rich .price strong { font-size: 16px; }
.card.rich .banner { margin-top: 0; padding: 8px 10px; font-size: 12px; }

.card-name {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.facts-box h4, .promos h4 { margin: 0 0 6px; font-size: 13px; }

.card .facts {
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 4px 8px;
  font-size: 12px;
}

.card .facts dd { min-width: 0; overflow-wrap: anywhere; }
.card .promo { font-size: 12px; padding: 6px 0; }

.shop, .muted { color: var(--muted); font-size: 12px; margin: 0; }

.title {
  font-size: 14px;
  line-height: 1.45;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: baseline; }
.price strong { color: var(--accent-dark); font-size: 18px; }
.price s { color: var(--muted); font-size: 12px; }
.price .label, .save { color: var(--ok); font-size: 12px; }
.price .label { color: var(--accent-dark); font-weight: 650; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  font-size: 11px;
  color: var(--muted);
  background: #fff1ef;
  border-radius: 999px;
  padding: 3px 8px;
}

.actions { display: flex; gap: 8px; }
.actions .btn, .actions button { flex: 1; padding: 8px 10px; font-size: 13px; }

.banner {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #fff4e8;
  border: 1px solid #f0d3a8;
}

.banner p { margin: 0 0 10px; }

.note, .banner, .empty, .error, .status {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.error {
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff1f0;
  color: var(--danger);
}

.gallery { display: grid; gap: 10px; width: 100%; min-width: 0; }

.gallery .hero {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  border-radius: 20px;
  background: #fff1ef center/cover no-repeat;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.thumbs { display: flex; gap: 8px; min-width: 0; overflow: auto; }

.thumbs button {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff1ef center/cover no-repeat;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  margin-top: 14px;
}

.panel h2, .panel h3 { margin: 0 0 10px; font-size: 16px; }

.facts { display: grid; grid-template-columns: 88px 1fr; gap: 8px 12px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.promo { padding: 10px 0; border-top: 1px solid var(--line); }
.promo:first-of-type { border-top: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  z-index: 2;
}

.sentinel { height: 1px; }

@media (max-width: 980px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .wrap { width: min(1120px, calc(100% - 20px)); }
  .grid { grid-template-columns: 1fr; gap: 10px; }
  .card .body { padding: 10px; }
  .title { font-size: 13px; }
  .price strong { font-size: 16px; }
  .actions { flex-direction: column; }
}
