:root {
  --bg: #05070d;
  --panel: rgba(10, 16, 28, 0.62);
  --panel-solid: rgba(9, 14, 25, 0.9);
  --stroke: rgba(90, 170, 255, 0.22);
  --stroke-strong: rgba(90, 190, 255, 0.55);
  --text: #e9f2ff;
  --muted: #9fb2cf;
  --blue: #2f81ff;
  --blue-2: #1a5cff;
  --cyan: #00e5ff;
  --danger: #ff4d5e;
  --ok: #23d18b;
  --glow: 0 0 22px rgba(47, 129, 255, 0.45);
  --radius: 14px;
  --font-cn: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Hiragino Sans GB", system-ui, sans-serif;
  --font-tech: "Orbitron", var(--font-cn);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  color: var(--text);
  font-family: var(--font-cn);
  overflow: hidden;
}
/* 深色兜底放在 html（位于背景视频之下）；body 透明，否则会盖住 z-index:-2 的视频 */
html { background: var(--bg); }
body { background: transparent; }

/* -------- 背景视频 -------- */
.bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
  background: #000;
}
.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 20% 30%, rgba(20, 60, 130, 0.35), transparent 60%),
    linear-gradient(90deg, rgba(3, 6, 14, 0.72) 0%, rgba(3, 6, 14, 0.28) 46%, rgba(3, 6, 14, 0.12) 100%),
    linear-gradient(0deg, rgba(3, 6, 14, 0.55), rgba(3, 6, 14, 0.15));
}

/* -------- 进入遮罩 -------- */
.mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 5, 12, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.mask.hide { opacity: 0; visibility: hidden; }
.mask-inner { text-align: center; padding: 24px; animation: floatIn 0.7s ease both; }
.mask-badge {
  font-family: var(--font-tech);
  letter-spacing: 0.34em;
  font-size: 12px;
  color: var(--cyan);
  opacity: 0.85;
  margin-bottom: 18px;
}
.mask-title {
  font-size: clamp(24px, 4vw, 42px);
  margin: 0 0 14px;
  text-shadow: 0 0 30px rgba(0, 200, 255, 0.4);
  letter-spacing: 2px;
}
.mask-tip { color: var(--muted); font-size: 15px; line-height: 1.9; margin: 0 0 30px; }
.mask-cta { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 16px; }
.mask-ring {
  width: 62px; height: 62px; border-radius: 50%;
  border: 2px solid var(--cyan);
  position: relative;
  animation: pulse 1.8s ease-out infinite;
}
.mask-ring::after {
  content: "";
  position: absolute; inset: 20px 0 0 22px;
  width: 0; height: 0;
  border-left: 16px solid var(--cyan);
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
}
.mask-cta-text { font-size: 13px; letter-spacing: 3px; color: var(--muted); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.5); }
  70% { box-shadow: 0 0 0 22px rgba(0, 229, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0); }
}
@keyframes floatIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* -------- 左侧面板 -------- */
.panel {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 400px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px 12px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--stroke);
  box-shadow: 4px 0 40px rgba(0, 0, 0, 0.45);
  overflow-y: auto;
  overflow-x: hidden;
}
.panel::-webkit-scrollbar { width: 8px; }
.panel::-webkit-scrollbar-thumb { background: rgba(90, 170, 255, 0.3); border-radius: 8px; }

.panel-head { display: flex; align-items: center; gap: 12px; animation: floatIn 0.5s ease both; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--stroke-strong);
  box-shadow: var(--glow);
}
.brand { font-family: var(--font-tech); font-size: 20px; margin: 0; letter-spacing: 1px; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 1px; }

.block {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 10px 12px;
  animation: floatIn 0.6s ease both;
}
.block.wechat { animation-delay: 0.05s; }
.block.actions { animation-delay: 0.1s; }
.block.audio-row { animation-delay: 0.15s; }
.block.resources { animation-delay: 0.2s; flex: 1 1 auto; min-height: 180px; display: flex; flex-direction: column; }

