/* Musixy Mini App.
   Brand comes from the logo: a magenta -> violet -> sky-blue note. The gradient
   is reserved for brand moments (mark, progress, the track that plays); the
   rest of the UI is quiet ink on near-black so covers carry the colour. */
:root {
  --bg: #0c0c10;
  --bg-2: #141419;
  --bg-3: #1c1c23;
  --line: rgba(255, 255, 255, .07);
  --ink: #f4f3f7;
  --ink-2: #a3a1ad;
  --ink-3: #6b6976;
  --pink: #ff2e93;
  --violet: #8f3dff;
  --sky: #2fa6ff;
  --brand: linear-gradient(100deg, var(--pink), var(--violet) 55%, var(--sky));
  --display: "Unbounded", system-ui, sans-serif;
  --ui: "Onest", system-ui, sans-serif;
  --r: 14px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 400 15px/1.4 var(--ui);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + 80px + var(--safe-b));
  overscroll-behavior-y: none;
}
/* Film grain: keeps big dark areas from looking flat and digital. */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; }
svg.ic { width: 22px; height: 22px; fill: currentColor; flex: none; }

/* ── Header ── */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 6px; max-width: 640px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 18px/1 var(--ui); letter-spacing: -.02em; }
.brand-mark { width: 30px; height: 30px; filter: drop-shadow(0 4px 12px rgba(143, 61, 255, .35)); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-3); color: var(--ink-2); font: 600 14px/1 var(--ui); border: 1px solid var(--line); }
.avatar:empty { visibility: hidden; }

#view { padding: 0 18px; max-width: 640px; margin: 0 auto; }

/* ── Headings ── */
.eyebrow { color: var(--ink-3); font: 600 11px/1 var(--ui); letter-spacing: .12em; text-transform: uppercase; }
.hello { font: 600 25px/1.15 var(--display); letter-spacing: -.035em; margin: 8px 0 0; }
.sub { color: var(--ink-2); font-size: 14px; margin-top: 6px; max-width: 34ch; }
.greet { margin: 14px 0 18px; }
.section { margin-top: 34px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; }
.section-head .eyebrow { margin-bottom: 6px; }
.section-title { margin: 0; font: 700 20px/1.15 var(--ui); letter-spacing: -.025em; }
.section-note { color: var(--ink-3); font-size: 13px; }

/* ── Hero: today's mix ── */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 20px; min-height: 212px;
  display: flex; flex-direction: column; justify-content: space-between; isolation: isolate;
  background: var(--bg-2); border: 1px solid var(--line);
}
.hero-bg { position: absolute; inset: -30%; z-index: -2; background-size: cover; background-position: center; filter: blur(40px) saturate(1.6); opacity: .8; transition: background-image .6s; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(12,12,16,.88) 30%, rgba(12,12,16,.25)); }
.hero-text { max-width: 58%; }
.hero-title { margin: 8px 0 0; font: 600 30px/1 var(--display); letter-spacing: -.045em; }
.hero-seeds { margin-top: 10px; color: var(--ink-2); font-size: 13px; line-height: 1.45; }
.hero-seeds b { color: var(--ink); font-weight: 600; }
.hero-cta { align-self: flex-start; margin-top: 18px; display: inline-flex; align-items: center; gap: 9px; height: 44px; padding: 0 20px 0 16px; border-radius: 22px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 15px; }
.hero-cta svg.ic { width: 17px; height: 17px; }
.hero-cta .grad { display: none; }
.hero.is-playing .hero-cta { background: rgba(255,255,255,.12); color: var(--ink); }
/* Fanned stack of the next covers in the mix */
.fan { position: absolute; right: 18px; top: 50%; width: 132px; height: 132px; transform: translateY(-50%); }
.fan img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 14px; object-fit: cover; box-shadow: 0 14px 34px rgba(0,0,0,.5); background: var(--bg-3); transition: transform .5s cubic-bezier(.2,.8,.2,1); }
.fan img:nth-child(1) { transform: translate(-52px, 10px) rotate(-14deg) scale(.84); filter: brightness(.55); }
.fan img:nth-child(2) { transform: translate(-27px, 4px) rotate(-7deg) scale(.92); filter: brightness(.78); }
.fan img:nth-child(3) { transform: rotate(3deg); }
.hero.is-playing .fan img:nth-child(3) { animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: rotate(3deg) translateY(-4px); } }

