:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #e3e8f0;
  --accent: #1769ff;
  --accent-strong: #0d55d8;
  --accent-soft: #e8f0ff;
  --danger: #b42318;
  --danger-soft: #fff2f0;
  --shadow: 0 18px 50px rgba(27, 45, 91, 0.09);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 15% 0%, rgba(70, 140, 255, 0.16), transparent 34%),
    radial-gradient(circle at 90% 15%, rgba(112, 224, 205, 0.16), transparent 28%),
    var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family:
    "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.hero {
  max-width: 760px;
  margin: 18px auto 34px;
  text-align: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 22px rgba(23, 105, 255, 0.25);
}

h1 {
  margin: 0;
  font-size: clamp(34px, 7vw, 62px);
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.subtitle {
  max-width: 620px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 17px;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
}

.trust-row span {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  font-size: 12px;
}

.tool-card {
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: calc(var(--radius) + 8px);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  border-radius: 18px;
  background: #eef2f8;
}

.tab {
  min-height: 46px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: 0 4px 16px rgba(30, 50, 90, 0.08);
}

.tab-panel {
  display: none;
  padding: 16px 6px 6px;
}

.tab-panel.active {
  display: block;
}

.search-form {
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f7f9fc;
}

.search-form input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}

.search-form:focus-within {
  border-color: rgba(23, 105, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(23, 105, 255, 0.09);
}

.pill-button,
.primary-button {
  min-height: 48px;
  border-radius: 12px;
  font-weight: 700;
}

.pill-button {
  min-width: 52px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.mode-button {
  min-width: 84px;
}

.mode-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-button {
  padding: 0 22px;
  border: 0;
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.form-hint {
  margin: 10px 4px 2px;
  color: var(--muted);
  font-size: 13px;
}

.status-panel {
  min-height: 64px;
  margin: 26px 0 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  text-align: center;
}

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

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

.results.search-mode {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.result-card {
  overflow: hidden;
  border: 1px solid rgba(225, 231, 241, 0.92);
  border-radius: var(--radius);
  background: var(--surface-solid);
  box-shadow: 0 10px 28px rgba(35, 52, 88, 0.07);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.result-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 38px rgba(35, 52, 88, 0.12);
}

.result-card.historical {
  border-color: rgba(223, 194, 127, 0.7);
  background: linear-gradient(180deg, #fffdf8, var(--surface-solid));
}

.result-section-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 2px 4px;
  color: var(--text);
}

.result-section-heading span {
  color: var(--muted);
  font-size: 12px;
}

.history-badge {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fff2cf;
  color: #8a5a00;
  font-size: 11px;
  font-weight: 700;
}

.cover {
  display: grid;
  width: 100%;
  min-height: 180px;
  place-items: center;
  background:
    linear-gradient(135deg, #e9f0ff, #f3f7ff 48%, #e7faf6);
  color: #9aa8bf;
}

.cover img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.result-card[data-type="theme"] .cover img {
  aspect-ratio: 9 / 16;
}

.card-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.card-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  min-height: 22px;
  color: var(--muted);
  font-size: 12px;
}

.download-button,
.copy-button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.download-button:hover,
.copy-button:hover {
  background: #dce9ff;
}

.parse-result {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr;
  gap: 24px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}

.parse-result .cover {
  overflow: hidden;
  border-radius: 16px;
}

.parse-details h2 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.3;
}

.parse-facts {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px 12px;
  margin: 16px 0;
  font-size: 14px;
}

.parse-facts dt {
  color: var(--muted);
}

.parse-facts dd {
  margin: 0;
  word-break: break-all;
}

.parse-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.parse-actions > * {
  width: auto;
  min-width: 150px;
  padding-inline: 18px;
}

.skeleton {
  min-height: 310px;
  border-radius: var(--radius);
  background:
    linear-gradient(
      100deg,
      #edf1f7 20%,
      #f8fafc 38%,
      #edf1f7 56%
    );
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}

.sentinel {
  height: 1px;
}

footer {
  max-width: 820px;
  margin: 46px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

footer p {
  margin: 5px 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes shimmer {
  to {
    background-position-x: -200%;
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 18px;
  }

  .hero {
    margin-top: 4px;
  }

  .trust-row {
    display: none;
  }

  .tool-card {
    padding: 7px;
    border-radius: 22px;
  }

  .search-form {
    flex-wrap: wrap;
  }

  .search-form input {
    order: -1;
    flex-basis: 100%;
  }

  .pill-button,
  .primary-button {
    flex: 1;
  }

  .results.search-mode {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .result-card {
    border-radius: 16px;
  }

  .cover {
    min-height: 130px;
  }

  .card-body {
    padding: 12px;
  }

  .card-title {
    font-size: 14px;
  }

  .parse-result {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .results.search-mode {
    grid-template-columns: 1fr;
  }
}

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