/* 微信二维码 */
.wechat { text-align: center; }
.qr-box {
  width: 118px; height: 118px; margin: 0 auto 7px;
  border-radius: 12px; overflow: hidden;
  border: 1px solid var(--stroke-strong);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow);
}
.qr-box img { width: 100%; height: 100%; object-fit: cover; }
.qr-fallback { color: #333; font-size: 13px; }
.qr-tip { font-size: 12px; color: var(--muted); margin: 0; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer;
  color: #fff; font-size: 13px; font-weight: 600;
  padding: 9px 14px; border-radius: 12px;
  font-family: var(--font-cn);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn-ico { font-size: 15px; }
.btn-primary {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-2) 100%);
  box-shadow: 0 6px 18px rgba(26, 92, 255, 0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(47, 129, 255, 0.55), var(--glow); }
.btn-primary:active { transform: translateY(0); }
.btn-block { width: 100%; }
.actions { display: flex; flex-direction: column; gap: 8px; }
.play-hint { margin: 1px 0 0; font-size: 11px; color: var(--cyan); text-align: center; letter-spacing: 0.5px; }

/* 音频按钮 A / B */
.audio-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.audio-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 8px; cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  color: var(--text);
  transition: all 0.2s ease;
}
.audio-btn .a-ico { font-size: 17px; }
.audio-btn .a-label { font-size: 13px; font-weight: 600; }
.audio-btn .a-state { font-size: 11px; color: var(--muted); }
.audio-btn:hover { border-color: var(--stroke-strong); transform: translateY(-1px); }
.audio-btn.on {
  border-color: var(--cyan);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.35) inset, 0 0 14px rgba(0, 229, 255, 0.25);
  background: rgba(0, 229, 255, 0.08);
}
.audio-btn.on .a-state { color: var(--cyan); }

/* 资源列表 */
.res-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.res-head h2 { font-size: 15px; margin: 0; letter-spacing: 1px; }
.res-head-right { display: flex; align-items: center; gap: 8px; }
.res-count {
  font-family: var(--font-tech); font-size: 12px; color: var(--cyan);
  border: 1px solid var(--stroke); border-radius: 20px; padding: 2px 9px;
}
.admin-entry {
  cursor: pointer; font-size: 12px; color: var(--text);
  background: transparent; border: 1px solid var(--stroke-strong);
  border-radius: 20px; padding: 4px 12px; transition: all 0.2s ease;
}
.admin-entry:hover { background: rgba(47, 129, 255, 0.18); box-shadow: var(--glow); }

/* 资源搜索框 */
.res-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}
.res-search-ico {
  position: absolute;
  left: 10px;
  font-size: 13px;
  opacity: 0.7;
  pointer-events: none;
}
.res-search input {
  width: 100%;
  padding: 8px 30px 8px 30px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-cn);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.res-search input::placeholder { color: rgba(159, 178, 207, 0.65); }
.res-search input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15);
}
.res-search-clear {
  position: absolute;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  line-height: 1;
  transition: color 0.15s ease, background 0.15s ease;
}
.res-search-clear:hover { color: #fff; background: rgba(255, 77, 94, 0.55); }

.res-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px;
  overflow-y: auto; padding-right: 4px; flex: 1 1 auto;
}
.res-grid::-webkit-scrollbar { width: 6px; }
.res-grid::-webkit-scrollbar-thumb { background: rgba(90, 170, 255, 0.3); border-radius: 6px; }
.res-loading { grid-column: 1 / -1; color: var(--muted); font-size: 13px; padding: 12px 0; text-align: center; }

.res-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; line-height: 1.5;
  padding: 6px 8px; border-radius: 8px;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.res-item:hover { background: rgba(47, 129, 255, 0.1); border-color: var(--stroke); }
