/* 人生版本回退 · 视觉样式 */
:root {
  --ink: #2b2b45;
  --ink-soft: #6d6d88;
  --ink-faint: #9a9ab0;
  --line: rgba(43, 43, 69, 0.1);
  --accent: #d97a45;
  --accent-deep: #b95c2c;
  --violet: #6c5ce7;
  --deep: #1b1b3a;
  --paper: rgba(255, 255, 255, 0.82);
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(820px 520px at 88% -8%, rgba(255, 205, 155, 0.42), transparent 64%),
    radial-gradient(760px 520px at 2% 12%, rgba(178, 168, 255, 0.38), transparent 62%),
    linear-gradient(160deg, #f8f6ff 0%, #f4f0fb 48%, #fff6ec 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }

.app {
  width: min(720px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 calc(56px + env(safe-area-inset-bottom));
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 2px 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, #b6a5ff, #f0b37e);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 6px 6px auto auto;
  width: 8px;
  height: 8px;
  border-top: 2px solid #fff;
  border-right: 2px solid #fff;
  transform: rotate(45deg);
  border-radius: 1px;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.66);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  transition: background 0.18s, color 0.18s, transform 0.18s;
}
.ghost-btn:hover { background: #fff; color: var(--ink); }
.ghost-btn:active { transform: scale(0.97); }
.ghost-btn.small { padding: 7px 14px; font-size: 12.5px; }

.primary-btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 15px 20px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, #7363e8, #5a49d6);
  box-shadow: 0 12px 28px rgba(108, 92, 231, 0.24);
  transition: transform 0.18s, box-shadow 0.18s, opacity 0.18s;
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(108, 92, 231, 0.3); }
.primary-btn:active { transform: translateY(0) scale(0.99); }
.primary-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.link-btn {
  border: 0;
  background: none;
  padding: 4px 0;
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 600;
}
.danger-link {
  display: block;
  margin: 22px auto 0;
  border: 0;
  background: none;
  color: var(--ink-faint);
  font-size: 12.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.danger-link:hover { color: #c0504d; }

.icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(43,43,69,0.06);
  color: var(--ink-soft);
  font-size: 20px;
  line-height: 1;
}

/* ---------- 导航 ---------- */
.tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: 18px;
  margin-bottom: 26px;
}
.tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  padding: 10px 8px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.tab.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(70,70,110,0.08);
}

/* ---------- 通用 ---------- */
.view { display: none; }
.view.is-active { display: block; animation: fadeUp 0.3s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hero { margin: 12px 4px 26px; }
.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 6.2vw, 44px);
  line-height: 1.24;
  letter-spacing: -0.03em;
}
.hero p { margin: 0; color: var(--ink-soft); font-size: 14.5px; line-height: 1.8; }
.view-head { margin: 12px 4px 22px; }
.view-head h1 { margin: 0 0 8px; font-size: 26px; letter-spacing: -0.02em; }
.view-head p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.7; }

.card {
  background: var(--paper);
  border: 1px solid rgba(255,255,255,0.92);
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(70,70,120,0.1);
  padding: 24px;
  margin-bottom: 20px;
}
.card.compose { padding: 26px 24px 24px; }
.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.card-title-row h2 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.hint { color: var(--ink-faint); font-size: 12px; }
.required {
  color: var(--accent-deep);
  font-size: 11px;
  font-weight: 700;
  background: rgba(217,122,69,0.1);
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 6px;
}

.field { margin-bottom: 20px; }
.field label {
  display: block;
  margin-bottom: 9px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}
