:root {
  color-scheme: light;
  --bg: #eef2f3;
  --panel: #ffffff;
  --ink: #172126;
  --muted: #59676d;
  --line: #cdd8dc;
  --accent: #006f8f;
  --accent-strong: #004f66;
  --warn: #b33f1d;
  --shadow: 0 16px 38px rgba(21, 35, 42, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  overflow-anchor: none;
}

button,
select,
input {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  background: #18252b;
  color: #fff;
  border-bottom: 3px solid #d4a017;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid #fff;
  background: #d4a017;
  color: #18252b;
  font-weight: 800;
  font-size: 23px;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.05;
}

.brand p {
  margin: 4px 0 0;
  color: #cbd7db;
  font-size: 13px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.nav a {
  color: #f5f7f8;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.24);
  padding: 6px 8px;
  border-radius: 3px;
  font-size: 12px;
}

.layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  align-items: start;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-panel,
.product-list,
.sounding-panel,
.readout-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.control-panel,
.product-list {
  padding: 8px;
}

.control-panel h2,
.product-list h2 {
  margin: 10px 0 6px;
  font-size: 13px;
}

.control-panel h2:first-child,
.product-list h2:first-child {
  margin-top: 0;
}

.model-menu {
  position: relative;
}

.model-menu-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 29px;
  padding: 0 10px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

.model-menu-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 10px 22px rgba(23, 33, 38, 0.18);
}

.model-option {
  display: block;
  width: 100%;
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #f7fafb;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.model-option:last-child {
  border-bottom: 0;
}

.model-option:hover,
.model-option.is-active {
  background: #e9f4f7;
  color: #102229;
}

.model-option:disabled {
  color: #7c8a90;
  background: #edf1f2;
  cursor: not-allowed;
}

select {
  width: 100%;
  min-height: 29px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.data-status {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  min-height: 24px;
}

.data-log-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
}

.data-log-panel[hidden] {
  display: none;
}

.data-log-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 118px;
}

.mini-button {
  min-height: 24px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f7fafb;
  color: var(--accent-strong);
  font-size: 12px;
  cursor: pointer;
}

.mini-button:hover {
  border-color: #a8c6cf;
  background: #e9f4f7;
}

.data-log {
  display: flex;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.data-log-empty {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.data-log-item {
  display: grid;
  gap: 2px;
  padding: 6px;
  min-width: 172px;
  max-width: 210px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f8fbfc;
  font-size: 11px;
  line-height: 1.25;
}

.data-log-item strong {
  color: #102229;
  font-size: 12px;
}

.data-log-item span {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product {
  position: relative;
  display: block;
  width: 100%;
  min-height: 27px;
  margin: 1px 0;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--accent-strong);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.product::after {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  z-index: 20;
  width: 260px;
  max-width: min(260px, calc(100vw - 260px));
  padding: 8px 9px;
  border: 1px solid #9fb5bd;
  border-radius: 3px;
  background: #172126;
  color: #fff;
  box-shadow: 0 10px 22px rgba(23, 33, 38, 0.22);
  content: attr(data-tooltip);
  font-size: 12px;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity 120ms ease, transform 120ms ease;
  visibility: hidden;
}

.product:hover::after,
.product:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
  visibility: visible;
}

.product:hover,
.product.is-active {
  border-color: #a8c6cf;
  background: #e9f4f7;
  color: #102229;
}

.product.is-unavailable,
.product:disabled {
  color: #8d9aa0;
  background: #f0f3f4;
  cursor: not-allowed;
  opacity: 0.68;
}

.product.is-unavailable:hover,
.product:disabled:hover {
  border-color: transparent;
  background: #f0f3f4;
  color: #8d9aa0;
}

.product.is-unavailable::after,
.product:disabled::after {
  content: "Not available for the selected model";
}

.viewer {
  min-width: 0;
  max-width: 100%;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(620px, 900px) minmax(500px, 1fr);
  gap: 10px;
  align-items: start;
  width: 100%;
}

.map-column {
  min-width: 0;
  max-width: 900px;
}

.map-column .details-row {
  width: 100%;
}

.viewer-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.viewer-toolbar h2,
.panel-header h3,
.readout-panel h3 {
  margin: 0;
}

.viewer-toolbar h2 {
  font-size: 22px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.meta-grid span {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
}

.map-shell {
  position: relative;
  width: 100%;
  max-width: 100%;
  align-self: start;
  overflow: hidden;
  border: 1px solid #a9b6bb;
  border-radius: 3px;
  background: #dce7ea;
  box-shadow: none;
  aspect-ratio: 1100 / 740;
  height: auto;
  min-height: 0;
  contain: layout paint;
}

#chartCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.sound-point {
  position: absolute;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25);
  cursor: grab;
}

.timeline {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px 112px;
  gap: 7px;
  align-items: center;
  margin: 8px 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  width: 100%;
}

.icon-button {
  width: 34px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f7fafb;
  color: var(--accent-strong);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

#hourRange {
  width: 100%;
  touch-action: none;
}

.hour-readout {
  text-align: right;
}

.hour-readout strong {
  display: block;
  font-size: 18px;
}

.hour-readout span {
  color: var(--muted);
  font-size: 12px;
}

.details-row {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.75fr);
  gap: 8px;
}

.details-row-single {
  grid-template-columns: 1fr;
}

.sounding-panel,
.readout-panel {
  padding: 8px;
}

#soundingImage,
#soundingCanvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 230px);
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f8fbfc;
}

#soundingCanvas {
  background: #071016;
}

#soundingImage[hidden],
#soundingCanvas[hidden] {
  display: none;
}

.chart-row .sounding-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100%;
}

.chart-row .panel-header {
  margin-bottom: 6px;
}

.chart-row .panel-header h3 {
  font-size: 18px;
  line-height: 1.1;
}

.chart-row #soundingImage,
.chart-row #soundingCanvas {
  flex: 0 0 auto;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.action-button {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.metric-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0;
}

.sounding-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.sounding-metrics div {
  padding: 6px;
}

.sounding-metrics dd {
  font-size: 15px;
}

.metric-list div {
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f8fbfc;
}

.metric-list dt {
  color: var(--muted);
  font-size: 12px;
}

.metric-list dd {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 700;
}

.source-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  min-height: 36px;
}

@media (max-width: 1500px) {
  .chart-row {
    grid-template-columns: minmax(560px, 1fr) minmax(320px, 390px);
  }

  .map-column {
    max-width: none;
  }
}

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

  .map-shell {
    height: auto;
  }
}

@media (max-width: 700px) {
  .topbar,
  .viewer-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions {
    align-items: stretch;
    justify-content: flex-start;
  }

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

  .sidebar {
    display: flex;
  }

  .control-panel {
    grid-column: 1 / -1;
  }

  .details-row {
    grid-template-columns: 1fr;
  }

  .chart-row {
    grid-template-columns: 1fr;
    max-width: none;
  }
}

@media (max-width: 620px) {
  .layout {
    padding: 10px;
  }

  .sidebar,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .timeline {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
  }

  .hour-readout {
    grid-column: 1 / -1;
    text-align: left;
  }
}
