:root {
  --bg: #0b0d12;
  --bg-soft: #11141b;
  --panel: #161a23;
  --line: rgba(255, 255, 255, .07);
  --text: #f3f0ea;
  --muted: #8c93a1;
  --gold: #c9a24a;
  --gold-soft: #e3c27a;
  --danger: #e2657a;
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior-y: none;
}

body { min-height: 100vh; }

#app {
  max-width: 620px;
  margin: 0 auto;
  padding-bottom: calc(84px + var(--safe-bottom));
}

svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* ── header ─────────────────────────────────────────────── */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 14px 14px 10px;
  background: linear-gradient(180deg, rgba(11,13,18,.98) 70%, rgba(11,13,18,.86) 100%);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brandline { display: flex; align-items: center; gap: 11px; }

.logo {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid rgba(201, 162, 74, .45);
  color: var(--gold-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  letter-spacing: 1px;
  background: radial-gradient(circle at 30% 20%, rgba(201,162,74,.18), transparent 70%);
}

.shop { font-family: Georgia, serif; font-size: 16px; letter-spacing: 2px; }
.sub { font-size: 11px; color: var(--muted); letter-spacing: .6px; margin-top: 2px; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  color: var(--text);
  position: relative;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:active { background: rgba(255,255,255,.06); }
.brandline .icon-btn { margin-left: auto; }
.icon-btn.square { border: 1px solid var(--line); background: var(--bg-soft); }

.badge {
  position: absolute;
  top: 2px; right: 1px;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--gold);
  color: #17130a;
  font-size: 10px;
  font-weight: 700;
  display: grid; place-items: center;
}

.search {
  margin-top: 12px;
  display: flex; align-items: center; gap: 9px;
  padding: 0 13px;
  height: 44px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
}
.search svg { width: 18px; height: 18px; flex: 0 0 auto; }
.search input {
  flex: 1; min-width: 0;
  background: none; border: none; outline: none;
  color: var(--text);
  font-size: 15px;
}
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { filter: invert(.6); }

.toolbar { display: flex; gap: 8px; margin-top: 10px; align-items: stretch; }

.select {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  padding: 6px 10px 7px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
}
.select span { font-size: 9px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.select select {
  appearance: none;
  border: none; background: none; outline: none;
  color: var(--text);
  font-size: 13px;
  padding-right: 14px;
  width: 100%;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 6px) 55%, calc(100% - 2px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.select select option { background: #161a23; }

.icon-btn.square { width: 46px; align-self: stretch; height: auto; }
#onlyFav.active { border-color: rgba(201,162,74,.6); color: var(--gold-soft); background: rgba(201,162,74,.08); }

.chips {
  display: flex; gap: 7px;
  overflow-x: auto;
  margin: 11px -14px 0;
  padding: 0 14px 2px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 7px 13px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  transition: .15s;
}
.chip.active { color: #17130a; background: linear-gradient(135deg, var(--gold-soft), var(--gold)); border-color: transparent; font-weight: 600; }

/* ── grid ───────────────────────────────────────────────── */
main { padding: 12px 14px 0; }

.count { font-size: 11px; color: var(--muted); margin: 2px 0 9px; letter-spacing: .4px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.card { cursor: pointer; animation: rise .25s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.thumb {
  position: relative;
  border-radius: 15px;
  overflow: hidden;
  background: #f5f4f2;
  aspect-ratio: 9 / 11;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.fav {
  position: absolute; top: 7px; right: 7px;
  width: 31px; height: 31px;
  border-radius: 50%;
  background: rgba(255,255,255,.82);
  color: #8b8377;
  display: grid; place-items: center;
  backdrop-filter: blur(4px);
  transition: .15s;
}
.fav svg { width: 17px; height: 17px; }
.fav.active { color: #c9455f; background: #fff; }
.fav.active svg { fill: currentColor; }

.meta { padding: 8px 2px 0; }
.m-brand { font-size: 10px; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-name { font-size: 13.5px; margin-top: 2px; line-height: 1.25; font-weight: 600; }
.m-price { margin-top: 5px; font-size: 14px; font-weight: 700; color: var(--gold-soft); }

.tag {
  display: inline-block;
  margin-top: 5px;
  font-size: 9px;
  letter-spacing: .5px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(201,162,74,.12);
  color: var(--gold-soft);
}

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-ico { font-size: 34px; margin-bottom: 10px; }
.empty p { margin: 0 0 16px; font-size: 14px; }

/* ── tabbar ─────────────────────────────────────────────── */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  max-width: 620px;
  margin: 0 auto;
  padding: 7px 10px calc(7px + var(--safe-bottom));
  background: rgba(13,16,22,.94);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 5px 0;
  color: var(--muted);
  font-size: 10px;
  position: relative;
}
.tab svg { width: 21px; height: 21px; }
.tab.active { color: var(--gold-soft); }
.tab .dot { position: absolute; top: 3px; right: 26%; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }

/* ── sheets ─────────────────────────────────────────────── */
.backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(3px);
  z-index: 40;
  animation: fade .2s;
}
@keyframes fade { from { opacity: 0; } }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  max-width: 620px;
  margin: 0 auto;
  max-height: 92vh;
  background: var(--bg-soft);
  border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--line);
  transform: translateY(103%);
  transition: transform .26s cubic-bezier(.22,.7,.3,1);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sheet.open { transform: translateY(0); }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; }

.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px; }
.sheet-head h2 { margin: 0; font-size: 18px; font-family: Georgia, serif; letter-spacing: .5px; }

.sheet-close {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 2;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  color: #3a3a3a;
  font-size: 16px;
  display: grid; place-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
}

/* product sheet */
.p-hero { background: #f5f4f2; }
.p-hero img { width: 100%; display: block; max-height: 46vh; object-fit: cover; }
.p-info { padding: 16px 18px 20px; }
.p-brand { font-size: 11px; letter-spacing: 1.2px; color: var(--muted); text-transform: uppercase; }
.p-name { font-family: Georgia, serif; font-size: 25px; margin: 5px 0 8px; line-height: 1.15; }
.p-price { font-size: 22px; font-weight: 700; color: var(--gold-soft); }
.p-desc { color: #c7c9d0; font-size: 13.5px; line-height: 1.55; margin: 13px 0 0; }
.p-notes { margin-top: 14px; padding: 12px 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; font-size: 12.5px; color: #b9bdc7; line-height: 1.5; }
.p-notes b { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 5px; }
.p-actions { display: flex; gap: 9px; margin-top: 16px; padding-bottom: 4px; }

.btn {
  flex: 1;
  height: 47px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: .15s;
}
.btn:active { transform: scale(.98); }
.btn.gold { background: linear-gradient(135deg, var(--gold-soft), #b48b35); color: #17130a; }
.btn.outline { border: 1px solid rgba(201,162,74,.5); color: var(--gold-soft); }
.btn.outline.active { background: rgba(201,162,74,.14); border-color: var(--gold); }
.btn.ghost { border: 1px solid var(--line); color: var(--text); background: var(--panel); flex: 0 0 auto; padding: 0 18px; height: 40px; font-size: 13px; }
.btn.danger { border: 1px solid rgba(226,101,122,.4); color: var(--danger); }

/* cart */
.cart-item { display: flex; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--line); align-items: center; }
.cart-item img { width: 62px; height: 76px; object-fit: cover; border-radius: 9px; background: #f5f4f2; }
.ci-info { flex: 1; min-width: 0; }
.ci-brand { font-size: 9.5px; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; }
.ci-name { font-size: 13px; font-weight: 600; margin: 2px 0 4px; }
.ci-price { font-size: 13px; color: var(--gold-soft); font-weight: 600; }
.ci-controls { display: flex; align-items: center; gap: 2px; }
.ci-controls button { width: 28px; height: 28px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: 15px; display: grid; place-items: center; }
.ci-qty { min-width: 24px; text-align: center; font-size: 13px; }
.cart-foot { padding: 14px 16px calc(18px + var(--safe-bottom)); border-top: 1px solid var(--line); background: var(--bg-soft); }
.cart-total { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 12px; }
.cart-total b { font-size: 19px; color: var(--gold-soft); }

.toast {
  position: fixed;
  left: 50%; bottom: calc(96px + var(--safe-bottom));
  transform: translate(-50%, 12px);
  background: #f3f0ea;
  color: #17181c;
  padding: 9px 16px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: .22s;
  z-index: 80;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 480px) {
  .grid { grid-template-columns: 1fr 1fr 1fr; }
}


/* brand logos */
.chip { display: inline-flex; align-items: center; gap: 7px; }
.chip-logo { height: 16px; width: auto; max-width: 54px; object-fit: contain; border-radius: 3px; background: rgba(255,255,255,.92); padding: 2px 4px; }
.chip.active .chip-logo { background: rgba(255,255,255,.35); }

.m-brand { display: flex; align-items: center; gap: 6px; }
.m-brand-logo-wrap { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.m-brand-logo { height: 14px; width: auto; max-width: 44px; object-fit: contain; border-radius: 2px; background: rgba(255,255,255,.9); padding: 1px 3px; flex: 0 0 auto; }
.m-brand-logo-wrap span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.p-brand { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.p-brand-logo-wrap { display: inline-flex; align-items: center; gap: 8px; }
.p-brand-logo { height: 22px; width: auto; max-width: 90px; object-fit: contain; border-radius: 4px; background: rgba(255,255,255,.94); padding: 3px 6px; }
.p-dot { color: var(--muted); margin: 0 2px; }
