/* ==========================================================================
   贷镜 LoanLens — 设计系统
   干净的金融工具界面：细线、克制留白、大数字、少量蓝紫强调色
   ========================================================================== */

:root {
  --bg: #f6f7fa;
  --surface: #ffffff;
  --surface-2: #fbfcfe;
  --ink: #0b1322;
  --ink-2: #3d4659;
  --ink-3: #7c8598;
  --ink-4: #a2aab9;
  --line: #e7eaf1;
  --line-strong: #d9dee9;

  --brand: #2f5bff;
  --brand-2: #7a4dff;
  --brand-soft: #eef2ff;
  --brand-ink: #1b3ed8;

  --good: #0e9f6e;
  --warn: #c47b12;
  --bad: #dd3540;
  --info: #7c8598;

  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --shadow-sm: 0 1px 2px rgba(11, 19, 34, 0.045);
  --shadow-md: 0 1px 2px rgba(11, 19, 34, 0.04), 0 16px 40px -20px rgba(11, 19, 34, 0.22);
  --shadow-lift: 0 2px 4px rgba(11, 19, 34, 0.05), 0 22px 48px -20px rgba(11, 19, 34, 0.26);

  --ease: cubic-bezier(0.22, 0.7, 0.3, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::after {
  /* 极淡的网格，给大片留白一点结构感 */
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(to right, rgba(11, 19, 34, 0.028) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(11, 19, 34, 0.028) 1px, transparent 1px);
  background-size: 88px 88px;
  mask-image: radial-gradient(1000px 500px at 50% 0%, #000 0%, transparent 75%);
}

.aurora {
  position: fixed;
  inset: -20% -10% auto;
  height: 720px;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(720px 340px at 50% 0%, rgba(47, 91, 255, 0.12), transparent 68%),
    radial-gradient(520px 280px at 82% 6%, rgba(122, 77, 255, 0.1), transparent 70%),
    radial-gradient(420px 240px at 12% 10%, rgba(14, 159, 110, 0.07), transparent 70%);
  filter: blur(6px);
}

.wrap {
  position: relative;
  z-index: 1;
  width: min(1300px, 100%);
  margin: 0 auto;
  padding: 0 32px;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

p {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}

button:disabled {
  cursor: not-allowed;
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #fff;
  font-family: var(--font);
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   顶栏
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid transparent;
  background: rgba(246, 247, 250, 0.72);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.topbar.stuck {
  border-bottom-color: var(--line);
  background: rgba(246, 247, 250, 0.88);
  box-shadow: 0 8px 24px -20px rgba(11, 19, 34, 0.5);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(150deg, #3b63ff, #2243d6);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 6px 14px -6px rgba(47, 91, 255, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-text b {
  font-size: 16px;
  letter-spacing: 0.02em;
}

.brand-text em {
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  color: var(--ink-4);
  font-weight: 600;
}

.pill-privacy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: 0.01em;
}

.pill-privacy svg {
  width: 14px;
  height: 14px;
  color: var(--good);
}

.pill-short {
  display: none;
}

.protocol-tip {
  padding: 12px 20px;
  background: #fff4e5;
  border-bottom: 1px solid #f0d9b5;
  color: #8a5407;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.protocol-tip code {
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(138, 84, 7, 0.1);
  font-family: ui-monospace, Consolas, monospace;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  padding: 76px 0 34px;
  max-width: 820px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--brand-ink);
  text-transform: uppercase;
}

.eyebrow i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(47, 91, 255, 0.12);
}

.hero h1 {
  margin: 18px 0 0;
  font-size: clamp(34px, 5vw, 56px);
  letter-spacing: -0.035em;
  line-height: 1.06;
}

.hero h1 .mark {
  position: relative;
  white-space: nowrap;
  background: linear-gradient(100deg, #1e3fca 8%, #6a35e8 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  margin-top: 20px;
  max-width: 660px;
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink-2);
}

.lede b {
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 -0.55em 0 rgba(47, 91, 255, 0.1);
}

/* --------------------------------------------------------------------------
   输入区
   -------------------------------------------------------------------------- */

.composer {
  position: relative;
  z-index: 2;
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}

.composer:focus-within {
  border-color: rgba(47, 91, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(47, 91, 255, 0.1), var(--shadow-lift);
}

.composer-field {
  padding: 4px;
}

#input {
  display: block;
  width: 100%;
  min-height: 132px;
  padding: 20px 22px;
  border: 0;
  border-radius: var(--radius-xl);
  background: transparent;
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.75;
  resize: vertical;
  outline: none;
}

#input::placeholder {
  color: var(--ink-4);
}

.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 16px 14px 20px;
  border-top: 1px solid var(--line);
}

.examples {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.examples-label {
  margin-right: 2px;
  font-size: 12px;
  color: var(--ink-4);
  letter-spacing: 0.06em;
}

.chip {
  height: 32px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease),
    transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.chip:hover {
  border-color: rgba(47, 91, 255, 0.4);
  color: var(--brand-ink);
  background: var(--brand-soft);
  transform: translateY(-1px);
}

.chip:active {
  transform: translateY(0) scale(0.98);
}

.chip.flash {
  animation: chipFlash 0.7s var(--ease);
}

@keyframes chipFlash {
  0% {
    background: rgba(47, 91, 255, 0.16);
    border-color: rgba(47, 91, 255, 0.5);
  }
  100% {
    background: #fff;
    border-color: var(--line);
  }
}

.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #3b64ff, #2b4de3);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 10px 22px -12px rgba(43, 77, 227, 0.9);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), filter 0.2s var(--ease);
}

.btn-primary svg {
  width: 18px;
  height: 18px;
  transition: transform 0.25s var(--ease);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 16px 30px -14px rgba(43, 77, 227, 1);
}

.btn-primary:hover:not(:disabled) svg {
  transform: translateX(3px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0) scale(0.985);
}

.btn-primary:disabled {
  opacity: 0.45;
  filter: saturate(0.6);
  box-shadow: none;
}

.btn-primary.loading {
  pointer-events: none;
  padding-left: 46px;
}

.btn-primary.loading::after {
  content: "";
  position: absolute;
  left: 20px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.composer-foot {
  padding: 0 22px 14px;
  font-size: 12px;
  color: var(--ink-4);
}

.composer-foot.alert {
  color: var(--bad);
}

/* --------------------------------------------------------------------------
   使用说明
   -------------------------------------------------------------------------- */

.howto {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 30px 0 10px;
}

.howto-item {
  position: relative;
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.62);
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease);
}

