/* ── Reset & base ───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --gold:           #f5a623;
  --gold-light:     #fff8ec;
  --silver:         #9ca3af;
  --bronze:         #cd7f32;
  --accent:         #4f46e5;
  --accent-dark:    #4338ca;
  --accent-purple:  #7c3aed;
  --gradient:       linear-gradient(135deg, #4338ca, #7c3aed);
  --gradient-nav:   linear-gradient(135deg, #1e1b4b 0%, #4338ca 50%, #7c3aed 100%);
  --text:           #1a1a2e;
  --muted:          #6b7280;
  --border:         #e5e7eb;
  --bg:             #f4f5f7;
  --card-bg:        #ffffff;
  --ad-bg:          #f3f4f6;
  --ad-border:      #d1d5db;
  --radius:         12px;
  --font:           'Poppins', system-ui, sans-serif;
  --nav-h:          50px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Leaderboard ad ─────────────────────────────────────────── */
.ad-leaderboard {
  display: flex;
  justify-content: center;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}

/* ── Slim gradient nav bar ──────────────────────────────────── */
.site-header {
  background: var(--gradient-nav);
  height: var(--nav-h);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
}

.logo-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.nav-tagline {
  margin-left: 0.875rem;
  padding-left: 0.875rem;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 0.775rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Two-column layout ──────────────────────────────────────── */
.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
  display: grid;
  grid-template-columns: 30% 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* ── Left column: Sidebar ───────────────────────────────────── */
.sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 12px);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.125rem 1.125rem 0.875rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}

.sidebar-title {
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.75rem;
}

/* ── Trending list ──────────────────────────────────────────── */
.trending-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.trending-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.825rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.62rem;
  font-weight: 700;
  color: #ffffff;
  flex-shrink: 0;
  line-height: 1;
}

.rank-badge { background: var(--gradient); }

.trending-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trending-arrow {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
  opacity: 0.25;
  transition: opacity 0.15s, color 0.15s, transform 0.15s;
  line-height: 1;
}

.trending-item:hover {
  background: rgba(79, 70, 229, 0.07);
  color: var(--accent);
}

.trending-item:hover .trending-arrow {
  opacity: 1;
  color: var(--accent);
  transform: translateX(2px);
}

/* Live badge */
.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 500;
}

.live-dot {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── Right column: Main content card ───────────────────────── */
.main-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
  padding: 1.5rem;
}

/* ── Search bar ─────────────────────────────────────────────── */
.search-wrapper {
  display: flex;
  gap: 0.625rem;
}

.search-input-wrapper {
  flex: 1;
  position: relative;
}

.search-placeholder {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 0.95rem;
  font-family: var(--font);
  pointer-events: none;
  transition: opacity 0.35s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 3rem);
}

.clear-btn {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #d1d5db;
  border: none;
  color: #6b7280;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, background 0.15s;
  flex-shrink: 0;
}

.clear-btn:hover {
  background: #9ca3af;
  color: #fff;
}

.clear-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

