:root {
  --ink: #1f2a27;
  --muted: #65716b;
  --paper: #f7f5ef;
  --paper-deep: #eee9dd;
  --surface: #fffdf8;
  --line: #ded9cc;
  --jade: #28685b;
  --jade-dark: #16473d;
  --jade-soft: #e4efe9;
  --gold: #ad7b2d;
  --gold-soft: #f7edcf;
  --rose: #a34b40;
  --rose-soft: #fae9e5;
  --shadow: 0 12px 36px rgba(39, 49, 43, .08);
  --radius: 18px;
  --serif: "Noto Serif SC", "Songti SC", "STSong", SimSun, serif;
  --sans: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid rgba(173,123,45,.45);
  outline-offset: 2px;
}
.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 30; color: #fff; background: var(--jade-dark); padding: 8px 12px; border-radius: 6px; }
.skip-link:focus { left: 12px; }

.site-header { background: rgba(255,253,248,.92); border-bottom: 1px solid rgba(222,217,204,.9); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(10px); }
.header-content { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--jade-dark); }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-family: var(--serif); font-size: 20px; font-weight: 700; }
.brand strong { display: block; letter-spacing: .06em; font-family: var(--serif); font-size: 18px; }
.brand small { display: block; margin-top: -1px; color: var(--muted); font-size: 11px; letter-spacing: .035em; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; color: var(--jade-dark); background: var(--jade-soft); border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 700; }
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: #3d9a72; box-shadow: 0 0 0 3px rgba(61,154,114,.13); }

