:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #152033;
  --muted: #607086;
  --line: #d9e0ea;
  --accent: #087f8c;
  --accent-dark: #055f69;
  --accent-soft: #e8f7f8;
  --warn: #a05b00;
  --error: #b3261e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 88px;
  padding: 18px 28px;
  background: #101827;
  color: white;
  border-bottom: 1px solid #263247;
  flex: 0 0 auto;
}

.method-name {
  color: #70d6df;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  max-width: 1040px;
  margin: 5px 0 0;
  font-size: clamp(19px, 2vw, 28px);
  line-height: 1.15;
}

.author-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 220px;
  text-align: right;
  color: #b9c8dc;
  font-size: 13px;
}

.author-block span {
  display: block;
}

.author-link {
  display: block;
  margin-top: 6px;
  color: #ffd166;
  font-size: 18px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.author-link:hover,
.author-link:focus-visible {
  color: #ffe6a3;
  text-decoration: underline;
}

.resource-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  flex: 0 0 auto;
}

.resource-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  color: #1f3651;
  background: #f8fbfd;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.resource-link:hover {
  border-color: #96cbd1;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.resource-link[aria-disabled="true"] {
  opacity: 0.82;
}

.resource-link svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: 0 0 auto;
}

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

.site-footer {
  flex: 0 0 auto;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.panel,
.plot-panel,
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(30, 42, 62, 0.05);
}

.panel {
  padding: 16px;
}

h2 {
  margin: 0 0 12px;
  font-size: 15px;
}

label {
  display: block;
  margin-top: 10px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

select,
input[type="number"],
input[type="file"] {
  width: 100%;
  min-height: 36px;
  margin-top: 5px;
  padding: 7px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

input[type="range"] {
  width: 100%;
  height: 28px;
  margin-top: 2px;
  accent-color: var(--accent);
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

input[type="file"] {
  min-height: 40px;
  padding: 8px;
  font-weight: 600;
}

.hidden {
  display: none;
}

.dataset-name {
  margin: -2px 0 12px;
  padding: 9px 10px;
  border: 1px solid #cfe8eb;
  border-radius: 8px;
  background: var(--accent-soft);
  color: #07545c;
  font-size: 13px;
  font-weight: 900;
}

.format-details {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.format-details.compact {
  margin-top: 16px;
}

.format-details summary {
  padding: 10px 11px;
  color: #213447;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.format-body {
  padding: 0 11px 11px;
}

.format-body p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.slider-head {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.slider-head span {
  padding-bottom: 8px;
  color: #213447;
  font-size: 13px;
  font-weight: 900;
}

.slider-head label {
  margin-top: 0;
}

.range-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.range-label strong {
  color: #0f172a;
  font-size: 13px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  color: #213447;
  font-size: 13px;
  font-weight: 900;
}

.checkbox-row input {
  flex: 0 0 auto;
  margin: 0;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

button {
  width: 100%;
  min-height: 38px;
  margin-top: 13px;
  border: 0;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.primary {
  background: var(--accent);
  color: white;
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary {
  background: #243b53;
  color: white;
}

.ghost {
  width: auto;
  min-height: 34px;
  margin-top: 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: white;
  color: #27415e;
  transition: border-color .15s, background .15s, color .15s;
}

.ghost:hover {
  border-color: #96cbd1;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.hint {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

code {
  color: #17324d;
  font-weight: 800;
}

.content {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding-right: 4px;
}

.status {
  min-height: 40px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef6f7;
  color: #164e56;
  font-size: 14px;
  font-weight: 700;
}

.status.warn {
  background: #fff7e8;
  color: var(--warn);
}

.status.error {
  background: #fff0ef;
  color: var(--error);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 84px;
  padding: 13px 14px;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 4px;
  color: #0f172a;
  font-size: 27px;
  line-height: 1.1;
}

.download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.plot-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 12px 0;
  border-bottom: 1px solid var(--line);
}

.tab {
  width: auto;
  min-height: 34px;
  margin: 0 0 -1px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 7px 7px 0 0;
  background: transparent;
  color: #52657b;
  font-size: 13px;
  font-weight: 900;
}

.tab.active {
  border-color: var(--line);
  border-bottom-color: white;
  background: white;
  color: var(--accent-dark);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.research-note {
  margin: 12px 14px 0;
  padding: 9px 11px;
  border: 1px solid #cfe8eb;
  border-radius: 7px;
  background: #f0fafb;
  color: #164e56;
  font-size: 13px;
  font-weight: 800;
}

.plot {
  width: 100%;
  height: 470px;
}

.metadata-panel {
  margin: 0 14px 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.metadata-panel h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metadata-item {
  min-height: 58px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #ffffff;
}

.metadata-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.metadata-item strong {
  display: block;
  margin-top: 4px;
  color: #111827;
  font-size: 14px;
  overflow-wrap: anywhere;
}

@media (max-width: 1040px) {
  body {
    height: auto;
    overflow: visible;
  }

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

  .sidebar,
  .content {
    overflow-y: visible;
    padding-right: 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .author-block {
    text-align: left;
  }
}

@media (max-width: 760px) {
  .layout {
    padding: 12px;
  }

  .metrics-grid,
  .plot-grid,
  .two-col {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 16px;
  }

  .resource-nav {
    padding: 10px 12px;
  }

  .resource-link {
    flex: 1 1 150px;
    justify-content: center;
  }

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