:root {
  --bg: #f6f0ec;
  --bg-deep: #efe6e0;
  --ink: #241816;
  --muted: #8a736c;
  --line: rgba(36, 24, 22, 0.1);
  --card: #fffaf7;
  --accent: #c45c6a;
  --accent-deep: #9e3f4c;
  --accent-soft: rgba(196, 92, 106, 0.12);
  --champagne: #c9a27a;
  --shadow: 0 18px 40px rgba(60, 32, 28, 0.1);
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font-display: "Fraunces", Georgia, serif;
  --font-ui: "Outfit", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-ui);
  background:
    radial-gradient(920px 480px at 12% -8%, rgba(201, 162, 122, 0.28), transparent 55%),
    radial-gradient(780px 420px at 100% 8%, rgba(196, 92, 106, 0.14), transparent 52%),
    radial-gradient(640px 360px at 50% 100%, rgba(255, 255, 255, 0.7), transparent 60%),
    linear-gradient(180deg, #faf5f1 0%, #f0e7e1 48%, #ebe1da 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.app {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 8px calc(24px + var(--safe-b));
  position: relative;
}

.top {
  text-align: center;
  margin-bottom: 16px;
  animation: rise 0.55s ease both;
}

.brand-mark {
  display: inline-block;
  margin: 0 0 8px;
  padding: 0.12em 0.06em 0.22em;
  font-family: var(--font-display);
  font-size: clamp(34px, 9vw, 48px);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.35;
  overflow: visible;
  color: #5c2f2c;
  background: linear-gradient(135deg, #2a1a18 0%, #7a4a42 45%, #c45c6a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  /* Fraunces: ровные глифы + запас снизу, чтобы хвост «y» не обрезался */
  font-optical-sizing: none;
  font-variation-settings: "WONK" 0, "SOFT" 0, "opsz" 48;
}

.top h1 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.top-sub {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.filter-bar {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 14px;
  animation: rise 0.5s ease 0.06s both;
}

.chip {
  border: 1px solid var(--line);
  background: rgba(255, 250, 247, 0.72);
  color: var(--muted);
  border-radius: 14px;
  padding: 0 14px;
  font: 600 13px/1 var(--font-ui);
  cursor: pointer;
  transition: 0.2s ease;
  backdrop-filter: blur(10px);
  white-space: nowrap;
  flex: 0 0 auto;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chip.active {
  background: linear-gradient(135deg, #d47884, #c45c6a 55%, #9e3f4c);
  border-color: transparent;
  color: #fffaf8;
  box-shadow: 0 10px 22px rgba(196, 92, 106, 0.28);
}

.cat-btn {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255, 250, 247, 0.8);
  color: var(--ink);
  border-radius: 16px;
  padding: 9px 12px;
  cursor: pointer;
  min-height: 48px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  backdrop-filter: blur(10px);
}

.cat-btn:hover {
  border-color: rgba(196, 92, 106, 0.35);
  box-shadow: var(--shadow);
}

.cat-btn-label {
  grid-column: 1;
  grid-row: 1;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.cat-btn-value {
  grid-column: 1;
  grid-row: 2;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.cat-btn-chevron {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 14px;
}

.cat-sheet.hidden { display: none; }
.cat-sheet {
  position: fixed;
  inset: 0;
  z-index: 45;
}
.cat-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 16, 14, 0.42);
  backdrop-filter: blur(6px);
  animation: fade 0.25s ease;
}
.cat-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(78vh, 640px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #fffaf7 0%, #f4ebe5 100%);
  border-radius: 28px 28px 0 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  box-shadow: 0 -24px 60px rgba(40, 20, 18, 0.18);
  animation: slide 0.34s ease;
  padding-bottom: var(--safe-b);
}
.cat-sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line);
}
.cat-sheet-eyebrow {
  margin: 0 0 4px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.cat-sheet-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: var(--ink);
}
.cat-sheet-list {
  overflow: auto;
  padding: 8px 12px 18px;
  -webkit-overflow-scrolling: touch;
}
.cat-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid rgba(36, 24, 22, 0.06);
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 14px 10px;
  cursor: pointer;
}
.cat-option:last-child { border-bottom: 0; }
.cat-option.active { color: var(--accent-deep); }
.cat-option-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}
.cat-option-count {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  margin-left: auto;
  margin-right: 10px;
}
.cat-option.active .cat-option-count { color: var(--accent); }
.cat-option-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 12px;
  color: transparent;
  flex: 0 0 auto;
}
.cat-option.active .cat-option-check {
  background: linear-gradient(135deg, #d47884, #c45c6a);
  border-color: transparent;
  color: #fff;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 6px;
}

.load-more-wrap {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 22px 0 4px;
}

.load-more-wrap[hidden] { display: none; }

.load-state {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.load-more {
  min-width: 150px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: 600 12px/1 var(--font-ui);
  cursor: pointer;
}

.load-more:disabled { opacity: 0.55; }

/* Durger King–style product cell: photo → title · price → CTA */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
  cursor: pointer;
  text-align: center;
  padding: 0;
  color: inherit;
  animation: rise 0.5s ease both;
  transition: transform 0.22s ease;
}

.card:hover { transform: translateY(-2px); }
.card:active { transform: scale(0.98); }

.card-media {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 10px 24px rgba(50, 28, 24, 0.08);
}

.card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(36, 24, 22, 0.06);
  pointer-events: none;
}

