:root {
  color-scheme: light;
  font-family:
    Inter, "Noto Sans SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-synthesis: none;
  --paper: #f7f7f5;
  --surface: #ffffff;
  --surface-muted: #f0f2f3;
  --ink: #17191c;
  --muted: #6d747c;
  --line: #dfe3e6;
  --line-strong: #c8cdd2;
  --accent: #e63946;
  --accent-soft: #fff0f1;
  --teal: #16887a;
  --gold: #d99a18;
  --focus: #2563eb;
  --threshold-1: #2563eb;
  --threshold-2: #16887a;
  --threshold-3: #d99a18;
  --threshold-4: #e63946;
  --shadow: 0 8px 24px rgba(23, 25, 28, 0.08);
  --topbar-height: 68px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  letter-spacing: 0;
}

button,
input,
select {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 28%, transparent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  min-height: var(--topbar-height);
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 247, 245, 0.96);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-size: 16px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.view-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
}

.view-tab {
  min-height: 36px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.view-tab.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(23, 25, 28, 0.08);
}

.top-stats {
  display: flex;
  justify-self: end;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
}

.top-stats strong {
  color: var(--ink);
  font-size: 14px;
}

.app-status {
  display: grid;
  min-height: calc(100vh - var(--topbar-height));
  place-items: center;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.app-status.is-error {
  color: #a61b29;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(310px, 380px) minmax(0, 1fr);
  width: min(1600px, 100%);
  min-height: calc(100vh - var(--topbar-height));
  margin: 0 auto;
}

.library-sidebar {
  position: sticky;
  top: var(--topbar-height);
  align-self: start;
  height: calc(100vh - var(--topbar-height));
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.library-controls {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.search-field,
.filter-row label,
.ranking-filters label,
.distribution-filters label {
  display: grid;
  gap: 6px;
}

.search-field > span,
.filter-row span,
.ranking-filters span,
.distribution-filters span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.search-field input,
.filter-row select,
.ranking-filters select,
.distribution-filters select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
}

.search-field input {
  padding: 0 12px;
}

.search-field input::placeholder {
  color: #9aa0a6;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.filter-row select,
.ranking-filters select,
.distribution-filters select {
  padding: 0 30px 0 10px;
}

.result-count {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.result-count strong {
  color: var(--ink);
}

.song-list {
  height: calc(100% - 170px);
  overflow-y: auto;
  padding: 8px;
  scrollbar-width: thin;
}

.song-list-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  width: 100%;
  min-height: 70px;
  align-items: center;
  gap: 11px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  text-align: left;
}

.song-list-item:hover {
  background: var(--surface-muted);
}

.song-list-item.is-active {
  border-color: #f0b5bb;
  background: var(--accent-soft);
}

.song-thumb,
.ranking-cover {
  position: relative;
  overflow: hidden;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #e6e8ea;
}

.song-thumb {
  width: 54px;
  height: 54px;
}

.song-thumb img,
.ranking-cover img,
.detail-cover img {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 120ms ease-out;
}

.song-thumb img.is-loaded,
.ranking-cover img.is-loaded,
.detail-cover img.is-loaded {
  opacity: 1;
}

.cover-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background: #dde1e4;
  color: #626970;
  font-weight: 800;
}

.song-list-copy {
  min-width: 0;
}

.song-list-title,
.song-list-artist {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-list-title {
  font-size: 13px;
  font-weight: 750;
}

.song-list-artist {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.song-list-tags {
  display: flex;
  gap: 3px;
  margin-top: 7px;
}

.mini-tag,
.chart-badge,
.kind-badge,
.difficulty-badge {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.mini-tag.kind-DX,
.kind-badge.kind-DX {
  border-color: #e3a72f;
  background: #fff8df;
  color: #825b00;
}

.mini-tag.kind-ST,
.kind-badge.kind-ST {
  border-color: #5ab6ac;
  background: #eaf8f5;
  color: #14695f;
}

.mini-tag.level-tag {
  min-width: 28px;
  border-color: #b9c0c6;
  background: #f6f7f8;
  color: #43494f;
  font-variant-numeric: tabular-nums;
}

.mini-tag.origin-official {
  border-color: #6f83ad;
  background: #eef2fb;
  color: #334d7e;
}

.mini-tag.origin-fanmade {
  border-color: #b7749a;
  background: #fbeef6;
  color: #7a365d;
}

.song-chart-count {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.load-more {
  width: calc(100% - 16px);
  min-height: 40px;
  margin: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.detail-main {
  min-width: 0;
  background: var(--paper);
}

.song-overview,
.chart-section,
.radar-section {
  padding: 28px clamp(22px, 4vw, 58px);
  border-bottom: 1px solid var(--line);
}

.song-overview {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  align-items: end;
  gap: clamp(24px, 4vw, 54px);
  background: var(--surface);
}

.detail-cover {
  position: relative;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #e2e5e7;
  box-shadow: var(--shadow);
}

.detail-cover .cover-placeholder {
  font-size: 48px;
}

.song-identity {
  min-width: 0;
  padding-bottom: 4px;
}

.song-version,
.section-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.song-identity h1,
.ranking-header h1 {
  overflow-wrap: anywhere;
  margin: 0;
  font-size: clamp(28px, 4vw, 52px);
  line-height: 1.08;
}

.song-artist {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.song-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 12px;
}

.song-facts strong {
  color: var(--ink);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-heading h2 {
  margin: 0;
  font-size: 21px;
}

.section-note,
.scale-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.chart-switcher {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.chart-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 56px;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  text-align: left;
}

.chart-option:hover {
  border-color: #9ca3aa;
}

.chart-option.is-active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.chart-option-copy {
  min-width: 0;
}

.chart-option-copy strong,
.chart-option-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-option-copy strong {
  font-size: 12px;
}

.chart-option-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.chart-level {
  font-size: 18px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.chart-metadata {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 20px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.chart-metadata > div {
  min-width: 0;
  padding: 13px 12px;
  border-right: 1px solid var(--line);
}

.chart-metadata > div:last-child {
  border-right: 0;
}

.chart-metadata dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.chart-metadata dd {
  overflow: hidden;
  margin: 5px 0 0;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.radar-layout {
  display: grid;
  grid-template-columns: minmax(340px, 1.05fr) minmax(300px, 0.95fr);
  align-items: center;
  gap: clamp(22px, 5vw, 72px);
}

.radar-chart {
  width: min(100%, 600px);
  aspect-ratio: 1;
  justify-self: center;
}

.radar-chart svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.radar-ring {
  fill: none;
  stroke: #d6dade;
  stroke-width: 1;
}

.radar-ring.is-frame {
  fill: rgba(23, 25, 28, 0.025);
  stroke: #747c83;
  stroke-width: 2.2;
}

.radar-axis {
  stroke: #d9dde0;
  stroke-dasharray: 3 5;
  stroke-width: 1;
}

.radar-shape {
  fill: color-mix(in srgb, var(--radar-color) 23%, transparent);
  stroke: var(--radar-color);
  stroke-width: 3;
  stroke-linejoin: round;
}

.radar-point {
  fill: var(--surface);
  stroke: var(--dimension-color);
  stroke-width: 3;
}

.radar-label {
  fill: var(--dimension-color);
  font-size: 13px;
  font-weight: 750;
  text-anchor: middle;
}

.radar-ring-label {
  fill: #8b9299;
  font-size: 9px;
}

.score-breakdown {
  border-top: 1px solid var(--line);
}

.score-row {
  display: grid;
  grid-template-columns: minmax(90px, 120px) minmax(100px, 1fr) 58px;
  min-height: 56px;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.score-name {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 750;
}

.score-swatch {
  width: 8px;
  height: 24px;
  border-radius: 2px;
  background: var(--dimension-color);
}

.score-track {
  height: 7px;
  overflow: hidden;
  border-radius: 3px;
  background: #e7eaec;
}

.score-fill {
  width: var(--score-width);
  height: 100%;
  background: var(--dimension-color);
}

.score-value {
  font-size: 15px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ranking-main {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 32px clamp(18px, 4vw, 56px) 56px;
}

.ranking-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.ranking-header h1 {
  font-size: 34px;
}

.ranking-summary {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.ranking-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 190px));
  gap: 10px;
}

.dimension-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(100px, 1fr));
  gap: 6px;
  padding: 20px 0;
  overflow-x: auto;
}

.dimension-tab {
  min-height: 48px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.dimension-tab.is-active {
  border-color: var(--dimension-color);
  box-shadow: inset 0 -3px 0 var(--dimension-color);
}

.ranking-column-head,
.ranking-row {
  display: grid;
  grid-template-columns: 58px minmax(260px, 1.5fr) minmax(130px, 0.7fr) 100px 150px;
  align-items: center;
  gap: 14px;
}

.ranking-column-head {
  min-height: 38px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.ranking-row {
  width: 100%;
  min-height: 70px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.ranking-row:hover {
  background: var(--surface);
}

.rank-number {
  font-size: 16px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.rank-number.is-top {
  color: var(--accent);
}

.ranking-song {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.ranking-song > span {
  min-width: 0;
}

.ranking-cover {
  width: 48px;
  height: 48px;
}

.ranking-title,
.ranking-artist,
.ranking-charter {
  display: block;
  max-width: 100%;
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-title {
  font-size: 13px;
  font-weight: 750;
}

.ranking-artist,
.ranking-charter {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.ranking-chart-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ranking-score {
  display: grid;
  grid-template-columns: minmax(60px, 1fr) 46px;
  align-items: center;
  gap: 9px;
}

.ranking-score strong {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ranking-load-more {
  width: min(420px, 100%);
  margin: 20px auto 0;
}

.distribution-main {
  grid-column: 1 / -1;
  min-width: 0;
  background: var(--paper);
}

.distribution-header {
  display: flex;
  min-height: 132px;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  padding: 28px clamp(22px, 4vw, 58px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.distribution-header h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.12;
}

.distribution-summary {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.distribution-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 160px));
  gap: 10px;
}

.distribution-dimensions {
  padding: 0 clamp(22px, 4vw, 58px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.distribution-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 0 clamp(22px, 4vw, 58px);
  border-bottom: 1px solid var(--line);
  background: #f0f3f3;
}

.distribution-stats > div {
  min-width: 0;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
}

.distribution-stats > div:first-child {
  padding-left: 0;
}

.distribution-stats > div:last-child {
  border-right: 0;
}

.distribution-stats span,
.distribution-stats strong {
  display: block;
}

.distribution-stats span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.distribution-stats strong {
  margin-top: 5px;
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}

.distribution-workbench {
  display: grid;
  grid-template-columns: minmax(300px, 350px) minmax(0, 1fr);
  min-height: 640px;
}

.threshold-panel {
  padding: 24px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.threshold-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.threshold-heading h2 {
  margin: 0;
  font-size: 20px;
}

.mapping-note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.threshold-actions {
  display: grid;
  gap: 7px;
  flex: 0 0 auto;
}

.reset-curve-button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  font-size: 11px;
  font-weight: 700;
}

.reset-curve-button:hover {
  border-color: #8f979e;
  background: var(--surface-muted);
}

.threshold-control {
  display: grid;
  gap: 9px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.threshold-control-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.threshold-control-heading strong {
  padding-left: 10px;
  border-left: 5px solid var(--threshold-color);
  font-size: 12px;
}

.threshold-control-heading span,
.threshold-raw {
  color: var(--muted);
  font-size: 11px;
}

.threshold-control output {
  color: var(--threshold-color);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.threshold-control-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  align-items: center;
  gap: 10px;
}

.threshold-control input[type="range"] {
  width: 100%;
  accent-color: var(--threshold-color);
}

.threshold-control input[type="number"] {
  width: 72px;
  height: 34px;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.threshold-table-wrap {
  margin-top: 24px;
  overflow-x: auto;
  border-top: 1px solid var(--line-strong);
}

.threshold-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.threshold-table th,
.threshold-table td {
  height: 38px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.threshold-table th:first-child,
.threshold-table td:first-child {
  text-align: left;
}

.threshold-table th {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
}

.distribution-output {
  min-width: 0;
  padding: 24px clamp(18px, 4vw, 48px) 48px;
}

.distribution-chart-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 8px;
}

.distribution-chart-heading h2 {
  margin: 0;
  font-size: 20px;
}

.distribution-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 10px;
}

.distribution-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-line {
  width: 22px;
  height: 3px;
  background: var(--ink);
}

.legend-bar {
  width: 9px;
  height: 12px;
  background: var(--line-strong);
}

.distribution-chart {
  width: 100%;
  min-height: 360px;
  aspect-ratio: 980 / 550;
}

.distribution-chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

.distribution-grid {
  stroke: #dde1e4;
  stroke-width: 1;
}

.distribution-tick,
.distribution-axis {
  stroke: #9da4aa;
  stroke-width: 1;
}

.distribution-curve {
  fill: none;
  stroke: var(--dimension-color);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.distribution-bar {
  fill: color-mix(in srgb, var(--dimension-color) 68%, white);
}

.threshold-line {
  stroke: var(--threshold-color);
  stroke-dasharray: 4 4;
  stroke-width: 1.5;
}

.threshold-point {
  fill: var(--surface);
  stroke: var(--threshold-color);
  stroke-width: 3;
}

.threshold-label {
  fill: var(--threshold-color);
  font-size: 10px;
  font-weight: 800;
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 4px;
}

.threshold-1 { --threshold-color: var(--threshold-1); }
.threshold-2 { --threshold-color: var(--threshold-2); }
.threshold-3 { --threshold-color: var(--threshold-3); }
.threshold-4 { --threshold-color: var(--threshold-4); }

.distribution-axis-label,
.distribution-axis-title {
  fill: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.distribution-axis-title {
  fill: var(--ink);
  font-weight: 750;
}

.range-share {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.range-share-item {
  position: relative;
  display: block;
  min-width: 0;
  padding: 14px 12px;
  border-right: 1px solid var(--line);
}

.range-share-item:last-child {
  border-right: 0;
}

.range-share-item i {
  display: block;
  width: var(--range-width);
  min-width: 2px;
  height: 4px;
  margin-bottom: 9px;
  background: var(--range-color);
}

.range-share-item small,
.range-share-item strong {
  display: block;
}

.range-share-item small {
  color: var(--muted);
  font-size: 10px;
}

.range-share-item strong {
  margin-top: 3px;
  overflow: hidden;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.range-1 { --range-color: var(--threshold-1); }
.range-2 { --range-color: var(--threshold-2); }
.range-3 { --range-color: var(--threshold-3); }
.range-4 { --range-color: var(--threshold-4); }
.range-5 { --range-color: #6d747c; }

.empty-state {
  padding: 48px 18px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .song-overview {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .chart-metadata {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .chart-metadata > div:nth-child(3) {
    border-right: 0;
  }

  .chart-metadata > div:nth-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }

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

  .radar-chart {
    width: min(100%, 520px);
  }

  .ranking-column-head,
  .ranking-row {
    grid-template-columns: 48px minmax(230px, 1.4fr) minmax(110px, 0.7fr) 88px 130px;
  }

  .distribution-workbench {
    grid-template-columns: 300px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  :root {
    --topbar-height: 116px;
  }

  .topbar {
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 10px 14px;
  }

  .view-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .top-stats {
    gap: 9px;
  }

  .top-stats span:first-child {
    display: none;
  }

  .app-shell {
    display: block;
  }

  .library-sidebar {
    position: static;
    height: auto;
    max-height: 46vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .song-list {
    height: calc(46vh - 170px);
    min-height: 190px;
  }

  .song-overview,
  .chart-section,
  .radar-section {
    padding: 22px 16px;
  }

  .song-overview {
    grid-template-columns: 118px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
  }

  .song-identity h1 {
    font-size: 25px;
  }

  .song-artist {
    margin-top: 7px;
    font-size: 13px;
  }

  .song-facts {
    gap: 5px 10px;
    margin-top: 12px;
    font-size: 10px;
  }

  .chart-switcher {
    grid-template-columns: 1fr;
  }

  .chart-metadata {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-metadata > div,
  .chart-metadata > div:nth-child(3) {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .chart-metadata > div:nth-child(2n) {
    border-right: 0;
  }

  .chart-metadata > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .section-heading {
    align-items: start;
  }

  .radar-chart {
    width: 100%;
  }

  .score-row {
    grid-template-columns: 94px minmax(70px, 1fr) 50px;
    gap: 9px;
  }

  .ranking-main {
    padding: 24px 12px 44px;
  }

  .ranking-header {
    display: block;
  }

  .ranking-header h1 {
    font-size: 28px;
  }

  .ranking-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 20px;
  }

  .dimension-tabs {
    grid-template-columns: repeat(6, 104px);
  }

  .ranking-column-head {
    display: none;
  }

  .ranking-row {
    grid-template-columns: 34px minmax(0, 1fr) 88px;
    gap: 8px;
    padding: 9px 5px;
  }

  .ranking-charter-cell,
  .ranking-chart-cell {
    display: none;
  }

  .ranking-score {
    grid-template-columns: 1fr;
  }

  .ranking-score .score-track {
    display: none;
  }

  .distribution-header {
    display: block;
    min-height: 0;
    padding: 22px 16px;
  }

  .distribution-header h1 {
    font-size: 26px;
  }

  .distribution-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 18px;
  }

  .distribution-dimensions {
    padding: 0 16px;
  }

  .distribution-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 16px;
  }

  .distribution-stats > div,
  .distribution-stats > div:first-child {
    padding: 14px 10px;
    border-bottom: 1px solid var(--line);
  }

  .distribution-stats > div:nth-child(2n) {
    border-right: 0;
  }

  .distribution-stats > div:last-child {
    grid-column: 1 / -1;
    border-bottom: 0;
  }

  .distribution-stats strong {
    font-size: 18px;
  }

  .distribution-workbench {
    display: block;
  }

  .threshold-panel {
    padding: 20px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .distribution-output {
    padding: 18px 8px 36px;
  }

  .distribution-chart-heading {
    padding: 0 8px;
  }

  .distribution-chart {
    min-height: 300px;
  }

  .range-share {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-right: 8px;
    margin-left: 8px;
  }

  .range-share-item:nth-child(2n) {
    border-right: 0;
  }

  .range-share-item:last-child {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