.search-input {
  width: 100%;
  padding: 0.7rem 2.25rem 0.7rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input::placeholder {
  color: #9ca3af;
}

.search-input:focus {
  border-color: var(--accent);
  background: var(--card-bg);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-btn {
  padding: 0.7rem 1.4rem;
  background: var(--gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(79, 70, 229, 0.35);
  transition: filter 0.2s, box-shadow 0.2s, transform 0.1s;
}

.search-btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 5px 16px rgba(79, 70, 229, 0.5);
  transform: translateY(-1px);
}

.search-btn:active {
  transform: scale(0.97);
}

/* ── Search error banner ────────────────────────────────────── */
.search-error-banner {
  padding: 0.6rem 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  color: #dc2626;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ── Category chips ─────────────────────────────────────────── */
.category-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

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

.chip {
  padding: 5px 12px;
  background: transparent;
  border: 1.5px solid rgba(79, 70, 229, 0.28);
  border-radius: 999px;
  font-family: var(--font);
  font-size: 0.775rem;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
}

.chip:hover {
  background: var(--gradient);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(79, 70, 229, 0.3);
}

.chip.active {
  background: var(--gradient);
  border-color: transparent;
  color: #ffffff;
  font-weight: 600;
}

/* ── Popular cards (empty state) ────────────────────────────── */
.popular-heading {
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.popular-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.popular-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 1.125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.popular-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border-color: transparent;
}

.card-emoji {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 0.35rem;
  display: block;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  display: block;
}

.card-desc {
  font-size: 0.775rem;
  color: var(--muted);
  display: block;
  line-height: 1.4;
}

/* ── Results ────────────────────────────────────────────────── */
.results-section {
  min-height: 0;
}

.results-heading {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.875rem;
}

.results-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.result-item {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1.125rem;
  transition: box-shadow 0.2s, transform 0.15s;
}

.result-item:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.09);
  transform: translateY(-1px);
}

.result-rank {
  font-size: 1rem;
  font-weight: 800;
  min-width: 1.875rem;
  text-align: center;
  color: var(--muted);
  flex-shrink: 0;
}

.result-body {
  flex: 1;
  min-width: 0;
}

.result-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.result-detail {
  font-size: 0.825rem;
  color: var(--muted);
}

.result-stat {
  display: inline-block;
  margin-top: 0.3rem;
  padding: 2px 8px;
  background: rgba(79, 70, 229, 0.08);
  color: var(--accent);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.result-link {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
  flex-shrink: 0;
  padding: 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  align-self: center;
}

.result-link:hover {
  color: var(--accent);
  background: rgba(79, 70, 229, 0.08);
}

.result-item.rank-1 {
  border-color: var(--gold);
  background: var(--gold-light);
}

.result-item.rank-1 .result-rank { color: var(--gold); }
.result-item.rank-1 .result-name { color: #92400e; }
.result-item.rank-1 .result-stat {
  background: rgba(245, 166, 35, 0.12);
  color: #92400e;
}

/* Skeleton shimmer */
.skeleton-pulse {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

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

/* Loading */
.results-loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.875rem;
  padding: 0.75rem 0;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.results-error {
  color: #dc2626;
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
}

/* ── Ad boxes ───────────────────────────────────────────────── */
.ad-box {
  background: var(--ad-bg);
  border: 1px dashed var(--ad-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ad-728x90  { width: 100%; max-width: 728px; height: 90px; }
.ad-160x600 { width: 100%; height: 600px; }

.ad-300x250 {
  width: 100%;
  height: 90px;
}

/* ── Suggestions ("You might also like") ────────────────────── */
.suggestions-inner {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.suggestions-title {
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.625rem;
}

.suggestions-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

/* ── Footer (inside main-content card) ─────────────────────── */
.site-footer {
  padding: 0.875rem 0 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 500;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-links .sep {
  color: var(--border);
  font-size: 0.7rem;
  user-select: none;
}

.footer-disclaimer {
  font-size: 0.72rem;
  color: var(--muted);
}

/* ── Static pages (About, Privacy, Contact) ─────────────────── */
.page-container {
  max-width: 760px;
  margin: 2rem auto;
  padding: 2rem 2.5rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
}

.page-container h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.page-container h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.page-container p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.75;
  margin-bottom: 0.875rem;
}

.page-container a {
  color: var(--accent);
  text-decoration: none;
}

.page-container a:hover {
  text-decoration: underline;
}

.page-footer-outer {
  max-width: 760px;
  margin: 0 auto 2.5rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-tagline {
    display: none;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 1rem;
    gap: 1rem;
  }

  .sidebar {
    position: static;
    order: 2;
  }

  .main-content {
    order: 1;
    padding: 1.125rem;
    gap: 1rem;
  }

  .search-wrapper {
    flex-direction: column;
  }

  .search-btn {
    width: 100%;
  }

  .ad-728x90  { max-width: 100%; height: 60px; }
  .ad-160x600 { height: 250px; }
}
