:root {
  color-scheme: light;
  --canvas: #F5F7FB;
  --surface: #FFFFFF;
  --ink: #111827;
  --muted: #526077;
  --subtle: #667085;
  --blue: #2F5BFF;
  --blue-strong: #2147DC;
  --blue-soft: #EAF0FF;
  --line: #E3E8F0;
  --line-strong: #CBD4E2;
  --focus: #2147DC;
  --danger: #B42318;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --font-ui: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; overflow-x: clip; scrollbar-color: var(--line-strong) var(--canvas); }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.58;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
}
body, button, input, select { font-family: var(--font-ui); }
button, input, select { font-size: inherit; }
button { color: inherit; }
a { color: inherit; text-underline-offset: 4px; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
::selection { color: #fff; background: var(--blue-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 30;
  top: 10px;
  left: 10px;
  padding: 11px 15px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  height: 68px;
  align-items: center;
  gap: 52px;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(16px);
}
.brand {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -.09em;
  line-height: 1;
  text-decoration: none;
}
.brand-mark { color: var(--blue); }
.primary-nav { display: flex; height: 100%; align-items: center; gap: 30px; }
.nav-link {
  position: relative;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  padding: 0 1px;
  color: var(--muted);
  background: none;
  border: 0;
  font-size: 14px;
  transition: color 150ms ease;
}
.nav-link::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
  content: "";
  transition: background-color 150ms ease;
}
.nav-link:hover, .nav-link.is-current { color: var(--ink); }
.nav-link.is-current { font-weight: 650; }
.nav-link.is-current::after { background: var(--blue); }
.nav-count {
  min-width: 18px;
  color: var(--subtle);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.nav-count:empty { display: none; }
.info-button, .preview-close, .share-query {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}
.info-button { margin-left: auto; }
.info-button svg, .preview-close svg, .share-query svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}
.info-button:hover, .preview-close:hover, .share-query:hover {
  color: var(--ink);
  border-color: var(--line);
  background: var(--canvas);
}

.app-shell {
  width: min(100%, 1320px);
  min-height: calc(100vh - 68px);
  margin: 0 auto;
  padding: 0 clamp(24px, 5vw, 76px) 88px;
}
.work-area, .view-panel { min-width: 0; }
.search-workspace { display: block; }
.search-workspace.has-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 390px);
  gap: clamp(26px, 4vw, 58px);
  align-items: start;
}
.search-primary { min-width: 0; }
.search-head { position: relative; }
.heading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 28px;
}
.heading-row h1, .library-head h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(42px, 5.6vw, 66px);
  font-weight: 730;
  letter-spacing: -.075em;
  line-height: 1.08;
}
.search-workspace.has-query .heading-row { display: none; }
.share-query { width: 38px; height: 38px; }
.search-form { width: min(100%, 780px); margin: 0 auto; }
.search-workspace.has-query .search-form { width: min(100%, 860px); }
.search-box {
  display: flex;
  min-height: 66px;
  align-items: center;
  gap: 14px;
  padding: 6px 7px 6px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(26, 46, 93, .045);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.search-box:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(47, 91, 255, .10), 0 8px 26px rgba(26, 46, 93, .07);
}
.search-symbol {
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--subtle);
  stroke-linecap: round;
  stroke-width: 1.7;
}
.search-box input {
  width: 100%;
  min-width: 0;
  height: 50px;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 17px;
  line-height: 1.4;
}
.search-box input::placeholder { color: #8490A3; opacity: 1; }
.search-box input::-webkit-search-cancel-button { display: none; }
.clear-search {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 9px;
  color: var(--subtle);
  background: transparent;
}
.clear-search:hover { color: var(--ink); background: var(--canvas); }
.clear-search svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}
.search-submit {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--blue);
  transition: background-color 140ms ease, transform 180ms var(--ease-out);
}
.search-submit svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.search-submit:hover { background: var(--blue-strong); }
.search-submit:active { transform: scale(.96); }

.search-workspace:not(.has-query) .search-primary { padding-top: clamp(88px, 18vh, 188px); }
.search-workspace:not(.has-query) .search-head { text-align: center; }
.search-workspace:not(.has-query) .landing-state { width: min(100%, 780px); margin: 0 auto; }
.search-workspace.has-query .search-head { padding-top: 32px; }
.search-workspace.has-query .filter-line { width: min(100%, 860px); margin-inline: 0; }
.filter-line {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 14px;
  margin: 18px auto 0;
  border-bottom: 1px solid var(--line);
}
.filter-trigger {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: var(--surface);
  font-size: 14px;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}
