:root {
  color-scheme: light;
  --bg-start: #f7faff;
  --bg-end: #edf2fb;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --ink: #0f172a;
  --muted: #64748b;
  --line: rgba(148, 163, 184, 0.28);
  --line-strong: rgba(148, 163, 184, 0.5);
  --accent: #2563eb;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  --normal: #1d4ed8;
  --normal-bg: rgba(29, 78, 216, 0.12);
  --hyper: #ca8a04;
  --hyper-bg: rgba(250, 204, 21, 0.18);
  --another: #dc2626;
  --another-bg: rgba(248, 113, 113, 0.16);
  --leggendaria: #7c3aed;
  --leggendaria-bg: rgba(167, 139, 250, 0.18);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", "Meiryo", sans-serif;
  background:
    radial-gradient(1100px 650px at 15% -8%, rgba(37, 99, 235, 0.15), transparent 60%),
    radial-gradient(900px 600px at 96% 0%, rgba(124, 58, 237, 0.12), transparent 58%),
    linear-gradient(180deg, var(--bg-start), var(--bg-end));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.3) 1px, transparent 1px);
  background-size: 100% 54px;
  opacity: 0.32;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 88%);
}

.app {
  position: relative;
  width: min(1240px, calc(100% - 24px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

.masthead {
  margin-bottom: 18px;
}

.masthead h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.9rem);
  line-height: 1.06;
  letter-spacing: -0.05em;
  font-weight: 800;
  color: #0f172a;
  text-wrap: balance;
}

.title-lock {
  white-space: nowrap;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 18px;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px 14px;
  margin-bottom: 14px;
}

.search {
  flex: 1 1 320px;
  display: grid;
  gap: 8px;
  min-width: 220px;
}

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

.multi-filter {
  position: relative;
  display: grid;
  gap: 8px;
  min-width: 108px;
}

.feature-filter {
  flex: 0 1 220px;
  min-width: 180px;
}

.feature-filter .multi-filter__details,
.feature-filter .multi-filter__details > summary {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.feature-filter .multi-filter__options {
  left: 0;
  right: 0;
  width: auto;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
  max-height: none;
  overflow: visible;
}

.feature-filter__option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
}

.feature-filter__name {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.feature-filter__mode {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  white-space: normal;
}

.multi-filter > span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: none;
  color: var(--muted);
}

.multi-filter__details {
  position: relative;
}

.multi-filter__details > summary {
  position: relative;
  min-height: 42px;
  box-sizing: border-box;
  padding: 11px 36px 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel-strong);
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.multi-filter__details > summary::-webkit-details-marker {
  display: none;
}

.multi-filter__details > summary::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 13px;
  width: 7px;
  height: 7px;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: translateY(-65%) rotate(45deg);
}

.multi-filter__details[open] > summary {
  border-color: rgba(37, 99, 235, 0.6);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.multi-filter__details[open] > summary::after {
  transform: translateY(-25%) rotate(225deg);
}

.multi-filter__options {
  position: absolute;
  z-index: 5;
  top: calc(100% + 6px);
  left: 0;
  width: max-content;
  min-width: 100%;
  max-width: min(280px, calc(100vw - 48px));
  max-height: 17rem;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel-strong);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
}

.multi-filter__option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 7px;
  border-radius: 9px;
  color: var(--ink);
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

.multi-filter__option:hover {
  background: rgba(219, 234, 254, 0.55);
}

.multi-filter__option--all {
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.multi-filter__option input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  margin: 0;
  padding: 0;
  appearance: auto;
  box-shadow: none;
}

.filter {
  display: grid;
  gap: 8px;
  min-width: 108px;
}

.bpm-filter,
.pred-filter,
.level-filter {
  flex: 0 1 112px;
}

.search span,
.filter span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: none;
  color: var(--muted);
}

input,
select {
  width: 100%;
  appearance: none;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
  padding: 11px 13px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.6);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.toolbar input,
