/* Sidebar YouTube button style */
html { overflow-y: scroll; }

.yt-trigger-sidebar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 18px 0 14px 0;
  padding: 12px 18px;
  border-radius: 32px;
  border: 1.5px solid #ff6b6b;
  background: linear-gradient(90deg, rgba(255,40,40,0.13) 0%, rgba(255,40,40,0.08) 100%);
  color: #ff6b6b;
  font-size: 1.08rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.yt-trigger-sidebar:hover {
  background: rgba(255,40,40,0.22);
  border-color: #ff6b6b;
  color: #fff;
}
.yt-trigger-sidebar .yt-icon {
  font-size: 1.2em;
  margin-right: 2px;
}
.yt-trigger-sidebar .yt-label {
  font-size: 1em;
  font-weight: 700;
  letter-spacing: 0.01em;
}
/* ── YouTube panel ─────────────────────────────── */
.yt-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  padding: 7px 14px;
  border-radius: 50px;
  border: 1px solid rgba(255, 61, 61, 0.45);
  background: rgba(255, 40, 40, 0.1);
  color: #ff6b6b;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.yt-trigger:hover {
  background: rgba(255, 40, 40, 0.2);
  border-color: rgba(255, 61, 61, 0.7);
}

.yt-icon {
  font-size: 11px;
}

.yt-panel {
  margin: 8px 0 18px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
}

.yt-embed-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
}

.yt-embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.yt-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.yt-fulllink {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}

.yt-fulllink:hover {
  color: var(--gold-bright);
}

.yt-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
}

