/* Echolace: mobile-first. 22 themes (11 dark, 11 light) share one set of colour tokens; the
   pickers show them in those two groups (THEMES in app.js). tools/check_contrast.py checks every
   theme defines every token and its text colours meet WCAG AA. The layout for wide screens
   (desktops, laptops, tablets held sideways) is the last section of this file. */

:root, [data-theme="aubergine"] {
  --bg: #221830; --surface: #2b2040; --raised: #382a50; --line: #4a3b63;
  --text: #f4eef8; --muted: #b3a5c8; --accent: #fdb876; --on-accent: #2a1530; --dislike: #9aa7e0; --meh: #ff7f4d; --on-meh: #2a1406;
  --logo-b: #c6b1f2; --logo-mid: #ff6fa8;
  --heat-0: #3b2b4b; --heat-1: #5c3247; --heat-2: #874344; --heat-3: #b85c45; --heat-4: #e5844f; --heat-5: #fdb876; --heat-6: #ffe3bf;
  color-scheme: dark;
}
[data-theme="violet"] {
  --bg: #1c1430; --surface: #251b3f; --raised: #312452; --line: #45356b;
  --text: #f3eefc; --muted: #b4a7d4; --accent: #b48cff; --on-accent: #1a0f33; --dislike: #f0a8c8; --meh: #ff9a55; --on-meh: #2a1406;
  --logo-b: #e2d4ff; --logo-mid: #f0a8c8;
  --heat-0: #2a1f45; --heat-1: #3b2a63; --heat-2: #523a85; --heat-3: #6c4ca8; --heat-4: #8c66d1; --heat-5: #b48cff; --heat-6: #e2d4ff;
  color-scheme: dark;
}
[data-theme="raspberry"] {
  --bg: #2a1220; --surface: #35172a; --raised: #442037; --line: #5c2c4b;
  --text: #fbeef4; --muted: #d0a9bd; --accent: #ff6fa8; --on-accent: #330a1c; --dislike: #a9b8e8; --meh: #ff9c55; --on-meh: #2a1406;
  --logo-b: #a9b8e8; --logo-mid: #ffd0e3;
  --heat-0: #3d1a2e; --heat-1: #5a2140; --heat-2: #7d2a55; --heat-3: #a7366c; --heat-4: #d74d88; --heat-5: #ff6fa8; --heat-6: #ffd0e3;
  color-scheme: dark;
}
[data-theme="midnight"] {
  --bg: #0f1a2b; --surface: #15233a; --raised: #1d2f4c; --line: #2b4166;
  --text: #eef4fb; --muted: #a6b8d0; --accent: #57d0c1; --on-accent: #062520; --dislike: #f2aaaa; --meh: #ff9d5c; --on-meh: #2a1406;
  --logo-b: #b6bcff; --logo-mid: #f2aaaa;
  --heat-0: #1a2b40; --heat-1: #173f4f; --heat-2: #15585f; --heat-3: #167470; --heat-4: #2b9a8b; --heat-5: #57d0c1; --heat-6: #bdf2eb;
  color-scheme: dark;
}
[data-theme="ocean"] {
  --bg: #0b1e24; --surface: #10282f; --raised: #17353e; --line: #224854;
  --text: #eaf6f8; --muted: #9fbfc7; --accent: #4fc3f7; --on-accent: #04202b; --dislike: #f2b0a0; --meh: #ffa060; --on-meh: #2a1406;
  --logo-b: #f2b0a0; --logo-mid: #c4ecfd;
  --heat-0: #12303a; --heat-1: #13435a; --heat-2: #155a7a; --heat-3: #1b739d; --heat-4: #2f97c9; --heat-5: #4fc3f7; --heat-6: #c4ecfd;
  color-scheme: dark;
}
[data-theme="moss"] {
  --bg: #141f19; --surface: #1b2a22; --raised: #25372d; --line: #35493c;
  --text: #f0f4ec; --muted: #b0bfad; --accent: #e2bf5f; --on-accent: #241c04; --dislike: #a8bbe4; --meh: #f5874f; --on-meh: #2a1406;
  --logo-b: #ccb9f2; --logo-mid: #e88f7a;
  --heat-0: #223027; --heat-1: #3b3e22; --heat-2: #5b5223; --heat-3: #7f6a26; --heat-4: #ad8c31; --heat-5: #e2bf5f; --heat-6: #f7e7b4;
  color-scheme: dark;
}
[data-theme="graphite"] {
  --bg: #1a1b1e; --surface: #232428; --raised: #2e2f34; --line: #3f4147;
  --text: #f1f2f6; --muted: #b3b6c1; --accent: #b3eb5e; --on-accent: #152103; --dislike: #b4b3f0; --meh: #ff9d5c; --on-meh: #2a1406;
  --logo-b: #c2b1f8; --logo-mid: #85e3e8;
  --heat-0: #2a2d26; --heat-1: #33421f; --heat-2: #425a1c; --heat-3: #57791d; --heat-4: #719d24; --heat-5: #b3eb5e; --heat-6: #d7f1b7;
  color-scheme: dark;
}
[data-theme="garnet"] {
  --bg: #2f1010; --surface: #3d1516; --raised: #4e1e1e; --line: #672d2d;
  --text: #ffeeed; --muted: #dea7a4; --accent: #a4bbff; --on-accent: #131b37; --dislike: #f1aec7; --meh: #ff9d5c; --on-meh: #2a1406;
  --logo-b: #f1aec7; --logo-mid: #ecd69b;
  --heat-0: #501115; --heat-1: #5d2446; --heat-2: #6a3d70; --heat-3: #785d9a; --heat-4: #8783c6; --heat-5: #a4bbff; --heat-6: #dde6ff;
  color-scheme: dark;
}
[data-theme="cocoa"] {
  --bg: #24180e; --surface: #2f2114; --raised: #3d2b1c; --line: #523d2a;
  --text: #faf1e9; --muted: #c9b29f; --accent: #7ee0b7; --on-accent: #002417; --dislike: #eda6c1; --meh: #ff9d5c; --on-meh: #2a1406;
  --logo-b: #eda6c1; --logo-mid: #edd5a3;
  --heat-0: #3d250d; --heat-1: #473b08; --heat-2: #4f561e; --heat-3: #567740; --heat-4: #5d9d6b; --heat-5: #7ee0b7; --heat-6: #c9f1de;
  color-scheme: dark;
}
[data-theme="olive"] {
  --bg: #1a1d09; --surface: #23260d; --raised: #2f3214; --line: #414522;
  --text: #f2f4e7; --muted: #b5bb99; --accent: #e28fe7; --on-accent: #29132b; --dislike: #8ac7ea; --meh: #ff9d5c; --on-meh: #2a1406;
  --logo-b: #8ac7ea; --logo-mid: #d7d688;
  --heat-0: #2b2f01; --heat-1: #573200; --heat-2: #813825; --heat-3: #a54a5b; --heat-4: #c6679c; --heat-5: #e28fe7; --heat-6: #fed8ff;
  color-scheme: dark;
}
[data-theme="cobalt"] {
  --bg: #0b1642; --surface: #0f1d55; --raised: #16276b; --line: #233888;
  --text: #edf2ff; --muted: #a5b6e1; --accent: #f4dc4b; --on-accent: #111c40; --dislike: #efa3c7; --meh: #ff9d5c; --on-meh: #2a1406;
  --logo-b: #7ed2ed; --logo-mid: #e7da8b;
  --heat-0: #101c72; --heat-1: #00444f; --heat-2: #005f52; --heat-3: #00823c; --heat-4: #789b07; --heat-5: #f4dc4b; --heat-6: #f1e8b1;
  color-scheme: dark;
}
[data-theme="porcelain"] {
  --bg: #f5f7fb; --surface: #ffffff; --raised: #e9edf5; --line: #d3dae6;
  --text: #141b2d; --muted: #4f5a72; --accent: #2a4fd0; --on-accent: #ffffff; --dislike: #4f5d7a; --meh: #b34a00; --on-meh: #ffffff;
  --logo-b: #6a42c2; --logo-mid: #e05a8a;
  --heat-0: #e9edf6; --heat-1: #cfdaf5; --heat-2: #a9bdef; --heat-3: #7b98e4; --heat-4: #5073da; --heat-5: #2a4fd0; --heat-6: #17318a;
  color-scheme: light;
}
[data-theme="lavender"] {
  --bg: #f6f3fc; --surface: #ffffff; --raised: #ebe5f7; --line: #d8cfee;
  --text: #1d1530; --muted: #5a4f73; --accent: #6b3fd4; --on-accent: #ffffff; --dislike: #5a5f78; --meh: #b24a00; --on-meh: #ffffff;
  --logo-b: #a283e2; --logo-mid: #c2185b;
  --heat-0: #efe9fa; --heat-1: #ddd0f5; --heat-2: #c3aced; --heat-3: #a283e2; --heat-4: #8460da; --heat-5: #6b3fd4; --heat-6: #45238f;
  color-scheme: light;
}
[data-theme="rose"] {
  --bg: #fff0f4; --surface: #ffffff; --raised: #fbdde7; --line: #f2c3d3;
  --text: #2e1420; --muted: #6e4a5a; --accent: #c2185b; --on-accent: #ffffff; --dislike: #5b5d70; --meh: #a84800; --on-meh: #ffffff;
  --logo-b: #6b3fd4; --logo-mid: #f5a3c0;
  --heat-0: #fae6ed; --heat-1: #f5c9d8; --heat-2: #eb9db9; --heat-3: #dd6d96; --heat-4: #cf3f75; --heat-5: #c2185b; --heat-6: #7f0e3a;
  color-scheme: light;
}
[data-theme="blush"] {
  --bg: #fbf2f4; --surface: #fffafb; --raised: #f4e3e8; --line: #e8cfd6;
  --text: #2b1520; --muted: #6c4b5a; --accent: #8a2c66; --on-accent: #ffffff; --dislike: #565b70; --meh: #ad4a00; --on-meh: #ffffff;
  --logo-b: #4f5fc0; --logo-mid: #e1a8c3;
  --heat-0: #f6e6ec; --heat-1: #efcfdd; --heat-2: #e1a8c3; --heat-3: #cb7aa4; --heat-4: #ae5088; --heat-5: #8a2c66; --heat-6: #5c1745;
  color-scheme: light;
}
[data-theme="mint"] {
  --bg: #f1f7f4; --surface: #ffffff; --raised: #e2efe8; --line: #cde0d6;
  --text: #14221b; --muted: #4c6157; --accent: #157a55; --on-accent: #ffffff; --dislike: #5a5f6a; --meh: #b04800; --on-meh: #ffffff;
  --logo-b: #6a42c2; --logo-mid: #9dd1b6;
  --heat-0: #e5f1eb; --heat-1: #c8e5d6; --heat-2: #9dd1b6; --heat-3: #6db894; --heat-4: #3f9c73; --heat-5: #157a55; --heat-6: #0b4d35;
  color-scheme: light;
}
[data-theme="sand"] {
  --bg: #f2f0ea; --surface: #faf9f5; --raised: #e7e3d8; --line: #d6d0c0;
  --text: #23211b; --muted: #5d584c; --accent: #536418; --on-accent: #ffffff; --dislike: #585c64; --meh: #a84600; --on-meh: #ffffff;
  --logo-b: #5d4cb0; --logo-mid: #e0a14a;
  --heat-0: #ebe9df; --heat-1: #dcdfc0; --heat-2: #c1c891; --heat-3: #9fac5d; --heat-4: #7e8e35; --heat-5: #536418; --heat-6: #34410d;
  color-scheme: light;
}
[data-theme="apricot"] {
  --bg: #fff2e7; --surface: #fffdfb; --raised: #ffe2ca; --line: #facba3;
  --text: #2b1908; --muted: #6a523d; --accent: #00686c; --on-accent: #ffffff; --dislike: #575d6f; --meh: #ae4800; --on-meh: #ffffff;
  --logo-b: #a43687; --logo-mid: #f2bb8a;
  --heat-0: #ffe6d1; --heat-1: #deddaa; --heat-2: #a9c798; --heat-3: #73ac8b; --heat-4: #3f8f81; --heat-5: #00686c; --heat-6: #04494c;
  color-scheme: light;
}
[data-theme="lemon"] {
  --bg: #f8f7d8; --surface: #fffef4; --raised: #eeebb7; --line: #dfd98b;
  --text: #201e06; --muted: #5b593b; --accent: #4246c2; --on-accent: #ffffff; --dislike: #535f6c; --meh: #ae4800; --on-meh: #ffffff;
  --logo-b: #a840a2; --logo-mid: #ddd674;
  --heat-0: #e7eaf9; --heat-1: #ced7ff; --heat-2: #a9b7fe; --heat-3: #8595ef; --heat-4: #6572dd; --heat-5: #4246c2; --heat-6: #2e3386;
  color-scheme: light;
}
[data-theme="pistachio"] {
  --bg: #ecfae2; --surface: #fbfff8; --raised: #d9f1c8; --line: #c0e2a6;
  --text: #16210d; --muted: #4e5d43; --accent: #9f268d; --on-accent: #ffffff; --dislike: #575d6f; --meh: #ae4800; --on-meh: #ffffff;
  --logo-b: #2266a4; --logo-mid: #b6dc97;
  --heat-0: #f4e6f1; --heat-1: #f6c9eb; --heat-2: #e5a3d6; --heat-3: #cf7bbd; --heat-4: #b753a4; --heat-5: #9f268d; --heat-6: #68185c;
  color-scheme: light;
}
[data-theme="lagoon"] {
  --bg: #e3fafc; --surface: #fafeff; --raised: #c9f0f5; --line: #a7e1e8;
  --text: #002326; --muted: #385f63; --accent: #006398; --on-accent: #ffffff; --dislike: #5b5c6e; --meh: #ae4800; --on-meh: #ffffff;
  --logo-b: #a43687; --logo-mid: #83d4dd;
  --heat-0: #c6f5fb; --heat-1: #a3e5f8; --heat-2: #7ac9e7; --heat-3: #51a8d1; --heat-4: #2488bb; --heat-5: #006398; --heat-6: #00446a;
  color-scheme: light;
}
[data-theme="paper"] {
  --bg: #eeeeed; --surface: #ffffff; --raised: #e2e1df; --line: #cfcfcc;
  --text: #1e1d1c; --muted: #585754; --accent: #262628; --on-accent: #ffffff; --dislike: #425f85; --meh: #ae4800; --on-meh: #ffffff;
  --logo-b: #c13c3b; --logo-mid: #c3bdb0;
  --heat-0: #eaebed; --heat-1: #c9cacd; --heat-2: #a4a4a7; --heat-3: #7f8082; --heat-4: #57585a; --heat-5: #262628; --heat-6: #0f0f11;
  color-scheme: light;
}

