/* ============================================
   BILIBILI 像素方块世界 - 游戏界面样式
   ============================================ */

/* 全局重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Courier New', 'Consolas', monospace;
  user-select: none;
  -webkit-user-select: none;
}

/* 游戏画布 - 全屏 */
#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
}

/* 十字准星 */
#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 24px;
  font-weight: 200;
  pointer-events: none;
  z-index: 10;
  text-shadow: 0 0 2px rgba(0,0,0,0.8);
  opacity: 0.8;
  display: none;
}

/* 物品栏 */
#hotbar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  gap: 4px;
  z-index: 10;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px;
  border-radius: 4px;
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.hotbar-slot {
  width: 52px;
  height: 52px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.12s ease-out;
}

.hotbar-slot.selected {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.45), 0 0 3px rgba(255, 255, 255, 0.5);
  transform: scale(1.08);
  outline: 1px solid rgba(255, 255, 255, 0.3);
  outline-offset: -2px;
}

.hotbar-slot .block-preview {
  width: 36px;
  height: 36px;
  border-radius: 2px;
  image-rendering: pixelated;
}

.hotbar-slot .slot-key {
  position: absolute;
  bottom: 1px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8), 0 0 4px rgba(0,0,0,0.5);
  letter-spacing: 0;
  line-height: 1;
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 0 2px;
  border-radius: 0 0 3px 3px;
  pointer-events: none;
}

/* 当前选中方块名称 - 热键栏上方 */
#selectedBlockName {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 15px;
  font-weight: bold;
  z-index: 11;
  pointer-events: none;
  display: none;
  text-shadow: 0 2px 4px rgba(0,0,0,0.9);
  background: rgba(0, 0, 0, 0.5);
  padding: 5px 16px;
  border-radius: 4px;
  letter-spacing: 1px;
  transition: transform 0.12s ease-out, opacity 0.12s ease-out;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* 调试信息 */
#debugInfo {
  position: fixed;
  top: 12px;
  left: 12px;
  color: #fff;
  font-size: 13px;
  line-height: 1.6;
  z-index: 10;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.35);
  padding: 8px 12px;
  border-radius: 4px;
  display: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* 背景音乐开关按钮 */
#btnMusic {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  z-index: 100;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  padding: 0;
  line-height: 1;
}

#btnMusic:hover {
  background: rgba(0, 0, 0, 0.55);
  border-color: rgba(255, 255, 255, 0.4);
}

#btnMusic:active {
  transform: scale(0.92);
}

/* 帮助按钮：右上角，唤起新手引导（H 键也能唤起） */
.help-btn {
  position: fixed;
  top: 12px;
  right: 60px;
  width: 40px;
  height: 40px;
  z-index: 100;
  background: rgba(251, 114, 153, 0.25);
  border: 1px solid rgba(251, 114, 153, 0.6);
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  font-weight: bold;
  color: #FB7299;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  padding: 0;
  line-height: 1;
  text-shadow: 0 0 6px rgba(251, 114, 153, 0.6);
}

.help-btn:hover {
  background: rgba(251, 114, 153, 0.5);
  box-shadow: 0 0 14px rgba(251, 114, 153, 0.55);
}

.help-btn:active {
  transform: scale(0.92);
}

/* ============================================
   机器人头顶浮动标签层
   ============================================ */
#robotLabels {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
  overflow: hidden;
}

.robot-label {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3px 8px 4px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  line-height: 1.3;
  color: #fff;
  white-space: nowrap;
  pointer-events: none;
  transform-origin: bottom center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  will-change: transform, opacity;
}

.robot-label::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid rgba(0, 0, 0, 0.7);
}

.robot-label .rl-name {
  font-weight: bold;
  letter-spacing: 0.5px;
}

.robot-label .rl-status {
  font-size: 10px;
  opacity: 0.85;
  margin-top: 1px;
}

/* 三种机器人的不同配色 */
.robot-label.rl-scout {
  border-color: rgba(68, 136, 255, 0.7);
  box-shadow: 0 0 8px rgba(68, 136, 255, 0.35);
}
.robot-label.rl-scout .rl-name { color: #88BBFF; }

.robot-label.rl-heavy {
  border-color: rgba(255, 136, 0, 0.7);
  box-shadow: 0 0 8px rgba(255, 136, 0, 0.35);
}
.robot-label.rl-heavy .rl-name { color: #FFB347; }

.robot-label.rl-builder {
  border-color: rgba(0, 255, 136, 0.7);
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.35);
}
.robot-label.rl-builder .rl-name { color: #7FFFB0; }

/* 目标方块高亮提示 */
#blockHighlight {
  position: fixed;
  top: 53%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 13px;
  z-index: 10;
  pointer-events: none;
  display: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  background: rgba(0,0,0,0.4);
  padding: 4px 10px;
  border-radius: 4px;
}

/* 开始界面 - 磨砂玻璃效果叠加在游戏世界上 */
/* ============================================
   开始界面（卡片式双入口）
   ============================================ */
#startScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at top, rgba(251, 114, 153, 0.18), transparent 55%),
    radial-gradient(ellipse at bottom, rgba(0, 200, 255, 0.14), transparent 55%),
    rgba(5, 8, 20, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 20px;
  overflow-y: auto;
}

.start-card {
  width: 100%;
  max-width: 560px;
  background: linear-gradient(180deg, rgba(20, 14, 38, 0.92), rgba(8, 6, 20, 0.92));
  border: 1px solid rgba(251, 114, 153, 0.35);
  border-radius: 18px;
  padding: 36px 32px 28px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 18px 60px rgba(0, 0, 0, 0.65),
    0 0 80px rgba(251, 114, 153, 0.18);
  text-align: center;
  color: #fff;
  animation: cardFadeIn 0.6s ease;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.start-badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 4px;
  color: #FFD700;
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 18px;
  font-family: 'Courier New', monospace;
}

.start-title {
  font-size: 34px;
  font-weight: 800;
  margin: 0 0 10px;
  letter-spacing: 2px;
  background: linear-gradient(90deg, #FB7299 0%, #FFD700 50%, #00E5FF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(251, 114, 153, 0.3);
  animation: titleShift 6s ease-in-out infinite;
}

@keyframes titleShift {
  0%, 100% { filter: hue-rotate(0deg); }
  50%      { filter: hue-rotate(20deg); }
}

.start-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 28px;
  line-height: 1.6;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.start-modes {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.mode-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.mode-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.08) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.mode-card:hover::before { transform: translateX(100%); }

.mode-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
}

.mode-sandbox:hover {
  box-shadow: 0 8px 28px rgba(76, 175, 80, 0.25);
  border-color: rgba(129, 199, 132, 0.6);
}

.mode-parkour:hover {
  box-shadow: 0 8px 28px rgba(255, 215, 0, 0.3);
  border-color: rgba(255, 215, 0, 0.7);
}

.mode-icon {
  font-size: 28px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.mode-sandbox .mode-icon { box-shadow: inset 0 0 0 1px rgba(129, 199, 132, 0.4); }
.mode-parkour .mode-icon { box-shadow: inset 0 0 0 1px rgba(255, 215, 0, 0.5); }

.mode-body { flex: 1; min-width: 0; }

.mode-name {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-tag {
  font-size: 10px;
  font-weight: 800;
  color: #0a0a0a;
  background: linear-gradient(90deg, #FFD700, #FF8800);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 1px;
}

.mode-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.4;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.mode-arrow {
  font-size: 24px;
  color: rgba(255, 255, 255, 0.3);
  transition: transform 0.25s ease, color 0.25s ease;
}

.mode-card:hover .mode-arrow {
  transform: translateX(4px);
  color: rgba(255, 255, 255, 0.8);
}

.mode-sandbox:hover .mode-arrow { color: #A5D6A7; }
.mode-parkour:hover .mode-arrow { color: #FFD700; }

.start-controls {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  font-size: 11px;
}

.ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  flex: 1;
}

.ctrl-title {
  color: #FB7299;
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 10px;
  margin-bottom: 2px;
  text-transform: uppercase;
}

.ctrl-item {
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.ctrl-item kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  color: #FFD700;
  margin-right: 2px;
}

.start-controls-mobile {
  display: none;
  margin-top: 14px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  text-align: center;
}

.mobile-only { display: none; }

/* ============================================
   右上角操作说明面板（桌面端常驻）
   ============================================ */
#controlsPanel {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 50;
  display: none;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 12px 16px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.controls-trigger {
  display: none;
}

.controls-body {
  display: block;
}

/* 面板内标题 */
.controls-body::before {
  content: "操作说明";
  display: block;
  color: #81C784;
  font-size: 13px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: 2px;
}

/* 面板内每一行：按键 + 说明 */
.control-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 12px;
  line-height: 1.4;
}

.control-row .key {
  display: inline-block;
  min-width: 22px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  font-weight: bold;
  color: #FFD700;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  flex-shrink: 0;
}

.control-row > span:last-child {
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* 暂停界面 */
#pauseScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 90;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

#pauseScreen .pause-text {
  font-size: 36px;
  color: #fff;
  margin-bottom: 16px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

#pauseScreen .pause-hint {
  font-size: 16px;
  color: rgba(255,255,255,0.7);
  animation: hintBlink 2s ease-in-out infinite;
}

/* 加载提示 */
#loadingBar {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 80;
  text-align: center;
  display: none;
}

#loadingBar .loading-text {
  color: #81C784;
  font-size: 18px;
  margin-bottom: 12px;
}

#loadingBar .loading-progress {
  width: 200px;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}

#loadingBar .loading-fill {
  height: 100%;
  background: #4CAF50;
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s;
}

/* 响应式适配（仅按宽度判断，避免 pointer:coarse 误伤触屏笔记本） */
@media (max-width: 768px) {
  .start-title {
    font-size: 26px;
    letter-spacing: 1px;
  }

  .start-card {
    padding: 26px 20px 22px;
  }

  .start-subtitle {
    font-size: 12px;
  }

  /* 移动端显示移动端提示，隐藏桌面三栏操作说明 */
  .start-controls { display: none; }
  .start-controls-mobile { display: block; }

  .mode-card { padding: 14px 14px; }
  .mode-icon { width: 42px; height: 42px; font-size: 24px; }
  .mode-name { font-size: 15px; }
  .mode-desc { font-size: 11px; }

  .hotbar-slot {
    width: 44px;
    height: 44px;
  }

  .hotbar-slot .block-preview {
    width: 30px;
    height: 30px;
  }

  .hotbar-slot .slot-key {
    font-size: 11px;
    padding: 1px 0 1px;
  }

  #debugInfo {
    font-size: 11px;
  }

  #selectedBlockName {
    bottom: 62px;
    font-size: 13px;
    padding: 4px 12px;
  }

  /* 隐藏桌面端操作说明 */
  .desktop-only {
    display: none;
  }

  /* 移动端触控控件优化 */
  #joystickZone {
    width: 110px;
    height: 110px;
    bottom: 130px;
    left: 12px;
  }

  #joystickThumb {
    width: 46px;
    height: 46px;
  }

  .action-btn {
    width: 54px;
    height: 54px;
    font-size: 13px;
  }

  #actionButtons {
    bottom: 140px;
    right: 12px;
    gap: 10px;
  }

  #mobileHotbar {
    bottom: 8px;
    padding: 2px;
  }

  .m-slot {
    width: 34px;
    height: 34px;
  }
}

@media (max-width: 480px) {
  .start-title {
    font-size: 24px;
  }

  .hotbar-slot {
    width: 38px;
    height: 38px;
  }

  .hotbar-slot .block-preview {
    width: 26px;
    height: 26px;
  }

  .hotbar-slot .slot-key {
    font-size: 10px;
    padding: 1px 0 1px;
  }

  #hotbar {
    bottom: 10px;
  }

  #selectedBlockName {
    bottom: 54px;
    font-size: 12px;
    padding: 3px 10px;
  }
}

/* ============================================ */
/*  移动端触控 UI 样式 */
/* ============================================ */

#mobileControls {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  display: none;
}

/* 虚拟摇杆 */
#joystickZone {
  position: absolute;
  bottom: 140px;
  left: 16px;
  width: 130px;
  height: 130px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
  z-index: 21;
  transition: background 0.2s, border-color 0.2s;
}

#joystickZone:active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

#joystickThumb {
  position: absolute;
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: background 0.15s, border-color 0.15s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#joystickZone:active #joystickThumb {
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(255, 255, 255, 0.7);
}

/* 操作按钮区 */
#actionButtons {
  position: absolute;
  bottom: 150px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: auto;
  z-index: 21;
}

.action-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  pointer-events: auto;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  transition: background 0.1s, border-color 0.1s, transform 0.1s;
}

.action-btn:active {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(0.95);
}

/* 机器人按钮：蓝绿色调，与其他操作按钮区分 */
.action-btn-bot {
  width: 56px;
  height: 56px;
  background: rgba(0, 200, 180, 0.22);
  border-color: rgba(0, 220, 180, 0.55);
  color: #7FFFD4;
}

.action-btn-bot:active {
  background: rgba(0, 220, 180, 0.45);
  border-color: rgba(127, 255, 212, 0.85);
}

#btnJump {
  background: rgba(76, 175, 80, 0.25);
  border-color: rgba(76, 175, 80, 0.5);
}

#btnJump:active {
  background: rgba(76, 175, 80, 0.45);
  border-color: rgba(76, 175, 80, 0.7);
}

#btnBreak {
  background: rgba(244, 67, 54, 0.25);
  border-color: rgba(244, 67, 54, 0.5);
}

#btnBreak:active {
  background: rgba(244, 67, 54, 0.45);
  border-color: rgba(244, 67, 54, 0.7);
}

#btnPlace {
  background: rgba(33, 150, 243, 0.25);
  border-color: rgba(33, 150, 243, 0.5);
}

#btnPlace:active {
  background: rgba(33, 150, 243, 0.45);
  border-color: rgba(33, 150, 243, 0.7);
}

#btnSlide {
  background: rgba(255, 152, 0, 0.25);
  border-color: rgba(255, 152, 0, 0.5);
  font-size: 12px;
}

#btnSlide:active {
  background: rgba(255, 152, 0, 0.45);
  border-color: rgba(255, 152, 0, 0.7);
}

/* 移动端物品栏 */
#mobileHotbar {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 3px;
  pointer-events: auto;
  z-index: 21;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px;
  border-radius: 4px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
}

.m-slot {
  width: 38px;
  height: 38px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: all 0.12s ease-out;
}

.m-slot.selected {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
  transform: scale(1.08);
  outline: 1px solid rgba(255, 255, 255, 0.25);
  outline-offset: -2px;
}

.m-block-preview {
  width: 26px;
  height: 26px;
  border-radius: 2px;
  image-rendering: pixelated;
}

/* ============================================
   弹幕对战 HUD
   ============================================ */
#danmakuHUD {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: none;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 16px;
  pointer-events: none;
}

.dm-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 100px;
}

.dm-red .dm-team-name { color: #FF6B6B; }
.dm-blue .dm-team-name { color: #6B9EFF; }

.dm-team-name {
  font-size: 14px;
  font-weight: bold;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.dm-score {
  font-size: 32px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.9), 0 0 12px currentColor;
  line-height: 1;
}

.dm-red .dm-score { text-shadow: 0 2px 6px rgba(0,0,0,0.9), 0 0 16px #FF4444; }
.dm-blue .dm-score { text-shadow: 0 2px 6px rgba(0,0,0,0.9), 0 0 16px #4488FF; }

.dm-bots {
  font-size: 11px;
  color: rgba(255,255,255,0.8);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.dm-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 4px;
}

.dm-vs {
  font-size: 18px;
  font-weight: 900;
  color: #FFD700;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.dm-timer {
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  font-family: 'Courier New', monospace;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.dm-target {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.dm-message {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: bold;
  color: #FFD700;
  text-shadow: 0 2px 4px rgba(0,0,0,1), 0 0 10px rgba(255,215,0,0.5);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
  z-index: 51;
  max-width: 80%;
}

.dm-hint {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  pointer-events: none;
  z-index: 51;
  white-space: nowrap;
}

.dm-hint kbd {
  display: inline-block;
  padding: 2px 6px;
  margin: 0 2px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 3px;
  font-size: 11px;
  color: #FFD700;
}

/* 弹幕模式卡片样式 */
.mode-danmaku {
  border-left: 3px solid #FF6B6B;
}

.mode-danmaku:hover {
  background: rgba(255, 107, 107, 0.08);
}

/* 移动端暂停界面适配 */
@media (max-width: 768px) {
  #pauseScreen .pause-text {
    font-size: 28px;
  }

  #pauseScreen .pause-hint {
    font-size: 14px;
  }

  #crosshair {
    font-size: 18px;
  }

  #blockHighlight {
    top: 53%;
    font-size: 11px;
  }
}

/* ============================================
   跑酷模式 HUD
   ============================================ */
#parkourHUD {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid #FFD700;
  border-radius: 10px;
  padding: 10px 16px;
  backdrop-filter: blur(6px);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.35);
  font-family: 'Courier New', monospace;
  color: #fff;
}

.parkour-top {
  display: flex;
  gap: 18px;
  align-items: center;
}

.parkour-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}

.parkour-label {
  font-size: 10px;
  color: #FFD700;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.85;
}

.parkour-value {
  font-size: 18px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.6);
  margin-top: 2px;
}

#parkourLives {
  color: #FF5577;
  text-shadow: 0 0 6px rgba(255, 85, 119, 0.7);
  font-size: 16px;
}

.parkour-hint {
  font-size: 14px;
  color: #FFEB3B;
  letter-spacing: 1px;
  margin-top: 4px;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0,0,0,1), 0 0 8px rgba(0,0,0,0.8);
  font-weight: bold;
  background: rgba(0,0,0,0.4);
  padding: 3px 8px;
  border-radius: 4px;
}

.parkour-hint kbd {
  display: inline-block;
  padding: 1px 6px;
  background: linear-gradient(180deg, #fff, #ddd);
  color: #222;
  border-radius: 3px;
  border: 1px solid #888;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  font-weight: bold;
  margin: 0 2px;
  box-shadow: 0 1px 0 #888;
}

/* 退出模式按钮（跑酷/弹幕通用） */
.exit-mode-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  padding: 6px 16px;
  background: rgba(244, 67, 54, 0.3);
  border: 1px solid rgba(244, 67, 54, 0.6);
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
  z-index: 52;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.exit-mode-btn:active {
  background: rgba(244, 67, 54, 0.5);
  border-color: rgba(244, 67, 54, 0.8);
  transform: scale(0.95);
}

@media (max-width: 768px) {
  #parkourHUD {
    top: 8px;
    padding: 8px 10px;
    gap: 4px;
  }
  .parkour-top {
    gap: 10px;
  }
  .parkour-stat {
    min-width: 44px;
  }
  .parkour-value {
    font-size: 14px;
  }
  .parkour-label {
    font-size: 9px;
  }
  .parkour-hint {
    font-size: 10px;
  }
}

/* 跑酷临时消息（失败/提示） */
.parkour-message {
  font-size: 15px;
  font-weight: bold;
  color: #FFD700;
  text-shadow: 0 2px 4px rgba(0,0,0,1), 0 0 8px rgba(255,215,0,0.6);
  text-align: center;
  padding: 4px 12px;
  margin-top: 2px;
}

/* ============================================
   跑酷结算面板（生命归零时显示）
   ============================================ */
#parkourGameOver {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: pkGameOverFadeIn 0.35s ease;
}

@keyframes pkGameOverFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.pk-gameover-card {
  width: 90%;
  max-width: 360px;
  background: linear-gradient(180deg, rgba(30, 20, 50, 0.96), rgba(15, 10, 25, 0.96));
  border: 1px solid rgba(255, 215, 0, 0.5);
  border-radius: 16px;
  padding: 24px 22px 20px;
  text-align: center;
  color: #fff;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 12px 40px rgba(0, 0, 0, 0.7),
    0 0 60px rgba(255, 215, 0, 0.15);
  animation: pkCardPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pkCardPop {
  0%   { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

.pk-gameover-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(90deg, #FFD700 0%, #FF8800 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}

.pk-new-best {
  display: inline-block;
  font-size: 14px;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(90deg, #FFD700, #FF6B6B);
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
  animation: pkNewBestPulse 1.4s ease-in-out infinite;
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.5);
}

@keyframes pkNewBestPulse {
  0%, 100% { transform: scale(1);    box-shadow: 0 0 18px rgba(255, 215, 0, 0.5); }
  50%      { transform: scale(1.08); box-shadow: 0 0 28px rgba(255, 215, 0, 0.85); }
}

.pk-stats {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
}

.pk-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pk-stat-row:last-child {
  border-bottom: none;
}

.pk-stat-label {
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  letter-spacing: 0.5px;
}

.pk-stat-value {
  color: #FFD700;
  font-size: 17px;
  font-weight: bold;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.pk-best-row .pk-stat-value {
  color: #FF8800;
}

.pk-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.pk-btn {
  flex: 1;
  padding: 12px 8px;
  border-radius: 10px;
  border: 1px solid;
  font-size: 14px;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  transition: transform 0.1s, box-shadow 0.2s, background 0.2s;
}

.pk-btn:active {
  transform: scale(0.94);
}

.pk-btn-retry {
  background: linear-gradient(180deg, rgba(76, 175, 80, 0.85), rgba(56, 142, 60, 0.9));
  border-color: rgba(129, 199, 132, 0.7);
  box-shadow: 0 4px 14px rgba(76, 175, 80, 0.35);
}

.pk-btn-retry:active {
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.5);
}

.pk-btn-back {
  background: linear-gradient(180deg, rgba(100, 110, 130, 0.8), rgba(70, 80, 100, 0.85));
  border-color: rgba(180, 190, 210, 0.5);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.pk-gameover-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.5;
  letter-spacing: 0.3px;
}

/* 跑酷检查点通过提示（飘字动画） */
.parkour-checkpoint-toast {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  font-size: 22px;
  font-weight: 800;
  color: #FFD700;
  text-shadow: 0 2px 6px rgba(0,0,0,1), 0 0 20px rgba(255, 215, 0, 0.9);
  pointer-events: none;
  animation: pkCheckpointToast 1.6s ease-out forwards;
}

@keyframes pkCheckpointToast {
  0%   { opacity: 0; transform: translateX(-50%) translateY(20px) scale(0.6); }
  20%  { opacity: 1; transform: translateX(-50%) translateY(0)    scale(1.1); }
  35%  { transform: translateX(-50%) translateY(0)    scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-40px) scale(1); }
}

/* 游戏中央消息提示 */
#gameMsg {
  font-size: 22px !important;
  font-weight: bold;
  color: #fff;
  text-shadow: 2px 2px 6px rgba(0,0,0,1), 0 0 12px rgba(255,215,0,0.8) !important;
}

/* ============================================
   弹幕驱动的AI世界（方案A）样式
   ============================================ */

/* ---------- 飞行弹幕层：右→左飞过屏幕 ---------- */
#danmakuFlyLayer,
.danmaku-fly-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 60%;
  pointer-events: none;   /* 不阻挡操作 */
  z-index: 50;
  overflow: hidden;
}

.danmaku-item {
  position: absolute;
  left: 110%;          /* 从屏幕右侧外开始 */
  white-space: nowrap;
  font-size: 18px;
  font-weight: 500;
  color: #fff;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.85), 0 0 4px rgba(0,0,0,0.6);
  padding: 4px 10px;
  border-radius: 4px;
  background: rgba(0,0,0,0.15);
  animation: danmakuFly 9s linear forwards;
  will-change: transform;
}

@keyframes danmakuFly {
  0%   { transform: translateX(0); }
  100% { transform: translateX(calc(-100vw - 120%)); }
}

/* 移动端：弹幕字号小一点 */
@media (max-width: 768px) {
  .danmaku-item { font-size: 15px; animation-duration: 11s; }
}

/* ---------- AI 解说员播报条：屏幕中下位置 ---------- */
#aiCommentator,
.ai-commentator {
  position: fixed;
  left: 50%;
  bottom: 140px;              /* 避开移动端按钮栏 + 输入条 */
  transform: translateX(-50%);
  max-width: min(760px, 85vw);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(251,114,153,0.92), rgba(255,171,147,0.88));
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35), 0 0 0 2px rgba(255,255,255,0.3) inset;
pointer-events: none;
z-index: 95;
animation: aicIn 0.4s ease-out;
}

.aic-avatar {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.aic-bubble {
  flex: 1 1 auto;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  line-height: 1.4;
  word-break: break-word;
}

@keyframes aicIn {
  0%   { opacity: 0; transform: translate(-50%, 18px) scale(0.8); }
  100% { opacity: 1; transform: translate(-50%, 0)    scale(1); }
}

@keyframes aicBubblePop {
  0%   { opacity: 0; transform: scale(0.92); }
  50%  { opacity: 1; transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}

/* 移动端：解说条上移避开大按钮，字号调小 */
@media (max-width: 768px) {
  #aiCommentator,
  .ai-commentator {
    bottom: 200px;
    max-width: 92vw;
    padding: 8px 12px;
  }
  .aic-avatar { width: 32px; height: 32px; font-size: 18px; }
  .aic-bubble { font-size: 14px; }
}

/* ---------- 弹幕输入条：左下角 ---------- */
#danmakuInputBar {
position: fixed;
left: 16px;
bottom: 16px;
display: flex;
align-items: center;
z-index: 95;
  gap: 6px;
  padding: 6px;
  background: rgba(20, 20, 30, 0.7);
  border: 1.5px solid rgba(251,114,153,0.5);
  border-radius: 14px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 60;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

.di-toggle {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #FB7299, #FFAB91);
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  box-shadow: 0 2px 6px rgba(251,114,153,0.5);
}
.di-toggle:hover   { transform: translateY(-1px); }
.di-toggle:active  { transform: translateY(1px) scale(0.96); }

.di-input {
  flex: 1 1 auto;
  width: 200px;
  height: 40px;
  padding: 0 14px;
  border: 1.5px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.di-input::placeholder {
  color: rgba(255,255,255,0.55);
  font-size: 13px;
}
.di-input:focus {
  border-color: #FB7299;
  box-shadow: 0 0 0 3px rgba(251,114,153,0.25);
}

.di-send {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #00B5E5, #81D4FA);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  box-shadow: 0 2px 6px rgba(0,181,229,0.5);
}
.di-send:hover   { transform: translateY(-1px); }
.di-send:active  { transform: translateY(1px) scale(0.96); }

/* 移动端：输入条更宽，字号更大，按钮更大 */
@media (max-width: 768px) {
  #danmakuInputBar {
    left: 8px;
    bottom: 170px;            /* 避开移动下方按钮栏 */
    right: 8px;
    padding: 7px;
  }
  .di-input { width: auto; font-size: 16px; height: 44px; }
  .di-toggle,
  .di-send  { height: 44px; font-size: 16px; }
  .di-toggle { width: 44px; font-size: 20px; }
}

/* ---------- 弹幕控制台：左下角输入条上方快捷卡片 ---------- */
#danmakuPanel {
  position: fixed;
  left: 16px;
  bottom: 80px;
  width: min(480px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: rgba(20, 20, 30, 0.88);
  border: 1.5px solid rgba(251,114,153,0.55);
  border-radius: 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 95;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  animation: dpSlideIn 0.25s ease-out;
}

@keyframes dpSlideIn {
  0%   { opacity: 0; transform: translateY(14px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0)    scale(1); }
}

.dp-title {
  font-size: 15px;
  font-weight: 800;
  color: #FFD700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  padding-left: 4px;
}

.dp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.dp-chip {
  min-height: 46px;
  padding: 6px 8px;
  border: 1.5px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
}
.dp-chip:hover {
  background: rgba(251,114,153,0.25);
  border-color: #FB7299;
  transform: translateY(-1px);
}
.dp-chip:active {
  transform: translateY(1px) scale(0.97);
  background: rgba(251,114,153,0.4);
}

.dp-hint {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  padding-left: 4px;
}

/* 移动端：控制台在输入条上方，按钮更大 */
@media (max-width: 768px) {
  #danmakuPanel {
    left: 8px;
    right: 8px;
    bottom: 230px;
    width: auto;
  }
  .dp-grid { grid-template-columns: repeat(3, 1fr); }
  .dp-chip { min-height: 52px; font-size: 15px; }
}

/* ---------- 22娘/33娘 对话气泡：右上角 ---------- */
#npcDialog {
  position: fixed;
  top: 20px;
  right: 20px;
  width: min(340px, calc(100vw - 40px));
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px 12px 12px;
  background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(255,241,246,0.96));
  border: 1.5px solid #FB7299;
  border-radius: 16px;
box-shadow: 0 8px 24px rgba(0,0,0,0.25);
z-index: 95;
cursor: pointer;
  animation: npdIn 0.3s ease-out;
}

@keyframes npdIn {
  0%   { opacity: 0; transform: translate(14px, -10px) scale(0.92); }
  100% { opacity: 1; transform: translate(0, 0)       scale(1); }
}

.npd-avatar {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFE8EF, #E3F2FD);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 2px 8px rgba(251,114,153,0.35);
}

.npd-body {
  flex: 1 1 auto;
  min-width: 0;
}

.npd-name {
  font-size: 14px;
  font-weight: 800;
  color: #FB7299;
  margin-bottom: 4px;
}

.npd-text {
  font-size: 13.5px;
  line-height: 1.5;
  color: #333;
  word-break: break-word;
}

.npd-close {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.08);
  color: #888;
  font-size: 18px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.npd-close:hover { background: #FB7299; color: #fff; }

/* 移动端：NPC 对话气泡上移避开输入条 */
@media (max-width: 768px) {
  #npcDialog {
    top: 12px;
    right: 12px;
    left: 12px;
    width: auto;
    padding: 10px;
  }
  .npd-avatar { width: 42px; height: 42px; font-size: 24px; }
  .npd-text    { font-size: 13px; }
}

/* ============================================
   新手引导浮层 + 输入条脉冲提示
   ============================================ */

#tutorialOverlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: tutFadeIn 0.3s ease-out;
}

.tut-mask {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.tut-card {
  position: relative;
  width: min(480px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  background: linear-gradient(160deg, #1a1a2e, #16213e);
  border: 2px solid #FB7299;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 30px rgba(251,114,153,0.3);
  animation: tutCardIn 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes tutFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes tutCardIn {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.tut-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.tut-emoji { font-size: 28px; }
.tut-title {
  flex: 1;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 10px rgba(251,114,153,0.5);
}
.tut-close {
  flex: 0 0 auto;
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.tut-close:hover { background: rgba(255,255,255,0.1); color: #fff; }

.tut-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.tut-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  transition: background 0.2s;
}
.tut-step:hover { background: rgba(251,114,153,0.15); }

.tut-step-num {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FB7299, #FF6B9D);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(251,114,153,0.5);
}

.tut-step-text {
  flex: 1;
  font-size: 15px;
  color: #fff;
  line-height: 1.5;
}
.tut-step-text b { color: #FFD700; }
.tut-hint {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  line-height: 1.5;
}
.tut-hint b { color: #81D4FA; }

.tut-footer {
  text-align: center;
}

.tut-start-btn {
  padding: 12px 40px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #FB7299, #00B5E5);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(251,114,153,0.4);
}
.tut-start-btn:hover  { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(251,114,153,0.6); }
.tut-start-btn:active { transform: translateY(0) scale(0.97); }

/* 移动端引导 */
@media (max-width: 768px) {
  .tut-card { padding: 18px; border-radius: 16px; }
  .tut-title { font-size: 19px; }
  .tut-step { padding: 10px; }
  .tut-step-num { width: 26px; height: 26px; font-size: 14px; }
  .tut-step-text { font-size: 14px; }
  .tut-hint { font-size: 12px; }
  .tut-start-btn { padding: 10px 32px; font-size: 16px; }
}

/* ---------- 输入条脉冲提示（首次使用前） ---------- */
#danmakuInputBar.di-pulse {
  animation: diPulse 1.4s ease-in-out infinite;
}

@keyframes diPulse {
  0%, 100% {
    box-shadow: 0 4px 14px rgba(0,0,0,0.35), 0 0 0 0 rgba(251,114,153,0);
  }
  50% {
    box-shadow: 0 4px 14px rgba(0,0,0,0.35), 0 0 0 6px rgba(251,114,153,0.4);
    border-color: #FB7299;
  }
}

/* 💬按钮也脉冲 */
#danmakuInputBar.di-pulse .di-toggle {
  animation: btnPulse 1.4s ease-in-out infinite;
}

@keyframes btnPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.1); }
}
