:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f1f3f5;
  --surface-warm: #fff7d6;
  --text: #17191c;
  --muted: #68717b;
  --line: #e4e8ee;
  --accent: #111111;
  --accent-dark: #000000;
  --accent-soft: #fff0a8;
  --green: #087857;
  --green-soft: #e8f6ef;
  --gold: #ffd400;
  --danger: #b4382d;
  --shadow-sm: 0 8px 22px rgba(24, 31, 41, 0.07);
  --shadow-md: 0 18px 46px rgba(24, 31, 41, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 212, 0, 0.1), rgba(255, 255, 255, 0) 260px),
    var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

body.preview-open {
  overflow: hidden;
}

body.has-floating-cart main {
  padding-bottom: 118px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px max(16px, calc((100vw - 1220px) / 2 + 16px));
  border-bottom: 1px solid rgba(228, 232, 238, 0.82);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: #000;
  object-fit: cover;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

h1 {
  overflow: hidden;
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.language-switch {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.language-switch button {
  min-height: 34px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.language-switch button.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.cart-button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 104px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(17, 17, 17, 0.18);
}

.cart-button:hover {
  background: var(--accent-dark);
}

.cart-icon {
  font-size: 13px;
}

#cartCount {
  min-width: 27px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--gold);
  color: #111;
  text-align: center;
}

main {
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: 18px 16px 34px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #fff7ce 64%, #eef8f0 100%);
  box-shadow: var(--shadow-sm);
}

.hero-text {
  min-width: 0;
}

.hero h2 {
  max-width: 720px;
  font-size: 28px;
  line-height: 1.16;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 650px;
  margin-top: 8px;
  color: #4e5963;
  font-size: 15px;
  line-height: 1.45;
}

.hero-stat {
  display: grid;
  min-width: 104px;
  justify-items: center;
  padding: 10px 14px;
  border: 1px solid rgba(255, 212, 0, 0.55);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.hero-stat strong {
  font-size: 24px;
  line-height: 1;
}

.hero-stat span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.search-row {
  position: sticky;
  top: 77px;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 11px 0;
  background: rgba(245, 246, 248, 0.95);
  backdrop-filter: blur(14px);
}

.search-row input,
.order-form input,
.order-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.search-row input {
  min-height: 48px;
  padding: 0 15px;
  box-shadow: var(--shadow-sm);
}

.order-form input,
.order-form textarea {
  padding: 13px 12px;
}

.search-row input::placeholder,
.order-form input::placeholder,
.order-form textarea::placeholder {
  color: #8a939d;
}

.search-row input:focus,
.order-form input:focus,
.order-form textarea:focus {
  border-color: #111;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-row button,
.primary,
.add {
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.search-row button {
  min-width: 112px;
  padding: 0 18px;
  box-shadow: 0 10px 22px rgba(17, 17, 17, 0.15);
}

.search-row button:hover,
.primary:hover,
.add:hover {
  background: var(--accent-dark);
}

.category-bar {
  position: sticky;
  top: 145px;
  z-index: 19;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 13px;
  background: rgba(245, 246, 248, 0.95);
  scrollbar-width: none;
}

.category-bar::-webkit-scrollbar {
  display: none;
}

.category-bar button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-height: 39px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  box-shadow: 0 6px 16px rgba(24, 31, 41, 0.04);
}

.category-label {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-count {
  min-width: 24px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.category-bar button.active {
  border-color: #111;
  background: #111;
  color: #fff;
}

.category-bar button.active .category-count {
  background: var(--gold);
  color: #111;
}

.status {
  min-height: 36px;
  padding: 6px 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 14px;
}

.product {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(24, 31, 41, 0.06);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease;
}

.product:hover {
  border-color: #cfd6df;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.skeleton-card {
  pointer-events: none;
}

.skeleton-card:hover {
  border-color: var(--line);
  box-shadow: 0 8px 24px rgba(24, 31, 41, 0.06);
  transform: none;
}

.skeleton-image,
.skeleton-line,
.skeleton-button {
  position: relative;
  overflow: hidden;
  background: #eef1f5;
}

.skeleton-image::after,
.skeleton-line::after,
.skeleton-button::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.72) 45%, transparent 78%);
  content: "";
  transform: translateX(-100%);
  animation: skeleton-shimmer 1.25s ease-in-out infinite;
}

.skeleton-image {
  aspect-ratio: 1 / 1;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 212, 0, 0.18), transparent 38%),
    #eef1f5;
}

.skeleton-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.skeleton-line {
  display: block;
  height: 13px;
  border-radius: 999px;
}

.skeleton-chip {
  width: 44%;
  height: 24px;
}

.skeleton-title {
  width: 86%;
  height: 18px;
  margin-top: 2px;
}

.skeleton-short {
  width: 62%;
}

.skeleton-price {
  width: 50%;
  height: 22px;
  margin-top: 4px;
}

