/* 观象 · 夜观天象：深墨蓝底、旧金点睛、宋体标题。手机优先，桌面居中 560px。 */
:root {
  --bg: #0E1020;
  --bg-2: #13162A;
  --card: #181B31;
  --card-2: #1F2340;
  --line: rgba(201, 169, 98, 0.16);
  --line-2: rgba(236, 229, 211, 0.08);
  --gold: #C9A962;
  --gold-soft: rgba(201, 169, 98, 0.14);
  --text: #ECE5D3;
  --text-2: #B9B2C4;
  --muted: #8B86A0;
  --red: #D0574B;
  --red-soft: rgba(208, 87, 75, 0.14);
  --green: #6FA47E;
  --green-soft: rgba(111, 164, 126, 0.14);
  --blue: #6E93C9;
  --serif: 'Songti SC', 'STSong', 'Noto Serif SC', 'Source Han Serif SC', serif;
  --sans: -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  --radius: 18px;
  --tabbar: 62px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -200px, #1B1F3D 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: var(--text); }

#app { max-width: 560px; margin: 0 auto; padding: 18px 16px calc(var(--tabbar) + 28px + env(safe-area-inset-bottom)); min-height: 100vh; }
.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.red { color: var(--red); }
.green { color: var(--green); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---- 页头 ---- */
.top { display: flex; align-items: center; gap: 10px; margin: 4px 2px 18px; }
.top .back { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); color: var(--gold); font-size: 18px; flex-shrink: 0; }
.top h1 { font-family: var(--serif); font-size: 24px; margin: 0; font-weight: 600; letter-spacing: 2px; }
.top .sub { margin-left: auto; font-size: 12px; color: var(--muted); }

.brand { display: flex; align-items: baseline; gap: 10px; margin: 6px 2px 4px; }
.brand b { font-family: var(--serif); font-size: 30px; letter-spacing: 6px; color: var(--gold); font-weight: 600; }
.brand span { font-size: 12px; color: var(--muted); letter-spacing: 2px; }

/* ---- 卡片 ---- */
.card { background: linear-gradient(180deg, var(--card) 0%, var(--bg-2) 100%); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card.tap { cursor: pointer; transition: transform .15s ease, border-color .15s; }
.card.tap:active { transform: scale(0.985); border-color: rgba(201,169,98,.35); }
.card h2 { font-family: var(--serif); font-size: 18px; margin: 0 0 10px; font-weight: 600; letter-spacing: 1px; display: flex; align-items: center; gap: 8px; }
.card h2 .more { margin-left: auto; font-family: var(--sans); font-size: 12px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.card h2 .more::after { content: ' ›'; }
.sec-title { font-family: var(--serif); font-size: 16px; color: var(--gold); margin: 22px 4px 10px; letter-spacing: 2px; }
.hr { height: 1px; background: var(--line-2); margin: 14px 0; }

/* ---- 今日大日期 ---- */
.today { display: flex; align-items: flex-end; gap: 14px; }
.today .day { font-family: var(--serif); font-size: 64px; line-height: .9; font-weight: 600; color: var(--gold); }
.today .side { padding-bottom: 4px; }
.today .side b { font-family: var(--serif); font-size: 18px; display: block; }
.today .side span { font-size: 13px; color: var(--text-2); }

/* ---- 宫格入口 ---- */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.grid.g3 { grid-template-columns: repeat(3, 1fr); }
.tool { background: var(--card); border: 1px solid var(--line-2); border-radius: 16px; padding: 14px 6px 12px; text-align: center; cursor: pointer; }
.tool:active { background: var(--card-2); }
.tool .ic { width: 42px; height: 42px; margin: 0 auto 8px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 20px; font-weight: 600; background: var(--gold-soft); color: var(--gold); }
.tool .nm { font-size: 13px; }
.tool .ds { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.4; }

/* ---- 宜忌 ---- */
.yiji { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.yiji .col { background: var(--bg-2); border-radius: 12px; padding: 12px; }
.seal { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 600; font-size: 14px; margin-right: 6px; vertical-align: middle; }
.seal.yi { background: var(--green); color: #0E1020; }
.seal.ji { background: var(--red); color: #fff; }
.words { font-size: 13px; color: var(--text-2); margin-top: 8px; line-height: 1.8; }

/* ---- 键值表 ---- */
.kv { display: grid; grid-template-columns: 84px 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---- 星级 ---- */
.stars { color: var(--gold); letter-spacing: 1px; }
.stars i { font-style: normal; color: rgba(236,229,211,.15); }
.dims { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dim { background: var(--bg-2); border-radius: 12px; padding: 12px; }
.dim .nm { font-family: var(--serif); font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.dim p { margin: 6px 0 0; font-size: 13px; color: var(--text-2); }
.lucky { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.lucky div { background: var(--bg-2); border-radius: 12px; padding: 10px 4px; }
.lucky b { display: block; font-family: var(--serif); font-size: 16px; color: var(--gold); }
.lucky span { font-size: 11px; color: var(--muted); }

/* ---- 标签 ---- */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; background: var(--gold-soft); color: var(--gold); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.plain { background: rgba(236,229,211,.06); color: var(--text-2); }

/* ---- 按钮 ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 22px; border-radius: 999px; border: 1px solid var(--gold); background: var(--gold); color: #17140C; font-weight: 600; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--gold); }
.btn.block { width: 100%; }
.btn.sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }
.row-btns { display: flex; gap: 10px; margin-top: 14px; }
.row-btns .btn { flex: 1; }

/* ---- 表单 ---- */
.field { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.field:last-child { border-bottom: none; }
.field label { width: 76px; flex-shrink: 0; color: var(--text-2); font-size: 14px; }
.field .ctl { flex: 1; display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.field input[type=text], .field input[type=date], .field input[type=time], .field select {
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; min-width: 0; width: 100%; color-scheme: dark;
}
.seg { display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: 3px; border: 1px solid var(--line-2); }
.seg button { border: none; background: transparent; padding: 5px 14px; border-radius: 999px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.seg button.on { background: var(--gold); color: #17140C; font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check input { accent-color: var(--gold); }
textarea.box { width: 100%; min-height: 110px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px; resize: vertical; line-height: 1.7; }
.hint { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.6; }
.suggest { margin-top: 6px; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; }
.suggest div { padding: 10px 12px; font-size: 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.suggest div:last-child { border-bottom: none; }
.suggest div:active { background: var(--card-2); }
.suggest small { color: var(--muted); margin-left: 6px; }

/* ---- 八字四柱 ---- */
.pillars { display: grid; grid-template-columns: 56px repeat(4, 1fr); gap: 0; text-align: center; font-size: 13px; }
.pillars > div { padding: 7px 2px; border-bottom: 1px solid var(--line-2); }
.pillars .h { color: var(--muted); font-size: 12px; text-align: left; padding-left: 0; }
.pillars .gz { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1.2; }
.pillars .ss { font-size: 12px; color: var(--gold); }
.pillars .hide span { display: block; font-size: 12px; line-height: 1.5; }
.wx-木 { color: #7FBF8E; } .wx-火 { color: #E07A6E; } .wx-土 { color: #D1A464; } .wx-金 { color: #E0C27A; } .wx-水 { color: #7FA6DC; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 26px 1fr 44px; align-items: center; gap: 8px; font-size: 13px; }
.bar .track { height: 8px; border-radius: 4px; background: rgba(236,229,211,.06); overflow: hidden; }
.bar .fill { height: 100%; border-radius: 4px; }
.yun { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.yun::-webkit-scrollbar { display: none; }
.yun .step { flex: 0 0 64px; text-align: center; background: var(--bg-2); border-radius: 12px; padding: 8px 4px; border: 1px solid transparent; cursor: pointer; }
.yun .step.on { border-color: var(--gold); }
.yun .step b { display: block; font-family: var(--serif); font-size: 18px; }
.yun .step span { font-size: 11px; color: var(--muted); }
.liunian { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 10px; }
.liunian div { text-align: center; background: var(--bg-2); border-radius: 10px; padding: 6px 2px; font-size: 12px; }
.liunian div.on { background: var(--gold-soft); color: var(--gold); }
.liunian b { display: block; font-family: var(--serif); font-size: 15px; }

/* ---- AI 文本 ---- */
.reading { font-size: 15px; line-height: 1.9; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.reading h3 { font-family: var(--serif); color: var(--gold); font-size: 16px; margin: 16px 0 4px; letter-spacing: 1px; white-space: normal; }
.reading h3:first-child { margin-top: 0; }
.reading p { margin: 0 0 6px; }
.cursor::after { content: '▍'; color: var(--gold); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.ai-note { font-size: 11px; color: var(--muted); margin-top: 12px; }
.err { color: var(--red); font-size: 14px; }

/* ---- 骨架 ---- */
.sk { height: 14px; border-radius: 7px; background: linear-gradient(90deg, rgba(236,229,211,.05) 25%, rgba(236,229,211,.1) 37%, rgba(236,229,211,.05) 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; margin: 8px 0; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---- 星盘 ---- */
.chart { width: 100%; max-width: 420px; margin: 0 auto; display: block; }
.ptable { width: 100%; border-collapse: collapse; font-size: 13px; }
.ptable td { padding: 7px 4px; border-bottom: 1px solid var(--line-2); }
.ptable td:first-child { width: 28px; font-size: 16px; color: var(--gold); text-align: center; }
.ptable td:last-child { text-align: right; color: var(--muted); }
.elements { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.elements div { background: var(--bg-2); border-radius: 10px; padding: 8px; }
.elements b { display: block; font-family: var(--serif); font-size: 18px; }

/* ---- 塔罗 ---- */
.spreads { display: grid; gap: 8px; }
.spread { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line-2); cursor: pointer; }
.spread.on { border-color: var(--gold); }
.spread b { font-family: var(--serif); }
.spread span { font-size: 12px; color: var(--muted); }
.spread em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--gold); }
.table { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 6px 0 4px; }
.tcard { width: 92px; text-align: center; }
.tcard .face { height: 148px; border-radius: 10px; border: 1px solid var(--gold); background: linear-gradient(160deg, #22264A, #141730); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px; position: relative; overflow: hidden; }
.tcard .face::before { content: ''; position: absolute; inset: 5px; border: 1px solid rgba(201,169,98,.35); border-radius: 7px; }
.tcard .face .r { font-family: var(--serif); color: var(--gold); font-size: 13px; letter-spacing: 1px; }
.tcard .face .n { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.tcard .face .s { font-size: 22px; color: var(--gold); }
.tcard.rev .face > * { transform: rotate(180deg); }
.tcard .pos { font-size: 12px; color: var(--muted); margin-top: 6px; }
.tcard .ori { font-size: 11px; color: var(--gold); }
.tcard.back .face { background: repeating-linear-gradient(45deg, #1A1D3A 0 8px, #20244A 8px 16px); }
.flip { animation: flip .5s ease both; }
@keyframes flip { from { transform: rotateY(90deg); opacity: .3; } to { transform: none; opacity: 1; } }

/* ---- 测试结果 ---- */
.items { display: grid; gap: 10px; }
.item { background: var(--bg-2); border-radius: 12px; padding: 12px 14px; }
.item b { font-family: var(--serif); color: var(--gold); display: block; margin-bottom: 4px; }
.item p { margin: 0; font-size: 14px; color: var(--text-2); }

/* ---- 地图 ---- */
.map { width: 100%; display: block; background: var(--bg-2); border-radius: 14px; }
.cities { display: grid; gap: 8px; margin-top: 12px; }
.city { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: start; background: var(--bg-2); border-radius: 12px; padding: 10px 12px; }
.city .rk { font-family: var(--serif); font-size: 20px; color: var(--gold); text-align: center; }
.city b { font-family: var(--serif); }
.city p { margin: 2px 0 0; font-size: 13px; color: var(--text-2); }
.city .sc { font-family: var(--serif); color: var(--gold); font-size: 18px; }
.dimtabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.dimtabs::-webkit-scrollbar { display: none; }
.dimtabs button { flex-shrink: 0; border: 1px solid var(--line); background: transparent; color: var(--text-2); border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.dimtabs button.on { background: var(--gold); color: #17140C; border-color: var(--gold); }

/* ---- 列表入口 ---- */
.list .li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.list .li:last-child { border-bottom: none; }
.list .li .ic { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-family: var(--serif); background: var(--gold-soft); color: var(--gold); flex-shrink: 0; }
.list .li b { font-weight: 500; }
.list .li span { display: block; font-size: 12px; color: var(--muted); }
.list .li .chev { margin-left: auto; color: var(--muted); }
.list .li .done { margin-left: auto; font-size: 12px; color: var(--green); }

/* ---- 底部导航 ---- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(14,16,32,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar nav { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--tabbar); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--muted); }
.tabbar a i { font-style: normal; font-family: var(--serif); font-size: 19px; line-height: 1; }
.tabbar a.on { color: var(--gold); }

.foot { text-align: center; font-size: 11px; color: var(--muted); margin: 28px 0 8px; line-height: 1.8; }
.empty { text-align: center; padding: 26px 10px; color: var(--muted); font-size: 14px; }
.empty b { display: block; font-family: var(--serif); font-size: 18px; color: var(--text); margin-bottom: 6px; }
.fade { animation: fade .3s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