.yt-close:hover {
  color: var(--text);
}
:root {
  --bg-top: #33466f;
  --bg-bottom: #41577d;
  --panel: #132746;
  --panel-border: rgba(255, 255, 255, 0.18);
  --text: #f5f7fb;
  --muted: #b9c0cf;
  --gold: #e2b95f;
  --gold-bright: #f0c45b;
  --dot: radial-gradient(circle at 28% 22%, #fff3b9, #f0c45b 72%);
  --dot-dim: radial-gradient(circle at 30% 24%, rgba(255, 245, 196, 0.88), rgba(196, 206, 224, 0.52) 78%);
  --grid: rgba(255, 255, 255, 0.08);
  --barline: rgba(255, 255, 255, 0.22);
  --active-glow: rgba(240, 196, 91, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
   padding: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(111, 87, 255, 0.1), transparent 30%),
    radial-gradient(circle at top right, rgba(90, 170, 220, 0.08), transparent 24%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

.page-brand {
  max-width: 1320px;
  margin: 0 auto 14px;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 14px 0;
  margin-bottom: 14px;
  background: none;
  height: 64px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.nav-inner {
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.nav-logo {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  white-space: nowrap;
}

.logo-dot {
  color: var(--text);
}

.logo-beat {
  color: var(--gold);
}

.logo-tm {
  display: inline-block;
  margin-left: 1px;
  font-size: 13px;
  color: var(--text);
  opacity: 0.9;
  vertical-align: text-top;
  transform: translateY(-0.14em);
}

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

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 16px;
  color: var(--muted);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 14px;
  font-weight: 600;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  outline: none;
}

.nav-link.active {
  color: var(--text);
  background: linear-gradient(180deg, rgba(240, 196, 91, 0.18), rgba(240, 196, 91, 0.08));
  border-color: rgba(240, 196, 91, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 20px rgba(15, 23, 42, 0.16);
}

.layout {
  max-width: 1320px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(400px, 1fr) 200px;
  gap: 20px;
  align-items: start;
}


.sheet,
.sidebar {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.sheet {
  border-radius: 24px;
  padding: 26px 28px 22px;
  min-width: 340px;
}

.sidebar {
  border-radius: 20px;
  padding: 18px 14px;
  max-width: 200px;
  min-width: 0;
  overflow-x: auto;
}

.title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 10px;
}

.title-block h1 {
  margin: 0 0 6px;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 10px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  font-size: 13px;
}

.meta-pill strong {
  color: var(--gold-bright);
}

.song-meta {
  min-width: 150px;
  text-align: right;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.song-meta strong {
  color: var(--gold-bright);
  font-weight: 700;
}

.hero-play {
  display: flex;
  justify-content: flex-start;
  margin: 16px 0 10px;
}

.controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 20px;
}

.btn {
  border: 0;
  border-radius: 16px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-play {
  min-width: 184px;
  min-height: 56px;
  padding: 0 28px;
  font-size: 18px;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, #f7d06a, #e0a020);
  color: #1b2137;
  box-shadow: 0 14px 28px rgba(255, 161, 35, 0.22), 0 0 26px rgba(255, 161, 35, 0.18);
}

.btn-stop {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.btn-dev {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.btn-dev:hover,
.btn-dev.is-active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.tempo-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 14px;
}

.tempo-pill strong {
  color: var(--gold-bright);
}

.tempo-btn {
  border: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.tempo-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.toggle input[type="checkbox"] {
  accent-color: var(--gold-bright);
  cursor: pointer;
}

.song-index-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 4px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.source-panel {
  margin: -4px 0 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.source-panel-title {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--gold-bright);
}

.source-grid {
  display: grid;
  gap: 8px;
}

.source-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.source-row strong {
  color: var(--text);
}

.song-index-link strong {
  color: var(--gold-bright);
}

.instruction {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
}

.next-step-prompt {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: -6px 0 22px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.next-step-prompt.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.next-step-copy {
  display: grid;
  gap: 4px;
}

.next-step-copy strong {
  color: var(--gold-bright);
  font-size: 14px;
}

.next-step-copy span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.next-step-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.next-step-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.section + .section {
  margin-top: 24px;
}

.section-title {
  margin: 0 0 12px;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.section-title span {
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}

.song-line {
  padding: 8px 10px 10px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01));
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.song-line + .song-line {
  margin-top: 18px;
}

.measures {
  --measure-gap: 10px;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--measure-gap);
}

.line-playhead {
  position: absolute;
  top: 6px;
  bottom: 8px;
  width: 2px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(250, 250, 255, 0.42), rgba(240, 196, 91, 0.28));
  box-shadow: 0 0 16px rgba(240, 196, 91, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateX(0);
  transition: opacity 0.15s ease;
}

.measure {
  position: relative;
  min-width: 0;
  flex: 0 0 calc(((100% - (3 * var(--measure-gap))) / 4) * var(--measure-ratio, 1));
  padding: 24px 8px 0 0;
  transition: box-shadow 0.16s ease, transform 0.16s ease;
}

.measure.pickup {
  opacity: 0.94;
}

.measure.pickup[data-chord=""] {
  padding-top: 12px;
}

.measure.pickup[data-chord=""] .chord-rail {
  min-height: 8px;
}

.measure.pickup[data-chord=""] .timeline {
  min-height: 46px;
  padding-top: 0;
}

.measure.pickup[data-chord=""] .timeline::before {
  top: 6%;
  height: 82%;
}

.measure.pickup .timeline::before {
  content: "";
  position: absolute;
  top: 12%;
  left: 0;
  width: 1px;
  height: 76%;
  background: rgba(255, 255, 255, 0.09);
}

.measure.current {
  box-shadow: 0 10px 22px rgba(240, 196, 91, 0.08);
  transform: translateY(-1px);
}

.chord-rail {
  position: absolute;
  top: 0;
  left: 0;
  right: 8px;
  min-height: 20px;
}

.chord-change {
  position: absolute;
  top: 0;
  left: calc((var(--chord-step, 1) - 0.5) * (100% / var(--timeline-steps, 8)));
  transform: translateX(-50%);
  color: var(--gold-bright);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.chord-change.is-late {
  top: 2px;
  font-size: 17px;
  color: #ffe19a;
}

.chord-change.is-late::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 22px;
  width: 1px;
  height: 14px;
  transform: translateX(-50%);
  background: rgba(240, 196, 91, 0.75);
  box-shadow: 0 0 8px rgba(240, 196, 91, 0.22);
}

.timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--timeline-steps, 8), minmax(0, 1fr));
  align-items: start;
  min-height: 54px;
  gap: 4px;
  padding-top: 6px;
  padding-right: 4px;
  overflow: hidden;
  white-space: nowrap;
  background:
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent calc(var(--beat-width, 25%) - 1px),
      rgba(255, 255, 255, 0.04) calc(var(--beat-width, 25%) - 1px),
      rgba(255, 255, 255, 0.04) var(--beat-width, 25%)
    );
}

.timeline::after {
  content: "";
  position: absolute;
  top: 10%;
  right: 0;
  width: 1px;
  height: 80%;
  background: var(--barline);
}

.rest-slot {
  align-self: start;
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  transform: translateY(18px);
  color: rgba(255, 255, 255, 0.16);
  font-size: 12px;
  line-height: 1;
  font-weight: 600;
  pointer-events: none;
  user-select: none;
}

.stroke {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-self: center;
  gap: 3px;
  margin-top: 0;
  opacity: 0.92;
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.stroke-dot {
  width: var(--dot-size, 12px);
  height: var(--dot-size, 12px);
  border-radius: 50%;
  background: var(--dot);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.72),
    0 10px 22px rgba(7, 14, 30, 0.5);
  transition: transform 0.14s ease, background 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}

.stroke-arrow {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  line-height: 1;
}

.stroke.ghost {
  opacity: 0.52;
}

.stroke.ghost .stroke-dot {
  background: var(--dot-dim);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.28),
    0 8px 16px rgba(7, 14, 30, 0.24);
}

.stroke.strong .stroke-arrow {
  color: rgba(255, 255, 255, 0.9);
}

.stroke.active {
  opacity: 1;
  transform: translateY(-1px);
}

.stroke.active .stroke-dot {
  background: var(--gold-bright);
  box-shadow:
    0 0 0 4px var(--active-glow),
    0 0 22px rgba(255, 179, 71, 0.42);
  transform: scale(1.08);
}

.stroke.active .stroke-arrow {
  color: var(--gold-bright);
}

.lyrics {
  margin-top: 4px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}

.sidebar-title {
  margin: 0 0 12px;
  color: var(--gold-bright);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chord-list {
  display: grid;
  gap: 12px;
}

.chord-card {
  display: grid;
  border-radius: 16px;
  padding: 14px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.chord-card.active {
  background: rgba(240, 196, 91, 0.08);
  border-color: rgba(240, 196, 91, 0.42);
  box-shadow: 0 12px 28px rgba(240, 196, 91, 0.12);
  transform: translateY(-1px);
}

.chord-card-name {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.chord-card-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.chord-diagram {
  width: 100%;
  max-width: 92px;
  display: block;
  margin: 0 auto;
}

.diagram-grid,
.diagram-top {
  stroke: rgba(255, 255, 255, 0.24);
  stroke-width: 1.4;
}

.diagram-top {
  stroke-width: 2.4;
}

.diagram-dot {
  fill: var(--gold-bright);
}

.diagram-finger {
  fill: #1b2137;
  font-size: 8px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
}

.diagram-open {
  fill: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  text-anchor: middle;
}

.empty-state {
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
  }

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

@media (max-width: 760px) {
  .sheet {
    padding: 22px 20px 20px;
  }

  .nav-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .title-row {
    flex-direction: column;
  }

  .song-meta {
    text-align: left;
  }

  .controls {
    gap: 10px;
  }

  .hero-play {
    margin: 14px 0 10px;
  }

  .source-row {
    grid-template-columns: 120px minmax(0, 1fr);
  }

  .btn,
  .tempo-pill,
  .song-index-link {
    min-height: 44px;
  }

  .btn-play {
    min-width: 168px;
    min-height: 52px;
    font-size: 17px;
  }

  .meta-grid {
    gap: 6px;
  }

  .next-step-prompt {
    align-items: flex-start;
  }

  .meta-pill {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  .measures {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
  }

  .measure {
    flex: 0 0 calc(min(260px, 78vw) * var(--measure-ratio, 1));
    scroll-snap-align: start;
  }
}

@media (max-width: 560px) {
  body {
    padding: 12px;
  }

  .sheet,
  .sidebar {
    padding: 18px;
  }

  .title-block h1 {
    font-size: 28px;
  }

  .subtitle,
  .instruction,
  .lyrics {
    font-size: 14px;
  }

  .brand {
    font-size: 22px;
  }

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

  .measure {
    flex-basis: calc(min(250px, 82vw) * var(--measure-ratio, 1));
  }
}
