:root {
  --dark: #071e2d;
  --dark2: #103e58;
  --primary: #155b82;
  --primary-light: #e1eef5;
  --accent: #dc8d25;
  --accent-light: #fff2df;
  --surface: #ffffff;
  --bg: #eaf0f3;
  --text: #172832;
  --muted: #657680;
  --border: #cad7dd;
  --danger: #a53333;
  --success: #15764f;
  --shadow: 0 12px 38px rgba(7, 35, 51, 0.12);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(220, 141, 37, 0.16), transparent 34rem),
    linear-gradient(145deg, #edf3f5, #dce7eb);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.topbar {
  position: sticky;
  z-index: 100;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 14px 22px;
  color: white;
  background: linear-gradient(135deg, var(--dark), var(--dark2));
  box-shadow: 0 8px 24px rgba(0,0,0,.16);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand > div:last-child { display: flex; flex-direction: column; }
.brand strong { font-size: 1.02rem; }
.brand span { color: #d7e6ee; font-size: .82rem; }

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 13px;
  color: var(--dark);
  background: white;
  font-weight: 950;
  letter-spacing: -.05em;
}

.top-actions { display: flex; gap: 8px; }
.secondary, .primary {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 11px;
  font-weight: 850;
}
.secondary {
  border: 1px solid rgba(255,255,255,.3);
  color: white;
  background: rgba(255,255,255,.1);
}
.primary {
  border: 0;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--dark));
}

.page-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 24px 22px 96px;
}

.intro-card, .library-card, .background-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.95);
  box-shadow: var(--shadow);
}

.intro-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--accent);
  font-size: .74rem;
  font-weight: 950;
  letter-spacing: .13em;
}

h1, h2, p { overflow-wrap: anywhere; }
h1 { margin: 6px 0 8px; font-size: clamp(2rem, 6vw, 3rem); }
.intro-card p, .background-card p { max-width: 760px; margin: 0; color: var(--muted); line-height: 1.65; }

.user-pill {
  min-width: 180px;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f7fafb;
}
.user-pill span { display: block; color: var(--muted); font-size: .75rem; }
.user-pill strong { display: block; margin-top: 4px; }

.now-playing-card {
  display: grid;
  grid-template-columns: minmax(210px, 330px) 1fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid rgba(220,141,37,.4);
  border-radius: var(--radius);
  color: white;
  background:
    radial-gradient(circle at top right, rgba(220,141,37,.42), transparent 42%),
    linear-gradient(145deg, var(--dark), var(--dark2));
  box-shadow: var(--shadow);
}

.cover-wrap {
  overflow: hidden;
  aspect-ratio: 1;
  border-radius: 22px;
  background: white;
  box-shadow: 0 16px 38px rgba(0,0,0,.28);
}
.music-cover { width: 100%; height: 100%; object-fit: cover; display: block; }

