* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --s1: #ffffff;
  --s2: #f3faf4;
  --s3: #e8f5ea;
  --b1: #d8e8dc;
  --b2: #c0d8c4;
  --pri: #1e5c30;
  --pri2: #2e7d32;
  --acc: #2471a3;
  --td: #7a9e84;
  --text: #1e3d2f;
  --warn: #b7472a;
  --r: 8px;
  --r2: 12px;
  --shadow2: 0 4px 16px rgba(0,0,0,0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: var(--r);
  border: 1.5px solid var(--b1);
  background: var(--s1);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--s2); border-color: var(--b2); }
.btn.ghost { background: transparent; border-color: var(--b1); color: var(--text); }
.btn.ghost:hover { background: var(--s2); }
.btn.sm { padding: 3px 9px; font-size: 10px; }
.btn.pri { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn.pri:hover { background: var(--pri2); }
.btn.ghost.active,
.btn.ghost.sm.active {
  background: var(--pri) !important;
  border-color: var(--pri) !important;
  color: #fff !important;
}

body {
  background: var(--s2);
  color: var(--text);
  font-family: Arial, sans-serif;
  padding: 10px;
}

.header {
  text-align: center;
  font-size: 18px;
  margin-bottom: 10px;
}

.container {
  display: flex;
  gap: 12px;
  max-width: 1400px;
  margin: 0 auto;
  height: calc(100vh - 80px);
}

@media (max-width: 768px) {
  .container {
    height: auto;
    flex-direction: column;
  }
}

.left {
  flex: 8;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.image-box {
  background: var(--s3);
  
  width: 100%;
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

#mainSvg {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  object-fit: contain;
}

.svg-objektas {
  transition: filter 0.15s ease, transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
  transform-box: fill-box;
  transform-origin: center;
}

.bottom-boxes {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  max-height: 130px;
}

.box {
  background: white;
  border: 3px solid var(--b1);
  border-radius: 12px;
  padding: 8px;
  text-align: center;
  overflow: hidden;
}


#objectMenu {
  overflow: visible;
}

.controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}

.system-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  align-items: center;
  justify-content: center;
}

.info-box {
  flex: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  overflow-y: auto;
  padding: 8px 10px;
}

#objectInfo {
  width: 100%;
  font-size: 13px;
  line-height: 1.6;
  color: #1e3d2f;
}


.info-main-text {
  
}

.info-warn-text {
  
  line-height: 1.5;
}

.right {
  flex: 2;
  background: white;
  border: 3px solid var(--b1);
  border-radius: 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 240px;
  max-width: 320px;
  position: relative;
}

.medis-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding: 14px 16px 10px;
  border-bottom: 2px solid var(--b1);
  flex-shrink: 0;
  text-align: center;
}

.medis-mygtukai {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-top: 2px solid var(--b1);
  flex-shrink: 0;
  min-height: 0;
}

.medis-btn {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 2px solid var(--b1);
  border-radius: 8px;
  background: var(--s1);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.medis-btn:hover {
  background: var(--s3);
  border-color: var(--spalva-mazas);
}

.medis-btn.active {
  background: var(--spalva-mazas);
  border-color: var(--spalva-mazas);
  color: #fff;
}

.medis-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  min-height: 0;
}

.medis-placeholder {
  color: #aaa;
  font-size: 13px;
  text-align: center;
  padding: 40px 10px;
}

.medis-diagram {
  width: 100%;
}

.medis-diagram svg {
  width: 100% !important;
  height: auto !important;
  max-width: 100%;
}

button {
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 7px;
  border: 1px solid var(--b1);
  background: var(--s1);
  cursor: pointer;
}

button:hover {
  background: #eef8f1;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.object-btn {
  padding: 5px 8px;
  margin: 2px 0;
  font-size: 11px;
}

.menu-label {
  font-size: 12px;
  font-weight: 700;
  color: #4a7c5f;
  padding: 4px 0 6px;
  text-align: center;
}

