/* Madhuri — white on soft grey, rounded and layered, Apple-clean.
   Light key throughout; the Now Playing room glows softly from each cover. */

:root {
  /* The accent is the wren's turquoise (her logo, her choice). --rose-deep is
     the same hue driven darker so small text and pressed states stay readable. */
  --rose: #58b7ae;
  --rose-deep: #37827a;
  --rose-soft: #e8f5f3;
  --ink: #1d1a20;
  --ink-soft: #7f7887;
  --line: #e9e5ec;
  --bg: #f3f2f5;
  --card: #ffffff;
  --shadow: 0 1px 2px rgba(30, 15, 25, .04), 0 6px 24px rgba(30, 15, 25, .06);
  --radius: 20px;
  --radius-sm: 14px;
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: calc(158px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font: inherit; }
a { color: var(--rose); }
.ic { display: block; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-icon { width: 30px; height: 30px; object-fit: contain; }
.brand-name { font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; }
.searchwrap { flex: 1; max-width: 460px; margin-left: auto; position: relative; }
.searchwrap .s-ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); pointer-events: none; }
.searchwrap input {
  width: 100%; border: 1px solid transparent; background: #efedf1;
  border-radius: 12px; padding: 9px 14px 9px 40px; outline: none;
  -webkit-appearance: none; appearance: none;
}
.searchwrap input:focus { border-color: var(--rose); background: #fff; }

/* Main view */
.view { padding: 20px 18px 8px; max-width: 1080px; margin: 0 auto; }
.section-title { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; margin: 22px 2px 14px; }
.section-title:first-child { margin-top: 4px; }
.muted { color: var(--ink-soft); }
.empty { color: var(--ink-soft); text-align: center; padding: 56px 20px; line-height: 1.65; }
.empty .ic { margin: 0 auto 10px; opacity: .5; }

/* Horizontal rows (Continue listening, Newest) */
.hrow {
  display: flex; gap: 14px; overflow-x: auto; padding: 2px 2px 10px;
  scroll-snap-type: x proximity; scrollbar-width: none;
}
.hrow::-webkit-scrollbar { display: none; }
.hrow .card { width: 152px; flex: none; scroll-snap-align: start; }

/* Recording cards */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.card {
  cursor: pointer; border: 0; background: none; padding: 0; text-align: left;
  -webkit-tap-highlight-color: transparent;
  /* buttons center their content by default; pin everything to the top so
     covers align in a row no matter how long the title below them runs */
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
}
.card > * { flex: none; }
.cover {
  position: relative; width: 100%; aspect-ratio: 1;
  border-radius: var(--radius-sm); overflow: hidden;
  box-shadow: var(--shadow); background: var(--rose-soft);
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gen {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 7px; padding: 10px;
  color: #fff; text-align: center;
}
.gen .gen-emoji { font-size: 2.2rem; line-height: 1; }
.gen .gen-title { font-weight: 700; font-size: .8rem; overflow: hidden; max-height: 2.4em; letter-spacing: -.01em; }
.cover .playhint {
  position: absolute; right: 10px; bottom: 10px; width: 42px; height: 42px;
  border-radius: 50%; background: rgba(255,255,255,.95); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: translateY(4px) scale(.95); transition: .18s; box-shadow: var(--shadow);
}
.card:hover .playhint, .card.playing .playhint { opacity: 1; transform: none; }
.card-title { font-weight: 650; margin: 10px 2px 2px; font-size: .95rem; letter-spacing: -.01em; }
.card-sub { color: var(--ink-soft); font-size: .84rem; margin: 0 2px; }
.card-resume { color: var(--rose-deep); font-size: .78rem; font-weight: 600; margin: 4px 2px 0; }

/* Row lists (library, albums) — white panel */
.panel-list {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 6px;
}
.rowlist { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 10px; border-radius: var(--radius-sm); border: 0; background: none; text-align: left;
}
.row:hover { background: #f7f5f8; }
.row .r-cover { width: 52px; height: 52px; border-radius: 10px; overflow: hidden; flex: none; background: var(--rose-soft); box-shadow: var(--shadow); }
.row .r-cover img { width: 100%; height: 100%; object-fit: cover; }
.row .r-cover .gen .gen-emoji { font-size: 1.5rem; }
.row .r-cover .gen .gen-title { display: none; }
.row .r-main { flex: 1; min-width: 0; }
.row .r-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.row .r-sub { color: var(--ink-soft); font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .r-actions { display: flex; gap: 2px; flex: none; align-items: center; }

.iconbtn {
  border: 0; background: none; padding: 9px;
  border-radius: 12px; color: var(--ink-soft); line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.iconbtn:hover { background: #f1eef3; color: var(--ink); }
.iconbtn.faved { color: var(--rose-deep); }

/* Mini player — floating white card above the nav */
.playerbar {
  position: fixed; left: 10px; right: 10px; z-index: 40;
  bottom: calc(66px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(30,15,25,.14);
  max-width: 720px; margin: 0 auto;
  overflow: hidden;
}
.playerbar.hidden { display: none; }
.pb-progress { position: absolute; top: 0; left: 0; right: 0; height: 3px; pointer-events: none; }
.pb-progress input { display: none; }
.pb-progress .pb-fill { height: 100%; width: 0%; background: var(--rose); border-radius: 0 2px 2px 0; transition: width .3s linear; }
.pb-row { display: flex; align-items: center; gap: 11px; padding: 10px 12px; cursor: pointer; }
.pb-cover { width: 44px; height: 44px; border-radius: 10px; overflow: hidden; flex: none; background: var(--rose-soft); box-shadow: var(--shadow); }
.pb-cover img { width: 100%; height: 100%; object-fit: cover; }
.pb-cover .gen .gen-emoji { font-size: 1.3rem; }
.pb-cover .gen .gen-title { display: none; }
.pb-meta { flex: 1; min-width: 0; }
.pb-title { font-weight: 650; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.pb-sub { color: var(--ink-soft); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-btn {
  border: 0; background: none; color: var(--ink);
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.pb-btn:hover { background: #f1eef3; }

/* Now Playing — the full room */
.nowplaying {
  position: fixed; inset: 0; z-index: 55;
  display: flex; flex-direction: column;
  background-color: #ffffff;
  background-image: linear-gradient(180deg, var(--np-tint, #e8f5f3) 0%, rgba(255,255,255,0) 62%);
  padding: calc(14px + env(safe-area-inset-top)) 22px calc(26px + env(safe-area-inset-bottom));
  transform: translateY(0); transition: transform .32s cubic-bezier(.32,.72,.35,1);
}
.nowplaying.hidden { transform: translateY(105%); }
.np-head { display: flex; align-items: center; justify-content: space-between; }
.np-head .np-label { font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.np-body { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 520px; width: 100%; margin: 0 auto; }
.np-cover {
  width: min(78vw, 380px, 42vh); aspect-ratio: 1; margin: 0 auto;
  border-radius: 24px; overflow: hidden;
  box-shadow: 0 18px 50px rgba(30, 10, 25, .22);
  background: var(--rose-soft);
}
.np-cover img { width: 100%; height: 100%; object-fit: cover; }
.np-cover .gen .gen-emoji { font-size: 4.2rem; }
.np-cover .gen .gen-title { font-size: 1.05rem; }
.np-titles { margin: 30px 4px 4px; }
.np-title { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.np-sub { color: var(--ink-soft); font-size: 1rem; margin-top: 5px; }
.np-occasion { color: var(--ink-soft); font-size: .82rem; margin-top: 3px; opacity: .8; }
.np-seekwrap { margin-top: 22px; }
.np-seekwrap input { width: 100%; margin: 0; height: 22px; appearance: none; -webkit-appearance: none; background: transparent; }
.np-seekwrap input::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--rose) var(--pb, 0%), rgba(29,26,32,.12) var(--pb, 0%));
}
.np-seekwrap input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px;
  border-radius: 50%; background: #fff; border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.np-times { display: flex; justify-content: space-between; font-size: .78rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; margin-top: 4px; }
.np-controls { display: flex; align-items: center; justify-content: center; gap: 30px; margin-top: 18px; }
.np-controls > button { flex: 0 0 auto; }
@media (max-width: 480px) { .np-controls { gap: 14px; } }
.np-skip { border: 0; background: none; color: var(--ink); padding: 10px; border-radius: 50%; }
.np-skip:hover { background: rgba(0,0,0,.05); }
.np-skip.np-small { color: var(--ink-soft); }
.np-skip.active { color: var(--rose-deep); }
input[type="color"] {
  width: 34px; height: 34px; border: 0; padding: 0; background: none;
  border-radius: 50%; overflow: hidden; cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 2.5px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); }
.np-play {
  border: 0; background: var(--ink); color: #fff;
  width: 76px; height: 76px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px rgba(20,10,18,.3); transition: transform .12s;
}
.np-play:active { transform: scale(.94); }
.np-extra { display: flex; justify-content: center; gap: 20px; margin-top: 20px; }
.np-extra .iconbtn { color: var(--ink-soft); }
.np-extra .iconbtn:hover { background: rgba(0,0,0,.05); }

/* Bottom navigation */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  display: flex; justify-content: space-around;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
}
.navbtn {
  border: 0; background: none; color: var(--ink-soft);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: .68rem; font-weight: 600; padding: 3px 12px; border-radius: 12px; min-width: 60px;
  -webkit-tap-highlight-color: transparent;
}
.navbtn.active { color: var(--rose-deep); }

/* Panels and forms */
.panel {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; max-width: 460px; margin: 24px auto;
}
.panel h2 { margin: 0 0 14px; font-size: 1.25rem; letter-spacing: -.02em; }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 13px; outline: none; background: #fbfafc;
}
.field input:focus { border-color: var(--rose); background: #fff; }
.btn {
  background: var(--ink); color: #fff; border: 0; border-radius: 999px;
  padding: 12px 24px; font-weight: 650; letter-spacing: -.01em;
}
.btn:hover { background: #000; }
.btn.rose { background: var(--rose-deep); }
.btn.rose:hover { background: #2c6e67; }
.btn.ghost { background: #f1eef3; color: var(--ink); }
.btn.ghost:hover { background: #e9e5ec; }
.btn.small { padding: 8px 16px; font-size: .85rem; }
.btn:disabled { opacity: .45; cursor: default; }

/* Upload */
.dropzone {
  border: 1.5px dashed #d9c9d3; border-radius: var(--radius); padding: 40px 20px;
  text-align: center; color: var(--ink-soft); background: var(--card); cursor: pointer;
  box-shadow: var(--shadow);
}
.dropzone .ic { margin: 0 auto 10px; color: var(--rose); }
.dropzone.drag { border-color: var(--rose); background: var(--rose-soft); }
.upitem {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  margin-top: 14px; box-shadow: var(--shadow);
}
.upitem .u-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.upitem .u-head .ic { color: var(--rose); flex: none; }
.upitem .u-file { font-size: .82rem; color: var(--ink-soft); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upbar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin: 8px 0 4px; }
.upbar > div { height: 100%; background: var(--rose); width: 0%; transition: width .3s; }
.upstatus { font-size: .8rem; color: var(--ink-soft); }
.upgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .upgrid { grid-template-columns: 1fr; } }

/* Cover picker */
.coverpick { display: flex; gap: 16px; align-items: flex-start; margin-top: 8px; flex-wrap: wrap; }
.coverpick .preview { width: 100px; height: 100px; border-radius: 16px; overflow: hidden; flex: none; box-shadow: var(--shadow); background: var(--rose-soft); }
.coverpick .preview img { width: 100%; height: 100%; object-fit: cover; }
.coverpick .preview .gen .gen-emoji { font-size: 1.9rem; }
.coverpick .preview .gen .gen-title { font-size: .58rem; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; max-width: 270px; }
.swatch { width: 27px; height: 27px; border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.sel { box-shadow: 0 0 0 2.5px var(--rose); }
.emojis { display: flex; gap: 4px; flex-wrap: wrap; max-width: 290px; margin-top: 10px; }
.emojis button { border: 0; background: none; font-size: 1.25rem; padding: 5px 7px; border-radius: 9px; }
.emojis button.sel { background: var(--rose-soft); box-shadow: 0 0 0 1.5px var(--rose); }

/* Members */
.member { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.member + .member { border-top: 1px solid var(--line); }
.member .avatar {
  width: 44px; height: 44px; border-radius: 50%; background: var(--rose-soft);
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--rose-deep);
  overflow: hidden; flex: none;
}
.member .avatar img { width: 100%; height: 100%; object-fit: cover; }
.member .m-main { flex: 1; min-width: 0; }
.member .m-name { font-weight: 650; letter-spacing: -.01em; }
.member .m-sub { font-size: .8rem; color: var(--ink-soft); }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 2; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: #e3dfe7; transition: .2s; }
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); transition: .2s;
}
.switch input:checked + .track { background: var(--rose); }
.switch input:checked + .track::after { left: 21px; }

/* Toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(138px + env(safe-area-inset-bottom)); z-index: 60;
  background: var(--ink); color: #fff; border-radius: 999px;
  padding: 11px 22px; font-size: .9rem; font-weight: 500;
  box-shadow: 0 6px 24px rgba(0,0,0,.25); transition: opacity .3s;
  max-width: calc(100vw - 40px); text-align: center;
}
.toast.hidden { opacity: 0; pointer-events: none; }

/* Playlist chips */
.pl-chip {
  display: inline-flex; align-items: center; gap: 9px;
  border: 0; background: var(--card); border-radius: 999px;
  padding: 11px 18px; margin: 0 8px 10px 0; box-shadow: var(--shadow); font-weight: 650;
  letter-spacing: -.01em;
}
.pl-chip:hover { box-shadow: 0 2px 4px rgba(30,15,25,.08), 0 8px 28px rgba(30,15,25,.1); }
.pl-chip .ic { color: var(--rose); }
.pl-chip .n { color: var(--ink-soft); font-weight: 400; font-size: .82rem; }

/* Action sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 70; background: rgba(25,15,22,.4); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: #fff; border-radius: 24px 24px 0 0; width: 100%; max-width: 480px;
  padding: 12px 12px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 30px rgba(0,0,0,.2);
}
.sheet button {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  border: 0; background: none; padding: 14px; font-size: 1rem; border-radius: 14px; font-weight: 500;
}
.sheet button:hover { background: #f5f2f6; }
.sheet button .ic { color: var(--ink-soft); }
.sheet button.danger, .sheet button.danger .ic { color: #c02942; }

@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .hrow .card { width: 180px; }
  .view { padding: 26px; }
}
