/* ==========================================================================
   问渠 · WenQu Search
   A paper-and-ink interface for the living web.
   ========================================================================== */

:root {
  --bg: #f7f5ee;
  --bg-2: #efebe0;
  --surface: #fffdf8;
  --surface-2: #f2eee4;
  --ink: #17201e;
  --ink-2: #2b3835;
  --muted: #61706b;
  --faint: #8b9691;
  --line: #e3dfd3;
  --line-2: #d3cec0;
  --jade: #0d6b5b;
  --jade-2: #084f43;
  --jade-soft: #dceae4;
  --jade-glow: rgba(13, 107, 91, 0.16);
  --seal: #b3402f;
  --amber: #9a570d;
  --amber-soft: #f6e8d2;
  --danger: #a33a2c;
  --shadow-sm: 0 1px 2px rgba(23, 32, 30, 0.05);
  --shadow-md: 0 2px 4px rgba(23, 32, 30, 0.04), 0 18px 50px -28px rgba(23, 32, 30, 0.35);
  --shadow-lg: 0 4px 8px rgba(23, 32, 30, 0.05), 0 34px 80px -32px rgba(13, 107, 91, 0.32);
  --radius: 22px;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  --bg: #0c1211;
  --bg-2: #101816;
  --surface: #141d1b;
  --surface-2: #192421;
  --ink: #e9ede9;
  --ink-2: #d2dad6;
  --muted: #9aa8a2;
  --faint: #6f7d77;
  --line: #24312e;
  --line-2: #33413d;
  --jade: #62c9ae;
  --jade-2: #8adfc7;
  --jade-soft: #17332c;
  --jade-glow: rgba(98, 201, 174, 0.14);
  --seal: #e07b63;
  --amber: #e0a45e;
  --amber-soft: #3a2a17;
  --danger: #ef8874;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.3), 0 18px 50px -28px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.35), 0 34px 80px -32px rgba(0, 0, 0, 0.9);
  color-scheme: dark;
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  background:
    radial-gradient(ellipse 70% 42% at 50% -8%, rgba(13, 107, 91, 0.1), transparent 62%),
    radial-gradient(ellipse 50% 34% at 92% 72%, rgba(179, 64, 47, 0.055), transparent 70%),
    radial-gradient(ellipse 44% 30% at 6% 88%, rgba(154, 87, 13, 0.045), transparent 70%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

[data-theme="dark"] body {
  background:
    radial-gradient(ellipse 70% 42% at 50% -8%, rgba(98, 201, 174, 0.08), transparent 62%),
    radial-gradient(ellipse 50% 34% at 92% 72%, rgba(224, 123, 99, 0.05), transparent 70%),
    radial-gradient(ellipse 44% 30% at 6% 88%, rgba(224, 164, 94, 0.035), transparent 70%),
    var(--bg);
}

.page-noise {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.34;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

[data-theme="dark"] .page-noise {
  opacity: 0.2;
  mix-blend-mode: screen;
}

main,
.topbar,
.footer {
  position: relative;
  z-index: 1;
}

::selection {
  background: var(--jade-soft);
  color: var(--jade-2);
}

:focus-visible {
  outline: 2px solid var(--jade);
  outline-offset: 3px;
  border-radius: 4px;
}

a {
  color: var(--jade);
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
}

.icon {
  width: 19px;
  height: 19px;
  flex: none;
}

.dot-sep {
  margin: 0 2px;
  color: var(--faint);
}

/* --------------------------------------------------------------- top bar */

.topbar {
  position: fixed;
  inset: 0 0 auto;
  height: 72px;
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 30px);
  padding: 0 clamp(20px, 4vw, 54px);
  border-bottom: 1px solid transparent;
  background: transparent;
  transition: background 0.25s ease, border-color 0.25s ease, backdrop-filter 0.25s ease;
  z-index: 50;
}

.topbar.scrolled,
body.searched .topbar {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom-color: var(--line);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  flex: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--jade);
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.2s;
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

.brand:hover .brand-mark {
  transform: rotate(-8deg) scale(1.04);
  border-color: var(--jade);
}

.brand-word {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1;
}

.brand-en {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--faint);
  margin-left: 1px;
  padding-top: 2px;
}

.compact-form {
  display: none;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 560px;
  height: 42px;
  padding: 0 6px 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

body.searched .compact-form {
  display: flex;
}

.compact-form:focus-within {
  border-color: var(--jade);
  box-shadow: 0 0 0 4px var(--jade-glow);
}

.compact-form .icon {
  color: var(--faint);
}

.compact-form input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13.5px;
}

.compact-form input::placeholder {
  color: var(--faint);
}

.compact-submit {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--jade);
  color: #f8fffc;
  transition: background 0.2s, transform 0.2s;
}

