:root {
  --bg0: #e8f5ef;
  --bg1: #f4fbf7;
  --ink: #163528;
  --muted: #5f7468;
  --card: rgba(255, 255, 255, 0.88);
  --line: rgba(22, 53, 40, 0.08);
  --accent: #1f6b4f;
  --accent-soft: #d8efe4;
  --accent-strong: #14533c;
  --warn: #d97706;
  --danger: #c2410c;
  --ok: #15803d;
  --info: #0369a1;
  --shadow: 0 18px 50px rgba(22, 53, 40, 0.08);
  --radius: 22px;
  /* 不依赖 Google Fonts，避免国内加载卡住 */
  --font: 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --display: 'Songti SC', 'STSong', 'SimSun', 'Noto Serif SC', serif;
}

html[data-theme='claude'] {
  --bg0: #f8ebe2;
  --bg1: #fff7f1;
  --ink: #3b2418;
  --muted: #7a5b4a;
  --card: rgba(255, 255, 255, 0.9);
  --line: rgba(59, 36, 24, 0.08);
  --accent: #a85a36;
  --accent-soft: #f3e0d4;
  --accent-strong: #8a4424;
  --shadow: 0 18px 50px rgba(59, 36, 24, 0.08);
}

html[data-theme='query'] {
  --bg0: #eaf1f8;
  --bg1: #f7fafc;
  --ink: #1e2a36;
  --muted: #607080;
  --accent: #2f6f8f;
  --accent-soft: #d9ebf4;
  --accent-strong: #1f526b;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(255,255,255,.85), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(255,255,255,.55), transparent 50%),
    linear-gradient(180deg, var(--bg0), var(--bg1) 40%, #fff);
  min-height: 100vh;
}

a { color: inherit; }
button, input, textarea { font: inherit; }

.wrap {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #10a37f;
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px rgba(0,0,0,.12);
  flex-shrink: 0;
  overflow: hidden;
}

.brand-mark img {
  width: 26px;
  height: 26px;
  display: block;
}

html[data-theme='gpt'] .brand-mark { background: #10a37f; }
html[data-theme='claude'] .brand-mark { background: #d97757; }
html[data-theme='query'] .brand-mark { background: #2f6f8f; }

.brand-text strong {
  display: block;
  font-size: 1.15rem;
  letter-spacing: .02em;
}
.brand-text span {
  color: var(--muted);
  font-size: .82rem;
}

.nav-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(255,255,255,.55);
  border: 1px solid var(--line);
  padding: 6px;
  border-radius: 999px;
  backdrop-filter: blur(10px);
}

.nav-pills button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: .2s ease;
  font-weight: 600;
}
.nav-pills button.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
}

.hero {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  padding: 28px 28px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
}

.hero h1 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  letter-spacing: -.02em;
  color: var(--accent-strong);
}
.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  max-width: 52ch;
}

.notice {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #eef7ff;
  border: 1px solid #cfe5f8;
  color: #1d4f74;
  font-size: .92rem;
  line-height: 1.5;
}
html[data-theme='claude'] .notice {
  background: #fff3e8;
  border-color: #f0d4bc;
  color: #7a4124;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 18px;
}
.stat {
  background: rgba(255,255,255,.75);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 12px;
  text-align: center;
}
.stat strong {
  display: block;
  font-size: 1.15rem;
  color: var(--accent-strong);
}
.stat span {
  color: var(--muted);
  font-size: .82rem;
}

.grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
  align-items: start;
}
.grid.query-only {
  grid-template-columns: 1fr;
  max-width: 720px;
  margin: 0 auto;
}
.grid [hidden] { display: none !important; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  backdrop-filter: blur(10px);
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

.steps {
  display: grid;
  gap: 14px;
}
.step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
}
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .85rem;
}
.step h3 {
  margin: 0 0 4px;
  font-size: .98rem;
}
.step p {
  margin: 0;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.55;
}
.step .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 600;
  transition: .18s ease;
}
.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 10px 22px rgba(0,0,0,.12);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); }
.btn-ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn-ghost:hover { background: var(--accent-soft); }
.btn-block { width: 100%; padding: 14px 18px; font-size: 1rem; }