.howto-item:hover {
  border-color: var(--line-strong);
  background: #fff;
  transform: translateY(-2px);
}

.howto-no {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-4);
}

.howto-item h3 {
  margin: 10px 0 6px;
  font-size: 15.5px;
  letter-spacing: -0.01em;
}

.howto-item p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-3);
}

/* --------------------------------------------------------------------------
   结果区
   -------------------------------------------------------------------------- */

.result {
  margin-top: 34px;
  padding-bottom: 20px;
}

.result[hidden] {
  display: none;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: 19px;
  letter-spacing: -0.02em;
}

.section-head .sub {
  font-size: 12.5px;
  color: var(--ink-3);
}

/* --------------------------------------------------------------------------
   话术风险扫描
   -------------------------------------------------------------------------- */

.scan {
  padding: 22px 24px 20px;
  border: 1px solid #f3ddd9;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #fff9f8 0%, #ffffff 42%);
  box-shadow: var(--shadow-sm);
  animation: riseIn 0.45s var(--ease) both;
}

.scan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.scan-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.scan-title svg {
  width: 17px;
  height: 17px;
  flex: none;
  color: #d92d20;
}

.scan-title > span {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--ink-3);
}

.scan-badge {
  font-size: 12px;
  font-weight: 650;
  padding: 5px 11px;
  border-radius: 999px;
  white-space: nowrap;
}

