/* ==========================================================================
   人话版 · 设计系统
   目标用户：50 岁以上，手机为主，老花眼。所有尺寸优先保证"看得清、点得准"。
   ========================================================================== */

:root {
  /* 色板 */
  --ink: #0f1724;
  --ink-2: #35455c;
  --sub: #5b6b80;
  --line: #e3e9f3;
  --line-strong: #cfd8e6;
  --bg: #f4f7fc;
  --bg-2: #eaf0f9;
  --card: #ffffff;
  --brand: #1f6feb;
  --brand-ink: #0b4bc4;
  --brand-soft: #eaf1ff;
  --warm: #ff7a1a;
  --warm-soft: #fff3e6;
  --danger: #d93a2b;
  --danger-soft: #fdecea;
  --ok: #128a5a;
  --ok-soft: #e8f7ef;

  /* 形状 */
  --r-xs: 10px;
  --r-sm: 12px;
  --r: 18px;
  --r-lg: 24px;

  /* 阴影 */
  --sh-1: 0 1px 2px rgba(15, 23, 36, .06);
  --sh-2: 0 8px 24px rgba(15, 23, 36, .08);
  --sh-brand: 0 10px 24px rgba(31, 111, 235, .26);

  /* 字号 */
  --fs: 18px;
}

html.large { --fs: 21px; }

html[data-theme="dark"] {
  --ink: #e9eff8;
  --ink-2: #c7d3e4;
  --sub: #9db0c8;
  --line: #242f40;
  --line-strong: #33415a;
  --bg: #0d1420;
  --bg-2: #131c2b;
  --card: #161f2e;
  --brand: #5b95f7;
  --brand-ink: #9dc0ff;
  --brand-soft: #1b2b47;
  --warm-soft: #2a2113;
  --danger-soft: #33201e;
  --ok-soft: #132b22;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-2: 0 10px 28px rgba(0, 0, 0, .45);
  --sh-brand: 0 10px 26px rgba(31, 111, 235, .32);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --ink: #e9eff8;
    --ink-2: #c7d3e4;
    --sub: #9db0c8;
    --line: #242f40;
    --line-strong: #33415a;
    --bg: #0d1420;
    --bg-2: #131c2b;
    --card: #161f2e;
    --brand: #5b95f7;
    --brand-ink: #9dc0ff;
    --brand-soft: #1b2b47;
    --warm-soft: #2a2113;
    --danger-soft: #33201e;
    --ok-soft: #132b22;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
    --sh-2: 0 10px 28px rgba(0, 0, 0, .45);
    --sh-brand: 0 10px 26px rgba(31, 111, 235, .32);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.sprite { display: none; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: var(--fs)/1.7 "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}

.icon { width: 1.35em; height: 1.35em; flex: 0 0 auto; display: block; }

.wrap {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 0 20px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

/* ---------- header ---------- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) 0 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: .3px;
}

.logo {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--brand), #4d8ef7);
  color: #fff;
  font-size: .9rem;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(31, 111, 235, .28);
}

.hdr-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--sub);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.icon-btn:active { background: var(--bg-2); }

.mini {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--sub);
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
}

.mini[aria-pressed="true"] {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}

/* ---------- screens ---------- */
main { flex: 1; }

.screen { animation: in .26s cubic-bezier(.2, .7, .3, 1); }
@keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h1 {
  font-size: clamp(1.9rem, 7vw, 2.4rem);
  line-height: 1.28;
  margin: 22px 0 12px;
  letter-spacing: -.02em;
  font-weight: 800;
}

.lead { color: var(--sub); margin: 0 0 26px; font-size: 1rem; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { margin-top: 24px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.hint { color: var(--sub); font-size: .84rem; margin: 10px 2px 0; }

.sec-title { color: var(--sub); font-size: .9rem; font-weight: 600; margin: 0 0 12px; }

/* ---------- buttons ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 15px 18px;
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: var(--sh-1);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.btn:active { transform: scale(.985); }
.btn.xl { min-height: 68px; font-size: 1.16rem; }

.btn.primary {
  background: linear-gradient(160deg, var(--brand), #3b82f6);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--sh-brand);
}

.btn.primary:active { filter: brightness(.94); }

.btn.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--sub);
  font-weight: 500;
  min-height: 48px;
}

.btn[disabled] { opacity: .55; pointer-events: none; }

.link {
  border: 0;
  background: none;
  padding: 6px 4px;
  color: var(--brand);
  font: inherit;
  font-size: .95rem;
  cursor: pointer;
}

.link.strong { font-weight: 700; }

/* ---------- panels ---------- */
.panel {
  margin-top: 18px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-1);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 12px;
}

.panel-label { display: block; font-size: .9rem; color: var(--sub); margin-bottom: 8px; }

textarea {
  width: 100%;
  padding: 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  font: inherit;
  color: var(--ink);
  background: var(--bg-2);
  resize: vertical;
  margin-bottom: 12px;
}

textarea:focus { outline: 2px solid rgba(31, 111, 235, .35); border-color: var(--brand); }

/* ---------- 选图缩略图 ---------- */
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }

.thumb {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line);
}

.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.thumb button {
  position: absolute;
  top: 6px; right: 6px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 36, .62);
  color: #fff;
  cursor: pointer;
}

.thumb button .icon { width: 17px; height: 17px; }

/* ---------- 重试条 ---------- */
.retry {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: .95rem;
}

html[data-theme="dark"] .retry { color: #ffb3a8; }

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .retry { color: #ffb3a8; }
}

.retry .icon { width: 1.2em; height: 1.2em; }
.retry span { flex: 1; }
.retry .link { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 示例 ---------- */
.samples { margin-top: 30px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }

.chip {
  min-height: 44px;
  padding: 10px 17px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: .93rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--sh-1);
}

.chip:active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }

/* ---------- 历史 ---------- */
.history { margin-top: 30px; }
.hist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.hist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  box-shadow: var(--sh-1);
}