.card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  background: #ebe0d8;
  transition: transform 0.45s ease;
}

.card:hover img { transform: scale(1.04); }

.card-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #d47884, #9e3f4c);
}
.card-badge.sold-badge {
  background: linear-gradient(135deg, #8a736c, #5c4a45);
}
.card.sold { opacity: 0.72; }
.card.sold img { filter: grayscale(0.28) contrast(0.95); }

.card-meta {
  margin: 0;
  padding: 0 2px;
  width: 100%;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

.card-meta .card-title-text {
  font-weight: 600;
}

.card-meta .card-dot {
  color: var(--muted);
  font-weight: 400;
}

.card-meta .card-price-text {
  color: var(--accent-deep);
  font-weight: 700;
  white-space: nowrap;
}

.card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  min-height: 32px;
  margin-top: 0;
  padding: 8px 6px;
  border-radius: 10px;
  background: linear-gradient(180deg, #e07a86 0%, #c45c6a 55%, #b04f5c 100%);
  color: #fffaf8;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 8px 18px rgba(196, 92, 106, 0.28);
  transition: filter 0.2s, transform 0.2s;
}

.card:hover .card-action {
  filter: brightness(1.04);
}

.card-action.sold-action {
  background: #c9bbb4;
  color: #5c4a45;
  box-shadow: none;
}

.sheet.hidden { display: none; }
.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 16, 14, 0.45);
  backdrop-filter: blur(6px);
  animation: fade 0.25s ease;
}

.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(94vh, 900px);
  overflow: auto;
  background: linear-gradient(180deg, #fffaf7 0%, #f3e9e3 100%);
  border-radius: 28px 28px 0 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  box-shadow: 0 -24px 60px rgba(40, 20, 18, 0.2);
  animation: slide 0.34s ease;
  padding-bottom: var(--safe-b);
}

.sheet-x {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 250, 247, 0.88);
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.sheet-hero {
  position: relative;
}

.sheet-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  background: #ebe0d8;
}

.sheet-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 28%;
  background: linear-gradient(transparent, #f3e9e3);
}

.sheet-body { padding: 4px 20px 28px; position: relative; }

.sheet-cat {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}

.sheet-body h2 {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 7vw, 38px);
  font-weight: 600;
  line-height: 1.08;
  color: var(--ink);
}

.sheet-price {
  margin: 12px 0 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-deep);
  letter-spacing: 0.01em;
}

.sheet-desc {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

.meta {
  margin: 18px 0 0;
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.55);
}

.meta div {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px;
  padding: 12px 14px;
  font-size: 14px;
  border-top: 1px solid var(--line);
}
.meta div:first-child { border-top: 0; }
.meta dt { color: var(--muted); margin: 0; }
.meta dd { margin: 0; font-weight: 500; color: var(--ink); }

.cta-stack {
  position: sticky;
  bottom: 0;
  margin-top: 16px;
  padding: 12px 0 4px;
  background: linear-gradient(180deg, transparent, #f3e9e3 28%);
}

button.cta {
  width: 100%;
  border: 0;
  cursor: pointer;
  font: inherit;
}
button.cta:disabled {
  opacity: 0.7;
  cursor: wait;
}
.cta {
  display: block;
  text-align: center;
  text-decoration: none;
  background: linear-gradient(180deg, #e07a86 0%, #c45c6a 55%, #b04f5c 100%);
  color: #fffaf8;
  border-radius: 16px;
  padding: 16px 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 14px 28px rgba(196, 92, 106, 0.3);
}
.cta:active { transform: translateY(1px); }
.cta-disabled {
  pointer-events: none;
  opacity: 0.55;
  background: #c9bbb4 !important;
  color: #5c4a45 !important;
  box-shadow: none !important;
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(255, 250, 247, 0.5);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide {
  from { transform: translateY(28px); opacity: 0.5; }
  to { transform: none; opacity: 1; }
}

@media (min-width: 640px) {
  .app { padding-inline: 14px; }
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px 12px;
  }
  .card-meta { font-size: 13px; }
  .card-action { font-size: 12px; min-height: 36px; }
}

@media (min-width: 980px) {
  .app { padding: 24px 20px calc(36px + var(--safe-b)); }
  .grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 24px 16px;
  }
}
