/* 星盘命理 · 样式 */
:root {
  --bg: #0b0f1f;
  --bg-2: #10162c;
  --card: #141b35;
  --card-2: #1a2244;
  --line: rgba(216, 181, 106, .18);
  --line-2: rgba(255, 255, 255, .08);
  --ink: #ece6d6;
  --ink-2: #b9b3a3;
  --ink-3: #847f74;
  --gold: #d8b56a;
  --gold-2: #f0d79b;
  --gold-ink: #1a1408;
  --warn: #e59a6a;
  --sky-star: #ffffff;
  --glow: radial-gradient(1200px 600px at 70% -10%, rgba(88, 76, 160, .35), transparent 60%),
          radial-gradient(900px 500px at -10% 30%, rgba(40, 90, 140, .25), transparent 60%);
  --wx-mu: #72c891; --wx-huo: #f07564; --wx-tu: #d2a062; --wx-jin: #d0d5df; --wx-shui: #67a9ec;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "Noto Serif CJK SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5efe2;
  --bg-2: #efe6d3;
  --card: #fffaf0;
  --card-2: #f8f0df;
  --line: rgba(160, 122, 44, .28);
  --line-2: rgba(60, 40, 10, .1);
  --ink: #2a2418;
  --ink-2: #5b5240;
  --ink-3: #8a8070;
  --gold: #a57a26;
  --gold-2: #8a6215;
  --gold-ink: #fffaf0;
  --warn: #b5552a;
  --sky-star: #b49660;
  --glow: radial-gradient(1200px 600px at 70% -10%, rgba(214, 180, 110, .25), transparent 60%),
          radial-gradient(900px 500px at -10% 30%, rgba(160, 190, 220, .25), transparent 60%);
  --wx-mu: #2f8a4e; --wx-huo: #c23a2c; --wx-tu: #9a6526; --wx-jin: #66707f; --wx-shui: #2563a8;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5efe2; --bg-2: #efe6d3; --card: #fffaf0; --card-2: #f8f0df;
    --line: rgba(160, 122, 44, .28); --line-2: rgba(60, 40, 10, .1);
    --ink: #2a2418; --ink-2: #5b5240; --ink-3: #8a8070;
    --gold: #a57a26; --gold-2: #8a6215; --gold-ink: #fffaf0; --warn: #b5552a; --sky-star: #b49660;
    --glow: radial-gradient(1200px 600px at 70% -10%, rgba(214, 180, 110, .25), transparent 60%),
            radial-gradient(900px 500px at -10% 30%, rgba(160, 190, 220, .25), transparent 60%);
    --wx-mu: #2f8a4e; --wx-huo: #c23a2c; --wx-tu: #9a6526; --wx-jin: #66707f; --wx-shui: #2563a8;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, summary, label, a, .tc { touch-action: manipulation; }
html.modal-open, html.modal-open body { overflow: hidden; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--bg); background-image: var(--glow); background-attachment: fixed;
  color: var(--ink); font: 15px/1.7 var(--sans);
  -webkit-tap-highlight-color: transparent;
}
#sky { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.wrap { position: relative; z-index: 1; max-width: 960px; margin: 0 auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
[hidden] { display: none !important; }
a { color: var(--gold); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: .02em; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* 顶栏 */
.top { display: flex; align-items: center; justify-content: space-between; padding: calc(14px + env(safe-area-inset-top)) 0 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 700 19px/1 var(--serif); letter-spacing: .12em; }
.brand-mark { color: var(--gold); font-size: 22px; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; color: var(--gold); }
.icon-btn svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.icon-btn .i-moon { fill: currentColor; stroke: none; }
.icon-btn .i-sun { display: none; }
:root[data-theme="light"] .icon-btn .i-moon { display: none; }
:root[data-theme="light"] .icon-btn .i-sun { display: inline; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .icon-btn .i-moon { display: none; }
  :root:not([data-theme="dark"]) .icon-btn .i-sun { display: inline; }
}

/* 开场 */
.intro { text-align: center; padding: 36px 0 26px; }
.intro h1 { margin: 0; font-size: clamp(28px, 6vw, 42px); line-height: 1.3; color: var(--gold-2); }
.intro p { margin: 14px auto 0; max-width: 520px; color: var(--ink-2); }
.br-m { display: none; }
@media (max-width: 480px) { .br-m { display: inline; } }

/* 卡片与表单 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .18); }
.form { max-width: 680px; margin: 0 auto; padding: 26px 26px 18px; }
.field { margin: 0 0 20px; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend { display: block; margin-bottom: 8px; padding: 0; font-weight: 600; font-size: 14px; }
.req { margin-left: 6px; padding: 1px 6px; border-radius: 4px; font-size: 11px; background: var(--gold); color: var(--gold-ink); vertical-align: 1px; }
.opt { margin-left: 4px; font-weight: 400; font-size: 12px; color: var(--ink-3); }
input[type=date], input[type=time], input[type=text], select {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2);
  font-size: 16px; /* 防止 iOS 聚焦放大 */
}
select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
input::placeholder { color: var(--ink-3); }
.hint { margin: 6px 0 0; font-size: 12px; color: var(--ink-3); }
.center { text-align: center; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 600px) { .row2 { grid-template-columns: 1fr; } .form { padding: 20px 16px 14px; } }