.hero { padding: 70px 0 50px; border-bottom: 1px solid var(--line); background:
  radial-gradient(circle at 86% 15%, rgba(203,184,129,.2), transparent 18rem),
  radial-gradient(circle at 0% 100%, rgba(70,130,107,.13), transparent 24rem),
  linear-gradient(123deg, #f7f5ef 0%, #fcfaf4 60%, #f2eee4 100%); }
.hero-grid { display: grid; grid-template-columns: 1.45fr .75fr; gap: 68px; align-items: end; }
.eyebrow { margin: 0 0 8px; color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 18px; max-width: 770px; font-family: var(--serif); font-size: clamp(34px, 4vw, 54px); font-weight: 700; line-height: 1.18; letter-spacing: .01em; }
h1 em { color: var(--jade); font-style: normal; }
h2 { margin-bottom: 8px; font-family: var(--serif); font-size: 27px; line-height: 1.28; }
h3 { margin-bottom: 3px; font-family: var(--serif); font-size: 21px; line-height: 1.32; }
.hero-copy { max-width: 720px; color: #52605a; font-size: 16px; line-height: 1.8; }
.source-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 25px; font-size: 12px; color: var(--muted); }
.source-strip b { color: var(--jade-dark); background: rgba(255,253,248,.75); border: 1px solid #d7ddcf; border-radius: 99px; padding: 5px 9px; font-weight: 700; }
.hero-note { margin-bottom: 5px; display: flex; gap: 14px; align-items: flex-start; padding: 22px; background: rgba(255,253,248,.68); border: 1px solid rgba(197,187,158,.62); border-radius: var(--radius); }
.note-icon { flex: none; display: grid; place-items: center; width: 32px; height: 32px; color: var(--gold); background: var(--gold-soft); border-radius: 50%; font-size: 20px; }
.hero-note strong { font-family: var(--serif); font-size: 17px; }
.hero-note p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }

.query-card { margin-top: -1px; padding: 33px 35px 27px; background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow); }
.query-heading, .section-title-row, .panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.query-heading { margin-bottom: 22px; align-items: center; }
.query-heading h2 { font-size: 25px; margin: 0; }
.primary-button, .outline-button, .quiet-button, .quick-range button { border: 0; border-radius: 9px; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.primary-button { flex: none; padding: 12px 16px; color: #fffdf8; background: var(--jade); box-shadow: 0 5px 13px rgba(22,71,61,.2); font-weight: 800; }
.primary-button:hover { background: var(--jade-dark); transform: translateY(-1px); }
.primary-button span { margin-right: 3px; font-weight: 400; }
.quiet-button { padding: 7px 4px; color: var(--jade-dark); background: transparent; font-size: 13px; font-weight: 800; }
.quiet-button:hover { color: var(--gold); }
.outline-button { padding: 9px 12px; color: var(--jade-dark); background: transparent; border: 1px solid #bdcabf; font-size: 13px; font-weight: 750; }
.outline-button:hover:not(:disabled) { background: var(--jade-soft); }
.outline-button:disabled { color: #a0a6a0; border-color: #d9d8d3; cursor: not-allowed; }

.query-grid { display: grid; grid-template-columns: 1.15fr .9fr .9fr .95fr 1.08fr 1.42fr; gap: 14px; }
.field { min-width: 0; display: block; }
.field > span { display: block; margin: 0 0 7px; color: #57645e; font-size: 12px; font-weight: 800; }
.field small { color: #8e978f; font-size: 10px; font-weight: 600; }
.field input, .field select { width: 100%; height: 42px; padding: 0 10px; border: 1px solid #d8d8cf; border-radius: 8px; color: var(--ink); background: #fffefb; }
.field input:hover, .field select:hover { border-color: #b5c4b9; }
.quick-range { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 18px; color: var(--muted); font-size: 12px; }
.quick-range span { margin-right: 3px; font-weight: 700; }
.quick-range button { padding: 4px 8px; color: #526158; background: #f2f1ea; font-size: 12px; }
.quick-range button:hover { color: var(--jade-dark); background: var(--jade-soft); }
.form-error { margin: 12px 0 0; color: var(--rose); font-size: 13px; font-weight: 700; }

.results-section { padding: 66px 0 0; }
.section-title-row { margin-bottom: 25px; align-items: end; }
.section-title-row h2 { margin-bottom: 3px; }
.section-title-row.compact { margin-bottom: 18px; }
.muted { margin: 0; color: var(--muted); font-size: 13px; }
.result-actions { display: flex; align-items: center; gap: 8px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 22px; }
.summary-card { min-height: 122px; padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.summary-card .summary-label { color: var(--muted); font-size: 12px; font-weight: 750; }
.summary-card .summary-value { margin-top: 6px; font-family: var(--serif); color: var(--jade-dark); font-size: 31px; font-weight: 800; line-height: 1; }
.summary-card .summary-note { margin-top: 7px; color: #7b857e; font-size: 11px; }
.summary-card.highlight { color: #fffbef; background: var(--jade); border-color: var(--jade); }
.summary-card.highlight .summary-label, .summary-card.highlight .summary-value, .summary-card.highlight .summary-note { color: inherit; }
.summary-card.loading-card { display: flex; align-items: center; gap: 10px; color: #7f8983; }
.loading-card span { width: 20px; height: 20px; display: inline-block; border: 2px solid #d7d9d1; border-top-color: var(--jade); border-radius: 50%; animation: rotate .8s linear infinite; }
@keyframes rotate { to { transform: rotate(360deg); } }

.results-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr); gap: 22px; align-items: start; }
.calendar-panel, .detail-panel { min-height: 570px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 24px rgba(44,54,44,.035); }
.detail-panel { position: sticky; top: 94px; max-height: calc(100vh - 112px); overflow: auto; }
.panel-header { padding-bottom: 17px; border-bottom: 1px solid #ebe7dc; }
.panel-header h3 { margin: 0; }
.legend { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 9px; color: #6f796f; font-size: 11px; white-space: nowrap; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { display: block; width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.best { background: var(--jade); }
.legend-dot.good { background: var(--gold); }
.legend-dot.caution { background: #b4aaa0; }
.calendar-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.day-card { min-height: 155px; padding: 14px; text-align: left; color: var(--ink); background: #fffefb; border: 1px solid #e1ddd3; border-radius: 12px; }
.day-card:hover { border-color: #89aa9a; box-shadow: 0 7px 16px rgba(38,104,91,.08); transform: translateY(-1px); }
.day-card.selected { border-color: var(--jade); box-shadow: inset 0 0 0 1px var(--jade), 0 7px 16px rgba(38,104,91,.09); }
.day-card.grade-a { background: linear-gradient(140deg, #fbfdf9, #edf6f0); }
.day-card.grade-b { background: linear-gradient(140deg, #fffefa, #fff8e6); }
.day-card.grade-c { background: #fffdf9; }
.day-top { display: flex; justify-content: space-between; gap: 7px; align-items: baseline; }
.day-number { color: var(--jade-dark); font-family: var(--serif); font-size: 23px; font-weight: 800; line-height: 1; }
.day-week { color: #7a857e; font-size: 11px; }
.day-lunar { margin: 8px 0 4px; color: #46554d; font-size: 12px; }
.day-pill { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #487165; background: var(--jade-soft); border-radius: 4px; padding: 2px 5px; font-size: 10px; font-weight: 800; }
.grade-b .day-pill { color: #876428; background: var(--gold-soft); }
.grade-c .day-pill { color: #6d7670; background: #efeee8; }
.day-meta { display: block; margin-top: 8px; color: #77827a; font-size: 10px; line-height: 1.45; }
.empty-state { margin: 45px 0 10px; padding: 24px; color: var(--muted); text-align: center; background: #f7f5ee; border-radius: 10px; }

.score-badge { flex: none; display: inline-flex; align-items: center; height: 27px; border-radius: 999px; padding: 0 10px; font-size: 11px; font-weight: 850; }
.score-badge.best { color: #eafff4; background: var(--jade); }
.score-badge.good { color: #704f13; background: var(--gold-soft); }
.score-badge.caution, .score-badge.neutral { color: #66716a; background: #efeee7; }
.detail-content { padding-top: 18px; }
.detail-placeholder { min-height: 400px; display: grid; place-content: center; justify-items: center; padding: 20px; color: #8b948d; text-align: center; }
.detail-placeholder span { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 12px; color: #b4a371; background: #f4eee0; border-radius: 50%; font-family: var(--serif); font-size: 31px; }
.detail-placeholder p { max-width: 250px; margin: 0; font-size: 13px; }
.detail-date { padding-bottom: 16px; border-bottom: 1px solid #eee9dd; }
.detail-date strong { display: block; font-family: var(--serif); color: var(--jade-dark); font-size: 24px; }
.detail-date p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.info-pill { padding: 4px 7px; color: #536159; background: #f2f1ea; border-radius: 5px; font-size: 11px; }
.detail-group { margin-top: 18px; }
.detail-group h4 { margin: 0 0 8px; color: #506158; font-size: 12px; letter-spacing: .04em; }
.fit-list, .trace-list { margin: 0; padding: 0; list-style: none; }
.fit-list { display: flex; flex-wrap: wrap; gap: 6px; }
.fit-list li { padding: 4px 8px; color: #346c5e; background: #e8f1eb; border-radius: 5px; font-size: 11px; font-weight: 700; }
.trace-list { display: grid; gap: 8px; }
.trace-item { position: relative; padding: 10px 10px 10px 12px; border-left: 3px solid #c9d5cc; background: #faf9f4; border-radius: 0 7px 7px 0; }
.trace-item.positive { border-left-color: var(--jade); }
.trace-item.negative { border-left-color: var(--rose); background: #fff9f7; }
.trace-item.neutral { border-left-color: #c8b173; }
.trace-title { display: flex; justify-content: space-between; gap: 8px; color: #38483f; font-size: 12px; font-weight: 800; }
.trace-score { flex: none; color: var(--jade); font-size: 11px; }
.trace-item.negative .trace-score { color: var(--rose); }
.trace-body { margin: 4px 0 0; color: #6e7972; font-size: 11px; line-height: 1.5; }
.trace-source { display: inline-block; margin-top: 5px; color: #9a7a45; font-size: 10px; }
.hour-summary { margin: 0 0 10px; color: #68756d; font-size: 11px; line-height: 1.55; }
.hour-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.hour-card { min-height: 101px; padding: 10px; color: var(--ink); text-align: left; background: #fffefb; border: 1px solid #e0ddd3; border-radius: 8px; }
.hour-card:hover { border-color: #85a795; background: #f8fcf8; }
.hour-card.priority { background: linear-gradient(140deg, #fcfefa, #edf6f0); border-color: #bbd5c7; }
.hour-card.caution { background: #fcfbf6; }
.hour-card.selected { box-shadow: inset 0 0 0 1px var(--gold); border-color: var(--gold); }
.hour-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.hour-name { color: var(--jade-dark); font-family: var(--serif); font-size: 16px; font-weight: 800; }
.hour-score { color: #6c7a70; font-size: 10px; font-weight: 800; }
.hour-card.priority .hour-score { color: var(--jade); }
.hour-card.caution .hour-score { color: #84776a; }
.hour-range { display: block; margin-top: 2px; color: #7a857e; font-size: 9px; }
.hour-meta { display: block; margin-top: 6px; color: #536159; font-size: 10px; line-height: 1.45; }
.hour-reason { display: block; margin-top: 3px; color: #95703c; font-size: 9px; line-height: 1.35; }
.caution-box { margin-top: 18px; padding: 11px 12px; color: #715841; background: #fcf5e6; border: 1px solid #f0dfb9; border-radius: 8px; font-size: 11px; line-height: 1.55; }

.methodology { display: grid; grid-template-columns: .85fr 1.35fr; gap: 72px; padding: 90px 0; }
.method-intro p:not(.eyebrow) { max-width: 420px; color: var(--muted); line-height: 1.75; }
.method-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0; padding: 1px; list-style: none; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.method-steps li { display: flex; gap: 15px; min-height: 126px; padding: 24px; background: var(--surface); }
.method-steps span { color: #a99161; font-family: var(--serif); font-size: 20px; font-weight: 800; }
.method-steps strong { display: block; margin: 2px 0 5px; color: var(--jade-dark); font-size: 15px; }
.method-steps p { margin: 0; color: var(--muted); font-size: 12px; }
.sources-section { margin-bottom: 70px; padding: 30px 32px; border: 1px solid var(--line); border-radius: var(--radius); background: #f3f0e6; }
.source-content { border-top: 1px solid #dcd5c6; padding-top: 20px; }
.source-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.source-item { padding: 16px 17px; background: rgba(255,253,248,.73); border-radius: 9px; }
.source-item h3 { margin: 0 0 5px; color: var(--jade-dark); font-size: 16px; }
.source-item p { margin: 0; color: #66716a; font-size: 12px; }
.source-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.source-meta span { padding: 3px 7px; color: #85682e; background: var(--gold-soft); border-radius: 4px; font-size: 10px; font-weight: 750; }
.boundary-note { margin-top: 16px; padding: 13px 15px; color: #665b48; background: #faf5e9; border-left: 3px solid #b79755; font-size: 12px; }

.site-footer { padding: 24px 0; color: #c7d6cf; background: #1f4138; font-size: 11px; }
.site-footer .shell { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.site-footer b { color: #f2d996; }
.help-dialog { width: min(500px, calc(100% - 32px)); padding: 0; color: var(--ink); border: 0; border-radius: 16px; box-shadow: 0 24px 70px rgba(0,0,0,.25); }
.help-dialog::backdrop { background: rgba(22,40,34,.42); backdrop-filter: blur(2px); }
.dialog-content { position: relative; padding: 32px; background: var(--surface); }
.dialog-content h2 { font-size: 26px; }
.dialog-content ol { margin: 18px 0; padding-left: 22px; color: #4e5c54; }
.dialog-content li { margin-bottom: 9px; }
.dialog-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; color: #607068; background: transparent; border: 0; border-radius: 50%; font-size: 26px; line-height: 1; }
.dialog-close:hover { color: var(--rose); background: var(--rose-soft); }
.callout { margin: 0; padding: 12px 13px; color: #735c3c; background: #fbf4e3; border-radius: 8px; font-size: 12px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 40; max-width: min(360px, calc(100% - 40px)); padding: 11px 15px; color: #fff; background: #244b40; border-radius: 8px; box-shadow: 0 8px 26px rgba(0,0,0,.18); font-size: 13px; opacity: 0; pointer-events: none; transform: translateY(10px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .hero-grid, .methodology { grid-template-columns: 1fr; gap: 28px; }
  .hero-note { max-width: 610px; }
  .query-grid { grid-template-columns: repeat(3, 1fr); }
  .location-field { grid-column: span 2; }
  .results-grid { grid-template-columns: 1fr; }
  .detail-panel { position: static; min-height: auto; max-height: none; overflow: visible; }
  .detail-placeholder { min-height: 180px; }
  .methodology { padding: 65px 0; }
}
@media (max-width: 660px) {
  .shell { width: min(100% - 24px, 1180px); }
  .site-header { position: static; }
  .header-content { min-height: 62px; }
  .brand small, .status-pill { display: none; }
  .hero { padding: 44px 0 34px; }
  h1 { font-size: 34px; }
  .hero-copy { font-size: 14px; }
  .query-card { padding: 24px 18px 20px; }
  .query-heading, .section-title-row { align-items: flex-start; flex-direction: column; }
  .query-heading h2, .section-title-row h2 { font-size: 23px; }
  .primary-button { width: 100%; }
  .query-grid { grid-template-columns: 1fr 1fr; }
  .activity-field, .location-field { grid-column: span 2; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-card { min-height: 104px; padding: 15px; }
  .summary-card .summary-value { font-size: 27px; }
  .result-actions { width: 100%; }
  .result-actions .outline-button { flex: 1; }
  .calendar-panel, .detail-panel { padding: 18px; border-radius: 14px; }
  .panel-header { align-items: flex-start; flex-direction: column; }
  .legend { justify-content: flex-start; }
  .calendar-list { grid-template-columns: 1fr 1fr; }
  .day-card { min-height: 137px; padding: 12px; }
  .method-steps { grid-template-columns: 1fr; }
  .method-steps li { min-height: auto; padding: 19px; }
  .sources-section { margin-bottom: 45px; padding: 25px 20px; }
  .site-footer .shell { display: grid; gap: 5px; }
}
@media print {
  body { background: #fff; }
  .site-header, .hero, .query-card, .result-actions, .methodology, .sources-section, .site-footer, .toast { display: none !important; }
  .results-section { padding: 0; }
  .section-title-row { display: block; margin-bottom: 12px; }
  .summary-grid { margin-bottom: 16px; }
  .summary-card { min-height: 82px; padding: 11px; }
  .results-grid { display: block; }
  .calendar-panel { display: none; }
  .detail-panel { min-height: 0; padding: 0; border: 0; box-shadow: none; }
  .detail-placeholder { display: none; }
}
