/* Marint, modernt mörkt tema */
:root {
  --bg: #0a1929;
  --bg2: #0f2438;
  --panel: #12293f;
  --panel2: #16324c;
  --line: #1e4260;
  --text: #dbe9f4;
  --muted: #8aa9c4;
  --accent: #33c2c2;
  --accent2: #4ea8ff;
  --warn: #ffb454;
  --bad: #ff6b6b;
  --good: #4ade80;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 70% -10%, #123 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
}

header {
  padding: 18px 28px 8px;
}
header h1 { margin: 0; font-size: 1.6rem; letter-spacing: 0.5px; }
.tagline { margin: 4px 0 0; color: var(--muted); font-size: 0.95rem; }

main {
  display: grid;
  grid-template-columns: 300px 1fr 380px;
  gap: 16px;
  padding: 16px 28px 40px;
  align-items: start;
}

.panel {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg2) 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

h2 { font-size: 1.05rem; margin: 18px 0 8px; color: var(--accent); }
h2:first-child { margin-top: 0; }
h3 { font-size: 0.9rem; margin: 14px 0 6px; color: var(--accent2); font-weight: 600; }
.hint { color: var(--muted); font-size: 0.82rem; margin: 4px 0 8px; }

select, textarea, button, input[type=range] { width: 100%; }

select, textarea {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  font-size: 0.9rem;
  font-family: inherit;
}
textarea { resize: vertical; }

.slider { margin: 10px 0; }
.slider label { display: block; font-size: 0.85rem; margin-bottom: 4px; color: var(--muted); }
.slider .val { color: var(--text); font-weight: 700; }

input[type=range] {
  -webkit-appearance: none; appearance: none;
  height: 5px; border-radius: 4px;
  background: var(--line); outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 2px solid #0a1929;
}
input[type=range]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 2px solid #0a1929;
}

button {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.15s, transform 0.05s;
}
button:hover { background: var(--line); }
button:active { transform: translateY(1px); }
button.primary {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent2) 100%);
  color: #04121e; font-weight: 700; border: none; margin-top: 12px;
}
button:disabled { opacity: 0.5; cursor: wait; }

/* Karta */
.map-area { display: flex; flex-direction: column; }
.map-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.map-head select { width: auto; min-width: 160px; }
#map {
  width: 100%; aspect-ratio: 1 / 1; margin: 8px 0;
  background: #071521; border-radius: 12px; border: 1px solid var(--line);
}
.zone-blob { cursor: pointer; transition: fill 0.25s, stroke-width 0.15s; }
.zone-blob.selected { stroke: #fff; stroke-width: 1.4; }
.zone-label { fill: #eaf4ff; font-size: 2.4px; text-anchor: middle; pointer-events: none;
  paint-order: stroke; stroke: #04121e; stroke-width: 0.5px; font-weight: 600; }

.timeline { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.timeline button { width: 40px; margin: 0; flex: 0 0 auto; }
.time-label { flex: 0 0 auto; color: var(--muted); font-size: 0.85rem; min-width: 52px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 0.78rem; color: var(--muted); align-items: center; }
.legend .bar { height: 10px; width: 120px; border-radius: 3px; }
.legend .swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }
.status { margin-top: 10px; color: var(--muted); font-size: 0.85rem; min-height: 1.2em; }

/* Vattenpelare */
.watercolumn { margin-bottom: 6px; }
.wc { height: 70px; border-radius: 8px; border: 1px solid var(--line); position: relative; overflow: hidden; }
.wc-labels { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); margin-top: 2px; }

/* Grafer */
.charts-area .col-head { display: flex; justify-content: space-between; align-items: baseline; }
#zone-name { color: var(--text); }
.chart { width: 100%; height: 130px; }
.chart svg { width: 100%; height: 100%; }
.axis { stroke: var(--line); stroke-width: 0.5; }
.gridline { stroke: var(--line); stroke-width: 0.3; opacity: 0.5; }
.axis-label { fill: var(--muted); font-size: 8px; }
.serie-label { font-size: 8px; font-weight: 600; }

.explain {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; margin-top: 8px; font-size: 0.9rem; line-height: 1.5; color: var(--text);
  min-height: 1em; white-space: pre-wrap;
}

@media (max-width: 1100px) {
  main { grid-template-columns: 1fr; }
}
