﻿:root {
  --bg: #161616;
  --panel: rgba(30, 30, 32, 0.94);
  --panel-border: #3a3a3c;
  --surface: #262628;
  --surface-2: #313134;
  --accent: #38bdf8;
  --accent-2: #f59e0b;
  --text: #e4e4e6;
  --muted: #8a8a92;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}
body { display: flex; flex-direction: row; }
#stage {
  flex: 1 1 auto;
  position: relative;
  height: 100%;
  overflow: hidden;
}
.ad-rail {
  flex: 0 0 160px;
  width: 160px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 1;
}
@media (max-width: 900px) {
  .ad-rail { display: none; }
}
#map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #161616;
}
#wind-canvas {
  position: absolute;
  inset: 0;
  z-index: 400;        
  pointer-events: none;
}
#brush-layer {
  position: absolute;
  inset: 0;
  z-index: 450;
  cursor: crosshair;
}
#brush-ring {
  position: absolute;
  border: 1.5px solid rgba(245, 158, 11, 0.9);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
  display: none;
}
.leaflet-control-container { z-index: 500; }
#panel-toggle {
  position: absolute;
  top: 50%;
  left: calc(14px + 280px + 4px);
  transform: translateY(-50%);
  z-index: 601;
  width: 20px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-left: none;
  border-radius: 0 4px 4px 0;
  background: rgba(30, 30, 32, 0.55);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.3);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: left 0.25s ease, color 0.15s, background 0.15s;
  backdrop-filter: blur(12px);
}
#panel-toggle:hover { color: var(--text); background: rgba(40, 40, 44, 0.7); }
#panel-toggle.panel-hidden {
  left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
}
#panel {
  transition: transform 0.25s ease;
}
#panel.panel-hidden {
  transform: translateX(calc(-100% - 20px));
}
#panel {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 600;
  width: 280px;
  max-height: calc(100% - 28px);
  overflow-y: auto;
  scrollbar-width: none;        
  -ms-overflow-style: none;     
  padding: 16px;
  background: rgba(0, 0, 0, 0.616);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
