.chord-lib-page {
  padding-bottom: 2rem;
}

.chord-lib-page .hub-header {
  padding: 1rem 1rem 0.75rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.chord-lib-page .hub-header-text {
  flex: 1;
  min-width: 0;
}

.cl-toc-toggle {
  flex-shrink: 0;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

@media (min-width: 900px) {
  .cl-toc-toggle {
    display: none;
  }
}

.cl-guide {
  margin: 0 1rem 0.75rem;
  padding: 0.75rem 0.9rem;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.55;
  color: #3730a3;
}

.cl-toolbar {
  padding: 0 1rem 0.75rem;
}

.cl-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.cl-search-icon {
  font-size: 0.9rem;
  opacity: 0.6;
}

.cl-search {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
}

.cl-layout {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 0 0 0 0;
}

.cl-toc {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  width: min(280px, 88vw);
  background: var(--surface);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
  transform: translateX(-100%);
  transition: transform 0.28s ease;
  overflow: hidden;
}

.cl-toc.is-open {
  transform: translateX(0);
}

@media (min-width: 900px) {
  .cl-toc {
    position: sticky;
    top: 0;
    transform: none;
    width: 240px;
    flex-shrink: 0;
    max-height: calc(100vh - 1rem);
    box-shadow: none;
    border-right: 1px solid var(--border);
    margin-left: 0;
  }
}

.cl-toc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 49;
  background: rgba(15, 23, 42, 0.35);
}

.cl-toc-backdrop[hidden] {
  display: none !important;
}

.cl-toc-inner {
  height: 100%;
  overflow-y: auto;
  padding: 0.75rem 0.65rem 2rem;
  -webkit-overflow-scrolling: touch;
}

body.cl-toc-open {
  overflow: hidden;
}

.cl-toc-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.75rem 0.5rem 0.35rem;
}

.cl-toc-group {
  margin-bottom: 0.5rem;
}

.cl-toc-group-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.5rem 0.5rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 0.88rem;
  font-weight: 800;
  font-family: inherit;
  text-align: left;
  color: var(--text);
  cursor: pointer;
}

.cl-toc-group-head:hover {
  background: var(--surface-2);
}

.cl-toc-group-head.is-active {
  background: var(--accent-light);
  color: #3730a3;
}

.cl-toc-chevron {
  font-size: 0.75rem;
  color: var(--muted);
  transition: transform 0.2s;
}

.cl-toc-group.is-expanded .cl-toc-chevron {
  transform: rotate(90deg);
}

.cl-toc-links {
  display: none;
  padding: 0 0 0.25rem 0.35rem;
}

.cl-toc-group.is-expanded .cl-toc-links {
  display: block;
}

.cl-toc-link {
  display: block;
  padding: 0.35rem 0.5rem 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-radius: 6px;
  border-left: 2px solid transparent;
}

.cl-toc-link:hover {
  color: var(--accent);
  background: var(--surface-2);
}

.cl-toc-link.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-light);
}

.cl-main {
  flex: 1;
  min-width: 0;
  padding: 0 1rem 2rem;
}

@media (min-width: 900px) {
  .cl-layout {
    padding-left: 0;
  }
  .cl-main {
    padding: 0 1.25rem 2rem 1rem;
  }
}

.cl-loading,
.cl-empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
  font-size: 0.9rem;
}

.cl-toc-section {
  scroll-margin-top: 1rem;
  margin-bottom: 2rem;
}

.cl-toc-section-head {
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 2px solid var(--accent-light);
}

.cl-toc-section-head h2 {
  font-size: 1.15rem;
  font-weight: 800;
}

.cl-toc-section-head p {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.25rem;
  line-height: 1.45;
}

.cl-chord-block {
  scroll-margin-top: 1rem;
  margin-bottom: 1.5rem;
}

.cl-chord-head h3 {
  font-size: 1.05rem;
  font-weight: 800;
}

.cl-chord-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.cl-voicing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.65rem;
  margin-top: 0.65rem;
}

.cl-voicing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.cl-voicing-card img {
  width: 100%;
  max-width: 130px;
  height: auto;
  object-fit: contain;
}

.cl-voicing-label {
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 0.45rem;
  line-height: 1.3;
}

.cl-voicing-notation {
  font-size: 0.7rem;
  font-family: ui-monospace, monospace;
  color: var(--muted);
  margin-top: 0.3rem;
}

.cl-voicing-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.cl-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}

.cl-tag--l1 {
  background: #ecfdf5;
  color: #047857;
}

.cl-tag--l2 {
  background: var(--accent-light);
  color: #3730a3;
}

.cl-tag--adv {
  background: #fef3c7;
  color: #b45309;
}

.cl-footer {
  margin-top: 1rem;
  padding: 1rem;
  text-align: center;
  font-size: 0.85rem;
}

.cl-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

@media (min-width: 640px) {
  .cl-voicing-grid {
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  }
}
