:root {
  --bg: #fbf7f0;
  --surface: #ffffff;
  --surface-2: #f4ece0;
  --ink: #2a1a17;
  --muted: #7d6c63;
  --line: #ecdfcc;
  --brand: #0f5b4a;
  --brand-ink: #ffffff;
  --accent: #9b1c31;
  --gold: #b88a35;
  --gold-soft: #f3e3bf;
  --ok: #1f7a4d;
  --warn: #b4521b;
  --shadow: 0 6px 24px rgba(66, 39, 22, 0.08);
  --radius: 18px;
  --font-head: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #15110f;
  --surface: #211b18;
  --surface-2: #2b2320;
  --ink: #f4ebdf;
  --muted: #aa9b8f;
  --line: #3b302b;
  --brand: #2f9c7f;
  --brand-ink: #0b1f19;
  --accent: #e2596e;
  --gold: #dcb767;
  --gold-soft: #3a3020;
  --ok: #5cc28d;
  --warn: #f0935c;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2 { font-family: var(--font-head); font-weight: 700; line-height: 1.15; margin: 0; }
h1 { font-size: 30px; }
h2 { font-size: 23px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.warn { color: var(--warn); }

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; position: relative; }
.view { padding: 12px 16px 32px; }
body.has-tabbar .view { padding-bottom: calc(96px + var(--safe-bottom)); }
body.has-main-btn .view { padding-bottom: calc(110px + var(--safe-bottom)); }
body.has-main-btn.has-tabbar .view { padding-bottom: calc(170px + var(--safe-bottom)); }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 600; transition: transform .12s, opacity .2s, background .2s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:disabled { opacity: .5; }
.btn-ghost { background: var(--surface); border-color: var(--line); }
.btn-block { width: 100%; }
.btn svg { width: 19px; height: 19px; }
.btn.is-loading { opacity: .7; }
.link-btn { background: none; border: 0; padding: 8px 0; color: var(--brand); font-weight: 600; font-size: 14px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); display: inline-grid; place-items: center; flex: none;
}
.icon-btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); width: 36px; height: 36px; }
.icon-btn-primary svg { width: 20px; height: 20px; }

.main-btn-wrap {
  position: fixed; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px;
  bottom: 0; padding: 12px 16px calc(12px + var(--safe-bottom)); z-index: 30;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
body.has-tabbar .main-btn-wrap { bottom: calc(62px + var(--safe-bottom)); padding-bottom: 10px; }
.main-btn-wrap .btn { min-height: 52px; box-shadow: var(--shadow); }

/* ---------- Нижнее меню ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px; z-index: 31;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-bottom));
}
.tabbar[hidden] { display: none; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 4px; position: relative; }
.tabbar a.active { color: var(--brand); font-weight: 600; }
.tab-badge {
  position: absolute; top: 0; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}

/* ---------- Шапка, поиск, баннер ---------- */
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 0 14px; }
.brand-logo { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; }
.brand-text { flex: 1; min-width: 0; }
.theme-btn svg { width: 20px; height: 20px; }
.page-head-end { margin-left: auto; }
.brand-name { font-family: var(--font-head); font-size: 27px; font-weight: 700; line-height: 1; letter-spacing: .5px; }
.brand-tag { font-size: 12.5px; color: var(--muted); }
.search {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 0 14px; color: var(--muted);
}
.search input { flex: 1; border: 0; outline: 0; background: none; height: 46px; font: inherit; color: var(--ink); min-width: 0; }
.search input::-webkit-search-cancel-button { filter: grayscale(1); }