.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); }
.seg label, .seg button { flex: 1 1 0; min-width: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span, .seg button { display: block; min-height: 38px; padding: 8px 10px; border-radius: 9px; text-align: center; cursor: pointer; font-size: 14px; color: var(--ink-2); white-space: nowrap; border: 0; background: transparent; transition: background .2s, color .2s; }
.seg input:checked + span, .seg button[aria-selected=true] { background: var(--gold); color: var(--gold-ink); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 1px; }
.sub { margin-top: 10px; }
.sub[data-show=exact] { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; align-items: end; }
.inline-sel { display: grid; gap: 4px; font-size: 12px; color: var(--ink-3); }
@media (max-width: 480px) { .sub[data-show=exact] { grid-template-columns: 1fr; } }
.chips-in { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-in label { position: relative; }
.chips-in input { position: absolute; opacity: 0; pointer-events: none; }
.chips-in span { display: inline-block; min-height: 40px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 14px; color: var(--ink-2); transition: all .2s; }
.chips-in input:checked + span { border-color: var(--gold); color: var(--gold-2); background: rgba(216, 181, 106, .12); }
.chips-in input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.err { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; background: rgba(229, 106, 90, .12); color: var(--warn); font-size: 14px; }

.actions { display: flex; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 22px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; font-size: 15px; transition: transform .15s, background .2s, opacity .2s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn--gold { flex: 1; border-color: transparent; background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: var(--gold-ink); font-weight: 700; letter-spacing: .1em; }
.btn--ghost { color: var(--ink-2); }
@media (hover: hover) { .btn--ghost:hover { border-color: var(--gold); color: var(--gold-2); } .btn--gold:hover { filter: brightness(1.06); } }

/* 排盘中 */
.loading { display: grid; place-items: center; gap: 18px; min-height: 60vh; text-align: center; color: var(--gold-2); font-family: var(--serif); letter-spacing: .3em; }
.astro { position: relative; width: 140px; height: 140px; }
.ring { position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 50%; border: 1px solid var(--gold); opacity: .6; }
.r1 { border-style: dashed; animation: spin 6s linear infinite; }
.r2 { top: 18px; right: 18px; bottom: 18px; left: 18px; border-color: var(--gold-2); border-top-color: transparent; animation: spin 2.2s linear infinite reverse; }
.r3 { top: 38px; right: 38px; bottom: 38px; left: 38px; border-width: 2px; border-right-color: transparent; border-left-color: transparent; animation: spin 1.4s linear infinite; }
.core { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: grid; place-items: center; font-size: 30px; color: var(--gold); animation: pulse 1.4s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .4; transform: scale(.9); } }
@media (prefers-reduced-motion: reduce) { .ring, .core { animation: none; } }

/* 结果 */
.result { padding-top: 8px; }
.toolbar { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; padding: 10px 0; padding-top: max(10px, env(safe-area-inset-top)); pointer-events: none; }
.toolbar .btn { pointer-events: auto; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.toolbar .btn--ghost { background: var(--card); }
.toolbar .btn--gold { flex: 0 1 auto; margin-left: auto; letter-spacing: .04em; }
@media (max-width: 480px) { .toolbar .btn { padding: 8px 12px; font-size: 14px; } #toggle-all { display: none; } }
.sheet { padding: 4px 0 8px; background: var(--bg); background-image: var(--glow); border-radius: 18px; }
.sheet-head { text-align: center; padding: 28px 18px 18px; }
.sh-mark { color: var(--gold); font-size: 26px; }
.sheet-head h1 { margin: 6px 0 4px; font-size: clamp(26px, 5.5vw, 36px); color: var(--gold-2); overflow-wrap: anywhere; }
.sh-sub { margin: 0; color: var(--ink-2); font-family: var(--serif); letter-spacing: .08em; }
.summary { margin: 20px auto 0; max-width: 640px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); font: 600 16px/1.8 var(--serif); color: var(--ink); text-align: left; }
.summary span { display: block; margin-bottom: 4px; font: 600 12px/1.4 var(--sans); color: var(--gold); letter-spacing: .2em; }

.sec { scroll-margin-top: 72px; margin: 14px 0; background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.sec > summary { display: flex; align-items: center; gap: 12px; padding: 16px 20px; cursor: pointer; list-style: none; min-height: 56px; }
.sec > summary::-webkit-details-marker { display: none; }
.sec-num { font: 600 12px/1 var(--sans); color: var(--gold); letter-spacing: .1em; }
.sec h2 { margin: 0; font-size: 19px; flex: 1; }
.chev { width: 10px; height: 10px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(45deg); transition: transform .25s; margin-right: 4px; }
.sec[open] > summary .chev { transform: rotate(-135deg); }
.sec-body { padding: 0 20px 20px; }
@media (max-width: 480px) { .sec > summary { padding: 14px 16px; } .sec-body { padding: 0 16px 16px; } }
.sec p { margin: 10px 0; }
.sec h3 { margin: 18px 0 8px; font-size: 16px; }
.hl { color: var(--gold-2); }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.lead { color: var(--ink); }
.note { padding: 10px 14px; border-left: 2px solid var(--gold); background: var(--card-2); border-radius: 0 10px 10px 0; font-size: 14px; color: var(--ink-2); }
.note--warn { border-left-color: var(--warn); }
.lock { padding: 8px 14px; border: 1px dashed var(--line); border-radius: 10px; font-size: 13px; color: var(--ink-3); }
.lock span { color: var(--gold); }

.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin: 0 0 16px; }
.kv > div { display: flex; gap: 10px; min-width: 0; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.kv dt { flex: 0 0 auto; color: var(--ink-3); font-size: 13px; min-width: 4.5em; padding-top: 1px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; gap: 0; } }

/* 五行配色 */
.wx-mu { color: var(--wx-mu); } .wx-huo { color: var(--wx-huo); } .wx-tu { color: var(--wx-tu); } .wx-jin { color: var(--wx-jin); } .wx-shui { color: var(--wx-shui); }
.wx-mu-bg { background: var(--wx-mu); } .wx-huo-bg { background: var(--wx-huo); } .wx-tu-bg { background: var(--wx-tu); } .wx-jin-bg { background: var(--wx-jin); } .wx-shui-bg { background: var(--wx-shui); }
.wx-mu-fill { fill: var(--wx-mu); } .wx-huo-fill { fill: var(--wx-huo); } .wx-tu-fill { fill: var(--wx-tu); } .wx-jin-fill { fill: var(--wx-jin); } .wx-shui-fill { fill: var(--wx-shui); }

/* 四柱卡片 */
.pillars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.pillar { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 6px 12px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--card-2); text-align: center; min-width: 0; }
.pillar--day { border-color: var(--gold); box-shadow: inset 0 0 0 1px rgba(216, 181, 106, .25); }
.p-label { font-size: 12px; color: var(--ink-3); letter-spacing: .2em; }
.p-tg { font-size: 12px; color: var(--gold); min-height: 18px; }
.p-char { display: flex; align-items: baseline; gap: 2px; }
.gz { font: 700 clamp(28px, 7vw, 40px)/1.15 var(--serif); }
.p-char small { font-size: 11px; color: var(--ink-3); }
.p-hide { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 6px; margin-top: 4px; font-size: 12px; }
.p-hide span { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.3; }
.hg { font: 600 14px/1.2 var(--serif); }
.p-hide em { font-style: normal; color: var(--ink-3); font-size: 10.5px; }
.p-ny { margin-top: 2px; font-size: 11px; color: var(--ink-3); }
.pillar--unknown { justify-content: center; border-style: dashed; border-color: var(--line); background: transparent; }
.p-q { font: 700 36px/1.2 var(--serif); color: var(--ink-3); }
.p-unk { font-weight: 600; font-size: 13px; }
.p-tip { font-size: 11px; color: var(--ink-3); }
@media (max-width: 420px) { .pillars { gap: 6px; } .pillar { padding: 10px 2px; } .p-hide em { font-size: 10px; } }

/* 五行图 */
.el-grid { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: center; }
@media (max-width: 600px) { .el-grid { grid-template-columns: 1fr; } .radar { max-width: 240px; margin: 0 auto; } }
.radar { width: 100%; height: auto; display: block; }
.rd-ring { fill: none; stroke: var(--line); }
.rd-axis { stroke: var(--line-2); }
.rd-shape { fill: rgba(216, 181, 106, .22); stroke: var(--gold); stroke-width: 1.5; }
.rd-dot { fill: var(--gold-2); }
.rd-label { font: 700 15px var(--serif); }
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: 24px 1fr 52px; grid-template-areas: "n t v" ". m m"; gap: 2px 10px; align-items: center; padding: 6px 0; }
.b-name { grid-area: n; font: 700 17px var(--serif); }
.b-track { grid-area: t; height: 10px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.b-fill { display: block; height: 100%; border-radius: 6px; }
.b-val { grid-area: v; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink-2); }
.b-meta { grid-area: m; font-size: 12px; color: var(--ink-3); }
.tag { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 600; border: 1px solid var(--line); color: var(--ink-2); line-height: 18px; }
.tag--hot { color: var(--wx-huo); border-color: currentColor; }
.tag--cold { color: var(--wx-shui); border-color: currentColor; }
.tag--gold { color: var(--gold); border-color: var(--gold); vertical-align: 2px; }

/* 日主 */
.dm-head { display: flex; align-items: center; gap: 16px; }
.dm-big { display: grid; place-items: center; flex: 0 0 auto; width: 72px; height: 72px; border: 1px solid currentColor; border-radius: 50%; font: 700 38px/1 var(--serif); }
.dm-title { font: 700 18px var(--serif); margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.chip--gold { border-color: var(--gold); color: var(--gold-2); background: rgba(216, 181, 106, .1); }
.chip--warn { border-color: var(--warn); color: var(--warn); }
.meter { margin: 8px 0 4px; }
.m-track { position: relative; height: 26px; border-radius: 8px; background: linear-gradient(90deg, rgba(103, 169, 236, .35), rgba(216, 181, 106, .15) 50%, rgba(240, 117, 100, .35)); }
.m-zone { position: absolute; top: 0; bottom: 0; display: grid; place-items: center; font-size: 11px; color: var(--ink-2); border-right: 1px solid var(--line-2); }
.m-pin { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--gold-2); box-shadow: 0 0 0 2px var(--card); }
.m-cap { margin-top: 8px; font-size: 13px; color: var(--ink-2); }

/* 十神表 */
.tg { width: 100%; border-collapse: collapse; font-size: 14px; }
.tg th, .tg td { padding: 9px 8px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
.tg thead th { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.tg tbody th { color: var(--ink-3); font-weight: 500; white-space: nowrap; width: 3.5em; }
.tg td span { font: 700 16px var(--serif); }

/* 运势 */
.ft-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .ft-grid { grid-template-columns: 1fr; } }
.ft { padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--card-2); min-width: 0; }
.ft--focus { border-color: var(--gold); }
.ft-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ft h3 { margin: 0; }
.ft p { font-size: 14px; }
.stars { white-space: nowrap; letter-spacing: 2px; font-size: 16px; }
.stars i { font-style: normal; color: var(--line); }
.stars i.on { color: var(--gold-2); }
.notes { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.notes li { margin: 4px 0; }

/* 流年 */
.ln-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .ln-grid { grid-template-columns: 1fr; } }
.ln { padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--card-2); min-width: 0; }
.ln-year { font-size: 13px; color: var(--ink-3); letter-spacing: .1em; }
.ln-gz { font: 700 28px/1.3 var(--serif); color: var(--gold-2); margin-bottom: 6px; }
.ln-gz small { margin-left: 8px; font: 500 13px var(--sans); color: var(--ink-2); }
.ln p { font-size: 14px; }
.yiji { margin: 8px 0 0; font-size: 13px; }
.yiji div { display: flex; gap: 8px; padding: 4px 0; }
.yiji dt { flex: 0 0 auto; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; font-size: 12px; color: var(--gold-ink); background: var(--wx-mu); }
.yiji div + div dt { background: var(--wx-huo); }
.yiji dd { margin: 0; color: var(--ink-2); }

