:root {
  --paper: #fbfbfd;
  --ink: #17151f;
  --ink-soft: #5d5a6b;
  --line: #e4e2ec;
  --blue: #2e3bff;
  --sun: #ffc53d;
  --rose: #ff6b8b;
  --mint: #19b48a;
  --violet: #8a4dff;
  --bar: #17151f;
  --bar-ink: #f4f3f8;
  --tint: 46 59 255;
  --radius-pill: 999px;
  --radius-card: 18px;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121118;
    --ink: #f1f0f6;
    --ink-soft: #a5a2b5;
    --line: #2b2936;
    --bar: #08070c;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Wordmark */
/* Logo: four equalizer bars + wordmark, all sized in em from the font size */
.mark {
  display: inline-flex; align-items: center; gap: 0.29em;
  font-family: "Sora", var(--font-display); font-weight: 600; letter-spacing: -0.055em; line-height: 1;
  text-decoration: none; color: var(--ink);
}
.mark__bars { display: inline-flex; align-items: center; gap: 0.086em; height: 1em; }
.mark__bars i { display: block; width: 0.155em; border-radius: 0.08em; background: var(--blue); }
.mark__bars i:nth-child(1) { height: 0.4em; }
.mark__bars i:nth-child(2) { height: 0.97em; }
.mark__bars i:nth-child(3) { height: 0.62em; }
.mark__bars i:nth-child(4) { height: 0.81em; }
.mark__word { transform: translateY(-0.04em); }
.mark--big { font-size: clamp(56px, 12vw, 116px); margin: 0 0 32px; }
.mark--small { font-size: 26px; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 14px 24px;
}
.topbar .mark--small, .topbar .search--top { visibility: hidden; }
.topbar .mark--small { flex: none; }
body:not(.is-home) .topbar { border-bottom: 1px solid var(--line); }
body:not(.is-home) .topbar .mark--small,
body:not(.is-home) .topbar .search--top { visibility: visible; }
.account { margin-left: auto; display: flex; align-items: center; gap: 10px; position: relative; }

/* Search */
.search {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--paper);
  transition: box-shadow .15s, border-color .15s;
}
.search:hover, .search:focus-within { border-color: transparent; box-shadow: 0 1px 6px rgb(32 33 36 / .2); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search--home { width: min(640px, 100%); padding: 14px 22px; }
.search--home input { font-size: 17px; }
.search__icon { color: var(--ink-soft); flex: none; }
.search--top { flex: 1; max-width: 640px; padding: 8px 8px 8px 20px; }
.search__go {
  display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: var(--blue); color: #fff; cursor: pointer; flex: none;
}
.search__go svg { width: 18px; height: 18px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 18px; border-radius: 8px; border: 1px solid transparent;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: 14px; cursor: pointer;
}
.btn:hover { border-color: var(--line); }
.btn--play { background: var(--blue); color: #fff; padding-inline: 26px; border-radius: var(--radius-pill); }
.btn--play:hover { border-color: transparent; filter: brightness(1.1); }
.btn--quiet { background: none; color: var(--ink-soft); }
.btn--signin { border-radius: var(--radius-pill); background: var(--blue); color: #fff; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; overflow: hidden;
  background: var(--violet); color: #fff; font-weight: 600;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.menu {
  position: absolute; right: 0; top: 46px; z-index: 20; min-width: 220px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 8px;
  box-shadow: 0 8px 30px rgb(0 0 0 / .12);
}
.menu p { margin: 6px 10px 10px; font-size: 14px; color: var(--ink-soft); overflow-wrap: anywhere; }
.menu button { width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }

/* Home */
.home {
  display: flex; flex-direction: column; align-items: center;
  padding: 12vh 16px 48px;
}
.home__actions { display: flex; gap: 12px; margin-top: 26px; }
.quota { margin: 22px 0 0; color: var(--ink-soft); font-size: 14px; text-align: center; min-height: 1.5em; }
.quota a { color: var(--blue); }
body:not(.is-home) .home { display: none; }

/* Studio */
.studio { display: none; }
body:not(.is-home) .studio {
  display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 40px;
  max-width: 1180px; margin: 0 auto; padding: 32px 24px 140px;
}
.library__title { font: 600 15px/1.2 var(--font-body); margin: 0 0 4px; }
.library__hint { margin: 0 0 14px; color: var(--ink-soft); font-size: 13px; }
.library__hint a { color: var(--blue); }
.library__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.lib-item {
  width: 100%; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: center;
  padding: 6px; border: 0; border-radius: 10px; background: none; text-align: left; cursor: pointer;
}
.lib-item:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.lib-item[aria-current="true"] { background: color-mix(in srgb, var(--blue) 12%, transparent); }
.lib-item__art { width: 44px; height: 44px; border-radius: 6px; background-size: cover; background-position: center; }
.lib-item__text { display: grid; min-width: 0; }
.lib-item__text strong, .lib-item__text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-item__text strong { font-weight: 600; font-size: 14px; }
.lib-item__text span { font-size: 12.5px; color: var(--ink-soft); }

.now {
  display: grid; grid-template-columns: minmax(220px, 340px) minmax(0, 1fr); gap: 36px; align-items: start;
  padding: 28px; border-radius: 24px;
  background: linear-gradient(160deg, rgb(var(--tint) / .22), rgb(var(--tint) / .04) 60%, transparent);
  transition: background .6s;
}
.now[hidden] { display: none; }
.now__cover {
  aspect-ratio: 1; border-radius: var(--radius-card); overflow: hidden; position: relative;
  background: var(--art, linear-gradient(135deg, var(--blue), var(--violet)));
  background-size: cover; background-position: center;
  box-shadow: 0 18px 50px rgb(var(--tint) / .35);
}
.now__cover .eq { display: none; }
.now.is-running .now__cover .eq { display: flex; }
.eq { position: absolute; inset: 0; align-items: flex-end; justify-content: center; gap: 8px; padding: 30%; }
.eq i { flex: 1; height: 30%; border-radius: 6px; background: rgb(255 255 255 / .85); animation: eq 1.1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; }
.eq i:nth-child(3) { animation-delay: -.6s; }
.eq i:nth-child(4) { animation-delay: -.15s; }
.eq i:nth-child(5) { animation-delay: -.45s; }
@keyframes eq { 0%, 100% { height: 25%; } 50% { height: 95%; } }

.now__style { margin: 4px 0 6px; font-size: 14px; font-weight: 600; color: rgb(var(--tint)); }
@media (prefers-color-scheme: dark) { .now__style { filter: brightness(1.6); } }
.now__title { font: 800 clamp(30px, 4.4vw, 52px)/1.02 var(--font-display); letter-spacing: -0.03em; margin: 0 0 12px; overflow-wrap: anywhere; }
.now__inspired { margin: -4px 0 12px; font-size: 15px; font-weight: 500; }
.now__inspired:empty { display: none; }
.now__prompt { margin: 0 0 16px; color: var(--ink-soft); font-size: 14.5px; }
.now__status { margin: 0 0 16px; font-weight: 500; }
.now__status:empty { display: none; }
.now__status.is-error { color: #d0284f; }
.now__keep { font-weight: 400; font-size: 14.5px; color: var(--ink-soft); }
.now__keep a { color: var(--blue); font-weight: 500; }
.now__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.now.is-running .now__actions, .now.is-failed .now__actions [data-play-big],
.now.is-failed .now__actions [data-download], .now.is-failed .now__actions [data-share] { display: none; }
.now__lyrics {
  margin: 0; white-space: pre-wrap; font: 500 16px/1.7 var(--font-body);
  max-width: 60ch; color: var(--ink);
}
.now__lyrics .tag { display: block; margin-top: 14px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.now__lyrics .tag:first-child { margin-top: 0; }

/* Player */
.player {
  position: fixed; inset: auto 0 0 0; z-index: 10;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr); align-items: center; gap: 16px;
  padding: 12px 20px; background: var(--bar); color: var(--bar-ink);
}
.player[hidden] { display: none; }
.player__track { display: flex; align-items: center; gap: 12px; min-width: 0; }
.player__thumb { width: 52px; height: 52px; border-radius: 6px; flex: none; background: var(--art, linear-gradient(135deg, var(--blue), var(--violet))); background-size: cover; background-position: center; }
.player__meta { display: grid; min-width: 0; }
.player__meta strong, .player__meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player__meta strong { font-weight: 600; font-size: 14px; }
.player__meta span { font-size: 12.5px; opacity: .65; }
.player__controls { display: grid; justify-items: center; gap: 4px; }
.player__buttons { display: flex; align-items: center; gap: 18px; }
.player__buttons button { border: 0; background: none; color: inherit; cursor: pointer; padding: 4px; display: grid; place-items: center; opacity: .85; }
.player__buttons button:hover { opacity: 1; }
.player__buttons button[disabled] { opacity: .3; cursor: default; }
.player__buttons svg { width: 20px; height: 20px; fill: currentColor; stroke-width: 1.5; }
.player__toggle { width: 38px; height: 38px; border-radius: 50%; background: var(--bar-ink) !important; color: var(--bar) !important; opacity: 1 !important; }
.player__toggle .i-pause, .player.is-playing .player__toggle .i-play { display: none; }
.player.is-playing .player__toggle .i-pause { display: block; }
.player__seek { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 8px; width: 100%; font-size: 12px; opacity: .85; }
.player__seek span:last-child { text-align: right; }
.player__volume { display: flex; align-items: center; justify-content: flex-end; gap: 8px; opacity: .85; }
.player__volume input { width: 110px; }
input[type="range"] { accent-color: var(--sun); height: 4px; cursor: pointer; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 30;
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 10px; font-size: 14px;
}

/* Mobile */
@media (max-width: 860px) {
  body:not(.is-home) .studio { grid-template-columns: 1fr; padding: 16px 16px 150px; }
  .library { order: 2; }
  .now { grid-template-columns: 1fr; padding: 16px; gap: 20px; }
  .now__cover { max-width: 360px; width: 100%; justify-self: center; }
  .topbar { padding: 10px 16px; gap: 12px; }
  .topbar .mark--small .mark__word { display: none; }
  body.is-home .topbar .search--top { display: none; }
  .player { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 16px; }
  .player__volume { display: none; }
  .player__controls { justify-items: end; }
  .player__seek { position: absolute; left: 0; right: 0; top: -14px; grid-template-columns: 1fr; padding: 0; }
  .player__seek span { display: none; }
  .home__actions { flex-direction: column; width: min(320px, 100%); }
}

@media (prefers-reduced-motion: reduce) {
  .eq i { animation: none; height: 60%; }
  .now, .search { transition: none; }
}
