/* Read-only explorer timeline (light theme) */

body.explorer-page {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.explorer-page .site-header {
  flex-shrink: 0;
}

.explorer-page .site-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 0.75rem 1.25rem 0.5rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.explorer-page .site-footer {
  flex-shrink: 0;
  padding: 0.6rem 1.25rem 0.75rem;
  margin: 0;
}

.explorer-layout {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 1rem;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  align-items: stretch;
  margin-bottom: 0.5rem;
}

@media (orientation: portrait) and (min-width: 861px) and (max-height: 1100px) {
  #waveform-wrap {
    flex: 1 1 0;
    min-height: 80px;
  }

  #lanes-panel {
    flex: 1 1 0;
  }
}

@media (max-width: 860px) {
  body.explorer-page {
    height: 100dvh;
    height: 100vh;
  }

  .explorer-page .site-main {
    padding: 0.5rem 0.75rem 0.45rem;
  }

  .explorer-page .site-footer {
    padding: 0.45rem 0.75rem 0.55rem;
    font-size: 0.78rem;
    line-height: 1.35;
  }

  .explorer-layout {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-height: 0;
    height: auto;
  }

  /* Song list above, timeline viewer below */
  .explorer-sidebar {
    order: 1;
    flex: 0 0 auto;
    height: auto;
    max-height: min(38vh, 300px);
  }

  .explorer-main {
    order: 2;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
  }

  .explorer-toolbar h2 {
    font-size: 1.05rem;
  }

  .transport input[type="range"] {
    min-width: 0;
  }

  #time-display {
    min-width: 0;
    font-size: 0.82rem;
  }

  #timeline-editor {
    min-height: 220px;
  }

  #waveform-wrap {
    flex: 1 1 0;
    min-height: 72px;
  }

  #lanes-panel {
    flex: 1 1 0;
  }
}

@media (max-width: 480px) {
  .explorer-page .site-main {
    padding: 0.45rem 0.6rem 0;
  }

  .explorer-sidebar {
    max-height: min(36vh, 260px);
    padding: 0.65rem;
  }

  .explorer-toolbar {
    padding: 0.6rem 0.7rem;
  }

  .explorer-toolbar-head {
    align-items: flex-start;
    gap: 0.35rem;
  }

  .transport {
    display: grid;
    grid-template-columns: repeat(4, 2.25rem) 1fr;
    align-items: center;
    gap: 0.4rem;
  }

  .transport input[type="range"] {
    min-width: 0;
  }

  .seek-wrap {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  #time-display {
    grid-column: 1 / -1;
    text-align: center;
    width: 100%;
  }

  .ann-detail {
    grid-template-columns: 1fr;
    gap: 0.15rem 0;
  }

  .ann-detail dt {
    margin-top: 0.35rem;
  }

  .ann-detail dt:first-child {
    margin-top: 0;
  }
}

.explorer-sidebar {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  height: 100%;
  min-height: 0;
}

.sidebar-search-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.sidebar-search-row input[type="search"] {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
}

.sidebar-mix-note {
  margin: 0;
  flex-shrink: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.filter-open-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
}

.filter-open-btn svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

.filter-open-btn:hover {
  border-color: color-mix(in srgb, var(--brand-primary) 35%, var(--border-subtle));
  color: var(--brand-primary);
}

.filter-open-btn.is-active {
  border-color: color-mix(in srgb, var(--brand-primary) 45%, var(--border-subtle));
  background: var(--vermilion-soft);
  color: var(--brand-deep);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.filter-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.filter-modal[hidden] {
  display: none;
}

body.filter-modal-open {
  overflow: hidden;
}

.filter-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(28, 19, 21, 0.45);
  cursor: pointer;
}

.filter-modal-panel {
  position: relative;
  width: min(100%, 420px);
  max-height: min(90vh, 640px);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.filter-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.filter-modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.filter-modal-close {
  border: 0;
  background: transparent;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 0;
}

.filter-modal-close svg {
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.filter-modal-close:hover {
  color: var(--text-primary);
}

.filter-modal-body {
  padding: 0.85rem 1.1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.filter-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-main);
}

.filter-done-btn {
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.filter-group + .filter-group {
  padding-top: 0.55rem;
  border-top: 1px solid var(--border-subtle);
}

.filter-group-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.filter-reset {
  border: 0;
  background: transparent;
  color: var(--brand-primary);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}

.filter-reset:hover {
  color: var(--brand-deep);
}

.filter-field label,
.filter-field-title {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.filter-modal select {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
}

.musician-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.musician-filter-head .filter-field-title {
  margin-bottom: 0;
}

.check-inline {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.musician-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 11rem;
  overflow-y: auto;
  padding: 0.35rem 0;
}

.musician-checkboxes label {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  margin: 0;
}

.song-list-label {
  margin: 0;
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.song-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  border-top: 1px solid var(--border-subtle);
}

.song-list li button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  font: inherit;
  color: var(--text-primary);
}

.song-list li button:hover,
.song-list li button.active {
  background: var(--gold-soft);
}

.song-list .song-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}

.song-list .song-list-main {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex: 1 1 auto;
}

.song-list .song-id {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.song-list .chip-protocol {
  flex-shrink: 0;
  padding: 0.1rem 0.35rem;
  font-size: 0.65rem;
  min-width: 1.25rem;
  text-align: center;
  line-height: 1.2;
}

.song-list .title {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
  font-size: 0.88rem;
}

.explorer-main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.explorer-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
}

.explorer-toolbar-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.explorer-toolbar h2 {
  margin: 0;
  font-size: 1.25rem;
  flex: 1;
}

.explorer-notice {
  margin: 0;
  font-size: 0.85rem;
  color: var(--brand-deep);
}

.explorer-notice[hidden] {
  display: none;
}

.transport {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  width: 100%;
}

.transport-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: var(--radius);
  cursor: pointer;
}

