:root {
  --bg: #0e0f12;
  --surface: #16181d;
  --surface-2: #1c1f26;
  --line: #2a2d35;
  --text: #e9e7e2;
  --muted: #8c909b;
  --accent: #ff6b3d;
  --ok: #3ddc97;
  --warn: #ffc857;
  --risk: #ff4d5e;
  --radius: 14px;
  --font: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 50% -20%, #1d2028 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.65;
  letter-spacing: 0.01em;
  padding-bottom: env(safe-area-inset-bottom);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px calc(14px + env(safe-area-inset-top)) ;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: rgba(14, 15, 18, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { color: var(--accent); font-size: 18px; }
.brand h1 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: 0.08em; }

.stage { max-width: 720px; margin: 0 auto; padding: 20px 16px 64px; }

.lede { color: var(--muted); font-size: 15px; margin: 4px 0 20px; }
.lede strong { color: var(--text); font-weight: 600; }

.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.label { font-size: 13px; color: var(--muted); letter-spacing: 0.06em; }
.hint { font-size: 12px; color: var(--muted); }

input, textarea {
  width: 100%;
  background: #101216;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  padding: 12px 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 61, 0.16);
}
textarea { resize: vertical; min-height: 96px; }

button { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid transparent; }

.primary {
  background: var(--accent);
  color: #16100d;
  font-weight: 600;
  padding: 14px 18px;
  letter-spacing: 0.04em;
}
.primary:disabled { opacity: 0.45; cursor: not-allowed; }

.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
  padding: 12px 16px;
}
.ghost:hover { border-color: var(--muted); }

.icon-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 7px 12px;
  font-size: 13px;
}
.icon-btn:hover { color: var(--text); }

.error { color: var(--risk); font-size: 13px; margin: 0; min-height: 18px; }

.warn-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 13px; color: var(--warn);
  background: rgba(255, 200, 87, 0.08);
  border: 1px solid rgba(255, 200, 87, 0.3);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 16px;
}

.link-btn {
  background: none; border: 0; padding: 0;
  color: var(--accent); font-size: 13px; text-decoration: underline;
}

.kb-row { display: flex; gap: 8px; flex-wrap: wrap; }
.small { padding: 8px 12px; font-size: 13px; }

/* 运行态 */
.running { text-align: center; padding: 40px 20px; }
.run-label { font-size: 17px; margin: 18px 0 12px; font-weight: 600; }
.progress { height: 3px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 10px; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.5s ease; }

.radar {
  width: 54px; height: 54px; margin: 0 auto;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 结果 */
.result-head { margin-bottom: 18px; }
.result-head .kicker { color: var(--accent); font-size: 12px; letter-spacing: 0.18em; }
.result-head h2 { margin: 6px 0 2px; font-size: 24px; line-height: 1.25; }
.result-head .sub { color: var(--muted); font-size: 14px; }

.score { display: flex; align-items: baseline; gap: 8px; margin-top: 14px; }
.score-num { font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.score-unit { color: var(--muted); font-size: 13px; }

.section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--muted);
  letter-spacing: 0.14em; margin: 26px 0 12px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: 11px; letter-spacing: 0.06em; border: 1px solid currentColor;
}
.badge-strong { color: var(--ok); }
.badge-mid { color: var(--warn); }
.badge-weak { color: var(--accent); }
.badge-gap { color: var(--risk); }
.badge-risk-high { color: var(--risk); }
.badge-risk-mid { color: var(--warn); }
.badge-risk-low { color: var(--muted); }

.match { border-left: 2px solid var(--line); padding: 4px 0 14px 14px; margin-bottom: 10px; }
.match-duty { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.match-line { color: var(--muted); font-size: 13px; margin: 2px 0; }
.match-say { margin-top: 8px; font-size: 14px; color: var(--text); background: #101216; border-radius: 10px; padding: 10px 12px; }

.risk-item { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.risk-item:last-child { border-bottom: 0; }
.risk-text { font-size: 14px; margin-bottom: 6px; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sources a, .sources span {
  font-size: 11px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 6px; padding: 3px 7px; text-decoration: none;
}
.sources a:hover { color: var(--accent); border-color: var(--accent); }

.q { border-top: 1px solid var(--line); padding: 16px 0; }
.q:first-of-type { border-top: 0; }
.q-cat { font-size: 11px; color: var(--accent); letter-spacing: 0.12em; }
.q-text { font-size: 16px; font-weight: 600; margin: 4px 0 10px; }
.q-conclusion { font-size: 15px; color: var(--text); background: #101216; border-left: 2px solid var(--accent); padding: 8px 12px; border-radius: 0 8px 8px 0; }
.q-points { margin: 10px 0 0; padding-left: 18px; font-size: 14px; color: var(--muted); }
.q-points li { margin-bottom: 6px; }
.q-points b { color: var(--text); font-weight: 600; }
.q-close { margin-top: 10px; font-size: 13px; color: var(--ok); }
.q-flag { margin-top: 8px; font-size: 12px; color: var(--warn); }

.askback { padding-left: 18px; margin: 0; }
.askback li { font-size: 14px; color: var(--muted); margin-bottom: 6px; }

.mt { margin-top: 14px; }

.actions { display: flex; gap: 10px; margin-top: 24px; }
.actions button { flex: 1; }

.dialog {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 22px;
  width: min(92vw, 420px);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); }
.dialog h2 { margin: 0 0 16px; font-size: 17px; }
.dialog .field { margin-bottom: 16px; }
.dialog-actions { display: flex; gap: 10px; }
.dialog-actions button { flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); padding: 10px 16px; border-radius: 10px; font-size: 13px;
  z-index: 50; max-width: 86vw;
}

.empty { color: var(--muted); font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  .radar { animation: none; }
  .progress-bar { transition: none; }
}
