:root {
  color-scheme: light;
  --ink: #151515;
  --ink-soft: #484642;
  --muted: #6f6b64;
  --paper: #f4f0e7;
  --paper-raised: #faf7f0;
  --paper-muted: #e9e4da;
  --line: rgba(21, 21, 21, 0.92);
  --line-soft: rgba(21, 21, 21, 0.28);
  --focus: 3px solid rgba(21, 21, 21, 0.28);
  --shadow: 4px 5px 0 rgba(21, 21, 21, 0.12);
  --shadow-large: 8px 9px 0 rgba(21, 21, 21, 0.18);
  --sidebar-width: 258px;
  --content-width: 1180px;
  --radius: 2px;
  --hand: "Patrick Hand", "Comic Sans MS", cursive;
  --mono: "Space Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--hand);
  font-size: 18px;
  line-height: 1.35;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  z-index: 100;
  inset: 0;
  pointer-events: none;
  opacity: 0.24;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button,
a,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border-radius: 0;
}

img,
svg {
  display: block;
  max-width: 100%;
}

::selection {
  color: var(--paper);
  background: var(--ink);
}

:focus-visible {
  outline: var(--focus);
  outline-offset: 3px;
}

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

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  padding: 9px 13px;
  border: 1.5px solid var(--line);
  background: var(--paper-raised);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 38px 24px 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1.5px solid var(--line);
  background: rgba(244, 240, 231, 0.9);
  backdrop-filter: blur(3px);
}

.brand {
  width: fit-content;
  margin: 0 0 48px 10px;
  display: inline-flex;
  flex-direction: column;
  font-size: 29px;
  line-height: 0.92;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  transform: rotate(-1deg);
}

.brand::after {
  content: "";
  width: 94%;
  height: 6px;
  margin-top: 13px;
  background: var(--ink);
  clip-path: polygon(0 32%, 100% 0, 96% 70%, 4% 100%);
}

.primary-nav {
  margin-inline: -24px;
  display: grid;
  border-top: 1.5px solid var(--line);
  border-bottom: 1.5px solid var(--line);
}

.primary-nav a {
  width: 100%;
  min-height: 48px;
  padding: 10px 34px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1.5px solid var(--line);
  transition: background 120ms ease, padding-left 120ms ease;
}

.primary-nav a:last-child {
  border-bottom: 0;
}

.primary-nav a:hover,
.primary-nav a.active,
.primary-nav a[aria-current="page"] {
  background: var(--paper-muted);
  padding-left: 38px;
}

.nav-icon {
  width: 22px;
  display: inline-grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
}

.folder-nav {
  min-height: 0;
  margin-top: 36px;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.section-heading {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1.5px solid var(--line);
}

.section-heading h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.folder-list {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.folder-link {
  min-height: 39px;
  padding: 8px 4px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 16px;
}

.folder-link:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.sidebar-footer {
  padding-top: 18px;
}

.sidebar-note {
  margin: 0 4px 18px;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: rotate(-2deg);
}

.local-note {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}


.nav-icon-filled {
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 20;
}

.local-note span {
  margin-right: 4px;
  font-size: 7px;
}

.main-panel {
  min-width: 0;
  padding: 42px clamp(24px, 4vw, 58px) 84px;
}

.main-panel > * {
  width: min(100%, var(--content-width));
  margin-inline: auto;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-bottom: 42px;
}

.global-search {
  min-width: 0;
  min-height: 49px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.15);
  transform: rotate(0.06deg);
}

.global-search:focus-within {
  box-shadow: var(--shadow);
}

.global-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.global-search input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.global-search kbd {
  padding: 1px 6px;
  border: 1px solid var(--line-soft);
  color: var(--muted);
  background: transparent;
  font-family: var(--mono);
  font-size: 10px;
}

.status-message:empty {
  display: none;
}

.status-message {
  margin-bottom: 18px;
  padding: 9px 12px;
  border-left: 4px solid var(--ink);
  background: var(--paper-muted);
}

.button {
  min-height: 43px;
  padding: 9px 16px;
  border: 1.5px solid var(--line);
  background: transparent;
  box-shadow: 2px 3px 0 rgba(21, 21, 21, 0.1);
  cursor: pointer;
  transition: transform 100ms ease, box-shadow 100ms ease;
}

.button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 5px 0 rgba(21, 21, 21, 0.12);
}