:root {
  --r-sm: 8px; --r-md: 16px; --r-lg: 24px; --r-pill: 999px;
  --tabbar: 64px;
  /* Capped at 34px, the most any iPhone has (the home indicator): at launch, iOS home-screen apps
     can report more, which lifted the tab bar off the bottom of the screen. */
  --safe-b: min(env(safe-area-inset-bottom, 0px), 34px);
  --safe-t: env(safe-area-inset-top, 0px);
  /* The tab bar (see html[data-standalone] below for the iPhone home-screen case):
     --strip    how much of the screen's bottom iOS may leave undrawn (0 except in home-screen apps)
     --vp-gap   how much it is leaving undrawn right now
     --bar-b    space below the icons: the home-indicator area, or the undrawn strip if bigger
     --bar-h    the tab bar's own height, which stops where the drawn page stops */
  --strip: 0px;
  --vp-gap: 0px;
  --bar-b: max(var(--safe-b), var(--strip));
  --bar-h: calc(var(--tabbar) + var(--bar-b) - var(--vp-gap));
  --font: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* touch-action: manipulation turns off double-tap to zoom (so quick taps on the rating and next
   buttons don't zoom the page) but keeps pinch to zoom for anyone who needs bigger text. Set on
   every element, since the screens scroll inside .scroller and a scroll box can reset it. */
html { -webkit-text-size-adjust: 100%; }
html, html * { touch-action: manipulation; }
/* iPhone home-screen apps (iOS 27): iOS treats the app as if it had Safari's collapsible toolbar.
   Measured on an iPhone (844px screen): the page is laid out and drawn only down to 797px (the
   small viewport, svh), leaving the bottom 47px undrawn (iOS fills it with the page's background
   colour), until a scroll makes iOS lay it out full height (dynamic viewport, dvh, grows to the
   large one, lvh = 844). In a home-screen app there is no toolbar, so:
     --strip  = lvh - svh: the strip iOS may leave undrawn (47px, fixed);
     --vp-gap = lvh - dvh: what it's leaving undrawn now (47px, then 0 after a scroll).
   The tab bar's icons always end where the drawn page ends at its shortest, and the strip below is
   filled in the tab bar's colour (html background below), so the bar looks the same either way.
   (data-standalone is set by app.js.) */
html[data-standalone] {
  --strip: max(0px, calc(100lvh - 100svh));
  --vp-gap: max(0px, calc(100lvh - 100dvh));
}
/* The page's own background is what iOS shows in that undrawn strip: the tab bar's colour while the
   app (with its tab bar) is showing; the page colour on sign-in and first run. */
html { background: var(--bg); }
html:has(#app:not([hidden])):not(:has(#flow:not([hidden]))) { background: var(--surface); }
/* The page itself never scrolls; the screens scroll inside .scroller (see index.html). Scrolling
   the page made iOS pan the screen past the layout, dragging the tab bar with it. Nothing in the
   page is taller than the screen, and overscroll-behavior stops the page bouncing. (Not
   overflow: hidden: on iOS that clips fixed elements too.) */
html, body { height: 100%; overscroll-behavior: none; }
body {
  margin: 0;
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.5;
  font-variation-settings: "opsz" 14;
  overscroll-behavior-y: none;
}
img { display: block; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg { flex: none; }

/* ---- shell ---- */
.scroller {
  position: fixed; inset: 0;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch;
}
.screen {
  max-width: 560px; margin: 0 auto;
  padding: calc(16px + var(--safe-t)) 16px calc(var(--bar-h) + 96px);
}
.screen h1 {
  font-size: 30px; line-height: 1.1; font-weight: 760; font-stretch: 85%;
  letter-spacing: -0.02em; margin: 6px 0 16px; font-variation-settings: "opsz" 72;
}
.screen h2 { font-size: 19px; font-weight: 700; margin: 28px 0 10px; }
.screen h3 { font-size: 16px; font-weight: 680; margin: 20px 0 8px; }
/* Settings sections that fold away: the heading is the button. */
.screen h2.sec-head { margin: 0; }
.sec-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  padding: 16px 0; background: none; border: 0; border-top: 1px solid var(--line); color: inherit;
  font: inherit; text-align: left; cursor: pointer; }
.sec-chev { flex: none; color: var(--muted); transition: transform .18s ease; }
.sec-toggle[aria-expanded="true"] .sec-chev { transform: rotate(180deg); }
.sec-toggle:hover .sec-chev { color: var(--text); }
.sec-head + .settings { padding-bottom: 8px; }
.settings[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { .sec-chev { transition: none; } }
.empty { color: var(--muted); margin: 8px 0; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  /* Icons and labels centred in the top --tabbar of the bar (equal space above and below them),
     then the home-indicator area. On an iPhone home-screen app, the part of that area iOS leaves
     undrawn is filled in the same colour by the page background, so the bar reads as one piece. */
  height: var(--bar-h);
  padding-bottom: calc(var(--bar-b) - var(--vp-gap));
  /* 6 tabs, or 7 with the host's Admin tab, all the same width however long their labels */
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar button {
  border: 0; background: none; color: var(--muted); padding: 0; min-width: 0;
  display: grid; place-items: center; align-content: center; gap: 2px;
  font-size: 12px; font-weight: 600; position: relative;
}
/* Narrow phones: narrower letters once the tabs get tight, so a label such as "Settings" keeps clear
   of its neighbours: the host's 7 tabs below 395px, 6 tabs below 340px, and a size smaller for the
   host's 7 on the narrowest. */
@media (max-width: 394px) { .is-admin .tabbar button { font-stretch: 85%; } }
@media (max-width: 339px) {
  .tabbar button { font-stretch: 85%; }
  .is-admin .tabbar button { font-size: 11px; }
}
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button[aria-selected="true"] { color: var(--accent); }
.badge {
  position: absolute; top: 8px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--accent); color: var(--on-accent); font-size: 11px; line-height: 16px;
}

/* mini "now playing" strip on other tabs */
.nowbar {
  position: fixed; left: 8px; right: 8px; z-index: 39;
  bottom: calc(var(--bar-h) + 8px);
  max-width: 544px; margin: 0 auto;
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  padding: 8px 8px 8px 8px; border-radius: var(--r-md);
  background: var(--raised); border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.nowbar img, .nowbar .ph { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--line); }
.nowbar .t { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.nowbar .a { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.nowbar .open { border: 0; background: none; text-align: left; padding: 0; min-width: 0; }

/* The YouTube player is always fixed-positioned; JS docks it into the Listen slot,
   or floats it (YouTube requires at least 200x200) when you're elsewhere. */
.player-dock {
  position: fixed; z-index: 45; overflow: hidden; border-radius: var(--r-md);
  background: #000; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.player-dock iframe { width: 100%; height: 100%; border: 0; display: block; }
.dock-back {
  position: fixed; z-index: 46; height: 32px; padding: 0 12px;
  border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}

/* ---- Listen ----
   Fills exactly one screen above the tab bar. The artwork/video area takes whatever
   height is left after the song details and buttons, so the buttons always stay
   above the tab bar. On a very short screen the area stops at 200px and the page scrolls. */
.listen {
  max-width: 560px; margin: 0 auto;
  min-height: 100%;   /* of .scroller, which is exactly the screen */
  padding: calc(12px + var(--safe-t)) 16px calc(var(--bar-h) + 12px);
  display: flex; flex-direction: column; gap: 12px;
}
.stage-wrap { flex: 1 1 0; min-height: 200px; container-type: size; display: grid; place-items: center; }
.listen-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; }
.wordmark { font-weight: 800; font-stretch: 75%; font-size: 22px; letter-spacing: -0.01em; font-variation-settings: "opsz" 96; display: inline-flex; align-items: center; gap: 8px; }
/* "beta" after the name (app.js BETA): a small tag in the theme's accent colour. */
.beta-pill {
  display: inline-block; font-size: 10.5px; font-weight: 750; font-stretch: 100%; letter-spacing: 0.1em; line-height: 1;
  font-variation-settings: normal; text-transform: uppercase; padding: 4px 7px 3px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--on-accent); margin-left: -1px; white-space: nowrap;
}
.logo-slot { display: inline-flex; }
.logo { display: block; width: auto; overflow: visible; }
.logo * { fill: none; stroke-width: 4; }
.logo .ra { stroke: var(--accent); }
.logo .rb { stroke: var(--logo-b); }
.logo .mid { fill: var(--logo-mid); stroke: none; }
.logo .gap { stroke: var(--bg); stroke-width: 10; }
.logo .ea { stroke: var(--accent); stroke-width: 1.2; opacity: 0.4; }
.logo .eb { stroke: var(--logo-b); stroke-width: 1.2; opacity: 0.4; }
.sign-logo { margin: 8px 0 18px; }
.source {
  display: inline-flex; align-items: center; gap: 6px; max-width: 70%;
  height: 32px; padding: 0 6px 0 12px; border-radius: var(--r-pill);
  background: var(--raised); border: 1px solid var(--line); font-size: 13px; font-weight: 600;
}
.source span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source button { border: 0; background: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.top-right { display: inline-flex; align-items: center; gap: 4px; min-width: 0; margin-right: 44px; }   /* room for feedback */
/* The feedback button: one for every tab, pinned to the top right of the content column. */
.top-anchor { position: absolute; top: 0; left: 0; right: 0; height: 0; max-width: 560px; margin: 0 auto; z-index: 5; pointer-events: none; }
.icon-btn.top-btn {
  position: absolute; right: 10px; top: calc(18px + var(--safe-t)); pointer-events: auto;   /* level with each h1 */
  width: 40px; height: 40px; color: var(--muted);
}
body[data-tab="listen"] .icon-btn.top-btn { top: calc(10px + var(--safe-t)); }   /* level with the Listen top bar */
.top-btn svg { width: 22px; height: 22px; }
.screen h1:first-child, .screen > .profile:first-child { padding-right: 48px; }
/* "I'm in the mood for": quiet until a genre is on, then it wears the accent. */
.mood-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; max-width: 170px; padding: 0 12px 0 10px;
  border-radius: var(--r-pill); border: 1.5px solid var(--line); background: none; color: var(--muted);
  font-size: 14px; font-weight: 650;
}
.mood-pill svg { width: 16px; height: 16px; flex: none; }
.mood-pill span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mood-pill.on { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.top-right .mood-pill { max-width: 132px; }
.reach-pill { color: var(--text); }   /* Discovery: always set, so never "off"-looking */
.reach-pill svg { color: var(--accent); }
/* Three pills (Discovery, Decade, Mood) don't fit beside the logo on phones, so there they get a row
   of their own under it, from the left edge (the feedback button sits level with the logo row). A long
   Mood name gives way (ellipsis) rather than pushing the pills off the screen. */
.top-right .mood-pill { min-width: 52px; flex: 0 1 auto; }
.top-right #btnDecade { flex-shrink: 0; }
.top-right .reach-pill { max-width: none; }   /* three fixed words: "Adventurous" never needs cutting */
@media (max-width: 560px) {
  .listen-top { flex-wrap: wrap; row-gap: 8px; }
  .top-right { flex: 1 0 100%; margin-right: 0; }
  .top-right .mood-pill { max-width: 170px; }   /* a row to themselves: "Adventurous" in full */
  .top-right .reach-pill { flex-shrink: 0; }   /* a long Mood name is the one that gives way */
}
/* The host has no feedback button (they read the messages), so no space is kept for it. */
.is-admin .top-right { margin-right: 0; }
.is-admin .screen h1:first-child, .is-admin .screen > .profile:first-child { padding-right: 0; }
.mood-pill.on svg { color: var(--accent); }
.source:not([hidden]) ~ .mood-pill { display: none; }   /* playing a blend: the blend pill says what's on */
.mood-list { display: grid; gap: 8px; margin: 8px 0 4px; }
.mood-opt {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%;
  min-height: 52px; padding: 8px 14px; border-radius: var(--r-md); border: 1.5px solid var(--line);
  background: var(--surface); text-align: left; color: var(--text);
}
.mood-opt b { font-weight: 650; }
.mood-opt .n { font-size: 13px; color: var(--muted); white-space: nowrap; }
.mood-opt[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.mood-opt.fit-new .n { color: var(--accent); }
.mood-group { margin: 14px 0 0; font-size: 14px; font-weight: 650; color: var(--muted); }
.ops-form label { display: block; font-weight: 650; margin: 18px 0 2px; }
.ops-form > label:first-child { margin-top: 0; }   /* straight under Admin's heading */
.ops-form .muted { margin: 0 0 8px; }
.ops-form select {
  width: 100%; min-height: 48px; padding: 0 16px; border-radius: var(--r-pill);
  border: 1.5px solid var(--line); background: var(--surface); color: inherit; font: inherit; font-size: 16px;
}
.check-row { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.check-row input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--accent); }
textarea.feedback-box, textarea.list-text {
  width: 100%; min-height: 120px; padding: 12px 14px; border-radius: var(--r-md); border: 1.5px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; resize: vertical;
}
textarea.list-text::placeholder { color: var(--muted); }
/* Importing a song list (Library > Playlists, first run): Upload a file / Paste a list. */
.list-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 8px; }
.list-paste { margin: 0 0 12px; }
.list-paste .btn { margin-top: 8px; }
/* "Which links work?": one short line per service. */
.src-help { list-style: none; margin: 6px 0 4px; padding: 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.src-help li { padding: 8px 0; border-top: 1px solid var(--line); }
.src-help li:first-child { border-top: 0; padding-top: 2px; }
.src-help li > b:first-child { display: block; color: var(--text); font-size: 15px; }
.inbox-item { padding: 12px 0; }
.inbox-item + .inbox-item { border-top: 1px solid var(--line); }
.inbox-item .who { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.inbox-item .who b { color: var(--text); }
.inbox-item.unread .who b::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.inbox-item p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.inbox-item .ctx { font-size: 13px; color: var(--muted); margin-top: 4px; }
.tabbar button { position: relative; }
.tabbar button.has-dot::after { content: ""; position: absolute; top: 8px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

.stage { position: relative; border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
/* First line of each pair: fallback for browsers without container units. */
.stage[data-mode="art"] { width: min(100%, 40vh); aspect-ratio: 1; width: min(100cqw, 100cqh, 520px); height: min(100cqw, 100cqh, 520px); }
.stage[data-mode="video"] { width: 100%; height: 200px; width: 100cqw; height: max(200px, min(100cqh, 56.25cqw)); }
.stage[data-mode="video-large"] { width: 100%; height: 260px; width: 100cqw; height: max(200px, min(100cqh, 75cqw)); }
.stage img.art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stage .empty-stage { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); }
.stage .progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, 0.25); }
.stage .progress div { height: 100%; width: 0; background: var(--accent); }
.clip-pill {
  position: absolute; left: 12px; top: 12px; display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px 0 10px; border: 0; border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 14px; font-weight: 650;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.clip-pill svg { width: 18px; height: 18px; }
.clip-pill span { white-space: nowrap; }
@container (max-height: 190px) {   /* small artwork: icon only */
  .clip-pill { padding: 0 9px; left: 8px; top: 8px; }
  .clip-pill span { display: none; }
}
.clip-pill:disabled { opacity: 0.6; }

.song { display: flex; align-items: flex-start; gap: 4px; }
.song-text { flex: 1; min-width: 0; }
.song.no-song .song-actions { display: none; }
.song-actions { display: flex; flex: none; margin: -4px -8px 0 0; }
.song-actions .icon-btn { width: 44px; height: 44px; color: var(--muted); }
.song-actions .icon-btn svg { width: 22px; height: 22px; }
.icon-btn.fav[aria-pressed="true"] { color: var(--accent); }
.icon-btn.fav.pop svg { animation: fav-pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes fav-pop { 0% { transform: scale(1); } 30% { transform: scale(0.7) rotate(-12deg); } 65% { transform: scale(1.3) rotate(8deg); } 100% { transform: none; } }
.song .title {
  margin: 0; font-size: clamp(26px, 7.4vw, 34px); line-height: 1.08; font-weight: 760; font-stretch: 82%;
  letter-spacing: -0.02em; font-variation-settings: "opsz" 72;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.song .artist { margin: 4px 0 0; color: var(--muted); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.why {
  margin: 0; border: 0; background: none; padding: 0; text-align: left; color: var(--muted); font-size: 14px;
  display: flex; gap: 6px; align-items: center;
}
.why span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.why .why-i { display: inline-grid; place-items: center; flex: none; color: var(--text); overflow: visible; }
.why .why-i svg { width: 18px; height: 18px; }
.note { margin: 0; font-size: 13px; color: var(--muted); }

.swipe-hint { position: absolute; top: 50%; transform: translateY(-50%); font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; }

.rate-row { display: flex; justify-content: center; align-items: flex-start; gap: clamp(26px, 10vw, 64px); }
/* Neutral (.meh, from when it was called Meh): orange, a little smaller, between the two that
   teach. Same family of motion as Like and Dislike: a squeeze, a "so-so" tilt one way then the
   other, and a ring going out. */
.rate.meh .disc { width: 56px; height: 56px; margin: 8px 0; color: var(--meh); border-color: var(--meh); }
.rate.meh svg { width: 24px; height: 24px; }
.rate.meh[aria-pressed="true"] .disc { background: var(--meh); color: var(--on-meh); }
.rate.meh.shrug .disc { animation: meh-tilt 0.55s cubic-bezier(0.3, 1.4, 0.5, 1); }
.rate.meh.shrug .disc svg { animation: meh-dash 0.55s ease; }
.rate.meh.shrug .disc::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; pointer-events: none;
  border: 2.5px solid var(--meh); animation: rate-ring 0.55s ease-out forwards;
}
@keyframes meh-tilt { 0% { transform: none; } 22% { transform: scale(0.88); } 48% { transform: scale(1.08) rotate(-10deg); } 72% { transform: rotate(8deg); } 88% { transform: rotate(-3deg); } 100% { transform: none; } }
@keyframes meh-dash { 0%, 100% { transform: none; } 45% { transform: scaleX(1.35); } }
.rate {
  border: 0; background: none; display: grid; justify-items: center; gap: 6px;
  font-size: 13px; font-weight: 650; color: var(--muted);
}
.rate .disc {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--line); color: var(--text); background: var(--surface);
  transition: transform 0.15s ease, background 0.15s ease;
}
.rate:active .disc { transform: scale(0.94); }
.rate .disc { position: relative; }
/* Like: squeeze, spring up past full size, settle; a ring bursts outward and the thumb tips up. */
.rate.like.burst .disc { animation: like-pop 0.55s cubic-bezier(0.2, 1.6, 0.4, 1); }
.rate.like.burst .disc svg { animation: like-tip 0.55s ease; }
.rate.like.burst .disc::after, .rate.dislike.thud .disc::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; pointer-events: none;
  border: 3px solid currentColor; animation: rate-ring 0.6s ease-out forwards;
}
.rate.like.burst .disc::after { border-color: var(--accent); }
@keyframes like-pop { 0% { transform: scale(1); } 25% { transform: scale(0.84); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes like-tip { 0%, 100% { transform: none; } 40% { transform: rotate(-18deg) translateY(-2px); } }
@keyframes rate-ring { from { transform: scale(0.85); opacity: 0.9; } to { transform: scale(1.65); opacity: 0; } }
/* Dislike: press down, then a short wobble; a fainter ring. */
.rate.dislike.thud .disc { animation: dislike-thud 0.5s ease; }
.rate.dislike.thud .disc svg { animation: dislike-tip 0.5s ease; }
.rate.dislike.thud .disc::after { border-width: 2px; animation-duration: 0.5s; }
@keyframes dislike-thud { 0% { transform: none; } 20% { transform: translateY(4px) scale(0.9); } 45% { transform: rotate(-9deg); } 65% { transform: rotate(7deg); } 85% { transform: rotate(-3deg); } 100% { transform: none; } }
@keyframes dislike-tip { 0%, 100% { transform: none; } 30% { transform: translateY(3px) rotate(10deg); } }
.rate svg { width: 26px; height: 26px; }
/* Outline until tapped; filled once rated; tapping again clears it and the colour reverts. */
.rate .disc { transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease; }
.rate.like .disc { color: var(--accent); border-color: var(--accent); width: 72px; height: 72px; }
.rate.dislike .disc { color: var(--dislike); border-color: var(--dislike); width: 72px; height: 72px; }   /* the same size as Like */
.rate[aria-pressed="true"] { color: var(--text); }
.rate.like[aria-pressed="true"] .disc { background: var(--accent); color: var(--on-accent); }
.rate.dislike[aria-pressed="true"] .disc { background: var(--dislike); color: var(--bg); }

.controls { display: flex; align-items: center; justify-content: space-between; }
#btnEnd[data-end="loop"], #btnEnd[data-end="pause"] { color: var(--accent); }
.icon-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 0; background: none;
  display: grid; place-items: center; color: var(--text);
}
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn.big { width: 60px; height: 60px; background: var(--raised); }
.icon-btn.big svg { width: 28px; height: 28px; }

/* ---- buttons, chips, controls ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: var(--r-pill);
  border: 1.5px solid var(--line); background: transparent; font-weight: 650; text-decoration: none; color: var(--text);
}
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.quiet { border-color: transparent; color: var(--muted); }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: default; }
.linklike { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px;
  border-radius: var(--r-pill); border: 1.5px solid var(--line); background: var(--surface); font-size: 15px;
}
.chip svg { width: 16px; height: 16px; }
.chip.static { min-height: 34px; cursor: default; }
.chip.trait { padding-right: 4px; transition: opacity 0.16s ease, transform 0.16s ease; }
.chip.leaving { opacity: 0; transform: scale(0.85); }
.chip-x {
  width: 30px; height: 30px; margin-left: 2px; border: 0; border-radius: 50%; padding: 0;
  display: grid; place-items: center; background: none; color: var(--muted);
}
.chip-x svg { width: 14px; height: 14px; }
.chip-x:hover, .chip-x:focus-visible { background: var(--raised); color: var(--text); }
.chip.removed { color: var(--muted); border-style: dashed; }
.chip.removed svg { width: 16px; height: 16px; }
/* "What did you like most?" / "What put you off?": in the Listen layout (never over the player). */
.reason-bar {
  padding: 8px 8px 10px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line);
  animation: sheet-in 0.18s ease;
}
.reason-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 15px; }
.reason-head .icon-btn { width: 36px; height: 36px; color: var(--muted); }
.reason-head .icon-btn svg { width: 18px; height: 18px; }
.reason-bar .chips { margin: 4px 0 6px; gap: 6px; }
.reason-bar .chip { min-height: 36px; padding: 4px 12px; font-size: 14px; }
.reason-bar .chip[aria-pressed="true"].pos { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.reason-bar .chip[aria-pressed="true"].neg { background: var(--dislike); border-color: var(--dislike); color: var(--bg); }
.reason-note { margin: 0; font-size: 13px; color: var(--muted); }
/* One swipeable row each for groups and details, so the strip stays short and the buttons stay above the tab bar. */
.reason-bar .chips.reason-groups, .reason-bar .chips.reason-items {
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -8px; padding-right: 8px;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.reason-bar .chips::-webkit-scrollbar { display: none; }
.reason-bar .chip { flex: none; }
.listen.has-reasons .stage-wrap { min-height: 120px; }
.listen.has-reasons .stage-wrap:has(.stage[data-mode^="video"]) { min-height: 200px; }   /* YouTube needs 200px */
@media (max-height: 720px) {   /* small phones: make room for the strip without pushing buttons under the tab bar */
  .listen.has-reasons { gap: 8px; }
  .listen.has-reasons .why, .listen.has-reasons .reason-note { display: none; }
  .listen.has-reasons .stage-wrap { min-height: 96px; }
  .listen.has-reasons .rate .disc { width: 54px; height: 54px; }
  .listen.has-reasons .rate.like .disc, .listen.has-reasons .rate.dislike .disc { width: 58px; height: 58px; }
  .listen.has-reasons .rate.meh .disc { width: 48px; height: 48px; margin: 5px 0; }
}
.reason-bar .chip.group { font-weight: 650; }
.reason-bar .chip.group[aria-expanded="true"] { border-color: var(--text); }
.reason-bar .chip.group.has { border-color: var(--dislike); color: var(--dislike); }
.reason-bar .reason-items { padding: 8px 0 0; border-top: 1px solid var(--line); margin-top: 2px; }
.reason-bar .chip.quiet-chip { border-style: dashed; color: var(--muted); }
.toast-action { border: 0; background: none; color: inherit; font-weight: 750; text-decoration: underline; text-underline-offset: 3px; padding: 4px 2px; margin-left: 6px; }
.row.pl-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px; padding: 4px 0; }
.pl-open { border: 0; background: none; padding: 6px 0; text-align: left; min-width: 0; color: inherit; }
.lib-tools { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 4px; }
ol.how-to { margin: 0 0 6px; padding-left: 22px; }
ol.how-to li { margin: 2px 0; }
code { font-size: 0.92em; padding: 1px 5px; border-radius: 5px; background: var(--raised); overflow-wrap: anywhere; }
.btn.danger { background: var(--dislike); border-color: var(--dislike); color: var(--bg); }
.btn.danger-outline { border-color: var(--dislike); color: var(--dislike); }
.chip.pos { border-color: var(--accent); }
.chip.neg { border-color: var(--dislike); color: var(--muted); }
.chip .lvl { display: inline-flex; gap: 2px; }
.chip .lvl i { width: 4px; height: 12px; border-radius: 2px; background: currentColor; opacity: 0.25; }
.chip .lvl i.on { opacity: 1; }
.chip.pos .lvl { color: var(--accent); }
.chip.neg .lvl { color: var(--dislike); }

.seg { display: flex; padding: 3px; border-radius: var(--r-pill); background: var(--raised); gap: 2px; overflow-x: auto; scrollbar-width: none; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: var(--r-pill); background: none; color: var(--muted); font-weight: 650; font-size: 15px; white-space: nowrap; padding: 0 12px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

.advanced-toggle {
  margin: 20px 0 0; border: 0; background: none; padding: 10px 0; color: var(--muted);
  font-weight: 650; display: inline-flex; align-items: center; gap: 6px;
}
.advanced-toggle svg { width: 18px; height: 18px; transition: transform 0.2s; }
.advanced-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

.field { display: flex; gap: 8px; }
.field input, input.search {
  min-width: 0; min-height: 48px; padding: 0 16px; border-radius: var(--r-pill);
  border: 1.5px solid var(--line); background: var(--surface); font-size: 16px;
}
.field input { flex: 1; }
/* The username box (first run, Settings): why a name won't do shows under it, in the danger colour. */
.field input[aria-invalid="true"] { border-color: var(--dislike); }
.uname-error { font-weight: 600; }
.uname-error:empty { display: none; }
/* Never flex: inside the first-run column, flex: 1 stretched the box to fill the screen whenever
   there were no results under it. */
input.search { flex: none; width: 100%; height: 48px; }
input::placeholder { color: var(--muted); }

/* ---- lists ---- */
.list { list-style: none; margin: 0; padding: 0; }
.row {
  width: 100%; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 8px 0; border: 0; background: none; text-align: left; color: inherit;
}
button.row:active { opacity: 0.7; }
.row img, .row .ph { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; background: var(--raised); }
.row .t { display: block; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .a { display: block; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.row + .row, .list li + li { border-top: 1px solid var(--line); }

.av { display: grid; place-items: center; border-radius: 50%; background: var(--raised); color: var(--text); font-weight: 700; flex: none; }
.row img[style*="border-radius"], .row .av { border-radius: 50%; }
.avatars { display: flex; }
.avatars img, .avatars .av { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--bg); object-fit: cover; background: var(--raised); display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.avatars > * + * { margin-left: -12px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: var(--r-pill); background: var(--raised); font-size: 13px; font-weight: 650; color: var(--text); }

/* Blends > Your groups: the heading with New group beside it, the New group / Add sheets' friend
   ticks, and a group's own page. */
.groups-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 4px; }
.groups-head h2 { margin: 0; }
.pick-list { margin: 4px 0 8px; }
.pick { display: flex; align-items: center; gap: 12px; padding: 8px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pick:last-child { border-bottom: 0; }
.pick input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0; order: 3; }
.pick .grow { flex: 1; min-width: 0; }
.pick .why { display: block; }
.pick.off { opacity: 0.55; cursor: default; }
.group-title { margin: 6px 0 4px; }
.group-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 12px; }
.blend-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; }
.blend-row .open { border: 0; background: none; padding: 0; text-align: left; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; grid-column: 1 / 3; }
.blend-row .name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.card { padding: 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); margin: 12px 0; }
.card p { margin: 0 0 10px; }
.card p:last-child { margin: 0; }
/* Friends: the Link with a friend box stands apart from the friends listed above it, as a heading
   would. First in its column (a member's, on big screens), it lines up with the other column. */
.link-card { margin-top: 28px; }
.friend-code { font-size: 17px; font-weight: 750; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; white-space: nowrap; user-select: all; }

/* A blend's page: Songs | Compare tabs (app.js renderBlendView, blendCompare). */
.bv-seg { margin: 4px 0 14px; }
.bv-bar { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.bv-bar .avatars img, .bv-bar .avatars .av { width: 34px; height: 34px; font-size: 13px; }
.bv-bar .grow { flex: 1; min-width: 0; }
.bv-pct { font-size: 28px; font-weight: 780; font-stretch: 80%; letter-spacing: -0.02em; }
.bv-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 6px; }
.cmp-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cmp-tile { min-width: 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.cmp-tile.wide { grid-column: 1 / -1; }
.cmp-tile .k { font-size: 13px; color: var(--muted); }
.cmp-tile .v { font-size: 28px; font-weight: 780; font-stretch: 85%; line-height: 1.1; margin-top: 4px; overflow-wrap: anywhere; }
.cmp-tile .t { font-size: 14.5px; line-height: 1.35; margin-top: 4px; }
.cmp-tile .mini { font-size: 14.5px; }
.blend-compare h3 { margin: 22px 0 8px; }
.actions { display: flex; gap: 10px; margin: 18px 0 6px; }
.actions .btn { flex: 1; white-space: nowrap; padding: 0 14px; }

/* ---- sheets ---- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.45); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  max-width: 600px; margin: 0 auto; max-height: 88dvh; overflow: auto;
  padding: 8px 16px calc(24px + var(--safe-b));
  background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
  animation: sheet-in 0.22s ease;
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
/* While a YouTube video floats above a sheet, keep the sheet below it. */
body.video-top .sheet { max-height: calc(100dvh - 236px - var(--safe-t)); }
.sheet .handle { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { margin: 4px 0; font-size: 20px; }

/* ---- charts ---- */
.char-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) 62px; gap: 12px; align-items: center; padding: 7px 0; font-size: 15px; }
.char-track { position: relative; height: 10px; border-radius: 5px; background: var(--raised); }
.char-band { position: absolute; top: 0; bottom: 0; border-radius: 5px; background: var(--heat-3); opacity: 0.55; }
.char-mark { position: absolute; top: -5px; width: 4px; height: 20px; margin-left: -2px; border-radius: 2px; background: var(--text); }
.char-val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }
.char-note { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
/* Blend character: one see-through shape per person (tasteShapesHTML). */
.shape-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 6px; }
.shape-legend svg, .mini-shape span svg { flex: none; }
.shape-who { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 10px; border: 1.5px solid var(--line); border-radius: var(--r-pill); background: none; color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.shape-who[aria-pressed="true"], .mini-shape[aria-pressed="true"] { border-color: var(--text); background: var(--raised); }
.shapes > svg { display: block; width: 100%; max-width: 460px; margin: 0 auto; overflow: visible; }
.shapes .ring { fill: none; stroke: var(--line); stroke-width: 1; }
.shapes .ax line { stroke: var(--line); stroke-width: 1; }
.shapes .ax text { fill: var(--muted); font-size: 15px; font-family: inherit; }
.shapes .ax { cursor: help; }
.shapes .ax:hover text { fill: var(--text); }
/* Light fills and a dot on each trait keep overlapping shapes apart; tapping a name fades the rest. */
.shapes .shape { fill: var(--c); stroke: var(--c); fill-opacity: 0.12; stroke-width: 2.6; stroke-linejoin: round; pointer-events: none; }
.shapes .dot { fill: var(--c); stroke: var(--bg); stroke-width: 1.5; pointer-events: none; }
.shapes .who-shape { transition: opacity 0.2s; }
.shapes.focus .who-shape { opacity: 0.13; }
.shapes.focus .who-shape.on { opacity: 1; }
.shapes.focus .who-shape.on .shape { fill-opacity: 0.32; stroke-width: 3.2; }
.minis-head { margin-top: 20px; }
.shape-minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.mini-shape { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 8px 10px; border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; min-width: 0; }
.mini-shape > svg { display: block; width: 100%; max-width: 150px; overflow: visible; }
.mini-shape span { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-shape .shape { fill-opacity: 0.38; stroke-width: 2.4; }
.mini-shape .others { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-dasharray: 4 3; }

.bar-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 40px; gap: 10px; align-items: center; font-size: 15px; padding: 3px 0; }
.bar-track { height: 8px; }
.bar-fill { display: block; height: 100%; background: var(--heat-5); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-row .v { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; }
.bar-group .g { font-size: 13px; color: var(--muted); margin: 8px 0 2px; }

.cmp-group { margin: 0 0 16px; }
.cmp-title { font-weight: 680; margin-bottom: 6px; }
.cmp-scroll { overflow-x: auto; }
.cmp-grid { display: grid; gap: 2px; align-items: end; }
.cmp-label { font-size: 11.5px; line-height: 1.15; color: var(--muted); padding: 0 1px 4px; text-align: center; }
.cmp-row { font-size: 12.5px; color: var(--muted); padding-right: 8px; white-space: nowrap; align-self: center; }
.cmp-cell { height: 24px; border-radius: 3px; }
.hm-row { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 8px; align-items: center; margin-bottom: 6px; }
.hm-group { font-size: 12.5px; color: var(--muted); }
.hm-cells { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2px; max-width: calc(12 * var(--cell, 16px) + 22px); }
.hm-cell { aspect-ratio: 1; border-radius: 3px; }
.hist { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 2px; height: 64px; align-items: end; border-bottom: 1px solid var(--line); }
.hcol { height: 100%; display: flex; align-items: flex-end; }
.hb { width: 100%; background: var(--heat-5); border-radius: 4px 4px 0 0; }
.hist-axis { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.match-grid { display: grid; gap: 2px; font-size: 13px; }
.match-grid div { padding: 8px 4px; text-align: center; border-radius: 4px; }
.mini { list-style: none; margin: 4px 0 0; padding: 0; font-size: 15px; }
.mini li { padding: 3px 0; }

/* ---- full-screen flows: sign-in and first run ---- */
.flow {
  position: fixed; inset: 0; z-index: 60; overflow: auto; background: var(--bg);
  padding: calc(32px + var(--safe-t)) 20px calc(32px + var(--safe-b));
}
.flow-inner { max-width: 560px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
/* Same type scale as the app's own screens (.screen h1), so sign-in and first run feel like part of it. */
.flow h1 {
  font-size: 30px; line-height: 1.1; font-weight: 760; font-stretch: 85%;
  letter-spacing: -0.02em; margin: 6px 0 10px; font-variation-settings: "opsz" 72;
}
.flow .lede { color: var(--muted); font-size: 16px; margin: 0 0 20px; }
.flow-inner.sign-in { min-height: 0; display: block; }
.sign-in .listen-top { margin-bottom: 20px; }
.sign-hero { margin: 0 0 14px; }
.sign-in .how { margin: 4px 0 22px; }
.sign-in .how .disc { color: var(--accent); }
/* Every theme picker (first run's look step and Settings) has the dark themes, then the
   light ones, each group under its own label. */
.theme-group + .theme-group { margin-top: 16px; }
.theme-group-k { margin: 0 0 8px; font-size: 13px; font-weight: 650; color: var(--muted); }
.flow .foot { margin-top: auto; padding-top: 24px; }
.steps { display: flex; gap: 6px; margin-bottom: 8px; }
.steps span { height: 4px; flex: 1; border-radius: 2px; background: var(--line); }
.steps span.on { background: var(--accent); }
/* Admin's preview of joining: marks the invite page and first run as a preview, with the way out. */
.preview-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 20px; padding: 6px 6px 6px 16px;
  border: 1.5px dashed var(--accent); border-radius: var(--r-md);
  font-size: 14px; color: var(--muted);
}
.preview-bar > span { text-wrap: balance; }   /* on phones: a line per sentence */
.preview-bar .btn { flex: none; }
.how { display: grid; gap: 16px; margin: 8px 0 24px; }
.how div { display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: center; }
.how .disc { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); }
.how .disc svg { width: 24px; height: 24px; }
.artist-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 12px; margin: 16px 0; }
.grid-head { grid-column: 1 / -1; margin: 0 0 -4px; font-size: 14px; font-weight: 650; color: var(--muted); }
.grid-head:not(:first-child) { margin-top: 8px; }   /* the next pick's group */
/* The Testing tab (app.js renderTesting) and first run's beta screen. */
.beta-note { background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 14px; padding: 10px 12px; font-size: 14px; line-height: 1.45; margin: 0 0 14px; }
.preview-note { margin: -4px 0 12px; color: var(--muted); }
.tests { display: grid; gap: 10px; align-items: start; }
.test-card { background: var(--surface); border-radius: var(--r-md); padding: 4px 12px 4px 4px; }
.test-card.open { padding-bottom: 14px; }
.test-row { display: flex; align-items: center; gap: 8px; }
.test-head { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px; border: 0; background: none; color: var(--text); text-align: left; border-radius: 12px; }
.test-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.test-icon svg { width: 20px; height: 20px; }
.test-name { min-width: 0; }
.test-name b { display: block; font-size: 16px; font-weight: 700; }
.test-name span { display: block; font-size: 13px; color: var(--muted); }
.test-tick { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); background: none; flex: none; display: grid; place-items: center; color: var(--on-accent); padding: 0; }
.test-tick.done { background: var(--accent); border-color: var(--accent); }
.test-tick svg { width: 16px; height: 16px; }
.test-body { padding: 0 0 0 12px; }
.test-prog { height: 6px; background: var(--raised); border-radius: 3px; margin: 4px 0 0; overflow: hidden; }
.test-prog i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.test-steps { margin: 10px 0 12px; padding-left: 22px; font-size: 14.5px; line-height: 1.45; }
.test-steps li { margin-bottom: 4px; }
.test-steps li::marker { color: var(--muted); font-weight: 700; }
.ob-beta { display: grid; gap: 14px; margin: 0 0 18px; }
.ob-beta > div { display: flex; gap: 12px; align-items: flex-start; }
.ob-beta b { display: block; font-size: 15.5px; margin-bottom: 1px; }
.ob-beta span:not(.test-icon) { display: block; font-size: 14px; color: var(--muted); line-height: 1.4; }
.flow .wordmark.ob-mark { margin: 0 0 14px; }
@media (min-width: 840px) and (pointer: fine), (min-width: 840px) and (min-height: 501px) {
  .tests { grid-template-columns: 1fr 1fr; }   /* two to a row, like Blends */
}
.ob-decade { margin: 0 0 16px; }
.ob-decade p { margin: 0 0 8px; }
.ob-decade .chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ob-playlist { margin: 8px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.ob-playlist h3 { margin: 0 0 4px; font-size: 16px; }
.ob-playlist .muted { margin: 0 0 10px; }
.artist-card { border: 0; background: none; padding: 0; text-align: center; font-size: 14px; font-weight: 600; }
.artist-card img, .artist-card .ph { width: 100%; aspect-ratio: 1; border-radius: 50%; object-fit: cover; background: var(--surface); margin-bottom: 6px; }
.artist-card .ph { display: block; background: var(--raised); }   /* a span: needs block for width and aspect-ratio; raised so it shows on the sheet */
.artist-card[aria-pressed="true"] img, .artist-card[aria-pressed="true"] .ph { outline: 3px solid var(--accent); outline-offset: 3px; }
.artist-card .genre { display: block; margin-top: 2px; font-size: 12px; font-weight: 500; color: var(--muted); }

.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
#libBody.slide-l { animation: slide-l 0.22s ease; }
#libBody.slide-r { animation: slide-r 0.22s ease; }
@keyframes slide-l { from { transform: translateX(24px); opacity: 0; } }
@keyframes slide-r { from { transform: translateX(-24px); opacity: 0; } }
#screen-library { touch-action: pan-y; }
.theme-swatch {
  border: 2px solid var(--line); border-radius: var(--r-md); padding: 12px; background: var(--surface);
  display: grid; gap: 8px; justify-items: start; text-align: left; font-weight: 650; font-size: 14px;
}
.theme-swatch[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.theme-swatch .dots { display: flex; gap: 4px; }
.theme-swatch .dots i { width: 18px; height: 18px; border-radius: 50%; display: block; border: 1px solid rgba(127, 127, 127, 0.3); }

.settings .item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.settings .item:first-child { border-top: 0; }
.settings .item .k { font-weight: 620; }
.settings .item .v { color: var(--muted); font-size: 14px; }
/* On/off switch */
.switch {
  flex: none; position: relative; width: 52px; height: 32px; border-radius: 16px; padding: 0;
  border: 1.5px solid var(--line); background: var(--raised); transition: background 0.18s ease, border-color 0.18s ease;
}
.switch span {
  position: absolute; top: 3px; left: 3px; width: 23px; height: 23px; border-radius: 50%;
  background: var(--muted); transition: transform 0.18s ease, background 0.18s ease;
}
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"] span { transform: translateX(20px); background: var(--on-accent); }
.profile { display: flex; align-items: center; gap: 14px; margin: 6px 0 10px; }
.profile img, .profile .av { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--raised); display: grid; place-items: center; font-weight: 700; font-size: 22px; }

/* ---- feedback ---- */
.toast {
  position: fixed; left: 50%; z-index: 70; transform: translateX(-50%);
  bottom: calc(var(--bar-h) + 84px);
  width: max-content; max-width: min(92vw, 480px); padding: 12px 16px; border-radius: var(--r-md);
  background: var(--text); color: var(--bg); font-weight: 600; font-size: 15px; text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.tip {
  position: fixed; z-index: 80; pointer-events: none; padding: 6px 10px; border-radius: var(--r-sm);
  background: var(--text); color: var(--bg); font-size: 13px; font-weight: 600; max-width: 260px;
}
.status-line { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; margin: 18px 0 0; }
.version-line { margin: 6px 0 0; }   /* Settings: which version of Echolace this is, under the status line */
.inline-icon svg { width: 1.15em; height: 1.15em; vertical-align: -0.2em; }   /* an icon in a sentence (the Share button in install help) */
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s ease-in-out infinite; flex: none; }
@keyframes pulse { 50% { opacity: 0.25; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  /* Like/dislike still need feedback (there's no popup): a fade, with no movement. */
  .rate.like.burst .disc::after, .rate.dislike.thud .disc::after, .rate.meh.shrug .disc::after { animation: rate-fade 0.6s ease-out forwards !important; }
  .rate.like.burst .disc, .rate.dislike.thud .disc, .rate.meh.shrug .disc, .icon-btn.fav.pop svg { animation: rate-glow 0.6s ease-out !important; }
}
@keyframes rate-fade { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }
@keyframes rate-glow { 0%, 100% { filter: none; } 30% { filter: brightness(1.25); } }
@media (min-width: 900px) {
  .tabbar { left: 50%; right: auto; width: 560px; transform: translateX(-50%); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r-md) var(--r-md) 0 0; }
}

/* =========================================================================
   Wide screens: desktops, laptops, and tablets held sideways
   =========================================================================
   The same elements laid out for a wide window: the tabs become a bar down the left side, Listen
   puts the artwork beside the song, its buttons and what's up next, sheets open as dialogs in the
   middle, and the other tabs use two columns when there's room. It follows the window as it is
   now, so it switches by itself when a window is resized or a tablet is turned. A phone held
   sideways (a touch screen under 501px tall) keeps the phone layout. app.js has the same query
   (WIDE): keep the two in step.

   Outside it, nothing changes for phones: the new elements stay hidden, and the box around the
   song and its buttons isn't drawn (display: contents), so they stack under the artwork as before. */
.rail-brand, .listen-side > .upnext, .lace, .edges, .settings > .wide-only { display: none; }
.listen-side { display: contents; }

@media (min-width: 840px) and (pointer: fine), (min-width: 840px) and (min-height: 501px) {
  :root {
    --rail: 88px;       /* the side bar */
    --bar-h: 0px;       /* no tab bar along the bottom */
    --page-pad: 40px;
    --page-max: 800px;  /* one column; two from 1180px (below) */
  }
  /* Listen is at least 1440px wide, and on big screens wide enough for the artwork to be as tall as
     the window allows, up to its full 1000px: the window's height less the 104px of rows above and
     below the artwork, plus the side column, the gap between them and the padding (as .listen below). */
  body[data-tab="listen"] {
    --page-max: max(1440px, calc(min(1000px, 100vh - 104px) + clamp(320px, 26vw, 420px) + clamp(32px, 4vw, 72px) + 2 * var(--page-pad)));
  }

  /* ---- the side bar: the same tab buttons, stacked ---- */
  .tabbar {
    top: 0; bottom: 0; left: 0; right: auto; width: var(--rail); height: auto;
    transform: none; border: 0; border-right: 1px solid var(--line); border-radius: 0;
    padding: 80px 8px 16px;
    display: flex; flex-direction: column; gap: 6px;
    overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  }
  .tabbar::-webkit-scrollbar { display: none; }
  .tabbar button { flex: none; height: 62px; border-radius: var(--r-md); gap: 4px; }
  /* The icon sits in a pill that fills in for the open tab. */
  .tabbar button svg { box-sizing: content-box; padding: 4px 16px; border-radius: var(--r-pill); }
  .tabbar button[aria-selected="true"] svg { background: var(--raised); background: color-mix(in srgb, var(--accent) 18%, transparent); }
  .tabbar .badge { top: 2px; left: calc(50% + 12px); }
  .tabbar button.has-dot::after { top: 4px; left: calc(50% + 16px); }
  .rail-brand {
    display: grid; place-items: center; position: fixed; top: 0; left: 0; z-index: 41;
    width: calc(var(--rail) - 1px); height: 72px; background: var(--surface); pointer-events: none;
  }
  .rail-brand .logo .gap { stroke: var(--surface); }   /* the weave's gaps take the colour behind them */
  .rail-brand { align-content: center; gap: 5px; }   /* the logo, with "beta" under it */
  .rail-brand .beta-pill { margin: 0; font-size: 9.5px; padding: 3px 6px 2px; }

  /* ---- the main area ---- */
  .scroller { left: var(--rail); scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
  /* Moving through a page with Tab stops short of the mini player along the bottom. */
  .scroller { scroll-padding: 24px 0 112px; }
  .screen { max-width: var(--page-max); padding: 32px var(--page-pad) 128px; }
  .screen h1 { font-size: 40px; margin: 2px 0 20px; }
  .screen h1:first-child, .screen > .profile:first-child { padding-right: 56px; }
  .top-anchor { max-width: var(--page-max); }
  .icon-btn.top-btn { right: calc(var(--page-pad) - 8px); top: 32px; }
  body[data-tab="listen"] .icon-btn.top-btn { top: 18px; }

  /* ---- the lace in the bare space either side of the page (app.js, Lace) ----
     A canvas in each margin, behind the screens (first in the page, and .scroller has no
     background). The page column is --page-max wide, so the margins follow the tab. Each canvas
     reaches 24px inside the column's edge, but the lace fades out over the 164px before the edge,
     where the edge line is (.edges, below). app.js leaves a margin under 126px bare.
     The key naming the waves (.lace-key, after the canvases) sits under the lower ribbon on the
     left; app.js sets its top and width, and hides it where there's no room. */
  .lace, .edges {
    display: block; position: fixed; top: 0; bottom: 0; left: var(--rail); right: 0;
    pointer-events: none; overflow: hidden;
    --half: calc(min(var(--page-max), 100vw - var(--rail)) / 2);
  }
  .lace canvas { position: absolute; top: 0; height: 100%; width: max(0px, calc(50% - var(--half) + 24px)); }
  .lace canvas:first-of-type {
    left: 0;
    -webkit-mask-image: linear-gradient(to left, transparent 24px, #000 188px); mask-image: linear-gradient(to left, transparent 24px, #000 188px);
  }
  .lace canvas:last-of-type {
    right: 0;
    -webkit-mask-image: linear-gradient(to right, transparent 24px, #000 188px); mask-image: linear-gradient(to right, transparent 24px, #000 188px);
  }
  .lace-key {
    position: absolute; left: 48px; display: flex; flex-wrap: wrap; gap: 6px 20px;
    font-size: 12px; line-height: 16px; color: var(--muted);
  }
  .lace-key span { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
  .lace-key svg { width: 24px; height: 10px; fill: none; stroke-width: 2; stroke-linecap: round; }
  /* The page's edges: a 2px line down each side of the column, blending the lace's four colours
     from top to bottom (app.js sets --edge-1 to --edge-4). It stays when Background is Off, and is
     hidden wherever it would come within 32px of the side bar or the window's edge. A long page's
     scrollbar takes room on the right, which moves the column: app.js sets --sb to its width. */
  .edges {
    right: var(--sb, 0px);
    --half: calc(min(var(--page-max), 100vw - var(--rail) - var(--sb, 0px)) / 2);
    -webkit-mask-image: linear-gradient(to right, transparent 32px, #000 32px calc(100% - 32px), transparent calc(100% - 32px));
    mask-image: linear-gradient(to right, transparent 32px, #000 32px calc(100% - 32px), transparent calc(100% - 32px));
  }
  .edges::before, .edges::after {
    content: ""; position: absolute; top: 0; bottom: 0; width: 2px; opacity: 0.65;
    background: linear-gradient(var(--edge-1), var(--edge-2), var(--edge-3), var(--edge-4));
  }
  .edges::before { left: calc(50% - var(--half) - 2px); }
  .edges::after { right: calc(50% - var(--half) - 2px); }
  .settings > .wide-only { display: flex; }   /* Settings > Background, for the lace */

  /* Mini player and messages: along the bottom of the main area. */
  .nowbar {
    left: calc(var(--rail) + 24px); right: 24px; bottom: 16px; max-width: 760px;
    grid-template-columns: 48px minmax(0, 1fr) auto auto; padding: 8px 10px;
  }
  .nowbar img, .nowbar .ph { width: 48px; height: 48px; }
  .toast { left: calc(50% + var(--rail) / 2); bottom: 100px; }

  /* ---- Listen: artwork on the left; the song, its buttons and Up next on the right ---- */
  .listen {
    max-width: var(--page-max); min-height: 100%;
    padding: 20px var(--page-pad) 28px;
    display: grid; grid-template-columns: minmax(0, 1fr) clamp(320px, 26vw, 420px);
    grid-template-rows: auto minmax(0, 1fr); gap: 20px clamp(32px, 4vw, 72px);
  }
  .listen-top { grid-column: 1 / -1; justify-content: flex-end; }
  #screen-listen .wordmark { display: none; }   /* the logo is at the top of the side bar */
  .stage-wrap { grid-column: 1; grid-row: 2; min-height: 260px; place-items: start center; }
  .stage[data-mode="art"] { width: min(100cqw, 100cqh, 1000px); height: min(100cqw, 100cqh, 1000px); }
  /* Sized by its grid cell, never by what's in it, so a long Up next list can't stretch the
     page; its own height decides what fits (the container queries below). */
  .listen-side {
    grid-column: 2; grid-row: 2; display: flex; flex-direction: column; gap: 14px;
    min-width: 0; min-height: 0; container: side / size;
  }
  .song .title { font-size: clamp(32px, 1.25vw + 20px, 52px); -webkit-line-clamp: 3; }
  .song .artist { font-size: 18px; }
  .rate-row { gap: clamp(24px, 2.4vw, 44px); margin-top: 4px; }
  /* What put you off: the groups wrap rather than scroll sideways (no swiping with a mouse). */
  .reason-bar .chips.reason-groups, .reason-bar .chips.reason-items { flex-wrap: wrap; overflow: visible; margin-right: 0; padding-right: 0; }
  /* The phone rules that squeeze Listen while that strip is open aren't needed beside the artwork. */
  .listen.has-reasons { gap: 20px clamp(32px, 4vw, 72px); }
  .listen.has-reasons .why { display: flex; }
  .listen.has-reasons .reason-note { display: block; }
  .listen.has-reasons .stage-wrap { min-height: 260px; }
  .listen.has-reasons .rate .disc { width: 64px; height: 64px; }
  .listen.has-reasons .rate.like .disc, .listen.has-reasons .rate.dislike .disc { width: 72px; height: 72px; }
  .listen.has-reasons .rate.meh .disc { width: 56px; height: 56px; margin: 8px 0; }
  /* If the strip doesn't fit (a short window), this column scrolls by itself rather than pushing
     the buttons off the bottom. The padding, taken back by the margin, keeps focus rings unclipped. */
  .listen.has-reasons .listen-side {
    overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 4px; margin: -4px;
    scrollbar-width: thin; scrollbar-color: var(--line) transparent;
  }

  .upnext { flex-direction: column; flex: 1 1 0; min-height: 0; padding-top: 14px; border-top: 1px solid var(--line); }
  .upnext-title { margin: 0 0 4px; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .upnext-body { position: relative; flex: 1 1 auto; min-height: 0; }
  .upnext-body > * { position: absolute; inset: 0; margin: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
  .upnext-body .row img, .upnext-body .row .ph { width: 44px; height: 44px; }
  .upnext-body .row { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .listen-side > .upnext { display: flex; }
  /* The song and its buttons take about 300px; Up next needs about 170 more for two songs. */
  @container side (max-height: 460px) { .upnext { display: none !important; } }
  @container side (max-height: 760px) { .listen.has-reasons .upnext { display: none !important; } }

  /* ---- sheets open as dialogs in the middle ---- */
  .sheet-backdrop { background: rgba(0, 0, 0, 0.5); }
  .sheet {
    top: 0; right: 0; bottom: 0; left: 0; margin: auto;
    width: min(620px, calc(100% - 48px)); max-width: none;
    height: -webkit-fit-content; height: -moz-fit-content; height: fit-content; max-height: min(88vh, 920px);
    padding: 16px 28px 28px; border-radius: var(--r-lg);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
    animation: dialog-in 0.18s ease;
    scrollbar-width: thin; scrollbar-color: var(--line) transparent;
  }
  .sheet .handle { display: none; }
  .sheet-head h2 { font-size: 22px; }
  /* A YouTube video playing floats at the top right while a dialog is open: keep clear of it. */
  body.video-top .sheet { right: 232px; max-height: min(88vh, 920px); }
  .sheet:has(#moodBody) { width: min(760px, calc(100% - 48px)); }
  .sheet .mood-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet:has(#obResults) { width: min(820px, calc(100% - 48px)); }
  .artist-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }

  /* ---- sign-in and first run ---- */
  .flow { display: grid; padding: 48px 32px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
  /* First run: each step's button follows it, at the right, rather than waiting at the bottom of the window. */
  .flow-inner { width: 100%; max-width: 760px; min-height: 0; align-self: start; }
  .flow .foot { display: flex; justify-content: flex-end; }
  .flow .foot .btn.block { width: auto; min-width: 240px; }
  /* In the middle of the window; auto margins (unlike align-self: center) start it at the top when the window
     is too short for it, so its top can still be scrolled to. */
  .flow-inner.sign-in { max-width: 560px; margin-top: auto; margin-bottom: auto; }
  .flow h1 { font-size: 40px; }
  .themes { grid-template-columns: repeat(6, minmax(0, 1fr)); }   /* each group six to a row */

  /* ---- the other tabs ---- */
  #screen-library > .seg, #screen-blends > .bv-seg { max-width: 520px; }
  /* A playlist's report reads better at the width of one column. */
  #screen-library > .chips, #screen-library > div:not([class]):not([id]), #screen-library > [data-adv-body] { max-width: 760px; }
  /* You has no Advanced toggle here: app.js (renderYou) lays the whole taste report out at once, with
     Pick artists under what Echolace has learned, so Settings leaves Pick artists out. */
  .settings > .phone-only { display: none; }
  .you-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 10px; }
  .you-head h2 { margin: 0; }
  .side-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }   /* four to a row when the page has two columns, two when it has one */
  .side-cards .card { margin: 0; }
  .side-cards .card p { margin: 0 0 6px; }
  .you-trio { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 40px; }

  /* Two columns once there's room for both. The column boxes are plain blocks on phones. */
  @media (min-width: 1180px) {
    :root { --page-max: 1180px; }
    .cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 56px; align-items: start; margin-top: 28px; }
    /* The space above the columns is the space above a heading, as when they're one column. */
    .cols > .col > :first-child { margin-top: 0; }
    /* A blend's Compare tab: the tiles and who matches whom on the left, the taste shapes on the right. */
    .blend-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 56px; align-items: start; }
    .cmp-b > h3:first-child { margin-top: 0; }
    /* Blends of each size in two columns, read across. */
    .blend-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 56px; }
    /* Song lists in two columns, read across. */
    #libBody .list, #imported .list, #mine .list, .bv .bv-songs {
      display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 40px;
    }
    #libBody .list > li, #imported .list > li, #mine .list > li, .bv .bv-songs > li { border-top: 1px solid var(--line); }
    #libBody .list > li:nth-child(-n+2), #imported .list > li:nth-child(-n+2), #mine .list > li:nth-child(-n+2), .bv .bv-songs > li:nth-child(-n+2) { border-top-color: transparent; }
  }

  /* ---- short windows (a laptop at 150%, say) ---- */
  @media (max-height: 600px) {
    .screen { padding-top: 20px; }
    .screen h1 { font-size: 34px; }
    .icon-btn.top-btn { top: 20px; }
    .tabbar { padding-top: 60px; gap: 2px; }
    .tabbar button { height: 52px; gap: 2px; }
    .tabbar button svg { padding: 2px 14px; }
    .rail-brand { height: 56px; }
    .listen { padding-top: 14px; padding-bottom: 16px; gap: 12px clamp(24px, 3vw, 48px); }
    .song .title { font-size: 30px; -webkit-line-clamp: 2; }
    .listen-side { gap: 10px; }
  }

  /* ---- mouse and trackpad: show what can be clicked ---- */
  @media (hover: hover) {
    .tabbar button:hover { color: var(--text); }
    .tabbar button[aria-selected="true"]:hover { color: var(--accent); }
    .tabbar button:not([aria-selected="true"]):hover svg { background: var(--raised); }
    .icon-btn:not(.big):not(:disabled):hover { background: var(--raised); }
    .icon-btn.big:hover { background: var(--line); }
    .btn:not(.primary):not(.danger):not(:disabled):hover { background: var(--raised); }
    .btn.primary:not(:disabled):hover, .btn.danger:not(:disabled):hover { filter: brightness(1.08); }
    .mood-pill:hover, .chip:is(button):hover, .theme-swatch:hover, .mood-opt:hover { border-color: var(--muted); }
    .mood-pill.on:hover, .mood-opt[aria-pressed="true"]:hover, .theme-swatch[aria-pressed="true"]:hover { border-color: var(--accent); }
    .rate:hover:not(:active) .disc { transform: scale(1.05); }
    .why:hover { color: var(--text); }
    .linklike:hover { text-decoration-thickness: 2px; }
    button.row:hover .t, .pl-open:hover .t, .blend-row .open:hover .name, .nowbar .open:hover .t { color: var(--accent); }
  }
}
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
