:root {
  --paper: #f6efdd;
  --paper2: #fffdf6;
  --ink: #2b2118;
  --red: #8c2b2e;
  --red-deep: #7a1f1f;
  --gold: #b8862f;
  --gold-soft: #e8d9ae;
  --line: #c9b894;
  --muted: #7a6a55;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  font-size: 15px;
  line-height: 1.55;
}
.site-head { text-align: center; padding: 20px 12px 6px; }
.site-head h1 {
  margin: 0; font-size: 26px; letter-spacing: .35em; text-indent: .35em;
  color: var(--red-deep); font-weight: 700;
}
.site-head .sub { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; letter-spacing: .12em; }
main { max-width: 560px; margin: 0 auto; padding: 10px 10px 28px; }
.card {
  background: var(--paper2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 14px 16px;
  margin: 12px 0;
  box-shadow: 0 1px 3px rgba(90, 60, 20, .08);
}
.card h2 {
  margin: 0 0 10px; font-size: 17px; color: var(--red-deep);
  border-bottom: 2px solid var(--gold-soft); padding-bottom: 6px; letter-spacing: .2em;
}
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13.5px; color: var(--muted); margin-bottom: 5px; }
.field .opt { font-size: 12px; }
input[type="text"], select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 7px;
  padding: 9px 10px; appearance: none;
}
.row3 { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 8px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button {
  font: inherit; font-size: 15.5px; padding: 9px 0; border-radius: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
}
.seg button.on { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
#go {
  width: 100%; font: inherit; font-size: 17px; font-weight: 700; letter-spacing: .3em; text-indent: .3em;
  background: var(--red); color: #fdf6e0; border: none; border-radius: 8px; padding: 12px 0; cursor: pointer;
  margin-top: 2px;
}
#go:active { background: var(--red-deep); }
.err { color: #b3261e; font-size: 14px; margin: 10px 0 0; }

/* ── 命盘 ─────────────────────────── */
.board-wrap { margin: 14px 0 2px; }
.board {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px;
  background: var(--red-deep); padding: 3px; border-radius: 8px;
}
.palace {
  background: var(--paper2); border-radius: 3px; padding: 5px 5px 4px;
  min-height: 128px; display: flex; flex-direction: column; position: relative;
}
.palace.cur-daxian { box-shadow: inset 0 0 0 2px var(--gold); }
.p-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; color: var(--muted); }
.p-head .gz { font-weight: 600; color: #5d4a2f; }
.p-head .dx { font-size: 10.5px; }
.stars { flex: 1; padding: 3px 0 2px; }
.major { font-size: 15.5px; font-weight: 700; color: var(--red-deep); line-height: 1.5; }
.major .br { font-size: 10px; font-weight: 400; color: #a08b62; margin-left: 1px; }
.minor-line { font-size: 10.8px; line-height: 1.55; color: #4c3f30; word-break: break-all; }
.minor-line .br { font-size: 9px; color: #b09a6d; }
.minor-line .sha { color: #8a5a2b; }
.hua {
  display: inline-block; font-size: 9.5px; line-height: 1.3; padding: 0 3px; border-radius: 3px;
  color: #fff; margin-left: 3px; vertical-align: 2px; font-weight: 600;
}
.hua.lu { background: #2e7d32; } .hua.quan { background: #6a3fa0; }
.hua.ke { background: #1565c0; } .hua.ji { background: #c62828; }
.selfhua { font-size: 9.5px; color: #8a6d1f; }
.empty-note { font-size: 10.5px; color: var(--muted); line-height: 1.45; }
.p-foot { border-top: 1px dashed var(--gold-soft); padding-top: 3px; display: flex; align-items: baseline; gap: 4px; }
.p-name { font-size: 14.5px; font-weight: 700; color: var(--ink); letter-spacing: .08em; }
.palace.is-ming .p-name { color: var(--red); }
.tag {
  font-size: 9.5px; line-height: 1.4; padding: 0 4px; border-radius: 3px;
  background: var(--gold); color: #fff; font-weight: 600;
}
.tag.shen { background: #5d7a9c; }
.tag.dxnow { background: var(--red); margin-left: auto; }
.center {
  background: #fdf6e0; border-radius: 3px; padding: 10px 10px 8px;
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
  font-size: 12.8px; line-height: 1.6;
}
.center .c-name { font-size: 17px; font-weight: 700; color: var(--red-deep); text-align: center; letter-spacing: .2em; }
.center .c-row b { color: #5d4a2f; font-weight: 600; }
.center .c-sihua span { margin-right: 6px; white-space: nowrap; }

/* ── 解读 ─────────────────────────── */
.star-block { margin-bottom: 12px; }
.star-block:last-child { margin-bottom: 0; }
.star-block .s-name { font-size: 16.5px; font-weight: 700; color: var(--red-deep); }
.star-block .s-nature { font-size: 12.5px; color: var(--gold); margin-left: 6px; font-weight: 600; }
.star-block p { margin: 3px 0 0; font-size: 14.5px; }
.kw { display: inline-block; font-size: 11.5px; border: 1px solid var(--gold-soft); background: #fdf6e0;
  color: #7a5c14; border-radius: 20px; padding: 1px 8px; margin: 2px 4px 0 0; }
.pat { border-left: 3px solid var(--gold-soft); padding: 2px 0 2px 10px; margin-bottom: 11px; }
.pat:last-child { margin-bottom: 0; }
.pat .p-title { font-size: 15.5px; font-weight: 700; }
.pat .lv { font-size: 11px; font-weight: 600; border-radius: 3px; padding: 1px 5px; margin-left: 6px; color: #fff; vertical-align: 2px; }
.lv.excellent { background: var(--gold); } .lv.good { background: #2e7d32; }
.lv.neutral { background: #8d8577; } .lv.caution { background: #c05621; }
.pat p { margin: 2px 0 0; font-size: 14px; }
.pat .src { font-size: 12px; color: var(--muted); margin-top: 2px; }
.none-note { color: var(--muted); font-size: 14px; margin: 0; }
.daxian-strip { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; }
.dx-chip {
  flex: 0 0 auto; text-align: center; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 9px; background: #fff; font-size: 12.5px; line-height: 1.45; min-width: 74px;
}
.dx-chip .ages { font-weight: 700; font-size: 13.5px; }
.dx-chip.cur { border-color: var(--gold); background: #fdf6e0; box-shadow: inset 0 0 0 1px var(--gold); }
.dx-chip .cur-tag { color: var(--red); font-size: 11px; font-weight: 700; }
.foot { color: var(--muted); font-size: 12.5px; text-align: center; margin-top: 16px; line-height: 1.7; }
.foot p { margin: 2px 0; }
@media (max-width: 380px) {
  .palace { min-height: 120px; }
  .major { font-size: 14.5px; }
  .center { font-size: 12px; }
}
