/* AEGIS TERRA · 前台（问 / 测）样式 —— 色彩取自品牌徽标：金 + 橄榄 + 深墨 */
:root {
  --bg: #F2F3EE;
  --surface: #FFFFFF;
  --surface-2: #F8F8F4;
  --line: #DFE1D8;
  --line-2: #EAEBE5;
  --ink: #101B21;
  --text: #1C272C;
  --muted: #5D696D;
  --faint: #97A0A1;
  --gold: #B0854A;
  --gold-2: #8F6630;
  --gold-soft: #F4EBDC;
  --olive: #7E7C4C;
  --olive-soft: #EAE9DC;
  --good: #3A7A4D; --good-soft: #E3EFE5;
  --warn: #A86C12; --warn-soft: #F8EDD8;
  --bad: #B0412E; --bad-soft: #F6E2DD;
  --user: #15232B;
  --user-ink: #F3F5F4;
  --shadow: 0 1px 2px rgba(16, 27, 33, .05), 0 14px 36px -18px rgba(16, 27, 33, .25);
  --shadow-lg: 0 30px 80px -30px rgba(16, 27, 33, .45);
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --num: "SF Pro Display", -apple-system, "Helvetica Neue", "PingFang SC", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0C151A; --surface: #121E25; --surface-2: #17252D; --line: #26363F; --line-2: #1D2C34;
    --ink: #EEF2F1; --text: #DCE4E4; --muted: #95A3A6; --faint: #66767A;
    --gold: #D2A866; --gold-2: #E2BD80; --gold-soft: rgba(210, 168, 102, .14); --olive: #B6B37E; --olive-soft: rgba(182, 179, 126, .14);
    --good: #66B884; --good-soft: rgba(102, 184, 132, .14); --warn: #E2A84A; --warn-soft: rgba(226, 168, 74, .14); --bad: #E8826D; --bad-soft: rgba(232, 130, 109, .14);
    --user: #22333C; --user-ink: #F0F4F4;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 14px 36px -18px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
  background-image: radial-gradient(70% 50% at 100% 0%, rgba(176, 133, 74, .10), transparent 60%), radial-gradient(60% 50% at 0% 100%, rgba(126, 124, 76, .10), transparent 60%);
  background-attachment: fixed;
}
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--gold-2); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.ico { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }

/* ---------- 顶栏 ---------- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 14px max(20px, env(safe-area-inset-left)); padding-top: calc(14px + env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.top.flat { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand img.e { height: 34px; }
.brand img.w { height: 24px; }
.brand .t { font-size: 12px; color: var(--muted); letter-spacing: .12em; border-left: 1px solid var(--line); padding-left: 10px; }
.top .sp { flex: 1; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; transition: all .15s;
}
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.primary:hover { opacity: .9; }
.btn.gold { background: linear-gradient(135deg, #C69A5B, #9E7139); border-color: transparent; color: #FFFFFF; box-shadow: 0 8px 20px -10px rgba(158, 113, 57, .8); }
.btn.gold:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.lg { height: 50px; padding: 0 22px; font-size: 15.5px; border-radius: 12px; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- 首页 ---------- */
.home { max-width: 760px; margin: 0 auto; padding: 6vh 20px 40px; text-align: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--olive); letter-spacing: .14em; font-weight: 600;
  background: var(--olive-soft); padding: 5px 14px; border-radius: 999px; }
.eyebrow i { width: 6px; height: 6px; border-radius: 50%; background: var(--olive); }
.home h1 { font-family: var(--serif); font-size: clamp(32px, 5.4vw, 48px); line-height: 1.25; margin: 22px 0 14px; color: var(--ink); letter-spacing: .03em; font-weight: 600; }
.home h1 em { font-style: normal; color: var(--gold-2); }
.home h1 span, .home h1 em { display: inline-block; }
.home .lead { color: var(--muted); font-size: clamp(15px, 2.1vw, 17px); margin: 0 auto; max-width: 560px; }

