:root {
  color-scheme: light;
  --ink: #101a34;
  --muted: #626d80;
  --line: #dfe3ec;
  --canvas: #eef2f8;
  --paper: #fffdf9;
  --indigo: #303d8e;
  --indigo-deep: #18245d;
  --copper: #bd7b48;
  --copper-pale: #f8eadc;
  --mint: #e4f2e9;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--canvas); }
button, input, select { font: inherit; }
button, input, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #edb66e; outline-offset: 3px; }

.site-header { width: min(1180px, calc(100% - 40px)); margin: 0 auto; min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; width: 39px; height: 39px; place-items: center; border-radius: 13px 13px 13px 4px; background: var(--indigo); color: white; font-family: Georgia, serif; font-size: 21px; box-shadow: 0 8px 18px #303d8e3d; }
.brand strong { display: block; letter-spacing: .08em; font-size: 16px; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; letter-spacing: .06em; }
nav { display: flex; gap: 22px; }
nav a { color: #47526a; text-decoration: none; font-size: 14px; }
nav a:hover { color: var(--indigo); }

main { overflow: hidden; }
.hero { position: relative; max-width: 920px; margin: 64px auto 48px; text-align: center; padding: 0 20px; }
.hero::before, .hero::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(4px); }
.hero::before { width: 300px; height: 300px; left: -130px; top: -130px; background: #d8dafa; opacity: .6; }
.hero::after { width: 280px; height: 280px; right: -100px; bottom: -90px; background: #f2d8c1; opacity: .55; }
.eyebrow { margin: 0 0 12px; color: var(--copper); font-size: 12px; font-weight: 750; letter-spacing: .15em; text-transform: uppercase; }
.hero h1 { margin: 0; max-width: 780px; font-family: Georgia, "Songti SC", serif; font-size: clamp(42px, 7vw, 74px); font-weight: 500; line-height: 1.08; letter-spacing: -.055em; }
.hero h1 em { color: var(--indigo); font-style: normal; }
.hero-copy { max-width: 630px; margin: 24px auto; color: var(--muted); font-size: 16px; line-height: 1.8; }
.hero-tags { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.hero-tags span { padding: 7px 11px; border: 1px solid #d9deeb; border-radius: 100px; color: #556176; background: #f8fafc99; font-size: 12px; }

.workspace { width: min(1080px, calc(100% - 40px)); margin: 0 auto; display: grid; grid-template-columns: minmax(0, .94fr) minmax(0, 1.06fr); align-items: start; gap: 20px; }
.calculator-card, .result-card { border: 1px solid #e6e2dc; border-radius: 24px; box-shadow: 0 18px 45px #101a3410; }
.calculator-card { padding: clamp(24px, 4vw, 42px); background: var(--paper); }
.card-heading h2, .result-heading h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 30px; font-weight: 500; letter-spacing: -.04em; }
.card-heading p:not(.eyebrow) { margin: 8px 0 30px; color: var(--muted); font-size: 14px; }
.calendar-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0; margin: 0 0 24px; border: 0; }
.calendar-toggle legend, .field-label { width: 100%; margin-bottom: 10px; font-size: 13px; font-weight: 750; }
.calendar-toggle label { display: block; }
.calendar-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.calendar-toggle span { display: flex; min-height: 46px; align-items: center; justify-content: center; border: 1px solid #dfe2eb; border-radius: 12px; color: var(--muted); cursor: pointer; font-weight: 700; }
.calendar-toggle input:checked + span { color: white; border-color: var(--indigo); background: var(--indigo); box-shadow: 0 6px 15px #303d8e36; }
.field-group, .lunar-fields { margin: 0 0 22px; }
.field-group > label:not(.check-row) { display: block; margin-bottom: 10px; font-size: 13px; font-weight: 750; }
input[type="date"], input[type="time"], select { width: 100%; min-height: 48px; border: 1px solid #d9dde7; border-radius: 12px; padding: 0 13px; color: var(--ink); background: #fff; }
.select-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 8px; }
.check-row { display: inline-flex; align-items: center; gap: 8px; margin-top: 11px; color: #5a667a; font-size: 13px; cursor: pointer; }
.check-row input { width: 17px; height: 17px; accent-color: var(--indigo); }
.check-row input:disabled + span { color: #abb3c1; cursor: not-allowed; }
.time-field { display: grid; grid-template-columns: 1fr auto; column-gap: 14px; align-items: center; }
.time-field > label:first-child { grid-column: 1 / -1; }
.time-field .check-row { margin: 0; }
.form-note { margin: 0 0 18px; color: #7a8394; font-size: 12px; line-height: 1.65; }
.primary-action { display: flex; width: 100%; min-height: 52px; align-items: center; justify-content: center; gap: 12px; border: 0; border-radius: 13px; color: white; background: var(--indigo); cursor: pointer; font-weight: 750; transition: transform .2s, background .2s; }
.primary-action:hover { background: var(--indigo-deep); transform: translateY(-1px); }
.primary-action span { font-size: 19px; }
.form-status { min-height: 20px; margin: 12px 0 0; color: #58705f; font-size: 13px; line-height: 1.5; }

.result-card { min-height: 490px; padding: clamp(24px, 4vw, 42px); color: #eef1fa; border-color: #26336f; background: radial-gradient(circle at 90% 4%, #4556b1 0, transparent 34%), linear-gradient(145deg, #1b275f, #111a43); }
.result-card[hidden] { display: none; }
.result-heading h2 { color: white; }
.date-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 22px; padding: 21px 0; margin: 23px 0 22px; border-block: 1px solid #ffffff24; }
.date-summary div { display: flex; flex-direction: column; gap: 4px; }
.date-summary dt { color: #aeb8da; font-size: 11px; }
.date-summary dd { margin: 0; color: white; font-size: 14px; font-weight: 650; }
.pillar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pillar-card { min-width: 0; min-height: 126px; padding: 13px 8px; border: 1px solid #ffffff1c; border-radius: 14px; text-align: center; background: #ffffff0b; }
.pillar-name, .pillar-parts { display: block; color: #aeb8da; font-size: 11px; }
.pillar-value { display: block; margin: 15px 0 10px; color: #fff7e9; font-family: Georgia, "Songti SC", serif; font-size: 27px; letter-spacing: .04em; }
.pillar-value.is-pending { font-family: inherit; color: #c7cde2; font-size: 14px; letter-spacing: 0; }
.characters-readout { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 22px; padding: 17px; border-radius: 14px; background: #fff4dd; color: #34405e; }
.characters-label { color: #887253; font-size: 12px; font-weight: 700; }
.characters-value { color: #1d2853; font-family: Georgia, "Songti SC", serif; font-size: 24px; letter-spacing: .12em; }
.result-notice { margin: 15px 0 0; color: #bdc6e1; font-size: 12px; line-height: 1.7; }

.rule-section { width: min(1080px, calc(100% - 40px)); margin: 90px auto; padding-top: 12px; display: grid; grid-template-columns: .75fr 1.25fr; gap: 70px; }
.rule-section h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 34px; line-height: 1.25; font-weight: 500; letter-spacing: -.04em; }
.rule-grid { display: grid; gap: 0; border-top: 1px solid #d7dce7; }
.rule-grid article { position: relative; padding: 22px 0 22px 46px; border-bottom: 1px solid #d7dce7; }
.rule-grid span { position: absolute; left: 0; top: 24px; color: var(--copper); font-size: 12px; font-weight: 800; }
.rule-grid h3 { margin: 0 0 8px; font-size: 16px; }
.rule-grid p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
footer { padding: 30px 20px 38px; border-top: 1px solid #d8dde7; color: #7d8798; text-align: center; font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; clip-path: inset(50%); }

@media (max-width: 820px) {
  .workspace, .rule-section { grid-template-columns: 1fr; }
  .result-card { min-height: 0; }
  .rule-section { gap: 28px; }
}

@media (max-width: 480px) {
  .site-header, .workspace, .rule-section { width: min(100% - 28px, 1080px); }
  .site-header { min-height: 70px; }
  nav { gap: 13px; }
  nav a { font-size: 12px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 11px 11px 11px 3px; }
  .brand strong { font-size: 14px; }
  .brand small { font-size: 9px; }
  .hero { margin: 43px auto 35px; padding: 0 18px; }
  .hero h1 { font-size: 43px; }
  .hero-copy { font-size: 14px; }
  .calculator-card, .result-card { border-radius: 19px; padding: 23px; }
  .card-heading h2, .result-heading h2 { font-size: 27px; }
  .time-field { grid-template-columns: 1fr; }
  .time-field .check-row { margin-top: 10px; }
  .pillar-grid { grid-template-columns: 1fr 1fr; }
  .pillar-card { min-height: 108px; }
  .characters-readout { align-items: flex-start; flex-direction: column; }
  .date-summary { grid-template-columns: 1fr; }
  .rule-section { margin: 64px auto; }
  .rule-section h2 { font-size: 29px; }
}