.compact-submit:hover {
  background: var(--jade-2);
  transform: scale(1.05);
}

.compact-submit svg {
  width: 17px;
  height: 17px;
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--ink-2);
  transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.2s;
}

.icon-button:hover {
  border-color: var(--jade);
  color: var(--jade);
  background: var(--surface);
  transform: translateY(-1px);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.icon-sun {
  display: block;
}

.icon-moon {
  display: none;
}

[data-theme="dark"] .icon-sun {
  display: none;
}

[data-theme="dark"] .icon-moon {
  display: block;
}

.about-link {
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--muted);
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.about-link:hover {
  color: var(--jade);
  background: var(--jade-soft);
}

/* ------------------------------------------------------------------- hero */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 118px clamp(20px, 5vw, 48px) 104px;
}

.hero-inner {
  width: 100%;
  max-width: 840px;
  text-align: center;
  animation: hero-in 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.hero-kicker {
  display: flex;
  align-items: center;
  width: max-content;
  gap: 8px;
  margin: 0 auto;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  box-shadow: var(--shadow-sm);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--jade);
  animation: pulse 2.6s ease-out infinite;
}

.hero-title-wrap {
  position: relative;
  display: inline-block;
  margin-top: 18px;
}

.hero-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(5rem, 13vw, 9.2rem);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: 0.08em;
  text-indent: 0.08em;
  background: linear-gradient(130deg, var(--ink) 28%, var(--jade) 120%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-dot {
  color: var(--jade);
  -webkit-text-fill-color: var(--jade);
  font-size: 0.72em;
}

.seal {
  position: absolute;
  top: 6px;
  right: -82px;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 2px solid var(--seal);
  border-radius: 7px;
  color: var(--seal);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.05;
  letter-spacing: 0.08em;
  writing-mode: vertical-rl;
  opacity: 0.82;
  transform: rotate(5deg);
  mix-blend-mode: multiply;
}

[data-theme="dark"] .seal {
  mix-blend-mode: normal;
  opacity: 0.75;
}

.hero-line {
  margin: 20px 0 0;
  font-family: var(--serif);
  font-size: clamp(17px, 2.3vw, 22px);
  letter-spacing: 0.04em;
  color: var(--ink-2);
}

.hero-line em {
  font-style: normal;
  color: var(--jade);
  background-image: linear-gradient(var(--jade-soft), var(--jade-soft));
  background-repeat: no-repeat;
  background-size: 100% 0.36em;
  background-position: 0 88%;
}

.hero-sub {
  margin: 14px auto 0;
  max-width: 460px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.8;
}

.hero-form {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 740px;
  min-height: 74px;
  margin: 34px auto 0;
  padding: 8px 8px 8px 22px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}

.hero-form:focus-within {
  border-color: var(--jade);
  box-shadow: 0 0 0 5px var(--jade-glow), var(--shadow-lg);
  transform: translateY(-1px);
}

.hero-search-icon {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--faint);
}

.hero-form input {
  flex: 1;
  min-width: 0;
  height: 56px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16.5px;
  letter-spacing: 0.01em;
}

.hero-form input::placeholder {
  color: var(--faint);
}

.hero-clear {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--faint);
  transition: color 0.2s, background 0.2s;
}

.hero-clear:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.hero-clear svg {
  width: 17px;
  height: 17px;
}

.hero-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 56px;
  padding: 0 22px;
  flex: none;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(145deg, var(--jade), var(--jade-2));
  color: #f5fffb;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  box-shadow: 0 8px 18px -8px var(--jade);
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}

.hero-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -10px var(--jade);
  filter: brightness(1.05);
}