@media (max-width: 768px) {
  body { padding: 10px; }

  .header {
    font-size: 16px;
    margin-bottom: 10px;
  }

  .container {
    flex-direction: column;
    height: auto;
    gap: 10px;
  }

  .image-box {
    width: 100%;
    border-width: 4px;
    border-radius: 12px;
  }

.bottom-boxes {
    flex-direction: column;
    gap: 8px;
  }

  .box {
    padding: 12px;
    border-radius: 10px;
    border-width: 2px;
  }

  .controls {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
  }

  .controls button {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    padding: 10px 6px;
    font-size: 13px;
  }

  .system-box {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    min-height: 50px;
  }

  .info-box {
    min-height: 50px;
    font-size: 13px;
    padding: 10px;
    align-items: flex-start;
    text-align: left;
  }

  .object-btn {
    padding: 8px 12px;
    font-size: 13px;
    margin: 0;
  }

  .right {
    flex: none;
    height: auto;
    min-height: 0;
    max-width: 100%;
    overflow: visible;
    border-radius: 10px;
    display: none;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  body { padding: 12px; }

  .container {
    height: calc(100vh - 80px);
    gap: 12px;
  }

  .left { flex: 6; }
  .right { flex: 4; }

  .controls button {
    padding: 10px 8px;
    font-size: 13px;
  }
}

#popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}
#popup-overlay.active { display: flex; }

#popup-modal {
  background: #bdbdbd;
  border-radius: 16px;
  width: min(820px, 95vw);
  height: min(88vh, 700px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 28px 70px rgba(0,0,0,0.4);
  overflow: hidden;
  opacity: 0;
  transform: translateY(24px) scale(0.97);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
#popup-modal.slide-in {
  opacity: 1;
  transform: translateY(0) scale(1);
}

#popup-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  background: var(--text);
  color: #fff;
  flex-shrink: 0;
}
#popup-title {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}
#popup-back {
  display: none;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  align-items: center;
  gap: 4px;
  transition: background 0.15s;
}
#popup-back:hover { background: rgba(149, 202, 151, 0.28); }
#popup-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
#popup-close:hover { background: #c0392b; }

#popup-body {
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#popup-hotspot-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  background: var(--s3);
  overflow: hidden;
  line-height: 0;
}
#popup-hotspot-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
#popup-hotspot-ph {
  position: absolute;
  inset: 0;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 52px;
  color: #a0c4ae;
  background: var(--s3);
  line-height: 1.4;
}
#popup-hotspot-ph small { font-size: 13px; color: #7aab8a; }

.hs-dot {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 10;
}
.hs-pulse {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255, 220, 50, 0.9);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  animation: hs-ping 1.8s ease-in-out infinite;
  transition: transform 0.15s;
}
.hs-dot:hover .hs-pulse {
  transform: scale(1.25);
  background: #ffeb3b;
}
@keyframes hs-ping {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,220,50,0.6), 0 2px 8px rgba(0,0,0,0.35); }
  50%       { box-shadow: 0 0 0 10px rgba(255,220,50,0), 0 2px 8px rgba(0,0,0,0.35); }
}
.hs-label {
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.hs-dot:hover .hs-label { opacity: 1; }

.popup-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/7;
  background: var(--s3);
  flex-shrink: 0;
  overflow: hidden;
}
.popup-img-main {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.popup-img-ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 40px;
  color: #a0c4ae;
}
.popup-img-ph small { font-size: 12px; color: #7aab8a; }

.popup-desc {
  padding: 14px 18px 4px;
  font-size: 14px;
  line-height: 1.6;
  color: #2c4a38;
  flex-shrink: 0;
}

.popup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  padding: 14px 18px 18px;
}
.popup-card {
  border: 2px solid #d4e8da;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: #f8fcf9;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.popup-card:hover {
  border-color: #2d7a4f;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(45,122,79,0.18);
}
.popup-card-img-wrap {
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--s3);
  position: relative;
}
.popup-card-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.popup-card-ph {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: var(--s3);
  color: #a0c4ae;
}
.popup-card-label {
  padding: 7px 10px 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.popup-info-btnbar {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  background: #f8fcf9;
  border-top: 2px solid #d4e8da;
  flex-shrink: 0;
}
.popup-info-btn {
  flex: 1;
  padding: 11px 8px;
  background: #fff;
  border: 2px solid #b8d9c2;
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  line-height: 1.3;
}
.popup-info-btn:hover {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(30,61,47,0.25);
}

.popup-info-blokas {
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px 24px;
  display: flex;
  align-items: flex-start;
}
.popup-info-blokas p {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  background: #f0f9f3;
  border-left: 4px solid #2d7a4f;
  border-radius: 0 10px 10px 0;
  padding: 18px 20px;
  margin: 0;
  width: 100%;
}

@media (max-width: 600px) {
  #popup-overlay { padding: 0; align-items: flex-end; }
  #popup-modal {
    width: 100%;
    height: 92vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(50px);
  }
  #popup-modal.slide-in { transform: translateY(0); }
  #popup-title { font-size: 13px; }
  #popup-hotspot-wrap { min-height: 220px; }
  .popup-grid { grid-template-columns: repeat(2, 1fr); padding: 12px; }
}

