:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --text: #152033;
  --muted: #64748b;
  --line: #dbe3ef;
  --accent: #1d64f2;
  --accent-soft: #ffffff;
  --ok: #057a55;
  --warn: #b42318;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.11);
  --radius: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: linear-gradient(#ffffff);
}

.hero {
  max-width: 1360px;
  margin: 0 auto;
  padding: 28px 34px 12px;
}

.hero__topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 8px 13px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 3.2vw, 46px);
  letter-spacing: -0.05em;
}

.hero p {
  margin: 0;
  max-width: 950px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 16px;
}

.app-layout {
  max-width: 1360px;
  margin: 0 auto;
  padding: 18px 34px 38px;
  display: grid;
  grid-template-columns: minmax(360px, 485px) minmax(0, 1fr);
  gap: 22px;
}

.panel, .map-card, .result-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(219, 227, 239, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.input-panel { padding: 22px; }

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 14px;
}

.section-title h2 { margin: 0; font-size: 19px; }
.section-title span { color: var(--muted); font-size: 13px; text-align: right; }

.field { display: grid; gap: 7px; margin: 13px 0; }
label { font-weight: 800; font-size: 14px; }

input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--text);
  padding: 12px 13px;
  font-size: 15px;
  outline: none;
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.hint { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
button {
  border: 0;
  border-radius: 13px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}
button.primary { background: var(--accent); color: #fff; }
button.secondary { background: #edf2f7; color: var(--text); }
button:hover { filter: brightness(0.98); }

.status { min-height: 20px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }

.main-panel {
  display: grid;
  grid-template-rows: 455px auto;
  gap: 22px;
  min-width: 0;
}

.map-card { overflow: hidden; }
#map { width: 100%; height: 100%; min-height: 420px; }

.result-card {
  padding: 22px;
  display: grid;
  grid-template-columns: minmax(230px, 0.85fr) 1.15fr;
  gap: 18px;
}

.result-big {
  background: var(--accent-soft);
  border-radius: 18px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.result-label, .result-big small { color: var(--muted); line-height: 1.4; }
.result-big strong {
  color: var(--accent);
  font-size: clamp(48px, 7vw, 78px);
  line-height: 0.96;
  letter-spacing: -0.08em;
}
.result-unit { color: var(--accent); font-size: 22px; font-weight: 900; margin-bottom: 12px; }

.metrics { display: grid; align-content: center; gap: 6px; }
.metrics div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  font-size: 14px;
}
.metrics strong { white-space: nowrap; }

.formula {
  grid-column: 1 / -1;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 15px;
  padding: 15px 17px;
  font-size: 13.5px;
  line-height: 1.55;
  overflow-x: auto;
}
.formula p { margin: 9px 0 0; color: #cbd5e1; }

@media (max-width: 1020px) {
  .app-layout { grid-template-columns: 1fr; }
  .main-panel { grid-template-rows: 390px auto; }
}

@media (max-width: 700px) {
  .hero, .app-layout { padding-left: 18px; padding-right: 18px; }
  .grid-2, .result-card { grid-template-columns: 1fr; }
  .section-title { display: block; }
}

@media print {
  .input-panel, .hero__topline button, #languageSelect, .button-row { display: none !important; }
  body { background: #fff; }
  .app-layout { display: block; padding: 0; }
  .hero { padding: 0 0 18px; }
  .main-panel { display: block; }
  .map-card { height: 380px; margin-bottom: 18px; box-shadow: none; }
  .result-card { box-shadow: none; border: 1px solid #ccc; }
}

.sound-wave-ring {
  stroke: var(--accent);
  stroke-dasharray: 7 7;
  fill: none;
}
.sound-wave-ring-1 { stroke-opacity: 0.55; }
.sound-wave-ring-2 { stroke-opacity: 0.45; }
.sound-wave-ring-3 { stroke-opacity: 0.35; }
.sound-wave-ring-4 { stroke-opacity: 0.26; }
.sound-wave-ring-5 { stroke-opacity: 0.18; }

.sound-wave-label {
  background: transparent;
  border: 0;
}
.sound-wave-label span {
  display: inline-block;
  white-space: nowrap;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(219, 227, 239, 0.95);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
}

.sound-wave-legend {
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(219, 227, 239, 0.95);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}
.sound-wave-legend span {
  color: var(--muted);
}

/* Dynamic map symbols for installation situation and directivity */
.hp-div-icon, .receiver-div-icon {
  background: transparent;
  border: 0;
}

.hp-symbol {
  position: relative;
  width: 74px;
  height: 74px;
  transform: translateZ(0);
}

.hp-unit {
  position: absolute;
  left: 20px;
  top: 20px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #1d64f2;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.28);
  z-index: 4;
}

.hp-arrow {
  position: absolute;
  left: 54px;
  top: 26px;
  width: 26px;
  height: 22px;
  color: #1d64f2;
  font-size: 23px;
  font-weight: 900;
  line-height: 22px;
  text-shadow: 0 2px 8px rgba(255,255,255,0.95);
  z-index: 5;
  transform-origin: -17px 11px;
}

.hp-arrow { transform: rotate(var(--hp-arrow-rotation, 0deg)); }
.hp-dir-bad .hp-arrow {
  transform: rotate(var(--hp-arrow-rotation, 0deg)) scale(1.12);
  color: #b42318;
}
.hp-wall-group {
  position: absolute;
  inset: 0;
  transform: rotate(var(--hp-map-rotation, 0deg));
  transform-origin: 37px 37px;
  z-index: 2;
}

.hp-tag {
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translateX(-50%);
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(219, 227, 239, 0.95);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
  color: #152033;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
  z-index: 6;
}

.hp-wall {
  position: absolute;
  display: none;
  background: #334155;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
  z-index: 2;
}

.hp-wall-a {
  display: block;
  left: 8px;
  top: 8px;
  width: 58px;
  height: 7px;
  opacity: 0;
}

.hp-wall-b {
  right: 8px;
  top: 8px;
  width: 7px;
  height: 58px;
}

.hp-wall-c {
  left: 8px;
  top: 8px;
  width: 7px;
  height: 58px;
}

.hp-wall .hp-wall-a,
.hp-corner .hp-wall-a,
.hp-niche .hp-wall-a {
  opacity: 1;
}

.hp-corner .hp-wall-b,
.hp-niche .hp-wall-b,
.hp-niche .hp-wall-c {
  display: block;
}

.hp-free .hp-wall-a { opacity: 0; }

.receiver-symbol {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  display: grid;
  place-items: center;
  border: 3px solid #fff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.28);
  font-size: 13px;
  font-weight: 900;
}

.installation-line {
  stroke: #334155;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.installation-label {
  background: transparent;
  border: 0;
}

.installation-label span {
  display: inline-block;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  color: white;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
  font-size: 11px;
  font-weight: 900;
}

#directivity:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}


.geometry-warning {
  min-height: 20px;
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}
.geometry-warning.warn {
  color: var(--warn);
  background: #fff1f3;
  border: 1px solid #ffd6dc;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 800;
}

.result-big.invalid-geometry {
  background: #fff1f3;
}
.result-big.invalid-geometry strong,
.result-big.invalid-geometry .result-unit {
  color: var(--warn);
}

.receiver-symbol.receiver-invalid {
  background: var(--warn);
  animation: receiverPulse 1.2s ease-in-out infinite;
}

@keyframes receiverPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}


.sound-field-cell {
  stroke: none;
  mix-blend-mode: multiply;
}

.sound-threshold-line {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-wave-legend {
  min-width: 210px;
}

.sound-wave-legend strong {
  display: block;
  margin-bottom: 4px;
}

.sound-wave-legend > span {
  display: block;
  color: var(--muted);
  margin-bottom: 9px;
}

.sound-field-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 5px 0;
  font-weight: 800;
}

.sound-field-swatch {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 2px solid transparent;
  flex: 0 0 15px;
}

.sound-wave-label span {
  border: 2px solid rgba(15, 23, 42, 0.18);
}


.nudge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-width: 260px;
}

.nudge-grid #moveHpNorth {
  grid-column: 2;
}

.nudge-grid #moveHpWest {
  grid-column: 1;
}

.nudge-grid #moveHpEast {
  grid-column: 3;
}

.nudge-grid #moveHpSouth {
  grid-column: 2;
}

