:root {
  --ink: #2c2e2b;
  --muted: #696b65;
  --paper: #fffdf8;
  --cream: #f7f2e9;
  --line: #ded8cc;
  --rose: #ca637d;
  --rose-soft: #f5dfe4;
  --forest: #315848;
  --wood: #3f7c55;
  --fire: #c65d49;
  --earth: #a67c3d;
  --metal: #66717a;
  --water: #3f6686;
  --shadow: 0 24px 70px rgba(58, 48, 40, 0.1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--ink); background: radial-gradient(circle at 15% 3%, rgba(202,99,125,.13), transparent 23rem), radial-gradient(circle at 90% 20%, rgba(49,88,72,.12), transparent 27rem), var(--cream); font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.page-header { height: 72px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(90,75,62,.12); background: rgba(255,253,248,.9); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 20; }
.brand { display: grid; gap: 1px; color: var(--forest); }
.brand strong { font-family: "Songti TC", "Noto Serif TC", Georgia, serif; font-size: 1.1rem; letter-spacing: .08em; }
.brand small { color: var(--rose); font-family: Georgia, serif; font-size: .58rem; letter-spacing: .12em; }
.back-link { padding: 8px 0; color: var(--forest); font-size: .92rem; font-weight: 800; }

main { width: min(100% - 28px, 1080px); margin: 0 auto; padding: 30px 0 76px; }
.intro { display: grid; gap: 22px; align-items: center; }
.eyebrow, .section-heading span, .analysis-card > span { color: var(--rose); font-size: .75rem; font-weight: 850; letter-spacing: .14em; }
.intro h1 { margin: 8px 0 0; color: #273b32; font-family: "Songti TC", "Noto Serif TC", Georgia, serif; font-size: clamp(2.5rem, 12vw, 5rem); letter-spacing: -.06em; line-height: 1.12; }
.intro h1 i { color: var(--rose); font-style: normal; font-weight: 400; }
.intro p { max-width: 660px; margin: 14px 0 0; color: var(--muted); font-size: 1rem; line-height: 1.8; }
.rule-seal { width: 130px; height: 130px; padding: 18px; display: grid; align-content: center; justify-items: center; border-radius: 50%; color: #fff; background: var(--forest); box-shadow: 0 18px 45px rgba(49,88,72,.2); transform: rotate(4deg); }
.rule-seal b { font-size: .8rem; letter-spacing: .12em; }
.rule-seal span { font-family: Georgia, serif; font-size: 2rem; line-height: 1.15; }
.rule-seal small { opacity: .72; font-size: .66rem; }

.birthday-guide { margin-top: 28px; padding: 20px 18px; display: grid; grid-template-columns: auto 1fr; gap: 15px; border: 1px solid rgba(49,88,72,.2); border-radius: 24px; background: rgba(255,253,248,.86); box-shadow: 0 16px 45px rgba(58,48,40,.07); }
.guide-number { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 14px; color: #fff; background: var(--forest); font-family: Georgia, serif; font-weight: 800; }
.birthday-guide h2 { margin: 5px 0 0; color: #273b32; font-family: "Songti TC", "Noto Serif TC", Georgia, serif; font-size: 1.45rem; }
.birthday-guide p { margin: 8px 0 0; color: var(--muted); line-height: 1.7; }
.birthday-guide > div:last-child > small { display: block; margin-top: 9px; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.formula-example { margin-top: 13px; padding: 12px 14px; display: grid; gap: 3px; border-radius: 14px; color: var(--forest); background: #edf2ee; }
.formula-example b { font-size: .82rem; }
.formula-example span { font-size: .85rem; line-height: 1.55; }
.formula-example strong { color: var(--rose); font-size: 1.08rem; }

.analyzer { margin-top: 30px; display: grid; gap: 13px; }
.person-panel { padding: 22px 17px; border: 1px solid rgba(255,255,255,.88); border-radius: 26px; background: rgba(255,253,248,.92); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: center; gap: 12px; }
.panel-heading > span { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 42px; border-radius: 14px; color: #fff; background: var(--forest); font-size: 1.1rem; font-weight: 900; }
.person-b .panel-heading > span { background: var(--rose); }
.panel-heading > div { min-width: 0; flex: 1; }
.panel-heading label { display: block; color: var(--muted); font-size: .76rem; font-weight: 750; }
.panel-heading input { width: 100%; margin-top: 2px; border: 0; border-bottom: 1px solid var(--line); padding: 5px 0 7px; color: var(--ink); background: transparent; outline: none; font-weight: 700; }
.panel-heading input:focus { border-color: var(--forest); }
.birthday-field { margin-top: 18px; }
.birthday-field label { display: block; color: var(--muted); font-size: .78rem; font-weight: 800; }
.birthday-field input { width: 100%; min-height: 48px; margin-top: 6px; border: 1px solid #cfc7ba; border-radius: 13px; padding: 0 12px; color: var(--ink); background: #fff; outline: none; }
.birthday-field input:focus { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(202,99,125,.12); }
.birthday-result { min-height: 23px; margin-top: 7px; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.birthday-result.is-calculated { color: var(--forest); font-weight: 750; }
.person-panel > p { margin: 16px 0 10px; color: var(--muted); font-size: .85rem; }
.number-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.number-button { min-height: 58px; border: 1px solid var(--line); border-radius: 16px; background: #fff; cursor: pointer; transition: .18s ease; }
.number-button b { display: block; font-family: Georgia, serif; font-size: 1.25rem; }
.number-button small { color: var(--muted); font-size: .69rem; }
.number-button:hover { transform: translateY(-1px); border-color: #a8a497; }
.number-button[aria-checked="true"] { color: #fff; border-color: var(--element-color); background: var(--element-color); box-shadow: 0 9px 22px color-mix(in srgb, var(--element-color) 25%, transparent); }
.number-button[aria-checked="true"] small { color: rgba(255,255,255,.75); }
.element-木 { --element-color: var(--wood); }
.element-火 { --element-color: var(--fire); }
.element-土 { --element-color: var(--earth); }
.element-金 { --element-color: var(--metal); }
.element-水 { --element-color: var(--water); }
.mini-profile { margin-top: 13px; min-height: 70px; padding: 13px; border-radius: 16px; color: #fff; background: var(--element-color); }
.mini-profile strong { display: block; font-size: 1rem; }
.mini-profile p { margin: 5px 0 0; opacity: .82; font-size: .78rem; line-height: 1.5; }
.relationship-axis { height: 42px; display: grid; place-items: center; position: relative; }
.relationship-axis i { position: absolute; width: 1px; height: 100%; background: #bbb5aa; }
.relationship-axis span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--forest); font-family: "Songti TC", serif; font-weight: 900; z-index: 1; }

.context-card { margin-top: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.68); }
.context-card label { display: block; font-weight: 800; }
.context-card select { width: 100%; min-height: 48px; margin-top: 8px; border: 1px solid #cfc7ba; border-radius: 13px; padding: 0 12px; color: var(--ink); background: #fff; }
.context-card p { margin: 8px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.55; }

.result-section { margin-top: 26px; padding: 24px 16px; border: 1px solid rgba(255,255,255,.9); border-radius: 28px; background: rgba(255,253,248,.94); box-shadow: var(--shadow); }
.result-hero { display: grid; gap: 16px; align-items: center; }
.result-hero h2 { margin: 7px 0 0; color: #253d32; font-family: "Songti TC", "Noto Serif TC", Georgia, serif; font-size: clamp(1.9rem, 8vw, 3.5rem); line-height: 1.25; letter-spacing: -.045em; }
.result-hero p { margin: 9px 0 0; color: var(--muted); line-height: 1.7; }
.direction-badge { min-height: 86px; padding: 14px; display: grid; place-items: center; align-content: center; border-radius: 20px; color: #fff; background: var(--forest); text-align: center; }
.direction-badge strong { font-size: 1.25rem; }
.direction-badge span { margin-top: 3px; opacity: .75; font-size: .76rem; }

.profile-results { margin-top: 22px; display: grid; gap: 11px; }
.profile-card { padding: 18px; border-radius: 19px; color: #fff; background: var(--element-color); }
.profile-card header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.profile-card header b { font-size: 1.05rem; }
.profile-card header span { padding: 5px 8px; border: 1px solid rgba(255,255,255,.35); border-radius: 99px; font-size: .73rem; }
.profile-number { margin-top: 16px; display: flex; align-items: end; gap: 10px; }
.profile-number strong { font-family: Georgia, serif; font-size: 3rem; line-height: .9; }
.profile-number span { opacity: .8; }
.profile-card p { margin: 13px 0 0; opacity: .86; line-height: 1.65; }

.analysis-grid { margin-top: 12px; display: grid; gap: 10px; }
.analysis-card { padding: 18px; border: 1px solid var(--line); border-radius: 19px; background: #fff; }
.analysis-card h3 { margin: 7px 0 0; color: #273c33; font-family: "Songti TC", "Noto Serif TC", Georgia, serif; font-size: 1.25rem; }
.analysis-card p { margin: 8px 0 0; color: var(--muted); font-size: .88rem; line-height: 1.7; }
.relation-card { background: #f3eee3; }

.complement-section, .roles-section { margin-top: 30px; }
.section-heading h2 { margin: 4px 0 0; color: #273c33; font-family: "Songti TC", "Noto Serif TC", Georgia, serif; font-size: 1.55rem; }
.complement-grid, .roles-layout { margin-top: 13px; display: grid; gap: 10px; }
.complement-grid article, .role-card { padding: 17px; border-radius: 18px; background: var(--rose-soft); }
.complement-grid article:nth-child(2) { background: #e6ede8; }
.complement-grid b, .role-card strong { color: #34463d; }
.complement-grid p, .role-card p { margin: 7px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.65; }
.role-card { background: #fff; border: 1px solid var(--line); }
.role-card small { display: block; margin-bottom: 6px; color: var(--rose); font-weight: 850; }
.role-card strong { display: block; font-size: 1.05rem; }
.joint-advice { margin: 11px 0 0; padding: 15px 16px; border-left: 3px solid var(--forest); color: #4c5b53; background: #edf2ee; font-size: .88rem; line-height: 1.7; }
.questionnaire-section { margin-top: 30px; padding: 19px; border: 1px solid var(--line); border-radius: 20px; background: #f7f2e9; }
.questionnaire-section > p { margin: 9px 0 16px; color: var(--muted); font-size: .88rem; line-height: 1.7; }
.questionnaire-section label { display: block; margin-bottom: 7px; color: var(--forest); font-size: .86rem; font-weight: 850; }
.questionnaire-section textarea { width: 100%; min-height: 150px; resize: vertical; border: 1px solid #cfc7ba; border-radius: 15px; padding: 13px 14px; color: var(--ink); background: #fff; font: inherit; font-size: .92rem; line-height: 1.6; outline: none; }
.questionnaire-section textarea:focus { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(202,99,125,.12); }
.copy-area { margin-top: 28px; text-align: center; }
.copy-area button { min-width: 190px; min-height: 50px; border: 0; border-radius: 99px; color: #fff; background: var(--forest); cursor: pointer; font-weight: 850; box-shadow: 0 12px 28px rgba(49,88,72,.2); }
.copy-area button:hover { background: #243f34; }
.copy-area p { min-height: 20px; margin: 7px 0 0; color: var(--forest); font-size: .82rem; }
.line-cta { margin-top: 18px; padding: 18px; display: grid; gap: 6px; border-radius: 18px; color: #fff; background: var(--forest); }
.line-cta > span { color: rgba(255,255,255,.72); font-size: .84rem; }
.line-cta a { font-size: 1.05rem; font-weight: 900; }
.line-cta strong { color: #f2a7b8; }
.line-cta small { color: rgba(255,255,255,.65); font-size: .75rem; }

.rules-reference { margin-top: 20px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.65); overflow: hidden; }
.rules-reference summary { padding: 17px 18px; cursor: pointer; color: var(--forest); font-weight: 850; }
.rule-columns { padding: 0 18px 18px; display: grid; gap: 10px; }
.rule-columns > div { padding: 14px; border-radius: 15px; background: #fff; }
.rule-columns h3 { margin: 0; font-size: 1rem; }
.rule-columns p { margin: 6px 0; font-weight: 750; line-height: 1.5; }
.rule-columns small { color: var(--muted); line-height: 1.55; }

footer { padding: 0 20px 42px; text-align: center; color: var(--muted); }
footer a { color: var(--forest); font-family: "Songti TC", serif; font-weight: 850; }
footer p { margin: 7px 0 0; font-size: .8rem; }
.copy-helper { position: fixed; opacity: 0; pointer-events: none; }

@media (min-width: 760px) {
  .page-header { height: 78px; padding: 0 30px; }
  .brand strong { font-size: 1.2rem; }
  main { padding-top: 50px; }
  .intro { grid-template-columns: 1fr auto; }
  .birthday-guide { padding: 24px; gap: 19px; }
  .birthday-guide h2 { font-size: 1.65rem; }
  .analyzer { grid-template-columns: 1fr 66px 1fr; align-items: stretch; }
  .relationship-axis { height: auto; }
  .relationship-axis i { width: 100%; height: 1px; }
  .person-panel { padding: 25px; }
  .context-card { display: grid; grid-template-columns: auto 230px 1fr; align-items: center; gap: 14px; }
  .context-card select { margin-top: 0; }
  .context-card p { margin: 0; }
  .result-section { padding: 38px; }
  .result-hero { grid-template-columns: 1fr 210px; }
  .profile-results { grid-template-columns: 1fr 1fr; }
  .analysis-grid { grid-template-columns: repeat(3, 1fr); }
  .complement-grid, .roles-layout { grid-template-columns: 1fr 1fr; }
  .rule-columns { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
