:root{
  --bg:#08080a;
  --panel:#121216;
  --panel-2:#17171c;
  --line:#26262e;
  --ink:#f2f2f5;
  --ink-2:#a1a1ac;
  --ink-3:#6b6b78;
  --accent:#5eead4;
  --green:#22c55e;
  --red:#ef4444;
  --amber:#f59e0b;
  --mono:'SFMono-Regular',Consolas,'Liberation Mono',Menlo,monospace;
  --sans:-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif;
}

*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  background:var(--bg);
  color:var(--ink);
  font-family:var(--sans);
  overflow:hidden;
  -webkit-font-smoothing:antialiased;
}

/* ---------------- 舞台 ---------------- */
#stage{position:fixed;inset:0;background:#000}
.layer,#videoLayer{
  position:absolute;inset:0;
  opacity:0;
  transition:opacity .45s ease;
  will-change:opacity;
}
.layer.visible,#videoLayer.visible{opacity:1}
.layer img{
  width:100%;height:100%;
  object-fit:contain;
  display:block;
  user-select:none;
}
#videoLayer{
  width:100%;height:100%;
  object-fit:contain;
  background:#000;
}

/* ---------------- HUD ---------------- */
#hud{
  position:fixed;inset:0;
  display:flex;flex-direction:column;justify-content:space-between;
  pointer-events:none;
  transition:opacity .3s ease;
}
#hud.hidden{opacity:0}

.hud-top{
  display:flex;align-items:center;gap:10px;
  padding:20px 24px 44px;
  background:linear-gradient(to bottom,rgba(0,0,0,.62),rgba(0,0,0,0));
}
.hud-bottom{
  padding:44px 24px 20px;
  background:linear-gradient(to top,rgba(0,0,0,.62),rgba(0,0,0,0));
}
.spacer{flex:1}

.brand{
  font-family:var(--mono);
  font-size:19px;
  font-weight:600;
  letter-spacing:.06em;
  display:flex;align-items:center;gap:9px;
  text-shadow:0 1px 8px rgba(0,0,0,.6);
}
.brand .pulse{
  width:7px;height:7px;border-radius:50%;
  background:var(--accent);
  box-shadow:0 0 0 0 rgba(94,234,212,.6);
  animation:pulse 2.4s infinite;
}
@keyframes pulse{
  0%{box-shadow:0 0 0 0 rgba(94,234,212,.55)}
  70%{box-shadow:0 0 0 9px rgba(94,234,212,0)}
  100%{box-shadow:0 0 0 0 rgba(94,234,212,0)}
}

