:root {
  --bg: #f6f4f2;
  --surface: #fff;
  --text: #1a1a1a;
  --muted: #5c5c5c;
  --border: #d8d4cf;
  --accent: #6b5344;
  --row-album: #e8f4ea;
  --row-single: #e8eef8;
  --row-other: #f5efe8;
  --focus: #2a6f97;
  font-family: "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.header {
  margin-bottom: 1.5rem;
}

.title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.filter {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.filter--grow {
  flex: 2 1 180px;
}

.filter--narrow {
  flex: 0 1 140px;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.filter-input,
.filter-select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.filter-input:focus,
.filter-select:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.filter--era-locked .filter-label,
.filter--category-locked .filter-label {
  color: #9a9590;
}

.filter-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #eceae7;
  color: var(--muted);
}

.combo {
  position: relative;
}

.suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 20;
  margin: 2px 0 0;
  padding: 0.25rem 0;
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.suggest li {
  padding: 0.4rem 0.65rem;
  font-size: 0.88rem;
  cursor: pointer;
}

.suggest li:hover,
.suggest li[aria-selected="true"] {
  background: #eef6f9;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.song-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  table-layout: auto;
}

.song-table th,
.song-table td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

.song-table thead th {
  background: #f0ebe5;
  font-weight: 600;
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.sort-btn:hover {
  color: var(--accent);
}

.sort-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.sort-ind::before {
  content: "◇";
  font-size: 0.65em;
  opacity: 0.35;
}

.sort-btn[data-dir="asc"] .sort-ind::before {
  content: "▲";
  opacity: 0.85;
}

.sort-btn[data-dir="desc"] .sort-ind::before {
  content: "▼";
  opacity: 0.85;
}

.song-table tbody tr {
  cursor: pointer;
  transition: filter 0.12s ease;
}

.song-table tbody tr:hover {
  filter: brightness(0.97);
}

.song-table tbody tr:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.song-table tbody tr.cat-album {
  background: var(--row-album);
}

.song-table tbody tr.cat-single {
  background: var(--row-single);
}

.song-table tbody tr.cat-other {
  background: var(--row-other);
}

.song-table tbody tr.is-selected {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.count {
  font-size: 0.85rem;
  color: var(--muted);
}

.count--above {
  margin: 0 0 0.5rem;
}

.detail {
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.detail[hidden] {
  display: none;
}

.detail-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.detail-dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  font-size: 0.9rem;
}

.detail-dl dt {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.detail-dl dd {
  margin: 0;
}

.detail-cluster-wrap .song-table tbody tr.row-cluster {
  cursor: default;
}

.detail-cluster-wrap .song-table tbody tr.row-cluster:hover {
  filter: none;
}

.detail-cluster-wrap .song-table tbody td.cluster-msg {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: normal;
}

.hint {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #fff8e6;
  border: 1px solid #e6c200;
  border-radius: 6px;
  font-size: 0.88rem;
}