.scan-badge.high {
  color: #b42318;
  background: #fee4e2;
  border: 1px solid #fecdca;
}

.scan-badge.mid {
  color: #b54708;
  background: #fef0c7;
  border: 1px solid #fedf89;
}

.scan-quote {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid #f4e6e3;
  background: #fffdfc;
  font-size: 15px;
  line-height: 2;
  color: var(--ink-2);
  word-break: break-word;
}

.kw {
  font-style: normal;
  font-weight: 650;
  padding: 1px 5px;
  border-radius: 5px;
  cursor: help;
  transition: filter 0.15s var(--ease);
}

.kw:hover {
  filter: brightness(0.94);
}

.kw.high {
  color: #b42318;
  background: #fee4e2;
  box-shadow: inset 0 -1px 0 #fda29b;
}

.kw.mid {
  color: #b54708;
  background: #fef0c7;
  box-shadow: inset 0 -1px 0 #fdb022;
}

.kw.info {
  color: #475467;
  background: #f2f4f7;
  box-shadow: inset 0 -1px 0 #d0d5dd;
}

.scan-groups {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.scan-group {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.scan-group.high {
  border-left-color: var(--bad);
}

.scan-group.mid {
  border-left-color: var(--warn);
}

.scan-group.info {
  border-left-color: var(--ink-4);
}

.scan-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.scan-group-name {
  font-size: 13.5px;
  font-weight: 660;
  color: var(--ink);
}

.scan-level {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.scan-group.high .scan-level {
  color: #b42318;
  background: #fee4e2;
}

.scan-group.mid .scan-level {
  color: #b54708;
  background: #fef0c7;
}

.scan-group.info .scan-level {
  color: #475467;
  background: #f2f4f7;
}

.scan-group-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 9px;
}

.scan-group-words b {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.scan-group-why {
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.scan-group-advice {
  font-size: 13px;
  line-height: 1.75;
  color: var(--brand-ink);
  padding-left: 10px;
  border-left: 2px solid #dfe6ff;
}

.scan-disclaimer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  line-height: 1.8;
  color: var(--ink-3);
}

.scan-disclaimer b {
  color: var(--ink-2);
}

.scan-clean {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-3);
}

.scan-clean svg {
  width: 15px;
  height: 15px;
  flex: none;
  margin-top: 2px;
  color: var(--ink-4);
}

/* 解析回读：一句话 + 字段 chips */
.readback {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.readback-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.readback-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
}

.readback-title span {
  font-weight: 400;
  font-size: 12.5px;
  color: var(--ink-3);
}

.field-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.field-chip {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
  animation: riseIn 0.45s var(--ease) both;
}

.field-chip:hover {
  border-color: rgba(47, 91, 255, 0.35);
  background: #fff;
}

.field-chip .k {
  font-size: 11.5px;
  color: var(--ink-4);
}

.field-chip .v {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.field-chip .q {
  font-size: 11px;
  color: var(--ink-4);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-chip .conf {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--good);
}

.field-chip.low .conf {
  background: var(--warn);
}

.field-chip .note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 13px;
  height: 13px;
  margin-left: 1px;
  border: 1px solid #c8d2e4;
  border-radius: 50%;
  color: #8e99ad;
  font-size: 9px;
  font-style: normal;
  line-height: 1;
  cursor: help;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.field-chip .note:hover {
  color: var(--brand);
  border-color: rgba(47, 91, 255, 0.45);
}

.field-note-inline {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.field-note-inline svg {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--warn);
}

/* 双栏 */
.dash {
  display: grid;
  grid-template-columns: 336px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin-top: 22px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* 参数面板 */
.params {
  position: sticky;
  top: 84px;
  padding: 20px;
}

.params h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14.5px;
  margin-bottom: 4px;
}

.params h2 em {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-4);
}

.params-sub {
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--ink-4);
  line-height: 1.6;
}

.fields {
  display: grid;
  gap: 13px;
}

.field {
  display: grid;
  gap: 6px;
}

.field > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-3);
}

