/* Moodflower: a little garden of songs for Chloe, with sunflowers and dahlias.
   Day = soft blush cream with dahlia pink; night = a cosy plum "night garden".
   Sunflower yellow is kept for the flowers themselves (--sun), not the whole UI. */

:root {
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-ui: "Nunito", "Segoe UI", system-ui, sans-serif;
  --font-hand: "Caveat", "Segoe Print", cursive;

  --bg: #fcf6f2;
  --bg-raise: #f6e9e3;
  --panel: rgba(255, 251, 248, 0.88);
  --panel-solid: #fffbf8;
  --line: rgba(120, 70, 70, 0.12);
  --line-strong: rgba(120, 70, 70, 0.23);
  --text: #42292c;
  --muted: #8d6f72;
  --faint: #cfb5b2;
  --accent: #df5f87;          /* dahlia pink */
  --accent-deep: #b9466c;     /* berry, for handwritten notes */
  --accent-shadow: #b23f66;
  --accent-soft: rgba(223, 95, 135, 0.12);
  --accent-ink: #ffffff;
  --sun: #f5b301;
  --sun-soft: rgba(245, 179, 1, 0.2);
  --leaf: #7bb05a;
  --seed: #5a3a1e;
  --glow-a: rgba(241, 160, 184, 0.30);
  --glow-b: rgba(255, 214, 120, 0.20);
  --pattern-opacity: 0.5;
  --danger: #c8553d;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 16px 36px -22px rgba(140, 70, 80, 0.38);
  --radius: 26px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #1d1930;
  --bg-raise: #2a2443;
  --panel: rgba(42, 36, 66, 0.82);
  --panel-solid: #2a2443;
  --line: rgba(255, 225, 235, 0.1);
  --line-strong: rgba(255, 225, 235, 0.2);
  --text: #fbeff2;
  --muted: #c4b5d6;
  --faint: #7f7499;
  --accent: #f08aaa;
  --accent-deep: #f7a9c1;
  --accent-shadow: #a8456a;
  --accent-soft: rgba(240, 138, 170, 0.14);
  --accent-ink: #3a1424;
  --sun: #ffc928;
  --sun-soft: rgba(255, 201, 40, 0.16);
  --leaf: #9cc46f;
  --glow-a: rgba(240, 138, 170, 0.16);
  --glow-b: rgba(140, 110, 220, 0.22);
  --pattern-opacity: 0.18;
  --danger: #ff9b85;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 20px 44px -24px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1930;
    --bg-raise: #2a2443;
    --panel: rgba(42, 36, 66, 0.82);
    --panel-solid: #2a2443;
    --line: rgba(255, 225, 235, 0.1);
    --line-strong: rgba(255, 225, 235, 0.2);
    --text: #fbeff2;
    --muted: #c4b5d6;
    --faint: #7f7499;
    --accent: #f08aaa;
    --accent-deep: #f7a9c1;
    --accent-shadow: #a8456a;
    --accent-soft: rgba(240, 138, 170, 0.14);
    --accent-ink: #3a1424;
    --sun: #ffc928;
    --sun-soft: rgba(255, 201, 40, 0.16);
    --leaf: #9cc46f;
    --glow-a: rgba(240, 138, 170, 0.16);
    --glow-b: rgba(140, 110, 220, 0.22);
    --pattern-opacity: 0.18;
    --danger: #ff9b85;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 20px 44px -24px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.5 var(--font-ui);
  color: var(--text);
  background:
    radial-gradient(60vw 55vh at 92% -10%, var(--glow-a), transparent 65%),
    radial-gradient(55vw 55vh at -10% 110%, var(--glow-b), transparent 62%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* A faint field of tiny flowers behind everything. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--pattern-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cg fill-opacity='.35'%3E%3Cg fill='%23f5c542' transform='translate(30 40)'%3E%3Ccircle cx='0' cy='-5' r='3.5'/%3E%3Ccircle cx='4.8' cy='-1.5' r='3.5'/%3E%3Ccircle cx='3' cy='4' r='3.5'/%3E%3Ccircle cx='-3' cy='4' r='3.5'/%3E%3Ccircle cx='-4.8' cy='-1.5' r='3.5'/%3E%3C/g%3E%3Cg fill='%23ee88a6' transform='translate(125 120) scale(.75)'%3E%3Ccircle cx='0' cy='-5' r='3.5'/%3E%3Ccircle cx='4.8' cy='-1.5' r='3.5'/%3E%3Ccircle cx='3' cy='4' r='3.5'/%3E%3Ccircle cx='-3' cy='4' r='3.5'/%3E%3Ccircle cx='-4.8' cy='-1.5' r='3.5'/%3E%3C/g%3E%3C/g%3E%3Cg fill='%23a0793f' fill-opacity='.35'%3E%3Ccircle cx='30' cy='40' r='2.2'/%3E%3Ccircle cx='125' cy='120' r='1.7'/%3E%3C/g%3E%3Cg fill='%237bb05a' fill-opacity='.22'%3E%3Ccircle cx='150' cy='30' r='2'/%3E%3Ccircle cx='70' cy='150' r='2.5'/%3E%3C/g%3E%3C/svg%3E");
}

button, input { font: inherit; color: inherit; }
img { display: block; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- top bar ------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 40px) 10px;
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.brand-mark {
  width: 46px; height: 46px; flex: none;
  filter: drop-shadow(0 6px 12px rgba(217, 146, 0, 0.35));
  animation: spin 40s linear infinite;
}
.brand:hover .brand-mark { animation-duration: 4s; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.wordmark {
  font-family: var(--font-display);
  font-size: 30px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap;
  font-variation-settings: "SOFT" 100, "WONK" 1;
}
.brand-note {
  font: 700 20px/1 var(--font-hand); color: var(--accent-deep);
  transform: rotate(-4deg) translate(6px, 1px); transform-origin: left;
}

.topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }

.account { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account-user {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 4px 14px 4px 4px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  box-shadow: var(--shadow);
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none;
  background: var(--accent-soft); display: grid; place-items: center;
  font-size: 14px; font-weight: 800; color: var(--accent-deep);
  box-shadow: 0 0 0 2px var(--accent);
}
.account-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 16ch; font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); flex: none; }
.link-btn {
  border: 0; background: none; padding: 0; cursor: pointer; white-space: nowrap;
  color: var(--muted); font-size: 13.5px; font-weight: 600;
  text-decoration: underline wavy var(--faint); text-underline-offset: 4px;
}
.link-btn:hover { color: var(--text); text-decoration-color: var(--accent); }