.mode-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.mode-tabs button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 600;
}
.mode-tabs button.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: transparent;
}

.sub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.sub-tabs button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: .86rem;
}
.sub-tabs button.active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
.sub-tabs button .count {
  margin-left: 4px;
  opacity: .8;
  font-weight: 500;
}

.product-groups {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}
.product-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: .9rem;
  font-weight: 700;
  color: var(--accent-strong);
}
.product-group-title span {
  color: var(--muted);
  font-weight: 500;
  font-size: .78rem;
}

.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.product {
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 14px 12px;
  cursor: pointer;
  text-align: left;
  transition: .18s ease;
  min-height: 88px;
}
.product:hover { transform: translateY(-1px); }
.product.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.product.disabled {
  opacity: .55;
  cursor: not-allowed;
  filter: grayscale(.2);
}
.product .name {
  font-weight: 700;
  font-size: .92rem;
  margin-bottom: 8px;
  line-height: 1.3;
}
.product .meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  font-size: .78rem;
  color: var(--muted);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e8f8ee;
  color: var(--ok);
  font-weight: 600;
}
.badge.sold {
  background: #fde8e4;
  color: var(--danger);
}
.badge.soon {
  background: #f3e8ff;
  color: #7c3aed;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.hint {
  font-size: .84rem;
  color: var(--muted);
  margin: 0 0 14px;
  line-height: 1.5;
}

.field { margin-bottom: 14px; }
.field label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: .92rem;
}
.field label .req { color: var(--danger); }
.field input,
.field textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--ink);
  outline: none;
  transition: .15s ease;
}
.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { min-height: 150px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
.field .help {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: .82rem;
  line-height: 1.5;
}

.benefits {
  margin: 8px 0 16px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.65);
  border: 1px dashed var(--line);
}
.benefits h4 { margin: 0 0 8px; font-size: .92rem; }
.benefits ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: .88rem; line-height: 1.7; }

.result {
  display: none;
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: .92rem;
  line-height: 1.55;
}
.result.show { display: block; }
.result.ok { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.result.err { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.result.info { border-color: #bae6fd; background: #f0f9ff; color: #075985; }
.result code {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0,0,0,.05);
  font-size: .82rem;
  word-break: break-all;
}

.faq {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}
.faq-item {
  background: rgba(255,255,255,.7);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}
.faq-item strong { display: block; margin-bottom: 4px; }
.faq-item p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }

.query-card .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .88rem;
  background: var(--accent-soft);
  color: var(--accent-strong);
  margin-bottom: 12px;
}
.query-meta {
  display: grid;
  gap: 8px;
}
.query-meta div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: .92rem;
}
.query-meta span { color: var(--muted); }
.query-meta strong { text-align: right; word-break: break-all; }

.footer {
  margin-top: 28px;
  text-align: center;
  color: var(--muted);
  font-size: .82rem;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.35);
  backdrop-filter: blur(2px);
  display: none;
  place-items: center;
  z-index: 50;
}
.loading-overlay.show { display: grid; }
.spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(0,0,0,.08);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.modal[hidden] { display: none !important; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 30, 26, .45);
}
.modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: min(80vh, 720px);
  overflow: auto;
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 18px 18px 16px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.modal-head h3 { margin: 0; font-size: 1.1rem; }
.modal-body {
  color: var(--ink);
  font-size: .92rem;
  line-height: 1.65;
}
.modal-body ol { margin: 0; padding-left: 1.2em; }
.modal-body li { margin: 8px 0; }
.modal-body code {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  word-break: break-all;
}
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: .88rem;
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  z-index: 90;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .topbar { flex-direction: column; align-items: stretch; }
  .nav-pills { justify-content: center; }
}
@media (max-width: 560px) {
  .wrap { width: min(100% - 20px, 1120px); padding-top: 18px; }
  .hero, .panel { padding: 18px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .products { grid-template-columns: 1fr 1fr; }
}