.hero-submit:active {
  transform: translateY(0);
}

.hero-submit kbd {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 5px;
  padding: 1px 5px;
  line-height: 1.4;
}

.hero-examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.examples-label {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  color: var(--faint);
  margin-right: 2px;
}

.example {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 52%, transparent);
  color: var(--muted);
  font-size: 12px;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s;
}

.example:hover {
  color: var(--jade);
  border-color: var(--jade);
  background: var(--surface);
  transform: translateY(-1px);
}

.recent-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 26px;
  font-size: 12px;
}

.recent-title {
  color: var(--faint);
  letter-spacing: 0.06em;
  font-size: 11px;
}

.recent-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.recent-chip {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 0;
  border-bottom: 1px dashed var(--line-2);
  background: none;
  padding: 2px 0;
  color: var(--muted);
  font-size: 12px;
  transition: color 0.2s, border-color 0.2s;
}

.recent-chip:hover {
  color: var(--jade);
  border-color: var(--jade);
}

.recent-clear {
  border: 0;
  background: none;
  padding: 2px 4px;
  color: var(--faint);
  font-size: 11px;
}

.recent-clear:hover {
  color: var(--danger);
}

.hero-foot {
  position: absolute;
  left: clamp(24px, 5vw, 56px);
  right: clamp(24px, 5vw, 56px);
  bottom: 26px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--faint);
  font-size: 8.5px;
  letter-spacing: 0.32em;
  font-weight: 600;
}

.hero-foot-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

/* ---------------------------------------------------------------- results */

body.searched .hero,
body.searched .hero-foot {
  display: none;
}

body.home .footer {
  display: none;
}

body.home .about-link {
  display: none;
}

.results-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 104px clamp(20px, 4vw, 48px) 72px;
}

.result-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.result-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.03em;
}

.result-kicker #result-count {
  color: var(--jade);
  font-weight: 700;
}

.cache-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 10px;
  letter-spacing: 0.06em;
  vertical-align: 1px;
}

.result-query-line {
  margin: 5px 0 0;
  color: var(--faint);
  font-size: 12.5px;
}

.result-query-line strong {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s;
}

.filter:focus-within,
.filter:hover {
  border-color: var(--line-2);
}

.filter span {
  color: var(--faint);
  font-size: 10.5px;
  letter-spacing: 0.08em;
}

.filter select {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  padding: 0 2px 0 0;
  cursor: pointer;
  max-width: 82px;
}

.notice {
  margin: 16px 0 0;
  padding: 10px 14px;
  border: 1px solid var(--amber-soft);
  border-radius: 10px;
  background: color-mix(in srgb, var(--amber-soft) 55%, var(--surface));
  color: var(--amber);
  font-size: 12.5px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 288px;
  gap: clamp(32px, 4vw, 56px);
  align-items: start;
  margin-top: 26px;
}

.primary {
  min-width: 0;
}

/* ---------------------------------------------------------------- AI card */

.ai-card {
  position: relative;
  overflow: hidden;
  margin-bottom: 30px;
  padding: 22px 24px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(ellipse 70% 130% at 0% 0%, var(--jade-glow), transparent 58%),
    linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface-2) 68%, var(--surface)));
  box-shadow: var(--shadow-md);
}

.ai-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--jade), var(--amber), transparent);
  opacity: 0.7;
}

.ai-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ai-title-group {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.ai-orb {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: none;
  border: 1px solid color-mix(in srgb, var(--jade) 24%, transparent);
  border-radius: 12px;
  background: var(--jade-soft);
  color: var(--jade);
}

.ai-orb svg {
  width: 22px;
  height: 22px;
}

.ai-head h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 7px;
}

.beta {
  padding: 1px 5px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  color: var(--faint);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.5;
}

.ai-sub {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.ai-generate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--jade);
  color: #f5fffb;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 6px 14px -7px var(--jade);
  transition: background 0.2s, transform 0.2s;
}

.ai-generate:hover {
  background: var(--jade-2);
  transform: translateY(-1px);
}

.ai-generate svg {
  width: 15px;
  height: 15px;
}

