:root {
  color-scheme: dark;
  --bg: #080c14;
  --surface: #121824;
  --surface-alt: #1b2434;
  --blue: #2399ff;
  --blue-soft: #123e65;
  --text: #f7f9fd;
  --muted: #a3afc1;
  --success: #52d184;
  --warning: #ffbc52;
  --danger: #ff6771;
  --line: rgba(163, 175, 193, 0.16);
  --shadow: 0 16px 46px rgba(0, 0, 0, 0.26);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button { color: inherit; }

.site-shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 12, 20, 0.94);
  backdrop-filter: blur(18px);
}
.topbar-inner {
  width: min(1240px, calc(100% - 36px));
  min-height: 70px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand img { width: 39px; height: 48px; object-fit: contain; }
.desktop-nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.nav-link {
  border: 0;
  border-radius: 12px;
  padding: 10px 13px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
}
.nav-link:hover, .nav-link.is-active { color: var(--text); background: var(--surface); }
.top-actions { display: flex; gap: 8px; }
.icon-action {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  cursor: pointer;
}
.icon-action:hover { border-color: rgba(35, 153, 255, 0.55); }

.main-content {
  width: min(1240px, calc(100% - 36px));
  margin: 0 auto;
  padding: 26px 0 62px;
}
.search-section { margin-bottom: 18px; }
.search-box {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.search-box:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(35, 153, 255, 0.12); }
.search-box > span { color: var(--muted); font-size: 24px; transform: rotate(-15deg); }
.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}
.search-box input::placeholder { color: #7f8ba0; }
.clear-search {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--muted);
  cursor: pointer;
}

