/*
 * 卦象自有 UI 令牌：黛蓝 #1E3A5F、鎏金 #C9A227、宣纸白 #F7F5F0。
 * 视觉来源：项目 ui/ 位图母版（L2/L3）；CSS 数值为本项目 L5 自建声明值。
 * 375×812 移动优先，8 点网格；禁止紫蓝、紫粉渐变与 Emoji 图标。
 */
:root {
  --dai: #1E3A5F;
  --dai-deep: #101E31;
  --dai-soft: #2E5C8A;
  --gold: #C9A227;
  --gold-light: #E3C97B;
  --gold-pale: #F1E5BD;
  --paper: #F7F5F0;
  --paper-deep: #EEE9DE;
  --white: #FFFFFF;
  --ink: #1A1A1A;
  --ink-2: #4A4A4A;
  --ink-3: #737982;
  --line: #D9D5CC;
  --success: #2F7358;
  --warning: #946515;
  --danger: #A43D32;
  --danger-pale: #F8E8E4;
  --mist: #EAF1F8;
  --dark-muted: #B9C6D5;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 16px rgba(30, 58, 95, .08);
  --shadow-raised: 0 10px 28px rgba(4, 16, 30, .24);
  --font-serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", STSong, serif;
  --font-sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; background: var(--dai-deep); }