.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; flex: none;
  border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--accent-deep);
  cursor: pointer; box-shadow: var(--shadow); transition: transform .3s;
}
.icon-btn:hover { transform: rotate(25deg) scale(1.05); }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* --- generic pieces ------------------------------------------------------ */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel-solid);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.chip-btn { cursor: pointer; color: var(--muted); transition: color .2s, border-color .2s, background .2s, transform .2s; }
.chip-btn:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); transform: translateY(-2px) rotate(-1.5deg); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 24px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 800; font-size: 15.5px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: transform .15s, background .2s, border-color .2s, opacity .2s, box-shadow .2s;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #ee82a2, var(--accent));
  color: var(--accent-ink);
  box-shadow: 0 3px 0 var(--accent-shadow), 0 12px 26px -12px var(--accent-shadow);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 5px 0 var(--accent-shadow), 0 16px 30px -12px var(--accent-shadow); }
.btn-primary:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-shadow); }
.btn-ghost { background: var(--panel-solid); border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.btn-spotify { background: #1ed760; color: #08130c; height: 40px; padding: 0 18px; box-shadow: 0 3px 0 #13a347; }
.btn-block { width: 100%; }

.banner {
  margin: 0 clamp(16px, 4vw, 40px) 12px;
  padding: 12px 18px; border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  background: color-mix(in srgb, var(--danger) 12%, var(--panel-solid));
  color: var(--text); font-weight: 600;
}

/* --- layout -------------------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: clamp(18px, 2.5vw, 32px);
  padding: 10px clamp(16px, 4vw, 40px) 40px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.library {
  padding: 22px;
  position: sticky; top: 16px;
  display: flex; flex-direction: column; gap: 16px;
  max-height: calc(100vh - 32px);
  animation: pop .7s cubic-bezier(.2, .9, .3, 1.2) both;
}
.panel-head h2 {
  margin: 0; font: 700 28px/1.05 var(--font-display);
  font-variation-settings: "SOFT" 100, "WONK" 1;
}
.panel-head p { margin: 4px 0 0; font-size: 14px; }

/* --- sources ------------------------------------------------------------- */

.sources { display: flex; flex-direction: column; gap: 2px; overflow: auto; margin: 0 -8px; padding: 0 8px; min-height: 0; }
.group-label { margin: 12px 0 4px 10px; }

.source {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 14px; cursor: pointer;
  transition: background .15s;
}
.source:hover { background: var(--accent-soft); }
.source input { position: absolute; opacity: 0; pointer-events: none; }
.source .box {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong);
  display: grid; place-items: center; transition: background .15s, border-color .15s, transform .2s;
}
.source input:checked + .box { background: var(--accent); border-color: var(--accent-deep); transform: scale(1.05); }
.source input:checked + .box::after {
  content: ""; width: 9px; height: 5px; margin-top: -2px;
  border: 2.4px solid var(--accent-ink); border-top: 0; border-right: 0; transform: rotate(-45deg);
}
.source input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.source.is-disabled { cursor: not-allowed; opacity: .5; }
.source.is-disabled:hover { background: none; }
.source-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.source-sub { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.source-count { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.source-everything .source-name {
  font: 700 19px var(--font-display); font-variation-settings: "SOFT" 100, "WONK" 1;
}
.cache-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--faint); }
.cache-dot.on { background: var(--leaf); }

.followed summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--muted); padding: 8px 10px; list-style: none; }
.followed summary::-webkit-details-marker { display: none; }
.followed summary::before { content: "＋ "; }
.followed[open] summary::before { content: "－ "; }
.followed .note { margin: 0 10px 6px; font-size: 12.5px; color: var(--muted); }

