:root {
  --sun: #f39c12;
  --sunrise: #e8590c;
  --moon: #4c6ef5;
  --moonrise: #91a7ff;
  --bg: #ffffff;
  --panel: #f7f7f9;
  --text: #222;
  --muted: #6b6b75;
  --border: #dcdce2;
  --accent: #2f6fde;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 14px/1.4 "Segoe UI", system-ui, sans-serif; color: var(--text); background: var(--bg); }
body { display: flex; }

#mapWrap { flex: 1; height: 100%; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; }

/* Floating location panel at the bottom of the map */
#locPanel {
  position: absolute; z-index: 1000; bottom: 44px; left: 50%; transform: translateX(-50%);
  width: min(440px, calc(100% - 24px));
  background: rgba(255,255,255,.96); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  padding: 10px 12px 8px;
}
[hidden] { display: none !important; }
#locPanel .row { margin-bottom: 4px; }
#locateBtn { font-size: 17px; line-height: 1; padding: 4px 9px; }
#locateBtn.busy { opacity: .5; cursor: progress; }
.link-btn {
  border: none; background: none; padding: 0; color: var(--accent); font-size: 12px; cursor: pointer;
}
.link-btn:hover { background: none; text-decoration: underline; }
#coordForm { margin-top: 6px; }
#locMsg { color: #b03a2e; }
#locPanel .hint { margin-top: 6px; font-size: 11px; }
#locPanel .results { max-height: 40vh; overflow-y: auto; }
#locPanel .results:not(:empty) { margin-bottom: 6px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }

#panel {
  width: 360px; height: 100%; overflow-y: auto; overflow-x: hidden;
  background: var(--panel); border-left: 1px solid var(--border);
  padding: 8px 14px 20px;
}
section { padding: 10px 0; border-bottom: 1px solid var(--border); }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 8px; color: #444; display: flex; align-items: center; gap: 6px; }
h2 .sub { text-transform: none; letter-spacing: 0; font-weight: normal; color: var(--muted); }

.row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.row input[type=text] { flex: 1; min-width: 0; }
input, button { font: inherit; }
input[type=text], input[type=date], input[type=time] {
  padding: 5px 7px; border: 1px solid var(--border); border-radius: 5px; background: #fff;
}
button {
  padding: 5px 10px; border: 1px solid var(--border); border-radius: 5px; background: #fff; cursor: pointer;
}
button:hover { background: #eef2fb; border-color: var(--accent); }
#nowBtn { background: var(--accent); border-color: var(--accent); color: #fff; }
#nowBtn:hover { filter: brightness(1.1); }
#prevDay, #nextDay { padding: 5px 7px; }
#date, #time { flex: 1; }

#slider { width: 100%; margin: 4px 0 0; }
.ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

.hint { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.hint.big { font-size: 14px; padding: 14px 0; text-align: center; }

table { width: 100%; border-collapse: collapse; }
td { padding: 2px 0; vertical-align: top; }
td:first-child { color: var(--muted); width: 42%; }
td:last-child { font-variant-numeric: tabular-nums; }

.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.swatch.sun { background: var(--sun); }
.swatch.moon { background: var(--moon); }
.compass-label { color: #868e96; font-size: 12px; font-weight: bold; }

/* Weather */
h3 { font-size: 12px; font-weight: 600; color: #555; margin: 12px 0 4px; display: flex; align-items: center; gap: 6px; }
.toggle-group { margin-left: auto; display: inline-flex; }
.unit {
  padding: 1px 7px; font-size: 11px; text-transform: none; letter-spacing: 0; border-radius: 0; background: #fff; color: #444;
}
.toggle-group .unit:first-child { border-radius: 5px 0 0 5px; }
.toggle-group .unit:last-child { border-radius: 0 5px 5px 0; border-left: none; }
.unit.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.wx-svg { width: 100%; height: auto; display: block; cursor: default; }
#wxChart .wx-svg { cursor: pointer; }
.wx-axis { font-size: 9.5px; fill: #6b6b75; font-family: "Segoe UI", system-ui, sans-serif; }
.wx-bold { font-weight: 600; fill: #333; }
.wx-layers { font-size: 13px; margin: 4px 0 2px; }
.wx-layers .wx-item { color: #444; padding-left: 8px; }
.wx-layers .wx-strong { font-weight: 600; margin-top: 2px; }
.wx-retry { margin-left: 6px; padding: 1px 8px; font-size: 12px; }
#wxStatus:empty { display: none; }
.wx-strip { margin: 4px 8px 0; height: 12px; }
.wx-strip-svg { width: 100%; height: 12px; display: block; border-radius: 2px; }
a { color: var(--accent); }

/* Phones / narrow windows: map on top, panel below */
@media (max-width: 800px) {
  body { flex-direction: column; height: auto; }
  html, body { height: auto; }
  #mapWrap { flex: none; height: 60vh; }
  #locPanel { bottom: 40px; padding: 8px 10px 6px; }
  #locPanel .results { max-height: 25vh; }
  #panel { width: 100%; height: auto; border-left: none; border-top: 1px solid var(--border); }
}

.results { list-style: none; margin: 0; padding: 0; }
.results li {
  padding: 5px 7px; border-radius: 5px; cursor: pointer; display: flex; gap: 6px; align-items: center;
}
.results li:hover { background: #e7ecf7; }
.results li .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results li .del { border: none; background: none; color: var(--muted); padding: 0 4px; }
.results li .del:hover { color: #c92a2a; }
.results .msg { color: var(--muted); cursor: default; }
.results .msg:hover { background: none; }

.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.toggles label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.toggles .swatch { width: 14px; height: 4px; border-radius: 2px; }

.hour-label {
  background: rgba(255,255,255,.85); border: none; box-shadow: none;
  font-size: 10px; padding: 0 3px; color: #7a4a00;
}