.ai-stop {
  flex: none;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.ai-stop:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.ai-placeholder {
  margin-top: 16px;
  padding: 16px 0 18px;
  border-top: 1px dashed var(--line);
}

.ai-placeholder p {
  margin: 0;
  max-width: 560px;
  color: var(--faint);
  font-size: 12.5px;
  line-height: 1.8;
}

.ai-output {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: 14.8px;
  line-height: 1.85;
  color: var(--ink-2);
  min-height: 24px;
}

.ai-output .cursor {
  display: inline-block;
  width: 7px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -0.14em;
  background: var(--jade);
  animation: blink 1s steps(2, start) infinite;
}

.ai-error {
  margin: 0.8em 0 0;
  padding: 9px 12px;
  border: 1px solid var(--amber-soft);
  border-radius: 8px;
  background: color-mix(in srgb, var(--amber-soft) 42%, transparent);
  color: var(--amber);
  font-size: 12.5px;
  line-height: 1.7;
}

.ai-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 11px 0 13px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10.5px;
}

#ai-status {
  letter-spacing: 0.04em;
}

#ai-status.working {
  color: var(--jade);
}

.ai-disclaimer {
  text-align: right;
}

/* ------------------------------------------------------------- result list */

.result-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.result-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding: 24px 0 25px;
  border-bottom: 1px solid var(--line);
  animation: rise 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.result-item.flash {
  border-radius: 12px;
  animation: flash 1.5s ease both;
}

.result-index {
  padding-top: 2px;
  font-family: var(--serif);
  font-size: 13px;
  color: var(--faint);
  letter-spacing: 0.04em;
}

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

.result-source {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11.5px;
}

.favicon {
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 5px;
  object-fit: cover;
  background: var(--surface-2);
}

.favicon-fallback {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 5px;
  background: var(--jade-soft);
  color: var(--jade);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.result-site {
  flex: none;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
  font-weight: 600;
}

.result-domain {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--faint);
  font-size: 11px;
}

.result-title {
  display: inline;
  color: var(--ink);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.48;
  letter-spacing: -0.005em;
  background-image: linear-gradient(var(--jade), var(--jade));
  background-repeat: no-repeat;
  background-size: 0 1px;
  background-position: 0 100%;
  transition: color 0.2s, background-size 0.3s;
}

.result-title:hover {
  color: var(--jade-2);
  background-size: 100% 1px;
}

.result-snippet {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13.8px;
  line-height: 1.78;
}

.result-summary {
  margin: 9px 0 0;
  padding: 10px 13px;
  border-left: 2px solid var(--jade);
  border-radius: 0 8px 8px 0;
  background: color-mix(in srgb, var(--surface-2) 68%, transparent);
  color: var(--muted);
  font-size: 12.8px;
  line-height: 1.78;
  animation: fade 0.25s ease both;
}

.result-summary p {
  margin: 0;
}

.result-summary p + p {
  margin-top: 0.7em;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  color: var(--faint);
  font-size: 10.8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 9.8px;
  letter-spacing: 0.04em;
  line-height: 1.7;
}

.badge-authority {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge-quality {
  background: var(--jade-soft);
  color: var(--jade);
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
}

.link-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--faint);
  font-size: 11.5px;
  transition: color 0.2s;
}

.link-action:hover {
  color: var(--jade);
}

.link-action svg {
  width: 13px;
  height: 13px;
}

.link-action[disabled] {
  opacity: 0.55;
  cursor: wait;
}

mark {
  padding: 0 1px;
  border-radius: 3px;
  background: var(--jade-soft);
  color: var(--jade-2);
  font-weight: 600;
}

[data-theme="dark"] mark {
  color: var(--jade-2);
}

.list-end {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 26px;
  padding: 16px;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  color: var(--faint);
  font-size: 11.5px;
}

.list-end button {
  border: 0;
  background: none;
  color: var(--jade);
  font-size: 11.5px;
  padding: 0;
  border-bottom: 1px solid transparent;
}

.list-end button:hover {
  border-bottom-color: var(--jade);
}

/* ----------------------------------------------------------- loading/state */

.loading-list {
  display: block;
}

.skeleton-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}