/* --- progress: a growing stem with a sunflower riding on top ------------- */

.progress { display: flex; flex-direction: column; gap: 8px; }
.progress-track {
  height: 10px; border-radius: 999px; background: var(--accent-soft);
  position: relative; overflow: visible;
}
.progress-fill {
  position: relative; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, #8cc06a, var(--leaf));
  transition: width .5s ease;
}
.progress-fill::after {
  content: ""; position: absolute; right: -13px; top: 50%; width: 26px; height: 26px; margin-top: -13px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-50 -50 100 100'%3E%3Cg fill='%23ffc928'%3E%3Cellipse ry='22' rx='10' cy='-27'/%3E%3Cellipse ry='22' rx='10' cy='-27' transform='rotate(45)'/%3E%3Cellipse ry='22' rx='10' cy='-27' transform='rotate(90)'/%3E%3Cellipse ry='22' rx='10' cy='-27' transform='rotate(135)'/%3E%3Cellipse ry='22' rx='10' cy='-27' transform='rotate(180)'/%3E%3Cellipse ry='22' rx='10' cy='-27' transform='rotate(225)'/%3E%3Cellipse ry='22' rx='10' cy='-27' transform='rotate(270)'/%3E%3Cellipse ry='22' rx='10' cy='-27' transform='rotate(315)'/%3E%3C/g%3E%3Ccircle r='17' fill='%235a3a1e'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: spin 3s linear infinite;
  filter: drop-shadow(0 2px 3px rgba(150, 100, 20, .35));
}
.progress.indeterminate .progress-fill { width: 30% !important; animation: wander 2.4s ease-in-out infinite alternate; }
.progress-msg {
  margin: 0; font-size: 13px; font-weight: 600; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* --- library stats ------------------------------------------------------- */

.lib-stats { border-top: 2px dotted var(--line-strong); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.stat-big { font: 700 36px/1 var(--font-display); font-variation-settings: "SOFT" 100, "WONK" 1; }
.stat-big small { font: 600 13.5px var(--font-ui); color: var(--muted); margin-left: 6px; }
.coverage { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--line); }
.coverage span { display: block; height: 100%; }
.coverage .c-track { background: var(--accent); }
.coverage .c-artist { background: var(--leaf); opacity: .75; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.mini-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.mini-tags span { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--muted); }

/* --- mood card ----------------------------------------------------------- */

.stage { display: flex; flex-direction: column; gap: clamp(22px, 3vw, 34px); min-width: 0; }

.mood-card {
  position: relative;
  padding: clamp(24px, 3.5vw, 40px) clamp(20px, 3.5vw, 44px) clamp(22px, 3vw, 32px);
  display: flex; flex-direction: column; gap: 18px;
  border-radius: calc(var(--radius) + 8px);
  background:
    radial-gradient(120% 90% at 100% 0%, var(--accent-soft), transparent 55%),
    var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: pop .8s .08s cubic-bezier(.2, .9, .3, 1.2) both;
}
.hero-flower {
  position: absolute; width: clamp(96px, 13vw, 150px); height: clamp(96px, 13vw, 150px);
  top: clamp(-44px, -4vw, -28px); right: clamp(-10px, 1vw, 24px);
  filter: drop-shadow(0 12px 18px rgba(217, 146, 0, 0.35));
  transform-origin: 50% 80%;
  animation: sway 6s ease-in-out infinite;
  pointer-events: none;
}
/* A dahlia tucked in beside the sunflower, swaying out of step with it. */
.hero-dahlia {
  position: absolute; width: clamp(80px, 10vw, 120px); height: clamp(80px, 10vw, 120px);
  top: clamp(-24px, -1.6vw, -12px); right: clamp(80px, 11.5vw, 160px);
  filter: drop-shadow(0 10px 14px rgba(178, 63, 102, 0.3));
  transform-origin: 50% 80%;
  animation: sway 7s ease-in-out -2.5s infinite;
  pointer-events: none;
}
.prompt {
  font: 700 23px/1.15 var(--font-hand); color: var(--accent-deep);
  font-size: clamp(22px, 2.4vw, 27px); padding-right: clamp(160px, 23vw, 270px);
}
.mood-input {
  width: 100%; padding: 2px 0 10px; border: 0; border-bottom: 3px dotted var(--line-strong);
  background: transparent; outline: none;
  font: italic 500 clamp(34px, 5.4vw, 62px)/1.12 var(--font-display); letter-spacing: -0.015em;
  font-variation-settings: "SOFT" 100, "WONK" 1;
  transition: border-color .3s;
}
.mood-input::placeholder { color: var(--faint); }
.mood-input:focus { border-bottom-color: var(--accent); }

.mood-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 7px; }
.mood-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* --- results ------------------------------------------------------------- */

