:root {
  --paper: #fbf7f0;
  --card: #ffffff;
  --ink: #2a211c;
  --muted: #6f6259;
  --line: #eadfd2;
  --red: #b8322a;
  --red-dark: #8f241e;
  --gold: #c79a3b;
  --wood: #4f8a4b;
  --fire: #d0482f;
  --earth: #a97a3c;
  --metal: #8d8f96;
  --water: #2f6fa3;
  /* darker text variants: >= 4.5:1 on white and on the paper background */
  --wood-text: #3e7340;
  --fire-text: #b53a22;
  --earth-text: #86602a;
  --metal-text: #626469;
  --water-text: #2f6fa3;
  --serif: "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
}
a { color: var(--red); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; margin-top: 1.2em; }
p { margin: 0 0 1em; }
.zh { font-family: var(--serif); }
.py { color: var(--muted); }

/* layout */
.wrap { max-width: 760px; margin: 0 auto; padding: 8px 16px 48px; }
.site-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  max-width: 760px; margin: 0 auto; padding: 14px 16px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none;
}
.seal { width: 22px; height: 22px; border-radius: 5px; background: var(--red); box-shadow: inset 0 0 0 4px var(--red), inset 0 0 0 6px #fff; }
.site-head nav { display: flex; gap: 16px; font-size: .95rem; }
.site-head nav a { color: var(--muted); text-decoration: none; }
.site-head nav a:hover { color: var(--red); }
.site-foot {
  max-width: 760px; margin: 0 auto; padding: 24px 16px 40px;
  color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line);
}
.site-foot p { margin: 0 0 .4em; }

.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; color: var(--red); font-weight: 600; margin-bottom: .6em; }
.lede { font-size: 1.1rem; color: var(--muted); }
.intro, .hero { padding: 24px 0 8px; }
.hero h1 { font-size: 2.3rem; }
.note { color: var(--muted); font-size: .9rem; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin: 16px 0; box-shadow: 0 1px 2px rgba(60, 40, 20, .04);
}
.prose p:last-child { margin-bottom: 0; }

