:root {
  --bg: #f3f6fb;
  --bg-muted: #e9eef7;
  --sidebar: #0f172a;
  --sidebar-border: rgba(148, 163, 184, 0.18);
  --panel: #ffffff;
  --panel-muted: #f8fafc;
  --border: #d7dee9;
  --border-strong: #bcc7d8;
  --text: #142033;
  --text-muted: #617086;
  --text-soft: #7b8799;
  --accent: #2457d6;
  --accent-soft: rgba(36, 87, 214, 0.12);
  --chart-size: 1rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  height: 100%;
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", "Noto Sans", sans-serif;
  overflow: hidden;
}

.page-shell {
  position: relative;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.page-shell.rail-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.show-rail-button {
  position: fixed;
  top: 1.2rem;
  left: 0.9rem;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 2.15rem;
  padding: 0 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
}

.page-shell.rail-collapsed .show-rail-button {
  display: inline-flex;
}

.song-rail {
  padding: 1rem;
  background: var(--sidebar);
  color: #f8fbff;
  border-right: 1px solid var(--sidebar-border);
  overflow-y: auto;
  overflow-x: hidden;
  transition: opacity 180ms ease, transform 180ms ease, padding 180ms ease, border-color 180ms ease;
}

.page-shell.rail-collapsed .song-rail {
  opacity: 0;
  transform: translateX(-18px);
  padding-left: 0;
  padding-right: 0;
  border-color: transparent;
}

.song-rail-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.rail-toggle {
  min-height: 1.95rem;
  padding: 0 0.7rem;
  border: 1px solid rgba(226, 232, 240, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #d9e2f2;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
}

.brand-block {
  margin-bottom: 1.2rem;
}

.brand-block h1 {
  margin: 0.15rem 0 0.35rem;
  font-size: clamp(1.85rem, 4vw, 2.55rem);
  line-height: 0.94;
  letter-spacing: -0.04em;
  font-weight: 800;
}

.home-link {
  color: inherit;
  text-decoration: none;
}

.home-link:hover,
.home-link:focus-visible {
  color: #ffffff;
  outline: none;
}

.eyebrow {
  margin: 0 0 0.6rem;
  color: #91b4ff;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.tagline {
  margin: 0;
  color: rgba(223, 232, 244, 0.76);
  font-size: 0.92rem;
  line-height: 1.45;
}

.search-wrap {
  display: grid;
  gap: 0.35rem;
  margin: 0 0 1rem;
}

.search-wrap span {
  color: #d8e3f6;
  font-size: 0.84rem;
  font-weight: 700;
}

.search-wrap input {
  width: 100%;
  min-height: 2.7rem;
  padding: 0 0.85rem;
  border: 1px solid rgba(226, 232, 240, 0.12);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  color: #f8fbff;
  font: inherit;
}

.search-wrap input::placeholder {
  color: rgba(223, 232, 244, 0.44);
}

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

.suggestion-panel {
  margin-top: 1rem;
  padding: 0.9rem;
  border: 1px solid rgba(226, 232, 240, 0.08);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.04);
}

.suggestion-panel-main {
  margin-top: 1.25rem;
  border-color: var(--border);
  background: rgba(248, 250, 252, 0.78);
}

.suggestion-panel-main .suggestion-copy p,
.suggestion-panel-main .suggestion-form span,
.suggestion-panel-main .suggestion-status {
  color: var(--text-muted);
}

.suggestion-panel-main .suggestion-kicker {
  color: var(--accent);
}

.suggestion-panel-main .suggestion-form input,
.suggestion-panel-main .suggestion-form textarea {
  border-color: var(--border);
  background: var(--panel);
  color: var(--text);
}

.suggestion-panel-main .suggestion-form input::placeholder,
.suggestion-panel-main .suggestion-form textarea::placeholder {
  color: var(--text-soft);
}

.suggestion-copy h2 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  line-height: 1.05;
}

.suggestion-copy p {
  margin: 0;
  color: rgba(223, 232, 244, 0.74);
  font-size: 0.88rem;
  line-height: 1.45;
}