.field > span b {
  font-weight: 500;
  color: var(--ink-4);
}

.field input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}

.field input:hover {
  border-color: var(--line-strong);
}

.field input:focus {
  border-color: rgba(47, 91, 255, 0.5);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 91, 255, 0.1);
}

.field-hint {
  font-size: 11px;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}

/* 方式切换 */
.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.segmented button {
  height: 34px;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 12.5px;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.segmented button:hover {
  color: var(--ink);
  background: rgba(47, 91, 255, 0.06);
}

.segmented button[aria-pressed="true"] {
  background: #fff;
  color: var(--brand-ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(11, 19, 34, 0.08), 0 0 0 1px rgba(47, 91, 255, 0.18);
}

.fees-block {
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px dashed var(--line);
}

.fees-block > span {
  display: block;
  margin-bottom: 9px;
  font-size: 12px;
  color: var(--ink-3);
}

.fee-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 6px 6px 0;
  padding: 5px 8px 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 12px;
}

.fee-tag b {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.fee-tag i {
  font-style: normal;
  font-size: 10.5px;
  color: var(--ink-4);
}

.fee-tag button {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  color: var(--ink-4);
  font-size: 13px;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}

.fee-tag button:hover {
  background: rgba(221, 53, 64, 0.1);
  color: var(--bad);
}

/* 指标 */
.stack {
  display: grid;
  gap: 22px;
}

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

.metric {
  position: relative;
  overflow: hidden;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
  animation: riseIn 0.5s var(--ease) both;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}

.metric:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.metric:hover::before {
  opacity: 1;
}

.metric-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}

.metric-label svg {
  width: 13px;
  height: 13px;
  color: var(--ink-4);
}

.metric-value {
  margin-top: 10px;
  font-size: clamp(23px, 2.4vw, 31px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.metric-value small {
  margin-left: 2px;
  font-size: 0.5em;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink-3);
}

.metric-note {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--ink-3);
  min-height: 16px;
}

.metric.feature {
  border-color: transparent;
  background: radial-gradient(120% 140% at 100% 0%, rgba(122, 77, 255, 0.35), transparent 55%),
    linear-gradient(155deg, #131e39 0%, #0d1528 70%);
  color: #fff;
  box-shadow: 0 18px 40px -24px rgba(13, 21, 40, 0.9);
}

.metric.feature .metric-label,
.metric.feature .metric-note,
.metric.feature .metric-value small {
  color: rgba(255, 255, 255, 0.62);
}

.metric.feature::before {
  background: linear-gradient(90deg, #6f8cff, #b58cff);
  opacity: 1;
}

.metric.feature:hover {
  box-shadow: 0 24px 48px -22px rgba(13, 21, 40, 1);
}

.metric.feature .metric-value {
  color: #fff;
}

.tag-mini {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.tag-mini.good {
  background: rgba(14, 159, 110, 0.1);
  color: #0b7a55;
}

.tag-mini.warn {
  background: rgba(196, 123, 18, 0.12);
  color: #9a5f0d;
}

.tag-mini.bad {
  background: rgba(221, 53, 64, 0.1);
  color: #b8242e;
}

.tag-mini.neutral {
  background: rgba(124, 133, 152, 0.12);
  color: var(--ink-3);
}

.metric.feature .tag-mini {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.9);
}

/* 图表并排：环形图窄、柱状图宽 */
.split {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.68fr);
  gap: 22px;
  align-items: start;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 20px 0;
}

.card-head h2 {
  font-size: 15px;
  letter-spacing: -0.01em;
}

.card-head .sub {
  font-size: 11.5px;
  color: var(--ink-4);
}

.chart-body {
  padding: 8px 20px 20px;
}

.chart-frame {
  position: relative;
}

.chart-hint {
  margin: 10px 20px 0;
  padding: 8px 12px;
  border-radius: 9px;
  background: rgba(196, 123, 18, 0.08);
  border: 1px solid rgba(196, 123, 18, 0.2);
  font-size: 12px;
  color: #8a5407;
  line-height: 1.55;
}

.chart-hint b {
  font-variant-numeric: tabular-nums;
}

.chart-hint[hidden] {
  display: none;
}

.chart-frame svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink-3);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
}

