:root {
  color-scheme: light;
  --paper: #f5efe2;
  --ivory: #fffcf4;
  --green: #153e30;
  --ink: #202f25;
  --muted: #655e50;
  --line: #e2d7c0;
  --gold: #e8ba6b;
  --serif: "Noto Serif CJK SC", "Songti SC", STSong, SimSun, serif;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(ellipse at 50% 0, #fcf7ea, transparent 55%),
    repeating-linear-gradient(135deg, #aa8c5508 0 1px, transparent 1px 7px), var(--paper);
}
.page { width: min(100% - 36px, 680px); margin: 0 auto; padding: 25px 0 22px; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 17px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--green); font-size: 16px; font-weight: 750; letter-spacing: .08em; }
.brand-tile { display: grid; place-items: center; width: 27px; height: 31px; border-radius: 5px; border: 1px solid #c3ae7f; background: #fff9e8; box-shadow: 0 2px #c3ae7f; font: 700 17px var(--serif); }
.masthead-note { color: var(--muted); font-size: 12px; letter-spacing: .09em; }

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 321px;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid #153729;
  background: radial-gradient(ellipse at 75% 50%, #28513a, transparent 65%), #113a2d;
  color: #fff1d1;
  box-shadow: 0 7px 20px #283c2d23;
}
.hero-frame { position: absolute; inset: 9px; border-radius: 12px; border: 1px solid #deba7470; pointer-events: none; }
.hero-frame::after { position: absolute; inset: 4px; border-radius: 8px; border: 1px solid #eaca8f22; content: ""; }
.hero-copy { z-index: 1; padding: 37px 0 38px 39px; }
.hero h1 { margin: 0; font-family: var(--serif); font-size: clamp(31px, 6vw, 47px); line-height: 1.27; letter-spacing: .035em; font-weight: 900; }
.hero h1 span { display: block; }
.gold { color: var(--gold); }
.hero p { margin: 18px 0 0; font-size: 14px; letter-spacing: .05em; color: #eee3c8; }
.hero-art { position: absolute; inset: 0 10px 0 auto; display: grid; place-content: center; width: 52%; padding-bottom: 25px; }
.hero-art::before, .hero-art::after { position: absolute; z-index: -1; inset: 9% 13% 16%; border: 1px solid #deba744c; border-radius: 50%; content: ""; }
.hero-art::after { inset: 13% 17% 20%; border-color: #deba742b; }
.hero-art img { display: block; width: 100%; height: auto; }
.hero-tiles { position: absolute; bottom: 28px; left: 50%; display: flex; gap: 6px; transform: translateX(-50%) rotate(-5deg); }
.tile { display: grid; place-items: center; width: 30px; height: 35px; border: 1px solid #cab98f; border-radius: 5px; background: linear-gradient(#fffaf0, #eae0c6); box-shadow: 0 3px #a79468, 0 5px 7px #15271b20; color: #294c39; font: 700 19px var(--serif); }
.hero-tiles .tile:nth-child(2) { color: #a63e31; }
.hero-tiles .tile:nth-child(4) { translate: 0 3px; rotate: 8deg; }

.today { margin: 14px 0; display: flex; align-items: center; gap: 13px; min-height: 48px; padding: 10px 15px; border: 1px solid var(--line); border-radius: 10px; background: #efe5cf; font-size: 13px; }
.today-label { display: inline-flex; flex: none; align-items: center; gap: 8px; color: #775027; font-weight: 700; }
.calendar-icon { position: relative; width: 15px; height: 14px; border: 1.5px solid currentColor; border-radius: 3px; }
.calendar-icon::before { content: ""; position: absolute; inset: 3px 0 auto; border-top: 1px solid currentColor; }
.calendar-icon::after { content: ""; position: absolute; width: 7px; height: 5px; top: -3px; left: 2.5px; border-inline: 1.5px solid currentColor; }
.today-dates { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; line-height: 1.5; }
.today-dates span:not(:empty) { padding-left: 10px; border-left: 1px solid #cdbd97; }
.panel { border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 4px 14px #35220308; }
.birthday { padding: 22px 24px 18px; background: var(--ivory); }
h2 { margin: 0; color: var(--green); font-family: var(--serif); font-size: 24px; font-weight: 800; }
.calendar-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 15px 0 13px; padding: 4px; border: 1px solid #e9dfc9; border-radius: 9px; background: #f1ebdc; }
.calendar-choice label { position: relative; cursor: pointer; }
.calendar-choice input { position: absolute; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.calendar-choice span { display: block; padding: 9px 5px; border-radius: 6px; color: #405043; text-align: center; font-size: 14px; font-weight: 700; }
.calendar-choice small { margin-left: 4px; font-size: 11px; font-weight: 400; }
.calendar-choice input:checked + span { color: #fff9e9; background: #28543f; box-shadow: 0 2px 4px #13332725; }
.calendar-choice input:focus-visible + span, :is(button, input, select, summary, a):focus-visible { outline: 2px solid #a04b25; outline-offset: 2px; }
.date-fields { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 9px; }
.date-fields label { min-width: 0; color: var(--muted); font-size: 12px; }
.date-fields select, .birth-time input[type="time"] { display: block; width: 100%; min-height: 44px; margin-top: 5px; padding: 6px 8px; border: 1px solid #d8c9ac; border-radius: 7px; background: #fffdf7; color: var(--ink); font: inherit; font-size: 16px; }
.date-fields select:disabled { background: #f8f4eb; color: #746e60; opacity: 1; }
.conversion { margin: 13px 0 0; min-height: 20px; font-size: 13px; line-height: 1.55; color: var(--muted); }
.chart { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.birth-time { color: var(--muted); font-size: 13px; }
.birth-time small { margin-left: .25em; font-size: 11px; }
.unknown-time { width: 100%; min-height: 44px; margin-top: 8px; padding: 7px 10px; border: 1px solid #b2c5a8; border-radius: 7px; background: #e8ecdf; color: var(--green); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.unknown-time:hover { background: #dce8d2; }
.chart h3 { margin: 14px 0 8px; color: var(--green); font: 800 18px var(--serif); }
.pillar-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0; }
.pillar-grid div { min-width: 0; padding: 7px 2px; border: 1px solid #e2d7c0; border-radius: 6px; background: #f5eddd; text-align: center; }
.pillar-grid dd { margin: 3px 0 0; color: var(--green); font: 700 19px var(--serif); }
.pillar-grid dt, .chart-note { color: var(--muted); font-size: 12px; }
.chart-note { margin: 7px 0 0; line-height: 1.5; }

.result { display: grid; grid-template-columns: minmax(0, 1fr) 132px; align-items: center; gap: 15px; margin-top: 14px; padding: 19px 24px; background: #e8ecdf; border-color: #cfd8c3; }
.result.has-direction { background: #e1ead9; border-color: #b2c5a8; }
.direction { margin: 5px 0 0; color: #194b34; font: 900 clamp(30px, 8vw, 49px)/1.16 var(--serif); }
.result-description { margin: 7px 0 0; font-size: 14px; line-height: 1.7; color: #3e5041; }
.result-details { grid-column: 1 / -1; padding-top: 13px; border-top: 1px solid #b2c5a8; color: #3e5041; }
.result-details h3 { margin: 0; color: var(--green); font: 800 18px var(--serif); }
.result-details p { margin: 5px 0 0; font-size: 14px; line-height: 1.75; }
.seat-alternatives { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; }
.seat-alternatives > div { padding: 9px 11px; border: 1px solid #c9d6c3; border-radius: 7px; background: #f3f6ec; }
.seat-alternatives > div:last-child { border-color: #d9cbb5; background: #f1ebdf; }
.seat-alternatives dt { color: #4f5e50; font-size: 12px; font-weight: 700; }
.seat-alternatives dd { margin: 3px 0 0; }
.seat-alternatives strong { color: var(--green); font: 800 22px var(--serif); }
.seat-alternatives > div:last-child strong { color: #755234; }
.seat-alternatives p { font-size: 13px; line-height: 1.55; }
.wealth-reference { margin-top: 12px; border-top: 1px solid #b2c5a8; }
.wealth-reference summary { padding-top: 10px; color: var(--green); font-size: 13px; font-weight: 700; cursor: pointer; }
.compass { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); place-items: center; width: 132px; height: 122px; }
.compass-line { position: absolute; inset: 10px 15px; border: 1px solid #7f967c60; border-radius: 50%; }
.compass-line::after { content: ""; position: absolute; inset: 9px; border: 1px dashed #7f967c60; border-radius: 50%; }
.compass .tile { z-index: 1; width: 29px; height: 32px; font-size: 17px; }
.compass .tile.active { border-color: #1e5237; background: #28543f; box-shadow: 0 3px #163727, 0 5px 8px #193d2850; color: #ffdb88; transform: scale(1.13); }
.north { grid-area: 1 / 2; }
.east { grid-area: 2 / 3; }
.south { grid-area: 3 / 2; }
.west { grid-area: 2 / 1; }
.compass-center { grid-area: 2 / 2; color: #8e6338; font: 700 20px var(--serif); }

.footer { padding: 16px 3px 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.footer summary { width: fit-content; cursor: pointer; color: var(--green); font-weight: 700; }
.footer p { margin: 7px 0 0; }
.footer a { color: var(--green); text-underline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 540px) {
  .page { width: min(100% - 26px, 680px); padding-top: 17px; }
  .masthead { margin-bottom: 13px; }
  .hero { min-height: 248px; }
  .hero-copy { padding-left: 20px; }
  .hero h1 { font-size: clamp(25px, 7.4vw, 38px); }
  .hero p { font-size: 12px; margin-top: 13px; }
  .hero-art { right: 7px; width: 43%; }
  .hero-art::before { inset: 17% 9% 18%; }
  .hero-art::after { inset: 20% 12% 21%; }
  .hero-tiles { bottom: 32px; gap: 4px; }
  .hero-tiles .tile { width: 23px; height: 27px; font-size: 15px; }
  .today { padding-inline: 11px; gap: 9px; }
  .birthday, .result { padding-inline: 15px; }
  .result { grid-template-columns: minmax(0, 1fr) 97px; gap: 8px; }
  .seat-alternatives { grid-template-columns: 1fr; }
  .compass { width: 97px; height: 101px; }
  .compass-line { inset: 8px 10px; }
  .compass .tile { width: 25px; height: 29px; font-size: 15px; }
  h2 { font-size: 21px; }
}

@media (max-width: 360px) {
  .hero-copy { padding-left: 15px; }
  .hero h1 { font-size: clamp(21px, 7.1vw, 25px); }
  .today-dates { gap: 2px 6px; }
  .today-dates span:not(:empty) { padding-left: 6px; }
}
