:root {
  --bg: #ffffff;
  --surface: #f5f7fb;
  --surface-2: #ffffff;
  --surface-hover: #edf1f7;
  --border: #dde3ea;
  --border-strong: #c7cfdb;

  --text: #111827;
  --text-muted: #6b7280;
  --text-faint: #9aa3b2;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.10);

  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.10), 0 2px 6px rgba(15, 23, 42, 0.05);

  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

html.dark {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1d212b;
  --surface-hover: #232735;
  --border: #2b3140;
  --border-strong: #3a4155;

  --text: #f3f4f6;
  --text-muted: #9ca3af;
  --text-faint: #6b7280;

  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-soft: rgba(96, 165, 250, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

::selection { background: var(--accent-soft); color: var(--text); }

/* ===== Top nav ===== */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.topnav .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 17px;
}
.topnav .brand .accent { color: var(--accent); }
.topnav .brand img { width: 26px; height: 26px; }

.topnav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    transform 0.15s ease;
}
.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border);
}
.icon-btn:active { transform: scale(0.96); }
.icon-btn svg { width: 18px; height: 18px; }

/* ===== Hero (homepage) ===== */
.hero {
  position: relative;
  min-height: calc(100vh - 70px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px 140px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.2s ease;
  z-index: 0;
}
.hero-bg.loaded { opacity: 1; }
.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(60% 50% at 50% 35%, color-mix(in srgb, var(--bg) 60%, transparent) 0%, var(--bg) 80%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 40%, transparent) 0%, var(--bg) 90%);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  animation: fadeUp 0.7s ease both;
}

.brand-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.brand-logo .orbit {
  position: relative;
  width: 110px;
  height: 110px;
  margin-bottom: 10px;
}
.brand-logo .orbit::before,
.brand-logo .orbit::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  opacity: 0.45;
}
.brand-logo .orbit::before {
  transform: rotate(20deg) scaleY(0.42);
  animation: spinSlow 14s linear infinite;
}
.brand-logo .orbit::after {
  transform: rotate(-30deg) scaleY(0.55);
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  animation: spinSlow 22s linear infinite reverse;
}
.brand-logo .orbit .core {
  position: absolute;
  inset: 38%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--accent-hover), var(--accent));
  box-shadow: 0 0 24px var(--accent-soft);
}

.wordmark {
  font-size: clamp(38px, 6vw, 56px);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0;
}
.wordmark .accent { color: var(--accent); }

.tagline {
  color: var(--text-muted);
  font-size: 16px;
  margin: 0;
  text-align: center;
}

.adfree-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.adfree-badge .adfree-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22,163,74,0.18);
}

/* ===== Search bar ===== */
.searchbar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  position: relative;
}
.searchbar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-md);
}
.searchbar .search-icon {
  width: 20px; height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.searchbar input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  padding: 12px 4px;
  outline: none;
  min-width: 0;
}
.searchbar input::placeholder { color: var(--text-faint); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease,
    color 0.15s ease;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }

.mic-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mic-btn:hover { background: var(--surface-hover); color: var(--accent); }
.mic-btn.listening {
  color: #ffffff;
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

/* ===== Autocomplete dropdown ===== */
.suggest {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 30;
  max-height: 420px;
  overflow-y: auto;
}
.suggest:empty { display: none; }
.suggest .group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 10px 18px 4px;
}
.suggest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s ease;
  border: 0;
  width: 100%;
  text-align: left;
  background: transparent;
}
.suggest-item .icon {
  width: 16px; height: 16px;
  color: var(--text-faint);
  flex-shrink: 0;
}
.suggest-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-item .label mark {
  background: transparent;
  color: var(--accent);
  font-weight: 600;
}
.suggest-item .remove {
  opacity: 0;
  background: transparent;
  border: 0;
  color: var(--text-faint);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
  transition: opacity 0.1s ease, background 0.12s ease;
}
.suggest-item:hover .remove { opacity: 1; }
.suggest-item .remove:hover { background: var(--surface-hover); color: var(--text); }
.suggest-item.active,
.suggest-item:hover { background: var(--surface-hover); }