.nudge-btn {
  padding: 10px 12px;
  min-height: 42px;
}


.sound-field-canvas {
  position: absolute;
  z-index: 390;
  image-rendering: auto;
  mix-blend-mode: multiply;
}

.leaflet-overlay-pane svg {
  z-index: 410;
}


/* Keep Leaflet marker dragging smooth: marker artwork should not intercept pointer events internally. */
.hp-symbol,
.hp-symbol *,
.receiver-symbol,
.receiver-symbol * {
  pointer-events: none;
}

.leaflet-marker-icon {
  cursor: grab;
}

.leaflet-marker-dragging {
  cursor: grabbing;
}


.address-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.address-row button {
  white-space: nowrap;
}

@media (max-width: 560px) {
  .address-row {
    grid-template-columns: 1fr;
  }
}


.location-button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.coordinate-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 11px 12px;
}

.coordinate-box .hint {
  margin: 0;
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
}

@media (max-width: 560px) {
  .location-button-row {
    grid-template-columns: 1fr;
  }
}


.interaction-hint {
  background: #eef4ff;
  border: 1px solid rgba(29, 100, 242, 0.22);
  border-radius: 13px;
  padding: 11px 12px;
}
.interaction-hint .hint {
  margin: 0;
}


.leaflet-container.ctrl-rotate-active {
  cursor: crosshair !important;
}


/* Usability improvements */
.mode-toolbar {
  margin-top: 18px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.segmented-control {
  display: inline-flex;
  gap: 4px;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.mode-button {
  border-radius: 999px;
  padding: 9px 13px;
  background: transparent;
  color: var(--muted);
}

.mode-button.active {
  background: var(--accent);
  color: #fff;
}

.mode-help {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

body:not(.show-advanced) .advanced-field {
  display: none !important;
}

.map-card {
  position: relative;
}

.map-hint {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 650;
  max-width: min(480px, calc(100% - 24px));
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.86);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

.direction-mode-active {
  cursor: crosshair !important;
}

.assessment-card {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 13px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 15px;
  background: #f8fafc;
}

.assessment-card p {
  margin: 3px 0 0;
  color: var(--muted);
  line-height: 1.4;
  font-size: 13px;
}

.assessment-badge {
  min-width: 86px;
  text-align: center;
  border-radius: 999px;
  padding: 8px 11px;
  font-weight: 900;
  font-size: 13px;
  background: #e2e8f0;
  color: #334155;
}

.assessment-ok {
  background: #ecfdf3;
  border-color: #abefc6;
}
.assessment-ok .assessment-badge {
  background: #057a55;
  color: #fff;
}

.assessment-critical {
  background: #fffaeb;
  border-color: #fedf89;
}
.assessment-critical .assessment-badge {
  background: #dc6803;
  color: #fff;
}

.assessment-exceeded {
  background: #fff1f3;
  border-color: #fecdd6;
}
.assessment-exceeded .assessment-badge {
  background: #b42318;
  color: #fff;
}

.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 18px;
}

.onboarding-overlay.hidden {
  display: none;
}

.onboarding-card {
  max-width: 520px;
  width: min(100%, 520px);
  background: #fff;
  border-radius: 24px;
  padding: 26px;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.32);
}

.onboarding-card h2 {
  margin: 14px 0 10px;
  font-size: 25px;
  letter-spacing: -0.03em;
}

.onboarding-card ol {
  margin: 0 0 20px;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.55;
}

.onboarding-card li {
  margin: 7px 0;
}

@media (max-width: 700px) {
  .mode-toolbar {
    align-items: stretch;
  }
  .segmented-control {
    width: 100%;
  }
  .mode-button {
    flex: 1;
  }
  .map-hint {
    border-radius: 14px;
  }
}


/* Map scale / distance verification */
.leaflet-control-scale {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.18);
}

.leaflet-control-scale-line {
  border: 2px solid #111827;
  border-top: none;
  background: rgba(255,255,255,0.94);
  color: #111827;
  font-weight: 900;
  font-size: 12px;
}

.distance-label {
  background: transparent;
  border: 0;
}

.distance-label span {
  display: inline-block;
  white-space: nowrap;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid rgba(29, 100, 242, 0.9);
  color: #152033;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
}


