:root{
  --bg:#03060f;
  --fg:#d8ecff;
  --muted:#4a6c82;
  --accent:#57f7c7;
  --accent-alt:#64a3ff;
  --panel:rgba(8,14,26,.84);
  --panel-border:rgba(120,200,255,.25);
  --overlay:rgba(8,14,24,.92);
}
*{box-sizing:border-box}
html,body,#app{height:100%}
body{
  margin:0;
  font:15px/1.5 "Fira Code","SFMono-Regular",Menlo,monospace;
  letter-spacing:.05em;
  color:var(--fg);
  background:radial-gradient(1200px 900px at 70% 8%,rgba(70,160,255,.25),transparent 65%),radial-gradient(900px 900px at 12% 88%,rgba(87,247,199,.18),transparent 60%),#03060f;
  overscroll-behavior:none;
}
#stage{position:fixed;inset:0;overflow:hidden;z-index:0}
#art{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;filter:brightness(.32) saturate(.85) blur(1.5px);transform:scale(1.06)}
#vis{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;mix-blend-mode:screen}
#hud{
  position:fixed;
  top:32px;
  left:32px;
  display:flex;
  align-items:flex-start;
  gap:18px;
  z-index:4;
}
.overlay-card{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:18px 22px;
  background:var(--panel);
  border:1px solid var(--panel-border);
  border-radius:20px;
  box-shadow:0 24px 48px rgba(0,0,0,.45);
  min-width:260px;
}
.overlay-card .line{display:flex;align-items:baseline;gap:14px;white-space:nowrap}
.overlay-card .line.state-line{align-items:center;justify-content:flex-end}
#titleBox{
  display:inline-block;
  position:relative;
  overflow:hidden;
  max-width:min(40vw,340px);
  height:1.6em;
  vertical-align:middle;
}
#title{
  display:inline-block;
  white-space:nowrap;
  color:var(--accent-alt);
  font-size:22px;
  letter-spacing:.12em;
  text-transform:uppercase;
  transform:translateX(0);
  will-change:transform;
}
#title.scrolling{
  animation:title-scroll var(--scroll-duration,12s) linear infinite;
}
@keyframes title-scroll{
  0%,10%{transform:translateX(0)}
  90%,100%{transform:translateX(calc(-1 * var(--scroll-distance,0px)))}
}
#status{
  display:inline-flex;
  justify-content:flex-end;
  align-items:center;
  flex:1;
  min-width:0;
  padding:3px 12px;
  border-radius:999px;
  background:rgba(87,247,199,.12);
  color:var(--accent);
  letter-spacing:.16em;
  text-transform:uppercase;
  font-size:10px;
  opacity:.62;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