.suggestion-kicker {
  margin: 0 0 0.45rem;
  color: #91b4ff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.suggestion-form {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.suggestion-form label {
  display: grid;
  gap: 0.28rem;
}

.suggestion-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.suggestion-form span {
  color: #d8e3f6;
  font-size: 0.78rem;
  font-weight: 700;
}

.suggestion-form input,
.suggestion-form textarea {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(226, 232, 240, 0.12);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  color: #f8fbff;
  font: inherit;
  resize: vertical;
}

.suggestion-form textarea {
  min-height: 9rem;
}

.suggestion-form input::placeholder,
.suggestion-form textarea::placeholder {
  color: rgba(223, 232, 244, 0.42);
}

.suggestion-submit {
  justify-self: start;
  min-width: 10rem;
}

.suggestion-status {
  min-height: 1.25rem;
  margin: 0;
  color: rgba(223, 232, 244, 0.72);
  font-size: 0.8rem;
  line-height: 1.4;
}

.suggestion-status[data-tone="success"] {
  color: #b7f3c4;
}

.suggestion-status[data-tone="warning"] {
  color: #f4dd9b;
}

.suggestion-status[data-tone="error"] {
  color: #ffb4b4;
}

.artist-group {
  border: 1px solid rgba(226, 232, 240, 0.08);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.artist-group[open] {
  background: rgba(255, 255, 255, 0.05);
}

.artist-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.75rem;
  cursor: pointer;
  list-style: none;
  border-bottom: 1px solid rgba(226, 232, 240, 0.06);
  background: rgba(15, 23, 42, 0.18);
}

.artist-summary::-webkit-details-marker {
  display: none;
}

.artist-name {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a8c1f7;
}

.artist-count {
  color: rgba(223, 232, 244, 0.52);
  font-size: 0.68rem;
  font-weight: 700;
}

.artist-songs {
  display: grid;
  gap: 0.16rem;
  padding: 0.3rem 0.35rem 0.35rem 0.7rem;
}

.song-link {
  display: block;
  padding: 0.42rem 0.55rem 0.42rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 0.72rem;
  color: inherit;
  text-decoration: none;
  position: relative;
}

.song-link::before {
  content: "";
  position: absolute;
  left: 0.18rem;
  top: 50%;
  width: 0.35rem;
  height: 1px;
  background: rgba(168, 193, 247, 0.38);
  transform: translateY(-50%);
}

.song-link:hover,
.song-link:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(226, 232, 240, 0.1);
  outline: none;
}

.song-link.active {
  background: var(--accent-soft);
  border-color: rgba(145, 180, 255, 0.35);
}

.song-link-title {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.92rem;
  color: #f4f7fd;
}

.song-stage {
  position: relative;
  padding: 1.25rem 1.35rem 1.5rem;
  height: 100vh;
  overflow-y: auto;
}

.page-shell.rail-collapsed .song-stage {
  padding-top: 4.15rem;
}

.song-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.song-header h2 {
  margin: 0;
  font-size: clamp(1.9rem, 5.4vw, 3.5rem);
  line-height: 0.96;
  letter-spacing: -0.045em;
  font-weight: 700;
}

.song-title-link {
  color: inherit;
  text-decoration: none;
}

.song-title-link:hover,
.song-title-link:focus-visible {
  color: inherit;
  outline: none;
}

.song-artist {
  margin: 0.45rem 0 0;
  color: var(--text-muted);
  font-size: 1.05rem;
  font-weight: 600;
}

.view-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.mobile-qr-toggle {
  display: none;
}

.font-pill {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  min-height: 2.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel);
}

.font-pill button {
  min-width: 3.1rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
}

#font-down {
  font-size: 0.8em;
}

.font-pill button + button {
  border-left: 1px solid var(--border);
}

.chord-helper {
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 1.05rem;
  background: var(--panel);
  overflow: hidden;
}