.button:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

.button-dark {
  color: var(--paper);
  background: var(--ink);
}

.icon-button {
  min-width: 36px;
  min-height: 36px;
  padding: 5px;
  border: 0;
  display: inline-grid;
  place-items: center;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover {
  background: var(--paper-muted);
}

.text-button {
  padding: 4px 2px;
  border: 0;
  background: transparent;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  cursor: pointer;
}

.page-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(36px, 5vw, 58px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.035em;
}

.page-heading p {
  margin: 0 0 8px;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.paper-card,
.feature-card {
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow);
}

.feature-card {
  margin-bottom: 38px;
  padding: 24px;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
  transform: rotate(-0.06deg);
}

.album-placeholder {
  width: 100%;
  aspect-ratio: 1;
  border: 1.5px solid var(--line);
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(45deg, transparent 0 8px, rgba(0, 0, 0, 0.035) 8px 9px),
    var(--paper-raised);
  font-size: 36px;
}

.artwork-container {
  position: relative;
  overflow: hidden;
}

.artwork-container img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.artwork-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.artwork-container img:not([hidden]) + .artwork-fallback {
  display: none;
}

.artwork-container.artwork-failed .artwork-fallback {
  display: grid;
}

.feature-card h2,
.song-main h2 {
  margin: 0;
  font-weight: 400;
}

.meta {
  margin: 2px 0;
  color: var(--muted);
}

.lyric-quote {
  margin: 18px 0 0;
  white-space: pre-line;
}

.controls {
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.controls label {
  display: grid;
  gap: 4px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}


.song-list {
  border-top: 1.5px solid var(--line);
}

.song-row {
  min-width: 0;
  padding: 17px 4px;
  display: grid;
  grid-template-columns: 74px minmax(190px, 1.1fr) minmax(220px, 1.4fr) auto;
  gap: 20px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
}

.song-row:hover {
  background: rgba(0, 0, 0, 0.025);
}

.song-thumb {
  width: 66px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.12);
}

.song-main {
  min-width: 0;
}

.song-main h2 {
  overflow: hidden;
  font-size: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tag-list {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
}

.empty-state {
  padding: clamp(38px, 8vw, 76px) 28px;
  text-align: center;
}

.empty-state h1 {
  max-width: 650px;
  margin: 12px auto 14px;
  font-size: clamp(36px, 6vw, 66px);
  font-weight: 400;
  line-height: 1.02;
}

.empty-state > p:not(.eyebrow) {
  margin: 0 auto 28px;
  color: var(--muted);
}

.empty-doodle {
  width: 78px;
  height: 78px;
  margin: 0 auto 22px;
  border: 1.5px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 32px;
  transform: rotate(-3deg);
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
}

.folder-card {
  min-height: 150px;
  padding: 22px;
  cursor: pointer;
}

.folder-card:nth-child(2n) {
  transform: rotate(0.35deg);
}

.folder-card:nth-child(3n) {
  transform: rotate(-0.4deg);
}

.folder-card:hover {
  transform: translate(-2px, -2px) rotate(-0.2deg);
  box-shadow: 7px 8px 0 rgba(21, 21, 21, 0.14);
}

.folder-card h2 {
  margin: 22px 0 4px;
  font-weight: 400;
}

.paper-dialog {
  width: min(760px, calc(100vw - 30px));
  max-height: calc(100vh - 30px);
  overflow: auto;
  padding: 25px;
  border: 1.5px solid var(--line);
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow-large);
}

.paper-dialog-wide {
  width: min(860px, calc(100vw - 30px));
}

.paper-dialog::backdrop {
  background: rgba(15, 15, 15, 0.46);
  backdrop-filter: blur(1px);
}

.small-dialog {
  width: min(460px, calc(100vw - 30px));
}

.dialog-heading {
  margin-bottom: 22px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 34px;
  font-weight: 400;
  line-height: 1;
}

.form-section {
  padding: 20px 0;
  border-top: 1px solid var(--line-soft);
}

.form-section:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.form-section-heading {
  margin-bottom: 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}

.form-section-heading h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
}