.legend i.line {
  width: 15px;
  height: 2px;
  border-radius: 1px;
}

.tooltip {
  position: absolute;
  z-index: 30;
  min-width: 132px;
  padding: 9px 11px;
  border: 1px solid rgba(11, 19, 34, 0.08);
  border-radius: 10px;
  background: rgba(13, 21, 40, 0.94);
  color: #fff;
  font-size: 11.5px;
  line-height: 1.65;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -110%) scale(0.96);
  transition: opacity 0.14s var(--ease), transform 0.14s var(--ease);
  box-shadow: 0 12px 28px -12px rgba(0, 0, 0, 0.6);
}

.tooltip.show {
  opacity: 1;
  transform: translate(-50%, -110%) scale(1);
}

.tooltip b {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
}

.tooltip .row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: rgba(255, 255, 255, 0.72);
}

.tooltip .row em {
  font-style: normal;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

/* 环形图中心 */
.donut-center text:first-child {
  font-size: 12px;
  fill: var(--ink-3);
}

/* 诊断列表 */
.diags {
  display: grid;
  gap: 9px;
  padding: 14px 18px 18px;
}

.diag {
  position: relative;
  padding: 12px 14px 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
  animation: riseIn 0.4s var(--ease) both;
}

.diag::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 13px;
  bottom: 13px;
  width: 3px;
  border-radius: 3px;
  background: var(--sev, var(--info));
}

.diag:hover {
  background: #fff;
  border-color: var(--line-strong);
}

.diag.red {
  --sev: var(--bad);
}
.diag.yellow {
  --sev: var(--warn);
}
.diag.green {
  --sev: var(--good);
}
.diag.info {
  --sev: var(--info);
}

.diag-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.diag-title {
  flex: 1;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.diag-sev {
  margin-left: 6px;
  margin-top: 1px;
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(124, 133, 152, 0.12);
  color: var(--ink-3);
}

.diag.red .diag-sev {
  background: rgba(221, 53, 64, 0.1);
  color: #b8242e;
}
.diag.yellow .diag-sev {
  background: rgba(196, 123, 18, 0.12);
  color: #9a5f0d;
}
.diag.green .diag-sev {
  background: rgba(14, 159, 110, 0.1);
  color: #0b7a55;
}

.diag-detail {
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.68;
  color: var(--ink-2);
}

.diag-advice {
  margin-top: 7px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--brand-ink);
}

.diag-advice::before {
  content: "→ ";
  opacity: 0.7;
}

.diag-basis {
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-4);
}

.diag-basis::before {
  content: "依据 · ";
  letter-spacing: 0.04em;
}

/* 体检结论：主视觉区块 */
.verdict-card {
  position: relative;
  overflow: hidden;
  --vc: var(--ink-4);
  --vc-soft: #f6f7fa;
  --vc-ink: var(--ink-2);
}

.verdict-card[data-level="red"] {
  --vc: var(--bad);
  --vc-soft: #fff5f4;
  --vc-ink: #b42318;
  border-color: #f7d8d6;
}

.verdict-card[data-level="yellow"] {
  --vc: var(--warn);
  --vc-soft: #fffaef;
  --vc-ink: #b54708;
  border-color: #f5e4c4;
}