.sk {
  display: block;
  border-radius: 5px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--surface-2) 70%, transparent) 20%,
    var(--line) 45%,
    color-mix(in srgb, var(--surface-2) 70%, transparent) 70%
  );
  background-size: 220% 100%;
  animation: shimmer 1.5s linear infinite;
}

.sk-index {
  width: 18px;
  height: 12px;
  margin-top: 4px;
}

.sk-title {
  width: 62%;
  height: 20px;
  margin-bottom: 12px;
}

.sk-url {
  width: 34%;
  height: 11px;
  margin-bottom: 14px;
}

.sk-line {
  width: 94%;
  height: 11px;
  margin-bottom: 8px;
}

.sk-line.short {
  width: 68%;
}

.state-card {
  padding: 56px 24px 48px;
  text-align: center;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 50%, transparent);
}

.state-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--faint);
}

.state-icon svg {
  width: 32px;
  height: 32px;
}

.state-card h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.state-card p {
  margin: 8px auto 0;
  max-width: 380px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.state-retry {
  margin-top: 20px;
  padding: 8px 18px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  transition: border-color 0.2s, color 0.2s;
}

.state-retry:hover {
  border-color: var(--jade);
  color: var(--jade);
}

/* --------------------------------------------------------------- sidebar */

.sidebar {
  position: sticky;
  top: 94px;
  display: grid;
  gap: 16px;
}

.side-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 76%, transparent);
}

.side-card h3 {
  margin: 0 0 7px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink-2);
}

.side-desc {
  margin: 0;
  color: var(--muted);
  font-size: 11.8px;
  line-height: 1.75;
}

.syntax-list {
  display: grid;
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.syntax {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 2px;
  border: 0;
  border-bottom: 1px dashed var(--line);
  background: none;
  text-align: left;
  transition: padding 0.2s, color 0.2s;
}

.syntax:hover {
  padding-left: 6px;
}

.syntax code {
  font-family: var(--mono);
  font-size: 10.8px;
  color: var(--jade);
  white-space: nowrap;
}

.syntax span {
  color: var(--faint);
  font-size: 10.5px;
  white-space: nowrap;
}

.side-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.side-stats > div {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.side-stats strong {
  display: block;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--jade);
  line-height: 1.2;
}

.side-stats span {
  color: var(--faint);
  font-size: 9.5px;
}

.side-foot {
  margin: 2px 0 0;
  text-align: center;
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0.22em;
}

/* ----------------------------------------------------------------- footer */

.footer {
  border-top: 1px solid var(--line);
  padding: 26px clamp(20px, 4vw, 48px) 34px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 24px;
}

.footer-brand {
  margin: 0;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--ink-2);
}

.footer-brand span {
  margin-left: 8px;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.24em;
  color: var(--faint);
  font-weight: 600;
}

.footer-copy,
.footer-note {
  margin: 0;
  color: var(--faint);
  font-size: 10.5px;
}

.footer-copy a {
  color: var(--muted);
  border-bottom: 1px solid var(--line-2);
}

.footer-copy a:hover {
  color: var(--jade);
  border-color: var(--jade);
}

/* ----------------------------------------------------------------- reader */

.reader-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(7, 12, 11, 0.48);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade 0.25s ease both;
}

.reader {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 100;
  width: min(780px, 100vw);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -30px 0 80px -30px rgba(0, 0, 0, 0.35);
  transform: translateX(101%);
  transition: transform 0.38s cubic-bezier(0.22, 0.8, 0.24, 1);
  overflow: hidden;
}

.reader.open {
  transform: translateX(0);
}

.reader-progress {
  position: absolute;
  inset: 0 auto auto 0;
  z-index: 4;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--jade), var(--amber));
  transition: width 0.1s linear;
}

.reader-head {
  position: relative;
  z-index: 3;
  flex: none;
  padding: 22px clamp(20px, 4vw, 34px) 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
}

