:root {
  color-scheme: dark;
  --bg: #07101f;
  --panel: #101c31;
  --panel-2: #162640;
  --text: #f5f7fb;
  --muted: #9aa8bd;
  --accent: #ff3b7a;
  --accent-2: #ff8a35;
  --line: rgba(255,255,255,.08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { min-height: 100dvh; }
button, input { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }

.screen {
  min-height: 100dvh;
  padding: calc(32px + var(--safe-top)) 22px calc(32px + var(--safe-bottom));
  display: grid;
  align-content: center;
  gap: 30px;
  background:
    radial-gradient(circle at 30% 5%, rgba(255,59,122,.24), transparent 34%),
    radial-gradient(circle at 90% 25%, rgba(255,138,53,.18), transparent 30%),
    var(--bg);
}

.brand-block { text-align: center; }
.brand-icon { width: 112px; height: 112px; border-radius: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.brand-block h1 { margin: 18px 0 5px; font-size: 38px; }
.brand-block p { color: var(--muted); margin: 0; }

.card {
  background: linear-gradient(145deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 16px 45px rgba(0,0,0,.22);
}

.login-card { padding: 20px; display: grid; gap: 16px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 14px; }
input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.22);
  color: var(--text);
  border-radius: 15px;
  padding: 14px 15px;
  outline: none;
}
input:focus { border-color: rgba(255,59,122,.65); box-shadow: 0 0 0 3px rgba(255,59,122,.12); }

.primary, .secondary, .small {
  border: 0;
  border-radius: 15px;
  padding: 14px 18px;
  font-weight: 800;
}
.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.secondary { background: var(--panel-2); }
.error { color: #ff9eae; min-height: 20px; margin: 0; font-size: 14px; }

.app-shell {
  min-height: 100dvh;
  max-width: 760px;
  margin: 0 auto;
  padding: calc(18px + var(--safe-top)) 16px calc(162px + var(--safe-bottom));
  background:
    radial-gradient(circle at 85% -5%, rgba(255,59,122,.17), transparent 29%),
    var(--bg);
}

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.topbar h1 { margin: 3px 0 0; font-size: 27px; }
.eyebrow { color: var(--accent-2); font-size: 11px; letter-spacing: .18em; font-weight: 900; }
.icon-button {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  font-size: 20px;
}

.view { display: none; }
.view.active { display: block; }

.hero { padding: 24px 20px; overflow: hidden; position: relative; }
.hero::after {
  content: "";
  position: absolute;
  width: 190px; height: 190px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,59,122,.25), rgba(255,138,53,.08));
  right: -70px; top: -70px;
}
.hero h2 { font-size: 34px; line-height: 1.03; margin: 10px 0 28px; position: relative; z-index: 1; }
.shuffle-button {
  width: 100%;
  min-height: 92px;
  border: 0;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 34px rgba(255,59,122,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 950;
  position: relative;
  z-index: 1;
}
.shuffle-symbol { font-size: 28px; }
.hero .secondary { width: 100%; margin-top: 12px; position: relative; z-index: 1; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.quick { min-height: 118px; border: 1px solid var(--line); color: var(--text); display: grid; place-content: center; gap: 9px; text-align: center; }
.quick span { font-size: 28px; color: var(--accent); }
.status-card { display: flex; gap: 12px; align-items: center; padding: 16px; }
.status-card small { display: block; color: var(--muted); margin-top: 3px; }
.status-dot { width: 11px; height: 11px; border-radius: 50%; background: #45d483; box-shadow: 0 0 15px rgba(69,212,131,.7); }

.search-box { padding: 12px; display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.small { padding: 12px 15px; }
.results { display: grid; gap: 9px; margin-top: 14px; }
.result-row {
  width: 100%;
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255,255,255,.035);
}
.result-row img { width: 58px; height: 58px; object-fit: cover; border-radius: 12px; background: var(--panel); }
.result-copy { min-width: 0; }
.result-copy strong, .result-copy span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-copy span { color: var(--muted); font-size: 13px; margin-top: 4px; }
.result-index { color: var(--muted); font-size: 12px; padding-right: 4px; }
.result-row.current { border-color: rgba(255,59,122,.6); background: rgba(255,59,122,.1); }

.section-heading { display: flex; align-items: center; justify-content: space-between; }
.section-heading h2 { margin: 0; }
.text-button { border: 0; background: transparent; color: var(--accent-2); }

.player-view { text-align: center; }
.cover-wrap { padding: 8px 12px 0; }
.player-cover {
  width: min(78vw, 420px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 30px;
  background: var(--panel);
  box-shadow: 0 30px 70px rgba(0,0,0,.4);
}
.track-copy { margin-top: 22px; }
.track-copy h2 { font-size: 26px; margin: 0 0 7px; }
.track-copy p { margin: 3px 0; color: var(--muted); }
#player-album { font-size: 13px; }

.progress-wrap { margin: 24px auto 18px; max-width: 520px; }
#progress { padding: 0; accent-color: var(--accent); }
.time-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 5px; }

.main-controls { display: flex; justify-content: center; align-items: center; gap: 20px; }
.round-button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-size: 24px;
}
.play-main {
  width: 88px;
  height: 88px;
  font-size: 34px;
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 15px 35px rgba(255,59,122,.25);
}
.secondary-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.pill-button { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 12px 16px; }

.mini-player {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(74px + var(--safe-bottom));
  max-width: 736px;
  margin: 0 auto;
  background: rgba(16,28,49,.96);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 19px;
  padding: 8px;
  display: grid;
  grid-template-columns: 48px 1fr 44px 44px;
  gap: 7px;
  align-items: center;
  z-index: 20;
  box-shadow: 0 15px 40px rgba(0,0,0,.35);
}
.mini-player img { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; }
.mini-copy { border: 0; background: transparent; text-align: left; min-width: 0; }
.mini-copy strong, .mini-copy span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-copy span { color: var(--muted); font-size: 12px; margin-top: 3px; }
.mini-player .icon-button { width: 42px; height: 42px; font-size: 17px; }

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(66px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(7,16,31,.96);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  z-index: 30;
}
.nav-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-content: center;
  gap: 2px;
  font-size: 21px;
}
.nav-button span { font-size: 10px; }
.nav-button.active { color: var(--text); }

.toast {
  position: fixed;
  left: 50%;
  top: calc(14px + var(--safe-top));
  transform: translate(-50%, -20px);
  background: #fff;
  color: #111;
  padding: 10px 15px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  z-index: 100;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

body.car-mode .topbar,
body.car-mode .bottom-nav,
body.car-mode .mini-player { display: none !important; }
body.car-mode .app-shell { max-width: none; padding: calc(14px + var(--safe-top)) 16px calc(20px + var(--safe-bottom)); }
body.car-mode .view { display: none !important; }
body.car-mode #player-view { display: block !important; }
body.car-mode .player-cover { width: min(58vh, 80vw, 430px); border-radius: 24px; }
body.car-mode .track-copy h2 { font-size: clamp(28px, 5vw, 44px); }
body.car-mode .round-button { width: 82px; height: 82px; font-size: 30px; }
body.car-mode .play-main { width: 112px; height: 112px; font-size: 42px; }
body.car-mode .pill-button { font-size: 17px; padding: 15px 20px; }

@media (min-width: 700px) {
  .app-shell { padding-left: 26px; padding-right: 26px; }
  .hero { padding: 32px; }
}