.form-section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid.one-column {
  grid-template-columns: 1fr;
}

.form-grid label,
.form-grid .form-field,
.small-dialog label {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 6px;
}

.form-grid label > span,
.form-grid .form-field > span,
.small-dialog label > span {
  display: block;
}

.form-grid label b,
.small-dialog label b {
  font-weight: 400;
}

.form-grid label em {
  color: var(--muted);
  font-size: 14px;
  font-style: normal;
}

.full-width {
  grid-column: 1 / -1;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  background: rgba(255, 255, 255, 0.16);
}

input:focus,
textarea:focus,
select:focus {
  background: var(--paper-raised);
  box-shadow: 3px 4px 0 rgba(21, 21, 21, 0.1);
}

textarea {
  resize: vertical;
}

select[multiple] {
  min-height: 126px;
}

.folder-toggle-list {
  min-height: 126px;
  padding: 5px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  align-content: start;
  gap: 2px;
  background: rgba(255, 255, 255, 0.16);
}

.folder-toggle-list:focus-within {
  background: var(--paper-raised);
  box-shadow: 3px 4px 0 rgba(21, 21, 21, 0.1);
}

.folder-toggle {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.folder-toggle:last-child {
  border-bottom: 0;
}

.folder-toggle:hover,
.folder-toggle:focus-visible {
  outline: 0;
  background: rgba(21, 21, 21, 0.06);
}

.folder-toggle[aria-pressed="true"] {
  background: rgba(21, 21, 21, 0.1);
}

.folder-toggle-check {
  width: 1.1em;
  flex: 0 0 auto;
  font-weight: 700;
  opacity: 0;
  transform: rotate(-7deg);
}

.folder-toggle[aria-pressed="true"] .folder-toggle-check {
  opacity: 1;
}

.folder-toggle-empty {
  margin: 0;
  padding: 8px;
  color: var(--muted);
  font-size: 14px;
}

small {
  color: var(--muted);
  font-size: 13px;
}

.source-details {
  margin-top: 2px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.source-details summary {
  padding: 13px 0;
  cursor: pointer;
}

.details-grid {
  padding: 4px 0 20px;
}

.dialog-actions {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.noscript-message {
  position: fixed;
  z-index: 2000;
  inset: 20px;
  padding: 24px;
  border: 2px solid var(--line);
  background: var(--paper-raised);
  box-shadow: var(--shadow-large);
  text-align: center;
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 18px;
    border-right: 0;
    /*border-bottom: 1.5px solid var(--line);*/
    overflow: visible;
  }

  .brand {
    margin: 0 0 18px;
    font-size: 23px;
  }

  .primary-nav {
    width: calc(100% + 36px);
    min-height: 58px;
    margin-inline: -18px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: 1.5px solid var(--line);
    border-bottom: 1.5px solid var(--line);
  }

  .primary-nav a {
    min-width: 0;
    min-height: 56px;
    padding: 8px 10px;
    justify-content: center;
    border-right: 1.5px solid var(--line);
    border-bottom: 0;
  }

  .primary-nav a:last-child {
    border-right: 0;
  }

  .primary-nav a:hover,
  .primary-nav a.active,
  .primary-nav a[aria-current="page"] {
    padding-left: 10px;
  }

  .folder-nav,
  .sidebar-footer {
    display: none;
  }

  .main-panel {
    padding: 24px 18px 60px;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 30px;
  }

  .feature-card {
    grid-template-columns: 94px minmax(0, 1fr);
  }

  .feature-card > :last-child {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .song-row {
    grid-template-columns: 58px minmax(0, 1fr) auto;
  }

  .song-row .lyric-quote {
    grid-column: 2 / -1;
    margin: 0;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 17px;
  }

  .primary-nav a {
    padding-inline: 6px;
  }

  .primary-nav a span:last-child {
    display: none;
  }

  .page-heading,
  .form-section-heading {
    display: block;
  }

  .page-heading > p,
  .form-section-heading p {
    margin-top: 8px;
  }

  .feature-card {
    grid-template-columns: 1fr;
  }

  .album-placeholder {
    width: 94px;
  }

  .song-row {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 14px;
  }

  .song-actions {
    grid-column: 2;
  }

  .song-row .lyric-quote {
    grid-column: 1 / -1;
  }

  .controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .controls select {
    width: 100%;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .full-width {
    grid-column: auto;
  }

  .paper-dialog {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.page-heading-actions,
.folder-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button-danger {
  border-color: var(--ink);
  background: transparent;
}

.button-danger:hover {
  color: var(--paper);
  background: var(--ink);
}

.danger-text {
  text-decoration-style: wavy;
}

.folder-description {
  max-width: 620px;
  margin-top: 10px !important;
  color: var(--ink-soft) !important;
  font-size: 18px;
}

.collection-count {
  margin: -6px 0 18px;
  color: var(--muted);
}

.folder-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.folder-card-link {
  flex: 1;
  padding: 22px 22px 14px;
}

.folder-card-icon {
  font-size: 25px;
}

.folder-card-actions {
  padding: 10px 20px 14px;
  border-top: 1px solid var(--line-soft);
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .page-heading-actions {
    width: 100%;
    align-items: stretch;
  }

  .page-heading-actions .button {
    flex: 1;
  }
}

.controls {
  align-items: end;
}

.controls .checkbox-control {
  min-height: 43px;
  padding: 0 10px;
  display: inline-flex;
  grid-template-columns: none;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--line);
  font-family: var(--hand);
  font-size: 16px;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

.checkbox-control input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--ink);
}

/* Temporarily retain the redundant controls without displaying them. */
.controls .custom-select-field[hidden],
.controls .checkbox-control[hidden] {
  display: none !important;
}

.clear-filters {
  align-self: end;
  width: 43px;
  min-width: 43px;
  height: 43px;
  padding: 0;
  border: 0;
  display: inline-grid;
  place-items: center;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.clear-filters .material-symbols-outlined {
  font-size: 23px;
  line-height: 1;
}

.clear-filters:hover,
.clear-filters:focus-visible {
  outline: none;
  background: transparent;
  color: var(--muted);
}

.clear-filters:disabled {
  color: var(--muted);
  cursor: default;
  opacity: 0.35;
}

.results-summary {
  margin: 0 0 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

mark {
  padding: 0 0.08em;
  color: inherit;
  background: transparent;
  background-image: linear-gradient(
    transparent 58%,
    rgba(21, 21, 21, 0.19) 58%,
    rgba(21, 21, 21, 0.19) 88%,
    transparent 88%
  );
}

/* Song detail view */
.song-row[data-action="open-song"] {
  cursor: pointer;
}

.song-main h2 a:hover,
.song-main h2 a:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.song-detail {
  max-width: 1080px;
  margin-inline: auto;
}

.detail-topline {
  margin-bottom: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.back-link,
.source-link {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.song-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button-danger {
  border-style: dashed;
}

.button-danger:hover {
  color: var(--paper);
  background: var(--ink);
}

.song-detail-header {
  margin-bottom: 34px;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 46px);
  align-items: center;
}

.detail-album-art {
  width: 150px;
  aspect-ratio: 1;
  border: 1.5px solid var(--line);
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(-35deg, transparent 0 10px, rgba(0, 0, 0, 0.04) 10px 11px),
    var(--paper-raised);
  box-shadow: var(--shadow);
  font-size: 46px;
  transform: rotate(-1.2deg);
}

.song-detail-header h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(46px, 8vw, 88px);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: 0.015em;
  overflow-wrap: anywhere;
}

.song-detail-artist {
  margin: 14px 0 0;
  font-size: clamp(24px, 3vw, 34px);
}

.detail-tags {
  margin-top: 16px;
}

.detail-excerpt {
  margin-bottom: 44px;
  padding: clamp(25px, 4vw, 44px);
  transform: rotate(-0.15deg);
}

.detail-excerpt blockquote {
  max-width: 900px;
  margin: 12px 0 0;
  font-size: clamp(27px, 4vw, 43px);
  line-height: 1.2;
  white-space: pre-wrap;
}

.song-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(250px, 0.8fr);
  gap: clamp(34px, 6vw, 72px);
  align-items: start;
}

.detail-section-heading {
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.detail-section-heading .eyebrow {
  flex: 0 0 auto;
  margin: 0;
}

.hand-rule {
  width: 100%;
  height: 5px;
  background: var(--ink);
  clip-path: polygon(0 40%, 100% 0, 98% 75%, 2% 100%);
  opacity: 0.85;
}

.lyrics-body {
  font-size: 21px;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.detail-sidebar {
  display: grid;
  gap: 28px;
}

.detail-note {
  padding: 22px;
  transform: rotate(0.3deg);
}

.detail-note > p:last-child {
  margin-bottom: 0;
  white-space: pre-wrap;
}

.detail-metadata {
  padding-top: 20px;
  border-top: 1.5px solid var(--line);
}

.detail-metadata h2 {
  margin: 0 0 14px;
  font-size: 24px;
  font-weight: 400;
}

.detail-metadata dl {
  margin: 0 0 16px;
}

.detail-metadata dl div {
  padding: 8px 0;
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.detail-metadata dt {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-metadata dd {
  margin: 0;
}

.detail-empty {
  color: var(--muted);
  font-style: italic;
}

@media (max-width: 760px) {
  .song-detail-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .detail-topline {
    align-items: flex-start;
  }

  .song-detail-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .song-detail-header {
    grid-template-columns: 1fr;
  }

  .detail-album-art {
    width: 104px;
  }

  .detail-sidebar {
    grid-template-columns: 1fr;
  }
}

.external-lookup-group {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.external-lookup-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.lookup-status {
  margin: 0;
  max-width: 46rem;
  font-family: "Space Mono", monospace;
  font-size: 0.78rem;
}

.song-autocomplete {
  position: relative;
  margin-bottom: 1.1rem;
}

.song-autocomplete > label {
  display: grid;
  gap: 0.38rem;
  font-family: "Space Mono", monospace;
  font-size: 0.82rem;
  font-weight: 700;
}

.song-autocomplete input {
  width: 100%;
}

.field-help {
  margin: 0.4rem 0 0;
  color: var(--muted-ink);
  font-family: "Space Mono", monospace;
  font-size: 0.72rem;
}

.song-search-results {
  display: grid;
  margin-top: 0.55rem;
  border: 2px solid var(--ink);
  background: var(--paper);
  max-height: 22rem;
  overflow-y: auto;
  z-index: 5;
}

.song-search-results[hidden] {
  display: none;
}

.song-search-result {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 0.8rem;
  align-items: center;
  width: 100%;
  padding: 0.65rem;
  border: 0;
  border-bottom: 1px dashed var(--ink);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.song-search-result:last-child {
  border-bottom: 0;
}

.song-search-result:hover,
.song-search-result[aria-selected="true"] {
  background: var(--ink);
  color: var(--paper);
}

.song-search-result img,
.song-search-art-placeholder {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border: 1px solid currentColor;
}

.song-search-art-placeholder {
  display: grid;
  place-items: center;
  font-size: 1.4rem;
}

.song-search-result > span:last-child {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.song-search-result strong,
.song-search-result span,
.song-search-result small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-search-result strong {
  font-family: "Space Mono", monospace;
  font-size: 0.83rem;
}

.song-search-result small {
  opacity: 0.75;
}

/* Global song finder and compact saved-entry search */
.quick-add-autocomplete {
  position: relative;
  flex: 1;
  min-width: 0;
  max-width: 760px;
}

.quick-add-autocomplete .global-search {
  width: 100%;
}

.quick-add-status {
  min-height: 18px;
  margin: 6px 4px 0;
}

.quick-add-results {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: min(430px, 62vh);
  overflow-y: auto;
  background: var(--paper-raised);
  box-shadow: 5px 6px 0 rgba(21, 21, 21, 0.16);
}

.library-entry-search {
  width: min(430px, 100%);
  min-height: 38px;
  margin: 12px 0 10px;
  padding: 7px 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.2);
}

.library-entry-search:focus-within {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.library-entry-search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 12px;
}

.library-entry-search input::placeholder {
  color: var(--muted);
}

.library-entry-search kbd {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

@media (max-width: 760px) {
  .quick-add-autocomplete {
    width: 100%;
    max-width: none;
  }

  .quick-add-results {
    position: static;
    margin-top: 8px;
    max-height: 360px;
  }
}

/* Manual entry action */
.manual-entry-button {
  justify-self: start;
  margin-top: -2px;
}

@media (max-width: 760px) {
  .manual-entry-button {
    justify-self: start;
  }
}

.song-action-menu {
  position: relative;
}

.song-menu-trigger[aria-expanded="true"] {
  background: var(--ink);
  color: var(--paper);
}

.song-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 5px);
  right: 0;
  min-width: 132px;
  padding: 4px;
  border: 1.5px solid var(--line);
  background: var(--paper);
}

.song-menu[hidden] {
  display: none;
}

.song-menu button {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--hand);
  font-size: 16px;
  text-align: left;
  cursor: pointer;
}

.song-menu button:hover,
.song-menu button:focus-visible {
  outline: none;
  background: var(--ink);
  color: var(--paper);
}

.song-menu button.danger-text {
  color: var(--danger, #8b0000);
}

.song-menu button.danger-text:hover,
.song-menu button.danger-text:focus-visible {
  color: var(--paper);
}

.song-menu-submenu {
  position: relative;
}

.song-submenu-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.song-folder-submenu {
  position: absolute;
  z-index: 30;
  top: -5px;
  right: calc(100% + 5px);
  min-width: 180px;
  max-width: min(260px, 70vw);
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
  border: 1.5px solid var(--line);
  background: var(--paper);
}

.song-folder-submenu[hidden] {
  display: none;
}

.song-folder-submenu button {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-menu-empty {
  display: block;
  padding: 8px 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.35;
}

@media (max-width: 760px) {
  .song-menu {
    min-width: 150px;
  }

  .song-folder-submenu {
    position: fixed;
    top: auto;
    right: 16px;
    bottom: 16px;
    left: 16px;
    max-width: none;
    max-height: min(45vh, 320px);
    border-width: 2px;
  }
}

/* Shared custom select menus */
.custom-select-field {
  position: relative;
  min-width: 180px;
  display: grid;
  gap: 4px;
}

.custom-select-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.custom-select-trigger {
  width: 100%;
  min-height: 43px;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--hand);
  font-size: 17px;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}

.custom-select-trigger:hover,
.custom-select-trigger:focus-visible,
.custom-select-trigger[aria-expanded="true"] {
  outline: none;
  background: var(--ink);
  color: var(--paper);
}

.custom-select-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  background: var(--paper-muted);
  color: var(--muted);
}

.custom-select-chevron {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 13px;
}

.custom-select-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  width: max(100%, 190px);
  max-width: min(300px, 82vw);
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
  border: 1.5px solid var(--line);
  background: var(--paper);
}

.custom-select-menu[hidden] {
  display: none;
}

.custom-select-menu button {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: transparent;
  color: var(--ink);
  font-family: var(--hand);
  font-size: 16px;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}

.custom-select-menu button:hover,
.custom-select-menu button:focus-visible {
  outline: none;
  background: var(--ink);
  color: var(--paper);
}

.custom-select-check {
  min-width: 1em;
  font-family: var(--mono);
  text-align: center;
}

.dialog-custom-select {
  width: 100%;
}

@media (max-width: 760px) {
  .custom-select-field {
    min-width: min(100%, 180px);
  }

  .controls .custom-select-field {
    flex: 1 1 160px;
  }

  .custom-select-menu {
    width: 100%;
    max-width: none;
  }
}

/* Compact library sort direction control */
.sort-direction-toggle {
  align-self: end;
  width: 43px;
  min-width: 43px;
  height: 43px;
  padding: 0;
  border: 1.5px solid var(--line);
  display: inline-grid;
  place-items: center;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.sort-direction-toggle:hover,
.sort-direction-toggle:focus-visible {
  outline: none;
  background: var(--ink);
  color: var(--paper);
}


/* Compact mobile header and navigation */
@media (max-width: 620px) {
  .primary-nav {
    min-height: 29px;
    margin-bottom: -20px;
  }

  .primary-nav a {
    min-height: 28px;
    padding: 3px 0px;
    gap: 4px;
  }

  .primary-nav a:hover,
  .primary-nav a.active,
  .primary-nav a[aria-current="page"] {
    padding-left: 6px;
  }

  .nav-icon {
    width: 14px;
    font-size: 14px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px;
  }

  .quick-add-autocomplete {
    min-width: 0;
  }

  .global-search {
    min-height: 26px;
    padding: 3px 8px;
    gap: 7px;
  }

  .global-search > span[aria-hidden="true"] {
    font-size: 14px;
    line-height: 1;
  }

  .global-search input {
    font-size: 14px;
    line-height: 1.2;
  }

  .manual-entry-button {
    width: 32px;
    min-width: 32px;
    min-height: 26px;
    margin-top: 0;
    padding: 2px;
    justify-self: end;
    font-size: 20px;
    line-height: 1;
  }

  .manual-entry-label {
    display: none;
  }

  .manual-entry-symbol {
    display: block;
    line-height: 1;
  }

  .feature-card {
    display: none;
  }
}

/* Refined compact layout for phones and narrow tablets only. */
@media (max-width: 620px) {
  /* Top-align the compact action with the taller search field. */
  .topbar {
    align-items: start;
  }

  .global-search {
    height: 42px;
    min-height: 42px;
    box-sizing: border-box;
  }

  .manual-entry-button {
    display: inline-grid;
    width: 32px;
    min-width: 32px;
    height: 42px;
    min-height: 42px;
    align-self: start;
    place-items: center;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  .manual-entry-symbol {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    margin: 0;
    line-height: 1;
    transform: none;
  }

  /* Keep the three selectors and two icon controls on one compact row. */
  .controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) 34px 34px;
    align-items: end;
    gap: 6px;
  }

  .controls .custom-select-field {
    min-width: 0;
    width: 100%;
    gap: 2px;
  }

  .controls .custom-select-label {
    overflow: hidden;
    font-size: 8px;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .controls .custom-select-trigger {
    min-width: 0;
    min-height: 34px;
    height: 34px;
    padding: 5px 6px;
    gap: 4px;
    overflow: hidden;
    font-size: 13px;
  }

  .controls .custom-select-trigger > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .controls .custom-select-chevron {
    font-size: 10px;
  }

  .controls .sort-direction-toggle,
  .controls .clear-filters {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
  }

  .controls .sort-direction-toggle {
    font-size: 18px;
  }

  .controls .clear-filters .material-symbols-outlined {
    font-size: 20px;
  }
}

/* Refine saved-song rows on screens 620px wide and smaller. */
@media (max-width: 620px) {
  .song-row {
    grid-template-columns: 56px minmax(0, 1fr);
    column-gap: 12px;
  }

  .song-thumb {
    width: 52px;
    max-width: 100%;
  }

  .song-main {
    grid-column: 2;
    width: 100%;
    min-width: 0;
  }

  .song-row .lyric-quote {
    grid-column: 2;
    width: min(100%, 34rem);
    margin: 4px 0 0 auto;
    text-align: right;
  }

  .song-actions {
    grid-column: 2;
    justify-self: end;
    justify-content: flex-end;
  }
}

/* Consistent Material Symbols folder icons */
.folder-link-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.folder-link-label .material-symbols-outlined,
.folder-card-icon.material-symbols-outlined,
.nav-icon.material-symbols-outlined {
  line-height: 1;
}

/* Use the variable Material Symbols axes; navigation icons are outlined by default. */
.material-symbols-outlined {
  font-variation-settings:
    "FILL" 0,
    "wght" 400,
    "GRAD" 0,
    "opsz" 20;
}

/* Favorites is intentionally the filled, solid-black variable glyph. */
.nav-icon-filled.material-symbols-outlined {
  color: #000;
  font-variation-settings:
    "FILL" 1,
    "wght" 400,
    "GRAD" 0,
    "opsz" 20;
}


/* Per-song favorite controls use the same variable Material Symbol as the Favorites tab. */
.song-favorite-button .song-favorite-icon {
  color: #000;
  line-height: 1;
  font-variation-settings:
    "FILL" 0,
    "wght" 400,
    "GRAD" 0,
    "opsz" 20;
}

.song-favorite-button.is-favorite .song-favorite-icon {
  color: #c62828;
  font-variation-settings:
    "FILL" 1,
    "wght" 400,
    "GRAD" 0,
    "opsz" 20;
}