.reader-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reader-label {
  color: var(--jade);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.reader-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reader-head-actions .icon-button {
  width: 32px;
  height: 32px;
}

.reader-head-actions .icon-button svg {
  width: 16px;
  height: 16px;
}

.reader-original {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  transition: border-color 0.2s, color 0.2s;
}

.reader-original:hover {
  border-color: var(--jade);
  color: var(--jade);
}

.reader-original svg {
  width: 13px;
  height: 13px;
}

.reader-head h2 {
  margin: 14px 0 6px;
  font-family: var(--serif);
  font-size: clamp(21px, 2.7vw, 28px);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.reader-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  color: var(--faint);
  font-size: 10.5px;
  min-width: 0;
}

#reader-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.reader-open {
  overflow: hidden;
}

.reader-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px clamp(20px, 4vw, 34px) 90px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

.reader-body::-webkit-scrollbar {
  width: 8px;
}

.reader-body::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 999px;
}

.reader-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 40px 0;
  color: var(--muted);
  font-size: 13px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line-2);
  border-top-color: var(--jade);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.reader-error {
  padding: 22px;
  border: 1px solid var(--amber-soft);
  border-radius: 12px;
  background: color-mix(in srgb, var(--amber-soft) 40%, transparent);
  color: var(--amber);
  font-size: 13px;
  line-height: 1.8;
}

.reader-note {
  margin-top: 2.6em;
  padding-top: 1.2em;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.8;
}

/* ------------------------------------------------------------------ prose */

.prose {
  overflow-wrap: anywhere;
  line-break: strict;
}

.prose > :first-child {
  margin-top: 0;
}

.prose > :last-child {
  margin-bottom: 0;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  margin: 1.6em 0 0.6em;
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.prose h1 {
  font-size: 1.75em;
}

.prose h2 {
  font-size: 1.42em;
}

.prose h3 {
  font-size: 1.18em;
}

.prose h4 {
  font-size: 1.05em;
}

.prose p {
  margin: 0 0 1em;
  text-wrap: pretty;
}

.prose a {
  color: var(--jade);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--jade) 35%, transparent);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}

.prose a:hover {
  text-decoration-color: var(--jade);
}

.prose strong {
  color: var(--ink);
  font-weight: 700;
}

.prose em {
  font-style: italic;
}

.prose ul,
.prose ol {
  margin: 0 0 1em;
  padding-left: 1.35em;
}

.prose li {
  margin: 0.3em 0;
}

.prose li::marker {
  color: var(--jade);
}

.prose blockquote {
  margin: 1.2em 0;
  padding: 10px 16px;
  border-left: 3px solid var(--jade-soft);
  border-radius: 0 8px 8px 0;
  background: var(--surface-2);
  color: var(--muted);
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose code {
  padding: 0.15em 0.4em;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--jade-2);
  font-family: var(--mono);
  font-size: 0.86em;
}

[data-theme="dark"] .prose code {
  color: var(--jade);
}

.prose pre {
  margin: 1.2em 0;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0f1716;
  color: #d7e5df;
  overflow-x: auto;
  line-height: 1.65;
  font-size: 0.86em;
}

.prose pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: inherit;
}

.prose img {
  max-width: 100%;
  height: auto;
  margin: 1em 0;
  border-radius: 10px;
}

.prose hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.prose table {
  width: 100%;
  margin: 1.2em 0;
  border-collapse: collapse;
  font-size: 0.86em;
}

.prose th,
.prose td {
  padding: 7px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--surface-2);
  font-weight: 600;
}

.prose .cite {
  display: inline;
  margin: 0 0.08em;
  padding: 0.05em 0.3em;
  border-radius: 4px;
  background: var(--jade-soft);
  color: var(--jade);
  font-family: var(--sans);
  font-size: 0.7em;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
  vertical-align: 0.12em;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.prose .cite:hover {
  background: var(--jade);
  color: #f5fffb;
}

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 200;
  padding: 9px 18px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.noscript {
  position: fixed;
  inset: auto 20px 20px;
  z-index: 300;
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  text-align: center;
}

/* -------------------------------------------------------------- animations */

@keyframes hero-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 var(--jade-glow);
  }
  70% {
    box-shadow: 0 0 0 7px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

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

@keyframes flash {
  0% {
    background: transparent;
    box-shadow: 0 0 0 0 transparent;
  }
  14% {
    background: color-mix(in srgb, var(--jade-soft) 60%, transparent);
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--jade-soft) 60%, transparent);
  }
  100% {
    background: transparent;
    box-shadow: 0 0 0 0 transparent;
  }
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1080px) {
  .content-grid {
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 32px;
  }
}

