:root{
  --bg-deep:#1A0F2E;
  --bg-panel:#241736;
  --bg-panel-2:#2E1E48;
  --line:#3B2A5C;
  --coral:#00CCFF;
  --coral-dark:#0096C7;
  --gold:#FFE500;
  --freeze:#3DDC97;
  --text:#F5EFE6;
  --text-muted:#A9B3D9;
  --radius-lg:28px;
  --radius-md:18px;
  --radius-sm:12px;
  --shadow-btn:0 10px 26px -8px rgba(0,204,255,.55);
}

*{box-sizing:border-box;}
html{-webkit-tap-highlight-color:transparent;}
[hidden]{ display:none !important; }

body{
  margin:0;
  min-height:100vh;
  background:
    radial-gradient(circle at 15% 0%, #2A1B47 0%, transparent 55%),
    radial-gradient(circle at 100% 20%, #34204F 0%, transparent 45%),
    var(--bg-deep);
  color:var(--text);
  font-family:'Inter', system-ui, sans-serif;
  padding-bottom:env(safe-area-inset-bottom);
  overflow-x:hidden;
}

h1,h2{ font-family:'Baloo 2', 'Inter', sans-serif; margin:0; }

button{ font-family:inherit; cursor:pointer; }
:focus-visible{ outline:3px solid var(--gold); outline-offset:2px; }

/* ---------- Header ---------- */
.app-header{
  position:relative;
  display:flex; align-items:center; justify-content:center;
  padding:20px 20px 6px;
  max-width:560px; margin:0 auto;
}
.brand{ display:flex; flex-direction:column; align-items:center; gap:2px; text-align:center; }
.eyebrow{ margin:0; font-size:11px; letter-spacing:.14em; text-transform:uppercase; color:var(--text-muted); font-weight:600; }
.brand-text h1{ font-size:22px; font-weight:800; line-height:1.1; }
h1{ font-size:22px; font-weight:800; line-height:1.1; }

.install-btn{
  position:absolute; right:20px; top:18px;
  display:flex; align-items:center; gap:6px;
  background:var(--bg-panel-2); color:var(--text);
  border:1px solid var(--line); border-radius:999px;
  padding:9px 14px; font-size:13px; font-weight:600;
}
.install-btn svg{ color:var(--gold); }

/* ---------- Main ---------- */
.app-main{ max-width:560px; margin:0 auto; padding:8px 20px 40px; display:flex; flex-direction:column; gap:22px; }

/* ---------- Stage ---------- */
.stage{ display:flex; flex-direction:column; align-items:center; padding:22px 10px 6px; text-align:center; }
.stage-ring{
  width:180px; height:180px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  background: radial-gradient(circle at 32% 28%, var(--bg-panel-2), var(--bg-panel) 70%);
  border:2px solid var(--line);
  position:relative;
  transition:border-color .3s ease, box-shadow .3s ease;
}
.stage-ring::before{
  content:""; position:absolute; inset:-10px; border-radius:50%;
  border:2px solid var(--coral); opacity:0; transition:opacity .3s ease;
}
.stage-ring.playing{ border-color:var(--coral); box-shadow:0 0 0 8px rgba(255,107,74,.10); }
.stage-ring.playing::before{ opacity:1; animation:pulse-ring 1.6s ease-out infinite; }
.stage-ring.stopped{ border-color:var(--freeze); box-shadow:0 0 0 8px rgba(61,220,151,.14); }
.stage-ring.finished{ border-color:var(--gold); box-shadow:0 0 0 8px rgba(255,201,60,.14); }

@keyframes pulse-ring{
  0%{ transform:scale(1); opacity:.7; }
  100%{ transform:scale(1.18); opacity:0; }
}

.stage-logo{
  width:132px; height:132px; border-radius:50%;
  transition:opacity .3s ease, filter .3s ease, transform .3s ease;
}
.stage-ring.playing .stage-logo{ animation:bob 1s ease-in-out infinite; }
.stage-ring.stopped .stage-logo{ opacity:.4; filter:grayscale(55%); }
.stage-ring.finished .stage-logo{ filter:saturate(1.3); }
@keyframes bob{ 0%,100%{ transform:translateY(0) scale(1);} 50%{ transform:translateY(-6px) scale(1.03);} }

.stage-status{ margin:16px 0 4px; font-size:15px; color:var(--text-muted); font-weight:500; min-height:20px; }

.stage-meta{ display:flex; gap:10px; margin-top:6px; }
.meta-chip{
  background:var(--bg-panel); border:1px solid var(--line); border-radius:999px;
  padding:6px 16px; display:flex; flex-direction:column; align-items:center; min-width:96px;
}
.meta-label{ font-size:10px; text-transform:uppercase; letter-spacing:.08em; color:var(--text-muted); }
.meta-value{ font-size:16px; font-weight:800; font-family:'Baloo 2',sans-serif; color:var(--gold); font-variant-numeric:tabular-nums; }

/* ---------- Transport ---------- */
.transport{ display:flex; align-items:center; justify-content:center; gap:14px; }
.transport-btn{
  border:none; border-radius:999px; font-weight:700; display:flex; align-items:center; justify-content:center; gap:8px;
  transition:transform .15s ease, opacity .15s ease, box-shadow .15s ease;
}
.transport-btn:active{ transform:scale(.95); }
.transport-btn:disabled{ opacity:.35; pointer-events:none; }

.transport-btn.primary{
  background:linear-gradient(135deg, var(--coral), var(--coral-dark));
  color:#fff; padding:18px 30px; font-size:16px; box-shadow:var(--shadow-btn);
}
.transport-btn.secondary{
  background:var(--bg-panel); color:var(--text-muted); border:1px solid var(--line);
  padding:14px 18px; font-size:13px;
}

/* ---------- Volume ---------- */
.volume-row{ display:flex; align-items:center; gap:12px; color:var(--text-muted); padding:0 6px; }
.volume-value{ font-size:12px; width:36px; text-align:right; font-variant-numeric:tabular-nums; }

/* range sliders */
input[type="range"]{
  -webkit-appearance:none; appearance:none; width:100%; height:6px; border-radius:999px;
  background:var(--bg-panel-2); border:1px solid var(--line);
}
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none; width:22px; height:22px; border-radius:50%;
  background:var(--gold); border:3px solid var(--bg-deep); cursor:pointer;
  box-shadow:0 2px 8px rgba(0,0,0,.4);
  margin-top:-1px;
}
input[type="range"]::-moz-range-thumb{
  width:22px; height:22px; border-radius:50%; background:var(--gold);
  border:3px solid var(--bg-deep); cursor:pointer;
}

/* ---------- Panels ---------- */
.panel{
  background:var(--bg-panel); border:1px solid var(--line); border-radius:var(--radius-lg);
  padding:20px;
}
.panel-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:14px; flex-wrap:wrap; }
.panel h2{ font-size:16px; font-weight:700; }

