:root {
  --panel-bg: rgba(18, 24, 22, 0.94);
  --panel-fg: #e8eee9;
  --muted: #9fb0a6;
  --accent: #f4b942;
  --up: #7bd88f;
  --down: #f08a7e;
  --line: rgba(255, 255, 255, 0.12);
  --radius: 10px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: #10150f; color: var(--panel-fg); }

#map { position: fixed; inset: 0; }

#panel {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: 340px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  overflow: hidden;
}

#panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
#panel-head h1 { flex: 1; margin: 0; font-size: 1rem; font-weight: 650; letter-spacing: 0.01em; }
.score-chip { display: flex; flex-direction: column; align-items: center; min-width: 46px; }
.score-chip span { font-size: 1.5rem; font-weight: 700; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.score-chip small { color: var(--muted); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; }

button {
  font: inherit;
  color: var(--panel-fg);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}
button:hover { background: rgba(255, 255, 255, 0.16); }

#panel-body { flex: 1; overflow-y: auto; padding: 4px 14px 14px; }
#panel.collapsed { bottom: auto; }
#panel.collapsed #panel-body { display: none; }
section { padding: 12px 0; border-bottom: 1px solid var(--line); }
section:last-of-type { border-bottom: 0; }
h2 { margin: 0 0 6px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.row label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
#status { margin: 8px 0 0; font-size: 0.78rem; color: var(--muted); min-height: 1em; }
#status.error { color: var(--down); }

input[type='range'] { width: 100%; accent-color: var(--accent); }
.ticks { display: flex; justify-content: space-between; font-size: 0.68rem; color: var(--muted); }
#hour-label { font-size: 0.85rem; font-weight: 600; }

.score-line { display: flex; align-items: baseline; gap: 6px; }
#score-value { font-size: 2.6rem; font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; }
.of { color: var(--muted); }
.meter { height: 6px; background: rgba(255, 255, 255, 0.1); border-radius: 3px; overflow: hidden; margin-top: 8px; }
#score-bar { height: 100%; width: 0; background: linear-gradient(90deg, #6a3d9a, #e15c4f, #f9c74f); transition: width 0.25s; }
.pill { font-size: 0.72rem; text-transform: capitalize; padding: 2px 10px; border-radius: 999px; background: rgba(244, 185, 66, 0.18); color: var(--accent); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: rgba(255, 255, 255, 0.05); border-radius: var(--radius); padding: 8px 10px; }
.stat b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.stat span { display: block; color: var(--muted); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; }
.stat small { display: block; color: var(--muted); font-size: 0.72rem; margin-top: 2px; }

#reasons { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 0.84rem; line-height: 1.35; }
#reasons li { padding-left: 16px; position: relative; }
#reasons li::before { content: ''; position: absolute; left: 2px; top: 0.5em; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
#reasons li.up::before { background: var(--up); }
#reasons li.down::before { background: var(--down); }

.stand p { margin: 0 0 8px; font-size: 0.84rem; line-height: 1.35; color: #d3ddd6; }

.check { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; font-size: 0.86rem; }
.slider { display: block; margin-top: 8px; font-size: 0.8rem; color: var(--muted); }
.legend { margin-top: 12px; }
#legend-ramp { height: 10px; border-radius: 5px; border: 1px solid var(--line); }
.legend-labels { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--muted); margin-top: 3px; }
.legend-land { margin-top: 8px; font-size: 0.76rem; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.swatch { display: inline-block; width: 18px; height: 0; border-top: 3px solid; }
.swatch.wma { border-color: #3ee0d2; }
.swatch.refuge { border-color: #ff7ad9; border-top-style: dashed; margin-left: 8px; }
.swatch.closed { border-color: #ffb020; border-top-style: dotted; margin-left: 8px; }
.facts p { margin: 0 0 6px; font-size: 0.84rem; line-height: 1.35; color: #d3ddd6; }
#data-status { list-style: none; margin: 0; padding: 0; font-size: 0.8rem; color: #ffb4a8; }
.disclaimer { font-size: 0.72rem; line-height: 1.4; color: var(--muted); margin: 8px 0 0; }

.stand-icon { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 3px solid #1a1a1a; box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0, 0, 0, 0.5); }
.leaflet-tooltip.land-tip { font-size: 0.78rem; }

@media (max-width: 720px) {
  #panel {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: auto;
    max-height: 62vh;
  }
  #panel.collapsed { max-height: none; bottom: max(8px, env(safe-area-inset-bottom)); }
  #panel-head { padding: 8px 12px; }
  .leaflet-control-layers { margin-top: 6px; }
}
#stand-under { list-style: none; margin: 0 0 8px; padding: 0; font-size: 0.78rem; line-height: 1.35; color: #c3cec6; display: grid; gap: 3px; }
.tag { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em; color: #ffd166; border: 1px solid #ffd166; border-radius: 3px; padding: 0 3px; }
#weather-age { margin: 0 0 8px; font-size: 0.8rem; color: #ffd166; }
#weather-age:empty { display: none; }
#save-offline { cursor: pointer; }
#offline-status { margin: 6px 0 0; font-size: 0.78rem; color: var(--muted); }

#best-spots { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
#best-spots button.spot { width: 100%; text-align: left; font-size: 0.78rem; }
