/* Web-X-AI² — AI² monochrome theme (black / silver / white / grey) */

.webx-root {
  /* AI² brand tokens — matches globals.css .dark */
  --ai2-black: #0a0a0a;
  --ai2-silver: #c8c8c8;
  --ai2-chrome: #e8e8e8;
  --ai2-muted: #8a8a8a;

  --bg: #0a0a0a;
  --surface: #121212;
  --surface-2: #1a1a1a;
  --text: #e8e8e8;
  --muted: #8a8a8a;
  --muted-2: #6a6a6a;
  --link: #c8c8c8;
  --serp-link: #99c3ff;
  --serp-site: #bdc1c6;
  --serp-snippet: #9aa0a6;
  --accent: #e8e8e8;
  --accent-fg: #0a0a0a;
  --accent-soft: rgba(200, 200, 200, 0.1);
  --border: #2a2a2a;
  --border-light: #333333;
  --danger: #e57373;
  --radius: 0.5rem;
  --radius-pill: 9999px;
  --shadow-pill: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.35), 0 1px 1px rgba(0, 0, 0, 0.2);
  --shadow-lift: 0 8px 24px rgba(0, 0, 0, 0.45);
  --header-h: auto;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --font: var(--font-geist, "Geist"), ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: var(--font-geist-mono, "Geist Mono"), ui-monospace, "JetBrains Mono", monospace;
  --max: 1100px;
  --results-col: 650px;
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --webx-beta: #60a5fa;
  --webx-beta-bright: #93c5fd;
  --webx-beta-glow: rgba(96, 165, 250, 0.55);
  --webx-beta-soft: rgba(59, 130, 246, 0.14);

  box-sizing: border-box;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.58;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  isolation: isolate;
  position: relative;
}

.webx-root::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 90% 55% at 50% -15%, rgba(59, 130, 246, 0.2), transparent 62%),
    radial-gradient(ellipse 45% 35% at 100% 0%, rgba(96, 165, 250, 0.14), transparent 55%),
    radial-gradient(ellipse 40% 30% at 0% 100%, rgba(37, 99, 235, 0.1), transparent 50%);
}

.webx-root > *:not(.webx-beta-badge--fixed) {
  position: relative;
  z-index: 1;
}

/* ---------- Beta badge ---------- */
.webx-beta-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 11px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #dbeafe;
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.35) 0%,
    rgba(59, 130, 246, 0.22) 100%
  );
  border: 1px solid rgba(147, 197, 253, 0.5);
  border-radius: var(--radius-pill);
  box-shadow:
    0 0 10px var(--webx-beta-glow),
    0 0 22px rgba(59, 130, 246, 0.28),
    inset 0 0 10px rgba(147, 197, 253, 0.12);
  animation: webx-beta-pulse 2.6s ease-in-out infinite;
  flex-shrink: 0;
}

.webx-beta-badge--fixed {
  position: fixed;
  top: calc(var(--safe-top) + 12px);
  right: calc(var(--safe-right) + 12px);
  z-index: 1001;
}

.webx-beta-badge--inline {
  margin-top: -0.75rem;
  margin-bottom: 0.5rem;
}

.webx-beta-badge--header {
  font-size: 0.55rem;
  padding: 3px 8px;
  margin-left: -4px;
}

.webx-beta-badge--footer {
  margin-bottom: 8px;
}

.webx-beta-badge--viewer {
  font-size: 0.55rem;
  padding: 3px 8px;
}

.landing-brand-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

@keyframes webx-beta-pulse {
  0%,
  100% {
    box-shadow:
      0 0 10px var(--webx-beta-glow),
      0 0 22px rgba(59, 130, 246, 0.28),
      inset 0 0 10px rgba(147, 197, 253, 0.12);
    border-color: rgba(147, 197, 253, 0.45);
  }
  50% {
    box-shadow:
      0 0 16px rgba(96, 165, 250, 0.75),
      0 0 32px rgba(59, 130, 246, 0.42),
      inset 0 0 14px rgba(191, 219, 254, 0.2);
    border-color: rgba(191, 219, 254, 0.75);
  }
}