.skeleton-button {
  display: block;
  height: 42px;
  margin-top: 2px;
  border-radius: 8px;
}

@keyframes skeleton-shimmer {
  100% {
    transform: translateX(100%);
  }
}

.product-image {
  position: relative;
  display: grid;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  place-items: center;
  background:
    linear-gradient(135deg, #fff4bd, #f5f7f9 62%, #e9f5ee);
  background-position: center;
  background-size: cover;
}

.product-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.product-image.has-image img {
  opacity: 1;
}

.product-image span {
  position: relative;
  z-index: 1;
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.76);
  color: #111;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(24, 31, 41, 0.08);
}

.product-image.has-image span {
  display: none;
}

.product-image.is-clickable {
  cursor: zoom-in;
}

.product-image.is-clickable::after {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(17, 17, 17, 0.78);
  color: #fff;
  content: "+";
  display: grid;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  place-items: center;
  pointer-events: none;
}

.product-body {
  display: grid;
  grid-template-rows: auto auto minmax(40px, auto) auto auto;
  gap: 9px;
  padding: 12px;
}

.category {
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product h3 {
  min-height: 42px;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.3;
}

.description {
  display: -webkit-box;
  overflow: hidden;
  min-height: 39px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.meta {
  display: block;
  min-height: 31px;
}

.price {
  color: #111;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.1;
}

.add {
  width: 100%;
  min-height: 42px;
}

.add:disabled {
  background: #eef2f8;
  color: #7b8591;
  cursor: not-allowed;
  box-shadow: none;
}

.product.out-of-stock .product-image,
.product.out-of-stock h3,
.product.out-of-stock .description,
.product.out-of-stock .price {
  opacity: 0.62;
}

.product-actions {
  min-height: 42px;
}

.product-stepper {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  min-height: 42px;
  overflow: hidden;
  border: 1px solid #e4e8ee;
  border-radius: 8px;
  background: #eef2f8;
}

.product-stepper[hidden] {
  display: none;
}

.product-stepper button {
  min-height: 42px;
  background: transparent;
  color: #17191c;
  font-size: 20px;
  font-weight: 900;
}

.product-stepper button:hover {
  background: #fff;
}

.product-stepper strong {
  color: #8a00c4;
  font-size: 17px;
  font-weight: 900;
  text-align: center;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  background: rgba(17, 19, 22, 0.42);
  backdrop-filter: blur(3px);
}

.floating-cart {
  position: fixed;
  right: max(14px, calc((100vw - 1220px) / 2 + 16px));
  bottom: max(14px, env(safe-area-inset-bottom));
  left: max(14px, calc((100vw - 1220px) / 2 + 16px));
  z-index: 45;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 62px;
  padding: 10px 14px 10px 18px;
  border: 1px solid rgba(255, 212, 0, 0.46);
  border-radius: 8px;
  background: #111;
  color: #fff;
  box-shadow: 0 18px 46px rgba(17, 17, 17, 0.28);
}

.floating-cart[hidden] {
  display: none;
}

.floating-cart-main {
  display: grid;
  min-width: 0;
  gap: 3px;
  text-align: left;
}

.floating-cart-main span {
  font-size: 16px;
  font-weight: 900;
}

.floating-cart-main strong {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.floating-cart-total {
  max-width: 42vw;
  overflow: hidden;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--gold);
  color: #111;
  font-size: 15px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer.open {
  display: block;
}

.image-preview {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  min-width: 320px;
  padding: 18px;
  place-items: center;
}

.image-preview.open {
  display: grid;
}

.image-preview-backdrop {
  position: absolute;
  inset: 0;
  min-height: 0;
  border-radius: 0;
  background: rgba(10, 12, 15, 0.78);
  cursor: zoom-out;
}

.image-preview-panel {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(720px, 100%);
  max-height: calc(100vh - 36px);
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.34);
}

.image-preview-panel img {
  width: 100%;
  max-height: calc(100vh - 130px);
  object-fit: contain;
  border-radius: 7px;
  background: #f7f8fa;
}

.image-preview-panel p {
  overflow: hidden;
  color: #17191c;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.image-preview-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 42px;
  min-height: 42px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: #111;
  font-size: 28px;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(24, 31, 41, 0.16);
}

.drawer-panel {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  width: min(520px, 100%);
  height: 100%;
  margin-left: auto;
  overflow-y: auto;
  background: var(--surface);
  padding: 18px;
  box-shadow: -16px 0 42px rgba(24, 31, 41, 0.2);
}

.drawer-head,
.cart-total,
.cart-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-head h2 {
  font-size: 24px;
}

.ghost {
  background: var(--surface-soft);
  color: var(--text);
  padding: 0 14px;
  font-weight: 800;
}

.ghost:hover {
  background: #e7ebef;
}

.cart-items {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px 0 8px;
}

.empty-cart {
  margin: 18px 0;
  padding: 20px;
  border: 1px dashed #cfd6df;
  border-radius: 8px;
  background: #fafbfc;
  color: var(--muted);
  text-align: center;
}

.cart-line {
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(24, 31, 41, 0.04);
}

.cart-line-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.cart-line-image {
  position: relative;
  display: grid;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  overflow: hidden;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #fff4bd, #f5f7f9 62%, #e9f5ee);
}

.cart-line-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.cart-line-image.has-image img {
  opacity: 1;
}

.cart-line-image span {
  position: relative;
  z-index: 1;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  color: #111;
  font-size: 12px;
  font-weight: 900;
}

.cart-line-image.has-image span {
  display: none;
}

.cart-line-info {
  min-width: 0;
}

.cart-line-title {
  display: -webkit-box;
  overflow: hidden;
  font-weight: 800;
  line-height: 1.2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.cart-line-price {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.cart-line-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.qty-stepper {
  display: grid;
  grid-template-columns: 36px 28px 36px;
  align-items: center;
  min-height: 44px;
  padding: 4px;
  border-radius: 8px;
  background: #eef2f8;
}

.qty-stepper button {
  width: 36px;
  min-height: 36px;
  background: transparent;
  color: #22262b;
  font-size: 21px;
  font-weight: 900;
}

.qty-stepper button:hover {
  background: #fff;
}

.qty-stepper strong {
  text-align: center;
  color: #8a00c4;
  font-size: 18px;
  font-weight: 900;
}

.remove {
  width: 36px;
  min-height: 36px;
  background: #fff1f0;
  color: var(--danger);
  font-size: 18px;
  font-weight: 900;
}

.remove:hover {
  background: #ffe3e0;
}

.cart-total {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding: 15px 0;
  font-size: 18px;
}

.cart-total strong {
  font-size: 21px;
}

.order-form {
  display: grid;
  gap: 10px;
}

.order-form textarea {
  min-height: 86px;
  resize: vertical;
}

#locationButton {
  background: #263238;
  color: #fff;
  font-weight: 800;
}

#locationButton:hover {
  background: #11191d;
}

.location-status {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    overflow: hidden;
    padding: 10px 12px;
  }

  .brand {
    flex: 1 1 0;
    gap: 9px;
  }

  .brand > div {
    min-width: 0;
  }

  .brand-logo {
    width: 46px;
    height: 46px;
  }

  h1 {
    font-size: 21px;
  }

  .topbar p {
    max-width: 148px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-actions {
    max-width: 124px;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
  }

  .language-switch {
    order: 2;
  }

  .cart-button {
    min-width: 50px;
    padding: 0 11px;
  }

  .cart-icon {
    display: none;
  }

  main {
    padding: 12px 11px 24px;
  }

  body.has-floating-cart main {
    padding-bottom: 110px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 15px;
  }

  .hero h2 {
    font-size: 22px;
  }

  .hero-copy {
    font-size: 14px;
  }

  .hero-stat {
    width: fit-content;
    min-width: 0;
    grid-template-columns: auto auto;
    align-items: baseline;
    gap: 8px;
  }

  .hero-stat strong {
    font-size: 22px;
  }

  .search-row {
    top: 74px;
    grid-template-columns: minmax(0, 1fr) 86px;
  }

  .search-row button {
    min-width: 0;
    padding: 0 10px;
  }

  .category-bar {
    top: 137px;
  }

  .floating-cart {
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    min-height: 58px;
    padding: 9px 10px 9px 14px;
  }

  .floating-cart-main span {
    font-size: 15px;
  }

  .floating-cart-total {
    max-width: 46vw;
    padding: 8px 10px;
    font-size: 14px;
  }

  .catalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .product-body {
    grid-template-rows: auto auto auto auto;
    gap: 8px;
    padding: 10px;
  }

  .category {
    font-size: 11px;
  }

  .product h3 {
    min-height: 54px;
    font-size: 14px;
  }

  .description {
    display: none;
  }

  .meta {
    min-height: 24px;
  }

  .price {
    font-size: 16px;
  }

  .product-stepper {
    grid-template-columns: 38px 1fr 38px;
  }

  .drawer-panel {
    padding: 15px;
  }
}

@media (max-width: 410px) {
  .brand-logo {
    width: 42px;
    height: 42px;
  }

  h1 {
    font-size: 19px;
  }

  .topbar p {
    max-width: 118px;
  }

  .language-switch button {
    padding: 0 8px;
  }

  .catalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-image img {
    padding: 8px;
  }

  .cart-line {
    display: grid;
    align-items: start;
  }

  .cart-line-actions {
    justify-content: space-between;
  }

  .cart-line-image {
    width: 58px;
    height: 58px;
    flex-basis: 58px;
  }

  .qty-stepper {
    grid-template-columns: 34px 30px 34px;
  }
}