#panel::-webkit-scrollbar { width: 0; height: 0; display: none; } 
.panel-header { position: relative; }
#panel-title {
  display: block;
  width: auto;
  max-width: 180px;
  height: auto;
  margin: 0 0 12px -6px;
}
.toggle-all {
  position: absolute;
  top: 0; right: 0;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  background: rgba(38, 38, 40, 0.6);
  backdrop-filter: blur(6px);
  color: var(--text);
  font-size: 10px;
  cursor: pointer;
}
.toggle-all:hover { background: rgba(49, 49, 52, 0.8); }
.group { border-top: 1px solid var(--panel-border); padding-top: 12px; margin-top: 12px; }
.group h2 {
  margin: 0 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.group h2:hover { color: var(--text); }
.group h2::after {
  content: "\2212";
  font-size: 14px;
  line-height: 1;
  color: var(--muted);
}
.group.collapsed h2 { margin-bottom: 0; }
.group.collapsed h2::after { content: "+"; }
.group.collapsed > :not(h2) { display: none !important; }
.row { display: flex; gap: 8px; margin-bottom: 10px; align-items: center; }
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 10px; }
.tool {
  padding: 9px 6px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  background: rgba(38, 38, 40, 0.6);
  backdrop-filter: blur(6px);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s;
}
.tool:hover { background: rgba(49, 49, 52, 0.8); }
.tool.active { background: var(--accent-2); color: #2a1a02; font-weight: 600; }
.tool[data-tool="eraser"] { grid-column: span 2; }
.seg { display: flex; flex: 1; border-radius: 4px; overflow: hidden; gap: 2px; }
.seg-btn { flex: 1; padding: 6px; border: 1px solid rgba(255, 255, 255, 0.07); background: rgba(38, 38, 40, 0.6); backdrop-filter: blur(6px); color: var(--text); font-size: 11.5px; cursor: pointer; }
.seg-btn.active { background: var(--accent); color: #04222f; font-weight: 600; }
#rotation-row label { font-size: 12px; color: var(--muted); min-width: 56px; }
.slider { display: block; margin-bottom: 12px; font-size: 12px; }
.slider span { display: block; margin-bottom: 5px; color: var(--text); }
.slider b { color: var(--accent); }
.kmh-ruler {
  position: relative;
  height: 16px;
  margin-bottom: 2px;
}
.kmh-tick {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
}
.kmh-tick::before {
  content: "";
  display: block;
  width: 1px;
  height: 4px;
  background: var(--panel-border);
}
.kmh-label {
  font-size: 9px;
  color: var(--muted);
  line-height: 1;
  margin-top: 1px;
}
.kmh-unit {
  position: absolute;
  right: 0;
  top: 0;
  font-size: 9px;
  color: var(--muted);
  transform: translateY(-1px);
}
input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; outline: none; }
input[type="range"]:focus { outline: none; }
.select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.select:focus { outline: none; border-color: var(--accent); }
.legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 10px;
  color: var(--muted);
}
.legend canvas {
  flex: 1;
  height: 10px;
  border-radius: 3px;
  display: block;
}
.stops { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.stop { position: relative; width: 30px; height: 26px; }
.stop input[type="color"] {
  width: 100%; height: 100%; padding: 0; border: none;
  border-radius: 4px; background: none; cursor: pointer;
}
.stop input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.stop input[type="color"]::-webkit-color-swatch { border: none; border-radius: 3px; }
.stop .rm {
  position: absolute; top: -5px; right: -5px;
  width: 14px; height: 14px; line-height: 12px; text-align: center;
  font-size: 11px; border: none; border-radius: 50%;
  background: #444; color: #fff; cursor: pointer; padding: 0;
}
.stop .rm:hover { background: #c0392b; }
.add-stop { margin-top: 8px; font-size: 11px; width: 100%; }
.check { font-size: 12px; color: var(--text); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { accent-color: var(--accent); }
#interactive-options {
  display: none;
  padding-left: 10px;
  border-left: 2px solid var(--panel-border);
  margin-bottom: 0;
}
.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  cursor: default;
  flex-shrink: 0;
  position: relative;
}
.info-tip::after {
  content: attr(aria-label);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  background: #1e1e20;
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  padding: 7px 9px;
  font-size: 11px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 900;
  white-space: normal;
}
.info-tip:hover::after { opacity: 1; }
.action {
  flex: 1;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  background: rgba(38, 38, 40, 0.6);
  backdrop-filter: blur(6px);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.action:hover { background: rgba(49, 49, 52, 0.8); }
.action.active { background: var(--accent); color: #04222f; font-weight: 600; }
#stations { position: absolute; inset: 0; z-index: 460; pointer-events: none; }
.station {
  position: absolute;
  transform: translate(-50%, -115%);
  background: rgba(20, 20, 22, 0.92);
  border-radius: 5px;
  padding: 5px 7px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  pointer-events: none;
}
.station::after {     
  content: "";
  position: absolute;
  bottom: -5px; left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid rgba(20, 20, 22, 0.92);
}
.st-rm {
  position: absolute; top: -6px; right: -6px;
  width: 14px; height: 14px; line-height: 12px; text-align: center;
  font-size: 11px; border: none; border-radius: 50%;
  background: #444; color: #fff; cursor: pointer; padding: 0;
  pointer-events: auto;
}
.st-rm:hover { background: #c0392b; }
.st-arrow-rot {
  display: block;
  transform-origin: 50% 50%;
  transition: transform 0.2s ease;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}
.st-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 120px;
  pointer-events: auto;
}
.st-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
  opacity: 0.45;
  pointer-events: auto;
}
.st-name:hover { opacity: 1; }
.st-name-input {
  font-size: 10px;
  width: 90px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 3px;
  color: var(--text);
  padding: 1px 4px;
  outline: none;
  pointer-events: auto;
}
.st-loc {
  font-size: 10px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  pointer-events: auto;
  flex-shrink: 0;
}
.st-loc:hover { color: var(--accent); }
.st-spd { font-weight: 600; font-variant-numeric: tabular-nums; }
.st-dir { font-size: 9px; color: var(--muted); letter-spacing: 0.5px; }
.hint {
  margin-top: 14px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  border-top: 1px solid var(--panel-border);
  padding-top: 10px;
}
.hint b { color: var(--accent); }
#settings-btn {
  position: absolute;
  top: 14px;
  right: 12px;
  z-index: 600;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  background: rgba(30, 30, 32, 0.6);
  backdrop-filter: blur(12px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
}
#settings-btn:hover { background: rgba(49, 49, 52, 0.85); }
#settings-btn img { opacity: 0.65; transition: opacity 0.15s; }
#settings-btn:hover img { opacity: 1; }

#settings-overlay {
  position: absolute;
  inset: 0;
  z-index: 800;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
}
#settings-overlay.open { display: flex; }

#settings-panel {
  background: rgba(0, 0, 0, 0.616);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  backdrop-filter: blur(8px);
  padding: 20px;
  min-width: 260px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.settings-header span {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
#settings-close {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
#settings-close:hover { color: var(--text); }
.settings-section { margin-bottom: 16px; }
.settings-section:last-child { margin-bottom: 0; }
.settings-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

#bottom-bar {
  position: absolute;
  bottom: 10px;
  right: 12px;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: ui-monospace, "Consolas", monospace;
}
#fps {
  color: var(--muted);
  background: rgba(22, 22, 22, 0.7);
  padding: 3px 8px;
  border-radius: 4px;
}
#tiktok-link {
  color: var(--muted);
  background: rgba(22, 22, 22, 0.7);
  padding: 3px 8px;
  border-radius: 4px;
  text-decoration: none;
  transition: color 0.15s;
}
#tiktok-link:hover { color: var(--text); }