/* 落地页：首屏 + 统计章节。沿用木纹窗口、奶油底和 pixel.css 的字体变量，只在开始页生效。
   手机要点（来自上一次修复）：
   - 首屏用 100dvh，随 Safari 工具栏伸缩；100vh 只作回退，否则按钮会被压到工具栏下
   - 顶部和按钮区分别计入 safe-area
   - 所有输入控件不小于 16px，否则 iOS 聚焦时放大页面 */
:root {
  --lp-text: #4a3a26;         /* 窗内正文，奶油底上对比度够 */
  --lp-soft: #6b5338;         /* 次要文字 */
  --lp-line: #d9c8a4;
  --lp-out: #d9573b;          /* 图表：出国 */
  --lp-back: #2f6fdb;         /* 图表：回国。这一对已过色盲校验 */
  --lp-stock: #8a5a33;        /* 图表：目的地存量（单系列，不是流量，不用出国色） */
  --lp-study: #14936b;        /* 分段条：仍在学习或研究。蓝/红/绿已过色盲校验 */
}
#app:has(> #screen-start:not([hidden])) { max-width: 760px; }
.px-home { color: var(--lp-text); }
.px-home h2, .px-home h3 { font-family: var(--px-font); font-weight: 400; color: var(--px-wood-dark); line-height: 1.35; }
.px-home h2 { font-size: 26px; margin: 4px 0 8px; }
.px-home h3 { font-size: 18px; margin: 28px 0 4px; }
.px-home select, .px-home input { font-size: 16px; }
.px-home a { text-underline-offset: 3px; }

/* ---- 首屏 ---- */
.lp-hero { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; padding-top: env(safe-area-inset-top, 0px); }
.lp-topline { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; color: var(--lp-soft); }
.lp-topline a { display: inline-flex; align-items: center; min-height: 44px; }
.lp-dot { display: inline-block; width: 8px; height: 8px; background: var(--px-red); margin-right: 8px; }
.lp-hero-main { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 12px; padding-top: 4px; min-width: 0; padding-bottom: 6px; }
.px-home .start-hero { width: 100%; max-width: 560px; margin: 0; padding: 12px 12px 14px; text-align: center; }
.lp-hero .px-scene { max-height: 11vh; max-height: 11dvh; object-fit: cover; object-position: 50% 80%; margin-top: 8px; }
.lp-hero .px-title { font-size: clamp(26px, 8vw, 36px); letter-spacing: 2px; line-height: 1.25; margin: 4px 0 4px; }
.lp-intro { font-size: 16px; line-height: 1.75; margin: 0; }
.lp-tagline { font-size: 13px; letter-spacing: 2px; margin: 8px 0 0; color: var(--lp-soft); }
/* 只在首屏内吸底：矮屏或横屏首屏变高时按钮仍在屏内，滚过首屏后不遮挡数据 */
.lp-actions { position: sticky; bottom: 0; z-index: 2; background: var(--bg); padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px)); text-align: center; }
.lp-actions .start-actions { margin: 0 auto; max-width: 560px; gap: 14px; }
.px-home .lp-actions .btn.big { min-height: 62px; font-size: 21px; padding: 10px; }
.px-home .btn.lp-setup-start { width: 100%; min-height: 56px; margin-top: 10px; }
.lp-actions #btn-continue { min-height: 44px; }
.lp-setup-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; font-size: 15px; }
.lp-hint { font-size: 12px; color: var(--lp-soft); margin: 0; }

