:root {
  --bg: #f7f5ef;
  --card: #fffdfa;
  --ink: #222;
  --muted: #6b665f;
  --line: #ded8ce;
  --border: #ded8ce;
  --accent: #7047eb;
  --note-bg: #fff3bf;
  --note-ink: #5c4400;
  --sheet-size: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: .75rem;
  justify-content: space-between;
  align-items: center;
  padding: .75rem clamp(1rem, 3vw, 2rem);
  background: rgba(255, 253, 250, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}

.actions {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button,
.back,
.song-card {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: .55rem .8rem;
  font: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

button:hover,
.back:hover,
.song-card:hover {
  border-color: var(--accent);
}

.app {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
}

.hero {
  margin: .5rem 0 1.25rem;
}

h1 {
  font-size: clamp(2rem, 6vw, 4.2rem);
  line-height: .95;
  margin: 0 0 .5rem;
}

.hero p {
  color: var(--muted);
  margin: 0 0 1rem;
}

.search {
  width: 100%;
  max-width: 680px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 1rem;
  padding: .9rem 1rem;
  font: inherit;
  font-size: 1.05rem;
}

.song-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
}

.song-card {
  display: block;
  border-radius: 1.1rem;
  padding: 1rem;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .035);
}

.song-card strong {
  display: block;
  font-size: 1.15rem;
}

.song-card span {
  color: var(--muted);
  font-size: .92rem;
}

.song-head {
  display: grid;
  gap: .8rem;
  margin-bottom: 1rem;
}

.back {
  justify-self: start;
  white-space: nowrap;
}

.song-title {
  margin: 0;
}

.meta,
.source {
  display: none;
}

.song-topbar {
  position: sticky;
  top: 52px;
  z-index: 15;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .6rem 0;
  margin-bottom: 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.song-topbar .back {
  margin: 0;
}

.transpose-panel {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

.song-topbar .transpose-panel {
  margin: 0;
  justify-content: flex-end;
}

.transpose-panel strong {
  white-space: nowrap;
}

.sheet {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  padding: clamp(1rem, 3vw, 2rem);
  overflow-x: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, .04);
}

.section {
  margin: 0 0 2rem;
}

.section:last-child {
  margin-bottom: 0;
}

.section h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
  padding-bottom: .4rem;
  margin: 0 0 1rem;
}

.note,
.notes {
  background: var(--note-bg);
  color: var(--note-ink);
  border-radius: .85rem;
  padding: .75rem .9rem;
  margin-bottom: .9rem;
  white-space: pre-wrap;
}

.linepair,
.song-line {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: var(--sheet-size);
  line-height: 1.25;
  margin: 0 0 .55rem;
  min-width: max-content;
}

.song {
  --sheet-font-size: var(--sheet-size);
}

.song-line {
  font-size: var(--sheet-font-size);
}

.chordline,
.lyricline,
.chords,
.lyrics {
  white-space: pre;
  margin: 0;
  font: inherit;
}

.chordline,
.chords {
  color: var(--accent);
  font-weight: 800;
  min-height: 1.25em;
}

.lyricline,
.lyrics {
  color: var(--ink);
}

body.hide-chords .chordline,
body.hide-chords .chords {
  display: none;
}

.home-section {
  margin: 0 0 2rem;
}

.home-section h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  margin: 0 0 .9rem;
}

.setlist-card {
  border-color: var(--accent);
}

.song-notes {
  display: inline-block;
  background: var(--note-bg);
  color: var(--note-ink);
  border-radius: .85rem;
  padding: .65rem .85rem;
  margin: .25rem 0 1.25rem;
  font-weight: 700;
  white-space: pre-wrap;
}

.setlist {
  display: grid;
  gap: .65rem;
  margin-top: 1.5rem;
}

.setlist-row {
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  gap: .75rem;
  align-items: start;
  padding: .9rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  color: var(--ink);
  text-decoration: none;
}

.setlist-row:hover {
  border-color: var(--accent);
}

.setlist-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.setlist-row strong {
  display: block;
  font-size: 1.1rem;
}

.setlist-row small {
  display: block;
  color: var(--muted);
  margin-top: .2rem;
  white-space: pre-wrap;
}

.empty {
  color: var(--muted);
  padding: 2rem 0;
}

@media (min-width: 700px) {
  .song-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .song-head {
    grid-template-columns: auto 1fr;
    align-items: center;
  }

  .song-title,
  .meta {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1050px) {
  .song-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  :root {
    --sheet-size: 19px;
  }
}

@media (max-width: 700px) {
  .song-topbar {
    top: 48px;
    align-items: flex-start;
    flex-direction: column;
  }

  .song-topbar .transpose-panel {
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .topbar {
    align-items: flex-start;
  }

  .actions button {
    padding: .45rem .58rem;
    font-size: .95rem;
  }

  .sheet {
    margin-left: -.25rem;
    margin-right: -.25rem;
  }
}

@media print {
  .topbar,
  .song-topbar,
  .back,
  .actions,
  .search {
    display: none !important;
  }

  body {
    background: white;
  }

  .app {
    width: 100%;
    padding: 0;
  }

  .sheet {
    border: 0;
    box-shadow: none;
    padding: 0;
  }
}