/* Outdoor heat-pump unit symbol instead of text-only HP marker */
.hp-unit.outdoor-unit {
  left: 18px;
  top: 18px;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(145deg, #f8fafc 0%, #dbeafe 100%);
  border: 3px solid #1d64f2;
  color: transparent;
  display: block;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.outdoor-fan {
  position: absolute;
  left: 7px;
  top: 7px;
  width: 18px;
  height: 18px;
  border: 3px solid #1d64f2;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #1d64f2 0 2px, transparent 3px),
    conic-gradient(from 20deg, transparent 0 18%, rgba(29,100,242,0.9) 18% 30%, transparent 30% 48%, rgba(29,100,242,0.9) 48% 60%, transparent 60% 78%, rgba(29,100,242,0.9) 78% 90%, transparent 90% 100%);
}

.outdoor-grille {
  position: absolute;
  right: 6px;
  top: 7px;
  width: 6px;
  height: 24px;
  background:
    repeating-linear-gradient(
      to bottom,
      #1d64f2 0,
      #1d64f2 2px,
      transparent 2px,
      transparent 5px
    );
  opacity: 0.9;
}

/* Keep map cleaner: dB values are in the legend, not as overlapping labels on the sound field. */
.sound-wave-label.sound-threshold-label {
  display: none;
}


/* Smaller outdoor-unit marker */
.hp-symbol {
  width: 58px;
  height: 58px;
}

.hp-unit.outdoor-unit {
  left: 15px;
  top: 13px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border-width: 2px;
}

.outdoor-fan {
  left: 5px;
  top: 5px;
  width: 14px;
  height: 14px;
  border-width: 2px;
}

.outdoor-grille {
  right: 5px;
  top: 5px;
  width: 5px;
  height: 19px;
}

.hp-arrow {
  left: 43px;
  top: 20px;
  font-size: 19px;
  transform-origin: -14px 9px;
}

.hp-tag {
  bottom: -8px;
  font-size: 9px;
  padding: 2px 6px;
}

.hp-wall-group {
  transform-origin: 29px 29px;
}

/* Top language buttons */
.language-buttons {
  display: inline-flex;
  gap: 5px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.language-button {
  padding: 8px 11px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.language-button.active {
  background: var(--accent);
  color: #fff;
}

/* Current calculation data directly below the dB value */
.current-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 10px;
}

.current-summary span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(219,227,239,0.95);
  color: var(--text);
  font-size: 11px;
  line-height: 1.1;
}

.current-summary strong {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.current-summary em {
  font-style: normal;
  font-weight: 900;
}


/* Clean main UI: these are not user-facing primary inputs anymore.
   Directivity/rotation/step positioning are handled by map interaction and shown as information. */
.technical-field {
  display: none !important;
}

.calculation-info-box {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
  padding: 13px 15px;
}

.calculation-info-box > strong {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
}

#calculationInfoText {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#calculationInfoText span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(219, 227, 239, 0.95);
  padding: 6px 9px;
  font-size: 12.5px;
  color: var(--text);
  font-weight: 700;
}


/* Coordinates now live inside the map window */
.map-coordinate-overlay {
  position: absolute;
  left: 12px;
  bottom: 42px;
  z-index: 650;
  max-width: min(560px, calc(100% - 24px));
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(219, 227, 239, 0.95);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
  color: #152033;
  font-family: Consolas, Monaco, monospace;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.35;
  pointer-events: none;
}

.coordinate-box {
  display: none !important;
}

@media (max-width: 700px) {
  .map-coordinate-overlay {
    bottom: 50px;
    font-size: 10.5px;
    border-radius: 10px;
  }
}


/* Single interaction mode: keep only complexity controls visible */
.mode-toolbar {
  align-items: center;
}



/* Fan/outlet direction fix:
   The acoustic front is the visible outlet direction. The base symbol points east,
   then the whole fan/outlet visual is rotated by --hp-map-rotation. */
.hp-symbol {
  transform: rotate(var(--hp-map-rotation, 0deg));
  transform-origin: 37px 37px;
}

.hp-symbol .hp-tag {
  transform: translateX(-50%) rotate(calc(-1 * var(--hp-map-rotation, 0deg)));
  transform-origin: center center;
}

.hp-wall-group {
  transform: none !important;
}

/* Reposition outdoor unit inside the rotating marker. */
.hp-unit.outdoor-unit {
  left: 16px;
  top: 20px;
  width: 34px;
  height: 34px;
}

/* Fan/outlet side is the right/front side of the base symbol. */
.hp-outlet-direction {
  position: absolute;
  left: 48px;
  top: 29px;
  width: 26px;
  height: 12px;
  z-index: 5;
  background:
    linear-gradient(90deg, rgba(29,100,242,0.95), rgba(29,100,242,0));
  clip-path: polygon(0 20%, 70% 20%, 70% 0, 100% 50%, 70% 100%, 70% 80%, 0 80%);
  filter: drop-shadow(0 2px 5px rgba(255,255,255,0.95));
}

/* The old arrow is no longer used; keep hidden if any old markup remains. */
.hp-arrow {
  display: none !important;
}

/* Because the whole symbol rotates, keep wall labels readable. */
.installation-label span,
.sound-wave-label span,
.distance-label span,
.receiver-symbol {
  transform: none;
}


/* Receiver is never marked invalid in this demo; rear-side sound is handled by directivity. */
.receiver-symbol.receiver-invalid {
  background: #0f172a !important;
  animation: none !important;
}


.iso-diffraction-panel {
  border: 1px solid rgba(29, 100, 242, 0.18);
  background: #f8fbff;
  border-radius: 16px;
  padding: 13px;
}

.iso-check-row {
  margin-bottom: 8px;
}

.compact-field {
  margin: 8px 0;
}

#calculationInfoText span.diffraction-bands {
  border-radius: 12px;
  max-width: 100%;
  white-space: normal;
  line-height: 1.45;
}


.iso-live-output {
  margin-top: 10px;
  padding: 10px 11px;
  border-radius: 13px;
  border: 1px solid rgba(219, 227, 239, 0.95);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.iso-live-output.active {
  color: var(--text);
  border-color: rgba(29, 100, 242, 0.28);
  background: #f8fbff;
}

.iso-band-table {
  margin-top: 8px;
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.iso-band-table th,
.iso-band-table td {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(219, 227, 239, 0.9);
  text-align: left;
}

.iso-band-table .selected-band {
  background: rgba(29, 100, 242, 0.08);
  font-weight: 900;
}


.iso-example-button {
  width: 100%;
  margin: 8px 0 6px;
}

.barrier-map-label {
  background: transparent;
  border: 0;
}

.barrier-map-label span {
  display: inline-block;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid rgba(124, 58, 237, 0.85);
  color: #2e1065;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
}

.iso-diffraction-panel .grid-2 {
  align-items: start;
}

.iso-example-button {
  display: inline-flex;
  width: auto !important;
  min-height: 40px;
  margin: 8px 0 8px !important;
  padding: 9px 13px;
}


/* Layout refinement: bigger map, more compact right-side result text */
.main-panel {
  gap: 12px;
}

.map-card {
  min-height: 620px;
}

#map {
  min-height: 620px;
}

.result-card {
  padding: 14px;
  gap: 10px;
}

.result-big {
  padding: 14px 16px;
}

.result-big strong#resultValue {
  font-size: clamp(34px, 5vw, 54px);
  line-height: 0.95;
}

.result-unit {
  font-size: 17px;
}

.current-summary {
  gap: 6px;
  margin-top: 10px;
}

.current-summary span,
#calculationInfoText span {
  padding: 4px 7px;
  font-size: 11.5px;
}

