/* ============================================================
   h0b0 — songs page
   v2 architecture: one composed scene SVG fills the viewport,
   pinned to the bottom (preserveAspectRatio="xMidYMax slice"
   inside the SVG file). Content overlays on top. Player bar
   pinned to bottom over everything.
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: #2d3543;
  color: #f4ead8;
  font-family: 'Iowan Old Style', 'Palatino', 'Georgia', serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

/* ---------- scene layer ---------- */

.scene-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Visually hidden text for screen readers */
.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;
}

/* Clear, high-contrast focus rings for keyboard / low-vision users */
:focus-visible {
  outline: 2px solid #d4a56a;
  outline-offset: 2px;
  border-radius: 2px;
}

/* Skip link for keyboard/screen reader users */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #d4a56a;
  color: #1a1410;
  padding: 8px 12px;
  z-index: 100;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 0;
}

.scene-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  /* .scene-layer blocks pointer events; re-enable on the object itself so
     user-grown flowers can receive hover/click. Inside the scene doc,
     only .user-flower groups opt back in — see injectSceneStyles(). */
  pointer-events: auto;
}

/* ---------- content layer ---------- */

.content-layer {
  /* fixed-page layout: the column fills the viewport, the masthead and
     controls stay pinned in place at the top, and only the inner
     .scroll-region scrolls. body itself does not scroll. */
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 4vh 32px 0;
  display: flex;
  flex-direction: column;
  /* the column itself is click-through so flowers behind empty regions
     (gaps between rows, the masthead margins) stay hoverable.
     Children that need interaction opt back in below. */
  pointer-events: none;
}

.scroll-region {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  pointer-events: auto;
  /* clear the fixed player bar so the last row doesn't hide under it */
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
  /* a soft fade so rows don't pop hard at the top edge as they scroll */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, black 14px);
          mask-image: linear-gradient(to bottom, transparent 0, black 14px);
  /* thin warm scrollbar — barely there until hovered, matches the palette */
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 165, 106, 0.28) transparent;
}

/* When the list AND both overlays (lyrics, stats) are hidden, the scroll-
   region holds nothing. Make it pointer-transparent so flowers behind it
   become hoverable again — fixes the regression where flora in the center
   column couldn't be tipped even with ≡ hiding the list. */
body.list-hidden:not(.lyrics-mode):not(.stats-mode) .scroll-region {
  pointer-events: none;
}

.scroll-region::-webkit-scrollbar { width: 8px; }
.scroll-region::-webkit-scrollbar-track { background: transparent; }
.scroll-region::-webkit-scrollbar-thumb {
  background: rgba(212, 165, 106, 0.22);
  border: 2px solid transparent;
  border-radius: 6px;
  background-clip: content-box;
  transition: background 0.2s ease;
}
.scroll-region:hover::-webkit-scrollbar-thumb { background: rgba(212, 165, 106, 0.4); background-clip: content-box; }
.scroll-region::-webkit-scrollbar-thumb:hover { background: rgba(212, 165, 106, 0.6); background-clip: content-box; }

.heart-btn,
.song-row {
  pointer-events: auto;
}

.content-spacer { display: none; }

/* ---------- masthead ---------- */

.masthead {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  flex-shrink: 0;
}

