#ovex-map-app,
#ovex-map-app * {
  box-sizing: border-box;
}

.ovex-app {
  width: 100%;
  font-family: Inter, Arial, sans-serif;
  color: #fff;
  display: flex;
  flex-direction: column;
}

.ovex-toolbar {
  margin-bottom: 12px;
  order: 1;
}

.ovex-toolbar-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  width: 100%;
}

.ovex-bottom-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr 1fr;
  gap: 12px;
  width: 100%;
  margin-top: 12px;
  order: 3;
}

.ovex-card {
  background: rgba(15, 34, 54, 0.96);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  min-width: 0;
}

.ovex-title {
  font-size: 16px;
  font-weight: 800;
  color: #f29a2e;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.ovex-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.82);
  margin-bottom: 12px;
}

.ovex-card-head {
  font-size: 13px;
  font-weight: 800;
  color: #f29a2e;
  margin-bottom: 10px;
}

.ovex-basemap-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.ovex-seg-btn {
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.ovex-seg-btn.is-active {
  background: #f29a2e;
  border-color: #f29a2e;
  color: #0f2236;
}

.ovex-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.ovex-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
}

.ovex-toggle input {
  margin: 0;
}

.ovex-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,0.12);
}

.ovex-dot-autobahn { background: #6fa4d9; }
.ovex-dot-road { background: #f2efe7; }
.ovex-dot-forest { background: #9f8464; }
.ovex-dot-track { background: #c2ae92; }
.ovex-dot-relief { background: #8c8c8c; }
.ovex-dot-contours { background: #9b9b9b; }

.ovex-divider {
  height: 1px;
  margin: 12px 0;
  background: rgba(255,255,255,0.12);
}

.ovex-route-label,
.ovex-form-label {
  display: block;
  font-size: 12px;
  color: rgba(255,255,255,0.82);
  margin-bottom: 6px;
}

.ovex-route-input,
.ovex-form-input,
.ovex-form-textarea {
  width: 100%;
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.08);
  color: #fff;
  padding: 8px 10px;
  margin-bottom: 12px;
}

.ovex-form-textarea {
  min-height: 110px;
  resize: vertical;
}

.ovex-route-input::placeholder,
.ovex-form-input::placeholder,
.ovex-form-textarea::placeholder {
  color: rgba(255,255,255,0.45);
}

.ovex-track-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.ovex-route-stats-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: rgba(255,255,255,0.86);
  margin: 0;
  justify-content: flex-end;
}

.ovex-route-actions,
.ovex-form-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ovex-mini-btn {
  min-height: 38px;
  border-radius: 10px;
  border: 0;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 10px;
}

.ovex-mini-btn-primary {
  background: #f29a2e;
  color: #0f2236;
}

.ovex-mini-btn-secondary {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.12);
}

.ovex-mini-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ovex-map-wrap {
  position: relative;
  width: 100%;
  height: 78vh;
  min-height: 620px;
  overflow: hidden;
  border-radius: 18px;
  background: #e6eadf;
  order: 2;
}

#ovex-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ovex-map-btn {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 20;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: rgba(15,34,54,0.92);
  color: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ovex-gps-btn.is-locate {
  background: rgba(15,34,54,0.92);
  color: #fff;
}

.ovex-gps-btn.is-follow {
  background: #f29a2e;
  color: #0f2236;
}

.ovex-gps-btn-icon {
  font-size: 21px;
  line-height: 1;
}

.ovex-legend {
  display: grid;
  gap: 10px;
}

.ovex-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  line-height: 1.2;
}

.ovex-line {
  width: 62px;
  height: 0;
  border-top-width: 4px;
  border-top-style: solid;
  border-radius: 999px;
  flex: 0 0 auto;
}

.ovex-line-autobahn {
  border-top-color: #6fa4d9;
  box-shadow: 0 0 0 1.4px #5c6d7a;
}

.ovex-line-landstrasse {
  border-top-color: #f0cf63;
  box-shadow: 0 0 0 1.3px #8a8478;
}

.ovex-line-road {
  border-top-color: #f2efe7;
  box-shadow: 0 0 0 1.2px #8a8478;
}

.ovex-line-forest {
  border-top: 4px dashed #9f8464;
}

.ovex-line-track {
  border-top: 3px dashed #c2ae92;
}

.ovex-water-chip,
.ovex-route-chip,
.ovex-poi-chip,
.ovex-relief-chip,
.ovex-contour-chip {
  width: 62px;
  height: 8px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.ovex-water-chip {
  background: #7aaabe;
  box-shadow: 0 0 0 1px #5d8fa2 inset, 0 0 0 1px #5d8fa2;
}

.ovex-route-chip {
  background: #f29a2e;
  box-shadow: 0 0 0 2px #ffffff;
}

.ovex-poi-chip {
  background: #ff5f5f;
  box-shadow: 0 0 0 2px #ffffff;
}

.ovex-relief-chip {
  background: linear-gradient(90deg, #efefef 0%, #969696 50%, #efefef 100%);
  border: 1px solid #7f7f7f;
}

.ovex-contour-chip {
  background: #a7a7a7;
  box-shadow: 0 0 0 1px #8f8f8f inset, 0 0 0 1px #8f8f8f;
}

.ovex-list {
  display: grid;
  gap: 10px;
}

.ovex-item {
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 10px;
}

.ovex-item-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
}

.ovex-item-title {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

.ovex-item-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.72);
  margin-top: 4px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.ovex-item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.ovex-link-btn {
  min-height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.08);
  color: #fff;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.ovex-link-btn.is-primary {
  background: #f29a2e;
  color: #0f2236;
  border-color: #f29a2e;
}

.ovex-empty {
  color: rgba(255,255,255,0.68);
  font-size: 13px;
}

.ovex-export-bar {
  order: 4;
  margin-top: 14px;
  width: 100%;
}

.ovex-export-bar::before {
  content: "";
  display: block;
  height: 1px;
  background: rgba(15,34,54,0.12);
  margin-bottom: 12px;
}

.ovex-export-btn {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 14px;
  border: 0;
  background: #0f2236;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,0.12);
}

.ovex-export-btn:hover {
  background: #14304d;
}

.ovex-popup {
  min-width: 220px;
  max-width: 280px;
  font-family: Inter, Arial, sans-serif;
}

.ovex-popup-title {
  font-size: 13px;
  font-weight: 800;
  color: #2f3b26;
  margin: 0 0 5px;
}

.ovex-popup-coords {
  font-size: 11px;
  line-height: 1.35;
  color: #5c6755;
  margin-bottom: 8px;
}

.ovex-popup-details {
  font-size: 11px;
  line-height: 1.35;
  color: #3f4a35;
  margin-bottom: 8px;
}

.ovex-popup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

.ovex-popup-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 8px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 0;
}

.ovex-popup-btn-primary {
  background: #f29a2e;
  color: #0f2236;
}

.ovex-popup-btn-secondary {
  background: #eef4e7;
  color: #3f4a35;
  border: 1px solid rgba(111,126,100,0.18);
}

.maplibregl-popup-content {
  border-radius: 14px !important;
  padding: 10px !important;
}

.maplibregl-popup-close-button {
  font-size: 17px;
  color: #5c6755;
  padding: 3px 7px;
}

.maplibregl-ctrl-top-right,
.maplibregl-ctrl-bottom-left {
  z-index: 9;
}

.maplibregl-ctrl-group {
  border-radius: 14px !important;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(0,0,0,0.14) !important;
}

.maplibregl-ctrl-group button {
  background: rgba(236,243,230,0.96) !important;
}

.maplibregl-ctrl-scale {
  background: rgba(236,243,230,0.96) !important;
  border: 1px solid rgba(111,126,100,0.18) !important;
  color: #485441 !important;
  padding: 2px 6px !important;
  border-radius: 8px !important;
  box-shadow: 0 10px 24px rgba(0,0,0,0.10) !important;
}

.maplibregl-canvas {
  cursor: crosshair;
}

.ovex-track-marker,
.ovex-poi-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(0,0,0,0.22);
}