/* 星座 */
.zd-head { display: flex; gap: 18px; align-items: center; }
.zd-sign { flex: 0 0 auto; display: grid; place-items: center; width: 84px; height: 84px; border: 1px solid var(--gold); border-radius: 50%; font: 700 24px/1 var(--serif); color: var(--gold-2); text-align: center; }
.zd-sign small { display: block; font-size: 12px; color: var(--ink-3); margin-top: -18px; }
.pl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
@media (max-width: 640px) { .pl-grid { grid-template-columns: 1fr; } .zd-head { align-items: flex-start; } .zd-sign { width: 68px; height: 68px; font-size: 20px; } }
.pl { padding: 12px 16px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--card-2); }
.pl-name { font: 700 16px var(--serif); }
.pl-name small { font: 400 12px var(--sans); color: var(--ink-3); margin-left: 4px; }
.pl p { font-size: 14px; margin: 6px 0 0; }

/* 开运 */
.yong { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.yong > div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--card-2); }
.yong b { font: 700 28px/1.3 var(--serif); }
.yong em { font-style: normal; font-size: 12px; color: var(--ink-3); }
.kv--lucky { grid-template-columns: 1fr; }
.sw { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; }
.sw i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--line); }

/* 每日 */
.daily { display: flex; gap: 18px; align-items: center; }
.daily-gz { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 96px; height: 96px; border-radius: 18px; border: 1px solid var(--gold); font: 700 30px/1.1 var(--serif); color: var(--gold-2); }
.daily-gz small { font: 400 11px var(--sans); color: var(--ink-3); margin-top: 6px; }
.daily h3 { margin-top: 0; }
.tip { color: var(--gold-2); font-size: 14px; }
@media (max-width: 420px) { .daily { align-items: flex-start; gap: 12px; } .daily-gz { width: 76px; height: 76px; font-size: 24px; } }