.heart-btn {
  width: 38px;
  height: 50px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.heart-btn:hover { transform: scale(1.08); }
.heart-btn:active { transform: scale(0.95); }

.heart-svg {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.wordmark {
  height: 56px;
  width: auto;
  pointer-events: none;
}

.view-toggles {
  margin-left: auto;
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.view-toggle {
  background: rgba(26, 20, 16, 0.45);
  border: 0.5px solid rgba(212, 165, 106, 0.3);
  color: #c9b890;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  padding: 0;
}

.view-toggle:hover {
  color: #f4ead8;
  border-color: rgba(212, 165, 106, 0.5);
}

.view-toggle[aria-pressed="false"] {
  color: #6e5a3a;
  border-color: rgba(212, 165, 106, 0.12);
  background: rgba(26, 20, 16, 0.25);
}

/* hidden states drive content visibility */
.list-hidden .tagline,
.list-hidden .list-controls,
.list-hidden .song-list { display: none; }

.player-hidden .player-bar { display: none !important; }

.tagline {
  font-style: italic;
  color: #c9b890;
  font-size: 15px;
  margin-bottom: 16px;
  margin-left: 4px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* ---------- list controls (sort + year filter) ---------- */

.list-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 0 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  pointer-events: auto;
  flex-shrink: 0;
}

.list-sort {
  background: rgba(26, 20, 16, 0.45);
  border: 0.5px solid rgba(212, 165, 106, 0.3);
  color: #f4ead8;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.list-sort:hover {
  color: #f4ead8;
  border-color: rgba(212, 165, 106, 0.5);
}

.list-locate {
  background: rgba(26, 20, 16, 0.45);
  border: 0.5px solid rgba(212, 165, 106, 0.3);
  color: #d4a56a;
  font-size: 13px;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  line-height: 1;
}
.list-locate:hover {
  border-color: rgba(212, 165, 106, 0.55);
  background: rgba(212, 165, 106, 0.12);
}

.list-search {
  background: rgba(26, 20, 16, 0.45);
  border: 0.5px solid rgba(212, 165, 106, 0.3);
  color: #f4ead8;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  font-family: inherit;
  width: 140px;
  transition: color 0.15s ease, border-color 0.15s ease;
  outline: none;
}

.list-search::placeholder { color: #8a7a55; }

.list-search:hover { border-color: rgba(212, 165, 106, 0.5); }

.list-search:focus {
  border-color: #d4a56a;
  background: rgba(26, 20, 16, 0.6);
}

.list-search:focus-visible {
  outline: 2px solid #d4a56a;
  outline-offset: 0;
}

.list-years {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  /* Years always wrap to their own row beneath chips/search/sort. Without
     this, year buttons interleave with mixtape-chips when many tapes exist
     and the layout becomes unreadable. */
  flex: 0 0 100%;
}

/* mixtape filter chips — sit between search and year buttons. Generalizes
   to one chip per placed mixtape; today there's just the favorites ♥ chip.
   Active chip filters the list to that mixtape's song-set, composes with
   year + sort + search. */
.mixtape-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mixtape-chip {
  background: transparent;
  border: 0.5px solid rgba(212, 165, 106, 0.2);
  color: #f4ead8;
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.mixtape-chip img {
  width: 12px;
  height: auto;
  pointer-events: none;
  filter: grayscale(0.9) opacity(0.5);
  transition: filter 0.15s ease;
}

.mixtape-chip:hover {
  border-color: rgba(212, 165, 106, 0.4);
}
.mixtape-chip:hover img { filter: grayscale(0) opacity(0.9); }

.mixtape-chip.is-active {
  background: rgba(143, 66, 60, 0.55);
  border-color: rgba(143, 66, 60, 0.8);
}

.mixtape-chip.is-active img { filter: grayscale(0) opacity(1); }

.year-btn {
  background: transparent;
  border: 0.5px solid rgba(212, 165, 106, 0.2);
  color: #f4ead8;
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.year-btn:hover {
  color: #f4ead8;
  border-color: rgba(212, 165, 106, 0.4);
}

.year-btn.is-active {
  background: #d4a56a;
  color: #1a1410;
  border-color: #d4a56a;
}

/* ---------- mixtape letter header ---------- */
/* Shown above the list when the mixtape filter is active and the tape has
   a message and/or fromName. Reads like an opened envelope — italic serif
   for the message, small caps for "from X". */
.mixtape-letter {
  margin: 0 0 14px;
  padding: 14px 16px;
  background: rgba(26, 20, 16, 0.45);
  border: 0.5px solid rgba(212, 165, 106, 0.28);
  border-radius: 8px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.mixtape-letter .ml-from {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #b8a878;
  margin-bottom: 6px;
}

.mixtape-letter .ml-msg {
  font-family: 'Iowan Old Style', 'Palatino', 'Georgia', serif;
  font-style: italic;
  font-size: 15px;
  line-height: 1.45;
  color: #f4ead8;
}

/* hide the letter under lyrics/stats modes — those modes also hide the
   song list, so the letter would float orphaned */
body.lyrics-mode .mixtape-letter,
body.stats-mode  .mixtape-letter { display: none; }

/* ---------- song list ---------- */

.song-list {
  list-style: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  padding-right: 1rem;
}



.song-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 12px;
  border-bottom: 0.5px solid rgba(244, 234, 216, 0.15);
  transition: background 0.2s ease;
  border-radius: 8px;
  background: rgba(26, 20, 16, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  margin-bottom: 6px;
}

.song-row:hover {
  background: rgba(26, 20, 16, 0.55);
}

.song-row.is-playing {
  background: rgba(26, 20, 16, 0.65);
  border-left: 2px solid #d4a56a;
  padding-left: 10px;
}

.song-play {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(244, 234, 216, 0.4);
  background: transparent;
  color: #f4ead8;
  font-size: 11px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  padding: 0;
  padding-left: 2px;
}

.song-row.is-playing .song-play {
  background: #d4a56a;
  border-color: #d4a56a;
  color: #1a1410;
  padding-left: 0;
}

.song-play:hover {
  border-color: #d4a56a;
  color: #d4a56a;
}

.song-row.is-playing .song-play:hover {
  background: #e0b478;
  color: #1a1410;
}

.song-info {
  flex: 1;
  min-width: 0;
}

/* a small stamp of the same flower that grew in the meadow for this song.
   only present on rows where the user has listened enough for a flower to
   sprout — closes the loop between the list and the meadow visually. */
.song-flower {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  opacity: 0.85;
  pointer-events: none;
  object-fit: contain;
}

/* row + player-bar heart — toggles favorites membership. Uses heart.svg art
   (the same warm-red asset as the masthead heart). Hollow state desaturates
   and dims the SVG so it reads as "not yet"; filled state shows full color. */
.song-fav,
.pb-fav {
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: transform 0.15s ease;
}

.song-fav img {
  width: 18px;
  height: auto;
  pointer-events: none;
  filter: grayscale(0.9) opacity(0.35);
  transition: filter 0.18s ease;
}

.song-fav[aria-pressed="true"] img {
  filter: grayscale(0) opacity(1);
}

.song-fav:hover img { filter: grayscale(0) opacity(0.85); }
.song-fav[aria-pressed="true"]:hover img { filter: grayscale(0) opacity(1); }
.song-fav:hover { transform: scale(1.10); }

/* small tape stamp on rows whose song is in any user-tape. Visually parallel
   to .song-flower — informational, not interactive. Tooltip lists tape names. */
.song-tapemark {
  width: 18px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.78;
  pointer-events: auto;
  object-fit: contain;
}

/* per-row "+" button — opens the add-to-mixtape popover. Sits between the
   info column and the heart fav button. Quiet by default; warms on hover. */
.song-add {
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #b8a878;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
  font-family: inherit;
}

.song-add:hover {
  color: #f4ead8;
  background: rgba(212, 165, 106, 0.15);
  transform: scale(1.10);
}

.pb-fav {
  padding: 0 2px;
  margin-left: 4px;
}

.pb-fav img {
  width: 14px;
  height: auto;
  pointer-events: none;
  filter: grayscale(0.9) opacity(0.40);
  transition: filter 0.18s ease;
}

.pb-fav[aria-pressed="true"] img {
  filter: grayscale(0) opacity(1);
}

.pb-fav:hover img { filter: grayscale(0) opacity(0.9); }
.pb-fav:hover { transform: scale(1.12); }

.song-title {
  font-size: 15px;
  font-weight: 500;
  color: #f4ead8;
}

.song-meta {
  font-size: 11px;
  color: #b8a878;
  margin-top: 2px;
}

.song-lyrics {
  font-family: 'Iowan Old Style', 'Palatino', 'Georgia', serif;
  font-size: 14px;
  line-height: 1.55;
  color: #e8dcb8;
  white-space: pre-wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 0.5px solid rgba(212, 165, 106, 0.25);
  animation: lyricsIn 0.4s ease both;
}

@keyframes lyricsIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .song-lyrics { animation: none; }
}

/* ---------- player bar ---------- */

.player-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  background: rgba(26, 20, 16, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 0.5px solid rgba(212, 165, 106, 0.25);
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom)) 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
}

.pb-btn {
  background: none;
  border: none;
  color: #c9b890;
  font-size: 14px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.pb-btn:hover { color: #f4ead8; }

.pb-play {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #d4a56a;
  color: #1a1410;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  padding-left: 2px;
}

.pb-play:hover { background: #e0b478; color: #1a1410; }
.pb-play[data-playing="true"] { padding-left: 0; }

.pb-btn[aria-pressed="true"] {
  color: #d4a56a;
  background: rgba(212, 165, 106, 0.15);
  border-radius: 4px;
}

.pb-info { flex: 1; min-width: 0; }

/* "from <tape> · pos/total" line above the song title when playing from a
   mixtape queue. Hidden when no queue is active. */
.pb-context {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: #b8a878;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pb-context .pbc-label  { color: #8a7a55; font-style: italic; }
.pb-context .pbc-value  { color: #d4c89a; }
.pb-context .pbc-counter{ color: #8a7a55; font-variant-numeric: tabular-nums; }

.pb-titleline {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.pb-date {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  font-size: 11px;
  color: #b8a878;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

.pb-title {
  font-size: 13px;
  font-weight: 500;
  color: #f4ead8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.pb-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.pb-time {
  font-size: 10px;
  color: #b8a878;
  font-variant-numeric: tabular-nums;
  min-width: 28px;
}

.pb-time:last-of-type { text-align: right; }

.pb-bar {
  flex: 1;
  height: 3px;
  background: rgba(244, 234, 216, 0.18);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
}

.pb-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: #d4a56a;
  border-radius: 2px;
  transition: width 0.1s linear;
}

/* ---------- seed-place mode (mixtape placement ritual) ---------- */
/* When the user is placing a tape-flower in the meadow, body.seed-mode
   activates: a tape-seed sprite follows the cursor, and a small hint banner
   appears reminding them to click the meadow or press Esc to cancel. */

body.seed-mode { cursor: crosshair; }
body.seed-mode .song-list,
body.seed-mode .player-bar,
body.seed-mode .list-controls { opacity: 0.55; transition: opacity 0.2s ease; }

.seed-cursor {
  position: fixed;
  width: 60px;
  height: 42px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 6;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55));
  opacity: 0;
  transition: opacity 0.18s ease;
}

.seed-cursor.is-visible { opacity: 1; }

.seed-hint {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  background: rgba(26, 20, 16, 0.85);
  border: 0.5px solid rgba(212, 165, 106, 0.4);
  color: #f4ead8;
  font-family: 'Iowan Old Style', 'Palatino', 'Georgia', serif;
  font-style: italic;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 8px;
  pointer-events: none;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.seed-hint .sh-esc {
  font-style: normal;
  color: #b8a878;
  font-size: 12px;
  margin-left: 8px;
}

/* shared-tape variant — recipient flow shows sender + message above the
   placement instruction, in a slightly larger, more "letter-like" block. */
.seed-hint.is-shared {
  white-space: normal;
  text-align: center;
  max-width: min(520px, calc(100% - 32px));
  padding: 12px 18px;
}

.seed-hint .sh-from {
  display: block;
  font-style: normal;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #b8a878;
  margin-bottom: 4px;
}

.seed-hint .sh-msg {
  display: block;
  font-style: italic;
  font-size: 16px;
  color: #f4ead8;
  line-height: 1.4;
  margin-bottom: 8px;
}

.seed-hint .sh-action {
  display: block;
  font-style: italic;
  color: #d4c89a;
  font-size: 13px;
}

.seed-hint.is-shared .sh-esc {
  display: block;
  margin-left: 0;
  margin-top: 4px;
}

/* a brief shake on the seed-cursor when the user clicks an invalid spot
   (cabin exclusion, off-meadow). lets them know the click was heard but
   the spot is no good — without a verbal error message. */
@keyframes seedReject {
  0%, 100% { transform: translate(-50%, -50%) translateX(0); }
  20%, 60% { transform: translate(-50%, -50%) translateX(-5px); }
  40%, 80% { transform: translate(-50%, -50%) translateX(5px); }
}

.seed-cursor.is-reject {
  animation: seedReject 0.35s ease both;
}

@media (prefers-reduced-motion: reduce) {
  .seed-cursor.is-reject { animation: none; }
}

/* ---------- floating heart messages ---------- */

.msg-layer {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}

.float-msg {
  position: absolute;
  font-style: italic;
  font-size: 16px;
  color: #ff8db3;
  white-space: nowrap;
  animation: floatup 3.5s ease-out forwards;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

@keyframes floatup {
  0%   { opacity: 0; transform: translate(-50%, 10px); }
  15%  { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -80px); }
}

/* ---------- flower tooltip ---------- */

.flower-tip {
  position: fixed;
  pointer-events: none;
  background: rgba(26, 20, 16, 0.88);
  color: #f4ead8;
  border: 0.5px solid rgba(212, 165, 106, 0.4);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translate(-50%, -100%) translateY(-10px);
  transition: opacity 0.18s ease;
  z-index: 5;
}

.flower-tip.is-visible { opacity: 1; }

.flower-tip .ft-title { color: #f4ead8; }
.flower-tip .ft-date  { color: #b8a878; font-size: 10px; margin-top: 2px; }

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

.heart-btn {
  animation: heartbeat 2.6s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .heart-btn { animation: none; }
  .float-msg { animation-duration: 1s; }
}

/* ---------- lyrics overlay ---------- */
/* Sits in normal content flow where the song list does. body.lyrics-mode
   hides the list and shows the overlay in its place; the meadow stays
   visible behind the content as usual. */

.lyrics-overlay { display: none; }

body.lyrics-mode .tagline,
body.lyrics-mode .list-controls,
body.lyrics-mode .song-list { display: none; }

body.lyrics-mode .lyrics-overlay {
  display: block;
  pointer-events: auto;
  padding: 8px 8px 24px;
  text-align: center;
  animation: lyOvIn 0.45s ease both;
}

@keyframes lyOvIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lo-inner {
  max-width: 520px;
  margin: 0 auto;
}

.lo-song-label {
  font-family: 'Iowan Old Style', 'Palatino', 'Georgia', serif;
  font-style: italic;
  font-size: 12px;
  color: #d4a56a;
  letter-spacing: 0.06em;
  opacity: 0.9;
}

.lo-song-date {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  font-size: 11px;
  color: #b8a878;
  margin-top: 4px;
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.lo-text {
  font-family: 'Iowan Old Style', 'Palatino', 'Georgia', serif;
  font-size: 12px;
  line-height: 1.85;
  color: #f4ead8;
  white-space: pre-wrap;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.lo-text.lo-empty {
  font-style: italic;
  color: #8a7a55;
  font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  body.lyrics-mode .lyrics-overlay { animation: none; }
}

/* ---------- stats overlay ---------- */
/* Same .scroll-region pattern as lyrics-overlay. body.stats-mode hides list
   + tagline + list-controls and reveals the stats panel. Mutually exclusive
   with lyrics-mode (the JS guards that). */

.stats-overlay { display: none; }

body.stats-mode .tagline,
body.stats-mode .list-controls,
body.stats-mode .song-list,
body.stats-mode .lyrics-overlay { display: none; }

body.stats-mode .stats-overlay {
  display: block;
  pointer-events: auto;
  padding: 8px 8px 24px;
  text-align: center;
  animation: lyOvIn 0.45s ease both;
}

.so-inner {
  max-width: 480px;
  margin: 0 auto;
}

.so-heading {
  font-family: 'Iowan Old Style', 'Palatino', 'Georgia', serif;
  font-style: italic;
  font-size: 14px;
  color: #d4a56a;
  letter-spacing: 0.06em;
  margin-bottom: 22px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.so-rows {
  margin: 0 auto;
  padding: 0;
  display: grid;
  grid-template-columns: auto auto;
  gap: 12px 24px;
  width: max-content;
  max-width: 100%;
  text-align: left;
  font-family: 'Iowan Old Style', 'Palatino', 'Georgia', serif;
}

/* Labels live over an open sky / meadow with no card behind them, so they
   need real contrast to read — went brighter (cream-tinted) and added the
   same text-shadow the values have. */
.so-rows dt {
  color: #e6dab8;
  font-size: 13px;
  letter-spacing: 0.04em;
  align-self: baseline;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.so-rows dd {
  margin: 0;
  color: #f4ead8;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* "most-listened song" can be long — let it wrap and italicize like a title */
.so-rows dd.so-title {
  font-style: italic;
  max-width: 22ch;
  word-break: break-word;
}

.so-empty {
  font-family: 'Iowan Old Style', 'Palatino', 'Georgia', serif;
  font-style: italic;
  font-size: 15px;
  color: #d4c89a;
  line-height: 1.7;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  body.stats-mode .stats-overlay { animation: none; }
}

/* ---------- add-to-mixtape popover ---------- */
/* Floats above the page, anchored under the row's "+" button. List of user
   tapes (skip favorites — heart row already does that) plus a "new tape with
   this song" entry. Click outside or Esc dismisses. */
.add-popover {
  position: fixed;
  z-index: 50;
  background: rgba(26, 20, 16, 0.96);
  border: 0.5px solid rgba(212, 165, 106, 0.45);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
  padding: 6px;
  min-width: 220px;
  max-width: 280px;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  color: #f4ead8;
  font-size: 12px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: popfade 0.15s ease-out;
}

@keyframes popfade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.add-pop-head {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8a7a55;
  padding: 6px 8px 4px;
}

.add-pop-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  color: inherit;
  text-align: left;
  font-family: inherit;
  font-size: 12px;
  padding: 7px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.add-pop-row:hover {
  background: rgba(212, 165, 106, 0.14);
}

.add-pop-row .app-mark {
  width: 14px;
  text-align: center;
  color: #d4a56a;
  flex-shrink: 0;
}

.add-pop-row[aria-pressed="true"] .app-mark {
  color: #d4a56a;
}

.add-pop-row .app-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.add-pop-row .app-count {
  color: #8a7a55;
  font-size: 10px;
  flex-shrink: 0;
}

.add-pop-row.add-pop-new {
  color: #d4a56a;
}

.add-pop-row.add-pop-new .app-mark {
  color: #d4a56a;
}

.add-pop-sep {
  height: 0.5px;
  background: rgba(212, 165, 106, 0.18);
  margin: 4px 6px;
}

/* ---------- tape details dialog (name + handwritten message) ---------- */
.tape-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 4, 0.55);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: popfade 0.18s ease-out;
}

.tape-dialog {
  width: min(420px, calc(100% - 32px));
  background: rgba(26, 20, 16, 0.97);
  border: 0.5px solid rgba(212, 165, 106, 0.4);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
  padding: 22px 22px 18px;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  color: #f4ead8;
}

.tape-dialog .td-heading {
  font-size: 16px;
  color: #f4ead8;
}

.tape-dialog .td-sub {
  font-size: 11px;
  color: #8a7a55;
  margin-bottom: 14px;
}

.tape-dialog .td-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #b8a878;
  margin: 10px 0 5px;
}

.tape-dialog .td-opt {
  text-transform: none;
  letter-spacing: 0;
  color: #6e6240;
  font-style: italic;
}

.tape-dialog .td-name,
.tape-dialog .td-msg {
  width: 100%;
  background: rgba(8, 6, 4, 0.55);
  border: 0.5px solid rgba(212, 165, 106, 0.3);
  border-radius: 6px;
  color: #f4ead8;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
  box-sizing: border-box;
}

.tape-dialog .td-name:focus,
.tape-dialog .td-msg:focus {
  border-color: #d4a56a;
  background: rgba(8, 6, 4, 0.75);
}

.tape-dialog .td-name:focus-visible,
.tape-dialog .td-msg:focus-visible {
  outline: 2px solid #d4a56a;
  outline-offset: 0;
}

/* handwritten feel for the message — italic serif on a slightly warmer bg */
.tape-dialog .td-msg {
  font-family: 'Iowan Old Style', 'Palatino', 'Georgia', serif;
  font-style: italic;
  font-size: 14px;
  line-height: 1.45;
  resize: vertical;
  min-height: 70px;
}

.tape-dialog .td-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.tape-dialog .td-cancel,
.tape-dialog .td-confirm {
  background: transparent;
  border: 0.5px solid rgba(212, 165, 106, 0.3);
  color: #f4ead8;
  font-size: 12px;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.tape-dialog .td-cancel:hover {
  border-color: rgba(212, 165, 106, 0.5);
}

.tape-dialog .td-confirm {
  background: rgba(212, 165, 106, 0.18);
  border-color: rgba(212, 165, 106, 0.6);
  color: #f4ead8;
}

.tape-dialog .td-confirm:hover {
  background: rgba(212, 165, 106, 0.32);
}

/* ---------- tape context menu (right-click / long-press) ---------- */
.tape-menu {
  position: fixed;
  z-index: 55;
  background: rgba(26, 20, 16, 0.96);
  border: 0.5px solid rgba(212, 165, 106, 0.45);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
  padding: 6px;
  min-width: 180px;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  color: #f4ead8;
  font-size: 12px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: popfade 0.12s ease-out;
}

.tape-menu-head {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8a7a55;
  padding: 6px 8px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.tape-menu-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  color: inherit;
  text-align: left;
  font-family: inherit;
  font-size: 12px;
  padding: 7px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.tape-menu-row:hover {
  background: rgba(212, 165, 106, 0.14);
}

.tape-menu-row .tm-mark {
  width: 14px;
  text-align: center;
  color: #d4a56a;
  flex-shrink: 0;
}

/* ---------- tape menu: separator + delete + inline confirm ---------- */

.tape-menu-sep {
  height: 0.5px;
  background: rgba(212, 165, 106, 0.18);
  margin: 4px 6px;
}

.tape-menu-row.is-delete { color: #e08080; }
.tape-menu-row.is-delete .tm-mark { color: #e08080; }
.tape-menu-row.is-delete:hover { background: rgba(224, 128, 128, 0.12); }

.tape-menu-confirm-msg {
  font-size: 11px;
  color: #f4ead8;
  padding: 8px 10px 4px;
  font-style: italic;
}

/* ---------- multi-select mode ---------- */

/* bar appended to .list-controls as a full-width row */
.multiselect-bar {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(212, 165, 106, 0.08);
  border: 0.5px solid rgba(212, 165, 106, 0.30);
  border-radius: 6px;
  margin-top: 4px;
  font-size: 11px;
  color: #d4c89a;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
}

.multiselect-bar .ms-actions { display: flex; gap: 6px; flex-shrink: 0; }

.multiselect-bar .ms-done,
.multiselect-bar .ms-cancel {
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  transition: background 0.12s ease;
}

.multiselect-bar .ms-done {
  color: #d4a56a;
  border: 0.5px solid rgba(212, 165, 106, 0.40);
}
.multiselect-bar .ms-done:not(:disabled):hover { background: rgba(212, 165, 106, 0.18); }
.multiselect-bar .ms-done:disabled { color: #5a4a30; border-color: rgba(212, 165, 106, 0.15); cursor: default; }

.multiselect-bar .ms-cancel { color: #8a7a55; }
.multiselect-bar .ms-cancel:hover { background: rgba(212, 165, 106, 0.08); color: #d4c89a; }

/* rows in multiselect mode */
body.multiselect-mode .song-row { cursor: pointer; }
body.multiselect-mode .song-row:hover { background: rgba(212, 165, 106, 0.07); }
body.multiselect-mode .song-row.multiselect-selected { background: rgba(212, 165, 106, 0.13); }

/* hide play + add buttons while in multiselect — row is the click target */
body.multiselect-mode .song-play,
body.multiselect-mode .song-add { display: none; }

/* selection-order badge shown at the left of selected rows */
.ms-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(212, 165, 106, 0.22);
  border: 0.5px solid rgba(212, 165, 106, 0.50);
  color: #d4a56a;
  font-size: 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  flex-shrink: 0;
  margin-right: 4px;
}

/* ---------- share dialog ---------- */
.share-dialog .td-heading em {
  font-style: italic;
  color: #d4c89a;
}

.share-dialog .sd-url {
  font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
  font-style: normal;
  font-size: 11px;
  line-height: 1.4;
  color: #d4c89a;
  word-break: break-all;
  white-space: pre-wrap;
}

.share-dialog .sd-status {
  font-size: 11px;
  color: #d4a56a;
  font-style: italic;
  min-height: 16px;
  margin-top: 8px;
}

/* ---------- mobile ---------- */

@media (max-width: 640px) {
  .content-layer { padding: 24px 18px 0; }
  .wordmark { height: 44px; }
  .heart-btn { width: 30px; height: 40px; }
  .masthead { gap: 10px; margin-bottom: 20px; }
  .tagline { font-size: 14px; margin-bottom: 24px; }
  .pb-time { display: none; }
  .pb-bar { height: 4px; }
  body.lyrics-mode .lyrics-overlay { padding-left: 0; padding-right: 0; }
  .lo-text { font-size: 15px; }
  body.stats-mode .stats-overlay { padding-left: 0; padding-right: 0; }
  .so-rows { gap: 8px 14px; }
  .so-rows dt { font-size: 13px; }
  .so-rows dd { font-size: 14px; }
}