.badge{
  font-family:var(--mono);
  font-size:11.5px;
  letter-spacing:.02em;
  padding:5px 11px;
  border-radius:99px;
  background:rgba(255,255,255,.09);
  border:1px solid rgba(255,255,255,.14);
  color:rgba(255,255,255,.82);
  backdrop-filter:blur(10px);
  white-space:nowrap;
}
.badge.online{background:rgba(34,197,94,.16);border-color:rgba(34,197,94,.42);color:#86efac}
.badge.offline{background:rgba(239,68,68,.18);border-color:rgba(239,68,68,.48);color:#fca5a5}
.badge.pending{background:rgba(245,158,11,.15);border-color:rgba(245,158,11,.4);color:#fcd34d}
.badge.ok{background:rgba(94,234,212,.14);border-color:rgba(94,234,212,.38);color:#99f6e4}
.badge.bad{background:rgba(239,68,68,.18);border-color:rgba(239,68,68,.45);color:#fca5a5}

.meta-row{
  display:flex;align-items:center;gap:8px;
  font-family:var(--mono);
  font-size:12px;
  color:rgba(255,255,255,.72);
  margin-bottom:10px;
}
.meta-row .sep{opacity:.4}
.meta-row .hint{opacity:.42;font-size:11px}

.progress{
  height:2px;
  background:rgba(255,255,255,.16);
  border-radius:99px;
  overflow:hidden;
}
#bar{
  height:100%;width:0%;
  background:var(--accent);
  border-radius:99px;
}

/* ---------------- 面板按钮 ---------------- */
#panelToggle{
  position:fixed;right:22px;bottom:56px;
  width:44px;height:44px;
  border-radius:50%;
  border:1px solid rgba(255,255,255,.16);
  background:rgba(20,20,24,.72);
  backdrop-filter:blur(12px);
  color:rgba(255,255,255,.8);
  display:grid;place-items:center;
  cursor:pointer;
  transition:transform .18s ease,background .18s ease,border-color .18s ease,opacity .25s ease;
  z-index:40;
}
#panelToggle:hover{background:rgba(30,30,36,.9);border-color:rgba(255,255,255,.28);transform:translateY(-1px)}
#panelToggle.active{background:rgba(94,234,212,.16);border-color:rgba(94,234,212,.45);color:#99f6e4}
#panelToggle.hidden{opacity:0;pointer-events:none}

/* ---------------- 侧边面板 ---------------- */
#panel{
  position:fixed;top:0;right:0;bottom:0;
  width:340px;
  background:var(--panel);
  border-left:1px solid var(--line);
  transform:translateX(100%);
  transition:transform .28s cubic-bezier(.4,0,.2,1);
  z-index:50;
  display:flex;flex-direction:column;
  padding:22px 20px;
  overflow-y:auto;
}
#panel.open{transform:translateX(0)}
#panel header{margin-bottom:18px}
#panel .title{font-size:15px;font-weight:600;letter-spacing:.01em}
#panel .sub{font-size:11.5px;color:var(--ink-3);font-family:var(--mono);margin-top:3px}

.sw-row{
  display:flex;align-items:center;justify-content:space-between;
  padding:11px 13px;
  background:var(--panel-2);
  border:1px solid var(--line);
  border-radius:9px;
  margin-bottom:18px;
}
.sw-row .label{font-size:12px;color:var(--ink-2);font-family:var(--mono)}

.section{margin-bottom:18px}
.section-head{
  display:flex;align-items:baseline;justify-content:space-between;
  font-size:12px;color:var(--ink-2);
  margin-bottom:9px;
}
.dim{color:var(--ink-3);font-size:11px;font-family:var(--mono)}

.cache-list{list-style:none;display:flex;flex-direction:column;gap:5px}
.cache-list .row{
  display:flex;align-items:center;gap:9px;
  padding:8px 11px;
  background:var(--panel-2);
  border:1px solid var(--line);
  border-radius:8px;
  font-size:12px;
}
.cache-list .name{font-family:var(--mono);color:var(--ink);flex:1}
.cache-list .sz{font-family:var(--mono);color:var(--ink-3);font-size:11px}
.tag{
  font-size:9.5px;
  padding:2px 6px;
  border-radius:4px;
  font-family:var(--mono);
  letter-spacing:.02em;
  white-space:nowrap;
}
.tag.hit{background:rgba(94,234,212,.14);color:#99f6e4}
.tag.new{background:rgba(34,197,94,.14);color:#86efac}
.tag.pending{background:rgba(255,255,255,.07);color:var(--ink-3)}
.tag.error{background:rgba(239,68,68,.16);color:#fca5a5}

.quota{
  margin-top:9px;
  font-size:11px;
  font-family:var(--mono);
  color:var(--ink-3);
}

.actions{display:flex;gap:8px;margin-bottom:20px}
.btn{
  flex:1;
  padding:10px 14px;
  border-radius:8px;
  font-size:12.5px;
  font-family:var(--sans);
  cursor:pointer;
  border:1px solid transparent;
  transition:background .16s ease,border-color .16s ease;
}
.btn.primary{background:rgba(94,234,212,.15);color:#99f6e4;border-color:rgba(94,234,212,.32)}
.btn.primary:hover{background:rgba(94,234,212,.22)}
.btn.ghost{background:transparent;color:var(--ink-2);border-color:var(--line)}
.btn.ghost:hover{background:var(--panel-2);border-color:#33333d}

.tips{
  border-top:1px solid var(--line);
  padding-top:16px;
  font-size:11.5px;
  color:var(--ink-2);
  line-height:1.7;
}
.tips p{margin-bottom:6px}
.tips b{color:var(--ink);font-weight:600}
.tips ol{margin:0 0 10px 16px}
.tips li{margin-bottom:3px}
.tips .dim{line-height:1.6;margin-top:8px}

/* ---------------- Toast ---------------- */
.toast{
  position:fixed;
  left:50%;bottom:34px;
  transform:translate(-50%,14px);
  padding:10px 18px;
  border-radius:99px;
  background:rgba(20,20,24,.94);
  border:1px solid rgba(255,255,255,.13);
  backdrop-filter:blur(12px);
  font-size:12.5px;
  color:rgba(255,255,255,.9);
  opacity:0;
  pointer-events:none;
  transition:opacity .22s ease,transform .22s ease;
  z-index:60;
  white-space:nowrap;
}
.toast.show{opacity:1;transform:translate(-50%,0)}
.toast.ok{border-color:rgba(94,234,212,.4);color:#99f6e4}
.toast.warn{border-color:rgba(245,158,11,.42);color:#fcd34d}
.toast.bad{border-color:rgba(239,68,68,.45);color:#fca5a5}

/* 离线时给舞台一圈细红边，肉眼可辨 */
body.is-offline #stage{box-shadow:inset 0 0 0 2px rgba(239,68,68,.35)}

@media(max-width:720px){
  #panel{width:100%}
  .hud-top{padding:16px 16px 38px}
  .hud-bottom{padding:38px 16px 16px}
  .meta-row .hint{display:none}
}
