/* ---- Reset & base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:     #0d1117;
  --panel:  #161b22;
  --border: #30363d;
  --text:   #c9d1d9;
  --accent: #58a6ff;
  --clear:  #3fb950;
  --marginal: #d29922;
  --storm:  #f85149;
  --nodata: #6e7681;
  --header-h: 52px;
}

body { background: var(--bg); color: var(--text); font-family: system-ui, sans-serif;
       font-size: 14px; height: 100vh; overflow: hidden; }

/* ---- Header ---- */
header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  background: var(--panel); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; z-index: 1000;
}
.logo { display: flex; align-items: center; gap: 8px; }
.logo-bird  { font-size: 22px; }
.logo-name  { font-weight: 700; font-size: 18px; letter-spacing: 1px; color: #fff; }
.logo-sub   { color: var(--nodata); font-size: 11px; }
.header-right { display: flex; align-items: center; gap: 10px; }
#report-date { color: var(--nodata); font-size: 12px; }

.pill-btn {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 16px; padding: 4px 14px; cursor: pointer; font-size: 13px;
  transition: background 0.15s;
}
.pill-btn:hover, .pill-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---- Map ---- */
#map {
  position: fixed; top: var(--header-h); left: 0; right: 0;
  bottom: 0; z-index: 1;
}

/* ---- Layer panel ---- */
#layer-panel {
  position: fixed; top: calc(var(--header-h) + 8px); right: 16px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 16px; z-index: 900;
  display: none; flex-direction: column; gap: 8px; min-width: 180px;
}
#layer-panel.open { display: flex; }
#layer-panel label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
#layer-panel hr { border-color: var(--border); }
#layer-panel select {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 4px; padding: 2px 6px;
}

/* ---- Detail panel ---- */
#detail-panel {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--panel); border-top: 1px solid var(--border);
  padding: 16px; z-index: 900; max-height: 40vh; overflow-y: auto;
  transition: transform 0.2s;
}
#detail-panel.hidden { transform: translateY(100%); }
#detail-close {
  position: absolute; top: 10px; right: 14px;
  background: none; border: none; color: var(--text); font-size: 18px; cursor: pointer;
}
#dp-name { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.condition-badge {
  display: inline-block; border-radius: 12px; padding: 2px 12px;
  font-size: 12px; font-weight: 600; margin-bottom: 10px;
}
.condition-badge.clear    { background: var(--clear);    color: #000; }
.condition-badge.marginal { background: var(--marginal);  color: #000; }
.condition-badge.storm    { background: var(--storm);    color: #fff; }
.condition-badge.no_data  { background: var(--nodata);   color: #fff; }

#dp-stats { border-collapse: collapse; width: 100%; margin-bottom: 10px; }
#dp-stats td { padding: 3px 8px; border-bottom: 1px solid var(--border); }
#dp-stats td:first-child { color: var(--nodata); }

#dp-hazards, #dp-source-breakdown { margin-top: 8px; font-size: 13px; }
.hazard-chip {
  display: inline-block; border-radius: 6px; padding: 2px 8px; margin: 2px;
  font-size: 11px; background: #2d1f1f; border: 1px solid var(--storm);
}

/* ---- Report modal ---- */
#report-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center; z-index: 2000;
}
#report-modal.hidden { display: none; }
#report-inner {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; width: 90%; max-width: 760px; max-height: 80vh;
  overflow-y: auto; padding: 24px; position: relative;
}
#report-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer;
}
#report-content { white-space: pre-wrap; font-family: monospace; font-size: 13px; line-height: 1.6; }

/* ---- Legend ---- */
#legend {
  position: fixed; bottom: 16px; left: 16px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; z-index: 900;
  font-size: 12px;
}
#legend hr { border-color: var(--border); margin: 6px 0; }
.leg-row { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.dot {
  width: 12px; height: 12px; border-radius: 50%; display: inline-block;
  border: 2px solid rgba(255,255,255,0.2);
}
.dot.clear    { background: var(--clear); }
.dot.marginal { background: var(--marginal); }
.dot.storm    { background: var(--storm); }
.dot.no-data  { background: var(--nodata); }
.haz-icon { font-size: 14px; }
