@font-face {
  font-family: "Hybler Font";
  src: url("./font/HyblerFont.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #eef4fb;
  --panel: #ffffff;
  --panel-soft: #f7fbff;
  --ink: #102a43;
  --muted: #486581;
  --accent: #0f4c81;
  --accent-2: #1f9d8f;
  --danger: #b42318;
  --line: #d6e2ef;
  --shadow: 0 16px 36px rgba(15, 76, 129, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(96, 168, 216, 0.22), transparent 30%),
    linear-gradient(180deg, #f7fbff 0%, var(--bg) 100%);
}

.shell-header {
  padding: 14px 24px 0 24px;
}

.shell-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border: 1px solid rgba(198, 216, 238, 0.95);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.shell-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.shell-logo {
  display: block;
  width: 140px;
  max-width: 100%;
  height: auto;
}

.shell-brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  justify-content: center;
}

.shell-brand h1 {
  margin: 0;
  font-family: "Hybler Font", "Segoe UI", "Trebuchet MS", sans-serif;
  font-size: 34px;
  line-height: 0.92;
  color: #58348b;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: #5d88b4;
}

.hint {
  color: var(--muted);
}

.module-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.session-tabs {
  margin: 0 0 12px 0;
}

.module-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid #c2d8ef;
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

.module-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.module-tab.link {
  cursor: pointer;
}

.layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(340px, 430px) 1fr;
  gap: 18px;
  min-height: 0;
  padding: 18px 24px 24px 24px;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow-y: auto;
}

.panel-section {
  padding: 14px;
  border-radius: 16px;
  background: var(--panel-soft);
  border: 1px solid #d9e8f7;
}

.panel-section h2,
.observer h2,
.list-wrap h3 {
  margin: 0 0 6px 0;
}

.session-card {
  background: linear-gradient(180deg, #f9fcff 0%, #eef6ff 100%);
}

.session-card .module-tab {
  flex: 1 1 78px;
  min-height: 40px;
  padding: 8px 12px;
}

.module-tab:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  background: #eef4fb;
  border-color: #d3dfeb;
  color: #7b93ab;
}

.admin-access {
  margin-top: 10px;
}

.admin-access-header {
  flex: 0 0 auto;
  min-width: 320px;
  max-width: 420px;
  margin-top: 0;
}

.admin-login-row {
  align-items: center;
  margin: 0;
}

.admin-login-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.admin-login-row button {
  width: auto;
  min-width: 110px;
  flex: 0 0 auto;
}

.admin-session-row {
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin: 0;
}

.admin-session-row button {
  width: auto;
  flex: 0 0 auto;
}

.admin-session-row .is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #dcecff;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.session-help {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.field-caption {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.row {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}

.row-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 2px 0;
  color: var(--muted);
  font-size: 13px;
}

.row-inline input[type="checkbox"] {
  width: auto;
  margin: 0;
}

input,
select,
button {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #bcccdc;
  border-radius: 10px;
  font-size: 14px;
}

button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  cursor: pointer;
}

button:hover,
.button-link:hover {
  filter: brightness(1.05);
}

button.secondary {
  background: #eef5ff;
  border-color: #c3d8ee;
  color: var(--accent);
}

button.danger {
  background: #fff2f0;
  border-color: #f5b5ae;
  color: var(--danger);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.stats {
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
  flex-wrap: wrap;
}

.module-panel[data-module-panel="analysis"] {
  display: none;
}

.module-panel[data-module-panel="visualization"] {
  display: none;
}

.module-panel[data-module-panel="editor"] {
  display: none;
}

body[data-module="noise"] .module-panel[data-module-panel="analysis"],
body[data-module="shadow"] .module-panel[data-module-panel="analysis"] {
  display: block;
}

body[data-module="noise"] .module-panel[data-module-panel="visualization"],
body[data-module="shadow"] .module-panel[data-module-panel="visualization"] {
  display: none;
}

body[data-module="visualization"] .module-panel[data-module-panel="visualization"] {
  display: block;
}

body[data-module="editor"] .module-panel[data-module-panel="editor"] {
  display: block;
}

body[data-module="noise"] .viewer,
body[data-module="shadow"] .viewer {
  grid-template-rows: 1fr;
}

body[data-module="noise"] #streetView,
body[data-module="noise"] #mapyczPanorama,
body[data-module="noise"] #mapbox3d,
body[data-module="shadow"] #streetView,
body[data-module="shadow"] #mapyczPanorama,
body[data-module="shadow"] #mapbox3d {
  display: none;
}

