:root {
  color-scheme: dark;
  --bg: #0b1020;
  --border: #29334f;
  --text: #eef2ff;
  --text-dim: #9fb0d8;
  --accent: #7c9cff;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(124, 156, 255, 0.15), transparent 28%),
    radial-gradient(circle at top right, rgba(52, 211, 153, 0.1), transparent 24%),
    var(--bg);
  color: var(--text);
}

.app-shell {
  width: min(1200px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.topbar {
  margin-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: clamp(40px, 7vw, 64px);
  line-height: 1.02;
}

.card {
  background: linear-gradient(180deg, rgba(25, 35, 59, 0.96), rgba(20, 27, 48, 0.96));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.controls {
  display: flex;
  gap: 18px;
  align-items: end;
  padding: 20px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.control-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 260px;
  flex: 1;
}

label,
.label {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 700;
}

input[type="search"] {
  width: 100%;
  background: rgba(11, 16, 32, 0.86);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
}

input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 156, 255, 0.18);
}

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

.model-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(11, 16, 32, 0.7);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.model-check input {
  margin: 0;
}

.model-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.breadcrumbs {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  min-height: 26px;
  margin: 0 0 18px;
}

.crumb-button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
}

.crumb-button:hover {
  color: var(--text);
}

.crumb-button.is-current {
  color: var(--text);
  font-weight: 700;
  cursor: default;
}

.view-root {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#explore-root {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid rgba(159, 176, 216, 0.24);
}

.plot-card {
  padding: 16px 18px 20px;
}

.plot-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.plot-head h2 {
  margin: 0;
  font-size: 24px;
}

.plot-hint {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 700;
}

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

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.plot-gridlines {
  position: relative;
  display: flex;
  justify-content: space-between;
  padding-left: 6px;
  padding-right: 6px;
  color: var(--text-dim);
  font-size: 10px;
  margin-bottom: 8px;
}

.plot-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px 18px;
  align-items: start;
}

.group-column {
  display: grid;
  grid-template-rows: 266px 22px 56px;
  align-items: start;
  padding: 0 8px 0;
}

.group-column.is-clickable {
  cursor: pointer;
  border-radius: 10px;
  transition: 0.16s ease;
}

.group-column.is-clickable:hover {
  background: rgba(124, 156, 255, 0.08);
}

.bars-wrap {
  height: 266px;
  width: 100%;
  border-bottom: 1px solid rgba(159, 176, 216, 0.25);
  background:
    linear-gradient(to top, rgba(159, 176, 216, 0.06) 1px, transparent 1px) 0 0 / 100% 25%,
    rgba(255, 255, 255, 0.02);
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 8px 6px 0;
}

.bars-cluster {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  width: 92%;
  height: 100%;
}

.bar-holder {
  flex: 1;
  display: grid;
  grid-template-rows: 14px 1fr;
  align-items: center;
  gap: 4px;
  min-width: 24px;
  height: 100%;
}

.bar-value {
  color: var(--text-dim);
  font-size: 9px;
  line-height: 14px;
  height: 14px;
  text-align: center;
  white-space: nowrap;
}

.bar-area {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
}

.bar {
  width: 100%;
  min-height: 2px;
  border-radius: 6px 6px 0 0;
  flex-shrink: 0;
}

.x-label {
  margin-top: 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  height: 56px;
  overflow: hidden;
}

.x-meta {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  height: 22px;
  line-height: 22px;
}

.empty-state,
.loading {
  padding: 22px 20px;
  color: var(--text-dim);
}

.explore-card {
  padding: 16px 18px;
}

.explore-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.explore-head h3 {
  margin: 0;
  font-size: 20px;
}

.explore-head input[type="search"] {
  width: min(360px, 100%);
}

.explore-sub {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 12px;
}

.explore-path {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.explore-crumb {
  border: 0;
  background: none;
  padding: 0;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
}

.explore-crumb:hover {
  color: var(--text);
}

.explore-crumb.is-current {
  color: var(--text);
  font-weight: 700;
  cursor: default;
}

.explore-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.explore-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.1fr) minmax(200px, 1.2fr) minmax(220px, 1.8fr) 80px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(159, 176, 216, 0.14);
  border-radius: 12px;
  background: rgba(11, 16, 32, 0.28);
}

.explore-row.is-clickable {
  cursor: pointer;
  transition: 0.16s ease;
}

.explore-row.is-clickable:hover {
  border-color: rgba(124, 156, 255, 0.45);
  background: rgba(124, 156, 255, 0.08);
}

.explore-name {
  font-size: 13px;
  font-weight: 700;
}

.explore-meta {
  color: var(--text-dim);
  font-size: 11px;
}

.explore-score {
  text-align: right;
  font-size: 14px;
  font-weight: 800;
}

.explore-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.explore-mini-row {
  display: grid;
  grid-template-columns: 64px 1fr 40px;
  align-items: center;
  gap: 6px;
}

.explore-mini-label {
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.explore-mini-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.explore-mini-fill {
  height: 100%;
  border-radius: 999px;
}

.explore-mini-value {
  color: var(--text-dim);
  font-size: 10px;
  text-align: right;
}

.subtle-note {
  color: var(--text-dim);
  font-size: 12px;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 20px, 1200px);
    padding-top: 20px;
  }

  .controls {
    padding: 16px;
  }

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

  .plot-legend {
    justify-content: flex-start;
  }

  .plot-columns {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px 12px;
  }

  .bars-wrap {
    height: 226px;
  }

  .group-column {
    grid-template-rows: 226px 22px 56px;
  }

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

  .explore-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .explore-score {
    text-align: left;
  }
}
