:root {
  --bg: #0b0f14;
  --card: #121821;
  --border: #1f2937;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background:
    radial-gradient(1200px at 10% 10%, #0e1726 0%, var(--bg) 60%),
    radial-gradient(900px at 90% 40%, #0a1626 0%, var(--bg) 70%);
  color: var(--text);
  line-height: 1.5;
  color-scheme: dark;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(160%) blur(10px);
}

.site-header .brand {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: .2px;
  background: linear-gradient(90deg, #93c5fd, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .95rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 24px;
  color: var(--muted);
  font-size: .9rem;
}

.search {
  margin: 16px 0 24px;
}

.input-group {
  position: relative;
}

.input-group .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1rem;
}

.filters {
  margin: 8px 0 20px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: .9rem;
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
  user-select: none;
}

.chip:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.25);
}

.chip.active {
  background: #1f2937;
  border-color: var(--primary);
}

.search input[type="search"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
  padding-left: 36px;
}

.search input[type="search"]::placeholder {
  color: var(--muted);
}

.search input[type="search"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.25);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 320px));
  gap: 18px;
  justify-content: center;
}

.load-sentinel {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,.02);
}

.scroll-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
  cursor: pointer;
  transition: opacity .2s ease, transform .16s ease, background .2s ease, border-color .2s ease;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.scroll-top:hover {
  border-color: var(--primary);
  background: #1f2937;
}

.scroll-cats {
  right: 68px;
}

.category-panel {
  position: fixed;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%) scale(.98);
  z-index: 60;
  min-width: 280px;
  max-width: 90vw;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .16s ease;
}

.category-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) scale(1);
}

.category-panel .title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.category-panel .close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #0f1622;
  color: var(--text);
}

.card {
  background:
    linear-gradient(180deg, #0f1622, var(--card));
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(0,0,0,.28);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .16s ease, box-shadow .2s ease, border-color .2s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
  border-color: #334155;
}

.card .media {
  display: block;
  position: relative;
  padding-top: 56%;
  background: #0f1622;
}

.card .media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 60%, rgba(0,0,0,.25));
  opacity: .7;
  transition: opacity .2s ease;
}

.card:hover .media::after {
  opacity: .5;
}
.card .media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card .content {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card h3 {
  margin: 0;
  font-size: 1rem;
}

.card h3 a {
  color: var(--text);
  text-decoration: none;
}

.card h3 a:hover {
  text-decoration: underline;
}

.tagline {
  color: var(--muted);
  font-size: .9rem;
}

.price {
  font-size: 1.2rem;
  font-weight: 600;
}

.original-price {
  color: var(--muted);
  text-decoration: line-through;
  margin-left: 8px;
}

.stock {
  font-size: .95rem;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .8rem;
  border: 1px solid var(--border);
  margin-left: 8px;
}

.badge.low {
  color: var(--warning);
  border-color: rgba(245,158,11,.35);
  background: rgba(245,158,11,.1);
}

.notice {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #0f1622;
  border: 1px solid var(--border);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  color: white;
  background: linear-gradient(180deg, var(--primary), #2563eb);
  border: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
  font-weight: 600;
  transition: transform .06s ease, box-shadow .2s ease, background .2s ease;
}

.btn:hover {
  background: linear-gradient(180deg, var(--primary-hover), #1d4ed8);
  box-shadow: 0 6px 20px rgba(59,130,246,.35);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,.35);
}

.btn::after {
  content: "↗";
  font-size: 1rem;
  opacity: .9;
  transition: transform .2s ease;
}

.btn:hover::after {
  transform: translateX(2px);
}

.btn.secondary {
  background: transparent;
  color: var(--text);
  border-color: #475569;
}

.btn.secondary:hover {
  background: #1f2937;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.2);
}

.btn.secondary::before {
  content: "ℹ️";
  font-size: 1rem;
}

.btn.secondary::after {
  content: none;
}

.btn.secondary.share::before {
  content: "📤";
}

.btn.disabled {
  opacity: .6;
  pointer-events: none;
}

.site-header .back {
  display: inline-block;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
}

.product-detail h1 {
  margin: 0 0 16px;
  font-size: 1.6rem;
}

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

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

@media (max-width: 520px) {
  .grid {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }
}

.image-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #0f1622;
  position: relative;
}

.image-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

.thumbs {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
  overflow-x: auto;
}

.thumbs img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex: 0 0 auto;
  transition: border-color .2s ease, box-shadow .2s ease, transform .06s ease;
}

.thumbs img:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.25);
}

.thumbs img.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59,130,246,.45);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 6px;
}

.card .actions .btn {
  width: 100%;
}

@media (min-width: 460px) {
  .card .actions {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
  }
  .card .actions .btn {
    flex: 1 1 150px;
    min-width: 0;
    width: auto;
  }
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
}

.stock-row {
  margin-top: 8px;
}

.error {
  color: var(--danger);
}

.skeleton.block {
  border-radius: 8px;
  background: linear-gradient(90deg, #0f1622 25%, #182231 37%, #0f1622 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