/* ===== Quick actions ===== */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}
.quick-actions .chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.quick-actions .chip:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.quick-actions .chip svg { width: 15px; height: 15px; color: var(--accent); }

/* ===== Live info bar ===== */
.live-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}
.live-bar .seg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.live-bar .seg svg { width: 14px; height: 14px; color: var(--accent); }
.live-bar .marquee {
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 18px;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.live-bar .marquee-track {
  display: flex;
  gap: 28px;
  white-space: nowrap;
  position: absolute;
  animation: marquee 45s linear infinite;
}
.live-bar .marquee-track span { color: var(--text); }
.live-bar .marquee-track .dot {
  color: var(--text-faint);
}
.live-bar .powered { font-size: 12px; color: var(--text-faint); }

/* ===== Results page ===== */
.results-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.results-header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 28px;
  max-width: 1240px;
  margin: 0 auto;
}
.results-header .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; letter-spacing: -0.01em;
  flex-shrink: 0;
}
.results-header .brand .accent { color: var(--accent); }
.results-header .brand img { width: 24px; height: 24px; }

.results-header .searchbar {
  max-width: 640px;
  flex: 1;
  box-shadow: none;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 28px;
  max-width: 1240px;
  margin: 0 auto;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tab:hover { color: var(--text); }
.tab svg { width: 15px; height: 15px; }
.tab.active { color: var(--accent); }
.tab.active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  animation: underlineIn 0.25s ease;
}

.results-meta {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 28px 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.results-layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 28px 80px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 36px;
}
.results-main { min-width: 0; }
.results-side { min-width: 0; }

@media (max-width: 960px) {
  .results-layout { grid-template-columns: 1fr; gap: 20px; }
  .results-side { order: -1; }
  .results-header-inner { padding: 12px 16px; }
  .tabs { padding: 0 16px; }
  .results-meta { padding: 14px 16px 4px; }
  .results-layout { padding: 12px 16px 60px; }
}

/* ===== Result cards ===== */
.answer-box {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.answer-box::before {
  content: "AI Answer";
  position: absolute;
  top: 14px; right: 18px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
}
.answer-box h2 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 500;
}
.answer-box .answer {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 6px;
}
.answer-box .answer.mono { font-family: var(--font-mono); }
.answer-box .snippet { color: var(--text-muted); font-size: 14px; margin-top: 6px; }
.answer-box .source {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-faint);
}
.answer-box .source a { color: var(--accent); }

.result-card {
  padding: 16px 0;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.result-card + .result-card { border-top: 1px solid var(--border); }
.result-card .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.result-card .meta img.favicon {
  width: 18px; height: 18px;
  border-radius: 4px;
  background: var(--surface);
  object-fit: contain;
}
.result-card .meta .domain { color: var(--text); font-weight: 500; }
.result-card .meta .crumb { color: var(--text-faint); }
.result-card h3 {
  margin: 2px 0 6px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.3;
}
.result-card h3 a { color: var(--accent); }
.result-card h3 a:hover { text-decoration: underline; }
.result-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
}

