:root {
  color-scheme: light;
  --bg: #f3f7f6;
  --surface: #ffffff;
  --surface-soft: #f8faf8;
  --ink: #14201f;
  --muted: #62706d;
  --faint: #899591;
  --line: #dce5e1;
  --line-strong: #c3d2cc;
  --primary: #0c6b5b;
  --primary-strong: #084f45;
  --primary-soft: #e5f1ee;
  --accent: #ad6a2b;
  --plum: #59405d;
  --danger: #9a3a2c;
  --danger-soft: #fff0ec;
  --shadow-sm: 0 8px 24px rgba(20, 32, 31, 0.07);
  --shadow-md: 0 22px 60px rgba(20, 32, 31, 0.11);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(12, 107, 91, 0.08), transparent 34%),
    linear-gradient(180deg, #f7faf9 0%, var(--bg) 48%, #eef3f2 100%);
  font-family:
    "Noto Sans SC",
    "Microsoft YaHei",
    "PingFang SC",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.page-frame {
  min-height: 100vh;
  background-image:
    linear-gradient(rgba(20, 32, 31, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 32, 31, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
}

.topbar {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--plum));
  box-shadow: var(--shadow-sm);
}

.status-chip,
.method-pill,
#status {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 8px 11px;
  white-space: nowrap;
}

.shell {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  gap: 36px;
  align-items: center;
  min-height: 520px;
}

.hero-copy {
  padding: 28px 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 720px;
  font-size: clamp(44px, 5.4vw, 78px);
  line-height: 0.98;
  font-weight: 900;
  letter-spacing: 0;
}

.title-line {
  display: block;
}

.lead {
  max-width: 680px;
  margin-top: 24px;
  color: #42504d;
  font-size: clamp(17px, 1.6vw, 21px);
  line-height: 1.8;
  text-wrap: pretty;
}

.search-card {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-md);
  padding: 22px;
}

.card-heading,
.section-header,
.block-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.card-heading {
  margin-bottom: 18px;
}

h2 {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: 0;
}

.card-heading p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.search-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

input[type="search"],
input[type="text"],
input[type="number"] {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfb;
  color: var(--ink);
  outline: none;
  padding: 0 13px;
  font-size: 15px;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

input::placeholder {
  color: #9ba6a2;
}

input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(12, 107, 91, 0.13);
}

.form-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 2px;
}

.toggle-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  user-select: none;
}

.toggle-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  width: 42px;
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #edf2f0;
  position: relative;
  transition:
    background 0.18s ease,
    border-color 0.18s ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(20, 32, 31, 0.2);
  transition: transform 0.18s ease;
}

.toggle-field input:checked + .toggle-track {
  border-color: var(--primary);
  background: var(--primary);
}

.toggle-field input:checked + .toggle-track::after {
  transform: translateX(18px);
}

.search-button {
  min-width: 148px;
  height: 48px;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(12, 107, 91, 0.22);
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.search-button:hover {
  background: var(--primary-strong);
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(12, 107, 91, 0.28);
}

.search-button:active {
  transform: translateY(0);
}

.search-button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.search-icon {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 50%;
  position: relative;
}

.search-icon::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  right: -6px;
  bottom: -3px;
  background: currentColor;
  transform: rotate(45deg);
  border-radius: 2px;
}

.sample-queries {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.sample-queries button,
.copy-button {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--primary-strong);
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  padding: 8px 10px;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

.sample-queries button:hover,
.copy-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 22px;
  align-items: start;
  margin-top: 28px;
}

.results-panel {
  min-height: 360px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.section-header {
  align-items: center;
  margin-bottom: 16px;
}

.section-header-compact {
  margin-bottom: 14px;
}

.section-header .eyebrow {
  margin-bottom: 6px;
}

#status {
  color: var(--muted);
  background: #fff;
}

.results {
  display: grid;
  gap: 12px;
}

.empty-state,
.error,
.loading-card,
.paper-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.empty-state,
.error {
  min-height: 170px;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
  font-size: 18px;
}

.error {
  border-color: #e7b7ac;
  color: var(--danger);
  background: var(--danger-soft);
}

.paper-card {
  padding: 18px;
  box-shadow: 0 7px 18px rgba(20, 32, 31, 0.045);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.paper-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.paper-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.paper-index,
.paper-chip {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  padding: 7px 9px;
}

.paper-index {
  color: #fff;
  background: var(--plum);
}

.paper-chip {
  color: var(--primary-strong);
  background: var(--primary-soft);
  border: 1px solid #cfe2dc;
}

.paper-title {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.42;
  font-weight: 900;
  letter-spacing: 0;
  text-wrap: pretty;
}

.paper-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.paper-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.paper-meta .meta-full {
  grid-column: 1 / -1;
}

.abstract {
  margin-top: 12px;
  color: #384541;
  line-height: 1.78;
  font-size: 14px;
  text-wrap: pretty;
}

.keyword {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}

.keyword span {
  border: 1px solid rgba(173, 106, 43, 0.24);
  border-radius: 999px;
  background: #fffaf3;
  color: #7b4b20;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 8px;
}

.api-panel {
  position: sticky;
  top: 18px;
}

.endpoint-block,
.prompt-box {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-sm);
  padding: 15px;
}

.block-title {
  align-items: center;
  margin-bottom: 10px;
}

.block-title strong {
  font-size: 14px;
  font-weight: 900;
}

.endpoint-block code {
  display: block;
  color: var(--primary-strong);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  padding: 11px;
}

.endpoint-block p {
  margin-top: 9px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.prompt-box {
  background: #162120;
  border-color: #223836;
  color: #f4faf8;
}

.prompt-box .block-title strong {
  color: #fff;
}

.copy-button-dark {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #d8f0e9;
}

.copy-button-dark:hover {
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.14);
}

.prompt-box pre {
  max-height: 360px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
}

.prompt-box code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.68;
}

.loading-card {
  height: 132px;
  overflow: hidden;
  padding: 18px;
}

.loading-line {
  height: 13px;
  border-radius: 999px;
  background: linear-gradient(90deg, #edf3f1 0%, #f9fbfa 48%, #edf3f1 100%);
  background-size: 220% 100%;
  animation: shimmer 1.1s linear infinite;
}

.loading-line + .loading-line {
  margin-top: 14px;
}

.loading-line.short {
  width: 38%;
}

.loading-line.mid {
  width: 66%;
}

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

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

@media (max-width: 1040px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .api-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .topbar,
  .shell {
    width: min(100% - 28px, 1220px);
  }

  .topbar {
    padding-top: 16px;
  }

  .shell {
    padding-top: 12px;
  }

  .hero-copy {
    padding: 12px 0 6px;
  }

  .card-heading,
  .section-header,
  .form-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .method-pill,
  #status {
    width: fit-content;
  }

  .search-card,
  .results-panel {
    padding: 16px;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .field-wide,
  .form-footer {
    grid-column: auto;
  }

  .search-button {
    width: 100%;
  }

  .paper-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 40px;
  }

  .lead {
    font-size: 16px;
  }
}
