html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", sans-serif;
}

/* ===== 大画面 ===== */
.stage-main {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  z-index: 1;
}

.stage-main > canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  display: block;
  object-fit: contain;
}

/* ===== 小画面 (PIP) ===== */
.stage-pip {
  position: fixed;
  top: 10px;
  left: 10px;
  width: 22vw;
  min-width: 110px;
  max-width: 320px;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 2px solid #fff;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  z-index: 100;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* 浏览器不支持 aspect-ratio 时的 fallback */
@supports not (aspect-ratio: 16 / 9) {
  .stage-pip { height: calc(22vw * 9 / 16); min-height: 62px; max-height: 180px; }
}

/* 手机竖屏: 小窗占屏宽 30%, 切换按钮挪到底部居中 */
@media (max-width: 600px) {
  .stage-pip {
    width: 30vw;
    min-width: 110px;
    max-width: 200px;
  }
  @supports not (aspect-ratio: 16 / 9) {
    .stage-pip { height: calc(30vw * 9 / 16); }
  }
  #swap-btn {
    right: 50%;
    transform: translateX(50%);
    bottom: 16px;
    padding: 12px 28px;
    font-size: 15px;
  }
  #swap-btn:active { transform: translateX(50%) scale(0.95); }
}

.stage-pip > canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  display: block;
  object-fit: contain;
  pointer-events: none; /* canvas 不拦截鼠标, 让 stage-pip 接管点击/拖拽 */
}

.stage-pip.dragging {
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.6);
  border-color: #3b82f6;
}

#loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 18px;
  letter-spacing: 1px;
  pointer-events: none;
  z-index: 50;
}

/* ===== 切换按钮 ===== */
#swap-btn {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 200;
  padding: 10px 16px;
  font-size: 14px;
  color: #fff;
  background: rgba(59, 130, 246, 0.85);
  border: none;
  border-radius: 24px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  letter-spacing: 2px;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

#swap-btn:hover { background: #2563eb; }
#swap-btn:active { transform: scale(0.95); }

/* ===== 密码遮罩 ===== */
#pwd-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwd-box {
  width: 320px;
  padding: 28px 24px;
  background: #1f2937;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.pwd-title {
  color: #fff;
  font-size: 18px;
  margin-bottom: 18px;
  letter-spacing: 2px;
}

#pwd-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  background: #111827;
  color: #fff;
  border: 1px solid #374151;
  border-radius: 6px;
  outline: none;
  box-sizing: border-box;
  letter-spacing: 4px;
  text-align: center;
}

#pwd-input:focus {
  border-color: #3b82f6;
}

.pwd-msg {
  min-height: 20px;
  margin: 10px 0 14px;
  font-size: 13px;
  color: #f87171;
}

#pwd-btn {
  width: 100%;
  padding: 10px;
  font-size: 15px;
  color: #fff;
  background: #3b82f6;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 4px;
}

#pwd-btn:hover { background: #2563eb; }
#pwd-btn:disabled { background: #6b7280; cursor: not-allowed; }

/* ===== Admin 改密码页 ===== */
.admin-body {
  background: #f5f7fa;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-card {
  width: 360px;
  padding: 28px 28px 24px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.admin-title {
  font-size: 18px;
  color: #1e293b;
  margin-bottom: 20px;
  text-align: center;
  font-weight: 600;
}

.admin-row {
  margin-bottom: 14px;
}

.admin-row label {
  display: block;
  font-size: 13px;
  color: #64748b;
  margin-bottom: 6px;
}

.admin-row input {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  outline: none;
  box-sizing: border-box;
}

.admin-row input:focus {
  border-color: #3b82f6;
}

.admin-msg {
  min-height: 20px;
  margin: 8px 0 14px;
  font-size: 13px;
  text-align: center;
  color: #64748b;
}

#admin-btn {
  width: 100%;
  padding: 10px;
  font-size: 14px;
  color: #fff;
  background: #3b82f6;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 2px;
}

#admin-btn:hover { background: #2563eb; }
#admin-btn:disabled { background: #94a3b8; cursor: not-allowed; }