.filter-trigger svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.5;
}
.filter-trigger:hover, .filter-trigger[aria-expanded="true"] { color: var(--ink); border-color: var(--line-strong); background: #fff; }
.filter-active-count { display: inline-grid; min-width: 19px; height: 19px; place-items: center; border-radius: 50%; color: #fff; background: var(--blue); font-size: 12px; }
.sort-control { display: flex; align-items: center; gap: 3px; }
.sort-button {
  min-height: 36px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  transition: color 140ms ease, background-color 140ms ease;
}
.sort-button:hover { color: var(--ink); background: rgba(17, 24, 39, .045); }
.sort-button.is-selected { color: var(--blue-strong); background: var(--blue-soft); font-weight: 600; }
.result-count { margin-left: auto; color: var(--muted); font-size: 14px; white-space: nowrap; }
.filter-options {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  padding: 17px 0 20px;
  border-bottom: 1px solid var(--line);
}
.filter-options label { display: grid; min-width: 145px; gap: 6px; color: var(--muted); font-size: 13px; }
.filter-options input, .filter-options select {
  min-width: 0;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
}
.filter-options input:focus, .filter-options select:focus { border-color: var(--blue); outline: 3px solid rgba(47, 91, 255, .12); }
.filter-apply {
  min-height: 40px;
  padding: 0 17px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  font-size: 14px;
  font-weight: 600;
}
.filter-apply:hover { background: var(--blue-strong); }
.text-button {
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  transition: color 140ms ease, background-color 140ms ease;
}
.text-button:hover { color: var(--ink); background: rgba(17, 24, 39, .05); }
.danger-text:hover { color: var(--danger); }

.landing-state { min-height: 150px; }
.trending-area { margin: 78px 0 0; text-align: center; }
.recent-area { width: min(100%, 780px); margin: 68px auto 0; text-align: left; }
.trending-area h2, .recent-area h2 { margin: 0 0 16px; color: var(--subtle); font-size: 14px; font-weight: 550; }
.trending-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.recent-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
.trending-chip {
  min-height: 39px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, .72);
  font-size: 14px;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease, transform 180ms var(--ease-out);
}
.trending-chip:hover { color: var(--blue-strong); border-color: #AABAFB; background: #fff; transform: translateY(-1px); }
.recent-query {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 3px;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  font-size: 15px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 140ms ease, border-color 140ms ease;
}
.recent-query::after { width: 7px; height: 7px; flex: 0 0 auto; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; content: ""; opacity: 0; transform: rotate(45deg); transition: opacity 140ms ease; }
.recent-query:hover { color: var(--blue-strong); border-color: #AABAFB; background: transparent; }
.recent-query:only-child { grid-column: 1 / -1; }
.recent-query:hover::after, .recent-query:focus-visible::after { opacity: 1; }

.loading-state { width: min(100%, 860px); margin: 68px auto; text-align: center; }
.loading-line { display: block; width: 96px; height: 3px; margin: 0 auto 18px; overflow: hidden; border-radius: 4px; background: var(--blue-soft); }
.loading-line::after { display: block; width: 45%; height: 100%; border-radius: inherit; background: var(--blue); content: ""; animation: search-progress 1.25s linear infinite; }
@keyframes search-progress { 0% { transform: translateX(-110%); } 100% { transform: translateX(235%); } }
.loading-state p { margin: 0; color: var(--muted); font-size: 15px; }
.error-state, .no-results { width: min(100%, 860px); margin: 44px auto; padding: 25px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.error-state h2, .no-results h2 { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: -.03em; }
.error-state p, .no-results p { margin: 8px 0 0; color: var(--muted); font-size: 15px; }
.error-state button, .preview-retry {
  min-height: 40px;
  margin-top: 17px;
  padding: 0 15px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  font-size: 14px;
}
.error-state button:hover, .preview-retry:hover { background: var(--blue-strong); }

.results-state { width: min(100%, 860px); margin: 0; }
.results-topline { display: flex; align-items: center; gap: 12px; margin: 26px 0 17px; }
.intent-label { color: var(--blue-strong); font-size: 14px; font-weight: 650; }
.results-query { display: none; }
.results-intro { margin: 0 0 22px; color: var(--muted); font-size: 15px; }

.source-summary { margin: 24px 0 28px; padding: 18px 22px; border: 1px solid #D8E2FF; border-radius: 14px; background: var(--blue-soft); }
.summary-list { display: grid; gap: 13px; }
.summary-item { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; align-items: start; }
.summary-key {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid #AABAFB;
  border-radius: 7px;
  color: var(--blue-strong);
  background: rgba(255,255,255,.62);
  font-size: 12px;
  font-weight: 700;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}
.summary-key:hover, .summary-key.is-active { color: #fff; border-color: var(--blue); background: var(--blue); }
.summary-text { margin: 0; color: #283449; font-size: 15px; line-height: 1.65; }
.summary-source { display: inline-block; margin-left: 8px; color: var(--muted); font-size: 13px; }

.comparison-intro { margin: 24px 0 12px; }
.comparison-intro h2 { margin: 0; font-size: 17px; font-weight: 650; }
.comparison-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin: 0 0 24px; }
.comparison-source { min-width: 0; padding: 16px 17px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.62); }
.comparison-source h3 { margin: 8px 0 0; font-size: 16px; font-weight: 650; line-height: 1.5; }
.comparison-source h3 a { text-decoration: none; }
.comparison-source h3 a:hover { color: var(--blue-strong); text-decoration: underline; }
.comparison-source .source-index { color: var(--blue-strong); font-size: 12px; font-weight: 700; }
.comparison-source .source-domain { margin: 6px 0 8px; color: var(--subtle); font-size: 13px; }
.comparison-source > p:last-child { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

.source-list { position: relative; border-top: 1px solid var(--line); }
.source-list::before {
  position: absolute;
  top: 20px;
  bottom: 20px;
  left: 19px;
  width: 1px;
  background: var(--line-strong);
  content: "";
}
.source-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 17px;
  align-items: start;
  padding: 23px 3px;
  border-bottom: 1px solid var(--line);
  transition: background-color 170ms ease, border-radius 170ms ease;
}
.source-index { padding-top: 4px; }
.source-index button {
  position: relative;
  z-index: 1;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--blue-strong);
  background: var(--canvas);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  transition: background-color 140ms ease, color 140ms ease;
}
.source-index button:hover, .source-index button.is-active { color: #fff; background: var(--blue); }
.source-content { min-width: 0; }
.source-domain { margin: 0 0 5px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.source-title {
  display: inline-block;
  color: #1745C7;
  font-size: 19px;
  font-weight: 620;
  letter-spacing: -.025em;
  line-height: 1.42;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.source-title:hover { color: var(--blue-strong); text-decoration: underline; }
.source-snippet { max-width: 72ch; margin: 7px 0 0; color: #364256; font-size: 15px; line-height: 1.68; overflow-wrap: anywhere; }
.source-metadata { display: flex; flex-wrap: wrap; gap: 6px 15px; margin-top: 9px; color: var(--subtle); font-size: 13px; }
.source-metadata span { display: inline-flex; align-items: center; gap: 6px; }
.metadata-dot { width: 3px; height: 3px; border-radius: 50%; background: #8D98A9; }
.metadata-opened { color: #167454; }
.source-actions { display: flex; align-items: center; gap: 3px; opacity: .72; transition: opacity 140ms ease; }
.source-action {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}
.source-action svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.55; }
.source-action:hover, .source-action.is-saved { color: var(--blue-strong); border-color: #DCE5FF; background: var(--blue-soft); }
.source-action.is-saved svg { fill: rgba(47,91,255,.13); }
.source-row.is-focused { margin-inline: -10px; padding-inline: 13px; border-radius: 12px; background: var(--blue-soft); }
.no-results { margin: 28px 0; }
.no-results p { margin-bottom: 0; }
.no-results button { min-height: 39px; margin-top: 13px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); background: var(--surface); }
.no-results button:hover { border-color: var(--blue); color: var(--blue-strong); }

.preview-pane {
  position: sticky;
  top: 91px;
  min-width: 0;
  max-height: calc(100vh - 112px);
  overflow: hidden;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 12px 38px rgba(23, 40, 78, .07);
  opacity: 0;
  transform: translateY(9px);
  transition: opacity 190ms ease, transform 240ms var(--ease-out);
}
.preview-pane.is-visible { opacity: 1; transform: translateY(0); }
.preview-pane-topline { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.preview-pane-topline h2 { margin: 0; color: var(--muted); font-size: 14px; font-weight: 550; }
.preview-close { width: 36px; height: 36px; margin: -6px -7px 0 0; border-color: var(--line); }
.preview-pane-title { margin: 18px 0 0; font-size: 20px; font-weight: 650; line-height: 1.45; overflow-wrap: anywhere; }
.preview-pane-meta { margin: 5px 0 0; color: var(--subtle); font-size: 13px; }
.preview-open-link { display: inline-flex; min-height: 40px; align-items: center; margin-top: 7px; color: var(--blue-strong); font-size: 14px; font-weight: 600; text-decoration: none; }
.preview-open-link:hover { text-decoration: underline; }
.preview-pane-content {
  max-height: calc(100vh - 320px);
  min-height: 170px;
  overflow: auto;
  margin-top: 13px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: #364256;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.75;
}
.preview-pane-content p { margin: 0; }
.preview-pane-content.preview-status { color: var(--subtle); }
.preview-error { color: var(--danger); }
.preview-retry { min-height: 38px; margin: 12px 0 0; padding: 0 12px; }

.library-view { width: min(100%, 900px); margin: 0 auto; padding-top: 60px; }
.library-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 21px; border-bottom: 1px solid var(--line-strong); }
.library-head h1 { font-size: clamp(34px, 4vw, 48px); }
.library-total { color: var(--muted); font-size: 14px; white-space: nowrap; }
.library-list { border-bottom: 1px solid var(--line); }
.library-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: start; padding: 20px 0; border-bottom: 1px solid var(--line); }
.library-row:last-child { border-bottom: 0; }
.library-row h2 { margin: 0; font-size: 18px; font-weight: 620; line-height: 1.5; }
.library-row h2 a { color: #1745C7; text-decoration: none; }
.library-row h2 a:hover { color: var(--blue-strong); text-decoration: underline; }
.history-query { padding: 0; border: 0; color: #1745C7; background: none; text-align: left; font-size: 18px; font-weight: 620; line-height: 1.5; overflow-wrap: anywhere; }
.history-query:hover { color: var(--blue-strong); text-decoration: underline; text-underline-offset: 4px; }
.library-row .row-meta { margin: 5px 0 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.library-row .row-summary { margin: 8px 0 0; color: #364256; font-size: 14px; line-height: 1.6; }
.bookmark-metadata { margin-top: 5px; }
.library-row .row-action { min-width: 44px; min-height: 40px; padding: 0 10px; border: 1px solid transparent; border-radius: 8px; color: var(--muted); background: transparent; font-size: 14px; }
.library-row .row-action:hover { color: var(--danger); border-color: #F0D9D7; background: #FFF8F7; }
.empty-library { padding: 28px 0; color: var(--muted); font-size: 15px; }
.empty-library h2 { margin: 0; font-size: 17px; font-weight: 550; }

.info-popover {
  position: fixed;
  inset: auto 22px 22px auto;
  width: min(440px, calc(100vw - 28px));
  max-height: min(70vh, 420px);
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 20px 70px rgba(17, 24, 39, .2);
}
.info-popover::backdrop { background: rgba(17, 24, 39, .25); backdrop-filter: blur(2px); }
.popover-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.popover-head h2 { margin: 0; font-size: 18px; font-weight: 650; }
.popover-close { display: grid; width: 36px; height: 36px; place-items: center; border: 0; border-radius: 8px; color: var(--muted); background: transparent; }
.popover-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.5; }
.popover-close:hover { color: var(--ink); background: var(--canvas); }
.popover-body { padding: 6px 18px 12px; }
.popover-body p { margin: 11px 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

.toast-region { position: fixed; z-index: 25; right: 20px; bottom: 20px; display: grid; gap: 8px; pointer-events: none; }
.toast { max-width: min(380px, calc(100vw - 40px)); padding: 12px 16px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; color: #fff; background: #172033; box-shadow: 0 10px 30px rgba(17,24,39,.19); font-size: 14px; }

@media (hover: hover) and (pointer: fine) {
  .source-actions { opacity: .44; }
  .source-row:hover .source-actions, .source-row:focus-within .source-actions { opacity: 1; }
}
@media (max-width: 1080px) {
  .search-workspace.has-preview { display: block; }
  .preview-pane { position: relative; top: auto; max-height: none; margin: 32px 0 0; }
  .preview-pane-content { max-height: 42vh; }
}
@media (max-width: 680px) {
  .topbar { height: 60px; gap: 22px; padding: 0 16px; }
  .brand { font-size: 23px; }
  .primary-nav { gap: clamp(13px, 4vw, 23px); }
  .nav-link { gap: 4px; font-size: 13px; }
  .nav-count { font-size: 11px; }
  .info-button { width: 38px; height: 38px; }
  .app-shell { min-height: calc(100vh - 60px); padding: 0 20px 56px; }
  .search-workspace:not(.has-query) .search-primary { padding-top: clamp(82px, 17vh, 150px); }
  .heading-row { margin-bottom: 23px; }
  .heading-row h1 { font-size: 47px; }
  .search-box { min-height: 60px; gap: 10px; padding: 5px 6px 5px 14px; border-radius: 13px; }
  .search-box input { height: 48px; font-size: 16px; }
  .search-submit { width: 48px; height: 48px; border-radius: 9px; }
  .filter-line { min-height: 50px; gap: 7px; margin-top: 12px; }
  .filter-trigger { min-height: 36px; gap: 5px; padding: 0 8px; font-size: 13px; }
  .sort-control { gap: 0; }
  .sort-button { min-height: 34px; padding: 0 8px; font-size: 12px; }
  .result-count { font-size: 12px; }
  .filter-options { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .filter-options label { min-width: 0; font-size: 13px; }
  .filter-apply, .filter-options > .text-button { align-self: end; }
  .trending-area { margin-top: 66px; }
  .recent-area { margin-top: 56px; }
  .recent-list { grid-template-columns: 1fr; }
  .recent-query { min-height: 45px; font-size: 14px; }
  .trending-list { gap: 7px; }
  .trending-chip { min-height: 36px; padding-inline: 12px; font-size: 13px; }
  .results-topline { margin-top: 23px; }
  .source-summary { margin: 16px 0 20px; padding: 15px; border-radius: 12px; }
  .comparison-grid { grid-template-columns: 1fr; gap: 10px; }
  .source-row { grid-template-columns: 25px minmax(0, 1fr); gap: 11px; padding: 18px 0; }
  .source-list::before { left: 12px; }
  .source-index button { min-width: 25px; min-height: 28px; }
  .source-title { font-size: 17px; }
  .source-snippet { margin-top: 6px; font-size: 14px; line-height: 1.62; }
  .source-metadata { gap: 4px 12px; margin-top: 7px; font-size: 12px; }
  .source-actions { grid-column: 2; opacity: 1; margin-top: 3px; }
  .source-row.is-focused { margin-inline: -7px; padding-inline: 10px; }
  .library-view { padding-top: 38px; }
  .library-row { gap: 10px; padding: 16px 0; }
  .library-row h2 { font-size: 16px; }
  .library-row .row-meta { font-size: 12px; }
  .preview-pane { margin-top: 24px; padding: 17px; }
  .info-popover { inset: auto 14px 14px; width: auto; }
}
@media (max-width: 390px) {
  .topbar { gap: 14px; padding-inline: 12px; }
  .brand { font-size: 21px; }
  .primary-nav { gap: 11px; }
  .nav-link { font-size: 12px; }
  .nav-count { display: none; }
  .app-shell { padding-inline: 15px; }
  .search-box { gap: 8px; }
  .filter-line { flex-wrap: wrap; padding-bottom: 9px; }
  .sort-control { flex: 1; justify-content: flex-end; }
  .result-count { width: 100%; margin: -1px 0 4px 4px; }
  .source-actions { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .source-row:hover .source-actions, .source-row:focus-within .source-actions { opacity: 1; }
}

:root { --ease-in-out: cubic-bezier(.77, 0, .175, 1); }

.nav-link::after {
  background: var(--blue);
  opacity: 0;
  transform: scaleX(.36);
  transform-origin: center;
  transition: opacity 140ms ease, transform 220ms var(--ease-out);
}
.nav-link.is-current::after { opacity: 1; transform: scaleX(1); }

.search-box { position: relative; }
.search-symbol { transition: color 180ms ease, transform 220ms var(--ease-out); }
.search-box:focus-within .search-symbol { color: var(--blue); transform: rotate(-9deg) scale(1.06); }
.search-form.is-searching .search-box {
  border-color: rgba(47, 91, 255, .55);
  box-shadow: 0 0 0 4px rgba(47, 91, 255, .075), 0 8px 28px rgba(26, 46, 93, .085);
}
.search-form.is-searching .search-box::after {
  position: absolute;
  right: auto;
  bottom: -1px;
  left: 0;
  width: 28%;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--blue), transparent);
  box-shadow: 0 0 10px rgba(47, 91, 255, .45);
  content: "";
  pointer-events: none;
  animation: search-signal 1.2s linear infinite;
}
.search-submit { position: relative; overflow: hidden; }
.search-submit svg { transition: opacity 140ms ease, transform 180ms var(--ease-out); }
.search-submit::after {
  position: absolute;
  width: 23px;
  height: 23px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  content: "";
  opacity: 0;
  transform: scale(.72);
  pointer-events: none;
}
.search-form.is-searching .search-submit svg { opacity: 0; transform: scale(.72); }
.search-form.is-searching .search-submit::after {
  opacity: 1;
  transform: scale(1);
  animation: spinner-turn 740ms linear infinite;
}
.search-form.is-searching .search-submit:disabled { opacity: 1; }

.filter-options:not([hidden]) { transform-origin: top; animation: filter-unfold 220ms var(--ease-out) both; }
.loading-state:not([hidden]) { animation: state-arrive 220ms var(--ease-out) both; }
.preview-pane {
  transform: translateY(12px) scale(.99);
  transition: opacity 180ms ease, transform 240ms var(--ease-out);
}
.preview-pane.is-visible { transform: translateY(0) scale(1); }
.preview-pane-content.preview-status p::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 8px 1px 0;
  border-radius: 50%;
  background: var(--blue);
  content: "";
  animation: preview-pulse 900ms ease-in-out infinite alternate;
}

.source-list.is-arriving { animation: list-arrive 300ms var(--ease-out) both; }
.source-list.is-arriving::before { transform-origin: top; animation: source-rail 430ms var(--ease-out) both; }
.results-topline.is-arriving,
.source-summary.is-arriving,
.comparison-intro.is-arriving,
.comparison-grid.is-arriving { animation: state-arrive 280ms var(--ease-out) var(--arrival-delay, 0ms) both; }
.source-row.is-arriving,
.library-row.is-arriving { animation: row-arrive 300ms var(--ease-out) var(--arrival-delay, 0ms) both; }
.source-row.is-focused { animation: source-focus 300ms var(--ease-out); }
.source-index button, .summary-key { transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease, transform 180ms var(--ease-out); }
.source-action { transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease, transform 180ms var(--ease-out); }
.source-action.is-saved { animation: save-pop 260ms var(--ease-out); }
.comparison-source { transition: border-color 180ms ease, box-shadow 200ms ease, transform 200ms var(--ease-out); }
.library-row { transition: border-color 160ms ease; }
.library-row .row-action { transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease, transform 160ms var(--ease-out); }

.view-panel { transition: opacity 180ms ease, transform 230ms var(--ease-out); }
.view-panel.is-entering { opacity: 0; transform: translateY(8px); }
.toast {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 170ms ease, transform 220ms var(--ease-out);
}
.toast.is-entering { opacity: 0; transform: translateY(9px) scale(.985); }
.toast.is-leaving { opacity: 0; transform: translateY(5px) scale(.99); }

@media (hover: hover) and (pointer: fine) {
  .nav-link:not(.is-current):hover::after { opacity: .4; transform: scaleX(.72); }
  .search-submit:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(47, 91, 255, .2); }
  .filter-trigger:hover svg { transform: rotate(-8deg); }
  .filter-trigger svg { transition: transform 180ms var(--ease-out); }
  .sort-button:not(.is-selected):hover { transform: translateY(-1px); }
  .source-index button:hover, .summary-key:hover { transform: scale(1.08); }
  .source-action:hover { transform: translateY(-1px); }
  .comparison-source:hover { border-color: #C8D5FF; box-shadow: 0 9px 22px rgba(23, 40, 78, .07); transform: translateY(-2px); }
  .library-row .row-action:hover { transform: translateY(-1px); }
}

@keyframes search-signal {
  from { transform: translateX(-110%); }
  to { transform: translateX(390%); }
}
@keyframes spinner-turn { to { transform: rotate(1turn) scale(1); } }
@keyframes filter-unfold {
  from { opacity: 0; transform: translateY(-6px) scaleY(.98); }
  to { opacity: 1; transform: translateY(0) scaleY(1); }
}
@keyframes preview-pulse { from { opacity: .35; transform: scale(.82); } to { opacity: 1; transform: scale(1.18); } }
@keyframes state-arrive {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes list-arrive {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes source-rail {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}
@keyframes row-arrive {
  from { opacity: 0; transform: translateY(7px) scale(.998); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes source-focus {
  from { transform: scale(.995); }
  to { transform: scale(1); }
}
@keyframes save-pop {
  0% { transform: scale(.86); }
  65% { transform: scale(1.16); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .search-form.is-searching .search-box::after,
  .search-form.is-searching .search-submit::after,
  .preview-pane-content.preview-status p::before { animation: none !important; }
  .search-form.is-searching .search-box::after { transform: translateX(0); }
  .filter-options:not([hidden]), .loading-state:not([hidden]) { opacity: 1; transform: none; animation: none !important; }
  .source-list.is-arriving::before,
  .source-list.is-arriving,
  .results-topline.is-arriving,
  .source-summary.is-arriving,
  .comparison-intro.is-arriving,
  .comparison-grid.is-arriving,
  .source-row.is-arriving,
  .library-row.is-arriving,
  .source-row.is-focused,
  .source-action.is-saved { animation: none !important; }
  .view-panel.is-entering { opacity: 1; transform: none; }
  .toast.is-entering, .toast.is-leaving { transform: none; }
}

/* Signature motion: a quiet orbital field gives the empty search page its own pulse. */
.search-head { isolation: isolate; transition: padding-top 460ms var(--ease-out); }
.search-head > * { position: relative; z-index: 1; }
.search-primary { transition: padding-top 560ms var(--ease-out); }
.search-form { transition: width 520ms var(--ease-out); }
.heading-row {
  max-height: 120px;
  overflow: hidden;
  transition: max-height 440ms var(--ease-out), margin 440ms var(--ease-out), opacity 260ms ease, transform 420ms var(--ease-out);
}
.search-workspace.has-query .heading-row {
  display: flex;
  max-height: 0;
  margin: 0;
  opacity: 0;
  transform: translateY(-12px) scale(.985);
  visibility: hidden;
  transition: max-height 440ms var(--ease-out), margin 440ms var(--ease-out), opacity 260ms ease, transform 420ms var(--ease-out), visibility 0s linear 440ms;
}
.search-workspace.has-query .filter-line:not([hidden]) { animation: filter-arrive 420ms var(--ease-out) 120ms both; }
.search-workspace:not(.has-query) .search-head::before,
.search-workspace:not(.has-query) .search-head::after {
  position: absolute;
  z-index: 0;
  top: -154px;
  left: 50%;
  display: block;
  content: "";
  pointer-events: none;
}
.search-workspace:not(.has-query) .search-head::before {
  width: min(88vw, 900px);
  height: 500px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 44%, rgba(255,255,255,.85), transparent 61%),
    repeating-radial-gradient(ellipse at 50% 46%, transparent 0 43px, rgba(47,91,255,.085) 44px, transparent 45px 82px),
    radial-gradient(ellipse at 50% 45%, rgba(47,91,255,.075), transparent 70%);
  opacity: .7;
  mask-image: linear-gradient(transparent 0%, #000 18%, #000 75%, transparent 100%);
  transform: translateX(-50%);
  animation: field-breathe 17s ease-in-out infinite alternate;
}
.search-workspace:not(.has-query) .search-head::after {
  top: -112px;
  width: min(69vw, 720px);
  height: 380px;
  border-radius: 50%;
  background:
    conic-gradient(from 8deg, transparent 0 294deg, rgba(47,91,255,.03) 300deg, rgba(47,91,255,.24) 308deg, rgba(47,91,255,.07) 314deg, transparent 322deg),
    radial-gradient(circle at 50% 20%, #6E87FF 0 2px, transparent 2.6px),
    radial-gradient(circle at 20% 50%, rgba(47,91,255,.6) 0 1.5px, transparent 2px);
  filter: blur(.25px);
  mask-image: radial-gradient(ellipse, transparent 55%, #000 55.8% 62%, transparent 62.8%);
  transform: translateX(-50%);
  animation: field-sweep 34s linear infinite;
}

body.is-ready .brand { animation: topbar-arrive 520ms var(--ease-out) both; }
body.is-ready .nav-link { animation: nav-arrive 460ms var(--ease-out) both; }
body.is-ready .nav-link:nth-child(1) { animation-delay: 70ms; }
body.is-ready .nav-link:nth-child(2) { animation-delay: 115ms; }
body.is-ready .nav-link:nth-child(3) { animation-delay: 160ms; }
body.is-ready .info-button { animation: topbar-arrive 460ms var(--ease-out) 210ms both; }
body.is-ready .search-workspace:not(.has-query) .heading-row { animation: hero-title-arrive 760ms var(--ease-out) 100ms both; }
body.is-ready .search-workspace:not(.has-query) .search-form { animation: hero-search-arrive 700ms var(--ease-out) 220ms both; }
.recent-area, .trending-area { transition: opacity 240ms ease, transform 300ms var(--ease-out); }
.recent-area.is-entering, .trending-area.is-entering { opacity: 0; transform: translateY(12px); }
.recent-query.is-arriving, .trending-chip.is-arriving { animation: chip-arrive 440ms var(--ease-out) var(--arrival-delay, 0ms) both; }

/* Search keeps moving while it works; each phase resolves into the next. */
.loading-state { position: relative; }
.loading-state::before {
  display: block;
  width: 46px;
  height: 46px;
  margin: 0 auto 17px;
  border: 1px solid rgba(47,91,255,.18);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--blue) 0 2px, transparent 2.5px),
    radial-gradient(circle at center, transparent 56%, rgba(47,91,255,.14) 57% 58%, transparent 59%),
    conic-gradient(from 20deg, transparent 0 66%, rgba(47,91,255,.36) 74%, transparent 82%);
  box-shadow: 0 0 0 7px rgba(47,91,255,.025), inset 0 0 15px rgba(47,91,255,.035);
  content: "";
  animation: loader-orbit 2.2s linear infinite;
}
.loading-state::after {
  position: absolute;
  top: 10px;
  left: calc(50% + 12px);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7891FF;
  box-shadow: 0 0 9px rgba(47,91,255,.45);
  content: "";
  transform-origin: -12px 13px;
  animation: satellite-orbit 2.2s linear infinite;
}

.results-topline.is-arriving { animation: intent-arrive 420ms var(--ease-out) var(--arrival-delay, 0ms) both; }
.source-list.is-arriving { position: relative; animation-duration: 640ms; }
.source-list.is-arriving::after {
  position: absolute;
  z-index: 2;
  top: -1px;
  left: -24%;
  width: 22%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(47,91,255,.85), transparent);
  content: "";
  pointer-events: none;
  animation: source-scan 630ms var(--ease-out) both;
}
.source-summary.is-arriving,
.comparison-intro.is-arriving,
.comparison-grid.is-arriving { animation-duration: 460ms; }
.error-state.is-arriving, .no-results.is-arriving { animation: state-arrive 440ms var(--ease-out) both; }
.summary-item.is-arriving { animation: summary-arrive 440ms var(--ease-out) var(--arrival-delay, 0ms) both; }
.comparison-source.is-arriving { animation: compare-arrive 540ms var(--ease-out) var(--arrival-delay, 0ms) both; }
.source-row.is-arriving { animation-duration: 530ms; }
.source-row.is-arriving .source-content > * {
  animation: source-copy-arrive 360ms var(--ease-out) calc(var(--arrival-delay, 0ms) + 48ms) both;
}
.source-row.is-arriving .source-title { animation-delay: calc(var(--arrival-delay, 0ms) + 68ms); }
.source-row.is-arriving .source-snippet { animation-delay: calc(var(--arrival-delay, 0ms) + 88ms); }
.source-row.is-arriving .source-metadata { animation-delay: calc(var(--arrival-delay, 0ms) + 108ms); }
.source-row.is-arriving .source-actions { animation: actions-arrive 400ms var(--ease-out) calc(var(--arrival-delay, 0ms) + 94ms) both; }
.source-row { position: relative; isolation: isolate; transition: background-color 190ms ease, border-radius 190ms ease; }
.source-row::after {
  position: absolute;
  top: 22px;
  bottom: 22px;
  left: -3px;
  width: 2px;
  border-radius: 2px;
  background: var(--blue);
  content: "";
  opacity: 0;
  transform: scaleY(.35);
  transition: opacity 180ms ease, transform 260ms var(--ease-out);
}
.source-title {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  transition: color 150ms ease, background-size 260ms var(--ease-out);
}
.source-title:hover { text-decoration: none; background-size: 100% 1px; }
.preview-pane.is-visible .preview-pane-topline { animation: preview-detail-arrive 400ms var(--ease-out) both; }
.preview-pane.is-visible .preview-pane-title { animation: preview-detail-arrive 460ms var(--ease-out) 45ms both; }
.preview-pane.is-visible .preview-pane-meta { animation: preview-detail-arrive 420ms var(--ease-out) 90ms both; }
.preview-pane.is-visible .preview-open-link { animation: preview-detail-arrive 430ms var(--ease-out) 125ms both; }
.preview-pane.is-visible .preview-pane-content { animation: preview-detail-arrive 520ms var(--ease-out) 170ms both; }
.preview-close svg { transition: transform 220ms var(--ease-out); }
.preview-close:hover svg { transform: rotate(90deg); }

.library-head { position: relative; }
.library-head::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--blue), rgba(47,91,255,.12) 62%, transparent);
  content: "";
  transform: scaleX(0);
  transform-origin: left;
}
.library-view:not([hidden]) .library-head::after { animation: library-line 650ms var(--ease-out) 120ms both; }
.library-row { position: relative; transition: border-color 180ms ease, background-color 180ms ease; }
.library-row::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(47,91,255,.62), transparent 65%);
  content: "";
  opacity: 0;
  transform: scaleX(.28);
  transform-origin: left;
  transition: opacity 180ms ease, transform 280ms var(--ease-out);
}
.library-row.is-arriving > div > h2,
.library-row.is-arriving > div > .history-query,
.library-row.is-arriving > div > .row-meta,
.library-row.is-arriving > div > .row-summary { animation: source-copy-arrive 360ms var(--ease-out) calc(var(--arrival-delay, 0ms) + 46ms) both; }
.library-row.is-arriving { animation-duration: 430ms; }
.toast { position: relative; overflow: hidden; }
.toast::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: linear-gradient(transparent, #7891FF, transparent);
  content: "";
}
#info-popover:popover-open { animation: popover-arrive 260ms var(--ease-out) both; }

@media (hover: hover) and (pointer: fine) {
  .source-row:hover { border-radius: 11px; background: rgba(234,240,255,.42); }
  .source-row:hover::after, .source-row:focus-within::after { opacity: 1; transform: scaleY(1); }
  .source-actions { transform: translateX(4px); transition: opacity 180ms ease, transform 250ms var(--ease-out); }
  .source-row:hover .source-actions, .source-row:focus-within .source-actions { transform: translateX(0); }
  .source-actions .source-action { transition-delay: 0ms; }
  .source-row:hover .source-actions .source-action:nth-child(2) { transition-delay: 28ms; }
  .source-row:hover .source-actions .source-action:nth-child(3) { transition-delay: 56ms; }
  .library-row:hover { background: rgba(255,255,255,.5); }
  .library-row:hover::after { opacity: 1; transform: scaleX(1); }
  .recent-query:hover::after { transform: translateX(2px) rotate(45deg); }
}
.nav-link:active, .filter-trigger:active, .sort-button:active, .source-action:active,
.trending-chip:active, .recent-query:active, .library-row .row-action:active { transform: scale(.97); }

@keyframes field-breathe {
  0% { opacity: .48; transform: translateX(-50%) rotate(-3deg) scale(.97); }
  100% { opacity: .76; transform: translateX(-50%) rotate(3deg) scale(1.025); }
}
@keyframes field-sweep { to { transform: translateX(-50%) rotate(1turn); } }
@keyframes topbar-arrive { from { opacity: 0; transform: translateY(-9px); } to { opacity: 1; transform: translateY(0); } }
@keyframes nav-arrive { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes hero-title-arrive { from { opacity: 0; filter: blur(7px); transform: translateY(23px) scale(.97); } to { opacity: 1; filter: blur(0); transform: translateY(0) scale(1); } }
@keyframes hero-search-arrive { from { opacity: 0; transform: translateY(25px) scale(.985); box-shadow: 0 0 0 rgba(47,91,255,0); } to { opacity: 1; transform: translateY(0) scale(1); box-shadow: 0 0 0 rgba(47,91,255,0); } }
@keyframes chip-arrive { from { opacity: 0; filter: blur(3px); transform: translateY(11px) scale(.96); } to { opacity: 1; filter: blur(0); transform: translateY(0) scale(1); } }
@keyframes loader-orbit { to { transform: rotate(1turn); } }
@keyframes satellite-orbit { to { transform: rotate(1turn); } }
@keyframes intent-arrive { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes filter-arrive { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes source-scan { from { left: -24%; opacity: 0; } 18% { opacity: 1; } to { left: 105%; opacity: 0; } }
@keyframes summary-arrive { from { opacity: 0; transform: translateY(12px) translateX(-5px); } to { opacity: 1; transform: translateY(0) translateX(0); } }
@keyframes compare-arrive { from { opacity: 0; transform: translateY(15px) scale(.975); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes source-copy-arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes actions-arrive { from { opacity: 0; transform: translateX(9px) scale(.96); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes preview-detail-arrive { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes library-line { to { transform: scaleX(1); } }
@keyframes popover-arrive { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .search-workspace:not(.has-query) .search-head::before,
  .search-workspace:not(.has-query) .search-head::after,
  .loading-state::before, .loading-state::after,
  body.is-ready .brand, body.is-ready .nav-link, body.is-ready .info-button,
  .source-list.is-arriving::after { animation: none !important; }
  body.is-ready .brand, body.is-ready .nav-link, body.is-ready .info-button,
  body.is-ready .search-workspace:not(.has-query) .heading-row,
  body.is-ready .search-workspace:not(.has-query) .search-form { opacity: 1; filter: none; transform: none; }
  .source-row.is-arriving .source-content > *, .source-row.is-arriving .source-actions,
  .library-row.is-arriving > div > h2, .library-row.is-arriving > div > .history-query,
  .library-row.is-arriving > div > .row-meta, .library-row.is-arriving > div > .row-summary {
    animation: none !important;
  }
  .search-primary, .search-form, .heading-row { transition-duration: .01ms !important; }
  .search-workspace.has-query .heading-row { transition-delay: 0ms !important; }
}

@media (max-width: 680px) {
  .search-workspace:not(.has-query) .search-head::before { top: -96px; width: 108vw; height: 390px; }
  .search-workspace:not(.has-query) .search-head::after { top: -62px; width: 86vw; height: 290px; }
}

/* Tools move with the search: refine locally, compare sources, or jump by command. */
[hidden] { display: none !important; }
.command-open {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 10px;
  padding: 0 9px 0 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease, transform 220ms var(--ease-out);
  margin-left: auto;
}
.topbar .info-button { margin-left: 0; }
.command-open kbd, .command-input-wrap kbd {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--subtle);
  background: rgba(255,255,255,.72);
  font: 550 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.command-open:hover { color: var(--blue-strong); border-color: #DCE5FF; background: #fff; transform: translateY(-1px); }
.command-open:active { transform: scale(.97); }

.result-workbench { margin: 2px 0 6px; }
.result-workbench-line { display: flex; min-height: 38px; align-items: center; gap: 10px; }
.local-filter-toggle {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}
.local-filter-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.local-filter-toggle:hover, .local-filter-toggle[aria-expanded="true"] { color: var(--blue-strong); border-color: #DCE5FF; background: #fff; }
.local-filter-toggle.has-active svg { color: var(--blue); filter: drop-shadow(0 0 4px rgba(47,91,255,.4)); }
.local-filter-input {
  width: min(100%, 360px);
  height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  outline: none;
  color: var(--ink);
  background: rgba(255,255,255,.7);
  font-size: 13px;
  animation: filter-expand 280ms var(--ease-out) both;
}
.local-filter-input:focus { border-color: #B8C7FF; background: #fff; box-shadow: 0 0 0 3px rgba(47,91,255,.08); }
.local-filter-input::placeholder { color: #8994A6; }
.domain-facets { display: flex; min-width: 0; align-items: center; gap: 6px; overflow-x: auto; padding: 2px 0 9px; scrollbar-width: none; }
.domain-facets::-webkit-scrollbar { display: none; }
.facet-caption { flex: 0 0 auto; margin-right: 2px; color: var(--subtle); font-size: 12px; }
.domain-facet {
  position: relative;
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.6);
  font-size: 11px;
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease, transform 220ms var(--ease-out);
}
.domain-facet:hover { border-color: #B8C7FF; color: var(--blue-strong); background: #fff; transform: translateY(-1px); }
.domain-facet.is-selected { border-color: var(--blue); color: #fff; background: var(--blue); box-shadow: 0 4px 12px rgba(47,91,255,.2); }
.domain-facet.is-selected::after { position: absolute; top: 0; bottom: 0; left: -42%; width: 30%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.42), transparent); content: ""; animation: facet-glint 520ms ease-out 1 both; }
.result-count.is-counting { animation: count-shift 260ms var(--ease-out) both; }
.local-empty { display: grid; min-height: 100px; place-items: center; border-top: 1px solid var(--line); color: var(--subtle); font-size: 14px; animation: state-arrive 260ms var(--ease-out) both; }
.source-row.is-filter-entering { animation: filter-row-in 280ms var(--ease-out) both; }
.source-row.is-filter-leaving { animation: filter-row-out 140ms ease both; pointer-events: none; }
.source-row.is-compare-selected { border-radius: 12px; background: linear-gradient(90deg, rgba(47,91,255,.085), rgba(255,255,255,0) 70%); }
.source-row.is-compare-selected::after { opacity: 1; transform: scaleY(1); }
.compare-select.is-selected { border-color: #B8C7FF; color: var(--blue-strong); background: var(--blue-soft); }
.compare-select svg { transition: transform 320ms var(--ease-out); }
.compare-select.is-selected svg { transform: scale(.9); }

.compare-dock {
  position: fixed;
  z-index: 28;
  right: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 14px;
  padding: 8px 10px 8px 18px;
  border: 1px solid rgba(185,199,255,.25);
  border-radius: 15px;
  color: #fff;
  background: rgba(16,25,49,.94);
  box-shadow: 0 18px 52px rgba(19,35,82,.28), inset 0 1px rgba(255,255,255,.11);
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, 18px) scale(.97);
  backdrop-filter: blur(18px);
  transition: opacity 220ms ease, transform 360ms var(--ease-out);
}
.compare-dock.is-visible { opacity: 1; pointer-events: auto; transform: translate(50%, 0) scale(1); }
.compare-dock-count { position: relative; display: inline-flex; align-items: center; gap: 9px; color: #DBE4FF; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.compare-dock-count::before { width: 7px; height: 7px; border-radius: 50%; background: #85A1FF; box-shadow: 0 0 12px rgba(133,161,255,.8); content: ""; }
.compare-open { min-height: 40px; padding: 0 15px; border: 0; border-radius: 9px; color: #13214D; background: #DDE5FF; font-size: 13px; font-weight: 650; transition: background 160ms ease, transform 200ms var(--ease-out); }
.compare-open:not(:disabled):hover { background: #fff; transform: translateY(-1px); }
.compare-open:disabled { color: #7885A7; background: #2C3858; cursor: default; }
.compare-clear { min-height: 38px; padding: 0 8px; border: 0; color: #AAB6D5; background: transparent; font-size: 12px; transition: color 140ms ease; }
.compare-clear:hover { color: #fff; }

.command-dialog, .compare-dialog { max-width: none; padding: 0; border: 1px solid rgba(255,255,255,.46); color: var(--ink); background: transparent; box-shadow: 0 28px 100px rgba(7,17,46,.26); }
.command-dialog { position: fixed; inset: 13vh 0 auto; width: min(620px, calc(100vw - 28px)); margin: 0 auto; overflow: visible; border-radius: 19px; }
.command-dialog::backdrop, .compare-dialog::backdrop { background: rgba(10,18,39,.43); backdrop-filter: blur(8px) saturate(.8); animation: backdrop-in 260ms ease both; }
.command-panel { overflow: hidden; border-radius: inherit; background: rgba(250,251,255,.97); backdrop-filter: blur(24px); }
.command-input-wrap { display: flex; min-height: 70px; align-items: center; gap: 14px; padding: 0 20px; border-bottom: 1px solid rgba(36,52,89,.1); }
.command-input-wrap svg { width: 22px; height: 22px; flex: 0 0 auto; fill: none; stroke: #8290A8; stroke-width: 1.6; stroke-linecap: round; }
.command-input-wrap input { width: 100%; min-width: 0; height: 52px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 17px; }
.command-input-wrap input::placeholder { color: #8A95A8; }
.command-list { display: grid; gap: 4px; max-height: min(55vh, 420px); overflow: auto; padding: 9px; }
.command-option { display: grid; grid-template-columns: 35px minmax(0,1fr) 38px; min-height: 49px; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid transparent; border-radius: 10px; color: #344157; background: transparent; text-align: left; transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 220ms var(--ease-out); }
.command-option:hover, .command-option.is-active { border-color: rgba(47,91,255,.11); color: #183CBA; background: #EDF1FF; }
.command-option:active { transform: scale(.99); }
.command-symbol { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid #E2E7F1; border-radius: 8px; color: #63728B; background: rgba(255,255,255,.8); transition: border-color 150ms ease, color 150ms ease, background 150ms ease, transform 200ms var(--ease-out); }
.command-symbol svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.command-option.is-active .command-symbol { border-color: #CBD6FF; color: var(--blue); background: #fff; transform: rotate(-4deg); }
.command-label { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.command-enter { justify-self: end; padding: 3px 5px; border: 1px solid #DDE3ED; border-radius: 5px; color: #8994A7; background: rgba(255,255,255,.72); font: 500 9px/1.15 var(--font-ui); opacity: 0; transform: translateX(-4px); transition: opacity 140ms ease, transform 180ms var(--ease-out); }
.command-option.is-active .command-enter { opacity: 1; transform: translateX(0); }
.command-option.is-command-entering { animation: command-item-in 360ms var(--ease-out) var(--command-delay, 0ms) both; }
.command-empty { padding: 24px 15px; color: var(--subtle); font-size: 13px; text-align: center; }

.compare-dialog { width: min(1140px, calc(100vw - 36px)); max-height: min(88vh, 900px); overflow: auto; border-radius: 22px; }
.compare-panel { padding: clamp(20px, 3vw, 34px); border-radius: inherit; background: #F8F9FC; }
.compare-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.compare-head h2 { margin: 0; color: var(--ink); font-size: clamp(22px, 3vw, 30px); font-weight: 650; letter-spacing: -.045em; }
.compare-head-actions { display: flex; align-items: center; gap: 8px; }
.compare-copy { min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: #fff; font-size: 13px; transition: color 150ms ease, border-color 150ms ease, transform 180ms var(--ease-out); }
.compare-copy:hover { border-color: #B8C7FF; color: var(--blue-strong); transform: translateY(-1px); }
.compare-close { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: #fff; transition: color 150ms ease, transform 220ms var(--ease-out); }
.compare-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.6; }
.compare-close:hover { color: var(--ink); transform: rotate(90deg); }
.compare-content { padding-top: 22px; }
.compare-content .comparison-grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: clamp(10px, 2vw, 18px); margin: 0; }
.compare-content .comparison-source { min-height: 100%; padding: clamp(15px, 2vw, 24px); border-color: #DFE4ED; border-radius: 15px; background: #fff; box-shadow: 0 10px 26px rgba(28,44,77,.045); animation: compare-card-in 520ms var(--ease-out) calc(var(--compare-i, 0) * 75ms) both; }
.compare-content .comparison-source:nth-child(2) { --compare-i: 1; }
.compare-content .comparison-source:nth-child(3) { --compare-i: 2; }
.compare-content .comparison-source .source-index { display: inline-grid; min-width: 28px; height: 28px; place-items: center; padding: 0 6px; border-radius: 8px; background: var(--blue-soft); }
.compare-content .comparison-source h3 { margin-top: 13px; font-size: clamp(16px, 2vw, 20px); }
.compare-content .comparison-source > p:last-child { margin-top: 16px; color: #354257; font-size: 14px; line-height: 1.8; }

@keyframes palette-in { from { opacity: 0; transform: translateY(-13px) scale(.975); filter: blur(4px); } to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); } }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes command-item-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes filter-expand { from { opacity: 0; clip-path: inset(0 100% 0 0 round 8px); } to { opacity: 1; clip-path: inset(0 0 0 0 round 8px); } }
@keyframes facet-glint { 0%, 55% { left: -42%; } 85%, 100% { left: 125%; } }
@keyframes count-shift { 0% { opacity: .5; transform: translateY(-4px) scale(.95); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes filter-row-in { from { opacity: 0; transform: translateY(8px) scale(.995); filter: blur(2px); } to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); } }
@keyframes filter-row-out { to { opacity: 0; transform: translateX(-8px) scale(.99); filter: blur(2px); } }
@keyframes compare-card-in { from { opacity: 0; transform: perspective(900px) translateY(18px) rotateX(3deg) scale(.985); } to { opacity: 1; transform: perspective(900px) translateY(0) rotateX(0) scale(1); } }

@media (max-width: 760px) {
  .command-dialog { inset: 8vh 0 auto; }
  .compare-dialog { width: calc(100vw - 20px); max-height: 90vh; }
  .compare-content .comparison-grid { grid-template-columns: 1fr; }
  .compare-content .comparison-source { min-height: 0; }
}
@media (max-width: 680px) {
  .topbar { gap: clamp(8px, 3vw, 16px); }
  .command-open { width: 36px; min-width: 36px; justify-content: center; padding: 0; }
  .command-open > span { display: none; }
  .command-open kbd { padding: 4px 5px; font-size: 9px; }
  .result-workbench { margin-top: 0; }
  .domain-facets { margin-right: -8px; }
  .compare-dock { bottom: max(12px, env(safe-area-inset-bottom)); gap: 8px; min-height: 54px; padding-left: 12px; }
  .compare-dock-count { font-size: 13px; }
  .compare-open { min-height: 38px; padding: 0 11px; }
  .compare-clear { padding: 0 6px; }
  .compare-panel { padding: 18px 14px; }
  .compare-content { padding-top: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .command-dialog[open], .command-dialog::backdrop, .compare-dialog::backdrop,
  .command-option.is-command-entering, .compare-content .comparison-source, .source-row.is-filter-entering,
  .source-row.is-filter-leaving, .domain-facet.is-selected::after,
  .compare-dock-count::before { animation: none !important; }
  .compare-dock, .command-open, .local-filter-toggle, .domain-facet,
  .compare-copy, .compare-close, .command-option, .compare-open {
    transition-duration: .01ms !important;
  }
}