.toolbar select,
.multi-filter__details > summary {
  font-size: 0.9rem;
}

.filter select {
  min-width: 108px;
  padding-right: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

.table-shell {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
}

.bpm-range {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
}

.table-shell.is-overflowing .bpm-range {
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  white-space: normal;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  table-layout: fixed;
}

col.col-orig {
  width: 7%;
}

col.col-title {
  width: 31%;
}

col.col-pred {
  width: 9%;
}

col.col-bpm {
  width: 11%;
}

col.col-features {
  width: 42%;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(248, 250, 252, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

thead th button {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 11px 20px 11px 12px;
  white-space: nowrap;
  overflow: visible;
}

thead th button span:first-child {
  min-width: 0;
}

thead th button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

thead th:nth-child(1) button {
  justify-content: center;
}

thead th:nth-child(2) button,
thead th:nth-child(3) button,
thead th:nth-child(4) button,
thead th:nth-child(5) button {
  justify-content: flex-start;
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  vertical-align: middle;
  font-size: 0.85rem;
}

.table-hint {
  margin: 8px 0 4px 2px;
  color: var(--ink);
  font-size: 0.72rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.row-count {
  margin: 0 0 8px 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.scroll-top-button {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 30;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(30, 41, 59, 0.2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  font: inherit;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.68;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.scroll-top-button:hover,
.scroll-top-button:focus-visible {
  opacity: 0.92;
}

@media (min-width: 721px) and (max-width: 1119px) {
  .toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(104px, 112px));
    align-items: end;
  }

  .toolbar .filters {
    display: contents;
  }

  .toolbar > .search,
  .toolbar > .multi-filter,
  .toolbar > .filter,
  .toolbar .filters > .multi-filter,
  .toolbar .filters > .filter {
    width: 100%;
    min-width: 0;
  }
}
@media (min-width: 1120px) {
  .toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) repeat(7, minmax(104px, 1fr));
    align-items: end;
  }

  .feature-filter .multi-filter__options {
    right: auto;
    width: min(360px, calc(100vw - 48px));
    max-width: min(360px, calc(100vw - 48px));
  }

  .toolbar .filters {
    display: contents;
  }

  .toolbar > .search,
  .toolbar > .multi-filter,
  .toolbar > .filter,
  .toolbar .filters > .multi-filter,
  .toolbar .filters > .filter {
    width: 100%;
    min-width: 0;
  }
}

.scroll-top-button[hidden] {
  display: none;
}

tbody tr:nth-child(2n) td {
  background: rgba(248, 250, 252, 0.45);
}

tbody tr:hover td {
  background: rgba(219, 234, 254, 0.3);
}

tbody td:nth-child(1),
tbody td:nth-child(3),
tbody td:nth-child(4) {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

tbody td:nth-child(1) {
  padding-left: 12px;
  padding-right: 12px;
}

tbody td:nth-child(2) {
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

tbody td:nth-child(5) {
  overflow-wrap: anywhere;
}

.mono {
  font-variant-numeric: tabular-nums;
}

/* Keep the main filter labels and values at shared sizes. */
.toolbar {
  --filter-label-size: 0.9rem;
  --filter-value-size: 0.9rem;
}

.toolbar > .search > span,
.toolbar > .multi-filter > span {
  font-size: var(--filter-label-size);
}

.toolbar > .search > input,
.toolbar > .multi-filter .multi-filter__details > summary {
  font-size: var(--filter-value-size);
}

.chart-title-cell {
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.chart-title-cell .chart-link {
  display: inline-block;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 8px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.chart-title-cell .difficulty--normal,
.chart-title-cell .difficulty--hyper,
.chart-title-cell .difficulty--another,
.chart-title-cell .difficulty--leggendaria {
  color: var(--ink);
}

.difficulty--normal {
  color: var(--normal);
  background: var(--normal-bg);
}

.difficulty--hyper {
  color: var(--hyper);
  background: var(--hyper-bg);
}

.difficulty--another {
  color: var(--another);
  background: var(--another-bg);
}

.difficulty--leggendaria {
  color: var(--leggendaria);
  background: var(--leggendaria-bg);
}

.sort-mark {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-block;
  color: var(--accent);
  font-size: 0.8rem;
  line-height: 1;
}

@media (max-width: 900px) {
  .panel {
    padding: 16px;
  }
}

@media (max-width: 720px) {
  .app {
    width: min(100% - 16px, 1240px);
    padding: 18px 0 26px;
  }

  .toolbar {
    align-items: stretch;
  }

  .search {
    flex-basis: 100%;
  }

  .filters {
    width: 100%;
  }

  .feature-filter {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }

  .feature-filter .multi-filter__options {
    width: auto;
    min-width: 0;
    max-width: none;
  }

  .filter {
    flex: 1 1 0;
    min-width: 0;
  }

  .filter select {
    width: 100%;
  }

  thead th button,
  tbody td {
    padding-left: 10px;
    padding-right: 10px;
  }
}
body .masthead__bar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: nowrap;
}

body .masthead__bar h1 {
  margin: 0;
  flex: 1 1 18rem;
  min-width: 0;
  line-height: 1.1;
}

body .title-lock {
  white-space: nowrap;
}

#menuRoot {
  position: relative;
  flex: 0 0 auto;
  align-self: flex-start;
}

#menuRoot .menu-button {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0.7rem 0.6rem;
  border: 1px solid rgba(98, 108, 132, 0.28);
  border-radius: 999px;
  background: rgba(98, 108, 132, 0.12);
  color: inherit;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.28rem;
  cursor: pointer;
}

#menuRoot .menu-button span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

#menuRoot .menu-button[aria-expanded="true"] {
  background: rgba(98, 108, 132, 0.2);
}

#menuRoot .menu-popover {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  min-width: 8rem;
  padding: 0.35rem;
  border: 1px solid rgba(98, 108, 132, 0.18);
  border-radius: 1rem;
  background: rgba(248, 249, 252, 0.96);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  z-index: 20;
}

#menuRoot .menu-item {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0.7rem 0.9rem;
  border-radius: 0.75rem;
  text-align: left;
  cursor: pointer;
}

#menuRoot .menu-item:hover,
#menuRoot .menu-item.is-active {
  background: rgba(98, 108, 132, 0.12);
}

