:root {
  color-scheme: dark;
  --bg: #05070d;
  --panel: #111722;
  --panel-strong: #171a2d;
  --line: #293142;
  --text: #f6f7fb;
  --muted: #a8adbb;
  --accent: #8c63ff;
  --accent-strong: #6237df;
  --warn: #ffb454;
  --shadow: rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(140, 99, 255, 0.22), transparent 28rem),
    linear-gradient(145deg, #06080f 0%, #101521 48%, #05070d 100%);
}

button,
input {
  font: inherit;
}

.shell {
  width: 100%;
  max-width: 54rem;
  min-height: 100vh;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 2.5rem);
}

.masthead {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.brand-mark,
.player-art,
.footer-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: white;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  box-shadow: 0 1rem 2rem var(--shadow);
}

.brand-mark {
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 0.7rem;
  font-size: 2.5rem;
}

.masthead h1,
.player-copy h2 {
  margin: 0;
  letter-spacing: 0;
}

.masthead h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.05;
}

.masthead p,
.player-copy p,
.footer,
.section-header span {
  color: var(--muted);
}

.masthead p {
  margin: 0.35rem 0 0;
  font-size: 1.15rem;
}

.view-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0 0 1.25rem;
}

.view-link {
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
}

.view-link.is-active {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.35rem;
}

.search {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 4rem;
  padding: 0 1.1rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: rgba(18, 24, 36, 0.82);
}

.search span {
  color: var(--muted);
  font-size: 2rem;
  line-height: 1;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 1.25rem;
}

.search input::placeholder {
  color: #8e95a6;
}

.section {
  margin-top: 2rem;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.section h2 {
  margin: 0 0 0.95rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.song-list {
  display: grid;
  gap: 0.9rem;
}

.song-card {
  display: grid;
  grid-template-columns: 3.7rem 1fr auto;
  align-items: center;
  gap: 1rem;
  width: 100%;
  min-height: 6.4rem;
  padding: 1rem;
  border: 1px solid transparent;
  border-radius: 0.9rem;
  color: var(--text);
  text-align: left;
  background: rgba(19, 25, 38, 0.82);
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.song-card.is-active {
  border-color: var(--accent);
  background: linear-gradient(145deg, rgba(140, 99, 255, 0.18), rgba(18, 24, 36, 0.88));
}

.song-icon {
  display: grid;
  place-items: center;
  width: 3.7rem;
  height: 3.7rem;
  border-radius: 0.65rem;
  background: linear-gradient(145deg, var(--accent), #312579);
  font-size: 2rem;
}

.song-title {
  display: block;
  font-size: 1.18rem;
  font-weight: 800;
  line-height: 1.2;
}

.song-meta {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.song-arrow {
  color: var(--accent);
  font-size: 2.25rem;
  line-height: 1;
}

.key-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.key-button {
  position: relative;
  min-width: 4rem;
  min-height: 3.8rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  color: var(--text);
  background: rgba(20, 26, 38, 0.88);
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
}

.key-button.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(140, 99, 255, 0.16);
}

.key-button.is-setlist {
  border-color: rgba(140, 99, 255, 0.55);
}

.key-setlist-mark {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
}

.setlist-note {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.95rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.setlist-note::before {
  content: "";
  flex: 0 0 auto;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
}

.setlist-note.is-mismatch {
  color: var(--warn);
}

.setlist-note.is-mismatch::before {
  background: var(--warn);
}

.player-panel {
  display: grid;
  grid-template-columns: 5.6rem 1fr;
  gap: 1.15rem;
  margin-top: 1.8rem;
  padding: 1.4rem;
  border: 1px solid rgba(140, 99, 255, 0.28);
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(39, 34, 78, 0.92), rgba(14, 20, 33, 0.95));
  box-shadow: 0 1.2rem 2.4rem rgba(0, 0, 0, 0.28);
}

.player-art {
  width: 5.6rem;
  height: 5.6rem;
  border-radius: 0.7rem;
  font-size: 3rem;
}

.player-copy h2 {
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  line-height: 1.15;
}

.player-copy p {
  margin: 0.4rem 0 0;
  overflow-wrap: anywhere;
}

#selectedKey {
  color: var(--accent);
  font-weight: 800;
}

audio {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 0.4rem;
}

.footer {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: 1.2rem;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.85rem;
  background: rgba(10, 14, 22, 0.58);
}

.footer-icon {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.55rem;
  font-size: 0.8rem;
}

.empty {
  padding: 1.25rem;
  border: 1px dashed var(--line);
  border-radius: 0.8rem;
  color: var(--muted);
  background: rgba(17, 23, 34, 0.64);
}

@media (max-width: 34rem) {
  .shell {
    padding: 1.3rem 1rem 1.5rem;
  }

  .masthead {
    gap: 0.85rem;
  }

  .brand-mark {
    width: 3.9rem;
    height: 3.9rem;
  }

  .masthead h1 {
    font-size: 2rem;
  }

  .masthead p {
    font-size: 1rem;
  }

  .search {
    min-height: 3.75rem;
  }

  .section-header {
    align-items: center;
  }

  .section h2 {
    margin-bottom: 0.8rem;
  }

  .song-card {
    grid-template-columns: 3.2rem 1fr auto;
    min-height: 5.8rem;
    padding: 0.9rem;
  }

  .song-title {
    font-size: 1.05rem;
  }

  .song-meta {
    font-size: 0.92rem;
  }

  .song-icon {
    width: 3.2rem;
    height: 3.2rem;
  }

  .key-button {
    min-width: 3.4rem;
  }

  .player-panel {
    grid-template-columns: 1fr;
  }
}