.field textarea, .field input[type="text"], .field input[type="password"], .field select, .modal-box input, .modal-box select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.86);
  padding: 13px 14px;
  color: var(--ink);
  outline: none;
  resize: vertical;
  line-height: 1.6;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.field textarea:focus, .field input:focus, .field select:focus, .modal-box input:focus, .modal-box select:focus {
  border-color: rgba(108,92,231,0.5);
  box-shadow: 0 0 0 3px rgba(108,92,231,0.1);
}
.field textarea::placeholder, .field input::placeholder { color: #b6b6c8; }
.field-foot { display: flex; justify-content: space-between; margin-top: 7px; }
.counter { color: var(--ink-faint); font-size: 11.5px; }
.field-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: 18px; }
.field-grid .field { margin-bottom: 18px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.7);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12.5px;
  transition: all 0.18s;
}
.chip:hover { border-color: rgba(108,92,231,0.4); }
.chip.is-active {
  background: rgba(108,92,231,0.12);
  border-color: rgba(108,92,231,0.45);
  color: #5747c9;
  font-weight: 700;
}
.engine-note { margin: 12px 0 0; text-align: center; color: var(--ink-faint); font-size: 11.5px; }

/* ---------- 加载 ---------- */
.loading {
  text-align: center;
  padding: 44px 24px 40px;
  background: var(--paper);
  border: 1px solid rgba(255,255,255,0.92);
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(70,70,120,0.1);
}
.loading h2 { margin: 22px 0 6px; font-size: 19px; }
.loading p { margin: 0; color: var(--ink-soft); font-size: 13px; min-height: 20px; }
.orbit { position: relative; width: 84px; height: 84px; margin: 0 auto; }
.orbit span {
  position: absolute;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--violet);
  border-right-color: rgba(217,122,69,0.8);
  animation: spin 1.3s linear infinite;
}
.orbit span:nth-child(1) { inset: 0; }
.orbit span:nth-child(2) { inset: 12px; border-top-color: var(--accent); animation-duration: 1.7s; animation-direction: reverse; }
.orbit span:nth-child(3) { inset: 24px; border-top-color: #9b8cf0; animation-duration: 1s; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 5px; background: rgba(43,43,69,0.08); border-radius: 99px; margin: 22px auto 0; max-width: 280px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--violet), var(--accent)); transition: width 0.5s ease; }

/* ---------- 报告 ---------- */
.report {
  background: linear-gradient(165deg, #242043 0%, #1d1a3a 55%, #2b1c40 100%);
  color: #f7f2ff;
  border-radius: 26px;
  padding: 30px 26px 26px;
  box-shadow: 0 24px 64px rgba(30,25,70,0.28);
  position: relative;
  overflow: hidden;
}
.report::before {
  content: "";
  position: absolute;
  width: 240px; height: 240px;
  right: -80px; top: -90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,190,120,0.22), transparent 70%);
  pointer-events: none;
}
.report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; position: relative; }
.report-kicker { font-size: 11px; letter-spacing: 0.16em; color: #ffd2a0; text-transform: uppercase; }
.report h2 { margin: 10px 0 12px; font-size: clamp(25px, 5vw, 34px); line-height: 1.3; letter-spacing: -0.02em; }
.report .overview { margin: 0; color: rgba(255,255,255,0.72); font-size: 14px; line-height: 1.85; }
.source-badge {
  flex-shrink: 0;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.12);
}
.source-badge.ai { color: #ffd2a0; border-color: rgba(255,190,120,0.35); background: rgba(255,190,120,0.12); }

.report-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 4px; }
.report-actions button {
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.85);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12.5px;
  transition: background 0.18s;
}
.report-actions button:hover { background: rgba(255,255,255,0.14); }

.report-section { margin-top: 28px; position: relative; }
.report-section > h3 {
  margin: 0 0 16px;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: #ffd2a0;
  display: flex;
  align-items: center;
  gap: 9px;
}
.report-section > h3::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #f2a65a; }