.ovex-track-marker {
  width: 30px;
  height: 30px;
  background: #f29a2e;
  color: #0f2236;
  border: 2px solid #fff;
  font-size: 12px;
}

.ovex-poi-marker {
  width: 18px;
  height: 18px;
  background: #ff5f5f;
  border: 2px solid #fff;
}

.ovex-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
}

.ovex-modal.is-open {
  display: block;
}

.ovex-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8,15,24,0.62);
  backdrop-filter: blur(3px);
}

.ovex-modal-dialog,
.ovex-modal-small {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #0f2236;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}

.ovex-modal-dialog {
  width: min(1320px, calc(100vw - 24px));
  height: min(860px, calc(100vh - 24px));
}

.ovex-modal-small {
  width: min(560px, calc(100vw - 24px));
}

.ovex-modal-close {
  position: absolute;
  right: 12px;
  top: 10px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.ovex-modal-head {
  padding: 14px 56px 12px 16px;
  background: #0f2236;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.ovex-modal-title {
  font-size: 16px;
  font-weight: 800;
  color: #f29a2e;
}

.ovex-modal-sub {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(255,255,255,0.8);
}

.ovex-modal-frame {
  width: 100%;
  height: calc(100% - 65px);
  border: 0;
  display: block;
  background: #dfe6dc;
}

.ovex-form {
  padding: 16px;
}

@media (max-width: 1100px) {
  .ovex-toolbar-grid,
  .ovex-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .ovex-toolbar {
    margin-bottom: 8px;
  }

  .ovex-toolbar-grid {
    gap: 8px;
  }

  .ovex-card {
    padding: 10px;
    border-radius: 14px;
  }

  .ovex-title {
    font-size: 15px;
    margin-bottom: 2px;
  }

  .ovex-sub {
    font-size: 11px;
    margin-bottom: 8px;
  }

  .ovex-card-head {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .ovex-seg-btn {
    min-height: 34px;
    font-size: 12px;
  }

  .ovex-toggle-row {
    gap: 8px 10px;
  }

  .ovex-toggle {
    font-size: 12px;
    gap: 6px;
  }

  .ovex-route-label {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .ovex-route-input {
    min-height: 34px;
    margin-bottom: 8px;
    font-size: 12px;
  }

  .ovex-track-head {
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
  }

  .ovex-route-stats-inline {
    justify-content: flex-start;
    gap: 8px;
    font-size: 11px;
  }

  .ovex-route-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .ovex-mini-btn {
    min-height: 34px;
    font-size: 12px;
    padding: 7px 8px;
  }

  .ovex-map-wrap {
    height: 52vh;
    min-height: 360px;
    border-radius: 14px;
  }

  .ovex-map-btn {
    right: 10px;
    top: 10px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .ovex-gps-btn-icon {
    font-size: 19px;
  }

  .ovex-bottom-grid {
    gap: 8px;
    margin-top: 8px;
  }

  .ovex-legend {
    gap: 8px;
  }

  .ovex-row {
    font-size: 12px;
    gap: 8px;
  }

  .ovex-line,
  .ovex-water-chip,
  .ovex-route-chip,
  .ovex-poi-chip,
  .ovex-relief-chip,
  .ovex-contour-chip {
    width: 48px;
  }

  .ovex-item {
    padding: 8px;
  }

  .ovex-item-title {
    font-size: 12px;
  }

  .ovex-item-sub {
    font-size: 11px;
  }

  .ovex-link-btn {
    min-height: 28px;
    font-size: 11px;
    padding: 5px 8px;
  }

  .ovex-export-bar {
    margin-top: 10px;
  }

  .ovex-export-btn {
    min-height: 44px;
    font-size: 13px;
    border-radius: 12px;
  }

  .ovex-popup {
    min-width: 200px;
    max-width: 240px;
  }

  .ovex-popup-title {
    font-size: 12px;
  }

  .ovex-popup-coords,
  .ovex-popup-details {
    font-size: 10px;
  }

  .ovex-popup-actions {
    gap: 5px;
  }

  .ovex-popup-btn {
    min-height: 30px;
    font-size: 11px;
    padding: 6px 6px;
  }

  .maplibregl-popup-content {
    padding: 8px !important;
  }

  .ovex-modal-dialog {
    width: calc(100vw - 12px);
    height: calc(100vh - 12px);
  }

  .ovex-modal-small {
    width: calc(100vw - 12px);
  }

  .ovex-form-actions {
    grid-template-columns: 1fr;
  }
}