.ask {
  margin: 34px auto 0; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 14px 14px 12px 18px; transition: border-color .15s, box-shadow .15s;
}
.ask:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 16%, transparent), var(--shadow); }
.ask textarea { width: 100%; border: 0; outline: 0; resize: none; background: transparent; font-size: 16.5px; line-height: 1.6; min-height: 54px; max-height: 200px; padding: 2px 0; }
.ask textarea::placeholder { color: var(--faint); }
.ask .row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.ask .note { flex: 1; font-size: 12.5px; color: var(--faint); }
.send { width: 42px; height: 42px; border-radius: 12px; border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--ink); color: var(--bg); transition: opacity .15s, transform .1s; }
.send:active { transform: scale(.96); }
.send[disabled] { opacity: .25; cursor: default; }

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.chip { border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--text); border-radius: 999px; padding: 7px 14px; font-size: 13.5px; cursor: pointer; transition: all .15s; }
.chip:hover { border-color: var(--gold); color: var(--gold-2); background: var(--surface); }

.or { display: flex; align-items: center; gap: 14px; color: var(--faint); font-size: 13px; margin: 38px 0 18px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

.test-card {
  display: flex; align-items: center; gap: 18px; text-align: left; width: 100%; cursor: pointer;
  background: var(--ink); color: #EEF2F1; border: 0; border-radius: 18px; padding: 20px 22px; box-shadow: var(--shadow-lg);
  background-image: radial-gradient(80% 140% at 100% 0%, rgba(198, 154, 91, .30), transparent 60%);
  transition: transform .15s;
}
@media (prefers-color-scheme: dark) { .test-card { background-color: #1A2A32; } }
.test-card:hover { transform: translateY(-1px); }
.test-card .gauge { width: 54px; height: 54px; flex: none; }
.test-card .tt { font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: .02em; }
.test-card .ts { font-size: 13px; color: #A9B6B8; margin-top: 3px; }
.test-card .go { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 10px;
  background: linear-gradient(135deg, #C69A5B, #9E7139); color: #FFFFFF; font-size: 14px; font-weight: 600; }

.foot { text-align: center; color: var(--faint); font-size: 12px; padding: 30px 20px calc(24px + env(safe-area-inset-bottom, 0px)); line-height: 1.8; }

/* ---------- 对话 ---------- */
.chat { max-width: 780px; margin: 0 auto; padding: 8px 20px 170px; }
.msg { display: flex; gap: 12px; margin: 22px 0; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--user); color: var(--user-ink); border-radius: 16px 16px 4px 16px; padding: 11px 16px; max-width: 86%; white-space: pre-wrap; word-break: break-word; }
.msg.ai .av { width: 32px; height: 32px; flex: none; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; margin-top: 2px; }
.msg.ai .av img { height: 22px; }
.msg.ai .body { min-width: 0; flex: 1; }
.msg.ai .card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 4px 16px 16px 16px; padding: 14px 18px; box-shadow: var(--shadow); }
.md { font-size: 15px; line-height: 1.75; word-break: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 4px 0 12px; padding-left: 1.3em; }
.md li { margin: 4px 0; }
.md li::marker { color: var(--gold); }
.md strong { color: var(--ink); }
.md h3, .md h4 { font-size: 15.5px; margin: 14px 0 6px; color: var(--ink); }
.md code { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 5px; padding: 0 5px; font-size: .92em; }
.md hr { border: 0; border-top: 1px solid var(--line-2); margin: 12px 0; }
.md .md-sub { color: var(--muted); }
.md-table { overflow-x: auto; margin: 6px 0 12px; }
.md table { border-collapse: collapse; font-size: 13.5px; min-width: 100%; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.md th { background: var(--surface-2); }
.caret::after { content: ""; display: inline-block; width: 7px; height: 16px; margin-left: 2px; vertical-align: -2px; background: var(--gold); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.thinking { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); animation: bounce 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
.actions { display: flex; align-items: center; gap: 2px; margin-top: 6px; }
.actions button { border: 0; background: transparent; color: var(--faint); height: 30px; min-width: 30px; padding: 0 8px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; }
.actions button:hover { background: var(--surface); color: var(--text); }
.actions button.on { color: var(--gold-2); }
.err { color: var(--bad); font-size: 14px; }

.cta {
  margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 16px; border-radius: 14px;
  background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
}
.cta .ct { flex: 1; min-width: 180px; font-size: 14px; color: var(--text); }
.cta .ct b { color: var(--ink); }

.composer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 12px 20px calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.composer .ask { max-width: 780px; margin: 0 auto; padding: 10px 10px 10px 16px; border-radius: 16px; }
.composer .ask .row { margin: 0; align-items: flex-end; }
.composer textarea { min-height: 26px; font-size: 16px; }
.ask.inline { display: flex; align-items: flex-end; gap: 10px; }
.ask.inline textarea { min-height: 28px; padding: 6px 0; }
.ask.inline .row { margin: 0; }
.ask.inline .note { display: none; }
.composer .tip { max-width: 780px; margin: 6px auto 0; text-align: center; font-size: 11.5px; color: var(--faint); }

/* ---------- 测评 ---------- */
.quiz { max-width: 680px; margin: 0 auto; padding: 10px 20px 60px; }
.progress { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.progress .bar { flex: 1; height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--olive), var(--gold)); border-radius: inherit; transition: width .35s ease; }
.qcard { margin-top: 26px; animation: qin .3s ease both; }
@keyframes qin { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.qcard h2 { font-family: var(--serif); font-size: clamp(23px, 3.6vw, 30px); line-height: 1.35; color: var(--ink); margin: 0; font-weight: 600; letter-spacing: .02em; }
.qcard .qh { color: var(--muted); font-size: 14px; margin-top: 8px; }
.opts { display: grid; gap: 10px; margin-top: 24px; }
.opt {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 16px 18px; border-radius: 14px; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--line); font-size: 16px; color: var(--text); transition: all .15s;
}
.opt:hover { border-color: var(--gold); }
.opt .k { width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); }
.opt.on { border-color: var(--gold); background: var(--gold-soft); }
.opt.on .k { background: var(--gold); color: #FFFFFF; border-color: var(--gold); }
.qnav { display: flex; justify-content: space-between; margin-top: 22px; }

/* ---------- 测评结果 ---------- */
.result { max-width: 860px; margin: 0 auto; padding: 6px 20px 60px; }
.res-hero { display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center; background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px; padding: 26px 28px; box-shadow: var(--shadow); }
.ring { width: 150px; height: 150px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .v { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .v b { font: 300 44px/1 var(--num); color: var(--ink); display: block; }
.ring .v span { font-size: 12px; color: var(--muted); }
.level { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; padding: 5px 12px; border-radius: 999px; }
.level.low { background: var(--good-soft); color: var(--good); }
.level.mid { background: var(--warn-soft); color: var(--warn); }
.level.mid-high, .level.high { background: var(--bad-soft); color: var(--bad); }
.res-hero h2 { font-family: var(--serif); font-size: clamp(21px, 3vw, 26px); margin: 12px 0 8px; line-height: 1.4; color: var(--ink); font-weight: 600; }
.res-hero .mode { color: var(--muted); font-size: 14px; }
.res-hero .mode b { color: var(--olive); }
.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.box { background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; padding: 20px 22px; box-shadow: var(--shadow); min-width: 0; }
.box h3 { margin: 0 0 4px; font-size: 16px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.box h3 .ico { color: var(--gold); }
.box .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 12px; }
.cost-big { font: 300 34px/1.15 var(--num); color: var(--ink); margin: 6px 0 2px; letter-spacing: -.01em; }
.cost-big small { font-size: 15px; color: var(--muted); margin-left: 4px; font-family: var(--sans); }
.cost-usd { color: var(--muted); font-size: 13px; }
.cost-list { list-style: none; padding: 0; margin: 14px 0 0; border-top: 1px solid var(--line-2); }
.cost-list li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.cost-list li span { flex: 1; color: var(--text); }
.cost-list li b { font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.risk { padding: 12px 0; border-top: 1px solid var(--line-2); }
.risk:first-of-type { border-top: 0; padding-top: 4px; }
.risk .rt { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); font-size: 14.5px; }
.risk .rt i { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; }
.risk.hi .rt i { background: var(--bad); }
.risk .rx { color: var(--muted); font-size: 13.5px; margin-top: 3px; line-height: 1.6; }
.steps { list-style: none; padding: 0; margin: 4px 0 0; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 12px; padding: 9px 0; font-size: 14px; line-height: 1.6; }
.steps li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12.5px; font-weight: 600; background: var(--olive-soft); color: var(--olive); margin-top: 1px; }
.res-cta { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; padding: 22px; border-radius: 18px; background: var(--ink); color: #EEF2F1;
  background-image: radial-gradient(70% 140% at 100% 0%, rgba(198, 154, 91, .28), transparent 60%); }
.res-cta .ct { width: 100%; text-align: center; font-family: var(--serif); font-size: 19px; margin-bottom: 6px; }
.res-cta .btn.ghost { color: #C9D2D3; }
.res-cta .btn.ghost:hover { background: rgba(255, 255, 255, .08); color: #FFFFFF; }
.disclaimer { text-align: center; color: var(--faint); font-size: 12px; margin-top: 16px; }

/* ---------- 联系顾问（底部弹层） ---------- */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(8, 14, 18, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 20px; }
.sheet { width: min(460px, 100%); background: var(--surface); border-radius: 20px; padding: 24px; box-shadow: var(--shadow-lg); animation: up .25s ease both; max-height: calc(100vh - 40px); overflow-y: auto; }
@keyframes up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.sheet h3 { margin: 0; font-family: var(--serif); font-size: 21px; color: var(--ink); }
.sheet .sub { color: var(--muted); font-size: 13.5px; margin: 6px 0 16px; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); }
.field input, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 11px 12px; font-size: 16px; outline: 0; }
.field input:focus, .field textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 16%, transparent); }
.field textarea { min-height: 70px; resize: vertical; }
.consent { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--muted); margin: 4px 0 16px; line-height: 1.6; }
.consent input { margin-top: 3px; accent-color: var(--gold); }
.sheet .row { display: flex; gap: 10px; justify-content: flex-end; }
.ok { text-align: center; padding: 10px 0; }
.ok .tick { width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center; background: var(--good-soft); color: var(--good); }
.ok .contact { margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; }
.formerr { color: var(--bad); font-size: 13px; min-height: 18px; margin-bottom: 6px; }

.toast { position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 70; background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow-lg); }

/* ---------- 手机 ---------- */
@media (max-width: 640px) {
  .brand .t, .brand img.w + .t { display: none; }
  .brand img.e { height: 30px; }
  .brand img.w { height: 20px; }
  .home { padding-top: 3vh; }
  .chips { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; margin: 14px -16px 0; padding: 0 16px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .or { margin: 26px 0 14px; }
  .test-card { flex-wrap: wrap; padding: 18px; }
  .test-card .go { margin-left: 0; width: 100%; justify-content: center; }
  .res-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; padding: 22px 18px; }
  .res-grid { grid-template-columns: 1fr; }
  .msg.user .bubble { max-width: 92%; }
  .msg.ai .av { display: none; }
  .chat, .quiz, .result { padding-left: 16px; padding-right: 16px; }
  .composer { padding-left: 12px; padding-right: 12px; }
  .scrim { align-items: flex-end; padding: 0; }
  .sheet { border-radius: 20px 20px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }
