/* =========================
   Base
========================= */
* {
  box-sizing: border-box;
}

:root {
  --bg: #f5f7fb;
  --bg-2: #eef3ff;
  --panel: #ffffff;
  --text: #101828;
  --sub: #667085;
  --line: #e6eaf2;

  --brand: #0a84ff;
  --brand-2: #5e5ce6;
  --ok: #16a34a;
  --warn: #f59e0b;
  --danger: #ef4444;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 4px 12px rgba(16, 24, 40, 0.08);
  --shadow-md: 0 10px 30px rgba(16, 24, 40, 0.12);

  --trans: all 0.2s ease;
}

html,
body {
  /* 核心修复：锁死高度，干掉幽灵滚动条 */
  height: 100vh;
  overflow: hidden; 
}

body {
  margin: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background:
    radial-gradient(1100px 520px at -8% -20%, rgba(10,132,255,.12), transparent 55%),
    radial-gradient(900px 450px at 110% -10%, rgba(94,92,230,.12), transparent 55%),
    var(--bg);
}

/* =========================
   Layout (升级为真正的专业仪表盘布局)
========================= */
.main-layout {
  max-width: 1520px;
  height: 100vh; /* 严格等于屏幕可视高度 */
  margin: 0 auto; 
  padding: 18px 14px 16px; /* 将外部边距转为内部边距，解决塌陷问题 */
  display: grid;
  grid-template-columns: minmax(260px, 380px) minmax(200px, 1fr);
  gap: 16px;
}

.control-panel,
.monitor-preview {
  background: rgba(255,255,255,.55);
  backdrop-filter: saturate(1.2) blur(20px);
  -webkit-backdrop-filter: saturate(1.2) blur(20px);
  border: 1px solid rgba(255,255,255,.45);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 16px;
  height: 100%; /* 撑满父容器 */
  min-height: 0;
  overflow-y: auto; /* 如果内部内容太多，让面板自己内部滚动 */
  scrollbar-width: none;
}

.control-panel::-webkit-scrollbar,
.monitor-preview::-webkit-scrollbar {
  display: none;
}

.control-panel h1,
.monitor-preview h2,
.timer-section h2,
.queue-section h2 {
  margin: 0;
}

.control-panel h1 {
  font-size: 22px;
  margin-bottom: 14px;
}

.monitor-preview {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

/* =========================
   Cards
========================= */
.form-section,
.queue-section,
.timer-section {
  background: rgba(255,255,255,.45);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.form-section:hover,
.queue-section:hover,
.timer-section:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* 设置面板展开/收起时，禁用父容器的 hover 位移，防止动画冲突 */
.queue-section:has(#queueSettingsPanel[style*="max-height"]):hover {
  transform: none;
}

.form-section label {
  display: block;
  margin: 8px 0;
  color: var(--sub);
  font-size: 13px;
  font-weight: 600;
}

/* =========================
   Buttons
========================= */
button {
  border: none;
  background: linear-gradient(180deg, #2b9cff 0%, #0a84ff 100%);
  color: #fff;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(10,132,255,.28);
  transition: transform .16s ease, box-shadow .2s ease, filter .2s ease;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(10,132,255,.35);
  filter: saturate(1.05);
}

button:active { transform: translateY(0) scale(.97); }
button:disabled { opacity: .55; cursor: not-allowed; }

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.select-btn {
  min-width: 68px;
  background: #f3f6ff;
  color: #244165;
  border: 1px solid #dbe7ff;
  box-shadow: none;
  font-weight: 700;
}

.select-btn:hover {
  background: #eaf2ff;
  box-shadow: 0 6px 16px rgba(10,132,255,.15);
}

.select-btn.active {
  color: #fff;
  background: linear-gradient(180deg, #3ea7ff 0%, #0a84ff 100%);
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(10,132,255,.33);
}

.queue-jump-btn {
  background: linear-gradient(180deg, #8a5cff 0%, #6f43f5 100%);
  border-color: transparent;
  color: #fff;
}

.queue-jump-btn:hover {
  box-shadow: 0 10px 24px rgba(111,67,245,.35);
}

/* =========================
   场景快切按钮组 (自由模式专属)
========================= */
.scene-btn-group {
  display: flex;
  gap: 4px;
  overflow: hidden;
  transition: max-width 0.35s ease, opacity 0.3s ease;
  max-width: 500px;
  opacity: 1;
}
.scene-btn-group.scene-hidden {
  max-width: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  gap: 0 !important;
}
.scene-btn {
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  background: #f3f6ff;
  color: #244165;
  border: 1px solid #dbe7ff;
  box-shadow: none;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}
.scene-btn:hover { transform: translateY(-1px); }
.scene-btn.active { color: #fff !important; border-color: transparent !important; }
.scene-btn.scene-hosting.active {
  background: linear-gradient(180deg, #60a5fa, #3b82f6) !important;
  box-shadow: 0 4px 12px rgba(59,130,246,.4) !important;
}
.scene-btn.scene-preparing.active {
  background: linear-gradient(180deg, #fbbf24, #f59e0b) !important;
  box-shadow: 0 4px 12px rgba(245,158,11,.4) !important;
}
.scene-btn.scene-game.active {
  background: linear-gradient(180deg, #c084fc, #a855f7) !important;
  box-shadow: 0 4px 12px rgba(168,85,247,.4) !important;
}
.scene-btn.scene-ended.active {
  background: linear-gradient(180deg, #d1d5db, #9ca3af) !important;
  box-shadow: 0 4px 12px rgba(156,163,175,.4) !important;
}

/* =========================
   呼吸灯大小/显隐控制按钮
========================= */
.icon-ctrl-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  vertical-align: middle;
}
.icon-ctrl-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1;
  background: #f3f6ff;
  color: #244165;
  border: 1px solid #dbe7ff;
  box-shadow: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-ctrl-btn:hover {
  background: #eaf2ff;
  box-shadow: 0 4px 10px rgba(10,132,255,.15);
}
.icon-ctrl-btn.active {
  background: linear-gradient(180deg, #ff6b6b, #ff3b30);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 10px rgba(255,59,48,.35);
}

/* 强制高亮 */
#singerBtnGroup .select-btn.active,
#typeBtnGroup .select-btn.active,
#typeBtnGroup2 .select-btn.active,
#queueModeBtn.active,
#jumpModeBtn.active {
  background: linear-gradient(180deg, #65c4ff 0%, #0a84ff 100%) !important;
  color: #ffffff !important;
  border: 1px solid #86d4ff !important;
  box-shadow:
    0 0 0 2px rgba(10, 132, 255, 0.24),
    0 10px 22px rgba(10, 132, 255, 0.36) !important;
  transform: translateY(-1px);
}

#typeBtnGroup2 .queue-jump-btn.active,
#jumpModeBtn.active {
  background: linear-gradient(180deg, #c09bff 0%, #7b4dff 100%) !important;
  border: 1px solid #d2b9ff !important;
  color: #ffffff !important;
  box-shadow:
    0 0 0 2px rgba(123, 77, 255, 0.24),
    0 10px 22px rgba(123, 77, 255, 0.38) !important;
}

/* =========================
   Inputs
========================= */
.song-input-row {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px;
}

.song-input-row input,
.timer-custom input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: var(--trans);
}

.song-input-row input:focus,
.timer-custom input:focus {
  border-color: #8ec8ff;
  box-shadow: 0 0 0 4px rgba(10,132,255,.12);
}

#addBtn {
  width: 44px;
  height: 42px;
  border-radius: 12px;
  font-size: 24px;
  line-height: 1;
  padding: 0;
}

#addGameBtn {
  width: 44px;
  height: 42px;
  border-radius: 12px;
  font-size: 20px;
  line-height: 1;
  padding: 0;
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
#addGameBtn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.5);
}

/* =========================
   Timer
========================= */
.timer-section { margin-top: 14px; }

.timer-display {
  margin: 10px 0 12px;
  text-align: center;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #0b6ed6;
  background: #f2f8ff;
  border: 1px solid #d9eaff;
  border-radius: 14px;
  padding: 8px 0;
}

.timer-display.warning {
  color: #d97706;
  background: #fff7ed;
  border-color: #fed7aa;
}

.timer-controls { display: grid; gap: 10px; }

.timer-presets,
.timer-actions {
  display: flex;
  gap: 8px;
}

.timer-custom {
  display: grid;
  grid-template-columns: 1fr 50px;
  gap: 8px;
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--sub);
  font-size: 13px;
  user-select: none;
}

.toggle-label input[type="checkbox"] {
  accent-color: var(--brand);
}

/* =========================
   Header
========================= */
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid #e7eaf2;
  background: linear-gradient(180deg, #ffffff 0%, #f6f8fd 100%);
  color: #111827;
  box-shadow: var(--shadow-sm);
  padding: 0;
}

.theme-toggle #themeIcon { font-size: 17px; line-height: 1; }

.theme-toggle.is-dark {
  background: linear-gradient(180deg, #323643 0%, #282c38 100%);
  border-color: #3b4150;
  color: #f9fafb;
}

.monitor-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  padding: 0;
  font-size: 18px;
}

/* =========================
   Queue
========================= */
.monitor-preview .queue-section {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* 防止内部内容撑破网格 */
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.now-playing {
  margin: 8px 0 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(90deg, #5a8cff 0%, #6e6efc 100%);
  color: #fff;
  box-shadow: 0 12px 28px rgba(90, 140, 255, .35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.np-content {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.np-delete-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 9px;
  background: rgba(255,255,255,.18);
  box-shadow: none;
}

.song-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  align-content: start; /* 核心修复：绝对不允许歌单高度自动拉伸 */
  gap: 8px;
  overflow: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.song-list::-webkit-scrollbar { width: 0; height: 0; }

.monitor-preview .song-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 12px; /* 核心修复：去掉了 170px 巨大空白占位 */
}

.song-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #e8edf6;
  border-radius: 14px;
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.song-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* ── 拖拽中：被拿起的歌曲（隐身留空位） ── */
.song-item.dragging {
  opacity: 0;
}

.drag-handle {
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #f3f6fb;
  border: 1px solid #e3e8f2;
  color: #64748b;
  font-size: 16px;
  cursor: grab;
}
.drag-handle:active { cursor: grabbing; }

.order-num {
  width: 28px;
  min-width: 28px;
  text-align: center;
  font-weight: 800;
  color: #475467;
}

.song-info {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
}

.song-singer {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
}

.song-name {
  font-size: 13px;
  color: #475467;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  color: #0369a1;
  font-weight: 700;
}

.song-tag {
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
  border-radius: 999px;
  white-space: nowrap;
  background: #eff6ff;
  border: 1px solid #cfe3ff;
  color: #1d4ed8;
}

.song-tag.queue-jump.jump-lv-1 {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}
.song-tag.queue-jump.jump-lv-2 {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
}
.song-tag.queue-jump.jump-lv-3 {
  background: linear-gradient(180deg, #fff7cc 0%, #ffe08a 100%);
  border-color: #facc15;
  color: #92400e;
  box-shadow: 0 0 0 1px rgba(250, 204, 21, .3), 0 4px 10px rgba(250, 204, 21, .35);
}

.song-tag.game-tag {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  border: none;
  color: #fff;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.4);
}

.song-item.game-item {
  border-left: 3px solid #a855f7;
  background: linear-gradient(135deg, #f5f0ff 0%, #ede5ff 100%);
}
.song-item.game-item .song-name {
  color: #7c3aed;
  font-weight: 700;
}

.delete-btn {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 9px;
  background: #ffe4e6;
  color: #be123c;
  box-shadow: none;
}
.delete-btn:hover {
  background: #fecdd3;
  box-shadow: none;
  transform: none;
}

/* =========================================
   新增：播放按钮 与 互动文字样式
========================================= */
.play-btn {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 9px;
  background: #ecfdf5;
  color: #059669;
  box-shadow: none;
  margin-right: -4px; /* 让播放和删除凑近一点 */
}

.play-btn:hover {
  background: #d1fae5;
  box-shadow: none;
  transform: scale(1.05);
}

.np-intermission {
  font-style: italic;
  opacity: 0.9;
  font-weight: 500;
  letter-spacing: 1px;
}
/* ========================================= */

.song-item.manual-sorted { border-style: dashed; }

/* =========================
   PIP 预览
========================= */
.pip-preview {
  --pip-w: 220px;
  position: fixed;
  right: 14px;
  bottom: 14px;
  width: var(--pip-w);
  z-index: 9999;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 14px 30px rgba(2, 6, 23, 0.35);
  backdrop-filter: blur(6px);
}

.pip-preview.pip-custom-pos {
  right: auto;
  bottom: auto;
}

.pip-preview.is-large { --pip-w: 320px; }
.pip-preview.is-collapsed .pip-ratio { display: none; }

.pip-toolbar {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 10px;
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
  user-select: none;
  touch-action: none;
  cursor: grab;
}
.pip-preview.dragging .pip-toolbar { cursor: grabbing; }

.pip-actions { display: flex; gap: 6px; }

.pip-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: none;
}
.pip-btn:hover {
  transform: none;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.26);
}

.pip-ratio {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: #000;
}
.pip-ratio::before { content: none !important; }

body.dark-mode .pip-preview {
  background: rgba(17, 24, 39, 0.9);
  border-color: rgba(148, 163, 184, 0.28);
}

/* =========================
   Monitor page
========================= */
body.monitor-body {
  margin: 0;
  height: 100vh;
  overflow: hidden !important;
  background:
    radial-gradient(900px 420px at 50% -30%, rgba(94,92,230,.16), transparent 55%),
    #0f1116;
  color: #eef2ff;
}

.monitor .container,
body.monitor-body .container {
  width: min(900px, 100%);
  margin: 0 auto;
  height: 100%;
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.monitor h1,
body.monitor-body h1 {
  flex: 0 0 auto;
  margin: 2px 0 10px;
  text-align: center;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: .5px;
}

.monitor .queue-section,
body.monitor-body .queue-section {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: none;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

.monitor .queue-section:hover,
body.monitor-body .queue-section:hover {
  transform: none;
  box-shadow: none;
}

.monitor .now-playing,
body.monitor-body .now-playing {
  flex: 0 0 auto;
  margin-top: 0;
  background: linear-gradient(90deg, #6f8dff 0%, #6e6efc 100%);
  box-shadow: none;
}

.monitor .song-list,
body.monitor-body .song-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;

  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: 54px;
  align-content: start;
  gap: 8px;
  padding-bottom: 0;
}

.monitor .song-item,
body.monitor-body .song-item {
  height: 54px;
  min-height: 54px;
  max-height: 54px;
  box-sizing: border-box;
  padding: 8px 10px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: none;
}

.monitor .song-item,
.monitor .now-playing,
.monitor .song-tag,
.monitor .timer-display,
body.monitor-body .song-item,
body.monitor-body .now-playing,
body.monitor-body .song-tag,
body.monitor-body .timer-display {
  transition: none !important;
  cursor: default !important;
}
.monitor .song-item:hover,
body.monitor-body .song-item:hover {
  transform: none !important;
  box-shadow: none !important;
}

.monitor .song-singer,
body.monitor-body .song-singer { color: #f8fafc; }

.monitor .song-name,
body.monitor-body .song-name { color: #cbd5e1; }

.monitor .song-tag,
body.monitor-body .song-tag {
  background: rgba(125, 190, 255, .14);
  border-color: rgba(125, 190, 255, .35);
  color: #dbeafe;
}
.monitor .song-tag.queue-jump.jump-lv-1,
body.monitor-body .song-tag.queue-jump.jump-lv-1 {
  background: rgba(251, 146, 60, .15);
  border-color: rgba(251, 146, 60, .4);
  color: #ffedd5;
}
.monitor .song-tag.queue-jump.jump-lv-2,
body.monitor-body .song-tag.queue-jump.jump-lv-2 {
  background: rgba(168, 85, 247, .16);
  border-color: rgba(168, 85, 247, .45);
  color: #f3e8ff;
}
.monitor .song-tag.queue-jump.jump-lv-3,
body.monitor-body .song-tag.queue-jump.jump-lv-3 {
  background: rgba(250, 204, 21, .2);
  border-color: rgba(250, 204, 21, .52);
  color: #fef3c7;
  box-shadow: none;
}

.monitor .monitor-timer,
body.monitor-body .monitor-timer {
  flex: 0 0 auto;
  margin-top: 8px;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}
.monitor .monitor-timer .timer-display,
body.monitor-body .monitor-timer .timer-display {
  margin: 0 auto;
  width: fit-content;
  min-width: 132px;
  padding: 8px 16px;
  font-size: 30px;
  color: #cfe5ff;
  background: rgba(59,130,246,.16);
  border-color: rgba(59,130,246,.3);
}

body.monitor-body::-webkit-scrollbar,
body.monitor-body .container::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* =========================
   Dark mode
========================= */
body.dark-mode {
  --bg: #191b21;
  --bg-2: #232734;
  --panel: #20232d;
  --text: #eef2ff;
  --sub: #a9b3c7;
  --line: #303647;

  background:
    radial-gradient(1000px 500px at -10% -20%, rgba(10,132,255,.22), transparent 55%),
    radial-gradient(900px 440px at 110% -10%, rgba(94,92,230,.2), transparent 55%),
    #17191f;
}

body.dark-mode .control-panel,
body.dark-mode .monitor-preview {
  background: rgba(28,31,39,.55);
  backdrop-filter: saturate(1.2) blur(20px);
  -webkit-backdrop-filter: saturate(1.2) blur(20px);
  border-color: rgba(255,255,255,.06);
}

body.dark-mode .form-section,
body.dark-mode .queue-section,
body.dark-mode .timer-section {
  background: rgba(31,35,48,.5);
  border-color: rgba(49,56,74,.6);
  box-shadow: 0 12px 28px rgba(0,0,0,.32);
}

body.dark-mode .song-input-row input,
body.dark-mode .timer-custom input {
  background: #161a24;
  border-color: #333b50;
  color: #f1f5f9;
}

body.dark-mode .select-btn {
  background: #242a3a;
  border-color: #3a4360;
  color: #d7e3ff;
}

body.dark-mode .song-item {
  background: #1a1f2b;
  border-color: #31384b;
}
body.dark-mode .song-item.game-item {
  background: linear-gradient(135deg, #2d1b4e 0%, #231340 100%);
  border-color: #7c3aed;
}

body.dark-mode .drag-handle {
  background: #252c3d;
  border-color: #39425b;
  color: #a8b4cf;
}

body.dark-mode .order-num { color: #b8c5df; }
body.dark-mode .song-singer { color: #f1f5ff; }
body.dark-mode .song-name { color: #afbdd6; }

body.dark-mode .song-tag {
  background: #213354;
  border-color: #355483;
  color: #cde1ff;
}

body.dark-mode .delete-btn {
  background: #4a2330;
  color: #fecdd3;
}

/* 深色模式下的播放按钮 */
body.dark-mode .play-btn {
  background: #134e4a;
  color: #a7f3d0;
}

/* =========================
   Responsive 移动端自适应（小屏幕自动恢复滚动）
========================= */
@media (max-width: 1100px) {
  html, body {
    height: auto;
    overflow: auto; /* 屏幕小的时候恢复原生滚动 */
    min-height: 100vh;
  }
  
  .main-layout {
    height: auto;
  }

  .control-panel,
  .monitor-preview {
    height: auto;
    overflow-y: visible;
  }

  .monitor-preview {
    min-height: 70vh;
  }

  .pip-preview {
    --pip-w: 180px;
    right: 10px;
    bottom: 10px;
  }

  .pip-preview.is-large {
    --pip-w: 240px;
  }
}

@media (max-width: 640px) {
  .control-panel,
  .monitor-preview {
    padding: 12px;
    border-radius: 16px;
  }

  .song-item {
    min-height: 48px;
  }
}

/* =========================
   新增：换挡结算弹窗样式
========================= */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(6px);
  z-index: 10000; display: flex; align-items: center; justify-content: center;
}
.modal-content {
  background: var(--panel); border-radius: var(--radius-xl);
  width: 500px; max-width: 90%; padding: 24px;
  box-shadow: var(--shadow-md); display: flex; flex-direction: column; gap: 16px;
}
.modal-content h2 { margin: 0; font-size: 20px; color: var(--text); }
#shiftReportText {
  width: 100%; height: 380px; resize: none; border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 14px; font-family: monospace;
  font-size: 13.5px; line-height: 1.5; color: var(--text); background: var(--bg); outline: none;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; }

body.dark-mode .modal-content { background: #1f2330; border: 1px solid #31384a; }
body.dark-mode #shiftReportText { background: #161a24; color: #d7e3ff; border-color: #31384a; }
/* 右上角关闭按钮样式 */
.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  color: var(--sub);
  border: none;
  box-shadow: none;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.modal-close-btn:hover {
  background: var(--bg-2);
  color: var(--text);
  transform: none;
  box-shadow: none;
}
body.dark-mode .modal-close-btn:hover {
  background: #242a3a;
  color: #fff;
}

/* --- 直播小窗 9:16 完美比例 & 自由拖拽缩放 (终极修复版) --- */
#pipPreview {
    width: 240px; /* 🌟 必须去掉 !important，否则鼠标拖不动！ */
    min-width: 150px; 
    max-width: 600px; 
    height: auto; 
    resize: horizontal; /* 允许横向拖拽 */
    overflow: hidden; /* 必须是 hidden，右下角的拖拽点才会出现 */
    padding-bottom: 12px; /* 给右下角手柄留点位置，防止被画面挡住 */
    background: rgba(15, 23, 42, 0.95);
}

.pip-ratio {
    width: 100%; /* 永远跟着外壳变大 */
    height: auto; 
    aspect-ratio: 9 / 16; /* 🌟 强制保持 9:16 竖屏完美比例 */
    position: relative;
    overflow: hidden;
    background: #000;
    pointer-events: none; /* 防止画面吞噬鼠标拖拽操作 */
}

/* 隐藏不再需要的放大缩小按钮 */
.pip-btn[onclick="togglePipSize()"] {
    display: none !important;
}
/* --- iOS 风格滑动开关 --- */
.ios-switch-container { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.ios-switch { position: relative; width: 44px; height: 24px; }
.ios-switch input { opacity: 0; width: 0; height: 0; }
.ios-switch .ios-slider {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc; transition: .3s; border-radius: 34px;
}
.ios-switch .ios-slider:before {
    position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px;
    background-color: white; transition: .3s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.ios-switch input:checked + .ios-slider { background-color: #34c759; } /* 经典苹果绿 */
.ios-switch input:checked + .ios-slider:before { transform: translateX(20px); }

/* --- 计时器按钮与输入框优化 --- */
.timer-presets-pro { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.timer-presets-pro button { padding: 6px 0; background: #f0f2f5; color: #333; box-shadow: none; font-size: 12px; }
body.dark-mode .timer-presets-pro button { background: #2c2c2e; color: #fff; }

.timer-custom-pro { display: flex; gap: 8px; margin-bottom: 8px; }
.timer-custom-pro .input-group { 
    flex: 1; display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; 
}
.timer-custom-pro input { 
    width: 100%; border: none !important; background: transparent !important; text-align: center; font-weight: 700; color: var(--text); padding: 8px 0; 
}
.timer-custom-pro .sep { font-weight: bold; color: var(--sub); }
.timer-custom-pro .check-btn { width: 44px; height: 36px; padding: 0; background: var(--brand); }

.timer-actions-pro { display: grid; grid-template-columns: 1fr 1fr 44px; gap: 8px; }
.timer-actions-pro .btn-run { background: linear-gradient(180deg, #34c759 0%, #28a745 100%); font-size: 14px; }
.timer-actions-pro .btn-pause { background: linear-gradient(180deg, #ff9500 0%, #e68600 100%); font-size: 14px; }
.timer-actions-pro .btn-reset { background: #f2f2f7; color: #333; box-shadow: none; border: 1px solid #d1d1d6; }
body.dark-mode .timer-actions-pro .btn-reset { background: #3a3a3c; color: #fff; border: none; }

/* 🌟 1. 彻底隐藏数字输入框的上下箭头 (Chrome, Safari, Edge, Firefox) */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

/* 🌟 2. 确保 iOS 开关样式通用化 (如果之前没加过，请添加) */
.ios-switch-container {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.ios-switch {
  position: relative;
  width: 44px;
  height: 24px;
}
.ios-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.ios-switch .ios-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .3s;
  border-radius: 34px;
}
.ios-switch .ios-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.ios-switch input:checked + .ios-slider {
  background-color: #34c759;
}
.ios-switch input:checked + .ios-slider:before {
  transform: translateX(20px);
}
/* --- 互动文案输入框深度美化 --- */
#sloganInput {
  background: rgba(0, 0, 0, 0.25) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  transition: all 0.3s ease;
  
  /* 🌟 核心修复：禁止拉伸、强制纯白字体、调整内部间距 */
  resize: none !important; 
  color: #ffffff !important; 
  font-family: inherit;
  padding: 12px !important;
  width: 100%;
  height: 90px;
  border-radius: 8px;
  box-sizing: border-box;

  scrollbar-width: thin; 
  scrollbar-color: rgba(255,255,255,0.2) transparent; 
}

#sloganInput:focus {
  border-color: #34c759 !important;
  box-shadow: 0 0 15px rgba(52, 199, 89, 0.2);
  outline: none;
}

/* 隐藏丑陋滚动条，换成极细高级版 */
#sloganInput::-webkit-scrollbar { width: 4px; }
#sloganInput::-webkit-scrollbar-track { background: transparent; }
#sloganInput::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 10px; }
#sloganInput::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.4); }

/* 🎮 游戏文案输入框 — 同款深色半透明风格 */
#gameTextInput {
  background: rgba(0, 0, 0, 0.25) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  transition: all 0.3s ease;
  resize: none !important;
  color: #ffffff !important;
  font-family: inherit;
  padding: 12px !important;
  width: 100%;
  height: 90px;
  border-radius: 8px;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}
#gameTextInput::placeholder {
  color: rgba(255, 255, 255, 0.35);
}
#gameTextInput:focus {
  border-color: #34c759 !important;
  box-shadow: 0 0 15px rgba(52, 199, 89, 0.2);
  outline: none;
}
#gameTextInput::-webkit-scrollbar { width: 4px; }
#gameTextInput::-webkit-scrollbar-track { background: transparent; }
#gameTextInput::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 10px; }
#gameTextInput::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.4); }

/* 🌟 强制解除预览小窗的鼠标锁定，允许拖拽 */
iframe {
    pointer-events: auto !important;
}

/* =========================
   控制台背景层
========================= */
#consoleBgLayer {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
#consoleBgLayer img,
#consoleBgLayer video {
  width: 100%; height: 100%;
  object-fit: cover;
}

/* =========================
   💬🎮 文案弹出框（Modal）
========================= */
.text-modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  transition: opacity 0.25s ease;
}
.text-modal-panel {
  width: 380px;
  max-height: 80vh;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}
.text-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.text-modal-close {
  width: 28px; height: 28px;
  border: none;
  background: rgba(128,128,128,0.1);
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  color: var(--sub);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.text-modal-close:hover {
  background: rgba(255, 59, 48, 0.15);
  color: #ff3b30;
}
.text-modal-body {
  padding: 14px 18px 20px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(128,128,128,0.2) transparent;
}
.text-modal-body::-webkit-scrollbar { width: 4px; }
.text-modal-body::-webkit-scrollbar-track { background: transparent; }
.text-modal-body::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.2); border-radius: 10px; }
.text-modal-body::-webkit-scrollbar-thumb:hover { background: rgba(128,128,128,0.4); }