.chord-helper[hidden],
.chart-card[hidden],
.landing-card[hidden] {
  display: none;
}

.chord-helper-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.98rem;
  font-weight: 600;
}

.chord-helper-summary::-webkit-details-marker {
  display: none;
}

.chord-tool-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
  padding: 0 1rem 1rem;
}

.transpose-picker,
.capo-picker,
.instrument-picker,
.custom-key-picker,
.tool-action-group {
  display: grid;
  gap: 0.3rem;
  color: var(--text-muted);
  font-size: 0.77rem;
  font-weight: 600;
  position: relative;
}

.tool-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  position: relative;
  width: fit-content;
}

.help-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-muted);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
}

.help-copy {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  z-index: 12;
  max-width: 20rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.985);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.45;
}

.help-copy::before,
.help-copy::after {
  content: "";
  position: absolute;
  left: 0.9rem;
  width: 0;
  height: 0;
  border-left: 0.42rem solid transparent;
  border-right: 0.42rem solid transparent;
}

.help-copy::before {
  top: -0.55rem;
  border-bottom: 0.55rem solid var(--border);
}

.help-copy::after {
  top: -0.48rem;
  border-bottom: 0.5rem solid rgba(255, 255, 255, 0.985);
}

.help-copy[hidden] {
  display: none;
}

.help-copy-block {
  top: calc(100% + 0.7rem);
  left: 0.95rem;
  margin: 0;
}

.tool-action-group .help-copy {
  left: auto;
  right: 0;
}

.tool-action-group .help-copy::before,
.tool-action-group .help-copy::after {
  left: auto;
  right: 0.9rem;
}

.chord-shapes {
  position: relative;
}

.transpose-picker select,
.capo-picker select,
.instrument-picker select,
.custom-key-picker select,
.secondary-button {
  min-height: 2.7rem;
  padding: 0 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  box-shadow: none;
  appearance: none;
}

.transpose-picker select.instrument-target {
  border-color: rgba(36, 87, 214, 0.34);
  background: rgba(36, 87, 214, 0.1);
  color: var(--accent);
}

.secondary-button {
  min-width: 5.2rem;
  font-weight: 600;
}

.tool-row-action {
  margin-left: auto;
}

.tool-action-group .secondary-button {
  min-width: 5.2rem;
}

.mobile-qr-group {
  display: none;
}

.custom-key-wrap {
  display: flex;
  align-items: end;
  gap: 0.75rem;
  padding: 0 1rem 1rem;
}

.capo-hint {
  margin: 0;
  padding: 0 1rem 1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.chord-helper-controls {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem 1rem;
}

.chord-helper-count {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 500;
}

.chord-shapes {
  margin: 0 1rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.95rem;
  background: var(--panel-muted);
  overflow: hidden;
}

.chord-shapes[hidden] {
  display: none;
}

.chord-shapes-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.93rem;
  font-weight: 600;
}

.chord-shapes-summary::-webkit-details-marker {
  display: none;
}

.chord-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.8rem;
  padding: 0 0.95rem 0.95rem;
}

.chord-card {
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.95rem;
  background: var(--panel-muted);
}