@media (max-width: 900px) {
  .content-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar,
  .about-link {
    display: none;
  }
}

@media (max-width: 760px) {
  .topbar {
    height: 64px;
    gap: 12px;
    padding: 0 16px;
  }

  .brand-en {
    display: none;
  }

  .brand-word {
    font-size: 18px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .top-actions {
    gap: 4px;
  }

  .about-link {
    display: none;
  }

  .icon-button {
    width: 34px;
    height: 34px;
  }

  .compact-form {
    height: 38px;
    padding-left: 11px;
  }

  .hero {
    padding: 96px 20px 92px;
  }

  .hero-title {
    font-size: clamp(4.4rem, 19vw, 6.6rem);
  }

  .seal {
    right: -54px;
    width: 38px;
    height: 38px;
    font-size: 11px;
    border-width: 1.5px;
  }

  .hero-line {
    font-size: 16.5px;
  }

  .hero-sub {
    font-size: 12.5px;
    max-width: 340px;
  }

  .hero-form {
    min-height: 64px;
    margin-top: 28px;
    padding: 6px 6px 6px 16px;
    border-radius: 18px;
  }

  .hero-form input {
    height: 50px;
    font-size: 15px;
  }

  .hero-search-icon {
    width: 19px;
    height: 19px;
  }

  .hero-submit {
    height: 50px;
    padding: 0 17px;
    border-radius: 13px;
    font-size: 13.5px;
  }

  .hero-submit kbd {
    display: none;
  }

  .hero-examples {
    gap: 6px;
  }

  .example {
    font-size: 11.5px;
    padding: 5px 10px;
  }

  .hero-foot {
    display: none;
  }

  .results-inner {
    padding: 84px 16px 56px;
  }

  .result-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .filters {
    gap: 6px;
  }

  .filter {
    flex: 1;
    justify-content: center;
    min-width: 0;
    padding: 0 8px;
  }

  .filter select {
    max-width: 72px;
  }

  .ai-card {
    padding: 18px 16px 0;
    border-radius: 18px;
  }

  .ai-head {
    flex-wrap: wrap;
    gap: 12px;
  }

  .ai-sub {
    max-width: 260px;
  }

  .ai-generate {
    height: 32px;
  }

  .ai-foot {
    flex-wrap: wrap;
    gap: 4px 10px;
  }

  .ai-disclaimer {
    text-align: left;
  }

  .result-item {
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 8px;
    padding: 20px 0 22px;
  }

  .result-title {
    font-size: 17.5px;
  }

  .result-snippet {
    font-size: 13.2px;
    -webkit-line-clamp: 4;
  }

  .reader-head {
    padding: 16px 18px 14px;
  }

  .reader-head h2 {
    margin-top: 12px;
    font-size: 21px;
  }

  .reader-body {
    padding: 20px 18px 70px;
    font-size: 15px;
  }

  .footer {
    padding: 22px 16px 28px;
  }

  .footer-inner {
    flex-direction: column;
    gap: 6px;
  }
}

@media (max-width: 480px) {
  .compact-form .icon {
    display: none;
  }

  .compact-form {
    padding-left: 14px;
  }

  .hero {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero-kicker {
    font-size: 10.5px;
    padding: 6px 11px;
  }

  .hero-title {
    font-size: 4.2rem;
  }

  .seal {
    display: none;
  }

  .hero-line {
    font-size: 15px;
    letter-spacing: 0.01em;
  }

  .hero-form {
    padding-left: 13px;
  }

  .hero-submit span {
    display: none;
  }

  .hero-submit {
    width: 50px;
    padding: 0;
  }

  .hero-submit::after {
    content: "→";
    font-size: 19px;
    line-height: 1;
  }

  .examples-label {
    display: none;
  }

  .hero-examples {
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
  }

  .result-query-line strong {
    font-size: 17px;
  }

  .filter select {
    max-width: none;
  }

  .reader-head-actions {
    gap: 4px;
  }

  .reader-original {
    padding: 0 8px;
    font-size: 10px;
  }
}

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