:root {
  color-scheme: light;
  --bg: #eef3f6;
  --panel: #ffffff;
  --ink: #1d2b67;
  --muted: #6d7b8e;
  --line: #e4ebf1;
  --axis: #526a82;
  --accent: #72c9bf;
  --accent-blue: #4e7193;
  --shadow: 0 16px 36px rgba(83, 96, 110, 0.14);
  --shadow-hover: 0 20px 44px rgba(83, 96, 110, 0.2);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

button,
input {
  font: inherit;
}

.site-header {
  width: 100%;
  background: #fff;
  box-shadow: 0 8px 24px rgba(83, 96, 110, 0.1);
}

.header-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  width: min(1500px, calc(100% - 56px));
  min-height: 82px;
  margin: 0 auto;
  padding: 14px 0 14px 28px;
}

.header-inner::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 6px;
  background: var(--accent);
}

h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.25rem, 1.7vw, 2rem);
  line-height: 1.08;
  font-weight: 800;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tab {
  min-height: 36px;
  padding: 0 14px;
  color: var(--accent-blue);
  font-size: 0.86rem;
  font-weight: 800;
  background: #f7fafc;
  border: 1px solid #dfe8ef;
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.tab:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(83, 96, 110, 0.12);
}

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

.page-shell {
  width: min(1500px, calc(100% - 56px));
  margin: 0 auto;
  padding: 28px 0 34px;
}

.category-status {
  display: none;
  min-height: 0;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
  align-items: stretch;
}

.chart-grid[data-category="rna"],
.chart-grid[data-category="untargeted"] {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.chart-grid[data-category="rna"] .chart-card,
.chart-grid[data-category="untargeted"] .chart-card {
  grid-column: span 2;
}

.chart-grid[data-category="rna"] .chart-card:nth-child(-n + 2),
.chart-grid[data-category="untargeted"] .chart-card:nth-child(-n + 2) {
  grid-column: span 2;
}

.chart-grid[data-category="rna"] .chart-card:nth-child(1),
.chart-grid[data-category="untargeted"] .chart-card:nth-child(1) {
  grid-column: 2 / span 2;
}

.chart-grid[data-category="rna"] .chart-card:nth-child(2),
.chart-grid[data-category="untargeted"] .chart-card:nth-child(2) {
  grid-column: 4 / span 2;
}

.chart-grid[data-category="rna"] .chart-card:nth-child(3),
.chart-grid[data-category="untargeted"] .chart-card:nth-child(3) {
  grid-column: 1 / span 2;
}

.chart-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 375px;
  padding: 16px 18px 12px;
  overflow: visible;
  background: var(--panel);
  border: 1px solid rgba(221, 230, 237, 0.94);
  border-radius: 14px;
  box-shadow: var(--shadow);
  transition:
    transform 170ms ease,
    box-shadow 170ms ease;
}

.chart-card:hover {
  transform: translateY(-2px) rotate(-0.08deg);
  box-shadow: var(--shadow-hover);
}

.card-title {
  margin: 4px 8px 12px;
  color: var(--accent-blue);
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 850;
  text-align: center;
}

.search-wrap {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr 34px;
  align-items: center;
  width: 100%;
  height: 44px;
  margin-bottom: 12px;
  padding: 0 4px 0 14px;
  background: #fff;
  border: 2px solid #e4ebf1;
  border-radius: 10px;
}

.search-icon {
  display: grid;
  place-items: center;
  color: var(--accent-blue);
}

.search-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.search-input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 6px;
  color: #24344d;
  background: transparent;
  border: 0;
  outline: none;
}

.search-input::placeholder {
  color: #8d96a2;
}

.menu-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #4f5a66;
  background: #f7f9fb;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.menu-button svg {
  width: 16px;
  height: 16px;
}

.options {
  position: absolute;
  z-index: 20;
  top: 48px;
  right: 0;
  left: 0;
  display: none;
  max-height: 260px;
  padding: 6px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 34px rgba(73, 86, 101, 0.2);
}

.options.open {
  display: block;
}

.option {
  width: 100%;
  padding: 9px 10px;
  overflow: hidden;
  color: #24344d;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.option:hover,
.option:focus {
  background: rgba(114, 201, 191, 0.18);
  outline: none;
}

.feature-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 30px;
  margin: 2px 0 8px;
  padding: 7px 12px;
  color: #62748b;
  font-size: 0.84rem;
  font-weight: 800;
  text-align: center;
  background: linear-gradient(90deg, #f7fbfa, #f2f7f8);
  border-radius: 8px;
}

.feature-badge .mw {
  color: #326a83;
  font-variant-numeric: tabular-nums;
}

.feature-badge .feature-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-area {
  position: relative;
  flex: 1;
  min-height: 232px;
}

.plot {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 232px;
}

.axis {
  stroke: var(--axis);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.axis-label {
  fill: var(--accent-blue);
  font-size: 12px;
  font-weight: 800;
}

.tick-label,
.scale-label {
  fill: #5e6f82;
  font-size: 11px;
}

.group-label {
  fill: #4f6071;
  font-size: 11px;
}

.bar {
  fill: #87bde2;
  fill-opacity: 0.92;
}

.error {
  stroke: #4e5258;
  stroke-width: 1.7;
  stroke-linecap: round;
}

.point {
  stroke: rgba(72, 87, 98, 0.68);
  stroke-width: 0.75;
  cursor: crosshair;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.download {
  min-height: 32px;
  padding: 0 12px;
  color: var(--accent-blue);
  font-size: 0.78rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 3px 8px rgba(74, 86, 101, 0.09);
  cursor: pointer;
}

.download:hover {
  border-color: #b7c9d8;
  box-shadow: 0 6px 12px rgba(74, 86, 101, 0.14);
}

.site-footer {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 34px 20px 42px;
  color: #6d7b8e;
  font-size: clamp(0.82rem, 1vw, 1rem);
  text-align: center;
  background: linear-gradient(135deg, #eff5f8, #e4edf2);
  border-top: 1px solid #d8e3ea;
}

.site-footer p {
  margin: 0;
  font-weight: 700;
}

.footer-mark svg {
  width: 28px;
  height: 28px;
  fill: #22bcae;
  stroke: #1d2b3e;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.footer-links a {
  color: #111827;
}

.tooltip {
  position: fixed;
  z-index: 60;
  display: none;
  max-width: 280px;
  padding: 9px 10px;
  color: #fff;
  font-size: 0.8rem;
  line-height: 1.35;
  pointer-events: none;
  background: rgba(33, 51, 72, 0.94);
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.2);
}

@media (max-width: 860px) {
  .header-inner {
    grid-template-columns: 1fr;
    align-items: start;
    width: calc(100% - 28px);
    padding-left: 22px;
  }

  .tabs {
    justify-content: flex-start;
  }

  .page-shell {
    width: calc(100% - 24px);
    padding-top: 18px;
  }

  .chart-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .chart-grid[data-category="rna"],
  .chart-grid[data-category="untargeted"] {
    grid-template-columns: 1fr;
  }

  .chart-grid[data-category="rna"] .chart-card,
  .chart-grid[data-category="untargeted"] .chart-card,
  .chart-grid[data-category="rna"] .chart-card:nth-child(-n + 2),
  .chart-grid[data-category="untargeted"] .chart-card:nth-child(-n + 2) {
    grid-column: auto;
  }

  .chart-card {
    min-height: 370px;
    padding: 18px 14px 14px;
  }

  .actions {
    justify-content: stretch;
  }

  .download {
    flex: 1;
  }
}