.content-section { margin-top: 28px; }
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.compact-heading { margin-bottom: 11px; }
.eyebrow {
  margin: 0 0 3px;
  color: var(--blue);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
h1, h2 { margin: 0; letter-spacing: -0.03em; }
h1 { font-size: clamp(25px, 4vw, 34px); }
h2 { font-size: clamp(22px, 3vw, 29px); }
.catalog-count { color: var(--muted); font-size: 13px; white-space: nowrap; }

.promotion-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(72%, 920px);
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-inline: contain;
  padding: 2px 0 4px;
}
.promotion-strip::-webkit-scrollbar, .category-strip::-webkit-scrollbar { display: none; }
.promotion-card {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  aspect-ratio: 1944 / 1140;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  scroll-snap-align: start;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.promotion-card img { width: 100%; height: 100%; object-fit: cover; }
.promotion-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 22%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.34));
  pointer-events: none;
}
.carousel-dots { display: flex; gap: 5px; padding-bottom: 4px; }
.carousel-dot { width: 6px; height: 6px; border-radius: 99px; background: #4b586b; }
.carousel-dot.is-active { width: 18px; background: var(--blue); }

.category-strip {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 2px 0 6px;
  scrollbar-width: none;
}
.category-pill {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 19px;
  background: var(--surface-alt);
  color: var(--muted);
  cursor: pointer;
}
.category-pill.is-active { background: var(--blue); color: white; font-weight: 800; }

.catalog-status {
  min-height: 86px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}
.catalog-status[hidden] { display: none; }
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.product-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--surface);
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease;
}
.product-card:hover { transform: translateY(-2px); border-color: rgba(35, 153, 255, 0.45); }
.product-image-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #fff;
}
.product-image { width: 100%; height: 100%; object-fit: contain; }
.product-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: #667085; font-size: 13px; }
.promo-badge, .stock-badge {
  position: absolute;
  top: 10px;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 800;
  backdrop-filter: blur(8px);
}
.promo-badge { left: 10px; background: rgba(35, 153, 255, 0.92); color: white; }
.stock-badge { right: 10px; background: rgba(8, 12, 20, 0.84); color: var(--muted); }
.product-body { padding: 13px 14px 15px; }
.product-meta {
  min-height: 17px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-name {
  min-height: 42px;
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-pricing { margin-top: 10px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.product-price { color: var(--text); font-size: 19px; font-weight: 850; }
.product-price.is-promo { color: var(--blue); }
.regular-price { color: var(--muted); font-size: 12px; text-decoration: line-through; }
.promo-label { width: 100%; color: var(--blue); font-size: 11px; font-weight: 700; }
.out-of-stock { color: var(--danger); }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); }
.footer-inner {
  width: min(1240px, calc(100% - 36px));
  min-height: 82px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-size: 13px;
}
.footer-inner a { color: var(--muted); }
.mobile-nav { display: none; }

.product-dialog {
  width: min(920px, calc(100% - 26px));
  max-height: calc(100dvh - 26px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 110px rgba(0,0,0,.65);
}
.product-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(3px); }
.dialog-shell { position: relative; padding: 22px; }
.dialog-close {
  position: sticky;
  top: 0;
  z-index: 3;
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(8,12,20,.88);
  font-size: 24px;
  cursor: pointer;
}
.product-detail { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 24px; }
.detail-image {
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;
  background: white;
}
.detail-image img { width: 100%; height: 100%; object-fit: contain; }
.detail-copy { padding: 8px 0 12px; }
.detail-category { margin: 0 0 7px; color: var(--blue); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.detail-copy h2 { font-size: clamp(25px, 4vw, 38px); }
.detail-brand { margin: 8px 0 0; color: var(--muted); }
.detail-price { margin: 22px 0 5px; font-size: 32px; font-weight: 900; }
.detail-description { color: var(--muted); line-height: 1.7; white-space: pre-line; }
.detail-stock { margin-top: 18px; font-weight: 800; color: var(--success); }
.detail-stock.out-of-stock { color: var(--danger); }
.detail-note { margin-top: 16px; padding: 13px 14px; border-radius: 14px; background: var(--surface-alt); color: var(--muted); font-size: 13px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 100;
  transform: translate(-50%, 30px);
  max-width: min(420px, calc(100% - 30px));
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #151d2a;
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .topbar-inner, .main-content, .footer-inner { width: min(100% - 24px, 1240px); }
  .topbar-inner { min-height: 62px; }
  .brand span { font-size: 16px; }
  .brand img { width: 32px; height: 40px; }
  .desktop-nav, .top-actions { display: none; }
  .main-content { padding-top: 14px; }
  .search-section { position: sticky; top: 70px; z-index: 30; padding: 5px 0 7px; margin: 0; background: linear-gradient(var(--bg) 76%, transparent); }
  .search-box { min-height: 48px; border-radius: 15px; }
  .content-section { margin-top: 22px; }
  .promotion-strip { grid-auto-columns: 92%; gap: 10px; }
  .promotion-card { min-height: auto; border-radius: 18px; }
  .section-heading { margin-bottom: 11px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .product-card { border-radius: 16px; }
  .product-body { padding: 10px 11px 12px; }
  .product-name { font-size: 13px; min-height: 38px; }
  .product-price { font-size: 17px; }
  .site-footer { display: none; }
  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 5px 8px env(safe-area-inset-bottom);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border-top: 1px solid var(--line);
    background: rgba(8, 12, 20, .97);
    backdrop-filter: blur(18px);
  }
  .mobile-nav-item {
    border: 0;
    background: transparent;
    color: #7f8ba0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
  }
  .mobile-nav-item span { font-size: 20px; line-height: 1; }
  .mobile-nav-item small { font-size: 10px; }
  .mobile-nav-item.is-active { color: var(--blue); }
  .product-dialog { width: 100%; max-width: none; max-height: 92dvh; margin: auto 0 0; border-radius: 24px 24px 0 0; border-bottom: 0; }
  .dialog-shell { padding: 16px 14px 24px; }
  .product-detail { grid-template-columns: 1fr; gap: 14px; }
  .detail-copy { padding: 0 3px 8px; }
  .detail-price { font-size: 28px; }
  .toast { bottom: calc(78px + env(safe-area-inset-bottom)); }
}

@media (max-width: 390px) {
  .product-grid { gap: 8px; }
  .product-body { padding-inline: 9px; }
}