/* 塔罗 */
#tarot-body .seg { max-width: 420px; margin: 0 auto 18px; }
.tc-row { display: grid; gap: 14px; justify-content: center; }
.tc-row--1 { grid-template-columns: minmax(0, 200px); }
.tc-row--3 { grid-template-columns: repeat(3, minmax(0, 190px)); }
@media (max-width: 520px) { .tc-row--3 { gap: 8px; } }
.tc-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.tc-pos { font: 600 13px var(--serif); color: var(--gold); letter-spacing: .2em; }
.tc { width: 100%; aspect-ratio: 2 / 3.2; padding: 0; border: 0; background: none; cursor: pointer; perspective: 900px; }
.tc-inner { position: relative; display: block; width: 100%; height: 100%; transition: transform .7s cubic-bezier(.3, .7, .2, 1); transform-style: preserve-3d; }
.tc.is-flipped .tc-inner { transform: rotateY(180deg); }
.tc-back, .tc-face { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 1px solid var(--gold); }
.tc-back { background: repeating-linear-gradient(45deg, rgba(216, 181, 106, .14) 0 6px, transparent 6px 12px), var(--card-2); color: var(--gold); font-size: 34px; }
.tc-back span { display: grid; place-items: center; width: 60%; aspect-ratio: 1; border: 1px solid var(--gold); border-radius: 50%; background: var(--card); }
.tc-face { transform: rotateY(180deg); gap: 6px; padding: 10px 6px; background: linear-gradient(170deg, var(--card), var(--card-2)); }
.tc-face.is-rev { transform: rotateY(180deg) rotate(180deg); }
.tc-no { font: 600 13px var(--serif); color: var(--gold); }
.tc-sym { font-size: clamp(30px, 8vw, 46px); color: var(--gold-2); line-height: 1.2; }
.tc-name { font: 700 clamp(14px, 3.6vw, 18px) var(--serif); }
.tc-en { font-size: 10px; color: var(--ink-3); letter-spacing: .04em; }
.tc-text { width: 100%; font-size: 13px; text-align: center; animation: fadeUp .4s ease both; }
.tc-text p { margin: 4px 0 0; color: var(--ink-2); text-align: left; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .tc-inner { transition: none; } .tc-text { animation: none; } }