.hero {
  --hero-color: #0f5b4a;
  position: relative; overflow: hidden; margin-top: 14px; border-radius: 22px; min-height: 150px;
  background: linear-gradient(135deg, var(--hero-color), color-mix(in srgb, var(--hero-color) 72%, #000));
  color: #fbf3e2; padding: 22px 20px; display: flex; align-items: center;
}
.hero-photo { background: var(--hero-img) center / cover no-repeat, #2a1a17; min-height: 170px; }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(20, 10, 6, var(--hero-shade)), rgba(20, 10, 6, calc(var(--hero-shade) * .35))); }
.hero-pattern {
  position: absolute; inset: 0; opacity: .16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Cpath d='M22 4l18 18-18 18L4 22z' fill='none' stroke='%23f3d48a' stroke-width='1.5'/%3E%3Ccircle cx='22' cy='22' r='3' fill='%23f3d48a'/%3E%3C/svg%3E");
}
.hero-light { color: #2a1a17; background: linear-gradient(135deg, var(--hero-color), color-mix(in srgb, var(--hero-color) 85%, #8a6a3a)); }
.hero-light .hero-pattern { opacity: .3; filter: brightness(.6); }
.hero-light h2 { color: #7d1f30 !important; }
.hero-photo h2, .hero-photo p { text-shadow: 0 1px 12px rgba(0, 0, 0, .35); }
.hero-text { position: relative; max-width: 68%; }
.hero h2 { font-size: 25px; color: #f6dc9a; }
.hero p { margin: 8px 0 0; font-size: 14px; opacity: .9; }
.hero:not(:has(.hero-tulip)) .hero-text { max-width: 100%; }
.hero-tulip { position: absolute; right: -6px; bottom: -14px; width: 120px; color: #c8384f; opacity: .95; }
.hero-tulip svg { width: 100%; height: auto; }

.chips { display: flex; gap: 8px; overflow-x: auto; margin: 16px -16px 0; padding: 0 16px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.section { margin-top: 24px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

/* ---------- Карточки товаров ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.scroller { display: grid; grid-auto-flow: column; grid-auto-columns: 46%; gap: 12px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 6px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.scroller::-webkit-scrollbar { display: none; }
.scroller .card { scroll-snap-align: start; }
.card {
  position: relative; background: var(--surface); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); display: flex; flex-direction: column;
}
.card-img { aspect-ratio: 1; background: var(--surface-2); overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card.is-out .card-img img { opacity: .55; filter: grayscale(.4); }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.card-title { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.card-sub { font-size: 12.5px; color: var(--muted); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 44px; }
.price { font-weight: 700; font-size: 15.5px; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; }
.price s { font-weight: 500; font-size: 12.5px; color: var(--muted); }
.price-lg { font-size: 24px; }
.price-lg s { font-size: 15px; }

.badge {
  position: absolute; top: 10px; left: 10px; z-index: 2; padding: 3px 9px; border-radius: 999px;
  background: var(--brand); color: var(--brand-ink); font-size: 11.5px; font-weight: 600;
}
.badge-sale { background: var(--accent); color: #fff; }
.badge-gold { background: var(--gold-soft); color: var(--ink); }
.badge-muted { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
.fav {
  position: absolute; top: 8px; right: 8px; z-index: 2; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: color-mix(in srgb, var(--surface) 85%, transparent); display: grid; place-items: center; color: var(--muted);
}
.fav svg { width: 19px; height: 19px; }
.fav.on { color: var(--accent); }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.stepper button { width: 38px; height: 38px; border: 0; background: none; display: grid; place-items: center; color: var(--brand); }
.stepper button:disabled { color: var(--muted); opacity: .4; }
.stepper button svg { width: 18px; height: 18px; }
.stepper span { min-width: 22px; text-align: center; font-weight: 700; }
.stepper-sm button { width: 32px; height: 34px; }
.stepper-sm span { min-width: 16px; font-size: 14px; }

/* ---------- Пустые состояния / скелетон ---------- */
.empty { text-align: center; padding: 48px 20px; }
.empty-icon { width: 64px; margin: 0 auto 14px; color: var(--accent); opacity: .85; }
.empty h2 { margin-bottom: 6px; }
.empty p { color: var(--muted); margin: 0 0 20px; }
.skeleton .card-img, .skeleton i { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton i { display: block; height: 12px; border-radius: 6px; margin: 6px 0; }
.skeleton i + i { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.ornament { display: flex; justify-content: center; gap: 10px; color: var(--gold); margin: 18px 0; }
.ornament svg { width: 16px; height: 22px; }
.ornament svg:nth-child(2) { color: var(--accent); width: 20px; height: 26px; }

.about { margin-top: 32px; padding: 8px 18px 20px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; }
.about p { color: var(--muted); }
.about-contacts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* ---------- Карточка товара ---------- */
.page-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; }
.page-head h1 { font-size: 28px; }
.product { margin: -12px -16px 0; }
.gallery { position: relative; background: var(--surface-2); }
.gallery-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track img { flex: none; width: 100%; aspect-ratio: 1; object-fit: cover; scroll-snap-align: center; }
.gallery .fav { top: 14px; right: 14px; width: 40px; height: 40px; }
.gallery-back { position: absolute; top: 14px; left: 14px; z-index: 2; }
.dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .6); box-shadow: 0 0 0 1px rgba(0,0,0,.08); transition: width .2s; }
.dots i.on { width: 20px; border-radius: 4px; background: #fff; }
.product-info { padding: 18px 16px 0; }
.product-cat { font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.product-info h1 { margin-top: 4px; }
.product-sub { margin: 4px 0 0; color: var(--muted); }
.product-buy { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; min-height: 44px; }
.stock { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--ok); }
.stock.low { color: var(--warn); }
.stock.out { color: var(--muted); }
.product-desc { margin: 0; font-size: 15.5px; line-height: 1.65; }
.product > .section { padding: 0 16px; }
.specs { margin: 18px 0 0; display: grid; gap: 1px; background: var(--line); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.specs div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 11px 14px; background: var(--surface); }
.specs dt { color: var(--muted); font-size: 13.5px; }
.specs dd { margin: 0; font-size: 14px; }
.note { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: var(--gold-soft); font-size: 13px; }

/* ---------- Корзина ---------- */
.cart-list { display: grid; gap: 10px; }
.cart-line { display: grid; grid-template-columns: 84px 1fr auto; gap: 12px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.cart-img { width: 84px; height: 84px; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.cart-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cart-title { font-weight: 600; line-height: 1.3; }
.cart-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 6px; }
.cart-remove { width: 34px; height: 34px; border: 0; color: var(--muted); background: none; }
.cart-remove svg { width: 19px; height: 19px; }
.summary { margin-top: 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 8px; }
.summary.flat { margin-top: 10px; padding: 12px 0 0; border: 0; border-top: 1px dashed var(--line); border-radius: 0; background: none; }
.summary > div { display: flex; justify-content: space-between; gap: 12px; }
.summary > div > span:first-child { min-width: 0; }
.summary > div > span:last-child { white-space: nowrap; }
.summary-total { padding-top: 8px; border-top: 1px dashed var(--line); font-weight: 700; font-size: 17px; }

/* ---------- Оформление ---------- */
.form { display: grid; gap: 14px; }
.block { margin: 0; padding: 14px 16px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.block legend, .block-title { float: left; width: 100%; font-family: var(--font-head); font-size: 21px; font-weight: 700; margin-bottom: 10px; padding: 0; }
.block > :not(legend):not(.block-title) { clear: both; }
section.block { margin-top: 14px; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 500; }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 12px;
  padding: 12px 14px; font: inherit; outline: 0; resize: vertical; transition: border-color .2s;
}
.field input:focus, .field textarea:focus { border-color: var(--brand); }
.field .invalid, .field input.invalid, .field textarea.invalid { border-color: var(--accent); }
.option {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center;
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px; margin-bottom: 8px; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.option.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, var(--surface)); }
.option input { accent-color: var(--brand); width: 18px; height: 18px; margin: 0; }
.option-text { display: grid; gap: 2px; min-width: 0; }
.option-row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.option-text small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.option-text .free-note { color: var(--gold); font-weight: 600; }
.option-price { white-space: nowrap; }
.option-price.free { color: var(--ok); }
.form-error { color: var(--accent); font-weight: 600; margin: 0; min-height: 0; }
.form-error:empty { display: none; }

/* ---------- Заказ ---------- */
.success { text-align: center; padding: 18px 8px 8px; }
.success-icon { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; animation: pop .45s cubic-bezier(.2, 1.4, .4, 1); }
.success-icon svg { width: 36px; height: 36px; }
.success p { color: var(--muted); margin: 8px 0 0; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.order-status { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 0; }
.status { padding: 4px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--surface-2); }
.status-new { background: var(--gold-soft); color: var(--ink); }
.status-confirmed, .status-paid { background: color-mix(in srgb, var(--brand) 16%, var(--surface)); color: var(--brand); }
.status-shipped { background: color-mix(in srgb, #2f6fb4 16%, var(--surface)); color: #2f6fb4; }
.status-completed { background: var(--brand); color: var(--brand-ink); }
.status-cancelled { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent); }
.pay-card { margin-top: 14px; padding: 16px; border-radius: var(--radius); background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); }
.pay-card p { margin: 8px 0; white-space: pre-line; }
.pay-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.pay-row b { font-size: 21px; }
.pay-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.pay-actions .btn { min-height: 42px; padding: 0 10px; font-size: 13.5px; }
.order-item { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 6px 0; }
.order-item img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.stack { display: grid; gap: 10px; margin-top: 16px; }
.orders { display: grid; gap: 10px; }
.order-card { display: grid; gap: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.order-card-head, .order-card-foot { display: flex; justify-content: space-between; align-items: center; }
.order-thumbs { display: flex; gap: 6px; }
.order-thumbs img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }

/* ---------- Тост ---------- */
.toast {
  position: fixed; left: 50%; top: 14px; transform: translate(-50%, calc(-100% - 20px)); z-index: 50; opacity: 0; visibility: hidden;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  transition: transform .3s cubic-bezier(.2, 1, .3, 1), opacity .3s, visibility .3s; box-shadow: var(--shadow); width: max-content; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.center a, .about a.legal { color: var(--brand); text-decoration: underline; }