@media (prefers-reduced-motion: reduce) {
  .webx-beta-badge {
    animation: none;
  }
}

.webx-root *,
.webx-root *::before,
.webx-root *::after {
  box-sizing: border-box;
}

.webx-root img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: var(--safe-top);
  z-index: 1000;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}

.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;
}

/* ---------- Brand ---------- */
.brand-symbol {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.brand-symbol--lg {
  margin-bottom: 1.75rem;
  padding: 1.25rem 0.5rem 0.5rem;
}

.brand-symbol--sm {
  transform: scale(0.42);
  transform-origin: left center;
  margin: -0.65rem 0;
  pointer-events: none;
}

.brand-home-link {
  display: inline-flex;
  flex-shrink: 0;
  text-decoration: none;
  border-radius: 10px;
  padding: 2px 4px;
}

.brand-home-link:hover {
  background: rgba(255, 255, 255, 0.04);
}

.brand-symbol__orbit {
  position: absolute;
  inset: -18%;
  border-radius: 50%;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--bg), var(--bg)) padding-box,
    conic-gradient(
      from 0deg,
      transparent 0deg,
      rgba(200, 200, 200, 0.15) 60deg,
      rgba(232, 232, 232, 0.85) 120deg,
      rgba(200, 200, 200, 0.2) 180deg,
      transparent 360deg
    )
    border-box;
  animation: webx-orbit 8s linear infinite;
  opacity: 0.9;
}

.brand-symbol__glow {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(232, 232, 232, 0.14) 0%,
    rgba(200, 200, 200, 0.05) 42%,
    transparent 72%
  );
  animation: webx-glow 3.6s ease-in-out infinite;
}

.brand-symbol__text {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: baseline;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.brand-symbol--lg .brand-symbol__text {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
}

.brand-symbol--sm .brand-symbol__text {
  font-size: 1.45rem;
}

.brand-symbol__web,
.brand-symbol__x,
.brand-symbol__ai {
  background: linear-gradient(
    110deg,
    #6a6a6a 0%,
    #c8c8c8 22%,
    #ffffff 38%,
    #e8e8e8 52%,
    #8a8a8a 68%,
    #ffffff 82%,
    #c8c8c8 100%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: webx-silver-shimmer 4.5s ease-in-out infinite;
}

.brand-symbol__x {
  animation-delay: 0.15s;
  opacity: 0.92;
}

.brand-symbol__ai {
  animation-delay: 0.3s;
  margin-left: 0.02em;
}

.brand-symbol__sheen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 999px;
  pointer-events: none;
}

.brand-symbol__sheen::after {
  content: "";
  position: absolute;
  top: -40%;
  left: -60%;
  width: 45%;
  height: 180%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.35),
    rgba(255, 255, 255, 0.08),
    transparent
  );
  transform: skewX(-18deg);
  animation: webx-sheen-sweep 5.5s ease-in-out infinite;
}

@keyframes webx-orbit {
  to {
    transform: rotate(360deg);
  }
}

@keyframes webx-glow {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(0.96);
  }
  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

@keyframes webx-silver-shimmer {
  0%,
  100% {
    background-position: 100% 50%;
  }
  50% {
    background-position: 0% 50%;
  }
}