/* 推算依据 */
.basis { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 8px; }
.basis summary { cursor: pointer; font-size: 13px; color: var(--gold); list-style: none; min-height: 32px; display: flex; align-items: center; gap: 6px; }
.basis summary::-webkit-details-marker { display: none; }
.basis summary::before { content: '+'; display: inline-grid; place-items: center; width: 16px; height: 16px; border: 1px solid currentColor; border-radius: 4px; font-size: 12px; line-height: 1; }
.basis[open] summary::before { content: '−'; }
.basis ol { margin: 6px 0 0; padding-left: 22px; font-size: 12.5px; color: var(--ink-2); line-height: 1.75; }
.basis li { overflow-wrap: anywhere; }

.sheet-foot { padding: 10px 16px 18px; text-align: center; font-size: 12px; color: var(--ink-3); }
.foot { margin-top: 32px; padding: 20px 0 8px; border-top: 1px solid var(--line-2); text-align: center; font-size: 12.5px; color: var(--ink-3); }
.foot p { margin: 4px 0; }
.foot p:first-child { color: var(--ink-2); }

/* 图片弹窗 */
.modal { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .6); }
.modal-box { display: flex; flex-direction: column; gap: 10px; width: min(560px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); padding: 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-img { flex: 1; min-height: 0; overflow: auto; border-radius: 10px; border: 1px solid var(--line-2); }
.modal-img img { display: block; width: 100%; }

/* 截图时：去掉吸顶与动画干扰，翻开的牌直接平放显示 */
.capturing .tc-inner { transition: none; transform: none !important; }
.capturing .tc.is-flipped .tc-back { display: none; }
.capturing .tc.is-flipped .tc-face { transform: none; }
.capturing .tc.is-flipped .tc-face.is-rev { transform: rotate(180deg); }
.capturing .tc:not(.is-flipped) .tc-face { display: none; }
.capturing .basis, .capturing #tarot-body .seg { display: none; }
.capturing .tc-text { animation: none; }
.capturing .pillar--day { box-shadow: none; }

/* 旧内核兼容：不支持 aspect-ratio 时用固定比例盒子 */
@supports not (aspect-ratio: 1) {
  .tc { position: relative; height: 0; padding-top: 160%; }
  .tc-inner { position: absolute; top: 0; left: 0; }
  .tc-back span { width: 56px; height: 56px; }
}

/* 应用内置浏览器（QQ、微信等）：不支持下载属性，只保留长按保存 */
.in-app #img-dl { display: none; }
.in-app .modal-img { -webkit-touch-callout: default; }
.modal-img img { -webkit-user-select: none; user-select: none; }

/* 平板：两栏阅读更舒服，表单居中 */
@media (min-width: 768px) and (max-width: 1023px) {
  .ln-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ln { padding: 12px 12px; }
}
/* 电脑大屏：留白更宽松 */
@media (min-width: 1024px) {
  .intro { padding: 56px 0 34px; }
  .sec > summary { padding: 18px 26px; }
  .sec-body { padding: 0 26px 24px; }
  .sheet-head { padding-top: 36px; }
}
/* 横屏手机：压缩高度占用 */
@media (max-height: 500px) and (orientation: landscape) {
  .intro { padding: 16px 0 14px; }
  .intro h1 { font-size: 26px; }
  .loading { min-height: 80vh; }
  .toolbar { position: static; }
}

/* v1.1：出生地两级选择、精简结果页 */
.row2.row2--tight { grid-template-columns: 1fr 1fr; gap: 10px; }
select:disabled { opacity: .55; }
.big-wx { display: inline-block; margin-right: 12px; font: 700 24px/1.2 var(--serif); }
.ft-grid--one { grid-template-columns: 1fr; }
.p-tip { line-height: 1.4; text-align: center; }