#status.status-positive{
  background:rgba(87,247,199,.24);
  color:#5fffd0;
}
#status.status-negative{
  background:rgba(255,96,120,.2);
  color:#ff8095;
}
#status.scrolling{animation:status-scroll var(--state-scroll-duration,14s) linear infinite}
@keyframes status-scroll{
  0%,12%{transform:translateX(0)}
  88%,100%{transform:translateX(calc(-1 * var(--state-scroll-distance,0px)))}
}
#playlistToggle{
  align-self:stretch;
  padding:14px 20px;
  border-radius:18px;
  border:1px solid var(--accent);
  background:transparent;
  color:var(--accent);
  text-transform:uppercase;
  letter-spacing:.25em;
  font-weight:600;
  cursor:pointer;
  transition:background .2s ease,color .2s ease,transform .2s ease;
}
#playlistToggle:hover{background:rgba(87,247,199,.18);color:var(--fg);transform:translateY(-2px)}
#metricsToggle{
  align-self:stretch;
  padding:12px 18px;
  border-radius:18px;
  border:1px solid rgba(120,200,255,.45);
  background:rgba(8,16,26,.45);
  color:rgba(120,200,255,.85);
  text-transform:uppercase;
  letter-spacing:.2em;
  font-weight:600;
  cursor:pointer;
  transition:background .2s ease,color .2s ease,transform .2s ease;
}
#metricsToggle:hover{background:rgba(73,120,220,.22);color:var(--fg);transform:translateY(-2px)}
#metricsToggle.on{box-shadow:0 0 18px rgba(100,160,255,.35);border-color:rgba(120,200,255,.9);color:var(--fg)}
#controlBar{
  position:fixed;
  left:0;
  right:0;
  bottom:0;
  padding:22px 44px 28px;
  background:linear-gradient(0deg,rgba(6,12,20,.92) 0%,rgba(6,12,20,.65) 60%,transparent 100%);
  backdrop-filter:blur(14px);
  border-top:1px solid rgba(120,200,255,.18);
  display:flex;
  flex-direction:column;
  gap:18px;
  z-index:4;
}
#controlBar .row{display:flex;align-items:center;gap:18px}
.transport-row{justify-content:center}
.transport-row button{min-width:74px}
.transport-row .primary{min-width:92px}
.transport-row .toggles{display:flex;gap:12px}
.transport-row #volwrap{display:flex;align-items:center;gap:12px;padding:10px 16px;background:rgba(10,18,30,.75);border-radius:16px;border:1px solid rgba(120,200,255,.2)}
#controlBar button{
  appearance:none;
  border:none;
  background:rgba(10,22,36,.7);
  color:var(--fg);
  padding:12px 16px;
  border-radius:16px;
  cursor:pointer;
  font-weight:600;
  letter-spacing:.14em;
  text-transform:uppercase;
  transition:background .15s ease,transform .15s ease,box-shadow .2s ease;
  box-shadow:0 12px 24px rgba(0,0,0,.38);
}
#controlBar button:hover{background:rgba(48,84,128,.65);transform:translateY(-1px)}
#controlBar button.on{outline:2px solid var(--accent);box-shadow:0 0 18px rgba(87,247,199,.3)}
#controlBar button.primary{
  font-size:22px;
  padding:14px 28px;
  background:linear-gradient(120deg,var(--accent),var(--accent-alt));
  color:#021018;
  box-shadow:0 20px 40px rgba(24,180,255,.35);
}
#controlBar button.primary:hover{background:linear-gradient(120deg,var(--accent-alt),var(--accent))}
#volwrap button{min-width:auto;padding:10px 14px}
#volume{
  width:140px;
  appearance:none;
  height:6px;
  border-radius:999px;
  background:rgba(120,200,255,.24);
  outline:none;
}
#volume::-webkit-slider-thumb{
  appearance:none;
  width:16px;
  height:16px;
  border-radius:50%;
  background:var(--fg);
  box-shadow:0 0 0 4px rgba(120,200,255,.25);
}
#volume::-moz-range-thumb{
  width:16px;
  height:16px;
  border-radius:50%;
  background:var(--fg);
  border:none;
  box-shadow:0 0 0 4px rgba(120,200,255,.25);
}
.time-row{
  justify-content:center;
  gap:14px;
  padding:10px 14px;
  background:rgba(8,18,30,.78);
  border-radius:18px;
  border:1px solid rgba(120,200,255,.18);
}
#elapsed,#remaining{
  font-variant-numeric:tabular-nums;
  color:var(--muted);
  width:62px;
  text-align:center;
}
#seek{
  flex:1;
  max-width:680px;
  appearance:none;
  height:6px;
  border-radius:999px;
  background:rgba(120,200,255,.22);
  outline:none;
}
#seek::-webkit-slider-thumb{
  appearance:none;
  width:18px;
  height:18px;
  border-radius:50%;
  background:var(--accent);
  box-shadow:0 0 0 4px rgba(87,247,199,.25);
}
#seek::-moz-range-thumb{
  width:18px;
  height:18px;
  border-radius:50%;
  background:var(--accent);
  border:none;
  box-shadow:0 0 0 4px rgba(87,247,199,.25);
}
#playlist{
  position:fixed;
  top:50%;
  left:50%;
  transform:translate(-50%,-46%) scale(.95);
  width:min(960px,calc(100vw - 120px));
  height:min(88vh,calc(100vh - 96px));
  display:flex;
  flex-direction:column;
  padding:40px 44px;
  gap:26px;
  background:linear-gradient(145deg,rgba(8,16,28,.94),rgba(6,12,22,.88));
  border:1px solid rgba(120,200,255,.24);
  border-radius:28px;
  backdrop-filter:blur(22px);
  box-shadow:0 50px 90px rgba(0,0,0,.55);
  opacity:0;
  pointer-events:none;
  z-index:6;
  transition:opacity .3s ease,transform .35s cubic-bezier(.19,1,.22,1);
}
#playlist[data-open="true"]{
  transform:translate(-50%,-50%) scale(1);
  opacity:1;
  pointer-events:auto;
}
.playlist-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  text-transform:uppercase;
  letter-spacing:.3em;
  color:var(--muted);
  font-size:11px;
}
.playlist-header h2{margin:0;font-size:11px;letter-spacing:.35em}
.playlist-header button{
  appearance:none;
  border:none;
  background:transparent;
  color:var(--muted);
  font-size:18px;
  padding:6px;
  border-radius:12px;
  cursor:pointer;
  transition:color .2s ease,background .2s ease;
}
.playlist-header button:hover{color:var(--fg);background:rgba(120,200,255,.18)}
#list{
  flex:1;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:10px;
  padding-right:4px;
  padding-bottom:32px;
}
#list::-webkit-scrollbar{width:8px}
#list::-webkit-scrollbar-thumb{background:rgba(120,200,255,.25);border-radius:8px}
#list .item{
  display:flex;
  align-items:stretch;
  gap:0;
  padding:0;
  background:rgba(12,22,34,.55);
  border:1px dashed rgba(120,200,255,.28);
  border-radius:16px;
  color:var(--fg);
  transition:background .2s ease,border-color .2s ease,transform .15s ease;
}
#list .item:hover{background:rgba(22,40,66,.75);transform:translateY(-2px)}
#list .item.active{border-color:var(--accent);background:rgba(87,247,199,.16)}
#list .info-button{
  flex:0 0 80%;
  display:grid;
  grid-template-rows:1fr 1fr;
  align-content:stretch;
  gap:12px;
  padding:24px 26px;
  background:transparent;
  border:none;
  color:inherit;
  text-align:left;
  cursor:pointer;
  border-radius:16px 0 0 16px;
}
#list .info-button:focus-visible{outline:1px solid var(--accent)}
#list .info-button .title{
  font-size:16px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.12em;
  overflow:hidden;
  word-break:break-word;
  white-space:normal;
  line-height:1.4;
}
#list .info-button .meta{
  font-size:11px;
  letter-spacing:.22em;
  color:var(--muted);
  text-transform:uppercase;
  align-self:flex-end;
}
#list .download{
  flex:0 0 20%;
  min-width:140px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  font-size:15px;
  color:#021018;
  background:linear-gradient(140deg,var(--accent),var(--accent-alt));
  border-radius:0 16px 16px 0;
  transition:transform .15s ease,box-shadow .2s ease,filter .2s ease;
}
#list .download .label{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  font-weight:700;
  letter-spacing:.14em;
  text-transform:uppercase;
}
#list .download .text{font-size:12px}
#list .download .glyph{
  font-size:20px;
}
#list .download:hover{
  transform:translateY(-2px);
  box-shadow:0 18px 32px rgba(24,180,255,.35);
  filter:brightness(1.05);
}
body::after{
  content:'';
  position:fixed;
  inset:0;
  background:rgba(4,8,16,.72);
  backdrop-filter:blur(6px);
  z-index:3;
  pointer-events:none;
  opacity:0;
  transition:opacity .3s ease;
}
body.playlist-open #playlistToggle{background:rgba(87,247,199,.18);color:var(--fg)}
body.playlist-open::after{opacity:1}
body.metrics-open{overflow:hidden}
body.metrics-open #metricsToggle{background:rgba(73,120,220,.25);color:var(--fg)}
body.metrics-open::after{opacity:1}

