/* Sounds, album-style layout (after Spotify / Apple Music). Everything here is
   under html.sm, which js/sounds-music.js sets; without it the old look stays. */

/* ---------- Collection header (the big spot) ---------- */
html.sm .sound-panels.has-stage { margin: 0 0 2.5rem; }
html.sm .sound-panels.has-stage > .sound-panel {
  grid-template-columns: 15.5rem minmax(0, 1fr);
  grid-template-areas: "art title" "list list" "rest rest";
  grid-template-rows: auto auto 1fr;
  column-gap: 2.5rem;
  align-items: end;
  position: relative;
  padding-top: 0.5rem;
}
html.sm body {
  background-image: linear-gradient(180deg, rgba(196, 165, 116, 0.09), rgba(16, 14, 12, 0) 36rem);
  background-repeat: no-repeat;
}
html.sm .sounds-page { position: relative; isolation: isolate; }
html.sm .sound-panels.has-stage .sound-album-art {
  width: 15.5rem;
  border: 0;
  border-radius: 6px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.55);
}
html.sm .sp-stage-titlerow { margin: 0; align-items: flex-start; padding-bottom: 0.25rem; }
html.sm .sound-panels.has-stage .sound-album-head .group-title {
  font-size: clamp(2.6rem, 5.2vw, 4.6rem);
  line-height: 1;
  letter-spacing: -0.02em;
}
html.sm .sound-album-titles .sound-album-credit { margin-top: 0.55rem; font-size: 0.9rem; }
html.sm .sm-meta {
  margin: 0.35rem 0 0;
  color: #b3a89c;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
html.sm .sp-stage-titlerow > .sp-share { margin-top: 0.6rem; }
html.sm .sp-stage-titlerow > .sp-share .share-icon-std { width: 24px; height: 24px; }

.sm-actions { display: flex; align-items: center; gap: 1.1rem; margin-top: 1.25rem; }
.sm-play {
  appearance: none;
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #c4a574;
  color: #100e0c;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.sm-play svg { width: 1.35rem; height: 1.35rem; }
.sm-play[data-playing="false"] svg { margin-left: 0.15rem; }
.sm-play:hover { transform: scale(1.05); background: #d6bf9a; }
.sm-play:focus-visible, .sm-shuffle:focus-visible, .sm-chip:focus-visible {
  outline: 2px solid #c4a574;
  outline-offset: 3px;
}
.sm-shuffle {
  appearance: none;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #b3a89c;
  cursor: pointer;
  position: relative;
}
.sm-shuffle svg { width: 1.45rem; height: 1.45rem; }
.sm-shuffle:hover { color: #f0ebe3; }
.sm-shuffle[aria-pressed="true"] { color: #c4a574; }
.sm-shuffle[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  bottom: 0.1rem; left: 50%;
  width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%;
  background: #c4a574;
}

/* ---------- Track list: numbered rows, title, time, share ---------- */
html.sm .sound-panels.has-stage .sp-list {
  grid-area: list;
  margin-top: 2rem;
  max-height: min(40rem, 64vh);
  padding: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
html.sm .sounds-section .sp-row { border-bottom: 1px solid var(--line); border-radius: 0; gap: 0.25rem; }
html.sm .sounds-section .sp-row:last-child { border-bottom: 1px solid var(--line); }
@media (hover: hover) and (pointer: fine) { html.sm .sounds-section .sp-row:hover { background: rgba(240, 235, 227, 0.035); } }
html.sm .sounds-section .sp-row.is-current { background: rgba(196, 165, 116, 0.07); border-radius: 0; }
html.sm .sounds-section .sp-track {
  align-items: center;
  min-height: 3.35rem;
  padding: 0.55rem 0.5rem;
  gap: 0.9rem;
}
html.sm .sounds-section .sp-track-num { flex: 0 0 1.9rem; text-align: right; color: #b3a89c; }
html.sm .sp-track-title { font-size: 0.98rem; }
html.sm .sp-track-dur { color: #b3a89c; min-width: 2.8rem; text-align: right; }
html.sm .sounds-section.is-playing .sp-track.is-current .sp-track-num::before { content: none; }
html.sm .sounds-section.is-playing .sp-track.is-current .sp-track-num {
  color: transparent;
  background:
    linear-gradient(#c4a574, #c4a574) right 0.55rem bottom 0.15rem / 3px 60% no-repeat,
    linear-gradient(#c4a574, #c4a574) right 0.3rem bottom 0.15rem / 3px 100% no-repeat,
    linear-gradient(#c4a574, #c4a574) right 0.05rem bottom 0.15rem / 3px 40% no-repeat;
  animation: sm-eq 0.9s ease-in-out infinite;
}
@keyframes sm-eq {
  0%, 100% { background-size: 3px 60%, 3px 100%, 3px 40%; }
  50% { background-size: 3px 100%, 3px 45%, 3px 85%; }
}
@media (prefers-reduced-motion: reduce) {
  html.sm .sounds-section.is-playing .sp-track.is-current .sp-track-num { animation: none; }
}

/* ---------- Search + section filters (unused unless a filter bar is present) ---------- */
.sm-filter {
  grid-area: list;
  align-self: start;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.75rem;
}
.sm-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 1 18rem;
  min-width: 12rem;
  height: 2.5rem;
  padding: 0 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(240, 235, 227, 0.035);
  color: #b3a89c;
}
.sm-search:focus-within { border-color: #c4a574; }
.sm-search svg { width: 1.15rem; height: 1.15rem; flex: none; }
.sm-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f0ebe3;
  font: inherit;
  font-size: 0.95rem;
}
.sm-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.sm-chip {
  appearance: none;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: #b3a89c;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}
.sm-chip:hover { color: #f0ebe3; }
.sm-chip[aria-pressed="true"] { background: #f0ebe3; border-color: #f0ebe3; color: #100e0c; }

/* ---------- Elsewhere: links as a row of buttons ---------- */
html.sm .sound-panels.has-stage .elsewhere-players { grid-area: list; margin-top: 2rem; }
html.sm #elsewhere .elsewhere-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 0;
}
html.sm #elsewhere .elsewhere-list li { margin: 0; padding: 0; border: 0; }
html.sm #elsewhere .elsewhere-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: #f0ebe3;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  text-decoration: none;
}
html.sm #elsewhere .elsewhere-list a::after { content: "\2197"; color: #b3a89c; font-size: 0.85em; }
html.sm #elsewhere .elsewhere-list a:hover { border-color: #c4a574; color: #c4a574; }

/* ---------- Shelf of the other collections ---------- */
html.sm .sounds-page .sound-albums {
  grid-template-columns: repeat(auto-fill, minmax(9.75rem, 1fr));
  gap: 1.75rem 1.25rem;
}
@media (min-width: 1100px) {
  html.sm .sounds-page .sound-albums { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 1.5rem 1rem; }
}
html.sm .sound-album-cover { border: 0; border-radius: 6px; box-shadow: none; }
html.sm .sound-album-name { font-family: var(--font-sans); font-size: 0.98rem; letter-spacing: 0; margin-top: 0.65rem; }
html.sm .sound-album-count { font-size: 0.82rem; color: #b3a89c; }

/* ---------- The pinned player bar ---------- */
body.sm-has-dock { padding-bottom: var(--sm-dock-h, 5.5rem); --message-radio-clear: var(--sm-dock-h, 5.5rem); }
.sm-dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  background: color-mix(in srgb, #191613 96%, transparent);
  border-top: 1px solid var(--line-strong);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.sm-dock .section-player { display: none; }
.sm-dock .section-player.is-docked {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 36rem) minmax(0, 1fr);
  align-items: center;
  gap: 1.25rem;
  padding: 0.7rem max(1.25rem, calc((100vw - 80rem) / 2));
  border: 0;
  background: transparent;
}
.sm-info { display: flex; align-items: center; gap: 0.8rem; min-width: 0; }
.sm-thumb { width: 3.25rem; height: 3.25rem; flex: none; border-radius: 4px; object-fit: cover; }
.sm-text { min-width: 0; }
.sm-dock .sp-now {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.3;
  color: #f0ebe3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sm-from { margin: 0.1rem 0 0; color: #b3a89c; font-size: 0.8rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-center { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; min-width: 0; }
.sm-dock .sp-controls { gap: 1rem; }
.sm-dock .sp-btn { border: 0; background: transparent; color: #f0ebe3; width: 2.2rem; height: 2.2rem; }
.sm-dock .sp-btn svg { width: 0.85rem; height: 0.85rem; }
.sm-dock .sp-btn:hover { color: #c4a574; }
.sm-dock .sp-play {
  width: 2.5rem;
  height: 2.5rem;
  background: #f0ebe3;
  color: #100e0c;
  font-size: 0.8rem;
}
.sm-dock .sp-play:hover { background: #c4a574; color: #100e0c; }
.sm-dock .sm-shuffle { width: 2.2rem; height: 2.2rem; }
.sm-dock .sm-shuffle svg { width: 1.15rem; height: 1.15rem; }
.sm-dock .sp-seek { width: 100%; margin: 0; gap: 0.6rem; font-size: 0.75rem; color: #b3a89c; }
.sm-dock .sp-range { height: 1.1rem; }
.sm-right { display: flex; justify-content: flex-end; align-items: center; }
.sm-dock .sp-now-share.share-link.share-icon-btn { margin: 0; color: #b3a89c; text-decoration: none; }
.sm-dock .sp-now-share:hover { color: #c4a574; }
.sm-dock .sp-now-share .share-icon-std { width: 22px; height: 22px; }

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  html.sm .sound-panels.has-stage > .sound-panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "art" "title" "filter" "list" "rest";
    grid-template-rows: auto;
  }
  html.sm .sound-panels.has-stage .sound-album-art {
    width: min(14rem, 62vw);
    max-width: none;
    margin: 0.5rem auto 1.4rem;
  }
  html.sm .sound-panels.has-stage .sound-album-head .group-title { font-size: 2.5rem; }
  html.sm .sp-stage-titlerow > .sp-share { margin-top: 0.3rem; }
  .sm-actions { margin-top: 1rem; justify-content: space-between; flex-direction: row-reverse; }
  html.sm .sound-panels.has-stage .sp-list { margin-top: 1.5rem; max-height: min(34rem, 62vh); }
  html.sm .sounds-section .sp-track { gap: 0.7rem; padding: 0.5rem 0.2rem; min-height: 3.2rem; }
  html.sm .sounds-section .sp-track-num { flex-basis: 1.5rem; }
  .sm-filter { margin-top: 1.25rem; }
  .sm-search { flex: 1 1 100%; }
  .sm-chips { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(50% - 50vw); padding: 0 calc(50vw - 50%) 0.2rem; scrollbar-width: none; }
  .sm-chips::-webkit-scrollbar { display: none; }

  /* Shelf scrolls sideways */
  html.sm .sounds-page .sound-albums {
    display: flex !important;
    gap: 0.9rem;
    overflow-x: auto;
    margin: 0 calc(50% - 50vw) 1.5rem;
    padding: 0 calc(50vw - 50%) 0.4rem;
    scrollbar-width: none;
  }
  html.sm .sounds-page .sound-albums::-webkit-scrollbar { display: none; }
  html.sm .sound-album { flex: 0 0 9.25rem; }
  html.sm .sound-album-name { font-size: 0.9rem; -webkit-line-clamp: 2; min-height: 0; }
  html.sm .sound-album-count { font-size: 0.75rem; }
  html.sm .sound-album .sound-album-credit { font-size: 0.66rem; }

  /* Mini player */
  .sm-dock { left: 0.5rem; right: 0.5rem; bottom: 0.5rem; border: 1px solid var(--line-strong); border-radius: 10px; padding-bottom: 0; bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px)); box-shadow: 0 10px 30px rgba(0,0,0,0.55); }
  body.sm-has-dock { padding-bottom: calc(var(--sm-dock-h, 6rem) + 1rem); --message-radio-clear: calc(var(--sm-dock-h, 6rem) + 0.5rem); }
  .sm-dock .section-player.is-docked {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "info ctl share" "seek seek seek";
    gap: 0.2rem 0.4rem;
    padding: 0.5rem 0.55rem 0.4rem;
  }
  .sm-info { grid-area: info; gap: 0.6rem; }
  .sm-thumb { width: 2.6rem; height: 2.6rem; }
  .sm-center { display: contents; }
  .sm-dock .sp-controls { grid-area: ctl; gap: 0.1rem; }
  .sm-dock .sm-shuffle-bar { display: none; }
  .sm-dock .sp-btn { width: 2.3rem; height: 2.3rem; }
  .sm-dock .sp-play { width: 2.4rem; height: 2.4rem; }
  .sm-right { grid-area: share; }
  .sm-dock .sp-now-share.share-link.share-icon-btn { width: 2.3rem; height: 2.3rem; }
  .sm-dock .sp-now-credits { width: 2.3rem; height: 2.3rem; }
  .sm-dock .sp-now-credits svg { width: 20px; height: 20px; }
  .sm-dock .sp-seek { grid-area: seek; font-size: 0.7rem; padding: 0 0.15rem; }
  .sm-dock .sp-now { font-size: 0.9rem; }
  .sm-from { font-size: 0.74rem; }
}

/* Search / filter hides rows. */
html.sm .sounds-section .sp-row[hidden] { display: none !important; }

/* Seek bar runs left to right in every language, like the site bar. */
.sm-dock .sp-seek { direction: ltr; }

/* Per-track cover (e.g. Polychords): small square beside the title. */
.sp-track-art { width: 2.25rem; height: 2.25rem; flex: none; border-radius: 3px; object-fit: cover; }


/* =====================================================================
   Track rows (all widths): number, title, duration, and (on the playing
   row only) the share icon. Personnel / studio notes stay off the list
   and are shown in the player's ⓘ info sheet.
   ===================================================================== */
.sounds-section .sp-track-note { display: none; }
.sounds-section .sp-row > a.sp-track-link { display: none; }
.sounds-section .sp-row .sp-song-share { display: none; }
.sounds-section .sp-row.is-current .sp-song-share { display: inline-flex; }
.sounds-section .sp-track-title {
  display: block;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.sounds-section .sp-track-from {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.sm-right { display: flex; align-items: center; gap: 0.1rem; }
.sp-now-credits {
  appearance: none;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #b3a89c;
  cursor: pointer;
}
.sp-now-credits:hover, .sp-now-credits:focus-visible, .sp-now-credits[aria-expanded="true"] { color: #c4a574; }
.sp-now-credits.is-empty { opacity: 0.45; }
.sp-credits-sheet {
  position: fixed;
  z-index: 70;
  right: max(1.25rem, calc((100vw - 80rem) / 2));
  bottom: calc(var(--sm-dock-h, 6rem) + 1.1rem);
  width: min(26rem, calc(100vw - 1.5rem));
  max-height: 60vh;
  overflow: auto;
  padding: 0.9rem 1.1rem 1rem;
  background: #1f1b17;
  border: 1px solid var(--line-strong);
  border-left: 2px solid #c4a574;
  border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6);
  font-family: var(--font-sans);
}
.sp-credits-sheet[hidden] { display: none; }
.sp-credits-top { display: flex; align-items: center; justify-content: space-between; }
.sp-credits-head { margin: 0; color: #b3a89c; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.sp-credits-close { appearance: none; border: 0; background: transparent; color: #b3a89c; font-size: 1.5rem; line-height: 1; width: 2.2rem; height: 2.2rem; margin: -0.5rem -0.6rem -0.2rem 0; cursor: pointer; }
.sp-credits-song { margin: 0.3rem 0 0.5rem; color: #f0ebe3; font-size: 1.05rem; line-height: 1.3; }
.sp-credits-text { margin: 0 0 0.6rem; color: #d8d0c4; font-size: 0.9rem; line-height: 1.5; }
.sp-credits-text[hidden], .sp-credits-release[hidden] { display: none; }
.sp-credits-release { display: inline-block; color: #c4a574; font-size: 0.8rem; }
@media (max-width: 760px) {
  .sp-credits-sheet { right: 0.5rem; left: 0.5rem; width: auto; }
}

/* =====================================================================
   Phone: every section is visible near the top (4 x 2 tiles), the open
   section is a compact header + player + its tracks.
   ===================================================================== */
@media (max-width: 760px) {
  html.sm .sounds-page { display: flex; flex-direction: column; }
  html.sm .sounds-page > .page-title { order: 0; }
  html.sm .sounds-page > .sound-panels { order: 2; }
  html.sm .sounds-page > .sound-albums { order: 20; } /* albums UNDER the player + songs (LAYOUT-RULES.md) */
  html.sm .sounds-page > *:not(.page-title):not(.sound-albums):not(.sound-panels) { order: 3; }

  html.sm .sounds-page .sound-albums {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem 0.6rem;
    overflow: visible;
    margin: 0 0 1.4rem;
    padding: 0;
  }
  html.sm .sound-panels.has-stage ~ .sound-albums .sound-album[aria-current="true"],
  html.sp-js .sound-panels.has-stage ~ .sound-albums .sound-album[aria-current="true"] { display: flex; }
  html.sm .sound-album { flex: none; min-width: 0; }
  html.sm .sound-album-cover { border-radius: 8px; }
  html.sm .sound-album[aria-current="true"] .sound-album-cover { outline: 2px solid #c4a574; outline-offset: 2px; }
  html.sm .sound-album[aria-current="true"] .sound-album-name { color: #c4a574; }
  html.sm .sound-album-name {
    margin-top: 0.4rem;
    font-size: 0.7rem;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    min-height: 0;
  }
  html.sm .sound-album-count { font-size: 0.65rem; margin-top: 0.1rem; }
  html.sm .sound-album .sound-album-credit { display: none; }
  html.sm .sound-album-eq { display: none; }

  /* Open section: small cover beside the title instead of a full-width cover */
  html.sm .sound-panels.has-stage { margin-bottom: 1.5rem; }
  html.sm .sound-panels.has-stage > .sound-panel {
    grid-template-columns: 5.5rem minmax(0, 1fr);
    grid-template-areas: "art title" "player player" "filter filter" "list list" "rest rest";
    column-gap: 0.9rem;
    align-items: center;
    padding-top: 0;
  }
  html.sm .sound-panels.has-stage .sound-album-art {
    width: 5.5rem;
    margin: 0;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  }
  html.sm .sound-panels.has-stage .sound-album-head .group-title { font-size: 1.6rem; line-height: 1.1; }
  html.sm .sound-album-titles .sound-album-credit { margin-top: 0.3rem; font-size: 0.78rem; }
  html.sm .sm-meta { font-size: 0.8rem; margin-top: 0.2rem; }
  .sm-actions { margin-top: 0.6rem; }
  html.sm .sound-panels.has-stage .section-player { margin-top: 0.9rem; }
  html.sm .sound-panels.has-stage .sp-list { margin-top: 0.9rem; max-height: min(30rem, 58vh); }

  /* One clean line per track */
  html.sm .sounds-section .sp-track { min-height: 3rem; padding: 0.35rem 0.1rem; gap: 0.6rem; }
  html.sm .sounds-section .sp-track-num { flex-basis: 1.4rem; font-size: 0.78rem; }
  html.sm .sounds-section .sp-track-dur { min-width: 2.6rem; font-size: 0.8rem; }
  html.sm .sounds-section .sp-track-title { font-size: 0.95rem; }
}

/* Phone: the track list flows in the normal page scroll (no scroll box inside the page),
   nothing scrolls sideways, rows are one line, and the Message button is a small icon
   that never sits on top of a duration. */
@media (max-width: 760px) {
  html.sm, html.sm body { overflow-x: hidden; }
  html.sm #site-header { position: static; }
  html.sm .sound-panels.has-stage .sound-panel .sp-list,
  html.sm .sounds-section .sp-list {
    max-height: none !important;
    overflow: visible !important;
    overscroll-behavior: auto;
    margin-top: 0.8rem;
    padding: 0;
  }
  html.sm .sounds-section .sp-row { min-width: 0; max-width: 100%; padding-right: 3.2rem; }
  html.sm .sounds-section .sp-track { flex: 1 1 0; min-width: 0; max-width: 100%; }
  html.sm .sounds-section .sp-track-title { flex: 1 1 0; min-width: 0; }
  html.sm .site-message-label { display: none; }
  html.sm .site-message-main {
    width: 2.6rem; height: 2.6rem; min-width: 0; padding: 0; gap: 0;
    justify-content: center; border-radius: 999px;
  }
  html.sm .site-message-dock { right: max(0.55rem, env(safe-area-inset-right, 0px)); }
}

/* =====================================================================
   FINAL Sounds layout: ONE player, in the page (never floating); compact album
   picker; one-line song rows; credits and share only in the player.
   ===================================================================== */
/* The open album: compact header (small cover, title, count), then the player, then the songs. */
html.sm-inline .sound-panels.has-stage { margin-bottom: 1.5rem; }
html.sm-inline .sound-panels.has-stage > .sound-panel.is-active { display: block !important; max-width: none; padding: 0; }
html.sm-inline .sound-album-head { display: flex; align-items: center; gap: 0.9rem; margin: 0; padding: 0; }
html.sm-inline .sound-album-head .sound-album-art { width: 3.9rem; height: 3.9rem; margin: 0; flex: none; border-radius: 6px; box-shadow: none; }
html.sm-inline .sp-stage-titlerow { flex: 1; min-width: 0; display: block; margin: 0; }
html.sm-inline .sound-album-titles { padding: 0; margin: 0; }
html.sm-inline .sound-album-titles .group-title { margin: 0; font-size: 1.4rem; line-height: 1.1; }
html.sm-inline .sound-album-titles .sound-album-credit { margin: 0.2rem 0 0; font-size: 0.72rem; }
html.sm-inline .sm-meta { margin: 0.15rem 0 0; font-size: 0.78rem; }
html.sm-inline .sm-actions, html.sm-inline .sound-album-head .sp-share { display: none !important; }

/* The one player */
html.sm-inline .sound-panel .section-player {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "info right" "center center";
  gap: 0.35rem 0.4rem; align-items: center; margin: 0.9rem 0 0.6rem; padding: 0.75rem 0.9rem 0.8rem;
  border: 1px solid var(--line-strong); border-radius: 12px; background: #1a1612; position: static;
}
html.sm-inline .sm-info { grid-area: info; display: block; min-width: 0; }
html.sm-inline .sm-thumb, html.sm-inline .sm-from { display: none; }
html.sm-inline .sm-text { min-width: 0; }
html.sm-inline .sp-now { margin: 0; font-size: 1.02rem; line-height: 1.25; color: #f0ebe3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.sm-inline .sm-right { grid-area: right; display: flex; align-items: center; gap: 0.1rem; }
html.sm-inline .sm-center { grid-area: center; display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
html.sm-inline .sp-controls { display: flex; justify-content: center; align-items: center; gap: 0.5rem; }
html.sm-inline .sm-shuffle-bar { display: grid; width: 2.6rem; height: 2.6rem; place-items: center; border: 0; background: transparent; color: #b3a89c; }
html.sm-inline .sm-shuffle-bar[aria-pressed="true"] { color: #c4a574; }
html.sm-inline .sm-shuffle-bar svg { width: 1.15rem; height: 1.15rem; }
html.sm-inline .sound-panel .sp-btn { border: 0; background: transparent; color: #f0ebe3; width: 2.6rem; height: 2.6rem; }
html.sm-inline .sound-panel .sp-btn svg { width: 0.9rem; height: 0.9rem; }
html.sm-inline .sound-panel .sp-play { width: 3.2rem; height: 3.2rem; border-radius: 50%; background: #f0ebe3; color: #100e0c; }
html.sm-inline .sound-panel .sp-seek { width: 100%; margin: 0; gap: 0.6rem; font-size: 0.75rem; color: #b3a89c; direction: ltr; }
html.sm-inline .sound-panel .sp-range { height: 1.1rem; }
html.sm-inline .sp-now-share.share-link.share-icon-btn { margin: 0; width: 2.6rem; height: 2.6rem; color: #b3a89c; text-decoration: none; }
html.sm-inline .sp-now-share .share-icon-std { width: 22px; height: 22px; }
html.sm-inline .sp-credits-sheet { bottom: 1rem; }

/* Songs: one line each (number, title, time), no buttons on the rows */
html.sm-inline .sound-panel .sp-list { max-height: none !important; overflow: visible !important; margin: 0; padding: 0; border: 0; border-top: 1px solid var(--line); background: transparent; }
html.sm-inline body.sm-has-dock { padding-bottom: 0; }

@media (max-width: 760px) {
  html.sm .site-message-dock { display: none !important; }
  html.sm .sounds-section .sp-row { padding-right: 0; }
  html.sm #site-header { position: static; }
  html.sm-inline .sound-panels.has-stage { margin-top: 0.4rem; }
}

/* --- final compaction (higher specificity than the stage grid rules) --- */
html.sm-inline .sound-panels.has-stage .sound-panel .sound-album-head { display: flex; align-items: center; gap: 0.8rem; margin: 0; padding: 0; }
html.sm-inline .sound-panels.has-stage .sound-panel .sound-album-head .sound-album-art { display: block; width: 3.6rem; height: 3.6rem; aspect-ratio: 1 / 1; object-fit: cover; flex: none; margin: 0; border-radius: 6px; box-shadow: none; }
html.sm-inline .sound-panels.has-stage .sound-panel .sp-stage-titlerow { flex: 1; min-width: 0; display: block; margin: 0; padding: 0; }
html.sm-inline .sound-panels.has-stage .sound-panel .sound-album-titles .group-title { margin: 0; font-size: 1.3rem; line-height: 1.1; }
html.sm-inline .sound-panels.has-stage .sound-panel .sound-album-titles .sound-album-credit { margin: 0.15rem 0 0; font-size: 0.7rem; line-height: 1.2; }
html.sm-inline .sound-panels.has-stage .sound-panel .sm-meta { margin: 0.1rem 0 0; font-size: 0.74rem; line-height: 1.2; }
html.sm .sounds-page > .page-title { margin-bottom: 0.9rem; }
html.sm-inline .sound-panel .section-player { margin: 0.7rem 0 0.4rem; padding: 0.55rem 0.8rem 0.6rem; gap: 0.1rem 0.3rem; }
html.sm-inline .sp-now { font-size: 0.98rem; }
html.sm-inline .sound-panel .sp-btn { width: 2.4rem; height: 2.4rem; }
html.sm-inline .sound-panel .sp-play { width: 2.9rem; height: 2.9rem; }
html.sm-inline .sm-shuffle-bar { width: 2.4rem; height: 2.4rem; }
html.sm-inline .sp-now-share.share-link.share-icon-btn, html.sm-inline .sp-now-credits { width: 2.4rem; height: 2.4rem; }

/* ===== LAYOUT v2: left = the one open player + its song list (3/4); right = every album's cover icon, stacked (1/4) ===== */
html.sm-inline .sounds-page { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); column-gap: 2.25rem; align-items: start; }
html.sm-inline .sounds-page > .page-title { grid-column: 1 / -1; margin-bottom: 0.9rem; }
html.sm-inline .sounds-page > .sound-panels { grid-column: 1; grid-row: 2; display: block; max-width: none; margin: 0 0 1.5rem; }
html.sm-inline .sounds-page > .sound-albums {
  grid-column: 2; grid-row: 2; position: sticky; top: 1rem; display: flex !important; flex-direction: column; gap: 0.35rem;
  margin: 0; padding: 0; overflow: visible; grid-template-columns: none;
}
html.sm .sound-album {
  display: flex !important; flex-direction: row; align-items: center; gap: 0.8rem; width: auto; min-width: 0; flex: none;
  padding: 0.4rem 0.55rem; border: 1px solid transparent; border-radius: 10px; background: transparent; color: #d8d0c4; text-decoration: none;
}
html.sm .sound-album:hover { background: #1c1814; }
html.sm .sound-album .sound-album-cover { display: block !important; position: relative; width: 3.1rem; height: 3.1rem; flex: none; margin: 0; border-radius: 6px; overflow: hidden; background: #1a1612; }
html.sm .sound-album .sound-album-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
html.sm .sound-album .sound-album-count,
html.sm .sound-album .sound-album-credit,
html.sm .sound-album .sound-album-eq { display: none !important; }
html.sm .sound-album .sound-album-name { display: block; margin: 0; padding: 0; min-height: 0; font-size: 1.05rem; line-height: 1.2; white-space: normal; -webkit-line-clamp: unset; color: inherit; }
html.sm .sound-album[aria-current="true"] { border-color: #c4a574; background: #241e17; }
html.sm .sound-album[aria-current="true"] .sound-album-name { color: #c4a574; }

/* The big viewer: a large album cover for the open collection (overrides the compact 3.6rem thumb). */
html.sm-inline .sound-panel:not(.is-active) { display: none !important; }
html.sm-inline .sound-panels.has-stage .sound-panel.is-active > .sound-album-head,
html.sm-inline .sound-panels.has-stage .sound-panel .sound-album-head {
  display: flex;
  align-items: flex-end;
  gap: 1.25rem;
  margin: 0 0 0.85rem;
  padding: 0;
}
html.sm-inline .sound-panels.has-stage .sound-panel .sound-album-head .sound-album-art {
  display: block;
  width: 15.5rem;
  height: 15.5rem;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  flex: none;
  margin: 0;
  border-radius: 8px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.55);
}
html.sm-inline .sound-panels.has-stage .sound-panel .sound-album-titles .group-title {
  margin: 0;
  font-size: clamp(1.85rem, 3.4vw, 3.1rem);
  line-height: 1.05;
}

/* Phones (<=800px): the big cover + player + that album's songs come FIRST;
   the other albums are a list right UNDER the songs. Never above the player.
   See LAYOUT-RULES.md and tools/sounds-layout-guard.js. */
@media (max-width: 800px) {
  html.sm-inline .sounds-page { display: flex; flex-direction: column; align-items: stretch; }
  html.sm-inline .sounds-page > .sound-panels,
  html.sm-inline .sound-panels.has-stage > .sound-panel.is-active { display: contents !important; }
  html.sm-inline .sounds-page > .page-title { order: 0; margin-bottom: 0.55rem; }
  html.sm-inline .sounds-page > .sound-albums { order: 20; position: static; display: flex !important; flex-direction: column; grid-template-columns: none; gap: 0.35rem; margin: 1.6rem 0 0; }
  html.sm-inline .sound-panel.is-active > * { order: 5; }
  html.sm-inline .sound-panel.is-active > .sound-album-head { order: 2; }
  html.sm-inline .sound-panel.is-active > .section-player { order: 3; }
  html.sm-inline .sound-panel .sp-list { margin-top: 0 !important; }
  html.sm .sound-album { flex-direction: column; align-items: center; gap: 0.25rem; padding: 0.35rem 0.1rem 0.3rem; text-align: center; }
  html.sm .sound-album .sound-album-cover { width: 2.7rem; height: 2.7rem; }
  html.sm .sound-album .sound-album-name { font-size: 0.64rem; line-height: 1.12; letter-spacing: 0; min-height: 2.24em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  html.sm-inline .sound-panels.has-stage .sound-panel .sound-album-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.7rem;
    margin: 0 0 0.2rem;
  }
  html.sm-inline .sound-panels.has-stage .sound-panel .sound-album-head .sound-album-art {
    width: min(18rem, 78vw);
    height: auto;
    max-width: 18rem;
    aspect-ratio: 1 / 1;
  }
  html.sm-inline .sound-panels.has-stage .sound-panel .sound-album-titles { text-align: center; }
  html.sm-inline .sound-panels.has-stage .sound-panel .sound-album-titles .group-title { font-size: 1.7rem; }
}

/* ===== LAYOUT RULES (authoritative, keep LAST in this file; see LAYOUT-RULES.md) =====
   Desktop: left ~3/4 = open album cover, title, player, and the full song list
   in 2 columns (3 if the list is long) so every song sits on one screen with
   the other albums stacked down the right, all visible without page scroll.
   Phone (<=800px): cover, title, player, the full song list (compact one-line
   rows, 2 columns; 3 if the list is long), THEN the albums. Nothing above the
   player but the site header and the small SOUNDS label.
   The open list is never an inner scroll box; every Listening Room row stays
   in the first screen. tools/sounds-layout-guard.js enforces this. */

/* Tighten Sounds page chrome so the list can sit on one screen. */
html.sm-inline main { padding-top: 0.85rem; padding-bottom: 3rem; }
html.sm-inline .sounds-page > .page-title { margin-bottom: 0.45rem; }
html.sm-inline .sound-panels.has-stage { margin-bottom: 0.8rem; }
html.sm-inline .sound-panels.has-stage .sound-panel.is-active > .sound-album-head,
html.sm-inline .sound-panels.has-stage .sound-panel .sound-album-head {
  margin: 0 0 0.4rem;
}
html.sm-inline .sound-panels.has-stage .sound-panel .sound-album-head .sound-album-art {
  width: 14.5rem;
  height: 14.5rem;
}
html.sm-inline .sound-panels.has-stage .sound-panel .section-player {
  margin: 0.3rem 0 0.25rem;
  padding: 0.4rem 0.7rem 0.4rem;
}

/* Full song list visible at once: 2 columns, 3 if there are more than 42 songs.
   No max-height, no inner scroll. Beat earlier html.sm .sp-list margins. */
html.sm-inline .sound-panels.has-stage .sound-panel .sp-list,
html.sm-inline .sound-panel .sp-list {
  max-height: none !important;
  overflow: visible !important;
  margin: 0 !important;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  column-count: 2;
  column-gap: 1.4rem;
  column-fill: balance;
}
html.sm-inline .sound-panels.has-stage .sound-panel .sp-list:has(> .sp-row:nth-child(43)),
html.sm-inline .sound-panel .sp-list:has(> .sp-row:nth-child(43)) {
  column-count: 3;
  column-gap: 1.05rem;
}

/* Compact one-line rows (title + length). Notes stay behind the ⓘ. */
html.sm-inline .sounds-section .sp-row {
  break-inside: avoid;
  page-break-inside: avoid;
  -webkit-column-break-inside: avoid;
  display: flex;
  align-items: center;
  padding: 0;
  margin: 0;
  min-width: 0;
  max-width: 100%;
  border-bottom: 1px solid var(--line);
}
html.sm-inline .sounds-section .sp-track {
  min-height: 0 !important;
  height: auto;
  padding: 0.08rem 0.15rem !important;
  gap: 0.35rem !important;
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
  font-size: 0.82rem;
  line-height: 1.2;
}
html.sm-inline .sounds-section .sp-track-num {
  flex: 0 0 1.15rem;
  font-size: 0.7rem;
  line-height: 1.2;
}
html.sm-inline .sounds-section .sp-track-title {
  flex: 1 1 0;
  min-width: 0;
  font-size: 0.82rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html.sm-inline .sounds-section .sp-track-dur {
  flex: 0 0 auto;
  min-width: 2.1rem;
  font-size: 0.7rem;
  line-height: 1.2;
}
/* Share icon is only on the playing row; shrink it so the row stays one line. */
html.sm-inline .sp-row > .sp-song-share.share-link.share-icon-btn {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0 0 0 0.1rem;
  padding: 0;
}
html.sm-inline .sp-row > .sp-song-share .share-icon-std { width: 12px; height: 12px; }

@media (max-width: 800px) {
  html.sm-inline main { padding-top: 0.55rem; padding-bottom: 2.25rem; }
  html.sm-inline .sounds-page > .sound-albums { order: 20 !important; }
  html.sm-inline .sound-panels.has-stage .sound-panel .sp-stage-titlerow { width: 100%; }
  html.sm-inline .sounds-page .sound-album { flex-direction: row; align-items: center; text-align: left; gap: 0.8rem; padding: 0.4rem 0.55rem; }
  html.sm-inline .sounds-page .sound-album .sound-album-cover { width: 3rem; height: 3rem; outline: 0; }
  html.sm-inline .sounds-page .sound-album .sound-album-name { font-size: 1rem; line-height: 1.2; min-height: 0; display: block; -webkit-line-clamp: unset; overflow: visible; margin: 0; }

  /* Smaller cover so the full Listening Room list fits on one phone screen. */
  html.sm-inline .sound-panels.has-stage .sound-panel.is-active > .sound-album-head,
  html.sm-inline .sound-panels.has-stage .sound-panel .sound-album-head {
    flex-direction: column;
    align-items: center !important;
    text-align: center;
    gap: 0.3rem;
    margin: 0 0 0.1rem;
  }
  html.sm-inline .sound-panels.has-stage .sound-panel .sound-album-head .sound-album-art {
    width: min(7.75rem, 36vw);
    height: auto;
    max-width: 7.75rem;
    aspect-ratio: 1 / 1;
  }
  html.sm-inline .sound-panels.has-stage .sound-panel .sound-album-titles { text-align: center; }
  html.sm-inline .sound-panels.has-stage .sound-panel .sound-album-titles .group-title { font-size: 1.2rem; }
  html.sm-inline .sound-panels.has-stage .sound-panel .section-player {
    margin: 0.25rem 0 0.2rem;
    padding: 0.3rem 0.55rem 0.3rem;
  }
  html.sm-inline .sound-panels.has-stage .sound-panel .sp-list,
  html.sm-inline .sound-panel .sp-list {
    column-count: 2;
    column-gap: 0.65rem;
  }
  html.sm-inline .sound-panels.has-stage .sound-panel .sp-list:has(> .sp-row:nth-child(45)),
  html.sm-inline .sound-panel .sp-list:has(> .sp-row:nth-child(45)) {
    column-count: 3;
    column-gap: 0.4rem;
  }
  html.sm-inline .sounds-section .sp-track {
    font-size: 13px;
    padding: 0.05rem 0.05rem !important;
    gap: 0.22rem !important;
  }
  html.sm-inline .sounds-section .sp-track-title { font-size: 13px; line-height: 1.15; }
  html.sm-inline .sounds-section .sp-track-num,
  html.sm-inline .sounds-section .sp-track-dur { font-size: 11px; line-height: 1.15; }
  html.sm-inline .sounds-section .sp-track-num { flex-basis: 0.95rem; flex: 0 0 0.95rem; }
  html.sm-inline .sounds-section .sp-track-dur { min-width: 1.85rem; }
}

/* Highlight bug (Nov 29): on phones (hover: none) a tapped row keeps :hover after the
   song moves on, so styles.css's .sp-track:hover gold tint left a second gold row.
   Only the current song is gold on touch screens. */
@media (hover: none), (pointer: coarse) {
  .sp-track:not(.is-current):hover .sp-track-title { color: var(--ink); }
}