/* buttons */
.btn {
  display: inline-block; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--red); color: #fff; font: 600 1rem/1 var(--sans);
  padding: 15px 26px; text-decoration: none; text-align: center;
}
.btn:hover { background: var(--red-dark); }
.btn-big { width: 100%; font-size: 1.1rem; padding: 18px 24px; }
.btn-light { background: #fff; color: var(--ink); }
.btn-light:hover { background: #fff3e6; }
.btn-ghost { background: transparent; color: var(--red); border: 1.5px solid var(--red); }
.btn-ghost:hover { background: #fff1ee; }

/* home */
.choices { display: grid; gap: 14px; margin: 20px 0; }
.choice {
  display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.choice:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(60, 40, 20, .08); }
.choice-accent { background: var(--red); color: #fff; border-color: var(--red); }
.choice-kicker { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; opacity: .75; }
.choice-title { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; }
.choice-text { opacity: .85; }
.choice-go { font-weight: 600; margin-top: 4px; }
.how ol { padding-left: 1.2em; }
.how li { margin-bottom: .6em; }

/* forms */
.form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > label, legend { font-weight: 600; padding: 0; }
.opt { font-weight: 400; color: var(--muted); font-size: .9rem; }
input[type=text], input:not([type]), input[type=date], input[type=time], textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; min-height: 48px;
}
input:focus, textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(184, 50, 42, .15); }
input:disabled { background: #f4efe8; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: .95rem; }
.check input { width: 18px; height: 18px; accent-color: var(--red); }
.row2 { display: grid; gap: 18px; }
.pills, .styles { display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); margin-top: 6px; }
.styles { grid-template-columns: repeat(2, 1fr); }
.pill input, .style input { position: absolute; opacity: 0; pointer-events: none; }
.pill span, .style span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  min-height: 48px; padding: 10px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff;
}
.style b { font-weight: 600; }
.style small { color: var(--muted); font-size: .8rem; }
.pill input:checked + span, .style input:checked + span { border-color: var(--red); background: #fff1ee; color: var(--red-dark); }
.pill input:focus-visible + span, .style input:focus-visible + span { box-shadow: 0 0 0 3px rgba(184, 50, 42, .25); }
.from-chart { background: #fff7e8; border: 1px solid #f0dfba; border-radius: 10px; padding: 12px 14px; margin: 0; }
.error { background: #fff0ee; border: 1px solid #f2c4bf; color: var(--red-dark); border-radius: 10px; padding: 12px 14px; margin: 0 0 4px; }

/* bazi chart */
.pillars {
  display: grid; gap: 6px 8px; grid-template-columns: repeat(4, 1fr);
  grid-template-rows: auto auto auto; grid-auto-flow: column; text-align: center;
}
.pillars-3 { grid-template-columns: repeat(3, 1fr); }
.pillar { display: contents; }
.pillar-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pillar-day .pillar-label { color: var(--red); font-weight: 700; }
.gz {
  display: flex; flex-direction: column; align-items: center; padding: 10px 4px;
  border-radius: 10px; background: #faf6f1; border-top: 3px solid var(--el, var(--line));
}
.gz .zh { font-size: 2.1rem; line-height: 1.15; color: var(--el-text, var(--ink)); }
.gz .py { font-size: .9rem; }
.gz .el, .why-char .el { font-size: .72rem; color: var(--muted); }
.el-wood { --el: var(--wood); --el-text: var(--wood-text); }
.el-fire { --el: var(--fire); --el-text: var(--fire-text); }
.el-earth { --el: var(--earth); --el-text: var(--earth-text); }
.el-metal { --el: var(--metal); --el-text: var(--metal-text); }
.el-water { --el: var(--water); --el-text: var(--water-text); }
.pillars + .note { margin: 12px 0 0; text-align: center; }

.bars { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: 8.5em 1fr auto; align-items: center; gap: 10px; font-size: .95rem; }
.bar { height: 10px; border-radius: 99px; background: #f1ebe3; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--el); border-radius: 99px; }
.bar-n { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.is-needed .bar-name, .is-needed .bar-n { color: var(--el-text); font-weight: 700; }
.notes { padding-left: 1.1em; margin: 0; }
.notes li { margin-bottom: .6em; }
.suits { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.suits dt { font-weight: 600; }
.suits dd { margin: 0; }

.cta {
  margin: 24px 0; padding: 26px 22px; border-radius: var(--radius); color: #fff;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
}
.cta-text { font-family: var(--serif); font-size: 1.3rem; line-height: 1.4; }

/* name result */
.name-hero { text-align: center; padding: 28px 0 8px; }
.name { font-size: 56px; font-weight: 700; letter-spacing: .12em; line-height: 1.2; }
.name-py { font-size: 1.35rem; color: var(--muted); margin-top: 4px; letter-spacing: .02em; }
.name-hero audio { margin: 14px auto 0; display: block; width: 100%; max-width: 320px; }
.hints { list-style: none; padding: 0; margin: 18px 0 12px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.hints li { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-family: var(--serif); }
.bookmark { text-align: center; font-weight: 600; color: var(--red-dark); background: #fff7e8; border: 1px solid #f0dfba; border-radius: 10px; padding: 10px 14px; }
.locked { text-align: left; background: linear-gradient(180deg, #fff, #fff7ef); }
.locked-list { list-style: none; padding: 0; margin: 0 0 18px; }
.locked-list li { padding: 8px 0 8px 30px; position: relative; border-bottom: 1px dashed var(--line); }
.locked-list li::before {
  content: ""; position: absolute; left: 4px; top: 13px; width: 14px; height: 11px;
  border: 2px solid var(--gold); border-radius: 3px;
}
.locked-list li::after {
  content: ""; position: absolute; left: 7px; top: 6px; width: 8px; height: 8px;
  border: 2px solid var(--gold); border-bottom: 0; border-radius: 6px 6px 0 0;
}
.locked .note { text-align: center; margin: 10px 0 0; }
.why { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.why-char {
  flex: 0 0 72px; display: flex; flex-direction: column; align-items: center; padding: 8px 4px;
  border-radius: 10px; background: #faf6f1; border-top: 3px solid var(--el);
}
.why-char .zh { font-size: 2rem; line-height: 1.2; color: var(--el-text); }
.why p { margin: 0; }
.summary { font-family: var(--serif); font-size: 1.1rem; border-left: 3px solid var(--gold); padding-left: 14px; }
.famous { padding-left: 1.1em; }
.famous li { margin-bottom: .4em; }
.sources { font-size: .85rem; color: var(--muted); margin-top: 12px; }
.sources a { word-break: break-all; color: var(--muted); }
.again { text-align: center; margin: 24px 0; }
.again form { margin-bottom: 12px; }

@media (min-width: 640px) {
  h1 { font-size: 2.4rem; }
  .hero h1 { font-size: 2.8rem; }
  .choices { grid-template-columns: 1fr 1fr; }
  .row2 { grid-template-columns: 1fr 1fr; }
  .styles { grid-template-columns: repeat(4, 1fr); }
  .gz .zh { font-size: 2.6rem; }
  .name { font-size: 72px; }
  .card { padding: 26px; }
}
@media (max-width: 380px) {
  .bars li { grid-template-columns: 7.5em 1fr auto; font-size: .85rem; }
  .gz .zh { font-size: 1.8rem; }
}
@media (max-width: 360px) {
  .pill span, .style span { font-size: .85rem; padding: 8px 4px; }
  .name { font-size: 48px; }
}