.related {
  margin: 28px 0 8px;
}
.related h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 12px;
  font-weight: 600;
}
.related .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.related .chips a {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  color: var(--text);
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.related .chips a:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* Knowledge panel */
.kp {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: sticky;
  top: 132px;
  box-shadow: var(--shadow-sm);
}
.kp .kp-image {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 14px;
  background: var(--surface);
}
.kp h2 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.kp .kp-type { color: var(--text-muted); font-size: 13px; margin: 2px 0 12px; }
.kp .kp-desc { color: var(--text); font-size: 14px; line-height: 1.55; margin: 0 0 14px; }
.kp .kp-meta {
  display: grid;
  gap: 8px;
  font-size: 13px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.kp .kp-meta .row { display: flex; gap: 8px; }
.kp .kp-meta .k { color: var(--text-muted); min-width: 90px; flex-shrink: 0; }
.kp .kp-meta .v { color: var(--text); }
.kp .kp-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.kp .kp-links a {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

/* Inline news module */
.news-module {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 18px 0 6px;
  background: var(--surface-2);
}
.news-module h3 {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.news-module .item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.news-module .item:last-child { border-bottom: 0; }
.news-module .item img {
  width: 96px; height: 64px;
  border-radius: 8px; object-fit: cover;
  background: var(--surface);
  flex-shrink: 0;
}
.news-module .item .body { min-width: 0; }
.news-module .item .src { font-size: 12px; color: var(--text-muted); }
.news-module .item .title {
  font-weight: 600; font-size: 14px;
  color: var(--text); margin: 2px 0 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.news-module .item .title:hover { color: var(--accent); }
.news-module .item .when { font-size: 12px; color: var(--text-faint); }

/* Pagination */
.pagination {
  margin: 28px 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
}
.pagination button {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
}
.pagination button:hover { background: var(--surface-hover); }
.pagination button.active {
  background: var(--accent);
  color: #fff;
}
.pagination button[disabled] { color: var(--text-faint); cursor: not-allowed; }

/* ===== Skeletons ===== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface) 0%,
    var(--surface-hover) 50%,
    var(--surface) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}
.skeleton-line { height: 14px; margin: 8px 0; }
.skeleton-line.lg { height: 22px; }
.skeleton-line.sm { height: 10px; }
.skeleton-card { padding: 16px 0; border-top: 1px solid var(--border); }
.skeleton-card:first-child { border-top: 0; }

/* ===== Images page ===== */
.image-filters {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 28px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.image-filters select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 32px 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-family: inherit;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
.image-filters select:hover { background-color: var(--surface-hover); }
@media (max-width: 720px) {
  .image-filters { padding: 12px 16px 0; }
}

.masonry {
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 28px 80px;
  column-count: 5;
  column-gap: 12px;
}
@media (max-width: 1240px) { .masonry { column-count: 4; } }
@media (max-width: 980px)  { .masonry { column-count: 3; } }
@media (max-width: 680px)  { .masonry { column-count: 2; padding: 14px 16px 60px; } }
@media (max-width: 420px)  { .masonry { column-count: 2; } }

.masonry .tile {
  position: relative;
  break-inside: avoid;
  margin: 0 0 12px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  cursor: zoom-in;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.masonry .tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.masonry .tile img {
  width: 100%;
  height: auto;
  display: block;
  background: var(--surface);
}
.masonry .tile .overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 28px 12px 10px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.7));
  color: #fff;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.18s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.masonry .tile:hover .overlay { opacity: 1; }
.masonry .tile .overlay .src { opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 32px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.lightbox.open { display: flex; animation: fadeIn 0.2s ease; }
.lightbox img {
  max-width: min(94vw, 1400px);
  max-height: 78vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.lightbox .lb-meta {
  margin-top: 16px;
  color: #e5e7eb;
  font-size: 13px;
  text-align: center;
  max-width: 80vw;
}
.lightbox .lb-meta a { color: #93c5fd; }
.lightbox .lb-close,
.lightbox .lb-prev,
.lightbox .lb-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 0;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.lightbox .lb-close:hover,
.lightbox .lb-prev:hover,
.lightbox .lb-next:hover { background: rgba(255, 255, 255, 0.2); }
.lightbox .lb-close { top: 20px; right: 20px; }
.lightbox .lb-prev { left: 24px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 24px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-close svg,
.lightbox .lb-prev svg,
.lightbox .lb-next svg { width: 20px; height: 20px; }

/* ===== News page ===== */
.news-toolbar {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 28px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.news-toolbar .layout-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px;
}
.news-toolbar .layout-toggle button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.news-toolbar .layout-toggle button.active {
  background: var(--accent);
  color: #fff;
}
.news-toolbar .layout-toggle svg { width: 14px; height: 14px; }
@media (max-width: 720px) {
  .news-toolbar { padding: 12px 16px 0; }
}

.news-grid {
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 28px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.news-list {
  max-width: 860px;
  margin: 0 auto;
  padding: 18px 28px 80px;
  display: grid;
  gap: 14px;
}
@media (max-width: 720px) {
  .news-grid, .news-list { padding: 14px 16px 60px; }
}

.news-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.news-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.news-card .thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.news-card .body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.news-card .src {
  font-size: 12px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.news-card .src .badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}
.news-card .src .badge.live { background: var(--danger); color: #fff; }
.news-card .src .badge.breaking { background: var(--warning); color: #fff; }
.news-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-card h3 a { color: var(--text); }
.news-card h3 a:hover { color: var(--accent); }
.news-card .when {
  margin-top: auto;
  font-size: 12px;
  color: var(--text-faint);
}

.news-list .news-card { flex-direction: row; }
.news-list .news-card .thumb {
  width: 200px;
  aspect-ratio: auto;
  height: auto;
  border-bottom: 0;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .news-list .news-card { flex-direction: column; }
  .news-list .news-card .thumb { width: 100%; aspect-ratio: 16/9; border-right: 0; border-bottom: 1px solid var(--border); }
}

/* ===== Empty / error states ===== */
.state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.state .state-icon {
  width: 56px; height: 56px;
  display: inline-flex;
  align-items: center; justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 50%;
  margin-bottom: 14px;
}
.state .state-icon svg { width: 26px; height: 26px; }
.state h2 { margin: 0 0 6px; font-size: 20px; color: var(--text); }
.state p { margin: 0 auto; max-width: 480px; }
.state .actions { margin-top: 16px; display: inline-flex; gap: 8px; }

/* ===== Toast ===== */
.toast-root {
  position: fixed;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s ease;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--success); color: #fff; }

/* ===== Settings panel ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 150;
  display: none;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.modal-backdrop.open { display: block; animation: fadeIn 0.2s ease; }
.settings-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 151;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.25);
  max-width: 560px;
  margin: 0 auto;
  padding: 22px 24px 28px;
  transform: translateY(110%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.settings-panel.open { transform: translateY(0); }
.settings-panel header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.settings-panel header h2 { margin: 0; font-size: 18px; }
.settings-panel .row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.settings-panel .row:first-of-type { border-top: 0; }
.settings-panel .row .label { font-size: 14px; }
.settings-panel .row .hint { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.settings-panel select {
  appearance: none; -webkit-appearance: none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 28px 7px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.switch {
  width: 40px; height: 22px; border-radius: 999px;
  background: var(--border-strong); position: relative;
  border: 0; cursor: pointer; transition: background 0.18s ease;
  flex-shrink: 0;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform 0.18s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }

/* ===== Offline banner ===== */
.offline-banner {
  position: fixed;
  top: 12px; left: 50%;
  transform: translate(-50%, -120%);
  z-index: 60;
  background: var(--warning);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease;
}
.offline-banner.show { transform: translate(-50%, 0); }

/* ===== Animations ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes spinSlow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); }
  50% { box-shadow: 0 0 0 12px rgba(96, 165, 250, 0); }
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@keyframes underlineIn {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Utility ===== */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spinSlow 0.7s linear infinite;
  display: inline-block;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.searchbar:focus-within { outline: none; }

/* ===== AI Answer card (Groq) ===== */
.ai-answer {
  position: relative;
  margin: 0 0 20px;
  padding: 14px 16px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.07), rgba(168, 85, 247, 0.05) 50%, rgba(34, 197, 94, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.2);
}
:root[data-theme="dark"] .ai-answer,
[data-theme="dark"] .ai-answer {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.11) 50%, rgba(34, 197, 94, 0.10));
  border-color: rgba(129, 140, 248, 0.32);
}
.ai-answer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.ai-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #a855f7);
}
.ai-badge svg { width: 13px; height: 13px; }
.ai-meta {
  font-size: 12px;
  color: var(--text-faint);
}
.ai-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
  white-space: nowrap;
}
.ai-toggle:hover { background: rgba(99, 102, 241, 0.10); border-color: rgba(99, 102, 241, 0.5); }
.ai-toggle svg { width: 13px; height: 13px; }
.ai-answer-preview {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}
.ai-answer-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  margin-top: 8px;
}
.ai-answer-body p { margin: 0 0 10px; }
.ai-answer-body p:last-child { margin-bottom: 0; }
.ai-cite {
  display: inline-block;
  margin: 0 1px;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  vertical-align: 1px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.14);
  color: var(--accent);
  text-decoration: none;
}
.ai-cite:hover { background: rgba(99, 102, 241, 0.28); }

.ai-sources {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(99, 102, 241, 0.18);
}
.ai-sources-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.ai-sources-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ai-source {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  transition: background 120ms;
}
.ai-source:hover { background: rgba(99, 102, 241, 0.08); }
.ai-source-num {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 5px;
  background: rgba(99, 102, 241, 0.18);
  color: var(--accent);
}
.ai-source-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-skeleton-lines {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.ai-skeleton-lines .skeleton-line {
  height: 11px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.10), rgba(99, 102, 241, 0.20), rgba(99, 102, 241, 0.10));
  background-size: 200% 100%;
  animation: ai-shimmer 1.4s linear infinite;
}
.ai-skeleton-lines .skeleton-line.short { width: 55%; }
@keyframes ai-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.ai-answer-error {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.2);
}
.ai-error {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted, var(--text-faint));
}

/* ===== Ad slots (display ads — not sponsored results) ===== */
.ad-slot {
  margin: 4px 0 20px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: var(--surface);
  overflow: hidden;
}
.ad-slot-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px;
  border-bottom: 1px dashed var(--border);
}
.ad-label-text {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.ad-label-why {
  font-size: 10px;
  color: var(--accent);
  font-weight: 500;
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}
.ad-slot-body {
  padding: 0;
}
.ad-slot-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 90px;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 6px,
    rgba(128,128,128,0.04) 6px,
    rgba(128,128,128,0.04) 12px
  );
}