.verdict-card[data-level="green"] {
  --vc: var(--good);
  --vc-soft: #f3fdf8;
  --vc-ink: #067647;
  border-color: #cfeadd;
}

.verdict-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--vc);
}

.verdict-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 8px;
  background: linear-gradient(180deg, var(--vc-soft) 0%, rgba(255, 255, 255, 0) 130%);
}

.verdict-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.verdict-kicker svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--vc);
}

.verdict-badge {
  flex: none;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  color: #fff;
  background: var(--vc);
}

.verdict-badge:empty {
  display: none;
}

.verdict-lead {
  padding: 0 20px 4px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--vc-ink);
  font-weight: 500;
}

.verdict-lead:empty {
  display: none;
}

.verdict-card .diags {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px 18px 18px;
}

.verdict-card .diag.red {
  border-color: #f5d3d0;
  background: #fffafa;
  box-shadow: 0 8px 20px -18px rgba(221, 53, 64, 0.75);
}

.verdict-card .diag.red::before {
  width: 4px;
  left: 4px;
}

.verdict-card .diag.red .diag-title {
  font-size: 14px;
  color: #8f1d26;
}

.verdict-card .diag.red .diag-sev {
  background: var(--bad);
  color: #fff;
  font-weight: 650;
}

/* 表格 */
.table-card .card-head {
  align-items: center;
  padding-bottom: 14px;
}

.table-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12.5px;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease), background 0.18s var(--ease);
}

.btn-ghost:hover {
  border-color: rgba(47, 91, 255, 0.4);
  color: var(--brand-ink);
  background: var(--brand-soft);
}

.btn-ghost svg {
  width: 14px;
  height: 14px;
}

.btn-ghost.done {
  border-color: rgba(14, 159, 110, 0.45);
  color: #0b7a55;
  background: rgba(14, 159, 110, 0.08);
}

.table-wrap {
  max-height: min(62vh, 620px);
  overflow: auto;
  border-top: 1px solid var(--line);
  scrollbar-width: thin;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 18px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 600;
  text-align: right;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

thead th:first-child {
  text-align: left;
}

tbody td {
  padding: 9px 18px;
  border-bottom: 1px solid #f1f3f8;
  text-align: right;
  color: var(--ink-2);
  white-space: nowrap;
}

tbody td:first-child {
  text-align: left;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11.5px;
}

tbody tr:hover td {
  background: rgba(47, 91, 255, 0.035);
  color: var(--ink);
}

tbody tr.gap td {
  padding: 10px 18px;
  text-align: center;
  color: var(--ink-4);
  font-size: 11.5px;
  background: var(--surface-2);
}

tbody tr:last-child td {
  font-weight: 600;
  color: var(--ink);
}

/* 报告条 */
.report-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.report-bar p {
  font-size: 12px;
  color: var(--ink-3);
}

.report-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
  margin-top: 48px;
  padding: 30px 0 44px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
}

.footer-inner {
  display: grid;
  gap: 10px;
}

.disclaimer {
  font-size: 11.5px;
  line-height: 1.75;
  color: var(--ink-4);
  max-width: 900px;
}

.disclaimer b {
  margin-right: 6px;
  color: var(--ink-3);
}