/* ── Panels: grouped lists on a raised surface ── */
.panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: 20px; padding: 6px 14px; }
.panel .row { border-bottom-color: var(--line); }

/* Artist chips (search suggestions) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 36px; padding: 0 14px; border-radius: 18px; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink); font-size: 14px; font-weight: 500; }
.chip:active { background: var(--bg-3); }

/* ── Mix rail ── */
.rail { display: flex; gap: 12px; overflow-x: auto; margin: 0 -18px; padding: 0 18px 4px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.card { flex: none; width: 148px; text-align: left; scroll-snap-align: start; }
.card-cover { position: relative; width: 148px; height: 148px; border-radius: var(--r); overflow: hidden; background: var(--bg-3); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:active .card-cover img { transform: scale(.97); }
.card-play {
  position: absolute; right: 8px; bottom: 8px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(12, 12, 16, .72); backdrop-filter: blur(8px);
}
.card-play svg.ic { width: 15px; height: 15px; }
.card.playing .card-play { background: var(--ink); color: var(--bg); }
.card-title { margin-top: 9px; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-artist { color: var(--ink-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Track rows ── */
.list { display: flex; flex-direction: column; }
.row {
  display: grid; grid-template-columns: auto 46px 1fr auto; align-items: center; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.list.plain .row { grid-template-columns: 46px 1fr auto; }
.row:last-child { border-bottom: 0; }
.row-n { width: 30px; text-align: left; color: var(--ink-3); font: 600 17px/1 var(--display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.row-n.top3 { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.row-cover { position: relative; width: 46px; height: 46px; border-radius: 9px; overflow: hidden; background: var(--bg-3); }
.row-cover img { width: 100%; height: 100%; object-fit: cover; }
.row-meta { min-width: 0; }
.row-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-artist { color: var(--ink-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.row-artist > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.e { flex: none; font: 600 9px/1 var(--ui); padding: 3px 4px; border-radius: 3px; background: var(--bg-3); color: var(--ink-2); }
.dur { flex: none; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.row.playing .row-title { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* Equalizer bars over the cover of the track that plays */
.eq { position: absolute; inset: 0; display: none; align-items: flex-end; justify-content: center; gap: 3px; padding-bottom: 13px; background: rgba(12,12,16,.55); }
.eq i { width: 3px; border-radius: 2px; background: var(--ink); animation: eq .9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { height: 5px; } 50% { height: 18px; } }
.row.playing .eq { display: flex; }

.send-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-2); transition: color .2s, background .2s; }
.send-btn svg.ic { width: 20px; height: 20px; }
.send-btn:active { background: var(--bg-3); }
.send-btn.done { color: var(--sky); }

/* ── Search ── */
.search-box { position: sticky; top: 0; z-index: 5; margin: 12px -18px 4px; padding: 6px 18px 10px; background: var(--bg); }
.search-box label { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink-3); transition: border-color .2s; }
.search-box label:focus-within { border-color: rgba(143, 61, 255, .55); }
.search-box svg.ic { width: 19px; height: 19px; }
.search-box input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--ink); font: 500 16px var(--ui); }
.search-box input::placeholder { color: var(--ink-3); }
.search-box input::-webkit-search-cancel-button { display: none; }
.empty { padding: 48px 8px; text-align: center; color: var(--ink-2); font-size: 14px; max-width: 32ch; margin: 0 auto; }
.empty b { display: block; color: var(--ink); font: 600 18px/1.25 var(--display); letter-spacing: -.02em; margin-bottom: 8px; }
.empty svg.ic { width: 34px; height: 34px; margin: 0 auto 14px; display: block; color: var(--ink-3); }

/* Skeletons */
.sk { background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2)); background-size: 200% 100%; animation: sk 1.3s linear infinite; border-radius: 6px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ── Mini player ── */
.player {
  position: fixed; left: 10px; right: 10px; bottom: calc(var(--nav-h) + 8px + var(--safe-b)); z-index: 20;
  max-width: 620px; margin: 0 auto;
  display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center; gap: 10px;
  padding: 8px 8px 10px 8px; border-radius: 16px;
  background: rgba(28, 28, 35, .86); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
  transition: transform .3s ease, opacity .3s ease;
}
.player.hidden { transform: translateY(20px); opacity: 0; pointer-events: none; }
/* The cover sits on a little record that spins while the preview plays */
.player-disc { position: relative; width: 44px; height: 44px; border-radius: 50%; background: #050507; padding: 7px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); animation: spin 4s linear infinite; animation-play-state: paused; }
.player-disc::after { content: ""; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; background: #050507; }
.player-disc img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.player.is-playing .player-disc { animation-play-state: running; }
@keyframes spin { to { transform: rotate(360deg); } }
.player-meta { min-width: 0; }
.player-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-artist { color: var(--ink-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--ink); }
.icon-btn svg.ic { width: 20px; height: 20px; }
.icon-btn.solid { background: var(--ink); color: var(--bg); }
.icon-btn.solid svg.ic { width: 17px; height: 17px; }
.icon-btn.done { color: var(--sky); }
.player-progress { position: absolute; left: 14px; right: 14px; bottom: 4px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.player-progress span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .25s linear; }

/* ── Tabs ── */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: rgba(12, 12, 16, .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--ink-3); font-size: 11px; font-weight: 500; transition: color .2s; }
.tabs button svg.ic { width: 23px; height: 23px; }
.tabs button.active { color: var(--ink); }

/* ── Discover feed ── */
body.feed-mode { padding-bottom: 0; overflow: hidden; }
body.feed-mode .top { position: fixed; top: 0; left: 0; right: 0; z-index: 12; }
body.feed-mode #view { padding: 0; max-width: none; }
.discover { position: fixed; inset: 0 0 calc(var(--nav-h) + var(--safe-b)) 0; overflow: hidden; }
.slide {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center;
  padding: 64px 28px 24px; transition: transform .45s cubic-bezier(.2, .8, .2, 1), opacity .45s;
}
.slide-bg { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(50px) saturate(1.3); opacity: .38; transform: scale(1.1); }
.slide::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(12,12,16,.2), rgba(12,12,16,.85) 75%); }
.slide > *:not(.slide-bg) { position: relative; z-index: 1; }
.slide-inner { width: 100%; max-width: 380px; margin: 0 auto; }
.slide-cover { width: 100%; aspect-ratio: 1; max-height: 44vh; border-radius: 18px; object-fit: cover; box-shadow: 0 24px 60px rgba(0, 0, 0, .55); background: var(--bg-3); }
.slide-title { margin-top: 22px; font: 600 23px/1.15 var(--display); letter-spacing: -.03em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.slide-artist { margin-top: 6px; color: var(--ink-2); font-size: 15px; }
.slide-bar { margin-top: 18px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.slide-bar span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .25s linear; }
.actions { display: flex; align-items: center; justify-content: space-between; margin-top: 22px; }
.act { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.08); color: var(--ink); transition: transform .15s, background .2s, color .2s; }
.act:active { transform: scale(.92); }
.act svg.ic { width: 24px; height: 24px; }
.act.big { width: auto; height: 56px; padding: 0 22px; border-radius: 28px; gap: 10px; display: flex; align-items: center; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 15px; }
.act.big svg.ic { width: 20px; height: 20px; }
.act.big.done { background: var(--bg-3); color: var(--sky); }
.act.liked { color: var(--pink); background: rgba(255, 46, 147, .14); }
.hint { margin-top: 16px; text-align: center; color: var(--ink-3); font-size: 12px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.hint svg.ic { width: 14px; height: 14px; }
.start-overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(12,12,16,.55); backdrop-filter: blur(6px); }
.start-overlay button { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 26px; border-radius: 28px; background: var(--ink); color: var(--bg); font: 600 15px var(--ui); }
.start-overlay svg.ic { width: 18px; height: 18px; }

/* ── Toast ── */
.toast {
  position: fixed; left: 50%; top: 14px; z-index: 50; transform: translate(-50%, -16px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); transition: .25s ease; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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