body[data-module="editor"] .viewer {
  display: block;
  background:
    radial-gradient(circle at top left, rgba(96, 168, 216, 0.16), transparent 24%),
    linear-gradient(180deg, #f9fcff 0%, #eef6ff 100%);
}

body[data-module="editor"] #map,
body[data-module="editor"] #streetView,
body[data-module="editor"] #mapyczPanorama,
body[data-module="editor"] #mapbox3d {
  display: none;
}

body[data-module="editor"] #adminEditorView {
  display: block;
}

.observer {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  background: #eef5ff;
  border: 1px solid #d6e6fb;
}

.analysis-meta {
  margin: 10px 0 0 0;
  color: var(--muted);
}

.analysis-limit {
  --analysis-limit-gradient: linear-gradient(90deg, #30123b, #4361ee, #37b24d, #ffd43b, #d9480f);
  --analysis-limit-progress: 0%;
  margin-top: 10px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #d7e4f4;
}

.analysis-limit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}

.analysis-limit-head strong {
  color: var(--ink);
  font-size: 15px;
}

.analysis-limit-slider {
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--accent);
}

.analysis-limit-scale {
  position: relative;
  height: 14px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--analysis-limit-gradient);
  border: 1px solid rgba(16, 42, 67, 0.14);
  box-shadow: inset 0 1px 2px rgba(16, 42, 67, 0.08);
}

.analysis-limit-marker {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: var(--analysis-limit-progress);
  width: 2px;
  border-radius: 999px;
  background: rgba(16, 42, 67, 0.96);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.88),
    0 3px 12px rgba(16, 42, 67, 0.18);
  transform: translateX(-50%);
}

.analysis-limit-scale-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.analysis-limit-help {
  margin: 8px 0 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.editor-help {
  margin: 0 0 10px 0;
  color: var(--muted);
  line-height: 1.5;
}

.analysis-legend {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.analysis-legend-item {
  padding: 10px;
  border: 1px solid #c8dcf7;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
}

.analysis-legend-item strong {
  display: block;
  margin-bottom: 6px;
}

.analysis-legend-item span,
.analysis-legend-item small {
  display: block;
  color: var(--muted);
}

.analysis-inspector-popup .leaflet-popup-content-wrapper {
  border-radius: 12px;
  border: 1px solid #d7c0ef;
  box-shadow: 0 14px 34px rgba(50, 19, 91, 0.18);
}

.analysis-inspector-popup .leaflet-popup-content {
  margin: 10px 12px;
  color: var(--ink);
  line-height: 1.45;
}

.analysis-inspector-popup .leaflet-popup-content small {
  color: var(--muted);
}

.analysis-scale-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  margin-bottom: 6px;
  border: 1px solid rgba(16, 42, 67, 0.12);
}

.map-layer-control {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 148px;
  max-width: 148px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(198, 216, 238, 0.95);
  box-shadow: 0 14px 32px rgba(16, 42, 67, 0.14);
}

.map-layer-button {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid #c7dbee;
  background: #f7fbff;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  cursor: pointer;
}

.map-layer-button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.12);
}

.map-layer-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.map-tools-corner {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  padding: 10px 10px 0 0;
}

.map-tools-corner .leaflet-control {
  margin: 0;
}

.map-tools-control {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(198, 216, 238, 0.95);
  box-shadow: 0 14px 32px rgba(16, 42, 67, 0.14);
}

.map-tools-icon-button {
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-end;
  border-radius: 12px;
  border: 1px solid #c7dbee;
  background: #eef5ff;
  color: var(--accent);
  cursor: pointer;
}

.map-tools-icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-tools-icon-button.is-active {
  background: #d9480f;
  border-color: #d9480f;
  color: #fff;
}

.map-tools-icon-button.secondary {
  background: #fff;
  color: #b42318;
  border-color: #f1c5bf;
}

.map-tools-icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.map-tools-button {
  width: 100%;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #c7dbee;
  background: #eef5ff;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.map-tools-button.secondary {
  background: #fff;
}

.map-tools-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.leaflet-container.measure-mode {
  cursor: crosshair;
}

.measure-label-marker {
  background: transparent;
  border: 0;
}

.measure-label-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(16, 42, 67, 0.92);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 10px 22px rgba(16, 42, 67, 0.18);
}

.picker-map {
  width: 100%;
  height: 240px;
  border-radius: 10px;
  border: 1px solid #c8dcf7;
  overflow: hidden;
}

.admin-editor-view {
  display: none;
  width: 100%;
  height: 100%;
  overflow: auto;
}

.admin-editor-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100%;
  padding: 22px;
}

.admin-editor-toolbar,
.editor-section-head,
.toolbar-actions,
.form-grid,
.inline-row {
  display: flex;
  gap: 10px;
}

.admin-editor-toolbar,
.editor-section-head {
  justify-content: space-between;
  align-items: flex-start;
}