.assessment-card {
  padding: 10px 12px;
  gap: 10px;
}

.assessment-badge {
  min-width: 74px;
  padding: 6px 9px;
  font-size: 12px;
}

.assessment-card p {
  font-size: 12px;
}

.calculation-info-box {
  padding: 10px 12px;
}

.calculation-info-box > strong {
  margin-bottom: 6px;
  font-size: 13px;
}

.metrics {
  gap: 8px;
}

.metrics div {
  padding: 9px 10px;
}

.metrics span {
  font-size: 11px;
}

.metrics strong {
  font-size: 13px;
}

.formula {
  padding: 10px 12px;
  font-size: 12px;
}

.iso-note {
  margin: 8px 0 0;
  padding: 8px 9px;
  border-radius: 11px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 700;
}

@media (min-width: 1050px) {
  .app-layout {
    grid-template-columns: minmax(310px, 360px) minmax(700px, 1fr);
    gap: 16px;
  }

  .input-panel {
    max-width: 360px;
  }
}

@media (max-width: 1049px) {
  .map-card,
  #map {
    min-height: 520px;
  }
}

.osm-building-panel .check-row span {
  font-weight: 900;
}

.stable-note {
  font-size: 12px;
  color: #475569;
}


/* Directivity is always derived automatically; no visible user checkbox. */
#autoDirectivity,
#autoDirectivity + span {
  display: none !important;
}


/* Minimal Basic mode */
body:not(.show-advanced) .advanced-only {
  display: none !important;
}

.basic-mode-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

body.show-advanced .basic-mode-note::after {
  content: " Advanced mode is active.";
  color: var(--accent);
  font-weight: 900;
}

.basic-core {
  position: relative;
}

body:not(.show-advanced) .input-panel {
  gap: 12px;
}

body:not(.show-advanced) .input-panel .section-title span::after {
  content: "";
  color: var(--accent);
  font-weight: 900;
}

/* Keep Basic compact and clean */
body:not(.show-advanced) .input-panel .hint {
  font-size: 12px;
}

body:not(.show-advanced) .grid-2 {
  grid-template-columns: 1fr;
}

/* Result details may stay compact; acoustic settings move to Advanced. */
body:not(.show-advanced) .formula,
body:not(.show-advanced) .metrics {
  display: none !important;
}


/* Basic must stay minimal: ISO/OSM/test controls are Advanced only. */
body:not(.show-advanced) .iso-diffraction-panel,
body:not(.show-advanced) .osm-building-panel,
body:not(.show-advanced) .iso-example-button,
body:not(.show-advanced) #setExampleBarrier {
  display: none !important;
}


/* Final layout fix: prevent result card from disappearing under the map */
.main-panel {
  display: grid;
  grid-template-rows: minmax(420px, 1fr) auto;
  gap: 14px;
  min-width: 0;
}

.map-card {
  position: relative;
  min-height: 520px;
  overflow: hidden;
}

#map {
  position: relative;
  width: 100%;
  min-height: 520px;
  height: 100%;
  z-index: 1;
}

.result-card {
  position: relative;
  z-index: 2;
  margin-top: 0;
}

/* In Basic: keep result visible and compact below the map */
body:not(.show-advanced) .main-panel {
  grid-template-rows: minmax(520px, 1fr) auto;
}

body:not(.show-advanced) .map-card,
body:not(.show-advanced) #map {
  min-height: 560px;
}

body:not(.show-advanced) .result-card {
  display: block;
  padding: 12px;
}

body:not(.show-advanced) .result-big {
  padding: 12px 14px;
}

body:not(.show-advanced) .result-big strong#resultValue {
  font-size: clamp(34px, 5vw, 54px);
}

body:not(.show-advanced) .assessment-card,
body:not(.show-advanced) .calculation-info-box {
  margin-top: 10px;
}

/* Ensure all Advanced-only controls are hidden in Basic, including ISO/barrier leftovers */
body:not(.show-advanced) .advanced-only,
body:not(.show-advanced) .iso-diffraction-panel,
body:not(.show-advanced) #setExampleBarrier {
  display: none !important;
}

/* But never hide the result box in Basic */
body:not(.show-advanced) .result-card,
body:not(.show-advanced) .result-big,
body:not(.show-advanced) .assessment-card,
body:not(.show-advanced) .calculation-info-box {
  display: block !important;
}

@media (min-width: 1050px) {
  .app-layout {
    align-items: start;
    grid-template-columns: minmax(310px, 360px) minmax(680px, 1fr);
  }
}

@media (max-width: 1049px) {
  .main-panel {
    grid-template-rows: minmax(420px, auto) auto;
  }

  .map-card,
  #map,
  body:not(.show-advanced) .map-card,
  body:not(.show-advanced) #map {
    min-height: 440px;
  }
}


/* Day/night limits are Advanced-only */
body:not(.show-advanced) .limits-grid,
body:not(.show-advanced) #limitDay,
body:not(.show-advanced) #limitNight {
  display: none !important;
}

/* Legal footer */
.legal-footer {
  max-width: 1440px;
  margin: 28px auto 40px;
  padding: 0 24px;
  display: grid;
  gap: 18px;
}

.legal-block {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 22px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

.legal-block h2 {
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.legal-block p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.58;
}

.legal-block p:last-child {
  margin-bottom: 0;
}

.disclaimer-block {
  border-left: 5px solid #64748b;
}

.acknowledgements-block {
  border-left: 5px solid var(--accent);
}

@media print {
  .legal-footer {
    padding: 0;
    margin: 20px 0 0;
  }

  .legal-block {
    box-shadow: none;
    break-inside: avoid;
  }
}


/* Day/Night limit controls and assessments are Advanced-only */
body:not(.show-advanced) .limits-grid,
body:not(.show-advanced) .limit-assessment-card,
body:not(.show-advanced) #assessmentCard,
body:not(.show-advanced) #metricLimits {
  display: none !important;
}

/* Hide the whole metric tile that contains the limit check in Basic */
body:not(.show-advanced) .metrics div:has(#metricLimits) {
  display: none !important;
}

/* Fallback if :has is unavailable: metrics are already hidden in Basic in this layout. */
body:not(.show-advanced) .metrics {
  display: none !important;
}

/* No negative SPL display */
#resultValue::before {
  content: "";
}


/* Final stable basic/advanced visibility */
body:not(.show-advanced) .advanced-only,
body:not(.show-advanced) .limits-grid,
body:not(.show-advanced) .limit-assessment-card,
body:not(.show-advanced) .iso-diffraction-panel,
body:not(.show-advanced) #setExampleBarrier {
  display: none !important;
}

body:not(.show-advanced) .result-card,
body:not(.show-advanced) .result-big,
body:not(.show-advanced) .calculation-info-box {
  display: block !important;
}