.results { display: flex; flex-direction: column; gap: 22px; animation: pop .6s cubic-bezier(.2, .9, .3, 1.2) both; }
.results-head { padding: 0 6px; display: flex; flex-direction: column; gap: 10px; }
.res-mood {
  margin: 0; font: italic 600 clamp(42px, 6.5vw, 80px)/0.98 var(--font-display); letter-spacing: -0.02em;
  font-variation-settings: "SOFT" 100, "WONK" 1;
  overflow-wrap: anywhere;
}
.res-mood::after {
  content: ""; display: block; width: min(240px, 60%); height: 12px; margin-top: 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12'%3E%3Cpath d='M2 8c12-6 22 4 34-1s22-5 34 0 22 4 34-1 14-3 14-3' fill='none' stroke='%23df5f87' stroke-width='3.5' stroke-linecap='round'/%3E%3C/svg%3E") left / 100% 100% no-repeat;
}
.res-desc { margin: 0; max-width: 62ch; font-size: 16.5px; color: var(--muted); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-row .chip { font-size: 12.5px; padding: 4px 11px; }
.tag-row .chip.avoid { color: var(--faint); text-decoration: line-through; }

.save-bar {
  position: sticky; top: 12px; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px;
  padding: 16px 18px; border-radius: 22px;
  background: var(--panel-solid); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.name-field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 260px; min-width: 0; }
.name-field input {
  border: 0; border-bottom: 2px dashed var(--line-strong); background: transparent; outline: none;
  padding: 2px 0 4px; width: 100%;
  font: 600 27px/1.15 var(--font-display); font-variation-settings: "SOFT" 100, "WONK" 1;
}
.name-field input:focus { border-bottom: 2px solid var(--accent); }
.save-side { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sel-count { font-size: 13.5px; font-weight: 700; color: var(--muted); }

.saved {
  flex-basis: 100%;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-top: 14px; border-top: 2px dotted var(--line-strong);
  animation: pop .6s cubic-bezier(.2, .9, .3, 1.3) both;
}
.saved-icon { width: 34px; height: 34px; flex: none; animation: spin 8s linear infinite; }
.saved-text { flex: 1 1 200px; min-width: 0; font-weight: 600; }
.saved-text b { font-weight: 800; }

.tracks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.track { animation: pop .5s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(var(--i, 0) * 30ms); }
.track-inner {
  position: relative;
  display: grid; grid-template-columns: 24px 52px minmax(0, 1.1fr) minmax(0, 1fr) 48px;
  align-items: center; gap: 14px;
  padding: 8px 12px; border-radius: 18px; cursor: pointer;
  transition: background .15s, opacity .25s, transform .2s;
}
.track-inner:hover { background: var(--accent-soft); }
.track-check { position: absolute; opacity: 0; pointer-events: none; }
.check-ui {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong);
  display: grid; place-items: center; transition: background .15s, border-color .15s, transform .2s;
}
.track-check:checked + .check-ui { background: var(--accent); border-color: var(--accent-deep); }
.track-check:checked + .check-ui::after {
  content: ""; width: 9px; height: 5px; margin-top: -2px;
  border: 2.4px solid var(--accent-ink); border-top: 0; border-right: 0; transform: rotate(-45deg);
}
.track-check:focus-visible + .check-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.art {
  width: 52px; height: 52px; border-radius: 14px; object-fit: cover; background: var(--bg-raise);
  box-shadow: 0 6px 14px -8px rgba(90, 58, 30, .55);
  transform: rotate(-2deg); transition: transform .25s;
}
.track:nth-child(even) .art { transform: rotate(2deg); }
.track-inner:hover .art { transform: rotate(0) scale(1.06); }
.track-text { display: flex; flex-direction: column; min-width: 0; }
.track-title, .track-artist { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-title { font-weight: 800; }
.track-artist { font-size: 14px; font-weight: 600; color: var(--muted); }
.track-reason { font: 600 18px/1.15 var(--font-hand); color: var(--muted); }
.track:not(.is-on) .track-inner { opacity: .4; }
.track:not(.is-on) .art { filter: grayscale(1); }

/* Score = a sunflower head: petal ring fills with the score, seed centre shows the number. */
.score {
  --s: 0;
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; justify-self: end;
  background:
    radial-gradient(closest-side, var(--seed) 64%, transparent 66%),
    conic-gradient(var(--sun) calc(var(--s) * 1%), var(--sun-soft) 0);
  box-shadow: 0 0 0 3px var(--panel-solid);
}
.score-num { font-size: 13px; font-weight: 800; color: #ffe8a3; }

.more { border-top: 2px dotted var(--line-strong); padding-top: 14px; }
.more summary { cursor: pointer; color: var(--muted); font-weight: 800; list-style: none; padding: 6px 12px; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: "🌱 "; }
.more > p { margin: 4px 12px 10px; }

.empty { padding: clamp(16px, 4vw, 48px) 8px; text-align: center; animation: pop .9s .2s cubic-bezier(.2, .9, .3, 1.2) both; }
.empty-bouquet { display: flex; justify-content: center; align-items: flex-end; margin-bottom: 12px; }
.empty-flower, .empty-dahlia { display: block; transform-origin: 50% 90%; }
.empty-flower { width: 92px; height: 92px; animation: sway 5s ease-in-out infinite; }
.empty-dahlia { width: 78px; height: 78px; margin-left: -18px; animation: sway 6s ease-in-out -2s infinite; }
.empty-title {
  margin: 0 auto 6px; max-width: 24ch;
  font: 600 clamp(26px, 3.2vw, 38px)/1.18 var(--font-display); font-variation-settings: "SOFT" 100, "WONK" 1;
}
.empty-title em { color: var(--accent-deep); }
.empty-note { margin: 0; font: 700 24px var(--font-hand); color: var(--muted); }

.footer {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 8px;
  padding: 0 16px 28px; font-size: 13px; font-weight: 600; color: var(--faint);
}
.footer span:first-child { font: 700 18px/1.2 var(--font-hand); color: var(--muted); }
#llmChip { align-self: center; }

/* --- petal shower on save ----------------------------------------------- */

.petals { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.petal {
  position: absolute; top: -40px; width: 16px; height: 30px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: linear-gradient(180deg, #ffd34d, #f2a900);  /* JS swaps some for dahlia pinks */
  opacity: .95;
  animation: fall var(--dur, 3s) cubic-bezier(.3, .2, .6, 1) var(--delay, 0s) forwards;
}

/* --- motion -------------------------------------------------------------- */

@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sway { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes wander { from { margin-left: 0; } to { margin-left: 70%; } }
@keyframes fall {
  0% { transform: translate3d(0, 0, 0) rotate(var(--rot, 0deg)); }
  100% { transform: translate3d(var(--drift, 40px), 110vh, 0) rotate(calc(var(--rot, 0deg) + 540deg)); opacity: .8; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .petals { display: none; }
}

/* --- small screens ------------------------------------------------------- */

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .library { position: static; max-height: none; }
  .sources { max-height: 320px; }
  .track-inner { grid-template-columns: 24px 46px minmax(0, 1fr) 44px; gap: 10px; padding: 8px 6px; }
  .art { width: 46px; height: 46px; }
  .track-reason { grid-column: 3 / 4; grid-row: 2; margin-top: -4px; font-size: 16.5px; }
  .score { grid-row: 1; grid-column: 4; }

  /* One column: lift the greeting above the library so it's the first thing she sees. */
  .stage { display: contents; }
  .empty { order: -1; padding: 0 8px; }
  .empty-bouquet { margin-bottom: 6px; }
  .empty-flower { width: 64px; height: 64px; }
  .empty-dahlia { width: 54px; height: 54px; margin-left: -12px; }
  .empty-note { font-size: 21px; }
}

@media (max-width: 520px) {
  .account-name, .account-user .dot { display: none; }
  .account-user { padding: 3px; }
  /* Room for "Connect Spotify" next to the wordmark; very narrow phones wrap it below. */
  .topbar { gap: 8px; flex-wrap: wrap; }
  .topbar-right { gap: 6px; margin-left: auto; }
  .account .btn-spotify { height: 36px; padding: 0 10px; font-size: 13px; }
  .icon-btn { width: 36px; height: 36px; }
  .brand { gap: 6px; }
  .wordmark { font-size: 22px; }
  .brand-note { font-size: 17px; }
  .brand-mark { width: 34px; height: 34px; }
  .prompt { padding-right: 128px; }
  .mood-actions { width: 100%; }
  .mood-actions .btn { flex: 1; }
  .save-side { width: 100%; justify-content: space-between; }
}