.add-song-btn{
  background:var(--gold); color:#241736; font-weight:700; font-size:13px;
  padding:9px 14px; border-radius:999px; cursor:pointer; white-space:nowrap;
}

/* Playlist */
.playlist{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px; }
.playlist-empty{ color:var(--text-muted); font-size:13px; padding:10px 4px; }
.track{
  display:flex; align-items:center; gap:10px;
  background:var(--bg-panel-2); border:1px solid var(--line); border-radius:var(--radius-md);
  padding:10px 12px;
}
.track.active{ border-color:var(--coral); background:rgba(255,107,74,.08); }
.track-btn{
  width:34px; height:34px; border-radius:50%; border:none; flex-shrink:0;
  background:var(--bg-deep); color:var(--gold); display:flex; align-items:center; justify-content:center;
}
.track.active .track-btn{ background:var(--coral); color:#fff; }
.track-name{ flex:1; font-size:13.5px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.track-remove{ background:none; border:none; color:var(--text-muted); width:28px; height:28px; border-radius:50%; display:flex; align-items:center; justify-content:center; }
.track-remove:hover{ color:var(--coral); background:rgba(255,107,74,.12); }

/* Config fields */
.field{ margin-bottom:18px; }
.field:last-of-type{ margin-bottom:20px; }
.field-label{ display:flex; justify-content:space-between; font-size:13.5px; font-weight:600; margin-bottom:8px; color:var(--text); }
.field-value{ color:var(--gold); font-weight:700; font-variant-numeric:tabular-nums; }

.save-btn{
  width:100%; background:var(--coral); color:#0B2836; border:none; border-radius:999px;
  padding:14px; font-weight:800; font-size:14px;
}
.save-confirm{ text-align:center; color:var(--freeze); font-size:12.5px; margin:10px 0 0; font-weight:600; }

/* Instructions */
.instructions ol{ margin:0; padding-left:20px; display:flex; flex-direction:column; gap:8px; }
.instructions li{ font-size:13.5px; color:var(--text-muted); line-height:1.5; }
.instructions li::marker{ color:var(--gold); font-weight:800; }

/* ---------- Footer ---------- */
.app-footer{ text-align:center; padding:10px 20px 30px; color:var(--text-muted); font-size:12px; }
.app-footer a{ color:var(--coral); text-decoration:none; }

/* ---------- Freeze overlay (signature moment) ---------- */
.freeze-overlay{
  position:fixed; inset:0; z-index:999; pointer-events:none;
  display:flex; align-items:center; justify-content:center;
  background:rgba(255,255,255,0); opacity:0;
}
.freeze-overlay.show{
  animation:flash-bg .55s ease-out;
}
@keyframes flash-bg{
  0%{ background:rgba(245,239,230,.9); opacity:1; }
  100%{ background:rgba(245,239,230,0); opacity:1; }
}
.freeze-burst{ position:relative; display:flex; align-items:center; justify-content:center; opacity:0; }
.freeze-overlay.show .freeze-burst{ animation:burst-pop .7s cubic-bezier(.2,1.4,.4,1) forwards; }
@keyframes burst-pop{
  0%{ opacity:0; transform:scale(.4) rotate(-8deg); }
  35%{ opacity:1; transform:scale(1.08) rotate(2deg); }
  60%{ transform:scale(1) rotate(0deg); }
  100%{ opacity:0; transform:scale(1) rotate(0deg); }
}
.freeze-rays{ position:absolute; width:280px; height:280px; fill:var(--gold); }
.freeze-text{
  position:relative; font-family:'Baloo 2',sans-serif; font-weight:800; font-size:34px;
  color:var(--coral-dark); letter-spacing:.02em;
}

@media (min-width:480px){
  .freeze-text{ font-size:44px; }
}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; }
}