.res-name {
  color: var(--text); font-weight: 600;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.res-bar { color: rgba(159, 178, 207, 0.5); }
.res-links { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.res-links a { color: var(--cyan); text-decoration: none; white-space: nowrap; position: relative; }
.res-links a.lz { color: #7db8ff; }
.res-links a.fj { color: #57e0c6; }
.res-links a.ot { color: #ffd166; }
.res-links a:hover { text-shadow: 0 0 10px currentColor; }
.res-links .sep { color: rgba(159, 178, 207, 0.4); font-style: normal; }

/* 页脚 */
.panel-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 11px; color: var(--muted); padding-top: 4px;
}
.mode-tag {
  padding: 2px 8px; border-radius: 20px; font-size: 10px;
  border: 1px solid var(--stroke); color: var(--muted);
}
.mode-tag.cloud { color: var(--ok); border-color: rgba(35, 209, 139, 0.5); }
.panel-foot .beian {
  color: var(--muted); text-decoration: none; font-size: 11px;
  transition: color 0.2s ease;
}
.panel-foot .beian:hover { color: var(--cyan); }

/* -------- 右下角全局音乐总控 -------- */
.global-music {
  position: fixed; right: 22px; bottom: 22px; z-index: 40;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 18px; cursor: pointer;
  border-radius: 40px; border: 1px solid var(--stroke-strong);
  background: rgba(10, 16, 28, 0.7);
  backdrop-filter: blur(12px);
  color: var(--text); font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5), var(--glow);
  transition: all 0.2s ease;
}
.global-music:hover { transform: translateY(-2px); border-color: var(--cyan); }
.global-music .gm-icon { font-size: 15px; color: var(--cyan); }
.global-music.paused { border-color: rgba(159, 178, 207, 0.4); }
.global-music.paused .gm-icon { color: var(--muted); }

/* -------- 弹窗 -------- */
.modal {
  position: fixed; inset: 0; z-index: 80;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal.open { display: flex; }
.modal-mask { position: absolute; inset: 0; background: rgba(3, 5, 12, 0.7); backdrop-filter: blur(4px); }
.modal-card {
  position: relative; z-index: 1;
  width: 100%; background: var(--panel-solid);
  border: 1px solid var(--stroke-strong);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 40px rgba(47, 129, 255, 0.15);
  animation: floatIn 0.3s ease both;
}
.modal-login { max-width: 380px; }
.modal-admin { max-width: 720px; max-height: 86vh; overflow-y: auto; }
.modal-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--stroke);
  position: sticky; top: 0; background: var(--panel-solid); z-index: 2; border-radius: 18px 18px 0 0;
}
.modal-top h3 { margin: 0; font-size: 17px; letter-spacing: 1px; }
.modal-top-right { display: flex; align-items: center; gap: 10px; }
.modal-x {
  background: transparent; border: none; color: var(--muted);
  font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: 8px;
}
.modal-x:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.modal-body { padding: 20px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: var(--muted); }
.field input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
  border-radius: 10px; padding: 11px 12px;
  color: var(--text); font-size: 14px; font-family: var(--font-cn);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15); }
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 0 0 8px; }

.btn-ghost {
  cursor: pointer; background: transparent; color: var(--text);
  border: 1px solid var(--stroke-strong); border-radius: 10px;
  padding: 9px 14px; font-size: 13px; font-family: var(--font-cn);
  transition: all 0.2s ease;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }
.btn-danger {
  cursor: pointer; color: #fff; border: none; border-radius: 10px;
  padding: 8px 14px; font-size: 13px; font-family: var(--font-cn);
  background: linear-gradient(135deg, #ff5d6c, #e02f42);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(224, 47, 66, 0.4); }

/* 后台 */
.admin-body { display: flex; flex-direction: column; gap: 18px; }
.admin-form {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke); border-radius: 14px; padding: 16px;
}
.form-title { font-size: 14px; font-weight: 700; color: var(--cyan); margin-bottom: 14px; letter-spacing: 1px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.field-wide { grid-column: 1 / -1; }
.form-tip { font-size: 12px; color: var(--muted); margin: 0 0 12px; }
.form-actions { display: flex; gap: 10px; }

.admin-list-head { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.admin-list-body { display: flex; flex-direction: column; gap: 8px; max-height: 40vh; overflow-y: auto; }
.admin-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--stroke); background: rgba(255, 255, 255, 0.02);
}
.ai-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ai-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-meta { font-size: 11.5px; color: var(--muted); }
.ai-ops { display: flex; gap: 8px; flex-shrink: 0; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 40px;
  transform: translate(-50%, 20px);
  z-index: 120; opacity: 0; pointer-events: none;
  padding: 12px 20px; border-radius: 12px; font-size: 14px;
  background: rgba(10, 16, 28, 0.94); color: #fff;
  border: 1px solid var(--stroke-strong);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-ok { border-color: rgba(35, 209, 139, 0.6); }
.toast-err { border-color: rgba(255, 77, 94, 0.6); }

/* -------- 响应式：平板 -------- */
@media (max-width: 1024px) {
  .panel { width: 340px; }
  .qr-box { width: 108px; height: 108px; }
}

/* -------- 响应式：手机 -------- */
@media (max-width: 768px) {
  html, body { overflow-y: auto; }
  .panel {
    position: relative;
    width: 100%;
    height: auto;
    min-height: 100vh;
    border-right: none;
    border-bottom: 1px solid var(--stroke);
    background: rgba(6, 10, 20, 0.82);
  }
  .res-grid { grid-template-columns: 1fr 1fr; }
  .global-music { right: 14px; bottom: 14px; padding: 10px 14px; font-size: 13px; }
  .form-grid { grid-template-columns: 1fr; }
  .mask-title { font-size: 26px; }
}

@media (max-width: 480px) {
  .res-grid { grid-template-columns: 1fr; }
  .global-music .gm-text { display: none; }
  .global-music { padding: 12px; border-radius: 50%; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
