.map-3d-toggle {
  position: absolute;
  z-index: 960;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 999px;
  color: #fff;
  background: #172d24;
  box-shadow: 0 8px 24px rgba(23, 45, 36, 0.26);
  cursor: pointer;
}

.map-3d-toggle:hover,
.map-3d-toggle.is-active {
  color: #172d24;
  background: #e3ad58;
}

.map-3d-toggle:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.map-3d-toggle span {
  font-size: 20px;
  line-height: 1;
}

.map-3d-shell {
  position: absolute;
  inset: 0;
  z-index: 850;
  overflow: hidden;
  background: #cad4cf;
}

.map-3d-shell[hidden] {
  display: none;
}

.map-3d-canvas {
  position: absolute;
  inset: 0;
}

.map-3d-panel {
  position: absolute;
  z-index: 6;
  top: 65px;
  right: 14px;
  width: min(286px, calc(100% - 28px));
  color: #172d24;
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid rgba(215, 208, 196, 0.95);
  border-radius: 14px;
  box-shadow: 0 13px 34px rgba(23, 45, 36, 0.23);
  backdrop-filter: blur(8px);
}

.map-3d-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 13px;
}

.map-3d-panel-head small,
.map-3d-panel-head strong {
  display: block;
}

.map-3d-panel-head small {
  color: #a26e25;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.map-3d-panel-head strong {
  margin-top: 2px;
  font-size: 15px;
}

.map-3d-panel-head button {
  width: 30px;
  height: 30px;
  border: 1px solid #d9d2c6;
  border-radius: 8px;
  color: #172d24;
  background: #fff;
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
}

.map-3d-panel-body {
  padding: 0 13px 13px;
  border-top: 1px solid #e6dfd3;
}

.map-3d-panel.is-collapsed .map-3d-panel-body {
  display: none;
}

.map-3d-panel-body > p {
  margin: 10px 0;
  color: #5f6d66;
  font-size: 10px;
  line-height: 1.45;
}

.map-3d-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 10px;
}

.map-3d-view-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 10px 0 12px;
}

.map-3d-view-switch button {
  min-height: 36px;
  padding: 7px;
  border: 1px solid #d7d0c4;
  border-radius: 9px;
  color: #465b51;
  background: #fff;
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
}

.map-3d-view-switch button.is-active {
  border-color: #172d24;
  color: #fff;
  background: #172d24;
  box-shadow: 0 4px 12px rgba(23, 45, 36, 0.18);
}

.map-3d-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #344d43;
  font-size: 9.5px;
  font-weight: 700;
}

.map-3d-options input {
  width: 15px;
  height: 15px;
  accent-color: #172d24;
}

.map-3d-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 12px;
}

.map-3d-actions button {
  min-height: 34px;
  border: 1px solid #d7d0c4;
  border-radius: 8px;
  color: #172d24;
  background: #fff;
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
}

.map-3d-actions button:hover,
.map-3d-actions button.is-active {
  color: #fff;
  background: #172d24;
}

.map-3d-key {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin-top: 11px;
  color: #617069;
  font-size: 8px;
}

.map-3d-key span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.map-3d-key i {
  width: 10px;
  height: 10px;
  border: 1px solid rgba(23, 45, 36, 0.2);
  border-radius: 2px;
}

.map-3d-key .target {
  background: #d69a3d;
}

.map-3d-key .neighbor {
  background: #9da9a3;
}

.map-3d-key .sun {
  background: #fbbf24;
}

.map-3d-status {
  position: absolute;
  z-index: 7;
  left: 14px;
  bottom: 38px;
  max-width: min(430px, calc(100% - 28px));
  padding: 9px 12px;
  border-radius: 9px;
  color: #fff;
  background: rgba(23, 45, 36, 0.92);
  box-shadow: 0 8px 20px rgba(23, 45, 36, 0.22);
  font-size: 10px;
  font-weight: 700;
}

.map-3d-status[data-kind="error"] {
  background: rgba(150, 51, 43, 0.94);
}

.map-3d-status[data-kind="success"] {
  background: rgba(37, 110, 70, 0.94);
}

.map-3d-hint {
  position: absolute;
  z-index: 5;
  bottom: 9px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 10px;
  border-radius: 999px;
  color: #fff;
  background: rgba(23, 45, 36, 0.76);
  font-size: 8px;
  white-space: nowrap;
  pointer-events: none;
}

.map-3d-active > .map {
  visibility: hidden;
}

.map-3d-shell .maplibregl-ctrl-attrib {
  font-size: 8px;
}

.map-3d-shell .maplibregl-popup-content {
  border-radius: 11px;
  padding: 13px 15px;
  color: #172d24;
  font-family: "Inter", Arial, sans-serif;
}

.dvf-3d-popup {
  display: grid;
  gap: 4px;
  min-width: 190px;
}

.dvf-3d-popup small {
  color: #a26e25;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.dvf-3d-popup strong {
  margin-bottom: 3px;
  font-size: 13px;
}

.dvf-3d-popup span {
  color: #52645b;
  font-size: 10px;
  line-height: 1.35;
}

.dvf-3d-building-card {
  width: min(380px, 76vw);
  max-height: min(480px, 62vh);
  overflow: auto;
  padding-right: 3px;
  color: #172d24;
}

.dvf-3d-building-card > header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: grid;
  gap: 3px;
  padding: 2px 2px 10px;
  border-bottom: 1px solid #e5ded2;
  background: #fff;
}

.dvf-3d-building-card > header small {
  color: #a26e25;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.dvf-3d-building-card > header strong {
  font-size: 15px;
}

.dvf-3d-building-card > header span {
  color: #65736c;
  font-size: 10px;
}

.dvf-3d-layer-detail {
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid #e4ddd1;
  border-radius: 9px;
  background: #fcfaf5;
}

.dvf-3d-layer-detail summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 9px;
  color: #2e493e;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  list-style: none;
}

.dvf-3d-layer-detail summary::-webkit-details-marker {
  display: none;
}

.dvf-3d-layer-detail summary b {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  background: #172d24;
  font-size: 9px;
}

.dvf-3d-layer-detail > div {
  display: grid;
  gap: 6px;
  padding: 0 8px 8px;
}

.dvf-3d-layer-detail article,
.dvf-3d-source-html {
  display: grid;
  gap: 2px;
}

.dvf-3d-layer-detail article {
  padding: 7px;
  border-radius: 7px;
  background: #fff;
}

.dvf-3d-layer-detail article strong {
  font-size: 10px;
}

.dvf-3d-layer-detail article span,
.dvf-3d-layer-detail article small,
.dvf-3d-source-html {
  color: #65736c;
  font-size: 9px;
  line-height: 1.4;
}

.dvf-3d-source-html .leaflet-popup-content,
.dvf-3d-source-html .map-popup {
  width: auto !important;
  margin: 0 !important;
}

.dvf-3d-no-layer-info {
  margin: 9px 0 0;
  padding: 9px;
  border-radius: 8px;
  color: #6d756f;
  background: #f3efe7;
  font-size: 9px;
  line-height: 1.45;
}

@media (max-width: 680px) {
  .map-3d-toggle {
    top: 10px;
    min-height: 38px;
    padding: 7px 12px;
    font-size: 11px;
  }

  .map-3d-panel {
    top: 58px;
    right: 8px;
    width: min(255px, calc(100% - 16px));
  }

  .map-3d-panel.is-collapsed {
    width: 180px;
  }

  .map-3d-options {
    grid-template-columns: 1fr;
  }

  .map-3d-hint {
    display: none;
  }
}
