:root {
  --ink: #24312d;
  --muted: #68746f;
  --paper: #f3efe7;
  --card: #fffdf9;
  --line: #dedbd2;
  --accent: #2f6f62;
  --soft: #dcebe6;
  --warn: #9a6b3f;
  --danger: #8b3d3d;
  --gold: #8a6232;
  --water: #3d7ea6;
  --fire: #a33b32;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(47, 111, 98, 0.12), transparent 60%),
    radial-gradient(900px 420px at 100% 0%, rgba(184, 107, 69, 0.1), transparent 55%),
    linear-gradient(180deg, #f7f4ee 0%, var(--paper) 100%);
}

a { color: var(--accent); }

.shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 72px;
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 22px;
}

.brand {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-decoration: none;
}

.topnav-links {
  display: flex;
  gap: 14px;
  font-size: 14px;
}

.topnav-links a {
  text-decoration: none;
  color: var(--muted);
}

.topnav-links a:hover { color: var(--accent); }

h1 {
  margin: 0 0 10px;
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-size: clamp(28px, 6vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.lead {
  margin: 0 0 18px;
  max-width: 42em;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.disclaimer {
  margin: 0 0 22px;
  padding: 14px 16px;
  border: 1px solid #e4d5c4;
  border-radius: 12px;
  background: #fbf6ef;
  color: #6d5a48;
  font-size: 13px;
  line-height: 1.7;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(41, 52, 48, 0.04);
  padding: 18px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 16px;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field.wide { grid-column: 1 / -1; }

.field span,
.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

input, select, button { font: inherit; color: inherit; }

input, select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

input:focus, select:focus {
  outline: 3px solid var(--soft);
  border-color: #9abcb3;
}

.btn {
  appearance: none;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 12px 16px;
  cursor: pointer;
}

.btn:disabled { opacity: 0.55; cursor: wait; }

.error {
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 14px;
  line-height: 1.6;
}

.stack { display: grid; gap: 16px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}

.stat {
  padding: 12px;
  border-radius: 14px;
  background: #f7f4ee;
  border: 1px solid var(--line);
}

.stat b {
  display: block;
  margin-top: 4px;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.stat em {
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
}

.tag {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.tag.gold { background: #f4ead8; color: var(--gold); }
.tag.water { background: #e5f0f6; color: var(--water); }
.tag.fire { background: #f8e8e6; color: var(--fire); }
.tag.wood { background: var(--soft); color: var(--accent); }
.tag.earth { background: #f3eadf; color: var(--gold); }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

caption {
  caption-side: top;
  padding: 0 0 8px;
  text-align: left;
  font-weight: 700;
  color: var(--accent);
}

th, td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: top;
  line-height: 1.55;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}

td:first-child, th:first-child {
  text-align: left;
  color: var(--muted);
  white-space: nowrap;
}

.wuxing {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.wuxing span {
  padding: 6px 10px;
  border-radius: 999px;
  background: #f7f4ee;
  font-weight: 700;
  font-size: 14px;
}

.score {
  margin: 12px 0 0;
  color: var(--ink);
  line-height: 1.7;
}

.reading h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.reading .value {
  margin: 0 0 8px;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 28px;
}

.reading p,
.prose {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.75;
  font-size: 14px;
}

.muted { color: var(--muted); font-size: 13px; line-height: 1.7; }
.source { margin-top: 8px; }

.map {
  display: grid;
  gap: 14px;
}

.letters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.letters div {
  padding: 8px 10px;
  border-radius: 10px;
  background: #f7f4ee;
  font-size: 13px;
}

.aspects {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.aspect {
  padding: 6px 8px;
  border-radius: 10px;
  background: #f7f4ee;
  font-size: 13px;
}

.sign-reading {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sign-reading h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.wheel {
  display: block;
  width: min(100%, 460px);
  height: auto;
  margin: 8px auto 12px;
}

.wheel text {
  fill: var(--ink);
  font-size: 12px;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.wheel .house-no { fill: var(--muted); font-size: 11px; }
.wheel .planet-name { font-size: 11px; }
.wheel .wheel-center { fill: var(--accent); font-size: 12px; }

.foot {
  margin-top: 28px;
  color: var(--muted);
  font-size: 12px;
}

.foot a { color: inherit; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .shell { padding-top: 24px; }
  .letters { grid-template-columns: 1fr 1fr; }
}
