:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --ink: #16202b;
  --muted: #66788a;
  --line: #e4e9ef;
  --accent: #0f7b6c;
  --accent-2: #0b5f54;
  --warn: #b45309;
  --warn-bg: #fff7ed;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  max-width: 1080px;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 14px;
}
.brand b { display: block; font-size: 15px; line-height: 1.2; }
.brand small { color: var(--muted); font-size: 11px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.beta {
  font-size: 11px; font-weight: 700; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 999px; padding: 2px 10px;
}
.ghost-link { color: var(--muted); text-decoration: none; font-size: 13px; }
.ghost-link:hover { color: var(--accent); }

main { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

.hero { padding: 48px 0 24px; text-align: center; }
.hero-kicker span {
  font-size: 12px; font-weight: 700; letter-spacing: .12em; color: var(--accent);
  background: #e8f5f2; border-radius: 999px; padding: 5px 14px;
}
.hero h1 { font-size: 42px; line-height: 1.25; margin: 18px 0 12px; letter-spacing: -.01em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-sub { color: var(--muted); max-width: 640px; margin: 0 auto 28px; font-size: 15px; }

.composer {
  max-width: 720px; margin: 0 auto; background: var(--card);
  border: 1px solid var(--line); border-radius: 18px; padding: 16px;
  box-shadow: var(--shadow);
}
.composer textarea {
  width: 100%; border: none; outline: none; resize: vertical;
  font: inherit; font-size: 15px; min-height: 84px; color: var(--ink);
}
.composer textarea::placeholder { color: #9aa9b8; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.qty { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.qty input {
  width: 72px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 13px; text-align: center;
}
.primary {
  border: none; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font: inherit; font-weight: 600; font-size: 14px;
  padding: 10px 18px; border-radius: 10px; cursor: pointer;
}
.primary:hover { filter: brightness(1.06); }
.primary:disabled { opacity: .55; cursor: wait; }

.examples { margin: 18px auto 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.examples span { color: var(--muted); font-size: 13px; margin-right: 4px; }
.examples button {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.examples button:hover { border-color: var(--accent); color: var(--accent); }

.status {
  max-width: 720px; margin: 28px auto; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow);
}
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.status b { font-size: 14px; }
.status p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.result { padding: 8px 0 40px; display: grid; gap: 16px; }
.demo-banner {
  background: var(--warn-bg); border: 1px solid #fcd9a8; color: var(--warn);
  border-radius: var(--radius); padding: 12px 16px; font-size: 13px;
}
.hint-banner {
  background: #eef6ff; border: 1px solid #cfe4fb; color: #1d4f8a;
  border-radius: var(--radius); padding: 12px 16px; font-size: 13px;
}

.result-head {
  display: flex; justify-content: space-between; gap: 20px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.result-kicker { font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--accent); }
.result-head h2 { margin: 6px 0 6px; font-size: 26px; }
.result-head p { margin: 0; color: var(--muted); font-size: 14px; max-width: 560px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; flex: none; }
.result-actions button, .result-actions a {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-size: 13px; padding: 8px 12px; border-radius: 9px;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.result-actions button:hover, .result-actions a:hover { border-color: var(--accent); color: var(--accent); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.card-head h3 { margin: 0; font-size: 16px; }
.card-head span { color: var(--muted); font-size: 12px; }

.target-line { margin: 0; font-size: 14px; color: var(--ink); }
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.chip {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px;
}
.chip span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
td small { display: block; color: var(--muted); font-size: 12px; }
.num { text-align: right; white-space: nowrap; }
.idx { color: var(--muted); }
.note { color: var(--muted); max-width: 220px; }
.strong { font-weight: 700; color: var(--accent-2); }
tfoot td { border-bottom: none; font-weight: 600; padding-top: 12px; }
.cost-table td:first-child { width: 55%; }
.proto-notes { color: var(--muted); font-size: 13px; margin: 12px 0 0; }

.kv-list { margin: 0; padding-left: 20px; color: var(--ink); font-size: 14px; }
.kv-list li { margin: 6px 0; }
.kv-list.ordered li { margin: 8px 0; }

.error-box {
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  border-radius: var(--radius); padding: 24px; text-align: center;
}
.error-box h3 { margin: 0 0 6px; }
.error-box p { margin: 0 0 16px; font-size: 14px; }

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 0 40px; }
.foot a { color: var(--accent); text-decoration: none; }

.hidden { display: none !important; }

@media (max-width: 640px) {
  .hero h1 { font-size: 30px; }
  .result-head { flex-direction: column; }
  .composer-bar { flex-direction: column; align-items: stretch; }
  .qty { justify-content: space-between; }
  .topbar-right .ghost-link { display: none; }
}
