:root {
  --ink: #142622;
  --muted: #64736f;
  --paper: #f4f1ea;
  --surface: #fffdf8;
  --line: #d9ddd7;
  --forest: #194d3a;
  --forest-2: #23664d;
  --sunrise: #e6783f;
  --sunset: #67578c;
  --good: #1f7658;
  --warn: #a86919;
  --bad: #9b3f38;
  --shadow: 0 18px 50px rgba(25, 51, 43, .09);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.site-header {
  width: min(1180px, calc(100% - 40px));
  min-height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(20, 38, 34, .12);
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { border-radius: 12px; box-shadow: 0 5px 14px rgba(25, 77, 58, .18); }
.brand span { display: grid; gap: 2px; }
.brand strong { letter-spacing: .12em; font-size: 17px; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .04em; }
nav { display: flex; gap: 28px; }
nav a { text-decoration: none; font-size: 14px; color: var(--muted); }
nav a:hover { color: var(--forest); }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.query-shell { padding: 76px 0 54px; }
.query-heading { max-width: 780px; }
.eyebrow { margin: 0 0 12px; color: var(--forest-2); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 18px; font-family: Georgia, "Songti SC", serif; font-size: clamp(38px, 6vw, 70px); line-height: 1.08; letter-spacing: -.035em; font-weight: 600; }
.query-heading > p:last-child { max-width: 610px; color: var(--muted); font-size: 17px; line-height: 1.75; }

.search-card {
  margin-top: 38px;
  padding: 24px;
  border: 1px solid rgba(20, 38, 34, .12);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.form-grid { display: grid; grid-template-columns: minmax(260px, 1fr) auto 185px 150px; gap: 12px; align-items: end; }
.field { display: grid; gap: 8px; }
.field span { color: var(--muted); font-size: 12px; font-weight: 700; }
.field input {
  width: 100%; height: 50px; padding: 0 15px; border: 1px solid var(--line); border-radius: 12px;
  outline: none; background: #fff; color: var(--ink); transition: border-color .18s, box-shadow .18s;
}
.field input:focus { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(35, 102, 77, .12); }
.locate-button, .primary-button, .text-button, .close-button { border: 0; cursor: pointer; }
.locate-button { height: 50px; padding: 0 16px; border-radius: 12px; background: #e7eee9; color: var(--forest); font-weight: 750; white-space: nowrap; }
.primary-button { width: 100%; height: 54px; margin-top: 16px; border-radius: 13px; background: var(--forest); color: white; font-weight: 800; letter-spacing: .02em; }
.primary-button:hover { background: var(--forest-2); }
.primary-button:disabled { opacity: .65; cursor: wait; }
.form-note { margin: 13px 2px 0; color: #7a8783; font-size: 12px; line-height: 1.6; }
.candidate-panel, .error-box { margin-top: 14px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.candidate-panel { padding: 10px; border: 1px solid var(--line); }
.candidate-title { padding: 10px 12px; color: var(--muted); font-size: 12px; font-weight: 750; }
.candidate-button { width: 100%; padding: 14px 12px; border: 0; border-top: 1px solid #e7e9e5; background: transparent; text-align: left; cursor: pointer; color: var(--ink); }
.candidate-button strong { display: block; font-size: 14px; }
.candidate-button small { display: block; margin-top: 5px; color: var(--muted); }
.candidate-button:hover { background: #f1f4ef; }
.error-box { padding: 16px 18px; border: 1px solid #efc8c3; color: var(--bad); background: #fff5f3; }

.results { padding: 18px 0 70px; }
.result-title-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.result-title-row h2, .section-intro h2, .safety-note h2 { margin-bottom: 8px; font-family: Georgia, "Songti SC", serif; font-weight: 600; font-size: clamp(28px, 4vw, 42px); }
.result-meta { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.text-button { padding: 10px 0; background: transparent; color: var(--forest-2); font-weight: 750; }
.best-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.best-card { display: flex; align-items: center; gap: 18px; min-height: 112px; padding: 24px; border-radius: 18px; border: 1px solid transparent; }
.sunrise-card { background: #fff0df; border-color: #f3d2b4; }
.sunset-card { background: #efebf7; border-color: #d7cee8; }
.best-icon { font-size: 30px; }
.best-card div { display: grid; gap: 8px; }
.best-card small { color: var(--muted); font-weight: 700; }
.best-card strong { font-size: 17px; }
.forecast-wrap { margin-top: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.forecast-head, .forecast-row { display: grid; grid-template-columns: 132px 1fr 1fr; }
.forecast-head { min-height: 46px; background: #e9ece7; color: var(--muted); font-size: 12px; font-weight: 800; }
.forecast-head span { display: grid; place-items: center; }
.forecast-row { border-top: 1px solid var(--line); }
.forecast-date { display: grid; place-content: center; gap: 5px; padding: 14px; text-align: center; font-weight: 800; }
.forecast-date small { color: var(--muted); font-weight: 500; }
.event-card { min-width: 0; padding: 17px 18px; border: 0; border-left: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.event-card:hover { background: #f2f4ef; }
.event-card.is-best.sunrise { background: #fff3df; box-shadow: inset 0 0 0 2px #e5a14d; }
.event-card.is-best.sunset { background: #f0ecfb; box-shadow: inset 0 0 0 2px #8a78ba; }
.event-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.event-score { font-size: 28px; font-weight: 850; letter-spacing: -.04em; }
.event-score small { margin-left: 3px; font-size: 11px; letter-spacing: 0; }
.level-recommended { color: #b84f2e; }
.level-moderate { color: var(--warn); }
.level-poor, .level-notRecommended { color: var(--good); }
.level-unknown { color: var(--muted); }
.level-pill { padding: 4px 8px; border-radius: 999px; background: #e9ece7; color: var(--muted); font-size: 10px; font-weight: 800; white-space: nowrap; }
.event-metrics, .event-time { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.event-time { margin-top: 4px; color: #8a9692; }
.result-footnote { margin: 13px 4px 0; color: var(--muted); font-size: 12px; }

.editorial-section { padding: 76px 0; border-top: 1px solid rgba(20, 38, 34, .14); }
.section-intro { max-width: 720px; }
.method-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 36px; }
.method-grid article { min-height: 230px; padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,253,248,.56); }
.method-grid span { color: var(--sunrise); font-size: 12px; font-weight: 850; }
.method-grid h3 { margin: 28px 0 10px; font-size: 17px; }
.method-grid p { color: var(--muted); font-size: 13px; line-height: 1.75; }
.safety-note { display: grid; grid-template-columns: .8fr 1.2fr; gap: 60px; align-items: end; margin-bottom: 80px; padding: 38px; border-radius: 20px; background: var(--forest); color: white; }
.safety-note .eyebrow { color: #bdd4c9; }
.safety-note p:last-child { margin: 0; color: #d8e4df; line-height: 1.8; }

footer { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 36px 0 50px; display: flex; justify-content: space-between; gap: 30px; border-top: 1px solid rgba(20, 38, 34, .14); }
footer p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-links a { color: var(--muted); font-size: 12px; text-decoration: none; }

.detail-dialog { width: min(760px, calc(100% - 28px)); max-height: min(820px, calc(100vh - 40px)); padding: 0; border: 0; border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 100px rgba(10, 28, 22, .28); }
.detail-dialog::backdrop { background: rgba(13, 27, 23, .58); backdrop-filter: blur(4px); }
.dialog-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; gap: 20px; padding: 28px 30px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin-bottom: 5px; font-size: 30px; }
.close-button { width: 40px; height: 40px; border-radius: 50%; background: #e8ece8; color: var(--ink); font-size: 25px; }
.detail-score { margin: 24px 30px 0; padding: 22px; border-radius: 16px; background: #edf1ec; }
.detail-score strong { display: block; margin-bottom: 8px; font-size: 28px; }
.detail-score p { margin: 0; color: var(--muted); line-height: 1.7; }
.reason-list { display: grid; gap: 10px; padding: 22px 30px; }
.reason { padding: 16px 18px; border-left: 3px solid var(--line); background: #f5f4ef; }
.reason.good { border-color: var(--good); }
.reason.bad { border-color: var(--bad); }
.reason.neutral, .reason.warning { border-color: var(--warn); }
.reason strong { display: block; margin-bottom: 5px; font-size: 14px; }
.reason p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.weather-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin: 0 30px 30px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--line); }
.weather-item { display: flex; justify-content: space-between; gap: 10px; padding: 13px 14px; background: var(--surface); font-size: 12px; }
.weather-item span:first-child { color: var(--muted); }

@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr auto 1fr; }
  .field-location { grid-column: span 2; }
  .field-elevation { grid-column: span 1; }
  .method-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .site-header, main, footer { width: min(100% - 28px, 1180px); }
  .site-header { min-height: 74px; }
  nav a:first-child { display: none; }
  .query-shell { padding: 46px 0 38px; }
  h1 { font-size: 42px; }
  .search-card { padding: 16px; border-radius: 18px; }
  .form-grid { grid-template-columns: 1fr auto; }
  .field-location { grid-column: span 1; }
  .field-date, .field-elevation { grid-column: span 1; }
  .best-grid { grid-template-columns: 1fr; }
  .forecast-wrap { overflow-x: auto; }
  .forecast-head, .forecast-row { min-width: 610px; grid-template-columns: 92px 1fr 1fr; }
  .event-card { padding: 15px 13px; }
  .method-grid { grid-template-columns: 1fr; }
  .method-grid article { min-height: auto; }
  .safety-note { grid-template-columns: 1fr; gap: 18px; padding: 26px; }
  footer { flex-direction: column; }
  .weather-grid { grid-template-columns: 1fr; }
  .dialog-head, .reason-list { padding-left: 20px; padding-right: 20px; }
  .detail-score { margin-left: 20px; margin-right: 20px; }
  .weather-grid { margin-left: 20px; margin-right: 20px; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