/* Stable map/result layout */
.main-panel {
  display: grid;
  grid-template-rows: minmax(500px, auto) auto;
  gap: 14px;
  min-width: 0;
}

.map-card {
  position: relative;
  min-height: 540px;
  overflow: hidden;
}

#map {
  width: 100%;
  min-height: 540px;
  height: 100%;
  z-index: 1;
}

.result-card {
  position: relative;
  z-index: 2;
}

@media (max-width: 1049px) {
  .map-card,
  #map {
    min-height: 440px;
  }
}

/* Wall / installation visualization */
.installation-map-label {
  background: transparent;
  border: 0;
}

.installation-map-label span {
  display: inline-block;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.88);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}


/* Metrics repair: visible in Advanced, hidden only in Basic */
body.show-advanced .metrics {
  display: grid !important;
}

body.show-advanced .metrics div {
  display: block !important;
}

body:not(.show-advanced) .metrics {
  display: none !important;
}


/* Exact receiver point value badge */
.receiver-level-label {
  background: transparent;
  border: 0;
  pointer-events: none;
}

.receiver-level-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 5px 8px;
  border: 2px solid;
  border-radius: 999px;
  color: #0f172a;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.22);
  font-weight: 900;
  white-space: nowrap;
}

.receiver-level-badge strong {
  font-size: 14px;
  line-height: 1;
}

.receiver-level-badge span {
  font-size: 10px;
  line-height: 1;
}


/* Sound display mode selector */
.sound-display-toggle {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 660;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(219, 227, 239, 0.95);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
  color: #152033;
  font-size: 12px;
  font-weight: 900;
}

.sound-display-toggle select {
  height: 30px;
  min-height: 30px;
  border-radius: 999px;
  padding: 3px 26px 3px 10px;
  font-size: 12px;
  font-weight: 800;
}

.sound-threshold-line-shadow {
  filter: blur(0.4px);
}

@media (max-width: 700px) {
  .sound-display-toggle {
    left: 12px;
    right: auto;
    top: 54px;
    border-radius: 14px;
  }
}


/* Language-aware map note and OSM building candidate panel */
.osm-building-panel {
  border: 1px solid rgba(51, 65, 85, 0.18);
  background: #f8fafc;
  border-radius: 16px;
  padding: 13px;
}

.osm-load-button {
  width: 100%;
  margin: 8px 0;
}

.osm-live-output {
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(219, 227, 239, 0.95);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.osm-live-output.active {
  color: #14532d;
  background: #f0fdf4;
  border-color: #bbf7d0;
  font-weight: 800;
}

.osm-live-output.warn {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
  font-weight: 800;
}

.osm-applied-info {
  margin-top: 6px;
  padding: 7px 9px;
  border-radius: 10px;
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  font-size: 12px;
  font-weight: 800;
}

body:not(.show-advanced) .osm-building-panel {
  display: none !important;
}


.osm-live-output {
  line-height: 1.45;
}

.osm-live-output br {
  display: block;
  content: "";
  margin-top: 4px;
}


.osm-live-output.warn {
  white-space: normal;
}

.osm-applied-info {
  white-space: normal;
}


.osm-applied-info {
  line-height: 1.45;
}


.osm-tolerance-field {
  margin-top: 8px;
}

.osm-tolerance-field input {
  max-width: 110px;
}


.osm-nearest-button {
  width: 100%;
  margin: 0 0 8px;
}

.osm-nearest-button {
  background: #eef2ff;
  color: #3730a3;
  border-color: #c7d2fe;
}


.osm-installation-field {
  margin-top: 8px;
}

.osm-installation-field input {
  max-width: 110px;
}

.osm-installation-button {
  width: 100%;
  margin: 0 0 8px;
  background: #ecfdf3;
  color: #14532d;
  border-color: #bbf7d0;
}


/* Installation/positioning is now shown in the overview, not as text on the map. */
.installation-map-label {
  display: none !important;
}

/* Slightly stronger overview pills for positioning info */
#summarySetup,
#calculationInfoText span {
  line-height: 1.25;
}

/* Improved outdoor unit symbol */
.hp-unit.outdoor-unit-v2 {
  position: absolute;
  left: 13px;
  top: 19px;
  width: 39px;
  height: 31px;
  border-radius: 7px;
  background: linear-gradient(145deg, #f8fafc 0%, #dbeafe 100%);
  border: 3px solid #1d64f2;
  box-shadow: 0 9px 20px rgba(15, 23, 42, 0.26);
  overflow: visible;
  display: block;
}

.unit-body {
  position: absolute;
  inset: 0;
  border-radius: 5px;
  overflow: hidden;
}

.unit-body::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 2px;
  height: 4px;
  border-radius: 999px;
  background: rgba(29, 100, 242, 0.20);
}

.unit-fan-ring {
  position: absolute;
  left: 5px;
  top: 5px;
  width: 18px;
  height: 18px;
  border: 3px solid #1d64f2;
  border-radius: 50%;
  background: radial-gradient(circle at center, #1d64f2 0 2px, rgba(255,255,255,0.96) 3px 100%);
}

.unit-fan-blades {
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background:
    conic-gradient(from 25deg,
      transparent 0 14%,
      rgba(29,100,242,0.95) 14% 28%,
      transparent 28% 47%,
      rgba(29,100,242,0.95) 47% 61%,
      transparent 61% 80%,
      rgba(29,100,242,0.95) 80% 94%,
      transparent 94% 100%);
  opacity: 0.95;
}

.unit-grille-lines {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 8px;
  height: 19px;
  background:
    repeating-linear-gradient(
      to bottom,
      #1d64f2 0,
      #1d64f2 2px,
      transparent 2px,
      transparent 5px
    );
  opacity: 0.95;
}

.hp-airflow-plume {
  position: absolute;
  left: 51px;
  top: 22px;
  width: 31px;
  height: 23px;
  z-index: 6;
  pointer-events: none;
}

.hp-airflow-plume span {
  position: absolute;
  left: 0;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(29,100,242,0.95), rgba(29,100,242,0));
  filter: drop-shadow(0 1px 2px rgba(255,255,255,0.95));
}

.hp-airflow-plume span:nth-child(1) {
  top: 3px;
  width: 27px;
}

.hp-airflow-plume span:nth-child(2) {
  top: 10px;
  width: 32px;
}

.hp-airflow-plume span:nth-child(3) {
  top: 17px;
  width: 23px;
}

/* Hide any old ambiguous fan/grille/outlet graphics */
.hp-unit.outdoor-unit,
.outdoor-fan,
.outdoor-grille,
.hp-outlet-direction {
  display: none !important;
}


/* Rotation repair: larger unclipped icon box and clear outlet direction */
.hp-div-icon {
  overflow: visible !important;
}