.transport-btn svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

#play-pause-btn .transport-icon-play {
  margin-left: 0.1rem;
}

#follow-playhead-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

#metronome-btn svg {
  width: 1.2rem;
  height: 1.2rem;
}

#metronome-btn.is-active {
  background: var(--vermilion-soft);
  border-color: var(--brand-primary);
  color: var(--brand-deep);
}

.transport-btn .hidden {
  display: none !important;
}

.transport-btn.is-active {
  background: var(--vermilion-soft);
  border-color: var(--brand-primary);
  color: var(--brand-deep);
}

.transport-btn:hover {
  border-color: var(--text-primary);
}

.transport input[type="range"] {
  flex: 1;
  min-width: 120px;
  width: 100%;
}

.seek-wrap {
  flex: 1;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 32px;
  justify-content: center;
}

.seek-markers {
  position: relative;
  height: 20px;
  margin: 0 2px;
}

.seek-markers.is-empty {
  height: 0;
  margin: 0;
}

.seek-marker {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--brand-primary);
  cursor: pointer;
  z-index: 2;
}

.seek-marker-icon {
  width: 15px;
  height: 15px;
  fill: currentColor;
  display: block;
  filter: drop-shadow(0 1px 1px rgba(28, 19, 21, 0.2));
}

.seek-marker:hover {
  color: var(--brand-deep);
}

.seek-marker:hover .seek-marker-icon {
  width: 17px;
  height: 17px;
}

#time-display {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  color: var(--text-muted);
  min-width: 7.5rem;
}

#timeline-editor {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.timeline-viewport {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.timeline-viewport::-webkit-scrollbar {
  display: none;
  height: 0;
}

.timeline-inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.timeline-scroll {
  flex: 0 0 auto;
  overflow-x: auto;
  overflow-y: hidden;
  height: 14px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-main);
}

.timeline-scroll-spacer {
  height: 1px;
  pointer-events: none;
}

#waveform-wrap {
  position: relative;
  overflow: hidden;
  flex: 3 1 0;
  min-height: 120px;
  border-bottom: 1px solid var(--border-subtle);
  background: #f3ebe0;
  cursor: crosshair;
  display: flex;
  align-items: stretch;
}

#waveform {
  display: block;
  height: 100%;
  min-height: 100%;
}

.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--brand-primary);
  pointer-events: none;
  z-index: 5;
}

#lanes-panel {
  overflow: hidden;
  flex: 2 1 0;
  min-height: 0;
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
}

#lanes {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
}

.lane {
  display: flex;
  align-items: stretch;
  min-height: 0;
  border-bottom: 1px solid var(--border-subtle);
}

.lane:last-child {
  border-bottom: 0;
}

.lane-label {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 96px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-main);
  box-shadow: 1px 0 0 var(--border-subtle);
  align-self: stretch;
}

.lane-track {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  align-items: center;
}

.lane-track-inner {
  position: relative;
  flex-shrink: 0;
}

.block {
  position: absolute;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0 0.35rem;
  overflow: hidden;
  white-space: nowrap;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  line-height: 1.2;
}

.block.block-clickable {
  cursor: pointer;
}

.block.block-clickable:hover {
  filter: brightness(0.97);
  box-shadow: inset 0 0 0 1px rgba(28, 19, 21, 0.12);
}

.ann-detail {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(7rem, 38%) 1fr;
  gap: 0.35rem 0.75rem;
  font-size: 0.9rem;
}

.ann-detail dt {
  margin: 0;
  font-weight: 600;
  color: var(--text-muted);
}

.ann-detail dd {
  margin: 0;
  color: var(--text-primary);
}

.ann-detail-list {
  margin: 0;
  padding-left: 1.1rem;
}

.ann-detail-list li {
  margin: 0.15rem 0;
}

.ann-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.ann-tag {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  background: var(--gold-soft);
  color: var(--text-primary);
}

.ann-detail-chord dd:not(.ann-tag-list) {
  line-height: 1.45;
}

.ann-detail-section dd:not(.ann-tag-list) {
  line-height: 1.45;
}