.gvl-btn {
  padding: 5px 14px; 
  border: 2px solid #a8d5bc; 
  border-radius: 20px; 
  background: #ededed; 
  color: #4a7c5f; 
  font-size: 12px; 
  font-weight: 600; 
  cursor: pointer; 
  transition: all 0.18s; 
}

.gvl-btn:hover {
  background: #d4eddf; 
  border-color: var(--spalva-mazas); 
}

.gvl-btn.active {
  background: var(--spalva-mazas); 
  border-color: var(--spalva-mazas); 
  color: #fff; 
}

.background-overlay,
.background-overlay-kauburys,
.background-overlay-gvl-aukstai,
.background-overlay-gvl-zemai,
.background-overlay-slaitas-gvl1,
.background-overlay-slaitas-gvl2,
.background-overlay-kauburys-gvl1,
.background-overlay-kauburys-gvl2 {
  transition: opacity 0.4s ease;
}

.sl-step-wrap { padding: 4px 0 8px; }
.sl-step-title { font-size:11px; font-weight:700; color:var(--td); text-transform:uppercase; letter-spacing:.5px; margin-bottom:10px; }
.sl-step-obj { margin-bottom:14px; }
.sl-step-obj-name { font-size:13px; font-weight:700; color:var(--pri); margin-bottom:6px; }
.sl-pkg-btns { display:flex; flex-wrap:wrap; gap:6px; }
.sl-pkg-btn { background:var(--s2); border:2px solid var(--b1); border-radius:8px; padding:8px 14px; font-size:12px; font-weight:600; cursor:pointer; text-align:left; transition:border-color .15s, background .15s; }
.sl-pkg-btn:hover { border-color:var(--pri); background:var(--s1); }
.sl-pkg-btn.active { border-color:var(--pri); background:#e8f5e9; color:var(--pri); }
.sl-pkg-sub { display:block; font-size:10px; font-weight:400; color:var(--td); margin-top:2px; }


@media (max-width: 768px) {
  
  .bottom-boxes {
    flex-direction: column;
    max-height: none;
    height: auto;
    overflow-y: visible;
  }

  .box {
    width: 100%;
    overflow: visible;
  }

  .system-box {
    max-height: none;
    overflow-y: visible;
    flex-wrap: wrap;
    justify-content: center;
    min-height: 44px;
    padding: 8px;
  }

  .info-box {
    min-height: 44px;
    padding: 10px;
    font-size: 13px;
    align-items: flex-start;
    text-align: left;
  }

  .controls {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
  }

  .controls button {
    flex: 1 1 calc(50% - 5px);
    min-width: 0;
    padding: 9px 6px;
    font-size: 12px;
  }

  
  .image-box {
    height: 52vw;
    min-height: 200px;
    max-height: 300px;
  }

  
  #map-side-panel {
    position: static !important;
    width: 100% !important;
    max-height: none;
    min-height: 120px;
    border-radius: 10px;
    overflow-y: visible;
  }
}


@media (max-width: 768px) {
  
  #map-toolbar {
    flex-wrap: wrap;
  }
  #map-comp-mode {
    flex: 1 1 100%;
  }
  #map-toolbar > .btn {
    flex: 1 1 100%;
    font-size: 11px !important;
  }
}




#objectMenu,
#btn-sys {
  position: relative;
}

#objectMenu::before,
#btn-sys::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 2px solid #4a9d6f;
  opacity: 0;
  pointer-events: none;
  border-radius: 12px;
}

#objectMenu.wave::before {
  animation: waveRing 2.4s ease-in-out infinite;
}


#btn-sys.wave::before {
  animation: waveRing 2.4s ease-in-out infinite;
  animation-delay: 0s;
}

@keyframes waveRing {
  0%, 100% { opacity: 0;    box-shadow: 0 0 0px #4a9d6f; }
  50%       { opacity: 0.55; box-shadow: 0 0 10px 2px #4a9d6f; }
}


body.wave-calm #objectMenu.wave::before,
body.wave-calm #btn-sys.wave::before {
  animation: waveRingCalm 3s ease-in-out infinite;
}

@keyframes waveRingCalm {
  0%, 100% { opacity: 0;    }
  50%       { opacity: 0.08; box-shadow: 0 0 4px #4a9d6f; }
}


#map-canvas {
  touch-action: none;
}