/* ===== Filter & Sort bar ===== */
.filter-bar {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.filter-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-sort-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.filter-sort-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
  white-space: nowrap;
}
.filter-sort-select {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 28px 4px 10px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 120ms;
}
.filter-sort-select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.filter-sort-select:hover { border-color: var(--accent); }

.filter-chips-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted, var(--text));
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
  white-space: nowrap;
}
.filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(59,130,246,0.06);
}
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.filter-chip.active:hover { opacity: 0.88; }

.filter-reset {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 5px 11px 5px 9px;
  border-radius: 999px;
  white-space: nowrap;
  transition: color 150ms, border-color 150ms, background 150ms;
}
.filter-reset:hover:not(:disabled) {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}
.filter-reset.has-active {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.filter-reset:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.filter-hidden {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  background: rgba(128,128,128,0.12);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

/* ===== Per-result metadata badges ===== */
.result-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.result-badges > span {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(128,128,128,0.10);
  color: var(--text-faint);
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.result-badges .rmeta-pos {
  background: transparent;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  padding-left: 0;
  padding-right: 6px;
  border-right: 1px solid var(--border);
  border-radius: 0;
}
.result-badges .rmeta-date { color: var(--accent); background: rgba(59,130,246,0.10); }
.result-badges .rmeta-ftype {
  background: #fef3c7; color: #92400e; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.04em;
}
[data-theme="dark"] .result-badges .rmeta-ftype { background: rgba(252,211,77,0.18); color: #fcd34d; }
.result-badges .rmeta-cls-authority { background: rgba(16,185,129,0.12); color: #059669; }
[data-theme="dark"] .result-badges .rmeta-cls-authority { color: #34d399; }
.result-badges .rmeta-cls-forum  { background: rgba(245,158,11,0.12); color: #b45309; }
[data-theme="dark"] .result-badges .rmeta-cls-forum { color: #fbbf24; }
.result-badges .rmeta-cls-social { background: rgba(168,85,247,0.12); color: #7c3aed; }
[data-theme="dark"] .result-badges .rmeta-cls-social { color: #c084fc; }
.result-badges .rmeta-read { font-weight: 500; }

/* ===== Layout switcher (icon group on the right of filter bar) ===== */
.layout-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  margin-left: auto;
  background: var(--bg);
  flex-shrink: 0;
}
.layout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 26px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0;
  transition: background 120ms, color 120ms;
}
.layout-btn:hover { color: var(--accent); background: rgba(59,130,246,0.08); }
.layout-btn.active { background: var(--accent); color: #fff; }
.layout-btn svg { width: 16px; height: 16px; }

/* ===== Compact layout (single column, denser) ===== */
.results-list.results-compact .result-card { padding: 10px 0; }
.results-list.results-compact .result-card .meta { font-size: 11px; margin-bottom: 2px; }
.results-list.results-compact .result-card h3 { font-size: 16px; margin: 2px 0 4px; line-height: 1.3; }
.results-list.results-compact .result-card .result-snippet {
  font-size: 13px;
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.results-list.results-compact .result-badges { margin-top: 4px; }
.results-list.results-compact .result-badges > span { font-size: 10px; padding: 1px 6px; }

/* ===== Grid layouts ===== */
.results-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}
.results-grid.results-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.results-grid.results-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) {
  .results-grid.results-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .results-grid.results-grid-2,
  .results-grid.results-grid-3 { grid-template-columns: 1fr; }
}
.results-grid .result-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}
.results-grid .result-card + .result-card { border-top: 1px solid var(--border); }
.results-grid .result-card h3 { font-size: 15px; margin: 6px 0 6px; line-height: 1.35; }
.results-grid .result-card .result-snippet {
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.results-grid.results-grid-3 .result-card h3 { font-size: 14px; }
.results-grid.results-grid-3 .result-card .result-snippet { -webkit-line-clamp: 3; font-size: 12.5px; }
.results-grid .result-badges { margin-top: 10px; }

/* Full-width row inside a grid (for ad slots and Top stories in grid mode) */
.grid-fullspan { grid-column: 1 / -1; }

/* ===== "Why people switch from Google" — homepage value props ===== */
.why {
  position: relative;
  z-index: 2;
  padding: 60px 20px 80px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.why-inner {
  max-width: 1080px;
  margin: 0 auto;
}
.why-head {
  text-align: center;
  margin-bottom: 44px;
}
.why-head h2 {
  font-size: clamp(26px, 3.5vw, 36px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  color: var(--text);
}
.why-head p {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto;
  line-height: 1.55;
}
.why-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}
@media (max-width: 720px) {
  .why-grid { grid-template-columns: 1fr; }
}
.why-card {
  position: relative;
  padding: 24px 22px 22px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 200ms, transform 200ms, box-shadow 200ms;
}
.why-card:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -12px var(--accent-soft, rgba(59,130,246,0.25));
}
.why-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.why-icon svg { width: 22px; height: 22px; }
.why-icon-strip   { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.why-icon-ai      { background: rgba(168, 85, 247, 0.12); color: #7c3aed; }
.why-icon-privacy { background: rgba(16, 185, 129, 0.14); color: #059669; }
.why-icon-power   { background: rgba(59, 130, 246, 0.12); color: var(--accent); }
html.dark .why-icon-strip   { color: #f87171; }
html.dark .why-icon-ai      { color: #c084fc; }
html.dark .why-icon-privacy { color: #34d399; }
.why-card h3 {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.why-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted);
  flex: 1;
}
.why-card .cite-mark {
  display: inline-block;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  background: rgba(59,130,246,0.14);
  color: var(--accent);
  vertical-align: 1px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.why-stat {
  display: inline-block;
  margin-top: 6px;
  align-self: flex-start;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-faint);
  background: rgba(128,128,128,0.10);
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.why-honest {
  margin-top: 10px;
  padding: 16px 20px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border: 1px dashed color-mix(in srgb, var(--accent) 35%, var(--border));
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted);
  text-align: center;
}
.why-honest strong { color: var(--text); margin-right: 4px; }

/* ===== Legal / static content pages ===== */
.legal-page {
  max-width: 760px;
  margin: 32px auto 56px;
  padding: 0 24px;
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
}
.legal-page .legal-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 8px;
}
.legal-page h1 {
  font-size: 38px;
  line-height: 1.15;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}
.legal-page .legal-lede {
  font-size: 18px;
  color: var(--text-muted);
  margin: 0 0 28px;
}
.legal-page section { margin: 28px 0; }
.legal-page h2 {
  font-size: 20px;
  margin: 28px 0 10px;
  letter-spacing: -0.01em;
}
.legal-page p { margin: 10px 0; }
.legal-page ul {
  margin: 10px 0 10px 4px;
  padding-left: 20px;
}
.legal-page li { margin: 6px 0; }
.legal-page a { color: var(--accent); text-decoration: none; }
.legal-page a:hover { text-decoration: underline; }
.legal-page code {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* ===== Site footer (used on every page) ===== */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 18px 24px 22px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  justify-content: space-between;
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}
.site-footer nav a {
  color: var(--text-muted);
  text-decoration: none;
}
.site-footer nav a:hover { color: var(--accent); }
.site-footer .copyright a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.site-footer .copyright a:hover { color: var(--accent); text-decoration: underline; }
@media (max-width: 600px) {
  .site-footer { flex-direction: column; align-items: flex-start; }
}

/* ===== Featured "control panel" why-card ===== */
.why-card-feature {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 28px;
  padding: 28px 28px 26px;
  background:
    radial-gradient(ellipse at top right, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  position: relative;
  overflow: hidden;
}
.why-card-feature::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 5%, transparent), transparent 50%);
  pointer-events: none;
}
.why-card-feature:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}
.feature-copy { position: relative; display: flex; flex-direction: column; gap: 10px; }
.feature-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 6px 12px;
  border-radius: 999px;
}
.feature-eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.why-card-feature h3 {
  font-size: 22px;
  margin: 4px 0 0;
  line-height: 1.2;
}
.why-card-feature > .feature-copy > p { font-size: 14.5px; }
.why-card-feature strong { color: var(--text); font-weight: 600; }
.feature-bullets {
  list-style: none;
  margin: 6px 0 4px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
}
.feature-bullets li { display: flex; gap: 10px; align-items: flex-start; }
.feature-bullets .x,
.feature-bullets .check {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}
.feature-bullets .x      { background: rgba(239,68,68,0.14); color: #dc2626; }
.feature-bullets .check  { background: rgba(16,185,129,0.16); color: #059669; }
html.dark .feature-bullets .x     { color: #f87171; }
html.dark .feature-bullets .check { color: #34d399; }
.why-stat-feature { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }

/* Visual: faithful replica of the real filter bar */
.feature-visual { position: relative; display: flex; flex-direction: column; gap: 10px; }
.filter-mock {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 12px 32px -16px rgba(15,17,21,0.18);
}
html.dark .filter-mock { box-shadow: 0 12px 32px -10px rgba(0,0,0,0.6); }
.fm-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.fm-label {
  font-size: 12px; color: var(--text-muted); font-weight: 500;
}
.fm-label-2 { margin-left: 6px; }
.fm-select {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px; font-weight: 500; color: var(--text);
  flex: 1; min-width: 110px; max-width: 180px;
  justify-content: space-between;
}
.fm-select-sm { flex: 0 0 70px; min-width: 70px; }
.fm-chev { color: var(--text-faint); font-size: 10px; }
.fm-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.fm-chip {
  font-size: 12px; font-weight: 500;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
}
.fm-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 2px; gap: 10px; flex-wrap: wrap;
}
.fm-layouts {
  display: inline-flex; gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}
.fm-lay {
  width: 30px; height: 26px;
  border: none; background: transparent; padding: 0;
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: default;
}
.fm-lay svg { width: 14px; height: 14px; fill: currentColor; }
.fm-lay.active { background: var(--accent); color: #fff; }
.fm-reset {
  font-size: 12px; color: var(--text-faint);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.feature-caption {
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  font-style: italic;
}
@media (max-width: 820px) {
  .why-card-feature { grid-template-columns: 1fr; gap: 20px; padding: 22px; }
}

/* ===== Export button (filter bar) ===== */
.export-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms, border-color 150ms, transform 100ms;
  white-space: nowrap;
}
.export-btn:hover {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  transform: translateY(-1px);
}
.export-btn:active { transform: translateY(0); }

/* Export card icon */
.why-icon-export { background: rgba(234, 88, 12, 0.12); color: #ea580c; }
html.dark .why-icon-export { color: #fb923c; }