/* 2×2 开局卡片 */
.lp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 560px; }
.px-home .lp-card { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; min-height: 84px; padding: 10px 12px; text-align: left; font-family: var(--px-font); }
.px-home .lp-card { background: #fff3d6; color: var(--px-wood-dark); border: 3px solid var(--px-wood-dark); border-radius: 0; box-shadow: 0 4px 0 var(--px-wood-dark); cursor: pointer; }
.px-home .lp-card:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--px-wood-dark); }
.lp-card b { font-weight: 400; font-size: 18px; line-height: 1.3; }
.lp-card span { font-size: 13px; line-height: 1.4; color: var(--lp-soft); }
.lp-card span.lp-chosen { color: var(--px-red); font-weight: 700; }
.lp-random { display: block; margin: 6px auto 0; padding: 6px 10px; min-height: 32px; background: none; border: 0; color: var(--lp-soft); font: inherit; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.lp-picker { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(40, 24, 10, .55); }
.lp-picker-box { width: 100%; max-width: 420px; max-height: 86vh; max-height: 86dvh; display: flex; flex-direction: column; gap: 10px; padding: 14px; background: #fff3d6; }
.lp-picker-title { font-size: 18px; text-align: center; }
.lp-picker-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; overflow-y: auto; min-height: 0; padding: 2px 2px 6px; }
.lp-picker-short { grid-template-columns: 1fr 1fr 1fr; }
.lp-opt { min-height: 44px; padding: 6px 8px; font-size: 15px; }
.lp-opt[aria-pressed="true"] { background: var(--px-red); color: #fff; }

/* ---- 章节 ---- */
.lp-chapter { padding: 44px 0; border-top: 2px dashed var(--lp-line); scroll-margin-top: env(safe-area-inset-top, 0px); }
.lp-eyebrow { display: block; font-size: 13px; letter-spacing: 1px; color: var(--lp-soft); }
.lp-lead { font-size: 15px; margin: 0 0 16px; }
.lp-window { padding: 16px; margin: 0 0 12px; }
.lp-cap { font-size: 12px; color: var(--lp-soft); border-bottom: 1px dashed var(--lp-line); padding-bottom: 8px; margin-bottom: 4px; }
.lp-note { font-size: 13px; line-height: 1.7; color: var(--lp-soft); margin: 12px 0 0; }
.lp-src { font-size: 12px; line-height: 1.6; color: var(--lp-soft); margin: 6px 0 0; overflow-wrap: anywhere; }
.lp-body { font-size: 14px; margin: 4px 0 12px; }
.lp-warn { font-size: 13px; line-height: 1.7; border-left: 4px solid var(--px-red); background: #f7e6cf; padding: 10px 12px; margin: 14px 0 0; }
.lp-badge { display: inline-block; font-size: 12px; line-height: 1.4; padding: 0 6px; border: 2px solid var(--px-red-dark); color: var(--px-red-dark); vertical-align: 2px; }
.lp-number { display: block; font-family: var(--px-font); font-weight: 400; font-size: clamp(32px, 10vw, 44px); line-height: 1.25; color: var(--px-wood-dark); font-variant-numeric: tabular-nums; }
.lp-number em { font-style: normal; font-size: 16px; margin-left: 6px; }

.lp-metric { padding: 14px 0; border-bottom: 1px dashed var(--lp-line); min-width: 0; }
.lp-metric:last-child { border-bottom: 0; padding-bottom: 0; }
.lp-metric-k { font-size: 14px; }

/* ---- 年度图 ---- */
.lp-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; }
.lp-sw { display: inline-block; width: 12px; height: 12px; margin-right: 5px; vertical-align: -1px; }
.lp-sw-out { background: var(--lp-out); }
.lp-sw-back { background: var(--lp-back); }
.lp-sw-est { background: repeating-linear-gradient(0deg, #6b5338 0 2px, transparent 2px 4px); }
.lp-sw-gap { background: repeating-linear-gradient(135deg, #cdb98f 0 2px, transparent 2px 5px); border: 1px solid var(--lp-line); }
.lp-chart-box { margin: 10px 0; background: var(--px-cream); border: 3px solid var(--px-wood); }
#lp-chart { width: 100%; }
#lp-chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
#lp-chart text { font-family: var(--px-font); font-size: 11px; fill: var(--lp-soft); }
#lp-chart text.lp-val { fill: var(--lp-text); font-size: 12px; }
#lp-chart .lp-hit { fill: transparent; cursor: pointer; }
.lp-tools { display: flex; align-items: center; gap: 10px; margin: 12px 0; font-size: 14px; }
.lp-tools select { flex: 1; width: 0; min-width: 0; min-height: 44px; appearance: none; -webkit-appearance: none; border: 3px solid var(--px-wood); border-radius: 0; background: var(--px-paper); color: var(--ink); padding: 6px 8px; font-family: var(--px-font); }
.lp-year-card { font-size: 14px; background: var(--px-paper); border-left: 4px solid var(--px-wood); padding: 10px 12px; }
.lp-year-card p { margin: 2px 0; }
.lp-year-card strong { font-weight: 400; font-size: 18px; color: var(--px-wood-dark); }
.lp-details { margin-top: 14px; }
.lp-details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--px-wood); font-size: 14px; }
.lp-table-scroll { overflow: auto; max-height: 420px; border: 2px solid var(--lp-line); background: var(--px-paper); }
.lp-table-scroll table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lp-table-scroll caption { text-align: left; font-size: 12px; padding: 6px 8px; color: var(--lp-soft); }
.lp-table-scroll th, .lp-table-scroll td { padding: 8px; border-bottom: 1px solid var(--lp-line); text-align: right; }
.lp-table-scroll th:first-child, .lp-table-scroll td:first-child { text-align: left; }
.lp-table-scroll th { background: #f3e6c8; font-weight: 400; }

/* ---- 946 万的去向：一根分段条 ---- */
.lp-stack-bar { display: flex; gap: 2px; height: 22px; }
.lp-stack-bar i { display: block; min-width: 3px; }
.lp-seg-back { background: var(--lp-back); }
.lp-seg-res { background: repeating-linear-gradient(0deg, var(--lp-out) 0 2px, var(--px-cream) 2px 4px); }
.lp-seg-study { background: repeating-linear-gradient(0deg, var(--lp-study) 0 2px, var(--px-cream) 2px 4px); }
.lp-stack-rows { display: grid; gap: 2px; margin: 8px 0 0; font-size: 13px; }
.lp-stack-rows div { display: flex; justify-content: space-between; gap: 10px; min-width: 0; }
.lp-stack-rows div:last-child { border-top: 1px dashed var(--lp-line); padding-top: 4px; margin-top: 2px; }
.lp-stack-rows span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---- 旁证 ---- */
.lp-ev { padding: 12px 0; border-bottom: 1px dashed var(--lp-line); }
.lp-ev b { display: block; font-weight: 400; font-size: 22px; line-height: 1.3; color: var(--px-wood-dark); font-variant-numeric: tabular-nums; }

/* ---- 目的地 ---- */
.lp-seg { display: flex; gap: 8px; margin: 14px 0 6px; }
.lp-seg button { flex: 1; min-width: 0; min-height: 44px; font-family: var(--px-font); font-size: 13px; padding: 6px; color: var(--px-wood-dark); background: var(--px-paper); border: 3px solid var(--px-wood); border-radius: 0; cursor: pointer; }
.lp-seg button[aria-pressed="true"] { background: var(--px-wood-dark); border-color: var(--px-wood-dark); color: #fff6dc; }
.lp-dest-row { padding: 10px 0; border-bottom: 1px dashed var(--lp-line); }
.lp-dest-top { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; }
.lp-dest-top span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.lp-dest-row a, .lp-ev a, .lp-metric a { white-space: nowrap; }
.lp-track { height: 12px; margin: 5px 0; background: #efe2c3; }
.lp-track i { display: block; height: 100%; background: var(--lp-stock); }

/* ---- 开局设定、来源 ---- */
.px-home .setup { margin: 0 0 12px; }
.px-home .footnote { margin: 14px 0 0; }
.px-home .start-secondary { margin: 16px 0 0; }
.lp-source-list { padding-left: 20px; margin: 10px 0 0; font-size: 12px; line-height: 1.6; }
.lp-source-list li { margin: 8px 0; overflow-wrap: anywhere; }

@media (min-width: 700px) {
  .lp-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
  .lp-metric:last-child { grid-column: 1 / -1; }
  .lp-actions .start-actions, .lp-setup-link { margin-left: auto; margin-right: auto; }
}
/* 矮屏：先缩横幅，文字和按钮优先 */
@media (max-height: 620px) {
  .lp-hero .px-scene { display: none; }
  .px-home .lp-card { min-height: 68px; }
  .lp-hero .px-title { margin: 6px 0 2px; }
  .lp-intro { font-size: 14px; line-height: 1.5; }
  .px-home .lp-actions .btn.big { min-height: 52px; }
  .lp-setup-link { margin-top: 2px; }
  .lp-hint { display: none; }
}
/* 横屏：横幅裁下来只剩跑道，不如不放；两个按钮并排，把高度还给文字 */
@media (max-height: 480px) {
  .lp-hero .px-scene { display: none; }
  .lp-actions .start-actions { grid-auto-flow: column; grid-auto-columns: 1fr; }
  .px-home .lp-actions .btn.big, .lp-actions #btn-continue { min-height: 48px; }
  .lp-actions { padding-top: 6px; }
  .lp-setup-link { margin-top: 0; }
}

/* 首屏：按钮紧跟四张卡片，下面两句话 + 下滑提示（不再贴底） */
.lp-hero { min-height: 0; grid-template-rows: auto auto; }
.lp-hero-main .lp-actions { position: static; width: 100%; max-width: 560px; padding: 4px 0 0; background: none; }
.lp-heart { text-align: center; color: var(--lp-soft); font-size: 14px; line-height: 1.7; margin: 2px 0 0; }
.lp-heart p { margin: 0; }
.lp-scroll-cue { display: inline-block; margin: 6px auto 10px; padding: 6px 12px; color: var(--lp-soft); font-size: 14px; text-decoration: none; border: 2px dashed currentColor; animation: lp-bounce 1.6s ease-in-out infinite; }
@keyframes lp-bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
@media (prefers-reduced-motion: reduce) { .lp-scroll-cue { animation: none; } }
.lp-picker-note { font-size: 12px; margin: 6px 2px; }