.hp-symbol {
  width: 86px !important;
  height: 86px !important;
  transform: rotate(var(--hp-map-rotation, 0deg)) !important;
  transform-origin: 43px 43px !important;
  overflow: visible !important;
}

.hp-symbol .hp-tag,
.hp-wall-group {
  display: none !important;
}

.hp-unit.outdoor-unit-v2 {
  left: 21px !important;
  top: 28px !important;
  width: 39px !important;
  height: 31px !important;
  transform: none !important;
}

.hp-airflow-plume {
  left: 59px !important;
  top: 30px !important;
}

.ctrl-rotate-active,
.ctrl-rotate-active * {
  cursor: crosshair !important;
}

/* Keep positioning text out of the map; it is shown in the overview. */
.installation-map-label {
  display: none !important;
}


/* Repair: visible unit suffix in distance field */
.unit-input {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.unit-input input {
  flex: 1 1 auto;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.unit-suffix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 0 12px;
  border: 1px solid var(--line, #dbe3ef);
  border-left: 0;
  border-radius: 0 12px 12px 0;
  background: #f8fafc;
  color: #475569;
  font-weight: 900;
}

/* Repair: keep heat pump marker artwork visible and non-interfering */
.hp-div-icon,
.hp-div-icon * {
  overflow: visible !important;
}

.hp-symbol,
.hp-symbol *,
.receiver-symbol,
.receiver-symbol * {
  pointer-events: none;
}

.leaflet-marker-icon {
  cursor: grab;
}

.leaflet-marker-dragging {
  cursor: grabbing;
}


/* Model split note: receiver result vs qualitative map contours */
.map-model-note {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 665;
  max-width: min(560px, calc(100% - 24px));
  padding: 8px 11px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(219, 227, 239, 0.95);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
  color: #334155;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.35;
}

@media (max-width: 700px) {
  .map-model-note {
    bottom: 8px;
    font-size: 10.5px;
  }
}


/* Receiver-path-only ISO barrier indication */
.iso-barrier-map-label {
  background: transparent;
  border: 0;
  pointer-events: none;
}

.iso-barrier-map-label span {
  display: inline-block;
  white-space: nowrap;
  padding: 5px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.97);
  border: 2px solid rgba(124, 58, 237, 0.85);
  color: #2e1065;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
}

.iso-barrier-map-label em {
  font-style: normal;
  color: #64748b;
  font-weight: 800;
}


/* Deep-review fixes */
.unit-input {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.unit-input input {
  flex: 1 1 auto;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.unit-suffix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 0 12px;
  border: 1px solid var(--line, #dbe3ef);
  border-left: 0;
  border-radius: 0 12px 12px 0;
  background: #f8fafc;
  color: #475569;
  font-weight: 900;
}

.map-model-note {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 665;
  max-width: min(580px, calc(100% - 24px));
  padding: 8px 11px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(219, 227, 239, 0.95);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
  color: #334155;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.35;
}

.hp-symbol,
.hp-symbol *,
.receiver-symbol,
.receiver-symbol * {
  pointer-events: none;
}

.hp-div-icon {
  overflow: visible !important;
}


/* Surrounding detection Beta mode */
.beta-mode-button span {
  margin-left: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.12);
  color: #6d28d9;
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.mode-button.active.beta-mode-button {
  background: #6d28d9;
  color: #fff;
}

.mode-button.active.beta-mode-button span {
  background: rgba(255, 255, 255, 0.20);
  color: #fff;
}

body.show-surroundings .advanced-only {
  display: none !important;
}

body.show-surroundings .surroundings-detection-panel,
body.show-surroundings .osm-building-panel {
  display: grid !important;
}

body.show-surroundings .basic-core {
  display: grid !important;
}

body.show-surroundings .input-panel .section-title span::after {
  content: "";
  color: #6d28d9;
  font-weight: 950;
}

.surroundings-beta-intro {
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(124, 58, 237, 0.24);
  background: rgba(124, 58, 237, 0.07);
  color: #3b0764;
}

.osm-apply-installation-button {
  width: 100%;
  margin: 6px 0;
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}


/* Three-mode navigation */
.mode-toolbar {
  gap: 10px;
}

.segmented-control {
  flex-wrap: wrap;
}

.mode-button {
  white-space: nowrap;
}

.basic-mode-note {
  flex-basis: 100%;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

body.show-surroundings .basic-mode-note::after {
  content: " OSM surroundings is experimental and should be reviewed manually.";
  color: #6d28d9;
  font-weight: 900;
}

body.show-advanced .basic-mode-note::after {
  content: " Advanced settings are active.";
  color: var(--accent);
  font-weight: 900;
}


/* Strict mode visibility: no repeated inputs */
body:not(.show-advanced):not(.show-surroundings) .advanced-only,
body:not(.show-advanced):not(.show-surroundings) .surroundings-only,
body:not(.show-advanced):not(.show-surroundings) .metrics,
body:not(.show-advanced):not(.show-surroundings) .limit-assessment-card {
  display: none !important;
}

/* Advanced settings: show acoustic advanced fields, hide OSM beta panel */
body.show-advanced .advanced-only {
  display: grid;
}

body.show-advanced .surroundings-only,
body.show-advanced .surroundings-detection-panel,
body.show-advanced .osm-building-panel {
  display: none !important;
}

/* OSM surroundings Beta: show only shared basic inputs + OSM panel */
body.show-surroundings .advanced-only {
  display: none !important;
}

body.show-surroundings .basic-core {
  display: grid !important;
}

body.show-surroundings .surroundings-only,
body.show-surroundings .surroundings-detection-panel,
body.show-surroundings .osm-building-panel {
  display: grid !important;
}

/* Avoid duplicated “advanced field” legacy class in OSM mode */
body.show-surroundings .advanced-field:not(.surroundings-only):not(.surroundings-detection-panel):not(.osm-building-panel) {
  display: none !important;
}

/* Result/map stays visible in all modes */
.result-card,
.result-big,
.map-card,
#map,
.summary-strip {
  display: block;
}

body.show-advanced .metrics {
  display: grid !important;
}

body.show-surroundings .metrics,
body.show-surroundings .limit-assessment-card {
  display: none !important;
}


/* Strict separated menu concept:
   Quick assessment = base inputs only.
   Advanced settings = acoustic assumptions only.
   OSM surroundings Beta = OSM detection only.
   Values from Quick assessment remain stored and are reused by the other modes. */

/* Quick assessment */
body:not(.show-advanced):not(.show-surroundings) .advanced-only,
body:not(.show-advanced):not(.show-surroundings) .surroundings-only,
body:not(.show-advanced):not(.show-surroundings) .advanced-field {
  display: none !important;
}

/* Advanced settings: hide base inputs and OSM, show acoustic advanced fields */
body.show-advanced .basic-core,
body.show-advanced .surroundings-only,
body.show-advanced .surroundings-detection-panel,
body.show-advanced .osm-building-panel {
  display: none !important;
}

body.show-advanced .advanced-only:not(.surroundings-only):not(.surroundings-detection-panel):not(.osm-building-panel) {
  display: grid !important;
}

/* OSM surroundings Beta: hide base inputs and normal advanced fields, show only OSM workflow */
body.show-surroundings .basic-core,
body.show-surroundings .advanced-only:not(.surroundings-only):not(.surroundings-detection-panel):not(.osm-building-panel),
body.show-surroundings .advanced-field:not(.surroundings-only):not(.surroundings-detection-panel):not(.osm-building-panel),
body.show-surroundings .metrics,
body.show-surroundings .limit-assessment-card {
  display: none !important;
}

body.show-surroundings .surroundings-only,
body.show-surroundings .surroundings-detection-panel,
body.show-surroundings .osm-building-panel {
  display: grid !important;
}

/* Keep map/results visible in all modes */
.map-card,
#map,
.result-card,
.result-big,
.summary-strip,
.method-card {
  display: block;
}

/* Explain the separated workflow */
body.show-advanced .basic-mode-note::after {
  content: " Use Quick assessment to change base inputs.";
  color: var(--accent);
  font-weight: 900;
}

body.show-surroundings .basic-mode-note::after {
  content: " Use Quick assessment to change location, model, LwA or distance.";
  color: #6d28d9;
  font-weight: 900;
}


.mode-panel-hint {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--line, #dbe3ef);
  color: #475569;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

body.show-advanced .mode-panel-hint#advancedModePanelHint {
  display: block !important;
}

body.show-surroundings .mode-panel-hint#surroundingsModePanelHint {
  display: block !important;
}


/* Explicit mode hints */
body:not(.show-advanced) #advancedModePanelHint {
  display: none !important;
}

body.show-advanced #advancedModePanelHint {
  display: block !important;
}

body:not(.show-surroundings) #surroundingsModePanelHint {
  display: none !important;
}