#metricsPanel{
  position:fixed;
  top:50%;
  left:50%;
  transform:translate(-50%,-46%) scale(.95);
  width:min(960px,calc(100vw - 120px));
  height:min(88vh,calc(100vh - 96px));
  padding:40px 44px;
  background:linear-gradient(155deg,rgba(8,18,34,.94),rgba(6,10,20,.88));
  border:1px solid rgba(120,200,255,.28);
  border-radius:28px;
  box-shadow:0 50px 90px rgba(0,0,0,.6);
  backdrop-filter:blur(24px);
  display:flex;
  flex-direction:column;
  gap:26px;
  opacity:0;
  pointer-events:none;
  transition:opacity .28s ease,transform .35s cubic-bezier(.19,1,.22,1);
  z-index:7;
}
#metricsPanel[aria-hidden="false"]{
  opacity:1;
  pointer-events:auto;
  transform:translate(-50%,-50%) scale(1);
}
#metricsPanel header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  text-transform:uppercase;
  letter-spacing:.35em;
  color:rgba(120,200,255,.86);
  font-size:12px;
}
#metricsPanel header span::after{
  content:'//';
  margin-left:8px;
  color:rgba(87,247,199,.8);
}
#metricsPanel header button{
  appearance:none;
  border:none;
  background:transparent;
  color:rgba(120,200,255,.7);
  font-size:18px;
  padding:6px 8px;
  border-radius:12px;
  cursor:pointer;
  transition:background .2s ease,color .2s ease;
}
#metricsPanel header button:hover{background:rgba(120,200,255,.18);color:var(--fg)}
#metricsPanel .grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:20px;
}
#metricsPanel article{
  background:rgba(12,20,36,.6);
  border:1px solid rgba(120,200,255,.2);
  padding:16px 18px;
  border-radius:18px;
  box-shadow:inset 0 0 22px rgba(10,16,28,.55);
}
#metricsPanel article h3{
  margin:0 0 14px;
  font-size:12px;
  letter-spacing:.3em;
  text-transform:uppercase;
  color:rgba(87,247,199,.78);
}
#metricsPanel article p{
  margin:6px 0;
  display:flex;
  justify-content:space-between;
  font-size:11px;
  letter-spacing:.18em;
  color:rgba(120,200,255,.86);
}
#metricsPanel article p .label{
  color:rgba(87,247,199,.66);
  text-transform:uppercase;
  padding-right:8px;
}
#metricsPanel article p span:last-child{
  font-variant-numeric:tabular-nums;
  color:rgba(216,236,255,.95);
}
.sparkline{
  display:block;
  width:100%;
  height:54px;
  margin-top:6px;
  border-radius:12px;
  background:rgba(8,14,24,.55);
  border:1px solid rgba(120,200,255,.18);
  box-shadow:inset 0 0 18px rgba(6,10,20,.7);
}
.metrics-footer{
  margin-top:auto;
  padding-top:12px;
  border-top:1px dashed rgba(120,200,255,.18);
  font-size:11px;
  letter-spacing:.16em;
  color:rgba(120,200,255,.7);
  text-transform:uppercase;
}
.metrics-footer a{
  color:rgba(87,247,199,.85);
  text-decoration:none;
  border-bottom:1px dotted rgba(87,247,199,.35);
}
.metrics-footer a:hover{
  color:#d8ecff;
  border-bottom-color:rgba(216,236,255,.6);
}

