:root {
  color-scheme: light;
  --ink: #18202b;
  --muted: #657083;
  --line: #d8dee8;
  --panel: #ffffff;
  --page: #f4f7fb;
  --accent: #126b6f;
  --accent-deep: #0e5458;
  --accent-2: #9b4b36;
  --accent-3: #385c9a;
  --info: #edf7f2;
  --info-line: #bdd9cc;
  --soft: #eef4f8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

a {
  color: var(--accent-deep);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 32px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.brand-block {
  min-width: 0;
}

.app-header h1,
.section-heading h2,
.block-header h3 {
  margin: 0;
  letter-spacing: 0;
}

.app-header h1 {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.subtitle {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-umap {
  position: relative;
  overflow: hidden;
  display: grid;
  width: 116px;
  min-width: 116px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background:
    radial-gradient(circle at 28% 30%, rgba(18, 107, 111, 0.3) 0 4px, transparent 5px),
    radial-gradient(circle at 64% 55%, rgba(155, 75, 54, 0.28) 0 5px, transparent 6px),
    radial-gradient(circle at 42% 72%, rgba(56, 92, 154, 0.25) 0 4px, transparent 5px),
    #f8fafc;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.header-umap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-umap img.missing-image {
  display: none;
}

.header-umap span {
  position: relative;
  z-index: 1;
  padding: 4px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.78);
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - 117px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.nav-item {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  padding: 10px 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item:focus-visible {
  outline: 2px solid transparent;
  background: var(--soft);
}

.nav-item.active {
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.page-column {
  display: flex;
  min-width: 0;
  min-height: 100%;
  flex-direction: column;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 28px;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.section-heading,
.block-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.sub-block-header {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.section-heading h2 {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
}

.notice {
  margin-bottom: 18px;
  border: 1px solid var(--info-line);
  border-radius: 8px;
  padding: 13px 15px;
  background: var(--info);
  color: #25463b;
  line-height: 1.5;
}

.notice:not(.visible) {
  display: none;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

@media (min-width: 1180px) {
  .menu-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.menu-card {
  min-height: 154px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
}

.menu-card:hover,
.menu-card:focus-visible {
  outline: 2px solid var(--accent);
}

.menu-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.menu-card span {
  color: var(--muted);
  line-height: 1.45;
}

.analysis-block {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
}

.analysis-block:first-child {
  margin-top: 0;
}

.exploration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.simulation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.table-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.plot-card,
.table-card,
.contact-card,
.resource-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.plot-card {
  overflow: hidden;
}

.card-controls,
.inline-controls,
.tf-control {
  display: flex;
  align-items: end;
  gap: 10px;
}

.card-controls {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.card-controls label,
.inline-controls span,
.tf-control span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.card-controls select,
.card-controls input,
.inline-controls select,
.tf-control input {
  min-height: 38px;
  min-width: 170px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: #ffffff;
}

.tf-control {
  display: grid;
  grid-template-columns: auto minmax(170px, 240px);
}

.image-frame {
  position: relative;
  overflow: hidden;
  background: #f8fafc;
}

.image-frame img {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
}

.image-frame img.missing-image {
  display: none;
}

.plot-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(18, 107, 111, 0.12), rgba(56, 92, 154, 0.11)),
    repeating-linear-gradient(45deg, #f8fafc 0, #f8fafc 12px, #eef2f7 12px, #eef2f7 24px);
  color: #304052;
  text-align: center;
}

.plot-placeholder span {
  max-width: 18rem;
  font-weight: 800;
}

.square-plot {
  aspect-ratio: 1;
  min-height: 260px;
}

.rectangular-plot {
  aspect-ratio: 16 / 7;
  min-height: 220px;
}

.metadata-map {
  background:
    linear-gradient(135deg, rgba(18, 107, 111, 0.13), rgba(155, 75, 54, 0.08)),
    repeating-linear-gradient(45deg, #f8fafc 0, #f8fafc 12px, #eef2f7 12px, #eef2f7 24px);
}

.fixed-map {
  background:
    linear-gradient(135deg, rgba(155, 75, 54, 0.14), rgba(18, 107, 111, 0.1)),
    repeating-linear-gradient(45deg, #f8fafc 0, #f8fafc 12px, #eef2f7 12px, #eef2f7 24px);
}

.ko-map,
.score-map {
  background:
    linear-gradient(135deg, rgba(56, 92, 154, 0.14), rgba(155, 75, 54, 0.1)),
    repeating-linear-gradient(45deg, #f8fafc 0, #f8fafc 12px, #eef2f7 12px, #eef2f7 24px);
}

.expression-map,
.violin-map,
.proportion-map {
  background:
    linear-gradient(135deg, rgba(18, 107, 111, 0.14), rgba(56, 92, 154, 0.08)),
    repeating-linear-gradient(45deg, #f8fafc 0, #f8fafc 12px, #eef2f7 12px, #eef2f7 24px);
}

.plot-meta {
  display: grid;
  gap: 4px;
  padding: 13px 14px 15px;
}

.plot-meta small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.inline-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inline-controls label,
.range-control {
  display: grid;
  gap: 6px;
}

.range-control {
  grid-template-columns: auto 150px 34px;
  align-items: center;
  color: var(--muted);
  font-weight: 700;
}

.range-control span {
  grid-column: 1 / -1;
}

.range-control input {
  accent-color: var(--accent);
}

.table-card {
  overflow: hidden;
}

.table-card h4 {
  margin: 0;
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  font-size: 1rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 360px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
}

tr:last-child td {
  border-bottom: 0;
}

th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.resource-list {
  display: grid;
  gap: 10px;
}

.resource-item {
  padding: 14px 16px;
}

.resource-item p {
  margin: 6px 0 0;
  color: var(--muted);
}

.contact-content {
  display: grid;
  gap: 14px;
  max-width: 860px;
}

.contact-card {
  padding: 18px;
}

.contact-card h3 {
  margin: 0 0 10px;
}

.contact-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.app-footer {
  border-top: 1px solid var(--line);
  padding: 16px 28px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

@media (max-width: 980px) {
  .exploration-grid,
  .table-grid,
  .simulation-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .app-header,
  .section-heading,
  .block-header {
    display: grid;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .content {
    padding: 18px;
  }

  .header-umap {
    width: 96px;
    min-width: 96px;
  }

  .card-controls,
  .inline-controls,
  .tf-control {
    display: grid;
    justify-content: stretch;
  }

  .card-controls select,
  .card-controls input,
  .inline-controls select,
  .tf-control input {
    width: 100%;
    min-width: 0;
  }

  .range-control {
    grid-template-columns: auto 1fr 34px;
  }
}
