html,
body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  font-family: system-ui, sans-serif;
  background: #f6f7f9;
}

#layout {
  display: flex;
  gap: 20px;
  align-items: stretch;
  justify-content: stretch;
  width: 100vw;
  height: 100vh;
  padding: 20px;
  box-sizing: border-box;
}

#map-container {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
}

#map-viewport {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid #ccc;
  background: #fff;
  overflow: hidden;
  min-width: 0;
  touch-action: none;
  user-select: none;
}

#map-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
}

#map-image {
  max-width: 100%;
  height: auto;
  display: block;
}

#map-points {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#layout {
  position: relative;
}

#toggle-list {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 25;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  color: #111;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

#toggle-list:hover {
  background: #fafafa;
}

/* --- POINT --- */
.map-point,
.tooltip {
  pointer-events: auto;
}

.map-point {
  position: absolute;
  width: 16px;
  height: 16px;
  background: #c62828;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  box-shadow: 0 0 0 2px #fff;
  transition: transform 0.2s ease, background-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  line-height: 1;
}

.map-point:hover {
  transform: translate3d(-50%, -50%) scale(1.2);
  background: #ff5252;
}

.map-point.highlight {
  background: #ffaa3b;
  transform: translate3d(-50%, -50%) scale(1.4);
}

/* --- TOOLTIP --- */
.tooltip {
  position: absolute;
  background: #fff;
  padding: 12px 12px 10px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  width: 240px;
  display: none;
  z-index: 10;
  font-family: system-ui, sans-serif;
  font-size: 14px;
}

.tooltip-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #444;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tooltip-close:hover {
  background: #000;
}

.tooltip.visible {
  display: block;
}

.tooltip strong {
  font-size: 15px;
}

#sidebar {
  position: absolute;
  top: 26px;
  right: 26px;
  width: 320px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  transform: translateX(110%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 22;
}

.sidebar-open #sidebar {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

#sidebar h2 {
  margin: 0;
  font-size: 18px;
}

#value-list {
  margin: 0;
  padding: 10px;
  list-style: none;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 14px;
  overflow-y: auto;
  flex: 1 1 auto;
  max-height: calc(100% - 58px);
}

#value-list li {
  padding: 10px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

#value-list li:last-child {
  border-bottom: none;
}

#value-list li:hover {
  background: #f3f7ff;
}

@media (max-width: 920px) {
  #layout {
    flex-direction: column;
    align-items: stretch;
  }

  #sidebar {
    width: calc(100% - 32px);
    max-width: 100%;
    right: 16px;
    left: 16px;
    bottom: 16px;
    top: auto;
    height: 50%;
    transform: translateY(110%);
  }

  .sidebar-open #sidebar {
    transform: translateY(0);
  }
}

.tooltip .thumb {
  width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 6px 0;
  object-fit: cover;
  max-height: 140px;
}

.tooltip .facts {
  font-style: italic;
  color: #555;
}

.tooltip .btn {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 10px;
  background: #0073aa;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-size: 13px;
}