/* WeatherBox UI — dark instrument-panel look */
:root {
  --bg: #12151a;
  --bg-panel: #1a1f27;
  --bg-inset: #10131a;
  --border: #2b3340;
  --text: #d6dce4;
  --text-dim: #8b95a3;
  --accent: #58a6ff;
  --accent-warm: #e8b44a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

body { display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
#topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 8px 14px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  flex-wrap: wrap;
}
#brand { display: flex; align-items: baseline; gap: 8px; }
#logo { font-size: 20px; }
#title { font-size: 17px; font-weight: 700; letter-spacing: 0.02em; }
#subtitle { color: var(--text-dim); font-size: 12px; }

#preset-buttons { display: flex; gap: 6px; }
#preset-buttons { display: flex; gap: 5px; flex-wrap: wrap; }
.preset-btn {
  background: var(--bg-inset); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 9px; cursor: pointer; font-size: 12px;
  white-space: nowrap;
}
.preset-btn:hover { border-color: var(--accent); }
.preset-btn.active { border-color: var(--accent-warm); color: var(--accent-warm); }

#time-controls { display: flex; align-items: center; gap: 8px; margin-left: auto; }
#time-controls button {
  background: var(--bg-inset); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  width: 34px; height: 28px; cursor: pointer; font-size: 14px;
}
#time-controls button:hover { border-color: var(--accent); }
#clock {
  font-variant-numeric: tabular-nums;
  font-size: 16px; font-weight: 600; color: var(--accent-warm);
  min-width: 52px; text-align: right;
}
.inline-slider { display: flex; flex-direction: column; font-size: 11px; color: var(--text-dim); width: 150px; }
.inline-slider input { width: 100%; }

/* ---------- layout ---------- */
#layout { display: flex; flex: 1 1 auto; min-height: 0; }

#stage-wrap {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column;
  padding: 10px 12px;
  gap: 8px;
  overflow-y: auto;   /* width-first sizing may exceed the viewport height */
}

#preset-desc {
  color: var(--text-dim); font-size: 12.5px;
  min-height: 18px;
}

#stage {
  /* width/height are set by layoutStage() in main.js: 2:1 aspect, fitted to
     the available space; the rain bar below is kept exactly as wide */
  position: relative;
  margin: 0 auto;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
#stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hud { pointer-events: none; }
#glcanvas { cursor: crosshair; }

#gl-error[hidden] { display: none; }
#gl-error {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  padding: 30px; text-align: center;
  background: #200a0a; color: #ff9c9c; font-size: 15px;
}

#rainbar-wrap {
  margin: 0 auto;   /* width follows the stage, set by layoutStage() */
}
#rainbar {
  display: block; width: 100%; height: 13px;
  border: 1px solid var(--border); border-radius: 4px;
  image-rendering: pixelated;
  background: var(--bg-inset);
}
#rainbar-meta {
  display: flex; justify-content: space-between;
  font-size: 10.5px; color: var(--text-dim);
  margin-top: 2px;
}
#rainbar-label {
  font-variant-numeric: tabular-nums; color: var(--text);
}

#statusbar {
  display: flex; justify-content: space-between; gap: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden;
}
#status-fps { color: var(--text-dim); }

/* ---------- side panel ---------- */
#panel {
  flex: 0 0 300px;
  overflow-y: auto;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  padding: 10px 14px 30px;
}
#panel section { margin-bottom: 18px; }
#panel h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-dim); margin: 14px 0 8px;
  border-bottom: 1px solid var(--border); padding-bottom: 4px;
}

label.slider { display: block; margin-bottom: 8px; font-size: 12px; }
label.slider span { display: flex; justify-content: space-between; color: var(--text-dim); }
label.slider b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
label.slider input { width: 100%; margin-top: 1px; }

input[type="range"] { accent-color: var(--accent); height: 18px; }

#tools { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; margin-bottom: 8px; }
#tools label {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 4px; border-radius: 5px; cursor: pointer; font-size: 12px;
}
#tools label:hover { background: var(--bg-inset); }
#tools input { accent-color: var(--accent-warm); }

.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-row button, .select select {
  background: var(--bg-inset); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 10px; cursor: pointer; font-size: 12px;
}
.btn-row button:hover { border-color: var(--accent); }

label.select { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; font-size: 12px; color: var(--text-dim); }
label.check { display: flex; align-items: center; gap: 6px; margin: 8px 0; font-size: 12.5px; cursor: pointer; }

#legend { width: 260px; height: 34px; display: block; margin: 4px 0; }
#sonde-plot {
  width: 100%; background: var(--bg-inset);
  border: 1px solid var(--border); border-radius: 6px;
}

.hint { color: var(--text-dim); font-size: 11.5px; margin-top: 6px; }

.info-box {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 6px 0 8px;
  color: var(--text-dim);
  font-size: 11.5px;
  line-height: 1.5;
}
.info-box[hidden] { display: none; }
.info-box b { color: var(--text); }