.timeline { position: relative; padding-left: 4px; }
.tl-node { position: relative; padding: 0 0 24px 32px; }
.tl-node:last-child { padding-bottom: 0; }
.tl-node::before {
  content: "";
  position: absolute;
  left: 7px; top: 20px; bottom: -4px;
  width: 1px;
  background: rgba(255,255,255,0.14);
}
.tl-node:last-child::before { display: none; }
.tl-dot {
  position: absolute;
  left: 0; top: 5px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: #f2a65a;
  box-shadow: 0 0 0 5px rgba(242,166,90,0.14);
}
.tl-node:last-child .tl-dot { background: #ffd2a0; }
.tl-when { font-size: 11.5px; color: #ffc98a; letter-spacing: 0.04em; }
.tl-title { font-size: 16px; font-weight: 700; margin: 5px 0 7px; }
.tl-detail { font-size: 13.5px; line-height: 1.75; color: rgba(255,255,255,0.74); margin: 0 0 9px; }
.tl-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.tl-meta p { margin: 0; font-size: 12px; line-height: 1.6; }
.tl-meta .risk { color: #f3a9a0; }
.tl-meta .contrast { color: #b9c6ef; }
.tl-meta b { font-weight: 600; opacity: 0.8; margin-right: 4px; }

.risk-list { margin: 0; padding: 0; list-style: none; }
.risk-list li {
  position: relative;
  padding: 9px 0 9px 20px;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255,255,255,0.72);
}
.risk-list li::before { content: "!"; position: absolute; left: 0; top: 10px; color: #f3a9a0; font-weight: 800; font-size: 13px; }

.score-legend { display: flex; gap: 16px; margin: -6px 0 14px; font-size: 11.5px; color: rgba(255,255,255,0.55); }
.score-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.score-legend .now i { background: #b4c3e6; }
.score-legend .alt i { background: #f2a65a; }
.score-row { margin-bottom: 15px; }
.score-row-head { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 7px; }
.score-row-head span { color: rgba(255,255,255,0.8); }
.score-row-head b { color: #ffd2a0; font-size: 12px; }
.score-track { height: 6px; border-radius: 99px; background: rgba(255,255,255,0.09); margin-bottom: 5px; overflow: hidden; }
.score-track i { display: block; height: 100%; border-radius: 99px; }
.score-track.now i { background: #b4c3e6; }
.score-track.alt i { background: linear-gradient(90deg, #e08b4a, #ffc985); }
.total-compare {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
}
.total-compare > div { flex: 1; text-align: center; }
.total-compare small { display: block; font-size: 11px; color: rgba(255,255,255,0.5); margin-bottom: 4px; }
.total-compare strong { font-size: 24px; }
.total-compare .alt strong { color: #ffd2a0; }
.total-compare .arrow { color: rgba(255,255,255,0.3); font-size: 18px; }

.advice-box {
  margin-top: 26px;
  padding: 20px 22px;
  border-radius: 18px;
  background: rgba(242,166,90,0.14);
  border: 1px solid rgba(255,199,130,0.3);
}
.advice-box .label { font-size: 12px; color: #ffd2a0; font-weight: 700; letter-spacing: 0.04em; }
.advice-box p { margin: 9px 0 0; font-size: 15px; line-height: 1.8; }
.insight-line { margin: 16px 2px 0; font-size: 12.5px; line-height: 1.8; color: rgba(255,255,255,0.5); font-style: italic; }
.fallback-note { margin: 14px 2px 0; font-size: 11.5px; color: #f3a9a0; }

/* ---------- 解锁区 ---------- */
.unlock { margin-top: 28px; border-top: 1px solid rgba(255,255,255,0.12); padding-top: 24px; }
.unlock-locked {
  border: 1px dashed rgba(255,210,160,0.4);
  background: rgba(255,190,120,0.06);
  border-radius: 18px;
  padding: 22px;
  text-align: center;
}
.unlock-locked h4 { margin: 0 0 8px; font-size: 16px; }
.unlock-locked p { margin: 0 0 16px; font-size: 12.5px; color: rgba(255,255,255,0.6); line-height: 1.7; }
.unlock-locked .primary-btn { background: linear-gradient(135deg, #e08b4a, #c86a35); box-shadow: 0 10px 24px rgba(224,139,74,0.22); }
.unlock-note { display: block; margin-top: 10px; font-size: 11px; color: rgba(255,255,255,0.4); }

.variant-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.variant {
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  border-radius: 15px;
  padding: 14px;
}
.variant.best { border-color: rgba(255,199,130,0.45); background: rgba(255,190,120,0.1); }
.variant .lens { font-size: 11px; color: #ffd2a0; }
.variant .vtitle { font-size: 13.5px; font-weight: 700; margin: 6px 0 8px; line-height: 1.5; }
.variant .vscore { font-size: 22px; font-weight: 800; }
.variant .vscore small { font-size: 11px; font-weight: 400; color: rgba(255,255,255,0.5); margin-left: 4px; }
.variant .vdiff { font-size: 11px; margin-top: 3px; color: #b9c6ef; }
.variant .vdiff.up { color: #9fe0b4; }
.variant .vdiff.down { color: #f3a9a0; }
.best-tag { float: right; font-size: 10px; padding: 2px 6px; border-radius: 99px; background: rgba(255,199,130,0.2); color: #ffd2a0; }

.action-list { margin-top: 20px; }
.action-list h4 { margin: 0 0 12px; font-size: 14px; color: #ffd2a0; }
.action-item {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.action-item:last-child { border-bottom: 0; }
.action-item .at { flex-shrink: 0; width: 64px; font-size: 11.5px; color: #ffc98a; padding-top: 2px; }
.action-item .ab { flex: 1; }
.action-item .ab b { display: block; font-size: 13.5px; margin-bottom: 4px; }
.action-item .ab p { margin: 0; font-size: 12.5px; line-height: 1.7; color: rgba(255,255,255,0.65); }

/* ---------- 历史 ---------- */
.history-list { display: grid; gap: 12px; }
.history-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255,255,255,0.9);
  background: var(--paper);
  border-radius: 18px;
  padding: 17px 18px;
  box-shadow: 0 10px 30px rgba(70,70,120,0.07);
  transition: transform 0.18s, box-shadow 0.18s;
}
.history-item:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(70,70,120,0.12); }
.history-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.history-top time { font-size: 11px; color: var(--ink-faint); }
.history-top .tag { font-size: 11px; color: var(--accent-deep); background: rgba(217,122,69,0.1); padding: 3px 8px; border-radius: 99px; }
.history-item h3 { margin: 0 0 7px; font-size: 16px; }
.history-item p { margin: 0 0 10px; font-size: 12.5px; color: var(--ink-soft); line-height: 1.6; }
.history-scores { display: flex; gap: 14px; font-size: 11.5px; color: var(--ink-faint); }
.history-scores b { color: var(--ink); }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-soft); }
.empty p { font-size: 14px; line-height: 1.7; margin-bottom: 20px; }
.empty .primary-btn { width: auto; display: inline-block; padding: 12px 26px; }

/* ---------- 弹窗 / 提示 ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal:not([hidden]) { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(22,20,40,0.52); backdrop-filter: blur(4px); }
.modal-box {
  position: relative;
  width: min(440px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: #fff;
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 30px 80px rgba(20,20,50,0.28);
}
.modal-box h2 { margin: 0 0 12px; font-size: 20px; }
.modal-label { display: block; font-size: 12.5px; font-weight: 700; margin: 16px 0 7px; }
.modal-box .action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.modal-box .action-row .primary-btn { width: auto; flex: 1; min-width: 120px; padding: 12px 14px; }
.modal-box .action-row .ghost-btn { flex: 1; min-width: 90px; }
.modal-box .danger-link { margin-top: 18px; }
.crisis-box { text-align: center; }
.crisis-box p { font-size: 13.5px; line-height: 1.8; color: var(--ink-soft); }
.crisis-box .hotline { font-size: 28px; font-weight: 800; color: var(--accent-deep); letter-spacing: 0.04em; margin: 14px 0; }
.crisis-box .primary-btn { margin-top: 14px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  background: rgba(27,27,58,0.94);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.2);
  white-space: nowrap;
  max-width: calc(100% - 40px);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 响应式 ---------- */
@media (max-width: 600px) {
  .app { width: calc(100% - 24px); padding-top: 14px; }
  .card { padding: 20px 18px; border-radius: 20px; }
  .card.compose { padding: 22px 18px 20px; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .hero { margin-top: 6px; }
  .hero h1 { font-size: 32px; }
  .report { padding: 24px 18px 22px; border-radius: 20px; }
  .report h2 { font-size: 26px; }
  .tl-node { padding-left: 26px; }
  .total-compare strong { font-size: 21px; }
  .variant-grid { grid-template-columns: 1fr 1fr; }
  .desktop-only { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