.now-info { min-width: 0; }
.status-pill {
  display: inline-flex;
  min-height: 29px;
  align-items: center;
  padding: 5px 11px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px;
  background: rgba(255,255,255,.11);
  font-size: .78rem;
  font-weight: 850;
}
.now-info h2 { margin: 13px 0 6px; color: white; font-size: clamp(1.6rem, 5vw, 2.7rem); line-height: 1.1; }
.now-info p { margin: 4px 0; color: #e2edf2; }
.now-info .album { opacity: .75; }

.progress-row {
  display: grid;
  grid-template-columns: 45px 1fr 45px;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
.progress-row span:last-child { text-align: right; }
.range { width: 100%; min-height: 31px; accent-color: var(--accent); }

.main-controls { display: flex; justify-content: center; align-items: center; gap: 18px; margin: 18px 0; }
.round-button, .play-button {
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.round-button {
  width: 54px;
  height: 54px;
  border: 1px solid rgba(255,255,255,.35);
  color: white;
  background: rgba(255,255,255,.12);
  font-size: 1.2rem;
}
.play-button {
  width: 74px;
  height: 74px;
  border: 0;
  color: white;
  background: linear-gradient(145deg, var(--accent), #b96612);
  box-shadow: 0 12px 30px rgba(220,141,37,.32);
  font-size: 1.65rem;
}

.option-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.option-grid label { color: #e4eef3; font-size: .82rem; font-weight: 700; }
.option-grid select {
  width: 100%;
  min-height: 42px;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 10px;
  background: white;
}
.option-button {
  min-height: 44px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 11px;
  color: white;
  background: rgba(255,255,255,.1);
  font-weight: 800;
}
.option-button[aria-pressed="true"] { border-color: var(--accent); background: rgba(220,141,37,.24); }

.library-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.library-heading h2 { margin: 5px 0 3px; }
.library-heading p { margin: 0; color: var(--muted); }
.album-browser-heading { display:flex; align-items:end; justify-content:space-between; gap:12px; margin-top:22px; }
.library-auto-note { margin:5px 0 0; color:var(--success); font-size:.78rem; font-weight:750; }
.album-browser-heading h3 { margin:4px 0 0; font-size:1.15rem; }
.album-all-button { min-height:38px; padding:8px 12px; border:1px solid var(--border); border-radius:10px; }
.album-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; margin-top:12px; }
.album-button { overflow:hidden; padding:0; border:2px solid transparent; border-radius:15px; color:var(--text); background:#f7fafb; text-align:left; box-shadow:0 7px 20px rgba(7,35,51,.08); }
.album-button:hover,.album-button:focus-visible { border-color:var(--primary); }
.album-button[aria-current="true"] { border-color:var(--accent); background:var(--accent-light); }
.album-button img { display:block; width:100%; aspect-ratio:1; object-fit:cover; background:var(--primary-light); }
.album-button span { display:block; padding:10px; }
.album-button strong,.album-button small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.album-button small { margin-top:4px; color:var(--muted); }
.search-label { display: block; margin-top: 18px; color: var(--muted); font-size: .82rem; font-weight: 750; }
.search-label input {
  width: 100%;
  min-height: 46px;
  margin-top: 6px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  background: white;
}
.message { min-height: 22px; color: var(--muted); }
.message.error { color: var(--danger); }
.message.success { color: #167048; }

.playlist { display: grid; gap: 9px; }
.track-button {
  display: grid;
  grid-template-columns: 56px minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 72px;
  padding: 8px 13px 8px 8px;
  border: 1px solid var(--border);
  border-radius: 13px;
  color: var(--text);
  background: white;
  text-align: left;
}
.track-button:hover, .track-button:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(21,91,130,.1); }
.track-button[aria-current="true"] { border-color: var(--accent); background: var(--accent-light); }
.track-button img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--primary-light); }
.track-text { min-width: 0; }
.track-text strong, .track-text span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-text span { margin-top: 4px; color: var(--muted); font-size: .8rem; }
.track-number { color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.empty { padding: 25px; border: 2px dashed var(--border); border-radius: 14px; color: var(--muted); text-align: center; }

.background-card { margin-top: 18px; }
.background-card h2 { margin-top: 0; }

.mini-player {
  position: fixed;
  z-index: 120;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: minmax(0,1fr) 48px 52px 48px;
  gap: 5px;
  align-items: center;
  min-height: 70px;
  padding: 7px max(9px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(9px, env(safe-area-inset-left));
  color: white;
  background: linear-gradient(135deg, var(--dark), var(--dark2));
  box-shadow: 0 -8px 24px rgba(0,0,0,.2);
}
.hidden { display: none !important; }
.mini-player > button { min-height: 46px; border: 0; border-radius: 10px; color: white; background: rgba(255,255,255,.1); font-size: 1.05rem; }
.mini-track { display: grid; grid-template-columns: 45px minmax(0,1fr); gap: 9px; align-items: center; text-align: left; }
.mini-track img { width: 45px; height: 45px; border-radius: 8px; object-fit: cover; }
.mini-track span { min-width: 0; }
.mini-track strong, .mini-track small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-track small { margin-top: 3px; color: #d7e6ee; }

@media (max-width: 760px) {
  .topbar { align-items: flex-start; padding: 12px 14px; }
  .top-actions { flex-direction: column; }
  .top-actions button { min-height: 38px; padding: 8px 10px; font-size: .8rem; }
  .page-shell { padding: 16px 12px 96px; }
  .intro-card { display: block; }
  .user-pill { margin-top: 16px; }
  .now-playing-card { grid-template-columns: 1fr; padding: 16px; }
  .cover-wrap { width: min(78vw, 330px); margin: auto; }
  .option-grid { grid-template-columns: 1fr; }
  .library-heading { display: block; }
  .library-heading .primary { width: 100%; margin-top: 12px; }
}

@media (max-width: 470px) {
  .brand span { display: none; }
  .brand-mark { width: 42px; height: 42px; }
  .topbar { gap: 8px; }
  .top-actions { gap: 5px; }
  .track-button { grid-template-columns: 50px minmax(0,1fr); }
  .track-button img { width: 50px; height: 50px; }
  .track-number { display: none; }
  .album-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