.chord-card-title {
  margin: 0 0 0.4rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.chord-card-missing {
  display: grid;
  place-items: center;
  min-height: 150px;
}

.chord-card-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.chord-svg {
  width: 100%;
  height: auto;
}

.chord-string-line,
.chord-fret-line {
  stroke: #a0aec0;
  stroke-width: 1.5;
}

.chord-nut-line {
  stroke: #23354f;
  stroke-width: 4;
}

.chord-finger-dot {
  fill: var(--accent);
}

.chord-finger-label {
  fill: #ffffff;
  font-size: 8px;
  font-weight: 700;
}

.chord-svg-name,
.chord-svg-label,
.chord-svg-open,
.chord-svg-base {
  fill: #63748c;
  font-size: 9px;
  font-family: "SFMono-Regular", "JetBrains Mono", monospace;
}

.chord-svg-name {
  fill: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.chart-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 1.2rem;
  background: var(--panel);
}

.landing-card {
  margin-bottom: 1rem;
  padding: 1.2rem;
  border: 1px solid var(--border);
  border-radius: 1.2rem;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
}

.landing-kicker {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.landing-card h3 {
  margin: 0 0 0.8rem;
  max-width: 16ch;
  font-size: clamp(1.55rem, 3.8vw, 2.45rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.landing-copy {
  margin: 0 0 1rem;
  max-width: 60rem;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.55;
}

.landing-note {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.5;
}

.chart-body {
  display: grid;
  gap: 1rem;
  margin: 0;
}

.chart-body-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 1.15rem 1.35rem;
}

.chart-section {
  min-width: 0;
  margin: 0;
  overflow-x: auto;
  color: #231910;
  font-family: "SFMono-Regular", "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  font-size: var(--chart-size);
  line-height: 1.42;
  white-space: pre-wrap;
  tab-size: 2;
}

.qr-card {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: 148px;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.96);
}

.qr-image {
  display: block;
  width: 100%;
  border-radius: 0.55rem;
  background: #ffffff;
}

.show-rail-button:hover,
.show-rail-button:focus-visible,
.rail-toggle:hover,
.rail-toggle:focus-visible,
.song-link:hover,
.song-link:focus-visible,
.font-pill button:hover,
.font-pill button:focus-visible,
.transpose-picker select:hover,
.transpose-picker select:focus-visible,
.instrument-picker select:hover,
.instrument-picker select:focus-visible,
.help-toggle:hover,
.help-toggle:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible {
  outline: none;
}

@media (max-width: 860px) {
  .page-shell,
  .page-shell.rail-collapsed {
    grid-template-columns: 1fr;
    min-height: 100dvh;
  }

  .song-rail {
    border-right: 0;
    border-bottom: 0;
    min-height: 100dvh;
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  }

  .page-shell.mobile-home .song-stage,
  .page-shell.rail-collapsed .song-rail {
    display: none;
  }

  .page-shell.mobile-song .song-rail {
    display: none;
  }

  .page-shell.mobile-home .song-rail,
  .page-shell.mobile-song .song-stage {
    display: block;
  }

  .song-stage {
    padding-top: 1rem;
    padding-bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px));
    min-height: 100dvh;
  }

  .show-rail-button,
  .song-rail-top,
  .tagline,
  .landing-card {
    display: none;
  }

  .brand-block {
    margin-bottom: 1rem;
  }

  .brand-block h1 {
    margin-top: 0;
    font-size: 2.5rem;
  }

  .eyebrow {
    margin-bottom: 1rem;
  }

  .song-header {
    flex-direction: column;
    align-items: stretch;
  }

  .view-controls {
    justify-content: flex-start;
  }

  .mobile-qr-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 5.8rem;
  }

  .mobile-qr-group {
    display: grid;
  }

  .help-copy,
  .tool-action-group .help-copy,
  .help-copy-block {
    left: 0;
    right: auto;
    max-width: min(18rem, calc(100vw - 3rem));
  }

  .chord-tool-row,
  .chord-helper-controls,
  .chord-shapes-summary {
    flex-direction: column;
    align-items: stretch;
  }

  .transpose-picker select,
  .capo-picker select,
  .instrument-picker select,
  .custom-key-picker select,
  .secondary-button {
    width: 100%;
  }

  .chart-body-columns {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  .chart-section {
    font-size: calc(var(--chart-size) * 0.95);
  }

  .qr-card {
    display: none;
  }

  .page-shell.mobile-qr-visible .qr-card {
    display: block;
    position: fixed;
    right: 0.9rem;
    bottom: calc(5.75rem + env(safe-area-inset-bottom, 0px));
    width: 112px;
    padding: 0.45rem;
    z-index: 18;
  }

}

@media (max-width: 560px) {
  .song-rail,
  .song-stage {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  .brand-block h1 {
    font-size: 2rem;
  }

  .song-header h2 {
    font-size: 2.75rem;
  }
}
