/* ============================================================
 * 命盘站 设计系统 v2 (2026-10-12 大王: 要商业产品级高级感 + 除对话页外一屏放下)
 * 两套主题同一套 token, html[data-theme="ink"] 墨夜(默认) / html[data-theme="paper"] 纸墨
 * 高级感来源: 1 个强调色 + 染色灰阶 + 8pt 网格 + 衬线只用于标题 + 1px 描边 + 留白
 * 类名 API 不变 (card/tile/chip/row/btn/inp/seg/subtabs/pane/tabbar/modal), 模块页零改动即换肤
 * ============================================================ */
html[data-theme="ink"] {
  --bg: #0C0E13;            /* 近黑带蓝 hue, 不用纯黑 */
  --bg2: #10131A;
  --card: #151924;          /* 越浮越亮 */
  --card2: #1C2130;
  --card3: #242A3B;
  --border: #272D3C;
  --border2: #333A4D;
  --text: #ECEAE3;          /* 暖白 */
  --text2: #C9C7BF;
  --muted: #8A8F9E;
  --faint: #5A6070;
  --brand: #CBB283;         /* 香槟金, 去饱和 */
  --brand-ink: #15120A;     /* 金底上的字 */
  --brand-soft: rgba(203,178,131,.13);
  --brand-line: rgba(203,178,131,.35);
  --good: #83B89C; --good-soft: rgba(131,184,156,.14);
  --bad: #D4877D;  --bad-soft: rgba(212,135,125,.14);
  --blue: #8EA6C8; --blue-soft: rgba(142,166,200,.14);
  --gold: #DDA55C; --gold-soft: rgba(221,165,92,.14);
  --ring: rgba(203,178,131,.28);
  --sh-1: 0 1px 0 rgba(255,255,255,.03) inset, 0 1px 2px rgba(0,0,0,.35);
  --sh-2: 0 1px 0 rgba(255,255,255,.04) inset, 0 6px 18px rgba(0,0,0,.35);
  --sh-3: 0 1px 0 rgba(255,255,255,.05) inset, 0 18px 48px rgba(0,0,0,.5);
  --glass: rgba(12,14,19,.82);
  --tab-glass: rgba(16,19,26,.96);
  --hero-grad: linear-gradient(120deg, #1C2130 0%, #1A1E2B 55%, #242A3B 100%);
  --scheme: dark;
}
:root, html[data-theme="paper"] {
  --bg: #F3EFE8;            /* 暖米白 */
  --bg2: #EDE8DF;
  --card: #FBF9F5;
  --card2: #FFFFFF;
  --card3: #F2EDE5;
  --border: #E6E0D5;
  --border2: #D8D0C2;
  --text: #2B2926;          /* 墨, 非纯黑 */
  --text2: #4A4742;
  --muted: #8B8579;
  --faint: #B3ACA0;
  --brand: #9A6B4C;         /* 陶土棕, 去饱和 */
  --brand-ink: #FFFFFF;
  --brand-soft: rgba(154,107,76,.10);
  --brand-line: rgba(154,107,76,.32);
  --good: #5E8C6A; --good-soft: rgba(94,140,106,.12);
  --bad: #B5574A;  --bad-soft: rgba(181,87,74,.12);
  --blue: #5B7691; --blue-soft: rgba(91,118,145,.12);
  --gold: #B08A4A; --gold-soft: rgba(176,138,74,.14);
  --ring: rgba(154,107,76,.22);
  --sh-1: 0 1px 2px rgba(60,50,35,.05), 0 0 0 1px rgba(60,50,35,.02);
  --sh-2: 0 6px 20px rgba(60,50,35,.08), 0 1px 2px rgba(60,50,35,.05);
  --sh-3: 0 18px 48px rgba(60,50,35,.16);
  --glass: rgba(243,239,232,.86);
  --tab-glass: rgba(251,249,245,.97);
  --hero-grad: linear-gradient(120deg, #FFFFFF 0%, #F8F3EB 55%, #F1E9DD 100%);
  --scheme: light;
}
@font-face { font-family: "FateSerif"; src: url("fonts/fate-serif.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
:root {
  --serif: "FateSerif", "Songti SC", "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", STSong, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --r-sm: 10px; --r-md: 16px; --r-lg: 22px;
  --maxw: 640px;
  --topbar-h: 52px;
  --tabbar-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
html { color-scheme: var(--scheme); -webkit-text-size-adjust: 100%; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: .01em; color: var(--text); }
h1 { font-family: var(--serif); font-size: 24px; font-weight: 600; letter-spacing: .02em; }
h2 { font-family: var(--serif); font-size: 18px; letter-spacing: .02em; }
h3 { font-size: 14.5px; }
p { margin: 0; }
::selection { background: var(--brand-soft); }
img, svg { max-width: 100%; }

/* ---------- 布局 ---------- */
.page { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
/* 一屏页: 内容区高度固定为视口减顶栏底栏, 内部不滚, 由各区块自行 flex 分配 */
.screen { height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - var(--safe-b)); display: flex; flex-direction: column; gap: 10px; padding-top: 10px; padding-bottom: 10px; overflow: hidden; }
.screen > .grow { flex: 1 1 auto; min-height: 0; }
body:has(.screen) { padding-bottom: 0; }   /* 一屏页: .screen 已扣掉底栏, body 不再垫 */
@media (max-height: 640px) { .screen { height: auto; overflow: visible; } body:has(.screen) { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); } } /* 矮屏放开滚动兜底 */

/* 顶栏 */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--glass); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--border); }
.topbar .in { max-width: var(--maxw); margin: 0 auto; height: var(--topbar-h); display: grid; grid-template-columns: 72px 1fr 72px; align-items: center; padding: 0 8px; }
.topbar .ttl { text-align: center; font-family: var(--serif); font-size: 16px; font-weight: 600; letter-spacing: .06em; }
.topbar .act { display: flex; gap: 4px; }
.topbar .act.r { justify-content: flex-end; }
.iconbtn { height: 34px; min-width: 34px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--text2); font: inherit; font-size: 13.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.iconbtn:active { background: var(--card2); }

/* 页头: 标题 + 一句副标 */
.hero { padding: 14px 0 8px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.hero h1 em { font-style: normal; color: var(--brand); font-weight: 500; font-size: .72em; margin-left: 6px; letter-spacing: .08em; }
.hero .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px; box-shadow: var(--sh-1); }
.card + .card, .card + .grid, .grid + .card { margin-top: 10px; }
.card.hi { background: var(--card2); box-shadow: var(--sh-2); }
.card.flat { box-shadow: none; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-h h2, .card-h h3 { display: flex; align-items: center; gap: 6px; }
.card-h .more { font-size: 12.5px; color: var(--brand); white-space: nowrap; }
.card-sub { color: var(--muted); font-size: 12.5px; margin-top: -6px; margin-bottom: 10px; }

/* 数据格 */
.grid { display: grid; gap: 8px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 420px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g3.m2 { grid-template-columns: repeat(2, 1fr); } }
.tile { background: var(--card2); border: 1px solid var(--border); border-radius: 12px; padding: 9px 11px; min-width: 0; }
.tile .k { font-size: 11px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.tile .v { font-size: 15.5px; font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.tile .v.big { font-size: 22px; font-family: var(--serif); font-weight: 600; }
.tile .n { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.tile.on { border-color: var(--brand-line); background: var(--brand-soft); }

/* 胶囊 */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12px; background: var(--brand-soft); color: var(--brand); border: 1px solid transparent; line-height: 1.5; white-space: nowrap; }
.chip.gold { background: var(--gold-soft); color: var(--gold); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.blue { background: var(--blue-soft); color: var(--blue); }
.chip.ghost { background: transparent; border-color: var(--border2); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* 行列表 */
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.row:first-child { border-top: 0; padding-top: 0; }
.row .l { min-width: 0; }
.row .l b { display: block; font-size: 14px; font-weight: 600; }
.row .l span { display: block; font-size: 12px; color: var(--muted); }
.row .r { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.row.link { cursor: pointer; }
.row.link:active { opacity: .7; }

/* 表单 */
.field { display: block; margin-bottom: 10px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; letter-spacing: .02em; }
.inp { width: 100%; height: 42px; border: 1px solid var(--border2); border-radius: var(--r-sm); background: var(--card2); color: var(--text); padding: 0 12px; font: inherit; font-size: 15px; outline: 0; transition: border-color .12s, box-shadow .12s; }
.inp::placeholder { color: var(--faint); }
.inp:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.inp:disabled { opacity: .5; }
textarea.inp { height: auto; min-height: 42px; padding: 10px 12px; resize: vertical; }
.frow { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (max-width: 420px) { .frow.s1 { grid-template-columns: 1fr; } }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--card2); border: 1px solid var(--border2); border-radius: var(--r-sm); padding: 3px; gap: 3px; }
.seg label, .seg button { text-align: center; padding: 7px 6px; border-radius: 7px; cursor: pointer; font-size: 13.5px; color: var(--muted); border: 0; background: transparent; font: inherit; }
.seg input { display: none; }
.seg label.on, .seg button.on, .seg label:has(input:checked) { background: var(--card3); color: var(--text); font-weight: 600; box-shadow: var(--sh-1); }
.btn { height: 44px; padding: 0 20px; border: 0; border-radius: var(--r-sm); background: var(--brand); color: var(--brand-ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; letter-spacing: .02em; transition: filter .12s, transform .08s; }
.btn:active { transform: translateY(1px); filter: brightness(.94); }
.btn.w { width: 100%; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border2); }
.btn.ghost:active { background: var(--card2); }
.btn.soft { background: var(--brand-soft); color: var(--brand); }
.btn.sm { height: 34px; padding: 0 13px; font-size: 13px; border-radius: 9px; }
.btn.gold { background: var(--gold); color: var(--brand-ink); }
.btn:disabled { opacity: .45; cursor: default; }

/* 正文 */
.prose { font-size: 14.5px; line-height: 1.75; color: var(--text2); }
.prose b { color: var(--text); font-weight: 600; }
.prose p + p { margin-top: 8px; }
.note { font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }
.good { color: var(--good); } .bad { color: var(--bad); } .gold { color: var(--gold); }

/* 分区标题 */
.sec { display: flex; align-items: baseline; justify-content: space-between; margin: 14px 0 8px; }
.sec h2 { font-size: 16px; }
.sec .more { font-size: 12.5px; color: var(--brand); }

/* 页内页签 (≤6, 横滑) */
.subtabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs button { flex: 0 0 auto; height: 32px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--border2); background: transparent; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; transition: all .12s; }
.subtabs button.on { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; }
html[data-theme="ink"] .subtabs button.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.pane { display: none; } .pane.on { display: block; }

/* 横滑卡组 (一屏页用: 同一位置多张卡, 左右滑) */
.deck { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-left: 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
.deck::-webkit-scrollbar { display: none; }
.deck > * { flex: 0 0 calc(100% - 0px); scroll-snap-align: start; }
.deck.peek > * { flex-basis: 88%; }
.dots { display: flex; gap: 5px; justify-content: center; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--border2); transition: all .15s; }
.dots i.on { background: var(--brand); width: 14px; border-radius: 3px; }

/* 底部 tabbar (≤5 项) */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--tab-glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--border); }
.tabbar .in { max-width: var(--maxw); margin: 0 auto; height: var(--tabbar-h); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 10.5px; letter-spacing: .04em; border: 0; background: transparent; font-family: inherit; cursor: pointer; }
.tabbar .ic { width: 22px; height: 22px; display: block; opacity: .55; }
.tabbar .ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tabbar .on { color: var(--brand); font-weight: 600; position: relative; }
.tabbar .on::after { content: ''; position: absolute; bottom: 6px; width: 18px; height: 3px; border-radius: 2px; background: var(--brand); }
.tabbar .on .ic { opacity: 1; }

/* 弹层 */
.modal-bg { position: fixed; inset: 0; background: rgba(5,6,10,.55); z-index: 100; display: none; align-items: flex-end; justify-content: center; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal-bg.on { display: flex; }
.modal { width: 100%; max-width: var(--maxw); max-height: 84vh; overflow: auto; background: var(--card2); border: 1px solid var(--border); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 18px 18px calc(18px + var(--safe-b)); box-shadow: var(--sh-3); }
@media (min-width: 640px) { .modal-bg { align-items: center; } .modal { border-radius: var(--r-lg); max-width: 520px; } }
.modal h2 { margin-bottom: 8px; padding-right: 30px; }
.modal .x { float: right; border: 0; background: var(--card3); width: 28px; height: 28px; border-radius: 50%; font-size: 16px; color: var(--muted); cursor: pointer; }

/* 评分条 */
.bar { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.bar.gold > i { background: var(--gold); }
.bar.bad > i { background: var(--bad); }
.bar.good > i { background: var(--good); }

/* 空状态 */
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.empty .big { font-size: 36px; margin-bottom: 8px; filter: grayscale(.4); }

/* 表格 */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 11.5px; letter-spacing: .04em; padding: 6px 6px; border-bottom: 1px solid var(--border2); }
.tbl td { padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* 工具 */
.mt8{margin-top:8px}.mt12{margin-top:12px}.mt16{margin-top:16px}.mt20{margin-top:20px}.mb8{margin-bottom:8px}.mb12{margin-bottom:12px}
.flex{display:flex;align-items:center;gap:8px}.between{justify-content:space-between}.wrap{flex-wrap:wrap}
.center{text-align:center}.small{font-size:12.5px}.hide{display:none!important}
.serif{font-family:var(--serif)}
.num{font-variant-numeric:tabular-nums}

/* 质感: 极淡纸纹 (叠在卡片上, 哑光感) */
.grain { position: relative; }
.grain::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: .32; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45 0 0 0 0 .40 0 0 0 0 .33 0 0 0 .18 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>"); }
html[data-theme="ink"] .grain::before { mix-blend-mode: screen; opacity: .10; }
/* 入场: 轻微上浮淡入, 逐个延迟 */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .45s cubic-bezier(.2,.7,.2,1) both; }
.rise:nth-child(2) { animation-delay: .05s } .rise:nth-child(3) { animation-delay: .1s } .rise:nth-child(4) { animation-delay: .15s }
.rise:nth-child(5) { animation-delay: .2s } .rise:nth-child(6) { animation-delay: .25s } .rise:nth-child(7) { animation-delay: .3s } .rise:nth-child(8) { animation-delay: .35s }
@media (prefers-reduced-motion: reduce) { .rise { animation: none; } }

/* ---------- 头卡 (首页定稿, 模块页通用) ---------- */
.hero-c { background: var(--hero-grad); border: 1px solid var(--border); border-radius: 22px; padding: 18px 18px 16px; box-shadow: var(--sh-2), inset 0 1px 0 rgba(255,255,255,.5); min-height: 150px; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.hero-c .art { position: absolute; right: -34px; top: -44px; width: 180px; height: 180px; pointer-events: none; opacity: .9; }
.hero-c .k { position: relative; font-size: 12.5px; color: var(--text2); display: flex; align-items: center; gap: 8px; letter-spacing: .04em; }
.hero-c .k i { width: 1px; height: 12px; background: var(--border2); }
.hero-c .k em { font-style: normal; color: var(--muted); }
.hero-c .big { position: relative; max-width: 72%; display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; font-family: var(--serif); font-size: 28px; font-weight: 600; letter-spacing: .04em; line-height: 1.2; margin-top: 8px; }
.hero-c .big small { font-size: 14px; font-weight: 400; color: var(--text2); font-family: var(--sans); letter-spacing: .02em; }
.hero-c .tip { position: relative; font-size: 12.5px; color: var(--muted); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 74%; }
.hero-c .ft { position: relative; margin-top: auto; padding-top: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--text2); }
.hero-c .ft .more { margin-left: auto; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.hero-c .ft .more::after { content: ' ›'; }
