:root {
  --bg: #0b0a12;
  --panel: #15131f;
  --panel-2: #1b1828;
  --text: #f2f0f8;
  --text-dim: #a29cc0;
  --accent: #7c5cff;
  --accent-2: #ff5c93;
  --good: #3ddc97;
  --border: #2a2638;
  --radius: 18px;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
/* The JS toggles visibility via the `hidden` attribute; without this,
   elements that also declare their own `display` (e.g. `.segment-overlay`'s
   `display: flex`) override the browser's default `[hidden]{display:none}`
   and stay visible regardless of what JS sets `.hidden` to. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.bg-glow {
  position: fixed;
  inset: -20% -20% auto -20%;
  height: 60vh;
  background: radial-gradient(circle at 30% 0%, rgba(124, 92, 255, 0.35), transparent 60%),
              radial-gradient(circle at 80% 10%, rgba(255, 92, 147, 0.25), transparent 55%);
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(16px, 4vw, 48px);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; letter-spacing: 0.02em; }

.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #55506e;
  box-shadow: 0 0 0 0 rgba(61, 220, 151, 0);
  transition: background 0.3s, box-shadow 0.3s;
}
.brand-dot.live {
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(61, 220, 151, 0.18);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(61, 220, 151, 0.18); }
  50% { box-shadow: 0 0 0 8px rgba(61, 220, 151, 0.08); }
}

.status-pill {
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.layout {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px clamp(16px, 4vw, 48px) 60px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
  gap: 24px;
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
}

.now-playing-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 32px);
  display: flex;
  gap: clamp(16px, 3vw, 32px);
}

@media (max-width: 640px) {
  .now-playing-card { flex-direction: column; }
}

.artwork-wrap {
  position: relative;
  width: 220px;
  height: 220px;
  flex-shrink: 0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 40px -20px rgba(0,0,0,0.6);
}
@media (max-width: 640px) { .artwork-wrap { width: 100%; height: auto; aspect-ratio: 1/1; } }

.artwork { width: 100%; height: 100%; object-fit: cover; display: block; background: #1b1828; }

.segment-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 10, 18, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 18px;
  gap: 8px;
}
.segment-kind {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-2);
  font-weight: 700;
}
.segment-text { font-size: 0.95rem; color: var(--text); line-height: 1.4; margin: 0; }

.track-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }

.eyebrow { color: var(--text-dim); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; margin: 0 0 6px; }
.track-title { font-size: clamp(1.4rem, 3vw, 2rem); margin: 0; line-height: 1.15; overflow-wrap: anywhere; }
.track-artist { font-size: 1.05rem; font-weight: 400; color: var(--text-dim); margin: 6px 0 20px; }

.progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.time { font-size: 0.75rem; color: var(--text-dim); width: 34px; text-align: center; font-variant-numeric: tabular-nums; }
.progress-track { flex: 1; height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.4s linear; }

.controls-row { display: flex; align-items: center; gap: 24px; }

.play-btn {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 10px 24px -8px rgba(124, 92, 255, 0.6);
  transition: transform 0.15s;
}
.play-btn:hover { transform: scale(1.05); }
.play-btn:active { transform: scale(0.96); }

.volume-row { display: flex; align-items: center; gap: 8px; color: var(--text-dim); flex: 1; max-width: 180px; }
.volume-row input[type=range] { flex: 1; accent-color: var(--accent); }

.side-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.panel h3 { margin: 0 0 10px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }

.weather-panel #weatherLine { margin: 0; font-size: 0.95rem; }

.up-next { font-size: 0.95rem; color: var(--text); }
.up-next .up-next-kind { color: var(--text-dim); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }

.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.history-list li { display: flex; flex-direction: column; font-size: 0.88rem; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.history-list li:last-child { border-bottom: none; padding-bottom: 0; }
.history-list .h-name { color: var(--text); }
.history-list .h-artist { color: var(--text-dim); font-size: 0.8rem; }

.foot {
  position: relative; z-index: 1;
  text-align: center; color: var(--text-dim); font-size: 0.8rem; padding: 20px 16px 40px;
}

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 18px; border-radius: 999px; font-size: 0.85rem; z-index: 10;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.6);
}