@keyframes webx-sheen-sweep {
  0%,
  18% {
    left: -60%;
    opacity: 0;
  }
  28% {
    opacity: 1;
  }
  42%,
  100% {
    left: 130%;
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-symbol__orbit,
  .brand-symbol__glow,
  .brand-symbol__web,
  .brand-symbol__x,
  .brand-symbol__ai,
  .brand-symbol__sheen::after {
    animation: none;
  }
}

.brand-mark {
  font-weight: 700;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #e8e8e8 0%, #c8c8c8 45%, #8a8a8a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
  user-select: none;
}

.brand-mark--lg {
  font-size: clamp(2.4rem, 8vw, 4.4rem);
  letter-spacing: -2px;
  line-height: 1.05;
  margin-bottom: 1.5rem;
  text-align: center;
}

.brand-mark--sm {
  font-size: 1.45rem;
  flex-shrink: 0;
}

.brand-tagline {
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
  margin-bottom: 1.75rem;
  max-width: 28rem;
  letter-spacing: 0.01em;
}

/* ---------- Landing ---------- */
.landing-view {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  background: radial-gradient(ellipse at center, rgba(200, 200, 200, 0.06) 0%, transparent 55%);
}

.top-nav {
  width: 100%;
  padding: 12px 16px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
}

.top-nav a,
.nav-link {
  color: var(--text);
  text-decoration: none;
  padding: 8px 10px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
}

.top-nav a:hover,
.nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ai2-chrome);
}

.landing-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 650px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.search-form {
  width: 100%;
}

.search-pill {
  width: 100%;
  min-height: 48px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  padding: 6px 12px 6px 16px;
  gap: 10px;
  transition: box-shadow 0.2s var(--ease-smooth), border-color 0.2s var(--ease-smooth);
}

.search-pill:hover,
.search-pill:focus-within {
  box-shadow: var(--shadow-composer-focus, var(--shadow-pill));
  border-color: var(--border-light);
}

.pill-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--text);
  background: transparent;
  min-height: 36px;
}

.pill-input::placeholder {
  color: var(--muted-2);
}

.pill-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn--accent {
  color: var(--ai2-chrome);
}

.ai-mode-btn {
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  min-height: 36px;
  white-space: nowrap;
}

.ai-mode-btn:hover {
  background: var(--surface-2);
}

@media (min-width: 480px) {
  .ai-mode-btn {
    display: inline-flex;
  }
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 12px;
  margin-top: 36px;
  width: 100%;
  max-width: 320px;
}

@media (min-width: 480px) {
  .shortcuts-grid {
    display: flex;
    justify-content: center;
    max-width: none;
    gap: 28px;
  }
}

.shortcut-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  min-width: 72px;
}

.shortcut-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--ai2-silver);
  transition: background 0.2s var(--ease-smooth), border-color 0.2s var(--ease-smooth);
}

.shortcut-item:hover .shortcut-circle,
.shortcut-item:focus-visible .shortcut-circle {
  background: var(--surface-2);
  border-color: var(--border-light);
}

.landing-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted-2);
}

/* ---------- Results ---------- */
.results-view {
  display: none;
  flex-direction: column;
  width: 100%;
  min-height: 100dvh;
  padding-bottom: var(--safe-bottom);
}

.results-view.is-active {
  display: flex;
}

.landing-view.is-hidden {
  display: none;
}

.results-sticky-header {
  position: sticky;
  top: 0;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(12px);
  z-index: 100;
  border-bottom: 1px solid var(--border);
  padding: calc(10px + var(--safe-top)) 12px 0;
}

.header-top-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  max-width: var(--max);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.header-top-row .search-form {
  flex: 1;
  min-width: 0;
}

.results-search-pill {
  width: 100%;
  min-height: 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  padding: 4px 10px 4px 14px;
  gap: 8px;
  box-shadow: var(--shadow-card);
}

.tabs-bar {
  display: flex;
  gap: 4px;
  font-size: 0.875rem;
  color: var(--muted);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  max-width: var(--max);
  margin: 0 auto;
  width: 100%;
  padding-bottom: 0;
}

.tabs-bar::-webkit-scrollbar {
  display: none;
}

.tab-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 12px 14px;
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  color: var(--muted);
  font: inherit;
  min-height: 44px;
  border-radius: 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-item.active {
  color: var(--ai2-chrome);
  border-bottom-color: var(--ai2-silver);
  font-weight: 600;
}