.footer-meta {
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.02em;
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px;
  border-radius: 12px;
  background: rgba(13, 21, 40, 0.95);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translate(-50%, 16px) scale(0.97);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.toast svg {
  width: 15px;
  height: 15px;
  color: #4ade80;
}

/* --------------------------------------------------------------------------
   补充组件：缺失提示 / 下拉框 / 图表动效
   -------------------------------------------------------------------------- */

.need {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 16px;
  padding: 11px 15px;
  border: 1px solid rgba(196, 123, 18, 0.28);
  border-radius: 12px;
  background: rgba(196, 123, 18, 0.07);
  color: #8a5407;
  font-size: 13px;
  animation: riseIn 0.4s var(--ease) both;
}

.need::before {
  content: "!";
  flex: none;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: rgba(196, 123, 18, 0.16);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.select {
  width: 100%;
  height: 40px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background-color: var(--surface-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='m2.5 4.5 3.5 3.5 3.5-3.5' fill='none' stroke='%237c8598' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background-color 0.18s var(--ease);
}

.select:hover {
  border-color: var(--line-strong);
}

.select:focus {
  border-color: rgba(47, 91, 255, 0.5);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(47, 91, 255, 0.1);
}

.result {
  scroll-margin-top: 82px;
}

.metric-note {
  flex-wrap: wrap;
  row-gap: 3px;
}

.bar rect.bar-principal,
.bar rect.bar-interest {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: barGrow 0.62s var(--ease) both;
}

@keyframes barGrow {
  from {
    transform: scaleY(0.02);
    opacity: 0.35;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

.donut-seg {
  transition: stroke-dasharray 0.9s var(--ease), opacity 0.2s var(--ease);
}

/* --------------------------------------------------------------------------
   紧凑模式：出结果后收起 hero，把首屏让给数据
   -------------------------------------------------------------------------- */

body.is-analyzed .hero {
  padding: 30px 0 16px;
}

body.is-analyzed .hero h1 {
  margin-top: 0;
  font-size: clamp(23px, 3vw, 31px);
  letter-spacing: -0.03em;
}

body.is-analyzed .hero .eyebrow,
body.is-analyzed .hero .lede {
  display: none;
}

body.is-analyzed #input {
  height: 96px;
  min-height: 96px;
}

/* --------------------------------------------------------------------------
   动效
   -------------------------------------------------------------------------- */

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.reveal {
  animation: riseIn 0.55s var(--ease) both;
}

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */

@media (max-width: 1080px) {
  .dash {
    grid-template-columns: minmax(0, 1fr);
  }
  .dash > .stack {
    order: 1;
  }
  .dash > .params {
    order: 2;
  }
  .params {
    position: static;
  }
  .fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
  .verdict-card .diags {
    grid-template-columns: minmax(0, 1fr);
  }
  .howto {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .howto-item {
    display: grid;
    grid-template-columns: 44px 1fr;
    grid-template-areas: "no title" "no text";
    gap: 2px 8px;
    padding: 16px 18px;
  }
  .howto-no {
    grid-area: no;
    font-size: 12px;
  }
  .howto-item h3 {
    grid-area: title;
    margin: 0;
  }
  .howto-item p {
    grid-area: text;
  }
  .diags {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .wrap {
    padding: 0 18px;
  }
  .topbar-inner {
    gap: 10px;
  }
  .brand {
    min-width: 0;
  }
  .pill-long {
    display: none;
  }
  .pill-short {
    display: inline;
  }
  .pill-privacy {
    flex: none;
  }
  .hero {
    padding: 48px 0 24px;
  }
  .hero h1 {
    font-size: clamp(28px, 7.6vw, 38px);
  }
  .hero h1 .mark {
    white-space: normal;
  }
  .lede {
    font-size: 14.5px;
  }
  .composer-bar {
    padding: 12px 14px;
  }
  .btn-primary {
    width: 100%;
    justify-content: center;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .metric {
    padding: 14px 14px 12px;
  }
  .metric-value {
    font-size: 21px;
  }
  .fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .segmented {
    grid-template-columns: repeat(2, 1fr);
  }
  .readback {
    padding: 16px;
  }
  .card-head {
    padding: 16px 16px 0;
  }
  .chart-body {
    padding: 8px 14px 16px;
  }
  .diags {
    padding: 12px;
  }
  #donut-frame {
    max-width: 300px;
    margin: 0 auto;
  }
  thead th,
  tbody td {
    padding-left: 12px;
    padding-right: 12px;
  }
  .toast {
    bottom: 16px;
    max-width: calc(100% - 32px);
  }
}

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