body.show-surroundings #surroundingsModePanelHint {
  display: block !important;
}


/* Installation correction visualization: wall/corner/niche */
.installation-map-label {
  display: block !important;
  background: transparent;
  border: 0;
  pointer-events: none;
}

.installation-map-label span {
  display: inline-block;
  white-space: nowrap;
  padding: 5px 8px;
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.88);
  color: #fff;
  font-size: 11px;
  line-height: 1.18;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}

.installation-map-label em {
  font-style: normal;
  color: #cbd5e1;
  font-weight: 800;
}


/* Manual/ISO receiver-path barrier line labels */
.manual-barrier-map-label,
.iso-barrier-map-label {
  background: transparent;
  border: 0;
  pointer-events: none;
}

.manual-barrier-map-label span,
.iso-barrier-map-label span {
  display: inline-block;
  white-space: nowrap;
  padding: 5px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.97);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
}

.manual-barrier-map-label span {
  border: 2px solid rgba(15, 118, 110, 0.85);
  color: #064e3b;
}

.iso-barrier-map-label span {
  border: 2px solid rgba(124, 58, 237, 0.85);
  color: #2e1065;
}

.manual-barrier-map-label em,
.iso-barrier-map-label em {
  font-style: normal;
  color: #64748b;
  font-weight: 800;
}


/* OSM barrier/boundary line overlay:
   green dashed = barrier/wall/fence/hedge, violet dashed = OSM boundary line */
.osm-line-legend {
  font-size: 12px;
  color: #475569;
}


/* Manual/ISO receiver-path barrier line labels */
.manual-barrier-map-label,
.iso-barrier-map-label {
  background: transparent;
  border: 0;
  pointer-events: none;
}

.manual-barrier-map-label span,
.iso-barrier-map-label span {
  display: inline-block;
  white-space: nowrap;
  padding: 5px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.97);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
}

.manual-barrier-map-label span {
  border: 2px solid rgba(15, 118, 110, 0.85);
  color: #064e3b;
}

.iso-barrier-map-label span {
  border: 2px solid rgba(124, 58, 237, 0.85);
  color: #2e1065;
}

.manual-barrier-map-label em,
.iso-barrier-map-label em {
  font-style: normal;
  color: #64748b;
  font-weight: 800;
}


/* Rotation reliability fix: the outdoor-unit symbol rotates with the acoustic front direction. */
.hp-div-icon {
  overflow: visible !important;
}

.hp-symbol {
  width: 86px !important;
  height: 86px !important;
  transform: rotate(var(--hp-map-rotation, 0deg)) !important;
  transform-origin: 43px 43px !important;
  overflow: visible !important;
}

.hp-unit.outdoor-unit-v2 {
  display: block !important;
  visibility: visible !important;
}

.hp-airflow-plume {
  display: block !important;
  visibility: visible !important;
  pointer-events: none !important;
}

.hp-airflow-plume span {
  display: block !important;
}


/* OSM beta map status panel */
.osm-map-detection-panel {
  position: absolute;
  left: 12px;
  top: 58px;
  z-index: 670;
  width: min(380px, calc(100% - 24px));
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(219, 227, 239, 0.95);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
  color: #152033;
}

.osm-map-detection-title {
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  color: #6d28d9;
  margin-bottom: 5px;
}

.osm-map-detection-line {
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
  color: #0f172a;
  margin-top: 2px;
}

.osm-map-detection-hint {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.35;
  color: #64748b;
  font-weight: 750;
}


/* OSM map influence settings */
.osm-map-influence-toggle {
  margin-top: 10px;
  padding: 8px 9px;
  border-radius: 12px;
  background: rgba(14, 116, 144, 0.07);
  border: 1px solid rgba(14, 116, 144, 0.22);
}

.osm-map-influence-toggle span {
  font-weight: 900;
  color: #155e75;
}

.osm-map-influence-settings {
  margin-top: 4px;
}


.osm-curvature-hint {
  padding: 8px 9px;
  border-radius: 12px;
  background: rgba(14, 116, 144, 0.06);
  border: 1px solid rgba(14, 116, 144, 0.18);
  color: #155e75;
}


.barrier-inline-tag {
  background: transparent;
  border: 0;
  pointer-events: none;
}

.barrier-inline-tag span {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.98);
  border: 2px solid rgba(51, 65, 85, 0.18);
  color: #0f172a;
  font-size: 10px;
  line-height: 1.1;
  font-weight: 900;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.15);
}

/* Automatic directivity display */
.directivity-auto-field {
  border: 1px solid rgba(29, 100, 242, 0.18);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(29, 100, 242, 0.045);
}

.auto-directivity-box {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #0f172a;
  font-weight: 850;
  line-height: 1.35;
}

