[hidden] { display: none !important; }
:root {
  --paper: #F3EDE2; --paper2: #EAE2D3; --card: #FBF8F2;
  --ink: #1E1A16; --ink2: #5C5248; --ink3: #968A7C; --line: #DCD2C1;
  --cinnabar: #A8321E; --gold: #B08D4F;
  --mu: #4E7A55; --huo: #B9472F; --tu: #A47B3B; --jin: #8E8A82; --shui: #2F5A80;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
  --sans: -apple-system, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
/* 移动端：去掉点击灰色闪烁（各可点元素自带 :active 反馈）；横屏不放大字号 */
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
/* 控件：点击立即响应（无双击缩放等待），长按不选中文字 */
button, a, summary, .seg label, .pills label, .step {
  touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.7 var(--sans); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.3; margin: 0; }
a { color: var(--cinnabar); text-decoration: none; }
input, select, button { font: inherit; color: inherit; }
.wrap { max-width: 600px; margin: 0 auto; padding: 0 20px; }

/* 顶栏 */
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { display: flex; align-items: center; gap: 8px; font: 700 17px var(--serif); letter-spacing: 2px; color: var(--ink); }
.seal { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 4px; background: var(--cinnabar);
  color: #FBF3E6; font: 700 15px var(--serif); font-style: normal; letter-spacing: 0; }
.top nav a { color: var(--ink2); font-size: 14px; }

/* 首屏 */
.hero { position: relative; display: flex; justify-content: space-between; align-items: center; padding: 20px 0 28px; min-height: 230px; }
.hero-text { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 10px; color: var(--cinnabar); font-size: 12px; letter-spacing: 3px; }
.hero h1 { font-size: 44px; line-height: 1.2; letter-spacing: 6px; }
.hero-sub { margin: 12px 0 0; color: var(--ink2); font-size: 14px; line-height: 1.6; }
.hero-art { position: absolute; right: -10px; top: 30px; width: 190px; height: 190px; opacity: .85; pointer-events: none; }

/* 卡片 */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; }

/* 表单 */
.form { padding: 20px 20px 24px; }
.seg { position: relative; display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: var(--paper2); margin-bottom: 4px; }
.seg::before { content: ""; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 6px); border-radius: 8px;
  background: var(--card); box-shadow: 0 1px 3px #1E1A1614; transition: transform 200ms var(--ease-out); }
.seg:has(input[value=lunar]:checked)::before { transform: translateX(calc(100% + 4px)); }
.seg label { position: relative; z-index: 1; }
.seg label { flex: 1; }
.seg input, .pills input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: grid; place-items: center; height: 36px; border-radius: 8px; color: var(--ink3); font-size: 14px; cursor: pointer; transition: color 150ms ease; }
.seg input:checked + span { color: var(--ink); font-weight: 600; }
.field { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.fl { flex: 0 0 64px; color: var(--ink3); font-size: 13px; }
.fv { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fv > input, .fv > select, .place select { width: 100%; border: 0; background: none; padding: 2px 0; outline: none;
  font: 600 17px var(--serif); color: var(--ink); -webkit-appearance: none; appearance: none; }
.fv > input::placeholder { font: 400 15px var(--sans); color: var(--ink3); }
.fv small { color: var(--ink3); font-size: 11px; display: flex; align-items: center; gap: 4px; }
.fv small input[type=checkbox] { margin: 0; accent-color: var(--cinnabar); }
.fv small input[type=number] { width: 76px; border: 0; border-bottom: 1px dashed var(--line); background: none; font-size: 16px; color: var(--ink2); outline: none; padding: 0; }
.place { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.place select { width: auto; max-width: 46%; }
.place small { flex-basis: 100%; }
.fi { flex: 0 0 18px; width: 18px; height: 18px; fill: none; stroke: var(--ink3); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pills { flex-direction: row; gap: 10px; }
.pills span { display: inline-block; padding: 6px 16px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink2); font-size: 13px; cursor: pointer; }
.pills input:checked + span { border-color: var(--cinnabar); background: #A8321E12; color: var(--cinnabar); font-weight: 600; }
.more summary { list-style: none; display: flex; justify-content: space-between; padding: 14px 0 6px; color: var(--ink3); font-size: 12px; cursor: pointer; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: "⌄"; font-size: 16px; line-height: 1; }
.more[open] summary::after { content: "⌃"; }
.more .fv > input, .more .fv > select { font: 400 16px var(--sans); }
.cta { width: 100%; height: 52px; margin-top: 14px; border: 0; border-radius: 12px; background: var(--cinnabar); color: #FBF3E6;
  font: 700 18px var(--serif); letter-spacing: 4px; cursor: pointer; box-shadow: 0 6px 16px #A8321E40; }
.cta, .ai-cta, .step, .pills span { transition: transform 140ms var(--ease-out), background-color 140ms ease, border-color 140ms ease, color 140ms ease; }
.cta:active, .ai-cta:active { transform: scale(0.97); }
.step:active, .pills label:active span { transform: scale(0.96); }
.err { margin: 12px 0 0; color: var(--cinnabar); font-size: 13px; text-align: center; }

/* 结果 */
#out { padding-top: 28px; display: flex; flex-direction: column; gap: 24px; }
#chart { display: flex; flex-direction: column; gap: 24px; }
.who { font-size: 24px; }
.when { margin: 6px 0 0; color: var(--ink2); font-size: 12px; }
.notice { margin-top: 8px; padding: 10px 12px; border-radius: 8px; background: #B08D4F1F; color: #7A5F2E; font-size: 12px; line-height: 1.6; }
.notice p { margin: 0; }
.notice p + p { margin-top: 4px; }
.pillars { display: flex; padding: 18px 10px; }
.pillar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 0; border-radius: 12px; border: 1px solid transparent; text-align: center; }
.pillar.day { background: #A8321E0D; border-color: #A8321E55; }
.pillar .lab { color: var(--ink3); font-size: 11px; letter-spacing: 1px; }
.pillar .ss { color: var(--ink2); font-size: 12px; }
.pillar.day .ss { color: var(--cinnabar); font-weight: 700; }
.pillar .gz { font: 700 38px/1.05 var(--serif); }
.pillar .cg { color: var(--ink2); font-size: 11px; line-height: 1.5; }
.pillar .ny { color: var(--ink3); font-size: 10px; }
.w-木 { color: var(--mu); } .w-火 { color: var(--huo); } .w-土 { color: var(--tu); } .w-金 { color: var(--jin); } .w-水 { color: var(--shui); }
.b-木 { background: var(--mu); } .b-火 { background: var(--huo); } .b-土 { background: var(--tu); } .b-金 { background: var(--jin); } .b-水 { background: var(--shui); }
.sec { display: flex; flex-direction: column; gap: 12px; }
.sec-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.sec-head h2 { font-size: 19px; }
.sec-head span, .sec-head a { color: var(--ink3); font-size: 11px; }
.sec-head a { color: var(--cinnabar); font-size: 12px; }
.wxbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; }
.legend { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; color: var(--ink2); font-size: 12px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tags b { font: 700 14px var(--serif); }
.tag { padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink2); font-size: 11px; }
.tag.mu { color: var(--mu); }
.plain { margin: 0; color: var(--ink2); font-size: 12px; line-height: 1.7; }
.timeline { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.step { scroll-snap-align: start; }
.timeline::-webkit-scrollbar { display: none; }
.step { flex: 1 0 44px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; }
.step b { font: 700 18px/1.2 var(--serif); }
.step small { color: var(--ink3); font-size: 10px; line-height: 1.2; }
.step small + small { font-size: 9px; }
.step.now { background: var(--cinnabar); border-color: var(--cinnabar); color: #FBF3E6; }
.step.now small { color: #F6DCD3; }
.step.sel:not(.now) { border-color: var(--cinnabar); }
.grid5 { display: flex; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.grid5 > div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 0; border-right: 1px solid var(--line); }
.grid5 > div:last-child { border-right: 0; }
.grid5 small { color: var(--ink3); font-size: 11px; }
.grid5 b { font: 700 20px var(--serif); }
.grid5 .ji { color: var(--mu); }
.ln { width: 100%; border-collapse: collapse; font-size: 12px; }
.ln th, .ln td { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.ln th { color: var(--ink3); font-weight: 400; }
.ln td.gz { font: 700 15px var(--serif); white-space: nowrap; }

/* AI 卡片（深色） */
.ai { padding: 20px 20px 22px; border-radius: 16px; background: var(--ink); color: #F3EDE2; display: flex; flex-direction: column; gap: 14px; }
.ai-head { display: flex; justify-content: space-between; align-items: center; }
.ai h2 { display: flex; align-items: center; gap: 8px; font-size: 19px; }
.ai h2 svg { width: 18px; height: 18px; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linejoin: round; }
.quota { padding: 3px 10px; border: 1px solid #B08D4F80; border-radius: 999px; color: var(--gold); font-size: 11px; }
.ai-desc { margin: 0; color: #CFC6B8; font-size: 13px; line-height: 1.7; }
.ai-desc b { color: #F3EDE2; font-weight: 600; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips span { padding: 4px 10px; border-radius: 6px; background: #FFFFFF12; color: #E8E0D2; font-size: 12px; }
.ai-cta { height: 50px; border: 0; border-radius: 12px; background: var(--gold); color: var(--ink); font: 700 16px var(--serif); letter-spacing: 2px; cursor: pointer; }
.ai-cta:disabled { opacity: .55; cursor: default; }
.ai-note { margin: 0; color: #8F867A; font-size: 11px; }
.ai.used { align-items: center; text-align: center; }
.ai.used .chips, .ai.used .ai-cta, .ai.used .ai-note { display: none; }

/* 解读正文 */
.reading { padding: 20px; }
.reading-head { display: flex; justify-content: space-between; align-items: center; }
.reading-head h2 { font-size: 19px; }
.reading-head span { color: var(--ink3); font-size: 11px; }
.rule { display: block; width: 28px; height: 2px; margin: 12px 0 4px; background: var(--cinnabar); }
.md { color: var(--ink2); font-size: 14px; line-height: 1.85; overflow-wrap: anywhere; }
.md h1, .md h2, .md h3 { color: var(--ink); }
.md h1 { font-size: 22px; margin: 18px 0 8px; }
.md h2 { font-size: 17px; margin: 22px 0 8px; }
.md h3 { font-size: 15px; margin: 16px 0 6px; }
.md strong { color: var(--ink); }
.md table { display: block; overflow-x: auto; overscroll-behavior-x: contain; border-collapse: collapse; margin: 10px 0; font-size: 12.5px; line-height: 1.6; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.md th { background: var(--paper2); color: var(--ink); font-weight: 600; white-space: nowrap; }
.md blockquote { margin: 12px 0; padding: 10px 14px; background: #A8321E0A; border-left: 2px solid var(--cinnabar); color: var(--ink); font-family: var(--serif); }
.md blockquote p { margin: 0; }
.md ul, .md ol { padding-left: 20px; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.typing::after { content: "▍"; color: var(--cinnabar); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* 首页其余 */
.features { display: flex; margin: 28px 0; }
.features div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; border-right: 1px solid var(--line); }
.features div:last-child { border-right: 0; }
.features b { font: 700 15px var(--serif); }
.features span { color: var(--ink3); font-size: 11px; }
.knowledge .sec-head { padding-bottom: 10px; }
.knowledge h2 { font-size: 20px; }
.knowledge ol { list-style: none; margin: 0; padding: 0; }
.knowledge li a { display: flex; align-items: center; gap: 14px; min-height: 50px; border-top: 1px solid var(--line); color: var(--ink); }
.knowledge li a::after { content: "›"; margin-left: auto; color: var(--ink3); font-size: 20px; }
.knowledge li i { color: var(--gold); font: 400 13px var(--serif); font-style: normal; }
.howto { margin-top: 8px; border-top: 1px solid var(--line); color: var(--ink2); font-size: 13px; }
.howto summary { padding: 14px 0; color: var(--ink3); font-size: 12px; cursor: pointer; }
.howto ul { margin: 0 0 8px; padding-left: 18px; }

/* 文章页 */
.article { padding: 24px 22px; margin-top: 8px; }
.article h1 { font-size: 26px; margin: 0 0 16px; color: var(--ink); }
.cta-link { margin-top: 24px; font-weight: 600; }
.arts { list-style: none; margin: 0; padding: 0; }
.arts li { border-top: 1px solid var(--line); padding: 14px 0; }
.arts li a { font: 700 16px var(--serif); color: var(--ink); }
.arts p { margin: 4px 0 0; color: var(--ink3); font-size: 13px; }
.page-title { font-size: 26px; margin: 12px 0 16px; }

.foot { color: var(--ink3); font-size: 11px; text-align: center; padding: 32px 0 40px; }
.foot p { margin: 4px 0; }
.foot a { color: var(--ink3); }

@media (min-width: 640px) {
  .hero h1 { font-size: 52px; }
  .hero-art { width: 230px; height: 230px; right: 0; top: 10px; }
}

/* 原生日期/时间选择器图标隐藏，整块输入区可点开选择器（右侧用自绘图标） */
.fv > input[type=date], .fv > input[type=time] { position: relative; min-height: 28px; }
.fv > input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; opacity: 0; cursor: pointer; }
.ai.used .ai-head { flex-direction: column; gap: 10px; }
.ai.used .ai-head h2 svg { display: none; }
.ai.used .ai-head h2::before { content: ""; width: 22px; height: 22px; margin: 0 auto 4px; display: block;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B08D4F' stroke-width='1.8' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E"); }
.ai.used .ai-head h2 { flex-direction: column; gap: 0; }
.link-btn { margin-top: 4px; border: 0; background: none; color: var(--gold); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* 刘海屏横屏时内容避开安全区 */
.wrap { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
.foot { padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }

/* 结果出现：轻微上浮淡入，分块错开 50ms（每次起盘一次，频率低，可以有过渡） */
#out > .ai, #out > .reading, #chart > * { animation: rise 320ms var(--ease-out) both; }
#chart > *:nth-child(2) { animation-delay: 50ms; } #chart > *:nth-child(3) { animation-delay: 100ms; }
#chart > *:nth-child(4) { animation-delay: 150ms; } #chart > *:nth-child(n+5) { animation-delay: 200ms; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
/* 桌面端才有悬停反馈 */
@media (hover: hover) and (pointer: fine) {
  .knowledge li a:hover span, .arts li a:hover { color: var(--cinnabar); }
  .step:not(.now):hover { border-color: var(--ink3); }
  .cta:hover { background: #962B19; }
}
@media (prefers-reduced-motion: reduce) {
  #out > .ai, #out > .reading, #chart > * { animation: fade 200ms ease both; }
  @keyframes fade { from { opacity: 0; } }
  .seg::before { transition: none; }
  .typing::after { animation: none; }
}