.tab-item.is-loading {
  opacity: 0.85;
}

.tab-item:hover:not(.active):not(:disabled) {
  color: var(--text);
}

.tab-item:disabled,
.tab-item.is-soon {
  opacity: 0.45;
  cursor: not-allowed;
}

.results-body {
  max-width: var(--max);
  margin: 0 auto;
  width: 100%;
  padding: 16px 12px 60px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 641px) {
  .results-sticky-header {
    padding-left: 24px;
    padding-right: 24px;
  }

  .header-top-row {
    gap: 24px;
    margin-bottom: 12px;
  }

  .results-body {
    padding: 20px 24px 60px;
  }

  .brand-mark--sm {
    font-size: 1.6rem;
  }
}

/* ---------- Status / AI panel ---------- */
.status-bar {
  font-size: 0.875rem;
  color: var(--muted);
  display: none;
}

.status-bar.is-visible {
  display: block;
}

.ai-panel {
  display: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--surface);
  max-width: var(--results-col);
}

.ai-panel.is-visible {
  display: block;
}

.ai-panel[hidden] {
  display: none !important;
}

.ai-panel h2 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.ai-panel p {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.ai-panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-text {
  background: none;
  border: none;
  color: var(--ai2-silver);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 8px 4px;
  min-height: 44px;
}

.btn-text:hover {
  color: var(--ai2-chrome);
}

/* ---------- Layout: All tab ---------- */
.all-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

@media (min-width: 1025px) {
  .all-layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 40px;
  }

  .results-list {
    flex: 0 1 var(--results-col);
    max-width: var(--results-col);
  }

  .inline-images-rail {
    flex: 1;
    position: sticky;
    top: 120px;
    max-width: 320px;
  }
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
  width: 100%;
  max-width: var(--results-col);
}

.inline-images-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

@media (min-width: 1025px) {
  .inline-images-strip {
    display: none;
  }
}

.inline-images-rail {
  display: none;
}

@media (min-width: 1025px) {
  .inline-images-rail {
    display: block;
  }

  .inline-images-rail .inline-images-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

.inline-thumb {
  flex: 0 0 auto;
  width: 120px;
  height: 90px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  text-decoration: none;
  background: var(--surface-2);
}

.inline-images-rail .inline-thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
}

.inline-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rail-heading {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 12px;
  color: var(--text);
}

/* ---------- Result card (Google-style) ---------- */
.card-result {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 0 16px;
}

.card-site-row {
  display: flex;
  align-items: center;
  min-width: 0;
  margin-bottom: 2px;
}

.card-site-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  text-decoration: none;
  color: var(--serp-site);
  font-size: 0.82rem;
  line-height: 1.3;
}

.card-site-link:hover {
  text-decoration: underline;
}

.card-site-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}

.favicon-img {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--surface-2);
}

.card-domain {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-url-line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 0.82rem;
}

.results-stats {
  margin-bottom: 8px;
  color: var(--muted-2);
  font-size: 0.82rem;
}

.results-stats p {
  margin: 0;
  line-height: 1.4;
}

.results-stats-query {
  color: var(--muted);
  font-size: 0.78rem;
}

.results-list .card-result:not(:last-child) {
  border-bottom: none;
}

.card-title-link {
  font-size: clamp(1.15rem, 2.4vw, 1.35rem);
  font-weight: 400;
  color: var(--serp-link);
  text-decoration: none;
  line-height: 1.3;
  word-break: break-word;
  margin: 0;
  display: inline-block;
}

.card-title-link:hover {
  text-decoration: underline;
}

.card-snippet {
  font-size: 0.875rem;
  color: var(--serp-snippet);
  line-height: 1.58;
  margin-top: 4px;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- In-app page viewer ---------- */
body.webx-viewer-open {
  overflow: hidden;
}

.page-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  flex-direction: column;
  background: var(--bg);
}

.page-viewer.is-open {
  display: flex;
}