.editor-actions {
  display: grid;
  gap: 10px;
}

.toolbar-actions {
  flex-wrap: wrap;
}

.toolbar-actions button,
.inline-row button {
  width: auto;
  flex: 0 0 auto;
}

.inline-row > input,
.inline-row > textarea,
.inline-row > select {
  flex: 1 1 auto;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(540px, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.editor-card {
  min-width: 0;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #d9e8f7;
  box-shadow: var(--shadow);
}

.editor-card h3,
.admin-editor-toolbar h2 {
  margin: 0;
}

.form-grid {
  margin-bottom: 18px;
}

.form-grid label {
  flex: 1;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.turbine-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 940px;
}

.turbine-table th,
.turbine-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #e4eef7;
  vertical-align: top;
}

.turbine-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5faff;
  text-align: left;
  font-size: 13px;
}

.turbine-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

.row-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e2efff;
  color: var(--accent);
  font-weight: 700;
}

.icon-btn {
  min-width: 40px;
  padding: 8px 10px;
}

.json-editor {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 560px;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
  background: #08131f;
  color: #d9ecff;
  border-color: #1f3650;
  resize: vertical;
}

.hidden {
  display: none;
}

#vizDownload {
  margin-top: 0;
  color: #fff;
  font-weight: 600;
}

#vizDownload.hidden {
  display: none;
}

.viz-actions {
  align-items: stretch;
}

.viz-actions button,
.viz-actions .button-link {
  flex: 1 1 0;
}

.viz-preview {
  display: block;
  width: 100%;
  margin-top: 10px;
  border-radius: 8px;
  border: 1px solid #c8dcf7;
  cursor: zoom-in;
}

body.modal-open {
  overflow: hidden;
}

.viz-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(9, 30, 51, 0.82);
}

.viz-lightbox.hidden {
  display: none;
}

.viz-lightbox-panel {
  width: min(94vw, 1400px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  background: #f8fbff;
  border: 1px solid rgba(198, 220, 247, 0.9);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.28);
}

.viz-lightbox-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.viz-lightbox-toolbar .button-link,
.viz-lightbox-toolbar button {
  flex: 0 0 auto;
  width: auto;
  min-width: 180px;
}

.viz-lightbox-image {
  display: block;
  width: 100%;
  max-height: calc(92vh - 96px);
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid #c8dcf7;
  background: #dbe8f5;
}

.list-wrap {
  margin-top: 16px;
}

#turbineList {
  margin: 0;
  padding-left: 16px;
  font-size: 14px;
}

.status {
  min-height: 20px;
  color: var(--accent);
  font-size: 14px;
}

.status.error {
  color: var(--danger);
}

.viewer {
  display: grid;
  grid-template-rows: 45% 55%;
  min-height: 0;
  height: 100%;
  background: #dfeaf5;
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

#map,
#streetView,
#mapyczPanorama,
#mapbox3d {
  width: 100%;
  height: 100%;
}

#map {
  grid-row: 1;
}

#streetView,
#mapyczPanorama,
#mapbox3d {
  grid-row: 2;
}

@media (max-width: 1100px) {
  .shell-header,
  .layout {
    padding-left: 16px;
    padding-right: 16px;
  }

  .shell-header-bar {
    flex-wrap: wrap;
  }

  .admin-access-header {
    width: 100%;
    max-width: none;
    min-width: 0;
  }
}

@media (max-width: 980px) {
  .shell-header,
  .layout {
    grid-template-columns: 1fr;
    display: block;
  }

  .shell-header {
    padding-top: 16px;
  }

  .layout {
    height: auto;
    min-height: 0;
    padding-top: 16px;
  }

  .shell-header-bar {
    align-items: stretch;
  }

  .shell-brand {
    align-items: flex-start;
  }

  .shell-logo {
    width: 120px;
  }

  .module-tabs,
  .row,
  .stats {
    flex-direction: column;
  }

  .admin-login-row,
  .admin-session-row {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-login-row button,
  .admin-session-row button,
  .admin-session-row .admin-badge,
  .toolbar-actions button,
  .inline-row button {
    width: 100%;
  }

  .admin-editor-toolbar,
  .editor-section-head,
  .toolbar-actions,
  .form-grid,
  .inline-row {
    flex-direction: column;
  }

  .editor-grid {
    grid-template-columns: 1fr;
  }

  .viz-lightbox {
    padding: 12px;
  }

  .viz-lightbox-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .viz-lightbox-toolbar .button-link,
  .viz-lightbox-toolbar button {
    width: 100%;
    min-width: 0;
  }

  .viewer {
    margin-top: 16px;
    min-height: 72vh;
    grid-template-rows: 42vh 42vh;
  }
}