.hist-item .icon { color: var(--sub); }
.hist-body { flex: 1; min-width: 0; }
.hist-title { display: block; font-weight: 700; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-meta { display: block; color: var(--sub); font-size: .82rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- loading ---------- */
.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 62dvh;
  text-align: center;
}

.loader { width: 66%; max-width: 320px; margin-bottom: 26px; }

.spinner {
  width: 46px; height: 46px;
  margin: 0 auto 20px;
  border-radius: 50%;
  border: 4px solid var(--brand-soft);
  border-top-color: var(--brand);
  animation: spin .9s linear infinite;
}

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

.bar { height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.bar i {
  display: block;
  height: 100%;
  width: 4%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #6aa6ff);
  transition: width .6s ease;
}

.loading-text { font-size: 1.22rem; font-weight: 700; margin: 0; line-height: 1.5; }
.loading-sub { color: var(--sub); font-size: .9rem; margin: 10px 0 0; }

/* ---------- 结果 ---------- */
.hero {
  margin: 16px 0 14px;
  padding: 20px 20px 22px;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--sh-2);
}

.hero-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

.tag {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--warm-soft);
  color: #b35200;
  font-size: .82rem;
  font-weight: 700;
}

html[data-theme="dark"] .tag { color: #ffc38a; }

.tag.soft { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
html[data-theme="dark"] .tag.soft { color: #b9d2ff; }

.tag.danger { background: var(--danger-soft); color: #a8281c; }
html[data-theme="dark"] .tag.danger { color: #ffb3a8; }

h2 { font-size: 1.5rem; line-height: 1.42; margin: 2px 0 10px; letter-spacing: -.01em; }

.one-line {
  font-size: 1.22rem;
  line-height: 1.6;
  font-weight: 700;
  margin: 0;
  padding-left: 14px;
  border-left: 5px solid var(--brand);
  color: var(--ink);
}

.days {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  background: var(--brand-soft);
  color: var(--brand-ink);
}

.days.urgent { background: var(--danger-soft); color: var(--danger); }
.days.soon { background: var(--warm-soft); color: #b35200; }
.days.later { background: var(--ok-soft); color: var(--ok); }
html[data-theme="dark"] .days.soon { color: #ffc38a; }

.days-label { font-size: .9rem; font-weight: 600; opacity: .9; }
.days b { font-size: 2.2rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.days-unit { font-size: .95rem; font-weight: 600; }

.blocks { display: block; }
.blocks > .card { animation: cardIn .3s ease backwards; }
.blocks > .card:nth-child(2) { animation-delay: .05s; }
.blocks > .card:nth-child(3) { animation-delay: .1s; }
.blocks > .card:nth-child(4) { animation-delay: .15s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--sh-1);
}

.card h3 {
  font-size: .9rem;
  font-weight: 700;
  color: var(--sub);
  margin: 0 0 12px;
  letter-spacing: .04em;
}

.card p { margin: 0; }
.card ul, .card ol { margin: 0; padding: 0; list-style: none; }

.steps { counter-reset: s; }

.steps li {
  counter-increment: s;
  position: relative;
  padding: 0 0 16px 46px;
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.6;
}

.steps li:last-child { padding-bottom: 0; }

.steps li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: 2px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: .98rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

html[data-theme="dark"] .steps li::before { color: #b9d2ff; }

.steps li small {
  display: block;
  font-weight: 400;
  color: var(--sub);
  font-size: .92rem;
  margin-top: 4px;
}

.checks li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 1.03rem;
  line-height: 1.6;
}

.checks li:last-child { border-bottom: 0; padding-bottom: 0; }
.checks li:first-child { padding-top: 0; }

.checks li::before {
  content: "";
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 4px;
  border: 2px solid var(--line-strong);
  border-radius: 6px;
}

.split { display: grid; gap: 16px; }

.strong { font-size: 1.06rem; font-weight: 600; line-height: 1.6; }

.kv { margin: 0; }

.kv-row {
  display: flex;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}

.kv-row:last-child { border-bottom: 0; padding-bottom: 0; }
.kv-row:first-child { padding-top: 0; }

.kv dt { flex: 0 0 5.2em; color: var(--sub); font-size: .95rem; }

.kv dd {
  margin: 0;
  font-weight: 600;
  font-size: 1.03rem;
  line-height: 1.6;
  word-break: break-word;
}

.text-body { font-size: 1.01rem; line-height: 1.75; color: var(--ink-2); }

.block-bullets.tone-warn { background: var(--warm-soft); border-color: #f0d7b0; }
.block-bullets.tone-warn h3 { color: #93640a; }
.block-bullets.tone-danger { background: var(--danger-soft); border-color: #ffd8d0; }
.block-bullets.tone-danger h3 { color: var(--danger); }
html[data-theme="dark"] .block-bullets.tone-warn { border-color: #4a3a1d; }
html[data-theme="dark"] .block-bullets.tone-warn h3 { color: #ffc38a; }
html[data-theme="dark"] .block-bullets.tone-danger { border-color: #4a2723; }

.dots li { position: relative; padding: 7px 0 7px 20px; font-size: 1rem; line-height: 1.6; }

.dots li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: .4;
}

/* 真假判断条 */
.verdict {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border-radius: var(--r);
  margin: 0 0 14px;
  font-size: .98rem;
  line-height: 1.65;
}

.verdict strong { font-size: 1.12rem; }

.v-suspicious { background: var(--danger-soft); color: #98261a; }
.v-safe { background: var(--ok-soft); color: #0f6b45; }
.v-unknown { background: var(--bg-2); color: var(--ink-2); }
html[data-theme="dark"] .v-suspicious { color: #ffb3a8; }
html[data-theme="dark"] .v-safe { color: #8ee0b8; }

/* 原文 */
.raw summary {
  cursor: pointer;
  font-size: .9rem;
  font-weight: 700;
  color: var(--sub);
  letter-spacing: .04em;
  list-style: none;
  min-height: 24px;
}

.raw summary::-webkit-details-marker { display: none; }

.raw summary::after { content: "展开"; float: right; font-weight: 500; color: var(--brand); }
.raw[open] summary::after { content: "收起"; }

.raw pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font: .95rem/1.8 "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink-2);
}

.disclaimer {
  color: var(--sub);
  font-size: .82rem;
  text-align: center;
  margin: 22px 0 0;
  line-height: 1.75;
}

/* ---------- 朗读 ---------- */
.speak-row { display: flex; gap: 10px; align-items: stretch; }
.speak-row .btn { flex: 1; }

.seg {
  display: flex;
  padding: 4px;
  border-radius: var(--r);
  background: var(--bg-2);
  border: 1px solid var(--line);
}

.seg button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--sub);
  font: inherit;
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
}

.seg button.on { background: var(--card); color: var(--brand-ink); box-shadow: var(--sh-1); }

/* ---------- share ---------- */
.share-title { font-size: 1.12rem; margin: 20px 0 14px; font-weight: 700; }

#shareImg {
  width: 100%;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--card);
  display: block;
  box-shadow: var(--sh-2);
}

/* ---------- footer / toast ---------- */
footer { padding: 18px 0 4px; text-align: center; }
.stats { color: var(--sub); font-size: .78rem; opacity: .8; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(34px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(15, 23, 36, .92);
  color: #fff;
  padding: 13px 22px;
  border-radius: 999px;
  font-size: .92rem;
  max-width: 84vw;
  text-align: center;
  z-index: 50;
  animation: toastIn .18s ease;
}

@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (min-width: 620px) {
  .split { grid-template-columns: 1fr 1fr; }
}

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