.view[hidden] {
  display: none;
}

#aboutView .about-panel {
  min-height: clamp(12rem, 28vh, 18rem);
  display: flex;
  align-items: flex-start;
}

#aboutView .about-panel p {
  margin: 0;
  line-height: 1.9;
  font-size: 1rem;
}

@media (max-width: 640px) {
  body .masthead__bar {
    align-items: flex-start;
  }

  body .masthead__bar h1 {
    flex: 1 1 auto;
  }
}
/* About chart sizing */
.about-chart {
  max-width: 100%;
}

.about-chart img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

.chart-detail-panel {
  max-width: 920px;
}

.chart-detail__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.chart-back-link {
  display: inline-block;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.chart-share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.42rem 0.78rem;
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 999px;
  background: #0f1419;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.chart-share-button:hover,
.chart-share-button:focus-visible {
  background: #263340;
  text-decoration: none;
}

.chart-share-button[hidden] {
  display: none;
}

.chart-back-link:hover,
.chart-back-link:focus-visible,
.chart-link:hover,
.chart-link:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.chart-link {
  color: inherit;
  text-decoration: none;
}

.chart-detail__title {
  margin: 0 0 20px;
  color: var(--ink);
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.chart-detail__level-difficulty {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.chart-detail__stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chart-detail__line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
}

.chart-detail__metric {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.chart-detail__label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.chart-detail__value {
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.chart-detail__note {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.chart-detail__label-group {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  cursor: help;
}

.chart-detail__info-mark {
  position: relative;
  display: inline-block;
  color: var(--muted);
  font-size: 0.55rem;
  line-height: 1;
  top: -0.45em;
  cursor: help;
}

.chart-detail__label-group[data-tooltip]::after,
.feature-chip[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: 0;
  display: none;
  width: max-content;
  max-width: min(320px, calc(100vw - 48px));
  padding: 8px 10px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  pointer-events: none;
}

.chart-detail__label-group[data-tooltip]:hover::after,
.chart-detail__label-group[data-tooltip]:focus::after,
.feature-chip[data-tooltip]:hover::after,
.feature-chip[data-tooltip]:focus::after {
  display: block;
}

.chart-detail__pred-block {
  width: min(100%, 560px);
  padding: 14px 16px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.chart-detail__title-note {
  display: inline-block;
  margin-left: 0.45em;
  vertical-align: baseline;
}

.chart-pred-position {
  width: min(100%, 520px);
  margin: 2px 0 8px;
}

.chart-pred-position__title {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.chart-pred-histogram {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 76px;
  padding: 0 2px;
  border-bottom: 1px solid var(--line);
}

.chart-pred-histogram__bar {
  flex: 1 1 0;
  min-width: 2px;
  border-radius: 3px 3px 0 0;
  background: rgba(100, 116, 139, 0.35);
}

.chart-pred-histogram__bar--current {
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2);
}

.chart-pred-position__axis {
  display: flex;
  justify-content: space-between;
  position: relative;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.2;
}

.chart-pred-position__axis--histogram {
  min-height: 1.2em;
}

.chart-pred-position__axis--histogram > span {
  position: absolute;
  transform: translateX(-50%);
  color: var(--numeric-color, var(--muted));
  font-weight: 400;
  white-space: nowrap;
}

.chart-pred-position__axis--histogram > .chart-pred-position__axis-label--start {
  transform: none;
}

.chart-pred-position__axis--histogram > .chart-pred-position__axis-label--end {
  transform: translateX(-100%);
}


.chart-detail__similar {
  margin-top: 30px;
}

.chart-detail__textage {
  margin-top: 24px;
}

.chart-detail__textage-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.textage-button {
  min-width: 3.2rem;
  padding: 0.45rem 0.78rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #6b7280;
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  text-decoration: none;
}

.textage-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.72;
}

.textage-button:not([aria-disabled="true"]) {
  cursor: pointer;
}

.textage-button:not([aria-disabled="true"]):hover,
.textage-button:not([aria-disabled="true"]):focus-visible {
  background: #4b5563;
  text-decoration: none;
  color: #fff;
}

.textage-note {
  color: var(--muted);
  font-size: 0.78rem;
}

.chart-detail__section-title {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
}

.chart-detail__similar thead th {
  padding: 11px 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.chart-detail__similar thead th:nth-child(1) {
  text-align: center;
}

.chart-detail__error {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 640px) {
  .chart-detail__line {
    gap: 8px 20px;
  }
}

/* Keep secondary numeric filters compact until they are explicitly opened. */
.advanced-filter {
  position: relative;
  display: grid;
  flex: 0 1 auto;
  gap: 8px;
  min-width: 150px;
}

.advanced-filter > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel-strong);
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.2;
  list-style: none;
  cursor: pointer;
}

.advanced-filter > summary::-webkit-details-marker {
  display: none;
}

.advanced-filter > summary::after {
  position: static;
  display: block;
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin: -4px 0 0 12px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  content: "";
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.advanced-filter[open] > summary {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.advanced-filter[open] > summary::after {
  margin-top: 4px;
  transform: rotate(225deg);
}

.advanced-filter__body {
  position: absolute;
  z-index: 6;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 270px;
  max-width: calc(100vw - 48px);
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.advanced-filter:not([open]) > .advanced-filter__body {
  display: none;
}

.advanced-filter__body .filter {
  min-width: 0;
  flex: 0 1 auto;
}

.advanced-filter__body .filter input {
  width: 100%;
  min-width: 0;
}

@media (max-width: 900px) {
  .toolbar > .advanced-filter {
    width: 100%;
    min-width: 0;
  }

  .advanced-filter__body {
    left: 0;
    right: auto;
    width: min(360px, 100%);
    max-width: calc(100vw - 48px);
  }
}

@media (max-width: 640px) {
  .advanced-filter__body {
    width: min(360px, calc(100vw - 48px));
  }
}

/* Keep mobile Level and Difficulty controls in one flexible row. */
@media (max-width: 640px) {
  .toolbar > .level-filter,
  .toolbar > .bpm-filter {
    flex: 1 1 calc(50% - 7px);
    width: calc(50% - 7px);
    min-width: 0;
  }
}

.feature-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
}

.feature-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.feature-chip[data-tooltip] {
  position: relative;
  cursor: help;
}
.feature-chip--plus-0 {
  color: #1d4ed8;
  background: rgba(96, 165, 250, 0.2);
  border-color: rgba(37, 99, 235, 0.24);
}

.feature-chip--plus-1 {
  color: #b91c1c;
  background: rgba(248, 113, 113, 0.28);
  border-color: rgba(220, 38, 38, 0.36);
}

.feature-chip--plus-2 {
  color: #7c3aed;
  background: rgba(167, 139, 250, 0.32);
  border-color: rgba(124, 58, 237, 0.4);
}

.feature-chip--plus-3 {
  color: #4c1d95;
  background: rgba(124, 58, 237, 0.46);
  border-color: rgba(91, 33, 182, 0.52);
}

/* Tune chart detail emphasis and feature presentation. */
.chart-detail__title {
  font-size: clamp(1.5rem, 3.5vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.chart-detail__difficulty {
  display: inline-flex;
  align-items: center;
  margin-left: 0.55em;
  padding: 0.28em 0.6em;
  border-radius: 999px;
  font-size: 0.42em;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
  vertical-align: 0.18em;
}

.chart-detail__level-difficulty .chart-detail__difficulty {
  margin-left: 0;
  font-size: 0.72rem;
  vertical-align: baseline;
}

#chartLevel,
#chartBpm {
  font-size: 1rem;
  font-weight: 600;
}

#chartPred {
  color: var(--numeric-color, var(--accent));
  font-size: 1.45rem;
  font-weight: 800;
}

.chart-detail__metric--feature {
  width: 100%;
  align-items: flex-start;
}

.chart-detail__feature-value {
  flex: 1 1 auto;
  min-width: 0;
}
.feature-chip--none {
  color: #475569;
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(100, 116, 139, 0.18);
}

.search > span,
.filter > span,
.multi-filter > span {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-transform: none;
  color: var(--muted);
}

.toolbar input,
.toolbar select,
.multi-filter__details > summary {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.2;
}

.chart-title-cell {
  font-weight: 400;
}

.chart-title-cell__name {
  font-weight: 700;
}

.chart-title-cell__difficulty {
  color: var(--muted);
  font-size: 0.75em;
  font-weight: 400;
  white-space: nowrap;
}

@media (min-width: 721px) {
  .feature-filter__name {
    overflow-wrap: normal;
    white-space: nowrap;
  }

  .feature-filter__mode {
    flex: 0 0 auto;
    min-width: max-content;
    white-space: nowrap;
  }

  .feature-filter .multi-filter__options {
    width: min(360px, calc(100vw - 48px));
    max-width: min(360px, calc(100vw - 48px));
  }
}
.numeric-value {
  color: var(--numeric-color, currentColor);
}

.numeric-value--level {
  color: var(--ink);
}

.numeric-value--pred {
  font-weight: 700;
}
