:root {
  /* Colors */
  --bg: #09090b;
  --surface: #121216;
  --surface-hover: #18181f;
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);
  --text: #f4f4f6;
  --text-muted: #a1a1aa;
  --accent: #ef4444;
  --accent-hover: #dc2626;
  --accent-glow: rgba(239, 68, 68, 0.22);
  --gold: #f59e0b;

  /* Tokens */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;
  --gap-sm: 10px;
  --gap-md: 16px;
  --gap-lg: 22px;
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

.bg-glow {
  position: fixed;
  top: -180px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 460px;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.14) 0%, rgba(245, 158, 11, 0.05) 45%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header { padding: 48px 0 32px; text-align: center; }

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: #fca5a5;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 20px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

h1 {
  font-size: clamp(1.85rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  max-width: 780px;
  margin: 0 auto 14px;
}

h1 .accent {
  background: linear-gradient(135deg, #f87171 0%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  max-width: 620px;
  margin: 0 auto 36px;
}

/* Main Navigation */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  text-align: left;
}

.nav-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: var(--gap-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text);
  transition: var(--transition);
}

.nav-card:hover, .sub-pill:hover, .deal-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.nav-card:hover, .sub-pill:hover { background: var(--surface-hover); }

.nav-card.active {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.12) 0%, var(--surface) 100%);
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 8px 24px -8px var(--accent-glow);
}

.nav-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
}

.nav-card.active .nav-icon { background: var(--accent); color: #fff; }
.nav-icon svg { width: 22px; height: 22px; }
.nav-text strong { display: block; font-size: 0.95rem; font-weight: 700; margin-bottom: 2px; }
.nav-text span { display: block; font-size: 0.78rem; color: var(--text-muted); line-height: 1.3; }

/* Sub-navigation Pills */
.sub-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--gap-sm);
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.sub-pill {
  font: 600 0.84rem/1 inherit;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 9px 16px;
  cursor: pointer;
  transition: var(--transition);
}

.sub-pill.active {
  color: #fff;
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 4px 14px -4px var(--accent-glow);
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  padding: 12px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.results-info { display: flex; align-items: center; gap: var(--gap-sm); font-size: 0.9rem; font-weight: 600; }
.results-info .dot, #deals-count { color: var(--text-muted); font-weight: 500; }

/* Deals Grid (Flex centered last row) */
.deals-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--gap-lg);
  margin-bottom: 64px;
}

.deal-card {
  width: calc((100% - 44px) / 3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  scroll-margin-top: 24px;
}

.deal-card:hover { box-shadow: 0 18px 36px -14px rgba(0, 0, 0, 0.65); }
.deal-card.is-highlighted {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25), 0 20px 40px -12px rgba(0, 0, 0, 0.7);
}

.deal-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #17171d;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
  overflow: hidden;
}

.deal-media.has-image { background: #fff; padding: 18px; }
.deal-media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.35s ease;
}
.deal-card:hover .deal-media img { transform: scale(1.04); }

.deal-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
  background: radial-gradient(circle at top right, rgba(239, 68, 68, 0.14), transparent 60%), linear-gradient(135deg, #16161d 0%, #101014 100%);
  color: var(--text-muted);
}

.deal-placeholder svg { width: 40px; height: 40px; opacity: 0.65; }
.deal-placeholder span { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.75; }

.badge-row {
  position: absolute;
  inset: 12px 12px auto;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  z-index: 2;
}

.deal-badge, .store-tag {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}

.deal-badge {
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
}

.store-tag { background: rgba(245, 158, 11, 0.92); color: var(--bg); font-weight: 800; }

/* Card Content */
.deal-body { padding: 20px; display: flex; flex-direction: column; flex-grow: 1; }
.deal-title { font-size: 1.08rem; font-weight: 700; line-height: 1.35; margin-bottom: var(--gap-sm); }

.deal-highlight {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.22);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.deal-desc { font-size: 0.88rem; color: var(--text-muted); margin-bottom: var(--gap-md); }

.deal-specs { list-style: none; margin-bottom: 20px; display: flex; flex-direction: column; gap: 6px; }
.deal-specs li { font-size: 0.82rem; color: #d4d4d8; padding-left: var(--gap-md); position: relative; }
.deal-specs li::before { content: "•"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

/* Buttons & Share Dropdown */
.deal-actions { margin-top: auto; display: flex; gap: var(--gap-sm); align-items: stretch; }

.btn-primary {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary svg { width: 16px; height: 16px; }

.share-wrap { position: relative; flex-shrink: 0; }

.btn-share {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.btn-share:hover, .share-wrap.open .btn-share {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-color: var(--border-hover);
}
.btn-share svg { width: 18px; height: 18px; }

.share-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 175px;
  background: var(--surface-hover);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.75);
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 30;
}

.share-wrap.open .share-menu { display: flex; }

.share-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  font: 600 0.82rem/1.2 inherit;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}

.share-item:hover { background: rgba(255, 255, 255, 0.08); }
.share-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.share-item.fb svg { color: #3b82f6; }
.share-item.vb svg { color: #a855f7; }
.share-item.cp svg { color: var(--gold); }

/* Empty, Footer & Toast */
.empty-state {
  text-align: center;
  padding: 64px 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 64px;
}
.empty-state h3 { font-size: 1.2rem; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); margin-bottom: 20px; }
.empty-state .btn-primary { display: inline-flex; width: auto; }

.site-footer { border-top: 1px solid var(--border); padding: 32px 0; text-align: center; color: var(--text-muted); font-size: 0.8rem; }
.site-footer p + p { margin-top: 8px; opacity: 0.7; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-hover);
  color: #fff;
  border: 1px solid var(--border-hover);
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Responsive */
@media (max-width: 1024px) {
  .nav-grid { grid-template-columns: repeat(2, 1fr); }
  .deal-card { width: calc((100% - var(--gap-lg)) / 2); }
}
@media (max-width: 640px) {
  .site-header { padding: 32px 0 24px; }
  .nav-grid { grid-template-columns: 1fr; gap: var(--gap-sm); }
  .deals-grid { gap: var(--gap-md); }
  .deal-card { width: 100%; }
}