.page-viewer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(8px + var(--safe-top)) 12px 8px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.96);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.page-viewer-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
  color: var(--muted);
}

.page-viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.page-viewer-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  min-height: 40px;
}

.page-viewer-btn:hover {
  background: var(--surface-2);
}

.page-viewer-btn--icon {
  width: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.page-viewer-body {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #fff;
}

.page-viewer-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.page-viewer-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  background: var(--bg);
  text-align: center;
}

.page-viewer-fallback p {
  color: var(--muted);
  max-width: 320px;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.raw-toggle-btn {
  background: none;
  border: none;
  color: var(--muted-2);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
  align-self: flex-start;
  min-height: 44px;
}

.raw-toggle-btn:hover {
  color: var(--text);
  text-decoration: underline;
}

.raw-text-details {
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.raw-text-details[hidden] {
  display: none !important;
}

/* ---------- PAA ---------- */
.paa-widget {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 0 0 8px;
  max-width: var(--results-col);
}

.paa-heading {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.accordion-item {
  border-top: 1px solid var(--border);
}

.accordion-trigger {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 14px 0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  min-height: 48px;
}

.accordion-trigger svg {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.accordion-trigger[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.accordion-content {
  font-size: 0.88rem;
  color: var(--muted);
  padding: 0 0 14px;
}

.accordion-content[hidden] {
  display: none !important;
}

/* ---------- Media grids ---------- */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  width: 100%;
}

@media (min-width: 641px) {
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
  }
}

.media-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.media-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

.media-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--surface-2);
}

.media-info {
  padding: 10px 12px;
}

.media-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Empty / error / skeleton ---------- */
.state-card {
  max-width: var(--results-col);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  background: var(--surface);
}

.state-card h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.state-card p {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 14px;
}

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

.state-card--wake {
  text-align: center;
  padding-top: 32px;
  padding-bottom: 32px;
}

.loading-view {
  max-width: var(--results-col);
  padding: 8px 0 24px;
}

.loading-view-text {
  text-align: center;
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 20px;
}

.wake-spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 16px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: webx-spin 0.85s linear infinite;
}

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

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 18px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: opacity 0.2s var(--ease-smooth);
}

.btn-primary:hover {
  opacity: 0.9;
}

/* ---------- AI Mode answer ---------- */
.ai-answer-wrap {
  max-width: var(--results-col);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ai-overview-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  box-shadow: var(--shadow-card);
}

.ai-answer-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin-bottom: 14px;
}

.ai-answer-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ai2-chrome);
}

.ai-answer-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.ai-answer-body {
  line-height: 1.65;
  color: var(--text);
  font-size: 0.95rem;
}

.ai-answer-body p {
  margin-bottom: 12px;
}

.ai-answer-body p:last-child {
  margin-bottom: 0;
}

.ai-answer-list {
  margin: 0 0 12px 1.1rem;
  padding: 0;
}

.ai-answer-list li {
  margin-bottom: 6px;
}

.ai-sources-section {
  max-width: var(--results-col);
}

.ai-sources-heading {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--muted);
}

.ai-source-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-source-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.ai-source-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

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

.ai-source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--link);
  font-size: 0.9rem;
  line-height: 1.3;
}

.ai-source-link:hover {
  text-decoration: underline;
}

.ai-source-title {
  font-weight: 500;
}

.ai-source-url {
  display: block;
  font-size: 0.75rem;
  color: var(--muted-2);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-panel code {
  font-family: var(--mono);
  font-size: 0.8em;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
}

.skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: var(--results-col);
}

.skeleton-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.skeleton-line--title {
  height: 18px;
  width: 70%;
}

.skeleton-line--meta {
  width: 40%;
}

.skeleton-line--body {
  width: 95%;
}

.skeleton-line--body-2 {
  width: 80%;
}

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

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

  .skeleton-line {
    animation: none;
    background: var(--surface-2);
  }
}
