* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: Arial, sans-serif;
  font-size: 13px;
  background: #1a1a2e;
  color: #e0e0e0;
}

#header {
  height: 36px;
  background: #16213e;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 16px;
  border-bottom: 1px solid #0f3460;
  z-index: 1000;
  position: relative;
}

#title {
  font-size: 15px;
  font-weight: bold;
  color: #e94560;
}

#model-select,
#init-select {
  background: #0f3460;
  border: 1px solid #334480;
  color: #e0e0e0;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  outline: none;
}

#model-select:focus,
#init-select:focus {
  border-color: #e94560;
}

#init-select {
  min-width: 110px;
}

#controls {
  position: absolute;
  top: 44px;
  left: 8px;
  z-index: 1000;
  background: rgba(22, 33, 62, 0.92);
  border: 1px solid #0f3460;
  border-radius: 6px;
  padding: 8px 10px;
  min-width: 180px;
  backdrop-filter: blur(4px);
}

.ctrl-group {
  margin-bottom: 10px;
}

.ctrl-group:last-child {
  margin-bottom: 0;
}

.ctrl-group-title {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8888aa;
  margin-bottom: 5px;
}

#model-sections {
  margin-bottom: 4px;
}

.model-section {
  border-left: 2px solid #334480;
  padding-left: 7px;
  margin-bottom: 7px;
}

.model-section-header {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
}

.model-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.model-section-name {
  font-size: 11px;
  font-weight: bold;
  color: #c0c0e0;
  flex: 1;
}


.layer-row {
  margin-bottom: 5px;
}

.layer-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.layer-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #6688aa;
}

.btn-remove-layer {
  background: none;
  border: none;
  color: #5558aa;
  cursor: pointer;
  padding: 0 1px;
  font-size: 11px;
  line-height: 1;
  opacity: 0.6;
  flex-shrink: 0;
}

.btn-remove-layer:hover {
  color: #e94560;
  opacity: 1;
}

#surface-dropdown {
  position: relative;
}

#surface-btn {
  background: #0f3460;
  border: 1px solid #334480;
  color: #e0e0e0;
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  outline: none;
  white-space: nowrap;
}

#surface-btn:hover,
#surface-btn:focus {
  border-color: #e94560;
}

#surface-menu {
  position: absolute;
  top: calc(100% + 3px);
  right: 0;
  background: #16213e;
  border: 1px solid #334480;
  border-radius: 4px;
  padding: 3px 0;
  z-index: 2000;
  min-width: 130px;
}

.surface-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: #c0c0e0;
  cursor: pointer;
  white-space: nowrap;
}

.surface-item:hover {
  background: #1a3a6e;
  color: #ffffff;
}

.surface-item input[type="checkbox"] {
  accent-color: #e94560;
  cursor: pointer;
}

#time-info {
  font-weight: bold;
  color: #e0e0ff;
  font-size: 12px;
  margin-bottom: 5px;
  white-space: nowrap;
}

#time-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

#time-nav button {
  background: #0f3460;
  border: 1px solid #e94560;
  color: #e0e0e0;
  border-radius: 3px;
  cursor: pointer;
  padding: 2px 7px;
  font-size: 12px;
  line-height: 1.4;
}

#time-nav button:hover {
  background: #e94560;
}

#anim-speed {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

#anim-speed button {
  background: #0f3460;
  border: 1px solid #e94560;
  color: #e0e0e0;
  border-radius: 3px;
  cursor: pointer;
  padding: 1px 8px;
  font-size: 14px;
  line-height: 1.4;
}

#anim-speed button:hover:not(:disabled) {
  background: #e94560;
}

#anim-speed button:disabled {
  opacity: 0.35;
  cursor: default;
}

#speed-label {
  color: #a0a0c0;
  font-size: 11px;
  min-width: 38px;
  text-align: center;
}

#fhr-slider {
  width: 100%;
  accent-color: #e94560;
}

.toggle-row {
  display: flex;
  gap: 12px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
  cursor: pointer;
  color: #c8c8d8;
}

.toggle input[type="checkbox"] {
  accent-color: #e94560;
  width: 13px;
  height: 13px;
  cursor: pointer;
}

#map {
  position: absolute;
  top: 36px;
  left: 0;
  right: 0;
  bottom: 0;
}

#legend {
  margin-top: 8px;
  line-height: 0;
}

#colorbar,
#precip-colorbar {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
}

#precip-colorbar {
  margin-top: 4px;
}

#snow-colorbar {
  margin-top: 4px;
}

#wbz-colorbar {
  margin-top: 4px;
}

#zoom-info {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  font-size: 11px;
  color: #8888aa;
  pointer-events: none;
}

/* Hover tooltip */
#hover-tooltip {
  display: none;
  position: fixed;
  z-index: 2000;
  background: rgba(22, 33, 62, 0.95);
  border: 1px solid #0f3460;
  border-radius: 4px;
  padding: 5px 9px;
  font-size: 12px;
  color: #e0e0ff;
  pointer-events: none;
  white-space: nowrap;
  line-height: 1.6;
}

/* Two-model hover table */
.hover-table { border-collapse: collapse; }
.hover-table th { font-size: 11px; font-weight: normal; padding: 0 0 2px 12px; }
.hover-table td:first-child { color: #6688aa; font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; padding-right: 4px; }
.hover-table td:not(:first-child) { padding-left: 12px; }

/* Station value labels */
.stn-temp-label {
  background: rgba(22, 33, 62, 0.82);
  color: #ffffff;
  font-size: 10px;
  font-weight: bold;
  padding: 1px 3px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  white-space: nowrap;
  pointer-events: none;
  line-height: 1.2;
  display: inline-block;
}

.stn-precip-label {
  background: rgba(0, 48, 128, 0.82);
  color: #aaddff;
  font-size: 10px;
  font-weight: bold;
  padding: 1px 3px;
  border-radius: 2px;
  border: 1px solid rgba(100, 160, 255, 0.45);
  white-space: nowrap;
  pointer-events: none;
  line-height: 1.2;
  display: inline-block;
}

.stn-snow-label {
  background: rgba(30, 60, 200, 0.85);
  color: #ffffff;
  font-size: 10px;
  font-weight: bold;
  padding: 1px 3px;
  border-radius: 2px;
  border: 1px solid rgba(150, 180, 255, 0.5);
  white-space: nowrap;
  pointer-events: none;
  line-height: 1.2;
  display: inline-block;
}

/* Contour labels */
.contour-label {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  font-weight: bold;
  color: #111;
  white-space: nowrap;
  pointer-events: none;
  line-height: 1;
  text-shadow:
    -1px -1px 0 #fff,
     1px -1px 0 #fff,
    -1px  1px 0 #fff,
     1px  1px 0 #fff;
}

/* Leaflet overrides */
.leaflet-container {
  background: #2a3050;
}

.leaflet-control-zoom {
  border: 1px solid #0f3460 !important;
}

.leaflet-control-zoom a {
  background: #16213e !important;
  color: #e0e0e0 !important;
  border-bottom: 1px solid #0f3460 !important;
}

.leaflet-control-zoom a:hover {
  background: #0f3460 !important;
}

.leaflet-control-attribution {
  background: rgba(22, 33, 62, 0.7) !important;
  color: #6666aa !important;
  font-size: 10px !important;
}

.leaflet-control-attribution a {
  color: #9999cc !important;
}