@media (max-width:980px){
  #hud{
    top:20px;
    left:20px;
    right:20px;
    justify-content:space-between;
  }
  .overlay-card{min-width:0;width:100%;padding:16px 18px;border-radius:18px}
  #titleBox{
    max-width:66vw;
    height:1.4em;
  }
  #title{font-size:20px}
  #status{font-size:11px}
  #playlistToggle{padding:12px 18px;font-size:12px}
  #metricsToggle{padding:10px 16px;font-size:11px}
  #playlist{
    width:calc(100vw - 48px);
    height:calc(100vh - 72px);
    transform:translate(-50%,-48%) scale(.95);
    padding:32px 28px 36px;
    border-radius:26px;
  }
  #playlist[data-open="true"]{transform:translate(-50%,-50%) scale(1)}
  body.playlist-open{overflow:hidden}
  #controlBar{
    padding:18px 18px 24px;
    gap:14px;
  }
  .transport-row{
    justify-content:center;
    gap:12px;
    flex-wrap:wrap;
  }
  .transport-row .toggles{
    display:flex;
    order:2;
    width:100%;
    justify-content:center;
    gap:12px;
  }
  .transport-row .toggles button{flex:1 0 130px}
  #controlBar #volwrap{
    order:2;
    width:100%;
    display:flex;
    justify-content:center;
    background:transparent;
    border:none;
    padding:6px 0 0;
    gap:12px;
  }
  #controlBar #volwrap button{display:none}
  #controlBar #volwrap input{
    width:100%;
    max-width:280px;
  }
  #controlBar button{flex:1;padding:14px;font-size:13px}
  .transport-row .toggles button{flex:0 0 140px}
  #controlBar button.primary{flex:0 0 auto;padding:16px 26px}
  .time-row{padding:10px 12px}
  #elapsed,#remaining{width:54px}
  #list{padding-bottom:calc(48px + env(safe-area-inset-bottom,0))}
  #list .info-button{
    padding:18px 16px;
    gap:10px;
    flex:1;
  }
  #list .info-button .title{font-size:14px;letter-spacing:.1em}
  #list .info-button .meta{font-size:9px;letter-spacing:.18em}
  #list .download{
    flex:0 0 40%;
    min-width:120px;
    font-size:13px;
    border-radius:18px;
    margin:10px;
  }
  #list .download .label{gap:5px;letter-spacing:.1em}
  #list .download .glyph{font-size:18px}
  #list .download .text{font-size:11px}
  #metricsPanel{
    width:calc(100vw - 48px);
    height:calc(100vh - 72px);
    transform:translate(-50%,-48%) scale(.95);
    padding:32px 28px 36px;
    border-radius:26px;
  }
  #metricsPanel[aria-hidden="false"]{transform:translate(-50%,-50%) scale(1)}
}
@media (max-width:560px){
  body{font-size:14px}
  #hud{gap:12px}
  .overlay-card{padding:14px 16px}
  #titleBox{max-width:74vw}
  #title{font-size:18px}
  #controlBar button{font-size:12px}
  #seek{max-width:none}
  #playlist{
    top:0;
    left:0;
    width:100vw;
    height:100vh;
    transform:translateY(24px) scale(.97);
    padding:24px 18px 32px;
    border-radius:0;
  }
  #playlist[data-open="true"]{transform:translateY(0) scale(1)}
  #list{padding-bottom:calc(64px + env(safe-area-inset-bottom,0))}
  #list .info-button{padding:16px 14px;gap:8px}
  #list .info-button .title{font-size:13px;letter-spacing:.08em}
  #list .info-button .meta{font-size:9px;letter-spacing:.16em}
  #list .download{
    flex:0 0 44%;
    min-width:110px;
    font-size:12px;
    margin:10px;
    padding:12px 10px;
  }
  #list .download .label{gap:4px}
  #list .download .glyph{font-size:16px}
  #list .download .text{font-size:10px}
  .transport-row .toggles button{flex:0 0 120px}
  #metricsPanel{
    top:0;
    left:0;
    width:100vw;
    height:100vh;
    transform:translateY(24px) scale(.97);
    padding:24px 18px 32px;
    border-radius:0;
  }
  #metricsPanel[aria-hidden="false"]{transform:translateY(0) scale(1)}
  #metricsPanel .grid{
    grid-template-columns:1fr;
    gap:12px;
  }
  #metricsPanel article{padding:10px 12px}
  #metricsPanel article h3{letter-spacing:.24em}
  #metricsPanel article p{font-size:10px;letter-spacing:.14em}
}