body { min-height: 100%; color: var(--ink); background: var(--dai-deep); font-family: var(--font-sans); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { min-height: 44px; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { border-radius: 0; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
::selection { color: var(--dai-deep); background: var(--gold-light); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.page-light :focus-visible { outline-color: var(--dai-soft); }

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.app-shell { position: relative; width: 100%; max-width: 430px; height: 100dvh; min-height: 568px; margin: 0 auto; overflow: hidden; background: var(--paper); }
#app-main { position: absolute; inset: 0; }
.page { position: absolute; inset: 0; display: none; flex-direction: column; min-width: 0; overflow: hidden; }
.page.active { display: flex; }
.page-dark { color: var(--white); background: var(--dai-deep); }
.page-light { color: var(--ink); background: var(--paper); }
.page-scroll { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 8px 20px 32px; scrollbar-width: thin; }
.page-scroll.with-tab { padding-bottom: 104px; }
.page-scroll.with-tab button, .page-scroll.with-tab input, .page-scroll.with-tab textarea, .page-scroll.with-tab select { scroll-margin-block: 96px; }

/* 通用导航与文字 */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 64px; padding: max(8px, env(safe-area-inset-top)) 12px 8px; flex: none; border-bottom: 1px solid transparent; }
.page-light .topbar { border-bottom-color: rgba(30, 58, 95, .08); }
.topbar h1 { min-width: 0; font-family: var(--font-serif); font-size: 20px; font-weight: 600; line-height: 1.25; text-align: center; }
.topbar-spacer { width: 44px; flex: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none; color: inherit; background: transparent; border: 0; border-radius: 50%; }
.icon-btn:hover { background: rgba(201, 162, 39, .1); }
.gold-ring { color: var(--gold-light); border: 1px solid rgba(227, 201, 123, .65); }
.text-action { min-width: 44px; min-height: 44px; padding: 0 6px; color: var(--dai); background: none; border: 0; font-size: 14px; }
.page-dark .text-action { color: var(--gold-light); }
.danger-icon { color: var(--danger); }
h1, h2, h3 { overflow-wrap: anywhere; }
h2 { font-family: var(--font-serif); font-size: 22px; line-height: 1.4; }
h3 { font-family: var(--font-serif); font-size: 18px; line-height: 1.45; }
p { overflow-wrap: anywhere; }
.eyebrow { color: var(--gold-light); font-size: 12px; letter-spacing: 2px; }
.eyebrow.ink { color: var(--dai-soft); }
.page-intro, .dark-intro { margin: 8px 0 20px; color: var(--ink-2); line-height: 1.8; }
.dark-intro { color: var(--dark-muted); text-align: center; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; margin: 24px 0 12px; }
.section-heading h2 { font-size: 18px; }
.section-heading span { color: var(--dark-muted); font-size: 12px; }
.muted { color: var(--ink-3); }
.dark-footnote { margin-top: 16px; color: var(--dark-muted); font-size: 12px; line-height: 1.7; text-align: center; }

/* 按钮与表单 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; padding: 12px 20px; border: 1px solid transparent; border-radius: 24px; font-weight: 600; line-height: 1.4; transition: background-color .18s ease, color .18s ease, border-color .18s ease; }
.btn .icon { width: 20px; height: 20px; }
.btn-primary { color: var(--white); background: var(--dai); border-color: var(--dai); }
.btn-secondary { color: var(--dai); background: var(--mist); border-color: #CCD9E6; }
.btn-gold { color: var(--dai-deep); background: var(--gold-light); border-color: var(--gold-light); }
.btn-outline-light { color: var(--gold-light); background: transparent; border-color: rgba(227, 201, 123, .65); }
.btn-raised { box-shadow: var(--shadow-raised); }
.btn-compact { width: auto; min-width: 104px; min-height: 44px; padding: 8px 16px; }
.btn-danger { color: var(--white); background: var(--danger); border-color: var(--danger); }
.row2 { display: flex; gap: 12px; margin-top: 16px; }
.row2 > * { flex: 1; min-width: 0; }
.field { display: block; margin-bottom: 16px; color: var(--white); }
.field > span { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.field small { color: inherit; opacity: .72; font-size: 12px; }
.field input, .field textarea, .field select { width: 100%; min-height: 48px; padding: 12px 14px; color: var(--ink); background: var(--white); border: 1px solid transparent; border-radius: var(--radius-sm); }
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--gold); }
.field-light { color: var(--dai); }
.field-light input, .field-light textarea, .field-light select { border-color: var(--line); }
.form-message { min-height: 24px; margin: -4px 0 8px; color: var(--gold-light); font-size: 13px; }
.page-light .form-message, .modal .form-message { color: var(--danger); }
.consent-row { display: flex; align-items: flex-start; gap: 10px; margin: 4px 0 12px; color: var(--dark-muted); font-size: 12px; line-height: 1.8; }
.consent-row input { width: 20px; height: 20px; min-height: 20px; margin-top: 1px; flex: none; accent-color: var(--gold); }
.text-link { display: inline; min-height: 44px; padding: 0; color: var(--gold-light); background: none; border: 0; vertical-align: baseline; }
.segmented { display: flex; padding: 4px; border-radius: var(--radius-md); }
.segmented button { flex: 1; border: 0; border-radius: var(--radius-sm); }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 20px 12px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip { min-height: 44px; padding: 9px 16px; flex: none; color: var(--ink-2); background: var(--white); border: 1px solid var(--line); border-radius: 22px; white-space: nowrap; }
.chip.selected, .chip[aria-pressed="true"] { color: var(--white); background: var(--dai); border-color: var(--dai); }

/* 登录 S1：账号密码为产品决定，不沿用原稿短信交互 */
#p-login { overflow-y: auto; background: var(--dai-deep); }
.login-content { position: relative; z-index: 1; width: 100%; max-width: 360px; min-height: 100%; margin: 0 auto; padding: max(48px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; justify-content: center; }
.brand-mark { display: grid; place-items: center; width: 88px; height: 88px; margin: 0 auto 16px; color: var(--gold-light); border: 1px solid var(--gold); border-radius: 50%; box-shadow: inset 0 0 0 8px var(--dai-deep), inset 0 0 0 9px rgba(201, 162, 39, .4); }
.brand-mark .icon { width: 68px; height: 68px; stroke-width: 1.2; }
.login-content > .eyebrow { text-align: center; }
.login-content h1 { margin: 2px 0; font-family: var(--font-serif); font-size: 42px; font-weight: 600; letter-spacing: 10px; text-align: center; }
.brand-caption { margin-bottom: 24px; color: var(--dark-muted); font-family: var(--font-serif); text-align: center; letter-spacing: 3px; }
.auth-tabs { margin-bottom: 20px; background: rgba(255, 255, 255, .06); }
.auth-tabs button { color: var(--dark-muted); background: transparent; }
.auth-tabs button.selected { color: var(--dai-deep); background: var(--gold-light); }
#btn-guest { margin-top: 12px; }
.login-note { margin-top: 16px; color: var(--dark-muted); font-size: 12px; text-align: center; }
.design-entry { display: block; min-height: 44px; padding: 12px 0 0; color: var(--dark-muted); font-size: 12px; text-align: center; text-decoration: underline; text-underline-offset: 4px; }
.login-cloud { position: absolute; width: 150px; height: 56px; border: 1px solid rgba(201, 162, 39, .18); border-radius: 50%; pointer-events: none; }
.cloud-one { top: 44px; right: 0; }
.cloud-two { bottom: 64px; left: 0; }

/* 首页 S2 */
.home-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px 0 20px; }
.home-header h1 { margin: 4px 0; font-family: var(--font-serif); font-size: 26px; font-weight: 600; }
.home-lunar { color: var(--dark-muted); font-size: 13px; }
.calendar-card { position: relative; margin-bottom: 20px; padding: 20px; background: #172C47; border: 1px solid rgba(227, 201, 123, .45); border-radius: var(--radius-lg); box-shadow: var(--shadow-raised); }
.calendar-card::before { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(227, 201, 123, .1); border-radius: 11px; pointer-events: none; }
.calendar-card-head { position: relative; display: flex; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.calendar-card-head h2 { color: var(--gold-light); font-size: 20px; }
.calendar-card-head span { color: var(--dark-muted); font-size: 12px; }
.calendar-day-line { position: relative; margin-bottom: 16px; font-family: var(--font-serif); font-size: 24px; font-weight: 600; }
.calendar-tags { position: relative; display: flex; flex-wrap: wrap; gap: 8px; }
.calendar-tags span { padding: 4px 10px; color: #EDF2F7; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .09); border-radius: 6px; font-size: 12px; }
.calendar-meta { position: relative; margin-top: 14px; color: var(--dark-muted); font-size: 12px; }
.home-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 8px; }
.home-grid button { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; color: #E8EDF3; background: transparent; border: 0; font-size: 12px; }
.home-grid .grid-icon { display: grid; place-items: center; width: 48px; height: 48px; color: var(--gold-light); border: 1px solid rgba(227, 201, 123, .55); border-radius: 50%; }
.home-grid .grid-icon .icon { width: 25px; height: 25px; }
.festival-banner { display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 96px; margin-top: 24px; padding: 16px 20px; color: var(--gold-light); text-align: left; background: #172C47; border: 1px solid rgba(227, 201, 123, .4); border-radius: var(--radius-md); }
.festival-banner strong { margin: 2px 0; font-family: var(--font-serif); font-size: 20px; }
.festival-banner > span:last-child { color: var(--dark-muted); font-size: 12px; }
.banner-kicker { font-size: 11px; letter-spacing: 2px; }
.classic-quote { margin: 20px 0 8px; color: var(--dark-muted); font-family: var(--font-serif); font-size: 14px; line-height: 1.9; text-align: center; }
.classic-quote cite { display: block; font-size: 12px; font-style: normal; }

/* 卡片、加载、空态与错误 */
.card { min-width: 0; margin-bottom: 16px; padding: 20px; background: var(--white); border: 1px solid rgba(30, 58, 95, .07); border-radius: var(--radius-md); box-shadow: var(--shadow); }
.card h3 { margin-bottom: 12px; color: var(--dai); }
.card p { color: var(--ink-2); }
.state-box { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 176px; padding: 24px 16px; color: var(--ink-3); text-align: center; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-md); }
.page-dark .state-box { color: var(--dark-muted); background: #172C47; border-color: rgba(227, 201, 123, .24); }
.state-box .icon { width: 32px; height: 32px; margin-bottom: 12px; color: var(--gold); }
.state-box strong { margin-bottom: 4px; color: inherit; font-size: 16px; }
.state-box .btn { width: auto; min-width: 144px; margin-top: 16px; }
.error-text { color: var(--danger); }
.page-dark .error-text { color: #F1B8AE; }
.loading-spinner { width: 28px; height: 28px; margin-bottom: 16px; border: 2px solid rgba(201, 162, 39, .25); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.success-banner { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; padding: 12px 14px; color: var(--success); background: #E8F3ED; border: 1px solid #C9E2D4; border-radius: var(--radius-sm); }
.success-banner .icon { width: 20px; height: 20px; margin-top: 2px; }

/* 主题与方式 S3/S4 */
.theme-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.theme-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; min-width: 0; min-height: 136px; padding: 16px; color: var(--dai); text-align: left; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow); }
.theme-card .icon { margin-bottom: 10px; color: var(--gold); }
.theme-card strong { font-family: var(--font-serif); font-size: 18px; }
.theme-card small { margin-top: 4px; color: var(--ink-3); line-height: 1.5; }
.theme-card.selected { border: 2px solid var(--gold); background: #FFFCF3; padding: 15px; }
.theme-card.selected::after { content: "已选"; position: absolute; top: 8px; right: 8px; color: var(--warning); font-size: 10px; }
.selection-note { min-height: 44px; padding: 10px 0; color: var(--ink-3); font-size: 13px; }
.way-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.way-card { position: relative; min-width: 0; min-height: 176px; padding: 20px 12px; color: var(--white); text-align: center; background: #172C47; border: 1px solid rgba(227, 201, 123, .2); border-radius: var(--radius-md); }
.way-card .icon { width: 36px; height: 36px; margin: 0 auto 12px; color: var(--gold-light); }
.way-card strong { display: block; font-family: var(--font-serif); font-size: 18px; }
.way-card small { display: block; margin-top: 8px; color: var(--dark-muted); }
.way-card.selected { border: 2px solid var(--gold-light); background: #1E3552; padding: 19px 11px; }
.recommend-tag { position: absolute; top: 0; right: 0; padding: 3px 8px; color: var(--dai-deep); background: var(--gold-light); border-radius: 0 10px 0 8px; font-size: 10px; }
.subtle-action { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; margin: 16px 0; padding: 8px 12px; color: var(--gold-light); background: transparent; border: 0; }
.subtle-action .icon { width: 20px; height: 20px; }

/* 六次三钱 S5 */
.ritual-content { text-align: center; }
.ritual-step { margin-top: 4px; color: var(--gold-light); font-family: var(--font-serif); font-size: 26px; }
.ritual-help { color: var(--dark-muted); font-size: 13px; }
.coin-ritual { position: relative; display: grid; place-items: center; width: 248px; height: 248px; margin: 24px auto; }
.ritual-ring { position: absolute; border: 1px solid rgba(227, 201, 123, .5); border-radius: 50%; }
.ring-outer { inset: 0; box-shadow: inset 0 0 0 10px var(--dai-deep), inset 0 0 0 11px rgba(227, 201, 123, .16); }
.ring-inner { inset: 34px; border-style: dashed; }
.coin-set { position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; }
.coin { display: grid; place-items: center; width: 68px; height: 68px; margin: 0 -5px; color: #5C4612; background: var(--gold-light); border: 4px double #8E701C; border-radius: 50%; box-shadow: 0 6px 16px rgba(0, 0, 0, .35); font-family: var(--font-serif); font-size: 20px; }
.coin:nth-child(2) { transform: translateY(-22px); }
.coin-set.casting .coin { animation: coin-cast .32s ease-in-out; }
.coin-set.casting .coin:nth-child(2) { animation-delay: .04s; }
.coin-set.casting .coin:nth-child(3) { animation-delay: .08s; }
@keyframes coin-cast { 50% { transform: translateY(-14px) rotate(8deg); } }
.six-progress { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 16px; }
.six-progress span { height: 5px; background: rgba(255, 255, 255, .16); border-radius: 3px; }
.six-progress span.done { background: var(--gold-light); }
.coin-history { min-height: 80px; margin-bottom: 16px; color: var(--dark-muted); font-size: 13px; }
.coin-history p { margin-bottom: 6px; }
.coin-history ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; list-style: none; }
.coin-history li { padding: 4px 8px; color: var(--gold-light); border: 1px solid rgba(227, 201, 123, .28); border-radius: 6px; }

/* 结果 S6 */
.result-summary { position: relative; padding-top: 28px; text-align: center; }
.seal { display: inline-grid; place-items: center; width: 40px; height: 40px; margin-bottom: 12px; color: var(--warning); border: 1px solid var(--gold); border-radius: 7px; font-family: var(--font-serif); }
.result-summary h2 { color: var(--dai); font-size: 26px; }
.result-summary .result-subtitle { margin: 8px 0 16px; color: var(--ink-2); }
.rule-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; color: var(--dai); background: var(--mist); border-radius: 6px; font-size: 12px; }
.rule-badge .icon { width: 16px; height: 16px; }
.hex-names { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; text-align: center; }
.hex-names > div { padding: 12px 8px; background: var(--paper); border-radius: var(--radius-sm); }
.hex-names span { display: block; color: var(--ink-3); font-size: 12px; }
.hex-names strong { display: block; color: var(--dai); font-family: var(--font-serif); font-size: 22px; }
.hex-diagrams { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hex-diagram { min-width: 0; text-align: center; }
.hex-diagram h4 { margin-bottom: 10px; color: var(--dai); font-size: 13px; }
.yao-list { display: flex; flex-direction: column-reverse; gap: 8px; }
.yao-row { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 14px; }
.yao-bar { position: relative; width: 88px; height: 9px; flex: none; }
.yao-bar::before, .yao-bar::after { content: ""; position: absolute; top: 0; bottom: 0; background: var(--dai); }
.yao-bar.yang::before { left: 0; right: 0; }
.yao-bar.yin::before { left: 0; width: 42%; }
.yao-bar.yin::after { right: 0; width: 42%; }
.yao-row.moving .yao-bar::before, .yao-row.moving .yao-bar::after { background: var(--gold); }
.yao-row small { width: 20px; color: var(--warning); font-size: 10px; }
.hex-caption { margin-top: 16px; color: var(--ink-3); font-size: 12px; text-align: center; }
.classic-text { color: var(--dai); font-family: var(--font-serif); font-size: 16px; line-height: 1.9; }
.plain-text { margin-top: 10px; color: var(--ink-2); line-height: 1.9; }
.rule-box { padding: 16px; background: var(--mist); border-left: 3px solid var(--dai); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.rule-box p { margin-top: 8px; }
.result-actions { display: grid; gap: 12px; margin-top: 16px; }
.saved-indicator { margin-top: 12px; color: var(--success); font-size: 13px; text-align: center; }

/* 规则对话 S7 */
.chat-title h1 { font-size: 18px; }
.chat-title span { display: block; color: var(--gold-light); font-family: var(--font-sans); font-size: 10px; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px; }
.bubble { max-width: 88%; margin-bottom: 12px; padding: 12px 14px; border-radius: var(--radius-md); font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; white-space: pre-wrap; }
.bubble.assistant { margin-right: auto; color: var(--dai); background: var(--mist); border: 1px solid #D6E1EC; border-top-left-radius: 4px; }
.bubble.user { margin-left: auto; color: var(--white); background: var(--dai-soft); border-top-right-radius: 4px; }
.bubble.crisis { color: #722B24; background: #FFF0EC; border: 1px solid #E9B8AF; }
.bubble small { display: block; margin-top: 8px; opacity: .76; font-size: 11px; }
.chat-quick { display: flex; gap: 8px; overflow-x: auto; padding: 8px 20px; }
.chat-quick .chip { min-height: 44px; color: var(--gold-light); background: transparent; border-color: rgba(227, 201, 123, .4); }
.chat-bottom { flex: none; padding: 0 20px max(12px, env(safe-area-inset-bottom)); }
.quota-row { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; color: var(--dark-muted); font-size: 10px; }
.chat-inputbar { display: flex; gap: 8px; }
.chat-inputbar input { min-width: 0; min-height: 48px; flex: 1; padding: 10px 16px; color: var(--ink); background: var(--white); border: 1px solid var(--gold-light); border-radius: 24px; }
.send-btn { width: 48px; height: 48px; color: var(--dai-deep); background: var(--gold-light); }
.send-btn:hover { background: var(--gold-light); }
.chat-disclaimer { margin-top: 8px; color: var(--dark-muted); font-size: 10px; text-align: center; }

/* 卦例库 S8 */
.records-tools { flex: none; padding-top: 12px; }
.search-box { display: flex; align-items: center; gap: 8px; min-height: 48px; margin: 0 20px 8px; padding: 0 12px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.search-box .icon { width: 20px; height: 20px; color: var(--ink-3); }
.search-box input { min-width: 0; min-height: 44px; flex: 1; background: transparent; border: 0; outline: 0; }
.record-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 104px; margin-bottom: 12px; padding: 16px; color: var(--ink); text-align: left; background: var(--white); border: 1px solid rgba(30, 58, 95, .07); border-radius: var(--radius-md); box-shadow: var(--shadow); }
.record-symbol { display: grid; place-items: center; width: 44px; height: 44px; flex: none; color: var(--warning); background: var(--gold-pale); border-radius: 50%; }
.record-symbol .icon { width: 22px; height: 22px; }
.record-copy { min-width: 0; flex: 1; }
.record-copy strong { display: block; overflow-wrap: anywhere; color: var(--dai); font-size: 16px; }
.record-copy span { display: block; margin-top: 4px; color: var(--ink-3); font-size: 12px; }
.record-item > .icon { width: 20px; height: 20px; color: var(--ink-3); }
.detail-list { display: grid; gap: 0; }
.detail-list div { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--paper-deep); }
.detail-list div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--ink-3); }
.detail-list dd { min-width: 0; overflow-wrap: anywhere; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.daliuren-term { display: inline-block; margin-inline-end: 0.5em; white-space: nowrap; }
.detail-list .detail-report-id { grid-template-columns: minmax(0, 1fr); gap: 4px; }
.detail-report-id dd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.7; letter-spacing: 0; word-break: break-all; }
.saved-indicator { overflow-wrap: anywhere; word-break: break-all; font-variant-numeric: tabular-nums; }
.advice-list, .ordered-list { margin: 0 0 16px 20px; color: var(--ink-2); }
.advice-list li, .ordered-list li { margin-bottom: 8px; padding-left: 4px; }
.period-card h2 { margin: 8px 0 12px; color: var(--dai); }
.period-year-card h2 { color: var(--dai); font-size: 18px; }
#period-year-trend { display: block; width: 100%; margin-top: 12px; }
#period-year-trend text { fill: var(--ink-2); font: 12px var(--font-sans); }
.period-chart-grid { stroke: var(--line); }
.period-chart-line { fill: none; stroke: var(--dai); stroke-width: 2; }
.period-chart-point { fill: var(--dai); }
.period-highlights { display: grid; gap: 12px; margin: 12px 0 0; padding-left: 20px; }
.period-highlights strong { color: var(--dai); }
.period-highlights p { margin: 4px 0 0; color: var(--ink-2); line-height: 1.65; }
.decision-label { display: inline-block; margin: 8px 0 12px; padding: 4px 8px; color: var(--warning); background: var(--gold-pale); border-radius: 4px; font-size: 11px; }

/* 罗盘 S10 */
.luopan-content { text-align: center; }
.sensor-status { min-height: 44px; padding: 8px 12px; color: var(--dark-muted); font-size: 12px; }
.compass-wrap { display: grid; place-items: center; padding: 12px 0; }
.compass { position: relative; width: 264px; height: 264px; color: var(--gold-light); background: #152A44; border: 3px solid var(--gold); border-radius: 50%; box-shadow: 0 0 0 8px var(--dai-deep), 0 0 0 9px rgba(227, 201, 123, .3); }
.compass-ring { position: absolute; border: 1px solid rgba(227, 201, 123, .5); border-radius: 50%; }
.compass .ring-one { inset: 18px; }
.compass .ring-two { inset: 54px; border-style: dashed; }
.compass-cardinal { position: absolute; font-family: var(--font-serif); font-size: 16px; }
.compass-cardinal.north { top: 24px; left: 50%; transform: translateX(-50%); }
.compass-cardinal.south { bottom: 24px; left: 50%; transform: translateX(-50%); }
.compass-cardinal.east { top: 50%; right: 26px; transform: translateY(-50%); }
.compass-cardinal.west { top: 50%; left: 26px; transform: translateY(-50%); }
.compass-symbols { position: absolute; top: 50%; left: 50%; width: 150px; transform: translate(-50%, -50%) rotate(-18deg); color: rgba(227, 201, 123, .58); font-family: var(--font-serif); font-size: 13px; line-height: 3; word-break: break-all; }
.needle { position: absolute; top: 24px; bottom: 50%; left: calc(50% - 1px); width: 2px; background: var(--gold-light); transform-origin: 50% 100%; transform: rotate(0deg); }
.needle::before { content: ""; position: absolute; top: -4px; left: -5px; width: 0; height: 0; border-right: 6px solid transparent; border-bottom: 12px solid var(--gold-light); border-left: 6px solid transparent; }
.compass-center { position: absolute; top: 50%; left: 50%; display: grid; place-items: center; width: 56px; height: 56px; transform: translate(-50%, -50%); color: var(--gold-light); background: var(--dai-deep); border: 1px solid var(--gold); border-radius: 50%; }
.compass-center .icon { width: 42px; height: 42px; }
.angle-read { margin: 16px 0; }
.angle-read strong { display: block; color: var(--gold-light); font-family: var(--font-serif); font-size: 34px; line-height: 1.2; }
.angle-read span { display: block; margin-top: 6px; color: var(--dark-muted); font-size: 13px; }
.angle-read #angle-boundary { color: var(--gold-light); }
.angle-read #angle-boundary[hidden] { display: none; }
.angle-controls { display: flex; align-items: center; gap: 8px; }
.angle-controls input { min-width: 0; min-height: 44px; flex: 1; accent-color: var(--gold); }

/* 家居 S11 */
.fs-spaces { flex: none; padding-top: 12px; }
.space-illustration { display: grid; place-items: center; height: 128px; margin-bottom: 20px; color: var(--gold); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.space-illustration .icon { width: 64px; height: 64px; stroke-width: 1; }
.checklist { list-style: none; }
.checklist li { border-bottom: 1px solid var(--paper-deep); }
.checklist li:last-child { border-bottom: 0; }
.checklist label { display: flex; align-items: center; gap: 12px; min-height: 52px; color: var(--ink-2); cursor: pointer; }
.checklist input { width: 22px; height: 22px; flex: none; accent-color: var(--dai); }
.checklist input:checked + span { color: var(--ink-3); text-decoration: line-through; }

/* 黄历 S12 */
.calendar-tools { display: flex; align-items: flex-end; gap: 8px; flex: none; padding: 12px 20px 4px; }
.calendar-tools .field { min-width: 0; flex: 1; margin-bottom: 0; }
.almanac-date { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.almanac-date > strong { color: var(--gold); font-family: var(--font-serif); font-size: 64px; font-weight: 500; line-height: 1; }
.almanac-date h2 { color: var(--dai); }
.almanac-date p { color: var(--ink-3); font-size: 13px; }
.yiji-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.yiji-grid h3 { display: flex; align-items: center; gap: 6px; }
.yiji-grid .yi h3 { color: var(--success); }
.yiji-grid .ji h3 { color: var(--danger); }
.yiji-grid ul { list-style: none; }
.yiji-grid li { padding: 6px 0; color: var(--ink-2); }
.matter-row { margin: 8px 0 16px; }
.matter-row .chip-row { padding: 4px 0 12px; }
.matter-verdict { margin-top: 12px; padding: 12px; color: var(--dai); background: var(--mist); border-radius: var(--radius-sm); }
.auspicious-list { list-style: none; }
.auspicious-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 8px 0; border-bottom: 1px solid var(--paper-deep); }
.auspicious-list time { color: var(--dai); font-weight: 600; }
.auspicious-list span { color: var(--ink-3); font-size: 12px; text-align: right; }

/* 会员 S13 */
.vip-heading { padding: 20px 0; text-align: center; }
.vip-heading > .icon { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--gold-light); }
.vip-heading h2 { color: var(--gold-light); }
.vip-heading p { margin-top: 6px; color: var(--dark-muted); font-size: 13px; }
.vip-card { padding: 24px 20px; background: #172C47; border: 1px solid var(--gold); border-radius: var(--radius-md); }
.vip-card > p { color: var(--gold-light); font-family: var(--font-serif); font-size: 18px; text-align: center; }
.vip-price { display: flex; align-items: baseline; justify-content: center; gap: 5px; margin: 12px 0 20px; color: var(--gold-light); }
.vip-price strong { font-family: var(--font-serif); font-size: 64px; font-weight: 500; line-height: 1; }
.vip-price del { margin-left: 8px; color: var(--dark-muted); font-size: 13px; }
.vip-rights { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 16px; border-top: 1px solid rgba(227, 201, 123, .2); list-style: none; color: #E7EDF3; font-size: 13px; }
.vip-rights li::before { content: "·"; margin-right: 6px; color: var(--gold-light); }
.price-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 20px 0; }
.price-opts button { min-width: 0; padding: 8px 4px; color: var(--dark-muted); background: transparent; border: 1px solid rgba(227, 201, 123, .3); border-radius: var(--radius-sm); }
.price-opts button span { display: block; color: var(--gold-light); }
.price-opts button.selected { color: var(--white); background: #1E3552; border-color: var(--gold-light); }
.youth-payment-note { margin-bottom: 12px; padding: 12px; color: #F4C7BD; background: rgba(164, 61, 50, .18); border: 1px solid rgba(244, 199, 189, .35); border-radius: var(--radius-sm); font-size: 13px; }

/* 我的 S14 */
.profile-card { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.avatar { display: grid; place-items: center; width: 56px; height: 56px; flex: none; color: var(--dai); background: var(--mist); border: 2px solid var(--dai); border-radius: 50%; }
.profile-copy { min-width: 0; flex: 1; }
.profile-copy h2 { color: var(--dai); font-size: 20px; }
.profile-copy p { color: var(--ink-3); font-size: 12px; }
.seal-tag { padding: 3px 7px; color: var(--warning); border: 1px solid var(--gold); border-radius: 4px; font-size: 11px; }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); text-align: center; }
.stat-row > * { min-width: 0; color: var(--ink); background: transparent; border: 0; }
.stat-row strong { display: block; color: var(--gold); font-family: var(--font-serif); font-size: 20px; overflow-wrap: anywhere; }
.stat-row span { display: block; color: var(--ink-3); font-size: 11px; }
.referral-card { display: grid; gap: 12px; }
.referral-card h2, .referral-card h3 { color: var(--dai); }
.referral-card h2 { font-size: 18px; }
.referral-card h3 { font-size: 15px; }
.referral-card .plain-text { margin: 0; }
.referral-card .field { margin-bottom: 10px; }
.referral-card input { min-width: 0; }
#share-poster { position: fixed; inset: 0; margin: auto; width: min(92vw, 420px); max-height: 92dvh; padding: 16px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--dai); background: var(--paper); }
#share-poster::backdrop { background: rgb(16 30 49 / 72%); }
#share-poster header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#share-poster h2 { font-size: 18px; }
#share-poster-image { display: block; width: min(100%, 45dvh); height: auto; margin: 8px auto 16px; border: 1px solid var(--line); }
.share-poster-actions { display: grid; gap: 8px; }
#share-poster-status:empty { display: none; }
#auth-invite { margin-bottom: 12px; text-align: left; }
#auth-invite-remove { display: block; min-height: 44px; }
.menu-card { padding-top: 4px; padding-bottom: 4px; }
.menu-card > button, .menu-card > a { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; color: var(--ink); text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--paper-deep); }
.menu-card > *:last-child { border-bottom: 0; }
.menu-card > * > .icon { width: 22px; height: 22px; color: var(--dai); }
.menu-card > * > span { flex: 1; }
.menu-card .arrow { width: 18px; height: 18px; color: var(--ink-3); }
.menu-card strong { color: var(--ink-3); font-size: 12px; font-weight: 400; }
.app-disclaimer { color: var(--ink-3); font-size: 11px; line-height: 1.8; text-align: center; }

/* 底部导航 */
.tabbar { position: absolute; right: 0; bottom: 0; left: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); min-height: calc(72px + env(safe-area-inset-bottom)); padding: 4px 8px env(safe-area-inset-bottom); background: rgba(247, 245, 240, .98); border-top: 1px solid var(--line); }
.tabbar.on-dark { background: rgba(16, 30, 49, .98); border-top-color: rgba(227, 201, 123, .18); }
.tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; min-height: 56px; color: var(--ink-3); background: transparent; border: 0; font-size: 11px; }
.tabbar button .icon { width: 23px; height: 23px; }
.tabbar.on-dark button { color: var(--dark-muted); }
.tabbar button.selected, .tabbar.on-dark button.selected { color: var(--dai); }
.tabbar.on-dark button.selected { color: var(--gold-light); }

/* 弹层、确认与反馈 */
.modal-backdrop { position: absolute; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; padding: 20px 16px max(20px, env(safe-area-inset-bottom)); background: rgba(4, 13, 24, .72); }
.modal { width: 100%; max-width: 398px; max-height: 88%; overflow-y: auto; padding: 20px; color: var(--ink); background: var(--paper); border: 1px solid var(--gold); border-radius: var(--radius-lg); box-shadow: var(--shadow-raised); }
.modal > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal > header h2 { color: var(--dai); font-size: 20px; }
.modal-content { color: var(--ink-2); line-height: 1.85; }
.modal-content h3 { margin: 16px 0 6px; font-size: 16px; }
.modal-content p { margin-bottom: 10px; }
.modal-content ul { margin: 0 0 12px 20px; }
.modal-actions { display: flex; gap: 12px; margin-top: 20px; }
.modal-actions:empty { display: none; }
.modal-actions .btn { min-width: 0; }
.modal-note { margin-bottom: 16px; color: var(--ink-3); font-size: 12px; }
.gender-field { display: flex; gap: 12px; margin-bottom: 16px; border: 0; }
.gender-field legend { margin-bottom: 6px; color: var(--dai); font-size: 13px; }
.gender-field label { display: flex; align-items: center; gap: 8px; min-width: 88px; min-height: 44px; padding: 8px 16px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.gender-field input { width: 18px; height: 18px; accent-color: var(--dai); }
.toast { position: absolute; bottom: 96px; left: 50%; z-index: 150; width: max-content; max-width: calc(100% - 40px); padding: 10px 16px; color: var(--white); background: rgba(10, 21, 34, .96); border: 1px solid rgba(227, 201, 123, .35); border-radius: 22px; box-shadow: var(--shadow-raised); font-size: 13px; text-align: center; opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 520px) {
  body { display: grid; place-items: center; padding: 20px; }
  .app-shell { height: min(812px, calc(100dvh - 40px)); border: 1px solid rgba(227, 201, 123, .24); border-radius: 24px; box-shadow: 0 24px 80px rgba(0, 0, 0, .45); }
}
@media (max-width: 340px) {
  .page-scroll { padding-right: 16px; padding-left: 16px; }
  .login-content { padding-right: 20px; padding-left: 20px; }
  .home-grid { gap: 12px 4px; }
  .home-grid .grid-icon { width: 44px; height: 44px; }
  .coin-ritual { width: 224px; height: 224px; }
  .coin { width: 60px; height: 60px; }
  .compass { width: 232px; height: 232px; }
  .compass-symbols { width: 126px; font-size: 12px; }
  .compass-cardinal.east { right: 20px; }
  .compass-cardinal.west { left: 20px; }
  .calendar-tools { padding-right: 16px; padding-left: 16px; }
  .calendar-tools .btn-compact { min-width: 88px; padding-right: 10px; padding-left: 10px; }
  .chip-row { padding-right: 16px; padding-left: 16px; }
  .yao-bar { width: 72px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

#record-detail-body details > summary,
.time-precision > summary {
  min-height: 44px;
  align-content: center;
  color: var(--dai);
  cursor: pointer;
  font-weight: 600;
}

#record-detail-body details a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--dai);
  text-underline-offset: 3px;
}

.time-precision {
  margin-bottom: 12px;
}

.report-modal {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.report-modal form {
  min-height: 0;
  overflow-y: auto;
}

.report-modal > button {
  flex: none;
  margin-top: 12px;
}

.report-modal form:has(.time-precision[open] #save-time) .approximate-time {
  display: none;
}

.flight-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.flight-table th,
.flight-table td {
  padding: 8px 2px;
  border-bottom: 1px solid var(--line);
}

.ziwei-palaces { margin: 12px 0; }
.ziwei-palaces > div {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.ziwei-palaces dt { font-weight: 600; color: var(--dai); }
.ziwei-palaces dd, .ziwei-palaces p { margin: 0; }
.ziwei-stars {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 9px;
  padding: 0;
  margin: 4px 0 0;
  list-style: none;
}
.ziwei-stars li { white-space: nowrap; }
.ziwei-stars .major { font-weight: 600; color: var(--dai); }

#xiangshu-results summary {
  min-height: 44px;
  padding-block: 10px;
  color: var(--dai);
  cursor: pointer;
}

#luopan-reference {
  color: var(--ink);
  text-align: start;
}
#luopan-reference summary {
  min-height: 44px;
  padding-block: 10px;
  color: var(--dai);
  cursor: pointer;
}
.luopan-layer { border-top: 1px solid var(--line); }
.content-flag > summary, .name-knowledge > summary { min-height: 44px; align-content: center; color: var(--dai); }
.luopan-study-dial {
  position: relative;
  width: min(100%, 280px);
  aspect-ratio: 1;
  margin: 12px auto 20px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 0 0 6px var(--paper-deep);
}
.luopan-study-center, .luopan-study-mark {
  position: absolute;
  transform: translate(-50%, -50%);
  color: var(--dai);
  white-space: nowrap;
}
.luopan-study-center { inset: 50% auto auto 50%; font-weight: 600; }
.luopan-study-mark { font-size: 11px; }
.knowledge-content summary {
  min-height: 44px;
  padding: 10px 0;
  cursor: pointer;
  overflow-wrap: anywhere;
}
