:root {
  --bg: #0b0d17;
  --bg2: #11142200;
  --fg: #e7e9f3;
  --muted: #8b90a8;
  --accent: #6366f1;
  --accent2: #4f46e5;
  --err: #f87171;
  --card: #161a2c;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 100% at 50% 0%, #1a1f38 0%, var(--bg) 55%);
  color: var(--fg);
  font: 16px/1.4 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  min-height: 100%;
  padding: env(safe-area-inset-top) 20px calc(env(safe-area-inset-bottom) + 20px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.screen { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.hidden { display: none !important; }
h1 { font-weight: 600; letter-spacing: .5px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--err); min-height: 18px; font-size: 14px; }
code { background: #ffffff14; padding: 1px 5px; border-radius: 5px; font-size: 13px; }

/* Inputs / Buttons */
input[type=text], select {
  width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid #ffffff1f;
  background: var(--card); color: var(--fg); font-size: 16px;
}
select { width: auto; }
.btn {
  border: none; border-radius: 12px; padding: 12px 18px; font-size: 15px; font-weight: 500;
  color: var(--fg); background: #ffffff14; cursor: pointer;
}
.btn.primary { background: var(--accent2); width: 100%; padding: 14px; font-size: 16px; }
.btn.ghost { background: #ffffff0d; }
.btn.small { padding: 8px 12px; font-size: 13px; }
.btn:active { transform: scale(.98); }

/* Artwork */
.art-wrap { width: 230px; height: 230px; position: relative; margin-top: 6px; }
.art {
  width: 100%; height: 100%; border-radius: 22px; object-fit: cover;
  box-shadow: 0 18px 50px -18px #000, 0 0 0 1px #ffffff12;
  background: var(--card);
}
.art.fallback { display: flex; align-items: center; justify-content: center; font-size: 90px; position: absolute; inset: 0; }
.art[src=""], .art:not([src]) { opacity: 0; }

/* Now playing */
.now { text-align: center; min-height: 48px; }
.now-title { font-size: 19px; font-weight: 600; }
.now-source { font-size: 14px; margin-top: 3px; }

/* Big play */
.play-btn {
  width: 96px; height: 96px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(160deg, var(--accent), var(--accent2));
  color: #fff; font-size: 38px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 14px 40px -12px var(--accent2);
  transition: transform .12s;
}
.play-btn:active { transform: scale(.94); }
.play-btn.playing { font-size: 30px; }

.row { display: flex; align-items: center; gap: 12px; width: 100%; justify-content: center; }
.vol-row input { flex: 1; max-width: 280px; accent-color: var(--accent); }
.sleep-row { gap: 10px; }
.state { min-height: 18px; text-align: center; }

.hist { width: 100%; margin-top: 6px; }
.hist summary { cursor: pointer; text-align: center; padding: 8px; }
.hist-list { list-style: none; padding: 0; margin: 8px 0; max-height: 200px; overflow: auto; }
.hist-list li { padding: 8px 10px; border-radius: 10px; background: #ffffff08; margin-bottom: 6px; font-size: 14px; }
.hist-list li .s { color: var(--muted); font-size: 12px; }
.settings-link { display: block; text-align: center; color: var(--accent); text-decoration: none; padding: 10px; margin-top: 4px; }
#logout { display: block; margin: 6px auto 0; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; vertical-align: middle; }
.dot.live { background: #34d399; box-shadow: 0 0 8px #34d399; }
.dot.buffer { background: #fbbf24; }
.dot.err { background: var(--err); }
