:root {
  --bg: #0d0f14;
  --bg-soft: #12151d;
  --card: #181c26;
  --card-hover: #1f2431;
  --border: #262d3d;
  --text: #eef0f6;
  --muted: #93a0b6;
  --accent: #ff5722;
  --accent-hover: #ff7043;
  --accent-soft: rgba(255, 87, 34, 0.14);
  --green: #43d17c;
  --gold: #ffd600;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(255, 87, 34, 0.08), transparent 60%),
    radial-gradient(900px 400px at 10% -10%, rgba(67, 209, 124, 0.05), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ---- header ---- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  background: rgba(13, 15, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-size: 21px;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.brand span { color: var(--accent); }

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

main { flex: 1; max-width: 1200px; margin: 0 auto; padding: 28px 24px 48px; width: 100%; }

/* ---- hero ---- */

.hero { text-align: center; margin: 12px 0 28px; }

.hero h1 {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 800;
  letter-spacing: -0.5px;
}

.hero h1 em { font-style: normal; color: var(--accent); }

.hero p { color: var(--muted); margin-top: 8px; font-size: 15px; }

/* ---- toolbar: search + sort ---- */

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 520px;
}

.search-wrap .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 15px;
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  padding: 12px 40px 12px 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-wrap input::placeholder { color: var(--muted); }

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  display: none;
}

.search-clear:hover { color: var(--text); background: var(--card-hover); }
.search-clear.visible { display: block; }

.sort-select {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  outline: none;
}

.sort-select:focus { border-color: var(--accent); }

/* ---- category chips ---- */

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

.chip {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover { color: var(--text); border-color: var(--accent); }

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---- section ---- */

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

.section-title { font-size: 20px; font-weight: 700; }

.deal-count { color: var(--muted); font-size: 13px; }

/* ---- grid & cards ---- */

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

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  display: flex;
  flex-direction: column;
  animation: fade-up 0.35s ease both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-media {
  position: relative;
  aspect-ratio: 4/3;
  background: #0c0e13;
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 14px;
  transition: transform 0.25s ease;
}

.card:hover .card-media img { transform: scale(1.04); }

.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(255, 87, 34, 0.4);
}

.badge.mega {
  left: auto;
  right: 10px;
  background: var(--gold);
  color: #000;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(255, 214, 0, 0.35);
}

.no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  font-size: 13px;
}

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

.category {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
}

.card-body h3 {
  font-size: 15px;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em;
}

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

.price { font-size: 21px; font-weight: 800; color: var(--green); }

.old-price { font-size: 14px; color: var(--muted); text-decoration: line-through; }

.trust { font-size: 12px; color: var(--muted); }

.trust strong { color: var(--green); font-weight: 700; }

.empty {
  color: var(--muted);
  text-align: center;
  padding: 60px 20px;
  font-size: 15px;
  grid-column: 1 / -1;
}

.empty .empty-icon { font-size: 40px; display: block; margin-bottom: 12px; }

/* ---- skeleton loading ---- */

.skeleton-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--card-hover) 50%, var(--bg-soft) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.skeleton-media { aspect-ratio: 4/3; border-radius: 0; }
.skeleton-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.skeleton-line { height: 14px; }
.skeleton-line.short { width: 45%; }
.skeleton-line.tiny { width: 30%; }

/* ---- detail page ---- */

.back {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  display: inline-block;
  margin-bottom: 18px;
  transition: color 0.15s ease;
}

.back:hover { color: var(--text); }

.detail-card {
  flex-direction: row;
  max-width: 920px;
  margin: 0 auto;
  animation: fade-up 0.35s ease both;
}

.detail-card .card-media { aspect-ratio: auto; width: 45%; min-height: 320px; }
.detail-card .card-body { padding: 30px; gap: 14px; }

.detail-card h1 { font-size: 23px; font-weight: 700; letter-spacing: -0.3px; }

.detail-card .price { font-size: 32px; }

.amazon-note { font-size: 13px; color: var(--muted); }

.desc { font-size: 14px; color: var(--muted); line-height: 1.65; }

.cta {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), #ff3d00);
  color: #fff;
  padding: 14px 24px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  text-align: center;
  margin-top: 8px;
  box-shadow: 0 6px 18px rgba(255, 87, 34, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(255, 87, 34, 0.45);
}

.cta.disabled { background: var(--border); box-shadow: none; cursor: not-allowed; }

.cta-secondary {
  display: inline-block;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.cta-secondary:hover { border-color: var(--accent); background: var(--accent-soft); }

.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.disclosure { font-size: 11px; color: var(--muted); }

.related-section { max-width: 920px; margin: 40px auto 0; }

/* ---- footer ---- */

.site-footer {
  text-align: center;
  padding: 24px 20px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
}

/* ---- responsive ---- */

@media (max-width: 720px) {
  .tagline { display: none; }
  main { padding: 20px 16px 40px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-wrap { max-width: none; }
  .sort-select { width: 100%; }
}

@media (max-width: 640px) {
  .detail-card { flex-direction: column; }
  .detail-card .card-media { width: 100%; aspect-ratio: 4/3; min-height: 0; }
  .detail-card .card-body { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