.auto-directivity-box strong {
  color: #1d4ed8;
  font-size: 15px;
}

.auto-directivity-box span {
  color: #475569;
  font-size: 12px;
  font-weight: 750;
}


/* Map layer selector */
.map-layer-toggle {
  position: absolute;
  right: 12px;
  top: 52px;
  z-index: 661;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(219, 227, 239, 0.95);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
  color: #152033;
  font-size: 12px;
  font-weight: 900;
}

.map-layer-toggle select {
  height: 30px;
  min-height: 30px;
  border-radius: 999px;
  padding: 3px 26px 3px 10px;
  font-size: 12px;
  font-weight: 800;
}

/* Manual acoustic settings must be available in Advanced settings. */
body.show-advanced .manual-positioning-field,
body.show-advanced .manual-barrier-field,
body.show-advanced .acoustic-setting {
  display: grid !important;
}

body.show-surroundings .manual-positioning-field,
body.show-surroundings .manual-barrier-field,
body.show-surroundings .acoustic-setting {
  display: none !important;
}

@media (max-width: 700px) {
  .map-layer-toggle {
    top: 52px;
    left: 12px;
    right: auto;
  }
}


/* Diffraction element placement */
.manual-iso-wall-toggle {
  margin-top: 10px;
  padding: 8px 9px;
  border-radius: 12px;
  background: rgba(124, 58, 237, 0.07);
  border: 1px solid rgba(124, 58, 237, 0.22);
}

.manual-iso-wall-toggle span {
  font-weight: 900;
  color: #3b0764;
}

.diffraction-element-settings {
  margin-top: 4px;
}

.iso-wall-reset-button {
  width: 100%;
  margin: 6px 0 10px;
  background: #f5f3ff;
  color: #5b21b6;
  border-color: #ddd6fe;
}

.iso-wall-handle-icon {
  background: transparent;
  border: 0;
}

.iso-wall-handle-icon span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 3px solid #7c3aed;
  background: #fff;
  color: #4c1d95;
  font-size: 12px;
  font-weight: 950;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.22);
}


/* Diffraction element and frequency output */
.diffraction-element-settings {
  margin-top: 4px;
}

.iso-frequency-details {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(124, 58, 237, 0.06);
  border: 1px solid rgba(124, 58, 237, 0.16);
}

.iso-frequency-details summary {
  cursor: pointer;
  font-weight: 900;
  color: #4c1d95;
}

.iso-band-summary {
  margin: 6px 0;
  font-size: 12px;
  line-height: 1.45;
  color: #334155;
}


/* Clean map viewport: all custom information boxes are outside #map */
.map-card {
  display: grid !important;
  grid-template-rows: auto minmax(560px, 1fr) !important;
  gap: 10px !important;
  overflow: visible !important;
}

.map-top-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid rgba(219, 227, 239, 0.95);
  background: rgba(248, 250, 252, 0.96);
}

.map-control-row,
.map-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}

.map-status-row--notes {
  align-items: stretch;
}

.map-top-panel .map-layer-toggle,
.map-top-panel .sound-display-toggle,
.map-top-panel .map-coordinate-overlay,
.map-top-panel .map-hint,
.map-top-panel .map-model-note,
.map-top-panel .osm-map-detection-panel,
.map-top-panel .sound-wave-legend {
  position: static !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  z-index: auto !important;
  width: auto !important;
  max-width: none !important;
  transform: none !important;
  pointer-events: auto !important;
  box-shadow: none !important;
}

.map-top-panel .map-layer-toggle,
.map-top-panel .sound-display-toggle {
  display: inline-flex !important;
  flex: 0 1 auto;
  min-width: 245px;
  border-radius: 14px;
}

.map-top-panel .map-hint,
.map-top-panel .map-coordinate-overlay {
  flex: 1 1 280px;
  border-radius: 14px;
}

.map-top-panel .map-coordinate-overlay {
  font-family: Consolas, Monaco, monospace;
}

.map-top-panel .map-model-note,
.map-top-panel .osm-map-detection-panel,
.map-top-panel .sound-wave-legend {
  flex: 1 1 300px;
  border-radius: 14px;
  padding: 9px 11px;
  border: 1px solid rgba(219, 227, 239, 0.95);
  background: #ffffff;
}

.map-top-panel .map-hint {
  background: #0f172a;
  color: #ffffff;
}

#map {
  min-height: 620px !important;
  height: 100% !important;
}

/* Calculation summary visible in all modes */
.metrics-title {
  grid-column: 1 / -1;
  display: block !important;
  margin: 8px 0 4px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metrics {
  display: grid !important;
  align-content: center;
  gap: 6px;
}

.metrics div {
  display: flex !important;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  border-bottom: 1px solid var(--line, #dbe3ef);
  padding: 8px 0;
  font-size: 14px;
}

.metrics span {
  color: #475569;
  font-weight: 750;
}

.metrics strong {
  white-space: nowrap;
  color: #0f172a;
  font-weight: 950;
}

body:not(.show-advanced) .metrics,
body.show-surroundings .metrics,
body:not(.show-advanced) .metrics-title,
body.show-surroundings .metrics-title {
  display: grid !important;
}

body:not(.show-advanced) .metrics div,
body.show-surroundings .metrics div {
  display: flex !important;
}

body:not(.show-advanced) .metrics div:has(#metricLimits),
body.show-surroundings .metrics div:has(#metricLimits) {
  display: flex !important;
}

body:not(.show-advanced) #metricLimits,
body.show-surroundings #metricLimits {
  display: inline !important;
}


/* Diffraction element label placement: offset from element so it does not overlap the line/handles. */
.iso-barrier-map-label span,
.manual-barrier-map-label span {
  max-width: 270px;
  white-space: normal;
  text-align: center;
}

.barrier-inline-tag span {
  white-space: nowrap;
  opacity: 0.96;
}


/* Sound-field legend restored inside the map viewport */
.leaflet-control-container .sound-wave-legend {
  display: block !important;
}

.leaflet-control .sound-wave-legend,
.sound-wave-legend {
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(219, 227, 239, 0.95);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
  color: var(--text, #0f172a);
  font-size: 12px;
  line-height: 1.35;
  max-width: 260px;
}

.sound-wave-legend strong {
  display: block;
  margin-bottom: 2px;
}

.sound-wave-legend > span {
  display: block;
  color: var(--muted, #64748b);
  margin-bottom: 5px;
}

.sound-field-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
  font-weight: 800;
}

.sound-field-swatch {
  width: 16px;
  height: 10px;
  border: 2px solid;
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 auto;
}

/* Do not show an external duplicate legend if old markup remains outside Leaflet. */
.map-top-panel .sound-wave-legend {
  display: none !important;
}
