:root {
  --bg: #f4f6f1;
  --surface: rgba(255,255,255,.96);
  --surface-soft: #f8faf6;
  --surface-strong: #ffffff;
  --text: #1d2821;
  --muted: #657168;
  --line: #dce3dc;
  --line-strong: #cbd6cd;
  --accent: #24623f;
  --accent-strong: #194a30;
  --accent-soft: #e7f1e9;
  --warning-soft: #f6f1df;
  --danger-soft: #f6ece7;
  --shadow-sm: 0 7px 22px rgba(29,40,33,.09);
  --shadow-lg: 0 20px 56px rgba(29,40,33,.17);
  --radius-sm: 13px;
  --radius: 18px;
  --radius-lg: 24px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, select, input { font: inherit; }
button, select { min-height: 44px; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
:focus-visible { outline: 3px solid rgba(36,98,63,.34); outline-offset: 2px; }
.hidden { display: none !important; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  grid-template-rows: auto 1fr;
}

.topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(320px, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding: 12px 16px;
  background: rgba(244,246,241,.95);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  z-index: 1200;
  position: relative;
}
.brand { display: flex; gap: 10px; align-items: center; align-self: center; min-width: max-content; }
.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #eaf3eb, #dcebdd);
  box-shadow: inset 0 0 0 1px #cfdfd1;
  font-size: 23px;
}
.brand h1 { margin: 0; font-size: 18px; line-height: 1.1; letter-spacing: -.02em; }
.brand p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }

.controls-row { display: flex; justify-content: center; align-items: end; gap: 10px; min-width: 0; }
.control { display: grid; gap: 4px; min-width: 0; color: var(--muted); font-size: 11px; font-weight: 800; }
.control:first-child { flex: 1 1 220px; max-width: 330px; }
.control-day { flex: 0 0 138px; }
.control select {
  width: 100%;
  min-width: 0;
  padding: 10px 34px 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--surface-strong);
  color: var(--text);
  font-weight: 650;
  box-shadow: 0 1px 0 rgba(29,40,33,.02);
}
.control select:hover { border-color: #b6c5ba; }

.actions-row { display: flex; gap: 8px; align-items: center; align-self: end; }
.primary-button, .soft-button, .icon-button, .text-button {
  border: 0;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.primary-button {
  background: var(--accent);
  color: #fff;
  padding: 10px 15px;
  border-radius: 13px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 7px 18px rgba(36,98,63,.18);
}
.primary-button:hover { background: var(--accent-strong); transform: translateY(-1px); }
.soft-button {
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 13px;
  font-weight: 750;
  white-space: nowrap;
}
.soft-button:hover { background: var(--surface-soft); }
.soft-button[aria-pressed="true"] { background: var(--accent-soft); border-color: #a9c5b0; color: var(--accent-strong); }
.icon-button {
  min-width: 44px;
  min-height: 44px;
  border-radius: 13px;
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 11px;
  font-size: 18px;
}
.icon-button:hover { background: var(--surface-soft); }
.locate-label { font-size: 12px; font-weight: 750; white-space: nowrap; }
.text-button { background: transparent; color: var(--accent); padding: 9px 2px; font-weight: 800; text-align: left; }
.text-button:hover { color: var(--accent-strong); }

.map-area { position: relative; min-height: 0; overflow: hidden; }
#map { height: calc(100vh - 71px); min-height: 560px; background: #dfe8dd; }
.map-note {
  position: absolute;
  z-index: 500;
  left: 16px;
  bottom: 18px;
  max-width: 390px;
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(207,218,209,.95);
  border-radius: 13px;
  padding: 9px 12px;
  box-shadow: var(--shadow-sm);
  font-size: 12px;
}
.map-note strong { white-space: nowrap; }
.map-note span { color: var(--muted); }
.legend {
  position: absolute;
  z-index: 500;
  right: 16px;
  bottom: 18px;
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(255,255,255,.93);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  border: 1px solid rgba(207,218,209,.95);
  padding: 8px 11px;
  font-size: 10px;
  font-weight: 750;
  color: #53605a;
  box-shadow: var(--shadow-sm);
}
.legend-scale { width: 86px; height: 8px; border-radius: 999px; background: linear-gradient(90deg, #b7b8af 0%, #d9c877 27%, #c0b957 50%, #78a85e 73%, #2f784b 100%); box-shadow: inset 0 0 0 1px rgba(42,62,49,.08); }

.result-panel {
  background: #fbfcf9;
  border-left: 1px solid var(--line);
  padding: 22px 21px 34px;
  overflow: auto;
  max-height: calc(100vh - 71px);
  scrollbar-width: thin;
}
.empty-state { min-height: 100%; display: grid; place-content: center; text-align: center; padding: 24px; color: var(--muted); }
.empty-state h2 { margin: 10px 0 7px; color: var(--text); font-size: 22px; letter-spacing: -.02em; }
.empty-state p { margin: 0 auto; line-height: 1.55; max-width: 280px; }
.empty-icon { width: 54px; height: 54px; margin: 0 auto; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 28px; font-weight: 900; }
.result-content { animation: resultIn .18s ease-out; }
@keyframes resultIn { from { opacity: .55; transform: translateY(4px); } }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .055em; }
.result-head { display: flex; gap: 16px; align-items: start; justify-content: space-between; }
.result-heading-copy { min-width: 0; padding-top: 3px; }
.decision-pill { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 9px; margin: 1px 0 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 11px; font-weight: 850; }
.result-head h2 { margin: 0; font-size: 26px; line-height: 1.12; letter-spacing: -.025em; }
.score-wrap { flex: 0 0 auto; display: grid; justify-items: center; gap: 2px; }
.score-wrap > span { color: var(--muted); font-size: 9px; font-weight: 750; max-width: 72px; text-align: center; line-height: 1.15; }
.score-badge { width: 70px; height: 70px; border-radius: 23px; display: grid; place-items: center; font-size: 27px; font-weight: 900; background: #e3efe5; color: #1b5a37; }
.result-summary { line-height: 1.58; color: #45514b; margin: 16px 0 12px; }
.data-status {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f7f8f4;
  color: #53605a;
  font-size: 12px;
  line-height: 1.4;
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; margin-top: 4px; background: #b5b8b2; }
.data-status.is-loading .status-dot { background: #c7a947; animation: statusPulse 1.2s ease-in-out infinite; }
.data-status.is-live { background: #edf5ef; border-color: #c8dccd; color: #315341; }
.data-status.is-live .status-dot { background: #2f784b; }
.data-status.is-partial { background: var(--warning-soft); border-color: #e4d9b6; color: #655d42; }
.data-status.is-partial .status-dot { background: #b9912c; }
.data-status.is-offline { background: var(--danger-soft); border-color: #e4d3ca; color: #685f58; }
.data-status.is-offline .status-dot { background: #9f8774; }
@keyframes statusPulse { 50% { opacity: .35; transform: scale(.82); } }

.quick-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 12px; }
.fact-card { background: #fff; border: 1px solid var(--line); border-radius: 15px; padding: 11px 12px; min-height: 76px; display: grid; align-content: start; gap: 6px; }
.fact-card span { color: var(--muted); font-size: 10px; font-weight: 750; }
.fact-card strong { font-size: 14px; line-height: 1.3; }

.species-info { margin: 14px 0 8px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 15px; background: #fff; display: grid; gap: 5px; }
.species-info-kicker { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.species-info strong { font-size: 14px; }
.species-info p { margin: 0; color: #4f5b55; font-size: 12px; line-height: 1.45; }
.species-info small { color: #70685f; font-size: 11px; line-height: 1.42; }

.why-details { margin: 3px 0 18px; background: #eef3ed; border: 1px solid #dce7dd; border-radius: 15px; padding: 12px 14px; }
.why-details ul { margin: 0; padding-left: 19px; color: #4f5b55; line-height: 1.55; font-size: 12px; }
.why-details li + li { margin-top: 5px; }
.forecast-section { margin-top: 18px; }
.section-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-title-row h3 { margin: 0 0 12px; font-size: 16px; }
.section-title-row span { color: var(--accent); font-weight: 800; font-size: 11px; }
.forecast-bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; align-items: end; min-height: 136px; }
.forecast-day { appearance: none; border: 0; background: transparent; color: inherit; padding: 2px 2px 5px; border-radius: 11px; cursor: pointer; display: grid; grid-template-rows: 1fr auto auto; gap: 5px; justify-items: center; height: 136px; min-height: 44px; }
.forecast-day:hover { background: rgba(47,120,75,.06); }
.forecast-day.is-selected { background: rgba(47,120,75,.09); box-shadow: inset 0 0 0 1px rgba(47,120,75,.18); }
.forecast-day.is-selected .day-name { color: var(--accent); }
.bar-wrap { width: 100%; display: flex; align-items: end; justify-content: center; height: 94px; }
.bar { width: 74%; min-width: 20px; border-radius: 8px 8px 4px 4px; background: #91b59a; position: relative; transition: height .18s ease; }
.bar strong { position: absolute; top: -21px; left: 50%; transform: translateX(-50%); font-size: 10px; }
.forecast-day .day-name { font-size: 10px; font-weight: 800; }
.forecast-day .day-date { font-size: 9px; color: var(--muted); }

.confidence-box { margin-top: 18px; background: #f2f0e8; border: 1px solid #e6e1d2; border-radius: 15px; padding: 12px 13px; }
.confidence-box span { font-weight: 800; font-size: 12px; }
.confidence-box p { margin: 5px 0 0; color: #5f625a; font-size: 12px; line-height: 1.45; }
.sources-box { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.sources-box > summary { cursor: pointer; list-style: none; font-weight: 800; font-size: 12px; color: var(--accent); padding: 10px 0; user-select: none; min-height: 44px; display: flex; align-items: center; }
.sources-box > summary::-webkit-details-marker { display: none; }
.sources-box > summary::after { content: '  ▾'; color: var(--muted); margin-left: 4px; }
.sources-box[open] > summary::after { content: '  ▴'; }
.source-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.source-chip { display: inline-flex; align-items: center; gap: 4px; padding: 7px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; border: 1px solid var(--line); background: #fff; }
.source-chip.is-on { color: #27533a; background: #edf5ef; border-color: #c8dccd; }
.source-chip.is-off { color: #7a746d; background: #f5f3ef; }
.sources-note { margin: 9px 0 0; font-size: 11px; line-height: 1.45; color: var(--muted); }

.drawer { position: fixed; inset: 0; z-index: 3000; pointer-events: none; opacity: 0; transition: opacity .18s ease; }
.drawer.open { opacity: 1; pointer-events: auto; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(18,29,23,.38); backdrop-filter: blur(3px); }
.drawer-sheet { position: absolute; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); background: #fafbf8; box-shadow: -24px 0 50px rgba(20,34,26,.2); padding: 17px 20px calc(24px + env(safe-area-inset-bottom)); transform: translateX(100%); transition: transform .22s ease; overflow: auto; }
.drawer.open .drawer-sheet { transform: translateX(0); }
.drawer-handle { display: none; }
.drawer-header { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.drawer-header h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.drawer-intro { color: var(--muted); line-height: 1.45; }
.close-button { font-size: 24px; }
.quiet-option { display:flex; align-items:center; justify-content:space-between; gap:14px; margin:12px 0 16px; padding:12px 14px; border:1px solid var(--line); border-radius:15px; background:#fff; }
.quiet-option span { display:grid; gap:3px; }
.quiet-option small { color:var(--muted); line-height:1.35; }
.quiet-option input { width:22px; height:22px; accent-color:var(--accent); flex:0 0 auto; }
.ranking-list { display: grid; gap: 9px; }
.ranking-nearby-group { display:grid; gap:9px; min-width:0; padding:8px; border:1px solid var(--line); border-radius:17px; }
.ranking-group-note { margin:0; color:var(--muted); font-size:12px; line-height:1.5; overflow-wrap:anywhere; }
.ranking-item { border: 1px solid var(--line); background: #fff; border-radius: 17px; padding: 13px; min-height: 72px; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; text-align: left; width: 100%; color: inherit; }
.ranking-item:hover { border-color: #b8c8bb; box-shadow: var(--shadow-sm); }
.ranking-item.is-best { border-color: #b9d3bf; background: linear-gradient(135deg, #fff, #f1f7f2); box-shadow: 0 8px 24px rgba(36,98,63,.08); }
.ranking-index { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: #edf2eb; font-weight: 900; }
.ranking-item.is-best .ranking-index { background: var(--accent); color: #fff; }
.ranking-main { min-width: 0; }
.ranking-main > span { display: block; overflow-wrap: anywhere; }
@media (max-width:640px) {
  body:has(#resultPeekButton:not([hidden])) .map-note { max-width:calc(100% - 132px); }
}
.ranking-heading { display: flex !important; align-items: center; gap: 7px; flex-wrap: wrap; margin: 0 !important; }
.ranking-heading strong { display: inline; }
.ranking-heading em { display: inline-flex; padding: 3px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 9px; font-style: normal; font-weight: 850; }
.ranking-main > span:last-child { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.ranking-score { display: flex; align-items: baseline; gap: 2px; font-weight: 900; }
.ranking-score strong { font-size: 21px; }
.ranking-score small { color: var(--muted); font-size: 9px; }
.ranking-loading { display: grid; gap: 9px; }
.ranking-loading i { height: 72px; border-radius: 17px; background: linear-gradient(90deg, #eef1ec 25%, #f8faf6 50%, #eef1ec 75%); background-size: 200% 100%; animation: rankingShimmer 1.2s linear infinite; }
@keyframes rankingShimmer { to { background-position: -200% 0; } }

.leaflet-control-zoom a { border-radius: 10px !important; }
.leaflet-popup-content-wrapper { border-radius: 15px; }
.custom-score-marker { border: 2px solid rgba(255,255,255,.95); box-shadow: 0 4px 15px rgba(25,40,32,.2); }
.selected-place-marker { filter: drop-shadow(0 3px 7px rgba(18,54,34,.28)); }
.toast { position: fixed; z-index: 5000; left: 50%; bottom: max(18px, calc(14px + env(safe-area-inset-bottom))); transform: translate(-50%, 14px); width: min(440px, calc(100vw - 24px)); padding: 11px 14px; border-radius: 14px; background: #1f3027; color: #fff; box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 650; text-align: center; opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-warning { background: #665329; }
.toast.is-success { background: var(--accent-strong); }
.map-error { height: 100%; min-height: 420px; display: grid; place-content: center; gap: 8px; padding: 28px; text-align: center; color: var(--text); }
.map-error strong { font-size: 20px; }
.map-error span { color: var(--muted); max-width: 420px; line-height: 1.5; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: minmax(0, 1fr) 370px; }
  .topbar { grid-template-columns: auto 1fr; align-items: center; }
  .controls-row { justify-content: flex-start; }
  .actions-row { grid-column: 1 / -1; justify-content: flex-end; }
  #map, .result-panel { max-height: none; }
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(54vh, 1fr) auto; }
  .topbar { position: sticky; top: 0; grid-template-columns: 1fr auto; gap: 9px; padding: 10px 12px; }
  .controls-row { grid-column: 1 / -1; grid-row: 2; justify-content: stretch; }
  .control:first-child { max-width: none; }
  .actions-row { grid-column: 1 / -1; grid-row: 3; display: grid; grid-template-columns: 1fr 1fr auto; width: 100%; }
  .primary-button, .soft-button { white-space: normal; }
  #map { height: 55vh; min-height: 430px; }
  .result-panel { border-left: 0; border-top: 1px solid var(--line); max-height: none; padding-bottom: calc(38px + env(safe-area-inset-bottom)); }
  .empty-state { min-height: 210px; }
  .map-note { left: 10px; right: 10px; bottom: 55px; max-width: none; }
  .legend { left: 10px; right: 10px; bottom: 10px; max-width: none; justify-content: center; }
}

@media (max-width: 640px) {
  .topbar { padding: 9px 10px; }
  .brand p { display: none; }
  .brand-mark { width: 40px; height: 40px; border-radius: 13px; }
  .brand h1 { font-size: 16px; }
  .controls-row { gap: 7px; }
  .control { font-size: 10px; }
  .control-day { flex: 0 0 118px; }
  .control select { font-size: 13px; padding: 9px 28px 9px 10px; }
  .actions-row { gap: 7px; grid-template-columns: 1fr 1fr 44px; }
  .primary-button, .soft-button { padding: 8px 9px; font-size: 12px; }
  .locate-button { width: 44px; padding: 0; }
  .locate-label { display: none; }
  #map { height: 52vh; min-height: 390px; }
  .result-panel { padding: 18px 14px 34px; }
  .result-head h2 { font-size: 23px; }
  .score-badge { width: 64px; height: 64px; border-radius: 20px; font-size: 25px; }
  .quick-facts { gap: 7px; }
  .fact-card { min-height: 70px; padding: 10px; }
  .map-note { font-size: 10px; align-items: start; bottom: 49px; }
  .map-note strong { white-space: normal; }
  .legend { font-size: 9px; gap: 6px; padding: 7px 9px; left: auto; width: auto; }
  .legend-scale { width: 68px; }
  .drawer-sheet { top: auto; left: 0; right: 0; width: auto; height: min(80vh, 700px); border-radius: 22px 22px 0 0; transform: translateY(100%); }
  .drawer.open .drawer-sheet { transform: translateY(0); }
  .drawer-handle { display: block; width: 44px; height: 5px; background: #d5d9d3; border-radius: 10px; margin: 0 auto 12px; }
  .source-chip { font-size: 10px; padding: 6px 8px; }
  .forecast-bars { gap: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* v0.34 — decision reasons and clearer next-step guidance */
body.drawer-open { overflow: hidden; }
.decision-guide { margin: 12px 0 14px; }
.decision-guide-title h3 { margin-bottom: 8px; font-size: 14px; }
.reason-highlights { display: grid; gap: 7px; }
.reason-highlight { display: grid; grid-template-columns: 34px 1fr; gap: 9px; align-items: start; padding: 10px 11px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.reason-highlight-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: #f1f4ef; font-size: 17px; }
.reason-highlight-copy { display: grid; gap: 2px; min-width: 0; }
.reason-highlight-copy strong { font-size: 12px; line-height: 1.25; }
.reason-highlight-copy > span { color: var(--muted); font-size: 11px; line-height: 1.38; }
.reason-highlight.is-good { border-color: #cfe1d2; background: #f7fbf7; }
.reason-highlight.is-good .reason-highlight-icon { background: #e7f3e9; }
.reason-highlight.is-warn { border-color: #eadfc2; background: #fcfaf2; }
.reason-highlight.is-warn .reason-highlight-icon { background: #f6efdb; }
.reason-highlight.is-neutral { background: #fafbf8; }
.forecast-advice { margin: 10px 0 0; padding: 10px 11px; border-radius: 12px; background: var(--surface-soft); color: #4e5b54; font-size: 12px; line-height: 1.45; }

@media (min-width: 1181px) {
  .reason-highlights { grid-template-columns: 1fr; }
}
@media (max-width: 980px) and (min-width: 641px) {
  .reason-highlights { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .reason-highlight { grid-template-columns: 1fr; }
}


/* v0.35 — clearer qualitative confidence and ranking comparison */
.confidence-head { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.confidence-head > span { min-width:0; }
.confidence-level { flex:0 0 auto; display:inline-flex; align-items:center; min-height:28px; padding:5px 9px; border-radius:999px; font-size:10px; font-weight:850; letter-spacing:.01em; }
.confidence-level.is-high { color:#24543a; background:#e3f0e6; }
.confidence-level.is-medium { color:#665823; background:#f3edcf; }
.confidence-level.is-low { color:#78513c; background:#f3e6df; }
.confidence-steps { display:grid; grid-template-columns:repeat(3,1fr); gap:5px; margin-top:10px; }
.confidence-steps i { height:5px; border-radius:999px; background:#dddcd3; }
.confidence-steps i.is-on { background:#4f805f; }
.confidence-gap { padding-top:8px; border-top:1px solid rgba(86,91,79,.12); }
.ranking-main > span:last-child { line-height:1.42; }
@media (max-width: 420px) {
  .confidence-head { align-items:flex-start; flex-direction:column; gap:7px; }
}

/* v0.36 — mobile map-first result sheet + clearer place comparison */
.result-sheet-bar,
.result-close-button { display: none; }
.ranking-meter { display:block !important; height:4px; margin-top:8px !important; overflow:hidden; border-radius:999px; background:#edf0eb; }
.ranking-meter i { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#9fbd91,#3f7e54); }

@media (max-width: 640px) {
  .app-shell { min-height: 100dvh; grid-template-rows: auto minmax(0, 1fr); }
  .map-area { min-height: 0; }
  #map { height: calc(100dvh - 178px); min-height: 420px; }
  .result-panel {
    position: fixed;
    z-index: 1900;
    left: 8px;
    right: 8px;
    bottom: 8px;
    max-height: min(68dvh, 650px);
    padding: 20px 14px calc(24px + env(safe-area-inset-bottom));
    border: 1px solid rgba(202,214,204,.95);
    border-radius: 24px;
    box-shadow: 0 22px 65px rgba(24,42,31,.25);
    transform: translateY(calc(100% + 20px));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform .22s ease, opacity .18s ease;
    overscroll-behavior: contain;
  }
  .result-panel.has-result.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .result-panel .empty-state { display:none; }
  .result-sheet-bar { display:block; width:42px; height:5px; margin:-8px auto 12px; border-radius:999px; background:#d4dbd5; }
  .result-close-button {
    display:grid;
    place-items:center;
    position:absolute;
    top:10px;
    right:10px;
    width:44px;
    height:44px;
    min-height:44px;
    border:0;
    border-radius:14px;
    background:#f1f4ef;
    color:#425047;
    font-size:24px;
    line-height:1;
    z-index:2;
  }
  .result-head { padding-right:44px; }
  .result-summary { margin-top:12px; }
  .decision-guide { margin-top:10px; }
  .map-note { bottom:49px; }
  .toast { bottom:max(18px, calc(14px + env(safe-area-inset-bottom))); }
  body.result-sheet-open .toast { bottom:min(70dvh, 660px); }
}
.result-peek-button { display:none; }
@media (max-width: 640px) {
  .result-peek-button:not([hidden]) {
    position:absolute;
    z-index:850;
    right:10px;
    bottom:48px;
    min-height:46px;
    display:flex;
    align-items:center;
    gap:8px;
    padding:7px 9px 7px 12px;
    border:1px solid rgba(196,209,199,.95);
    border-radius:15px;
    background:rgba(255,255,255,.96);
    color:var(--text);
    box-shadow:var(--shadow-sm);
    backdrop-filter:blur(10px);
    font-weight:800;
  }
  .result-peek-button span { font-size:11px; color:var(--muted); }
  .result-peek-button strong { min-width:33px; height:33px; padding:0 7px; display:grid; place-items:center; border-radius:11px; background:#f1f5ef; font-size:15px; }
  body.result-sheet-open .result-peek-button { display:none; }
}

/* v0.38 — map-first hotspots, Top 5 preferences and progressive details */
.more-details { margin-top:14px; border:1px solid var(--line); border-radius:16px; background:#fff; overflow:hidden; }
.more-details > summary { min-height:48px; padding:12px 14px; display:flex; align-items:center; justify-content:space-between; gap:10px; cursor:pointer; list-style:none; font-weight:850; color:var(--accent-strong); user-select:none; }
.more-details > summary::-webkit-details-marker { display:none; }
.more-details > summary::after { content:'＋'; width:28px; height:28px; display:grid; place-items:center; border-radius:9px; background:var(--accent-soft); color:var(--accent-strong); font-size:16px; }
.more-details[open] > summary::after { content:'−'; }
.more-details-content { padding:0 14px 14px; border-top:1px solid var(--line); }
.more-details-content .forecast-section { margin-top:14px; }
.more-details-content .species-info { margin-top:16px; }
.ranking-options { display:grid; gap:8px; margin:12px 0 16px; }
.ranking-options .quiet-option { margin:0; }
.ranking-empty { margin:10px 0; padding:14px; border:1px solid var(--line); border-radius:15px; background:#fff; color:var(--muted); font-size:12px; line-height:1.5; }
.hotspot-zone { filter:drop-shadow(0 3px 8px rgba(24,68,42,.16)); }

@media (max-width: 640px) {
  .more-details > summary { position:sticky; top:0; background:#fff; z-index:1; }
  .ranking-options { gap:7px; }
  .ranking-options .quiet-option { padding:11px 12px; }
}


/* v0.66 — field-first trip preset */
.focus-trip-button.is-active,
.focus-trip-button[aria-pressed="true"] {
  box-shadow: 0 0 0 3px rgba(47, 120, 75, .16);
}
.ranking-item .ranking-main > span:first-of-type + span {
  line-height: 1.35;
}

/* v0.67 — practical trip planner */
.trip-plan {
  margin: 4px 0 16px;
  padding: 14px;
  border: 1px solid #cfe0d2;
  border-radius: 18px;
  background: linear-gradient(180deg, #f7fbf7 0%, #ffffff 100%);
  box-shadow: 0 8px 24px rgba(32, 78, 49, .07);
}
.trip-plan[hidden] { display: none !important; }
.trip-plan-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.trip-plan-head h3 { margin:2px 0 0; font-size:17px; line-height:1.25; }
.trip-plan-kicker { display:block; color:#50735b; font-size:10px; font-weight:900; letter-spacing:.06em; text-transform:uppercase; }
.trip-plan-freshness { flex:0 0 auto; max-width:135px; padding:5px 8px; border-radius:999px; background:#edf4ee; color:#4e6555; font-size:9px; font-weight:800; text-align:center; }
.trip-plan-summary { margin:9px 0 5px; color:#405047; font-size:12px; line-height:1.45; }
.trip-plan-target { margin:0 0 11px; color:#59675f; font-size:11px; line-height:1.42; }
.trip-plan-stops { display:grid; gap:7px; }
.trip-plan-stop { width:100%; min-height:52px; display:grid; grid-template-columns:auto 1fr auto; gap:9px; align-items:center; padding:9px 10px; border:1px solid #dce7de; border-radius:14px; background:#fff; color:inherit; text-align:left; cursor:pointer; }
.trip-plan-stop:hover { border-color:#b9cfbe; background:#fbfdfb; }
.trip-plan-stop:focus-visible { outline:3px solid rgba(47,120,75,.2); outline-offset:2px; }
.trip-plan-stop-index { width:30px; height:30px; display:grid; place-items:center; border-radius:10px; background:#e8f2e9; color:#2f6842; font-size:11px; font-weight:900; }
.trip-plan-stop-copy { display:grid; gap:2px; min-width:0; }
.trip-plan-stop-copy strong { font-size:12px; }
.trip-plan-stop-copy span { color:var(--muted); font-size:10px; line-height:1.35; }
.trip-plan-stop-score { font-size:16px; font-weight:900; color:#2d5f3d; }
.trip-plan-refresh { min-height:44px; width:100%; margin-top:10px; border:0; border-radius:12px; background:#edf4ee; color:#315f40; font-size:11px; font-weight:850; cursor:pointer; }
.trip-plan.is-medium { border-color:#e4ddbd; background:linear-gradient(180deg,#fcfaf2 0%,#fff 100%); }
.trip-plan.is-low { border-color:#e5d5cd; background:linear-gradient(180deg,#fcf7f4 0%,#fff 100%); }
@media (max-width:640px) {
  .trip-plan { margin-top:2px; padding:12px; border-radius:16px; }
  .trip-plan-head { gap:8px; }
  .trip-plan-head h3 { font-size:15px; }
  .trip-plan-freshness { max-width:112px; font-size:8.5px; }
  .trip-plan-stop { min-height:50px; padding:8px 9px; }
}

/* v0.68 — robust field decision layer */
.trip-plan-window { margin: -3px 0 11px; padding: 8px 10px; border-radius: 11px; background: rgba(47,120,75,.07); color: #395a45; font-size: 10.5px; line-height: 1.4; }
.trip-plan-stop-decision { color: #496a54 !important; font-weight: 700; }


/* v0.69 — resilient trip portfolio */
.trip-plan-resilience { margin: -3px 0 6px; color:#365642; font-size:10.5px; line-height:1.42; font-weight:750; }
.trip-plan-morning { margin: 0 0 11px; color:#66736b; font-size:10px; line-height:1.4; }
.trip-plan-stop-decision { display:block; margin-top:1px; }


/* v0.70 — cross-view decision consistency */
.trip-plan-consensus { margin: 0 0 7px; padding: 7px 9px; border-radius: 10px; background: rgba(255,255,255,.72); color:#435d4a; font-size:10px; line-height:1.4; border:1px solid rgba(77,118,89,.12); }
.trip-plan-quality { margin:0 0 7px; padding:8px 9px; border-radius:10px; background:#f2f7f3; color:#365642; font-size:10px; line-height:1.4; font-weight:720; }

/* v0.71 — personal offline mission receipt */
.trip-plan-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:10px; }
.trip-plan-actions .trip-plan-refresh { margin-top:0; }
.trip-plan-save { min-height:44px; width:100%; border:0; border-radius:12px; background:#315f40; color:#fff; font-size:11px; font-weight:850; cursor:pointer; }
.trip-plan-save:disabled { opacity:.55; cursor:default; }
.trip-plan-save-note { margin:7px 2px 0; color:#718078; font-size:9px; line-height:1.35; }
@media (max-width:420px) { .trip-plan-actions { grid-template-columns:1fr; } }

/* GT-076 — evidence-aware practical field guidance */
.trip-plan-action{margin:8px 0 10px;padding:9px 10px;border-radius:12px;background:#e7f1e9;color:#28583a;font-size:11px;line-height:1.45;font-weight:850}

/* forest-map-r3: four top actions must fit, including the long focus label. */
.topbar, .brand, .actions-row, .actions-row > button { min-width: 0; }
.actions-row { flex-wrap: wrap; }
.actions-row > button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 980px) {
  .topbar { grid-template-columns: minmax(0, 1fr); }
  .actions-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .actions-row > button { width: 100%; min-height: 44px; }
  .locate-button { width: 100%; }
  .locate-label { display: inline; white-space: normal; }
}

.basemap-status { position:absolute; top:12px; right:12px; z-index:600; max-width:min(320px,calc(100% - 72px)); padding:10px 12px; border-radius:12px; background:#fff8e8; color:#594b29; font-size:12px; box-shadow:var(--shadow-sm); }
.basemap-status[hidden] { display:none; }

/* Automatic map filters: one header, contextual panel, ordinary layer controls. */
html, body { width:100%; }
.app-shell { height:100dvh; min-height:100dvh; grid-template-columns:minmax(0,1fr) 360px; grid-template-rows:auto minmax(0,1fr); }
.topbar { grid-template-columns:auto minmax(280px,1fr) auto; align-items:center; gap:14px; padding:12px 16px; }
.controls-row { grid-column:auto; grid-row:auto; justify-content:flex-start; }
.control:first-child { max-width:320px; }
.actions-row { grid-column:auto; grid-row:auto; display:flex; flex-wrap:nowrap; width:auto; }
.actions-row > button { width:auto; white-space:nowrap; }
#map { height:100%; min-height:0; }
.result-panel { max-height:none; min-height:0; }
.result-filter { color:var(--muted); font-size:12px; margin:0 0 10px; }
.map-tools { position:absolute; right:12px; top:12px; z-index:900; display:flex; gap:8px; align-items:flex-start; }
.map-menu { position:relative; color:var(--text); }
.map-menu > summary { min-height:44px; min-width:44px; display:flex; align-items:center; justify-content:center; padding:8px 12px; border:1px solid var(--line); border-radius:12px; background:#fff; box-shadow:var(--shadow-sm); cursor:pointer; font-weight:700; list-style:none; }
.map-menu > summary::-webkit-details-marker { display:none; }
.map-menu-body { position:absolute; right:0; top:52px; width:min(300px,calc(100vw - 24px)); padding:14px; background:#fff; border:1px solid var(--line); border-radius:14px; box-shadow:var(--shadow-lg); font-size:13px; }
.map-menu-body label { display:flex; align-items:center; gap:8px; min-height:44px; cursor:pointer; }
.map-menu-body input { width:20px; height:20px; accent-color:var(--accent); }
.map-menu-body p { color:var(--muted); font-size:12px; margin:8px 0 0; }
.map-menu-body ol { margin:8px 0; padding-left:20px; line-height:1.6; }
.model-symbol { color:#175936; }.external-symbol { color:#7851a9; }
.legend { left:12px; right:auto; bottom:28px; border-radius:12px; max-width:calc(100% - 24px); flex-wrap:wrap; padding:8px 10px; gap:6px 10px; font-size:10px; }
.legend span { display:inline-flex; align-items:center; gap:4px; }
.legend i { display:inline-block; width:10px; height:10px; border-radius:3px; }
.legend [hidden] { display:none; }
.map-note { left:12px; right:auto; bottom:75px; max-width:min(450px,calc(100% - 24px)); align-items:start; font-size:11px; }
.map-note strong { white-space:normal; }
.area-cluster { background:transparent; border:0; }
.area-cluster > span { display:flex; align-items:center; justify-content:center; width:62px; height:44px; border:2px solid #fff; border-radius:12px; color:#142f20; box-shadow:0 4px 14px #0003; font-weight:900; font-size:16px; }
.model-hotspot-marker > span { display:grid; place-items:center; width:28px; height:28px; color:#103e27; background:#fff; border:2px solid #175936; border-radius:6px; box-shadow:0 2px 8px #0003; }
.ranking-preferences { margin:12px 0; font-size:13px; }
.ranking-preferences > summary { cursor:pointer; min-height:44px; display:flex; align-items:center; color:var(--accent); font-weight:700; }
.baseMapStatus, .basemap-status { top:64px; }
@media(min-width:981px) {
  .drawer { top:var(--header-height,90px); left:auto; width:360px; }
  .drawer-backdrop { display:none; }
  .drawer-sheet { width:100%; box-shadow:none; border-left:1px solid var(--line); }
  body.drawer-open { overflow:auto; }
}
@media(max-width:1100px) and (min-width:981px) {
  .brand-copy p { display:none; }.brand-mark { display:none; }
  .topbar { gap:10px; }
}
@media(max-width:980px) {
  .app-shell { grid-template-columns:minmax(0,1fr); grid-template-rows:auto minmax(0,1fr); }
  .topbar { grid-template-columns:minmax(0,1fr); padding:10px 12px; gap:8px; position:relative; }
  .brand { display:none; }
  .controls-row { grid-column:1; grid-row:1; display:flex; width:100%; gap:8px; }
  .control:first-child { flex:1 1 0; max-width:none; }.control-day { flex:0 0 112px; }
  .actions-row { grid-column:1; grid-row:2; display:grid; grid-template-columns:1fr 1fr; width:100%; }
  .actions-row > button { width:100%; min-height:44px; font-size:13px; }
  .locate-button { padding:8px; }.locate-label { display:inline; }
  .map-area { grid-row:2; min-height:0; }
  #map { height:100%; min-height:0; }
  .legend { justify-content:flex-start; width:auto; font-size:9px; gap:4px 7px; }
  .map-note { bottom:78px; font-size:10px; }
  .result-panel { position:fixed; left:8px; right:8px; bottom:8px; width:auto; max-height:68dvh; transform:translateY(calc(100% + 20px)); opacity:0; visibility:hidden; pointer-events:none; border-radius:22px; border:1px solid var(--line); z-index:1900; }
  .result-panel.has-result.is-open { transform:translateY(0); opacity:1; visibility:visible; pointer-events:auto; }
  .result-panel .empty-state { display:none; }
  .result-sheet-bar { display:block; }.result-close-button { display:grid; }
  .drawer-sheet { top:auto; left:0; right:0; width:auto; height:min(80dvh,700px); border-radius:22px 22px 0 0; transform:translateY(100%); }
  .drawer.open .drawer-sheet { transform:translateY(0); }
}

.navigation-status { color:var(--muted); font-size:12px; line-height:1.5; }
#navigationLink:not([hidden]) { display:flex; align-items:center; min-height:44px; white-space:normal; text-decoration:none; margin:12px 0; }

.map-filter{position:absolute;z-index:900;left:12px;top:84px;width:min(340px,calc(100% - 24px));display:grid;grid-template-columns:auto minmax(0,1fr);gap:6px 10px;align-items:center;padding:10px 12px;border:1px solid var(--line);border-radius:14px;background:rgba(255,255,255,.96);box-shadow:var(--shadow-sm);font-size:12px}
.map-filter select{width:100%;min-height:44px;padding:6px;border:1px solid var(--line);border-radius:9px;background:#fff;font:inherit;color:var(--text)}
.map-filter p{grid-column:1/-1;margin:0;font-size:11px;color:var(--muted);line-height:1.4}
.map-menu-body label:has(input:disabled){color:var(--muted);cursor:default}
.basemap-status{top:190px}
@media(max-width:520px){.map-filter{top:84px;font-size:11px;padding:8px 10px;gap:4px 8px}.map-filter p{font-size:10px}}

/* R21: score conveys conditions; dashed blue conveys selection only. */
.score-legend{display:flex;flex-wrap:wrap;gap:6px 10px}.selection-legend i{background:transparent;border:2px dashed #27659a}
.area-cluster > span{position:relative;display:flex;flex-direction:column;width:100px;height:64px;background:#fff;color:#233e2b;border:1px solid #c5d8c7;border-radius:13px;overflow:hidden;font-size:13px;padding:9px 4px 4px}
.area-cluster .cluster-scale{position:absolute;top:0;left:0;right:0;height:7px;display:flex;width:100%;border:0;border-radius:0;box-shadow:none;padding:0}
.cluster-scale i{height:100%;display:block}.area-cluster small{font-size:11px;font-weight:650;color:#526458;margin-top:2px}
.ranking-list{gap:12px}.ranking-item{border-radius:16px;padding:14px;gap:10px;align-items:start}.ranking-item.is-best{background:#fff;border-color:#b9d3bf;box-shadow:none}
.ranking-item.is-best .ranking-index{background:#edf2eb;color:#315b3d}.ranking-item.is-selected{border:2px dashed #27659a}
.ranking-heading strong{font-size:14px;line-height:1.45}.ranking-main>span:last-child{font-size:12px;line-height:1.5}
.ranking-reasons{display:block;font-size:12px;color:#46624e;line-height:1.45;margin-top:6px}.ranking-main>span:nth-child(2){font-size:11px;color:var(--muted);line-height:1.5;margin-top:6px}
.ranking-score{display:grid;justify-items:end;align-items:center}.ranking-score strong{font-size:27px;line-height:1}.ranking-score small{font-size:10px;margin-top:4px}
.trip-plan{margin-top:18px;padding:14px;background:#f3f7f2;box-shadow:none}.trip-plan>summary{min-height:44px;font-weight:800;cursor:pointer;color:#275c3a;line-height:1.4}.trip-plan[hidden]{display:none}
.drawer-intro{font-size:13px;line-height:1.55}.ranking-preferences{margin:8px 0}.observe-selected{width:100%;min-height:46px;margin:4px 0 0;white-space:normal}.observation-note{font-size:11px;line-height:1.4;color:var(--muted);margin:7px 0 18px}
.map-note{pointer-events:none}.score-badge{font-variant-numeric:tabular-nums}.result-summary{line-height:1.55}
@media(max-width:980px){.legend{font-size:10px;bottom:25px;gap:5px}.map-note{bottom:102px;max-width:calc(100% - 24px)}.drawer-sheet{height:min(88dvh,800px)}.ranking-list{gap:10px}.map-filter{max-width:360px}}
@media(max-width:640px){.result-peek-button:not([hidden]){bottom:116px}.map-note{max-width:calc(100% - 145px)}}

/* R30 local preview uses the existing map and result sheet. */
#predictionModeControl[hidden],#provisionalNotice[hidden]{display:none}
#predictionModeControl{flex:1 1 210px;max-width:280px}
#provisionalNotice{top:auto;bottom:170px;max-width:calc(100% - 24px);font-size:12px;pointer-events:none}
@media(max-width:640px){.controls-row{flex-wrap:wrap}#predictionModeControl{flex-basis:100%;max-width:none}.forecast-day{overflow-wrap:anywhere}}
