:root {
  --bg: #6a6a70;
  --panel: #141414;
  --panel-light: #1b1b1b;
  --text: #f0f0f0;
  --text-muted: #9a9a9a;
  --border: #2f2f2f;
  --pad: #2f2f2f;
  --pad-hover: #404040;
  --pad-active: #e0e0e0;
  --pad-current: #1a1a1a;
  --accent: #ffffff;
  --display: #d9d9d9;
  --shadow: rgba(0, 0, 0, 0.35);
  --pad-layer-1: #e8e8e8;
  --pad-layer-2: #d8e0e8;
  --pad-layer-3: #f0e8d8;
  --pad-glow-1: rgba(255, 255, 255, 0.32);
  --pad-glow-2: rgba(180, 225, 255, 0.35);
  --pad-glow-3: rgba(255, 210, 150, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
  overflow-x: auto;
  overflow-y: auto;
}

body {
  min-width: 100%;
  min-height: 100vh;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  color: var(--text);
  padding: 8px 16px;
  box-sizing: border-box;
  touch-action: manipulation;
}

/* Page loader: shown while the app initializes, fades out once UI is ready */
.page-loader {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--panel);
  z-index: 9999;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.page-loader .bars {
  height: 30px;
  position: relative;
  width: 40px;
}

.page-loader .bar {
  background: #ffffff;
  bottom: 1px;
  height: 3px;
  position: absolute;
  width: 3px;
  animation: sound 0ms -800ms linear infinite alternate;
  border-radius: 1px;
}

@keyframes sound {
  0% {
    opacity: 0.35;
    height: 3px;
  }
  100% {
    opacity: 1;
    height: 28px;
  }
}

.page-loader .bar:nth-child(1)  { left: 1px;  animation-duration: 474ms; }
.page-loader .bar:nth-child(2)  { left: 5px;  animation-duration: 433ms; }
.page-loader .bar:nth-child(3)  { left: 9px;  animation-duration: 407ms; }
.page-loader .bar:nth-child(4)  { left: 13px; animation-duration: 458ms; }
.page-loader .bar:nth-child(5)  { left: 17px; animation-duration: 400ms; }
.page-loader .bar:nth-child(6)  { left: 21px; animation-duration: 427ms; }
.page-loader .bar:nth-child(7)  { left: 25px; animation-duration: 441ms; }
.page-loader .bar:nth-child(8)  { left: 29px; animation-duration: 419ms; }
.page-loader .bar:nth-child(9)  { left: 33px; animation-duration: 487ms; }
.page-loader .bar:nth-child(10) { left: 37px; animation-duration: 442ms; }

.pad,
.play-btn,
.bank-btn,
.chip,
.step-btn,
.panel-toggle,
.track-label,
.volume-icon-btn,
.sd-power,
.sd-dice,
.dp-pad,
.dp-handle {
  touch-action: none;
}

:root {
  --fold-duration: 0.45s;
  --fold-easing: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Windows 10 Reveal Highlight：鼠标悬停时 UI 元素出现跟随鼠标的精致描边 */
.pad,
.chip,
.step-btn,
.play-btn,
.panel-toggle,
.toggle,
.bank-btn,
.track-btn,
.dp-pad,
.dp-pill {
  position: relative;
  overflow: hidden;
}

/* 悬停时缓慢浮现的完整描边（底层） */
.pad::before,
.chip::before,
.step-btn::before,
.play-btn::before,
.panel-toggle::before,
.toggle::before,
.bank-btn::before,
.vol-bar::before,
.track-btn::before,
.dp-pad::before,
.dp-pill::before,
.seq-slot.filled::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1.5px solid transparent;
  background: linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.55)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  transform: scale(0.97);
  pointer-events: none;
  z-index: 0;
}

.pad:hover::before,
.chip:hover::before,
.step-btn:hover::before,
.play-btn:hover::before,
.panel-toggle:hover::before,
.toggle:hover::before,
.bank-btn:hover::before,
.vol-bar:hover::before,
.track-btn:hover::before,
.dp-pad:hover::before,
.dp-pill:hover::before,
.seq-slot.filled:hover::before {
  opacity: 1;
  transform: scale(1);
}

/* 悬停时向外弥散的柔和光晕 */
.pad:hover,
.chip:hover,
.step-btn:hover,
.play-btn:hover,
.panel-toggle:hover,
.toggle:hover,
.bank-btn:hover,
.vol-bar:hover,
.track-btn:hover,
.dp-pad:hover,
.dp-pill:hover,
.seq-slot.filled:hover {
  box-shadow: 0 0 34px 8px rgba(255, 255, 255, 0.22);
}

/* 边框锐利高光（贴合 UI 轮廓，光从鼠标/已选中按钮方向扫过；toggle 配合底层描边形成完整圆环） */
.pad::after,
.chip::after,
.step-btn::after,
.play-btn::after,
.panel-toggle::after,
.toggle::after,
.bank-btn::after,
.vol-bar::after,
.track-btn::after,
.dp-pad::after,
.dp-pill::after,
.seq-slot.filled::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1.5px solid transparent;
  background: var(--h-grad, conic-gradient(from 0deg at 50% 50%, rgba(255, 255, 255, 0.95) 0deg, rgba(255, 255, 255, 0.55) 45deg, transparent 90deg, transparent 270deg, rgba(255, 255, 255, 0.55) 315deg, rgba(255, 255, 255, 0.95) 360deg)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: var(--h-opacity, 0);
  transition: opacity 0.08s linear;
  pointer-events: none;
  z-index: 1;
}

/* 音量条使用更细的高光描边和更紧凑的光晕 */
.vol-bar::before,
.vol-bar::after {
  border-width: 0.75px;
}

.vol-bar:hover {
  box-shadow: 0 0 14px 3px rgba(255, 255, 255, 0.25);
}

/* 缩放容器：宽度等于 .app 缩放后的视觉宽度，高度随内容自适应 */
.app-scaler {
  position: relative;
  width: calc(var(--app-width, 1360px) / var(--app-scale, 1));
  height: calc(var(--app-height, 788px) / var(--app-scale, 1));
  overflow: visible;
  flex-shrink: 0;
  transition: width var(--fold-duration) var(--fold-easing);
}

.app {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--app-width, 1360px);
  min-width: 960px;
  height: auto;
  display: flex;
  background: var(--panel);
  overflow: hidden;
  /* 多层阴影营造立体厚度：近处锐利投影 + 中距离轮廓 + 远处漫射 */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    inset 0 -1px 0 rgba(0, 0, 0, 0.45),
    0 2px 0 rgba(0, 0, 0, 0.15),
    0 8px 24px rgba(0, 0, 0, 0.32),
    0 24px 60px var(--shadow),
    0 48px 100px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.6s ease, width var(--fold-duration) var(--fold-easing);
  border-radius: 4px;
  /* 100%~125% 缩放区间内整体等比缩放，保持 UI 物理尺寸一致；超过 125% 不再缩放 */
  zoom: calc(1 / var(--app-scale, 1));
}

.app.loaded {
  opacity: 1;
}

/* 顶部斜面高光 + 底部内阴影，进一步强调外壳厚度 */
.app::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 100;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04) 0%,
    transparent 10%,
    transparent 90%,
    rgba(0, 0, 0, 0.22) 100%
  );
}

.app.collapsed {
  width: 1320px;
  min-width: 900px;
}

/* 左侧主区域 */
.main-area {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 22px 20px 22px 40px;
  gap: 8px;
  z-index: 2;
  transition: padding var(--fold-duration) var(--fold-easing);
}

.app.collapsed .main-area {
  padding: 24px 20px 24px 40px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
}

.top-controls-right {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  align-self: flex-start; /* 与顶栏第一行(Loop/Bank)水平对齐 */
}

.bank-tabs {
  margin-right: 98px; /* 右边缘对齐音序网格右缘： track-volumes(92px) + gap(6px) */
}

.app.collapsed .bank-tabs {
  margin-right: 98px;
}

.top-bpm {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  height: 40px;
  z-index: 20;
}

.bpm-blob {
  display: none;
}

.top-bpm .step-btn,
.top-bpm .bpm-value {
  opacity: 1;
  position: relative;
}

/* 顶部 BPM 加减按钮默认无边框，悬停时显示 Reveal 高光 */
.top-bpm .step-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  font-size: 22px;
  flex-shrink: 0;
  border-color: transparent;
}

.top-bpm .bpm-value {
  font-size: 24px;
  font-weight: 600;
  min-width: 54px;
  text-align: center;
}

.brand {
  transform: translateX(-8px);
  align-self: flex-start; /* 对齐播放按钮行，而非居中整个 transport 高度 */
  margin-top: 4px;
}

.brand h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

.brand span {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.play-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel-light);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.25s ease;
  flex-shrink: 0;
}

/* 播放按钮单独向左微调 1.5px，使播放键与品牌标题视觉对齐；
   其他 .play-btn（restart/clear/record）不共享该负边距，
   保证左侧扬声器孔洞右边缘与录制键右边缘对齐。 */
#playBtn {
  margin-left: -1.5px;
}

.play-btn:hover {
  background: #252525;
}

.play-btn:active {
  transform: scale(0.96);
}

.play-btn.playing {
  background: var(--accent);
  color: var(--panel);
}

.play-btn .pause-icon,
.play-btn .loading-icon {
  display: none;
}

.play-btn.playing .play-icon,
.play-btn.loading .play-icon,
.play-btn.loading .pause-icon {
  display: none;
}

.play-btn.playing .pause-icon {
  display: block;
}

.play-btn.loading .loading-icon {
  display: block;
  animation: spin 1s linear infinite;
}

.play-btn.loading {
  cursor: wait;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 播放按钮播放态：呼吸光晕（opacity 动画，避免 box-shadow 插值） */
.play-btn.playing {
  animation: none;
  box-shadow: 0 0 16px 3px rgba(255, 255, 255, 0.28);
}

.play-btn.playing::before {
  background: none;
  border: none;
  -webkit-mask: none;
  mask: none;
  opacity: 0;
  transform: scale(1);
  box-shadow: 0 0 32px 9px rgba(255, 255, 255, 0.48);
  animation: play-breathe-opacity 1.6s ease-in-out infinite;
}

.play-btn::before {
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.play-btn::after {
  transition: opacity 0.7s ease;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 20px;
  border: 1px solid transparent;
  background: transparent;
}

.volume-icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: transform 0.1s;
}

.volume-icon-btn:active {
  transform: scale(0.96);
}

/* 非 pad 按钮统一按下反馈 */
.chip:active,
.step-btn:active,
.play-btn:active,
.panel-toggle:active,
.bank-btn:active,
.volume-icon-btn:active {
  transform: scale(0.96);
}

.toggle:active .toggle-slider {
  transform: scale(0.96);
}

.volume-icon {
  display: block;
  overflow: visible;
}

.volume-icon path,
.volume-icon line {
  vector-effect: non-scaling-stroke;
}

.vol-wave {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.volume-control.level-1 .vol-wave-1,
.volume-control.level-2 .vol-wave-1,
.volume-control.level-2 .vol-wave-2,
.volume-control.level-3 .vol-wave-1,
.volume-control.level-3 .vol-wave-2,
.volume-control.level-3 .vol-wave-3 {
  opacity: 1;
}

.volume-muted {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.volume-control.muted .volume-muted {
  opacity: 1;
}

.volume-control.muted .vol-wave {
  opacity: 0;
}

.volume-control.muted {
  color: #666;
}

.volume-control .master-vol-track {
  width: 100px;
  height: 18px;
  display: flex;
  align-items: center;
  cursor: pointer;
  opacity: 1;
  transform: none;
}

.bpm-value {
  width: 54px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  -moz-appearance: textfield;
}

.bpm-value::-webkit-outer-spin-button,
.bpm-value::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.bpm-value:focus {
  outline: 1px solid var(--border);
  border-radius: 6px;
}

/* Bank 区：上下两行——第 1 行 bank 按钮（A B +），第 2 行播放序列槽位（O O +） */
.bank-tabs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* 提升层叠级：接龙槽位的呼吸光晕/悬停光晕下溢时不被后面的音频可视化面板遮挡 */
  position: relative;
  z-index: 30;
  align-items: flex-end;
  flex-shrink: 0;
}

.bank-col {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

/* bank 行右侧小标题（Loop / Bank）：与下方接龙播放钮同宽（40px），不另加 margin，
   以保证两排在右锚定时逐列上下对齐（margin-left 会把第一行整体左移而与下方错位） */
.bank-row-caption {
  width: 40px;
  margin-left: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
  text-align: center;
  color: var(--text-muted);
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}

/* 预留第一行高度：无 Loop/Bank 按钮时也保持与有按钮时一致的间隔（避免布局跳动） */
.bank-col-list {
  min-height: 40px;
}

/* 第 2 行槽位容器（接龙播放按钮之后的槽位 + 加号） */
.seq-slots-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

/* “+” 新增按钮（bank / 槽位） */
.bank-add,
.slot-add {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
}

.bank-add:hover:not(:disabled),
.slot-add:hover:not(:disabled) {
  color: var(--text);
  border-color: #444;
}

.bank-add:disabled,
.slot-add:disabled {
  opacity: 0.35;
  cursor: default;
}

/* 播放序列槽位圆（默认空心，可拖入 / 点选 bank） */
.seq-slot {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s, box-shadow 0.2s;
}

.seq-slot.filled {
  border-style: solid;
  border-color: var(--border);
  background: #242424;
  color: var(--text);
}

.seq-slot.pick-target {
  border-color: #fff;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.seq-slot.drop-hover {
  border-color: #fff;
}

.slot-add.drop-hover {
  color: #fff;
  border-color: #fff;
  border-style: solid;
}

/* 播放中当前序列槽位呼吸动画 */
@keyframes seq-breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5); transform: scale(1); }
  50% { box-shadow: 0 0 14px 4px rgba(255, 255, 255, 0.35); transform: scale(1.08); }
}
.seq-slot.playing-current {
  border-color: #fff;
  color: #fff;
  animation: seq-breathe 1.2s ease-in-out infinite;
}

/* 重复次数小圆点：贴底部居中、横向排列 */
.slot-repdots {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: row;
  gap: 3px;
  align-items: center;
  pointer-events: none;
}

.rep-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 3px rgba(255, 255, 255, 0.85);
}

.rep-num {
  font-size: 9px;
  line-height: 1;
  color: #fff;
}

.bank-btn.dragging {
  opacity: 0.5;
}

/* 拖动重排中的圆形按钮（序列槽 / bank 钮 / “+”）：半透明提示正在搬动 */
.seq-slot.dragging,
.bank-btn.dragging,
.dp-slot-add.dragging {
  opacity: 0.4;
}

/* 长按起拖时跟随手指的圆形拖拽层（仅圆形，无方形容器框） */
.seq-slot,
.bank-btn,
.dp-slot-add {
  touch-action: none; /* 防止触屏拖拽时浏览器平移手势抢走 pointermove */
}
.dp-drag-ghost {
  position: fixed;
  z-index: 9999;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: var(--panel-light);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  opacity: 0.95;
}

.bank-btn.pickable {
  cursor: copy;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

/* 播放控制：2×2 网格（播放 重播 / 清除 录制）*/
.transport-cluster {
  display: grid;
  grid-template-columns: auto 76px;
  /* 与 transport-grid 行尺寸一致：40px 行高 + 8px 间距 */
  grid-template-rows: repeat(2, 40px);
  column-gap: 6px;
  row-gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.transport-grid {
  grid-column: 1;
  grid-row: 1 / -1; /* 占满两行 */
  display: grid;
  grid-auto-flow: row;
  grid-template-columns: repeat(2, 40px);
  grid-template-rows: repeat(2, 40px);
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.bank-btn {
  position: relative; /* 作为 Reveal 光环 ::after 的定位基准（inset:0 紧跟按钮，不泄到外层） */
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #242424;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, box-shadow 0.25s ease, transform 0.1s;
  flex-shrink: 0;
}

/* Loop bank 单元格：按钮 + 悬停显示的删除角标 */
.bank-cell {
  position: relative;
  display: inline-flex;
}
.bank-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #ff4d4f;
  color: #141414;
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.bank-cell:hover .bank-del {
  display: inline-flex;
}
.app.dp-coarse .bank-del {
  display: inline-flex;
}

.bank-btn:hover {
  color: var(--text);
  border-color: #444;
}

.bank-btn.active {
  color: #141414;
  background: #ffffff;
  border-color: #ffffff;
  animation: none;
  box-shadow: none;
  overflow: hidden;
}

.bank-btn.active::before,
.bank-btn.active::after {
  opacity: 0;
}

.bank-btn::before {
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.bank-btn::after {
  transition: opacity 0.7s ease;
}

/* 舞台显示区：音频频谱，左边缘对齐第一列 pad（跳过 80px 标签列 + 6px 间距），
   右边缘对齐鼓盘网格右缘（扣除 track-volumes 80px + gap 6px）。
   凹陷屏幕：基础色比机身更深 + 顶部内阴影，制造"嵌入设备"的深度 */
.display-stage {
  position: relative;
  height: 110px;
  width: calc(100% - 184px);
  margin-left: 86px;
  background: #0d0d0e;
  overflow: hidden;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  box-shadow:
    inset 0 1px 0 rgba(0, 0, 0, 0.85),
    inset 0 12px 24px rgba(0, 0, 0, 0.55);
}

/* 屏幕表面质感：CRT 扫描线 + 顶部玻璃高光（覆盖在频谱之上，不拦截交互） */
.display-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.028) 0px,
      rgba(255, 255, 255, 0.028) 1px,
      transparent 1px,
      transparent 3px
    ),
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.055) 0%,
      rgba(255, 255, 255, 0.028) 4%,
      transparent 26%
    );
}

.spectrum-canvas {
  flex: 1 1 auto;
  min-width: 0; /* 防止画布按固有宽度撑破布局，把右侧扬声器挤出容器 */
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

/* 频谱面板不再显示播放头：进度反馈保留在 pad/beat 区域，避免重复视觉信息 */
.playhead-bar {
  display: none;
}

/* 待机态：底部基线呼吸 + 扫描光带（纯 CSS，无需音频初始化），
   播放时整层淡出（is-idle 由 script.js 在 start/stop 时切换） */
.screen-idle {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.display-stage.is-idle .screen-idle {
  opacity: 1;
}

.screen-idle::before {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 21px;
  height: 1px;
  background: rgba(255, 255, 255, 0.16);
  animation: screen-idle-breathe 4.6s ease-in-out infinite;
}

.screen-idle::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 26%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.028) 38%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.028) 62%,
    transparent 100%
  );
  animation: screen-idle-sweep 7.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  will-change: transform;
}

@keyframes screen-idle-breathe {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

/* -110% 与 385%：光带（26% 宽）完全移出容器左右边缘，首尾各留约 0.9s 停顿 */
@keyframes screen-idle-sweep {
  0%, 12% { transform: translateX(-110%); }
  88%, 100% { transform: translateX(385%); }
}

@media (prefers-reduced-motion: reduce) {
  .screen-idle::before,
  .screen-idle::after {
    animation: none;
  }
  .screen-idle::before {
    opacity: 0.7;
  }
  .screen-idle::after {
    opacity: 0;
  }
}

/* 底部拍号标记 */
.beat-markers {
  position: relative;
  display: grid;
  grid-template-columns: 80px repeat(16, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
  justify-items: center;
  width: calc(100% - 98px);
  margin-top: 8px;
  container-type: inline-size;
}

.beat-spacer {
  grid-column: 1;
}

/* 拍号标记：最大 40×40 圆形可点击区，与播放按钮大小一致；
   窗口缩窄时随网格单元等比缩小，避免溢出或重叠 */
.beat-marker {
  width: min(40px, 100%);
  aspect-ratio: 1 / 1;
  max-width: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.3s ease, transform 0.3s ease, text-shadow 0.3s ease;
}

.beat-number {
  text-align: center;
  font-size: clamp(10px, 1.9cqi, 14px);
  font-weight: 600;
  color: var(--text-muted);
}

.beat-number:hover {
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
  transform: scale(1.2);
}

.beat-dot {
  position: relative;
}

.beat-dot::before {
  content: "";
  width: clamp(3px, 0.68cqi, 5px);
  height: clamp(3px, 0.68cqi, 5px);
  border-radius: 50%;
  background: #666;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.beat-dot.active::before {
  background: #fff;
  box-shadow: 0 0 8px 1px rgba(255, 255, 255, 0.85);
  transform: scale(1.25);
}

.beat-dot:hover::before {
  background: #fff;
  box-shadow: 0 0 4px 1px rgba(255, 255, 255, 0.6);
  transform: scale(1.2);
}

/* 拍号设置 */
.time-sig {
  position: absolute;
  left: 50%;
  bottom: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 40px;
  color: var(--text);
  transform: translate(-50%, 60px);
}

.time-sig input {
  width: 30px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 4px;
  color: inherit;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.time-sig input::-webkit-outer-spin-button,
.time-sig input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.time-sig input:hover {
  background: rgba(255, 255, 255, 0.08);
}

.time-sig input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
  cursor: text;
}

.time-sig-slash {
  font-size: 22px;
  font-weight: 700;
  color: currentColor;
  pointer-events: none;
}

.accent-title {
  grid-column: 1;
  justify-self: end;
  align-self: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  padding: 2px 8px 2px 2px;
  white-space: nowrap;
  pointer-events: none;
  transform: translateY(-2px);
}

.beat-number.accent-number {
  color: var(--text-muted);
  text-shadow: none;
  transform: scale(1);
}

.beat-number.accent-number:hover {
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
  transform: scale(1.2);
}

/* 重音数字播放动画：从前一列开始，到后两列结束，非线性慢-快-慢 */
@keyframes beat-pop {
  0% {
    transform: scale(0.95) rotate(-1deg);
    color: var(--text-muted);
    text-shadow: none;
    animation-timing-function: cubic-bezier(0.4, 0, 0.8, 1);
  }
  50% {
    transform: scale(2.05) rotate(3deg);
    color: #fff;
    text-shadow: 0 0 18px rgba(255, 255, 255, 1);
    animation-timing-function: cubic-bezier(0.2, 0, 0.6, 1);
  }
  100% {
    transform: scale(1.7) rotate(2deg);
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  }
}

.beat-number.active {
  animation: beat-pop var(--beat-accent-duration, 1.4s) forwards;
}

/* 拍号离开当前列时的缩小、暗淡、旋转回正效果 */
.beat-number.beat-leave {
  animation: beat-leave 0.35s ease forwards;
}

@keyframes beat-leave {
  0% {
    transform: scale(1.7) rotate(2deg);
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  }
  100% {
    transform: scale(1) rotate(0deg);
    color: var(--text-muted);
    text-shadow: none;
  }
}

/* 关闭光效时重音数字离开动画，保留缩放但无光晕 */
.beat-number.beat-leave-no-glow {
  animation: beat-leave-no-glow 0.35s ease forwards;
}

@keyframes beat-leave-no-glow {
  0% {
    transform: scale(1.7) rotate(2deg);
    color: #fff;
    text-shadow: none;
  }
  100% {
    transform: scale(1) rotate(0deg);
    color: var(--text-muted);
    text-shadow: none;
  }
}

/* 次强拍：放大和光晕幅度更小 */
@keyframes beat-pop-weak {
  0% {
    transform: scale(1) rotate(0deg);
    color: var(--text-muted);
    text-shadow: none;
  }
  60% {
    transform: scale(1.45) rotate(3deg);
    color: #fff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.85);
  }
  100% {
    transform: scale(1.35) rotate(2deg);
    color: #fff;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
  }
}

@keyframes beat-breathe-weak {
  0%, 100% {
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
    transform: scale(1.35) rotate(2deg);
  }
  50% {
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.75);
    transform: scale(1.4) rotate(3deg);
  }
}

@keyframes beat-leave-weak {
  0% {
    transform: scale(1.35) rotate(2deg);
    color: #fff;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
  }
  100% {
    transform: scale(1) rotate(0deg);
    color: var(--text-muted);
    text-shadow: none;
  }
}

.beat-number.weak.active {
  animation: beat-pop-weak 0.35s ease forwards, beat-breathe-weak 1.4s ease-in-out 0.35s infinite;
}

.beat-number.weak.beat-leave {
  animation: beat-leave-weak 0.3s ease forwards;
}

.motion-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.9), transparent 60%);
  mix-blend-mode: overlay;
  pointer-events: none;
  transition: opacity 0.1s;
  z-index: 6; /* 原本被不透明频谱画布遮挡，显式置于屏幕纹理之上（回归修复） */
}

.motion-layer.on {
  opacity: 0.12; /* 逐拍脉冲：压低强度避免频闪，保留呼吸感 */
}

/* 音序器 */
.sequencer {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 6px;
  contain: layout style;
}

/* 固定通道名列（不随合并时间线滚动） */
.seq-labels {
  flex: 0 0 80px;
  display: grid;
  grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
  z-index: 5;
}

/* 可滚动网格列：合并时间线下横向滚动，pad 在通道名右侧被立即裁剪。
   非合并模式用 overflow: visible，让边缘 pad 的光晕能溢出网格边界
   （box-shadow + glow-canvas bleed 都需要不被截断） */
.seq-scroll {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: visible;
}

.app.merged .seq-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) rgba(255, 255, 255, 0.04);
}

.seq-grid {
  display: grid;
  grid-template-columns: repeat(16, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
  min-height: 100%;
}

.app.merged .seq-grid {
  grid-template-columns: repeat(16, 46px);
}

/* 合并时间线：标签行与固定 46px 的 pad 行完全对齐（滚动条占用高度不影响） */
.app.merged .seq-labels {
  grid-template-rows: repeat(8, 46px);
}

.track-label {
  font-size: 12px;
  color: var(--text);
  text-align: right;
  padding: 8px 8px 8px 2px;
  white-space: nowrap;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  font-family: inherit;
}

.track-label:hover {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.35), 0 0 12px rgba(255, 255, 255, 0.18);
}

.track-label:active {
  transform: scale(0.96);
}

.track-label[aria-expanded="true"] {
  opacity: 0;
  background: transparent;
  border-color: transparent;
}

/* Channel selector morph dropdown */
.channel-morph {
  position: fixed;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--panel-light);
  border: 1px solid transparent;
  overflow: hidden;
  z-index: 100;
  transition:
    width 350ms cubic-bezier(0.34, 1.25, 0.64, 1),
    height 350ms cubic-bezier(0.34, 1.25, 0.64, 1),
    top 350ms cubic-bezier(0.34, 1.25, 0.64, 1),
    left 350ms cubic-bezier(0.34, 1.25, 0.64, 1),
    border-radius 350ms cubic-bezier(0.34, 1.25, 0.64, 1),
    border-color 200ms ease,
    box-shadow 200ms ease;
}

.channel-morph > :not(.morph-menu),
.channel-morph > :not(.morph-menu) * {
  --h-opacity: 0 !important;
}

.channel-morph[data-open="true"] {
  border-color: var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.app:not(.lighting-off) .channel-morph[data-open="true"] {
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow:
    0 0 34px 8px rgba(255, 255, 255, 0.22),
    0 8px 24px rgba(0, 0, 0, 0.45);
}

.morph-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  opacity: 1;
  filter: blur(0);
  pointer-events: none;
  transition: opacity 150ms ease, filter 150ms ease;
}

.channel-morph[data-open="true"] .morph-label {
  opacity: 0;
  filter: blur(2px);
}

.morph-menu {
  position: absolute;
  inset: 0;
  padding: 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 8px;
  opacity: 0;
  transform: translateX(20px) scale(0.97);
  filter: blur(2px);
  pointer-events: none;
  transition:
    opacity 200ms ease,
    transform 350ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 200ms ease;
}

.morph-menu::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 2px;
  background: var(--h-grad);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: var(--h-opacity, 0);
  transition: opacity 0.18s ease;
  pointer-events: none;
  z-index: 1;
}

.channel-morph[data-open="true"] .morph-menu {
  opacity: 1;
  transform: translateX(0) scale(1);
  filter: blur(0);
  pointer-events: auto;
}

.morph-option {
  padding: 10px;
  font-size: 12px;
  line-height: 12px;
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.morph-option:hover {
  background: rgba(255, 255, 255, 0.12);
}

.morph-option[aria-selected="true"] {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.pad {
  position: relative;
  aspect-ratio: 1 / 1;
  min-width: 0;
  background: var(--pad);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.1s, transform 0.06s;
}

.pad::before {
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.pad::after {
  transition: opacity 0.08s linear;
}

.pad:hover {
  background: var(--pad-hover);
}

.pad:active {
  transform: scale(0.92);
}

/* Pad hover glow: separate element animated via opacity only, avoiding box-shadow interpolation cost */
.pad-hover-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.22) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  z-index: 0;
}

/* pad 内部不显示光晕，只保留边框外的 box-shadow 光晕 */
.pad:hover .pad-hover-glow {
  opacity: 0;
}

/* KEYLIGHT and lighting-off use their own hover treatments; hide the Aura hover glow layer */
.app[data-lighting-scheme="keylight"] .pad-hover-glow,
.app.lighting-off .pad-hover-glow {
  display: none;
}

/* Pad layer indicator: hidden by default, only shown in KEYLIGHT */
.pad-layer-marker {
  display: none;
}

.pad.active {
  background: var(--pad-active);
  box-shadow: 0 0 26px 6px rgba(255, 255, 255, calc(0.32 * var(--layer-ratio, 1)));
}

/* Accent burst glow is rendered on a single canvas overlay instead of per-pad DOM shadows */
.glow-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

.pad.current {
  outline: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--pad-current);
}

.pad.current.active {
  background: var(--pad-current);
}

/* 已选中的非 pad 按钮常驻保留光晕 */
.chip.active,
.play-btn.playing,
.track-btn.active {
  box-shadow: 0 0 18px 3px rgba(255, 255, 255, 0.2);
}

/* KEYLIGHT: 硬件键盘背光风，内敛顶部高光 + 内部微光 */
.app[data-lighting-scheme="keylight"] {
  --keylight-edge: rgba(255, 255, 255, 0.42);
  --keylight-core: rgba(255, 255, 255, 0.10);
  --keylight-active: rgba(255, 255, 255, 0.18);
}

/* 禁用 Reveal Highlight 伪元素 */
.app[data-lighting-scheme="keylight"] .pad::before,
.app[data-lighting-scheme="keylight"] .chip::before,
.app[data-lighting-scheme="keylight"] .step-btn::before,
.app[data-lighting-scheme="keylight"] .play-btn::before,
.app[data-lighting-scheme="keylight"] .panel-toggle::before,
.app[data-lighting-scheme="keylight"] .toggle::before,
.app[data-lighting-scheme="keylight"] .bank-btn::before,
.app[data-lighting-scheme="keylight"] .vol-bar::before,
.app[data-lighting-scheme="keylight"] .track-btn::before,
.app[data-lighting-scheme="keylight"] .pad::after,
.app[data-lighting-scheme="keylight"] .chip::after,
.app[data-lighting-scheme="keylight"] .step-btn::after,
.app[data-lighting-scheme="keylight"] .play-btn::after,
.app[data-lighting-scheme="keylight"] .panel-toggle::after,
.app[data-lighting-scheme="keylight"] .toggle::after,
.app[data-lighting-scheme="keylight"] .bank-btn::after,
.app[data-lighting-scheme="keylight"] .vol-bar::after,
.app[data-lighting-scheme="keylight"] .track-btn::after {
  display: none;
}

/* Hover: 内敛顶部高光 + 内部微光 */
.app[data-lighting-scheme="keylight"] .pad:hover,
.app[data-lighting-scheme="keylight"] .chip:hover,
.app[data-lighting-scheme="keylight"] .step-btn:hover,
.app[data-lighting-scheme="keylight"] .play-btn:hover,
.app[data-lighting-scheme="keylight"] .panel-toggle:hover,
.app[data-lighting-scheme="keylight"] .bank-btn:hover,
.app[data-lighting-scheme="keylight"] .vol-bar:hover,
.app[data-lighting-scheme="keylight"] .track-btn:hover {
  box-shadow: inset 0 1px 0 var(--keylight-edge), inset 0 0 14px var(--keylight-core);
}

/* Active/selected：更强的内部光 + 极小外轮廓 */
.app[data-lighting-scheme="keylight"] .chip.active,
.app[data-lighting-scheme="keylight"] .play-btn.playing,
.app[data-lighting-scheme="keylight"] .bank-btn.active,
.app[data-lighting-scheme="keylight"] .track-btn.active {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 0 18px var(--keylight-active), 0 0 8px rgba(255, 255, 255, 0.08);
}

/* KEYLIGHT: hide pad layer markers */
.app[data-lighting-scheme="keylight"] .pad-layer-marker {
  display: none !important;
}

/* 限制每个 pad 的重绘区域，快速滑动鼠标时避免整片网格反复重绘 */
.app[data-lighting-scheme="keylight"] .pad {
  contain: layout paint;
}

/* Pad active：用 inset glow 替代外发光，按层使用色温 */
.app[data-lighting-scheme="keylight"] .pad.active {
  background: var(--pad-active);
  box-shadow: inset 0 0 20px var(--keylight-active), inset 0 1px 0 var(--keylight-edge);
}

.app[data-lighting-scheme="keylight"] .pad.active.layer-1 { background: var(--pad-layer-1); box-shadow: inset 0 0 20px var(--pad-glow-1), inset 0 1px 0 var(--keylight-edge); }
.app[data-lighting-scheme="keylight"] .pad.active.layer-2 { background: var(--pad-layer-2); box-shadow: inset 0 0 20px var(--pad-glow-2), inset 0 1px 0 var(--keylight-edge); }
.app[data-lighting-scheme="keylight"] .pad.active.layer-3 { background: var(--pad-layer-3); box-shadow: inset 0 0 20px var(--pad-glow-3), inset 0 1px 0 var(--keylight-edge); }

.app[data-lighting-scheme="keylight"] .pad.active.layer-1 .pad-layer-marker { color: var(--pad-layer-1); }
.app[data-lighting-scheme="keylight"] .pad.active.layer-2 .pad-layer-marker { color: var(--pad-layer-2); }
.app[data-lighting-scheme="keylight"] .pad.active.layer-3 .pad-layer-marker { color: var(--pad-layer-3); }

.app[data-lighting-scheme="keylight"] .pad.current {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.app[data-lighting-scheme="keylight"] .pad.current.active {
  box-shadow: inset 0 0 20px var(--keylight-active), inset 0 1px 0 var(--keylight-edge), inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}
.app[data-lighting-scheme="keylight"] .pad.current.active.layer-1 { background: var(--pad-layer-1); box-shadow: inset 0 0 20px var(--pad-glow-1), inset 0 1px 0 var(--keylight-edge), inset 0 0 0 1px rgba(255, 255, 255, 0.22); }
.app[data-lighting-scheme="keylight"] .pad.current.active.layer-2 { background: var(--pad-layer-2); box-shadow: inset 0 0 20px var(--pad-glow-2), inset 0 1px 0 var(--keylight-edge), inset 0 0 0 1px rgba(255, 255, 255, 0.22); }
.app[data-lighting-scheme="keylight"] .pad.current.active.layer-3 { background: var(--pad-layer-3); box-shadow: inset 0 0 20px var(--pad-glow-3), inset 0 1px 0 var(--keylight-edge), inset 0 0 0 1px rgba(255, 255, 255, 0.22); }

/* 拍号：更克制的 hover/active */
.app[data-lighting-scheme="keylight"] .beat-number:hover,
.app[data-lighting-scheme="keylight"] .beat-number.accent-number:hover {
  text-shadow: none;
  color: #fff;
}

.app[data-lighting-scheme="keylight"] .beat-dot.active::before {
  box-shadow: inset 0 0 4px 1px rgba(255, 255, 255, 0.9);
}

.app[data-lighting-scheme="keylight"] .beat-dot:hover::before {
  box-shadow: inset 0 0 3px 1px rgba(255, 255, 255, 0.7);
}

/* 拍号 active：保留缩放但去除 text-shadow 光晕 */
.app[data-lighting-scheme="keylight"] .beat-number.active {
  animation: beat-pop-no-glow var(--beat-accent-duration, 1.4s) forwards;
}

.app[data-lighting-scheme="keylight"] .beat-number.weak.active {
  animation: beat-pop-weak-no-glow 0.35s ease forwards, beat-breathe-weak-no-glow 1.4s ease-in-out 0.35s infinite;
}

.app[data-lighting-scheme="keylight"] .beat-number.beat-leave {
  animation: beat-leave-no-glow 0.35s ease forwards;
}

.app[data-lighting-scheme="keylight"] .beat-number.weak.beat-leave {
  animation: beat-leave-weak-no-glow 0.3s ease forwards;
}

/* 音量条：拖拽时内部光 */
.app[data-lighting-scheme="keylight"] .vol-track.dragging .vol-bar {
  box-shadow: inset 0 0 12px var(--keylight-active), inset 0 1px 0 var(--keylight-edge);
}

.app[data-lighting-scheme="keylight"] .vol-fill {
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.25);
}

.app[data-lighting-scheme="keylight"] .vol-thumb {
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.4);
}

/* 移除呼吸动画 */
.app[data-lighting-scheme="keylight"] .play-btn.playing,
.app[data-lighting-scheme="keylight"] .bank-btn.active {
  animation: none;
}

/* Motion layer 在 KEYLIGHT 下隐藏 */
.app[data-lighting-scheme="keylight"] .motion-layer {
  display: none;
}

/* Lighting effects 关闭时：隐藏所有装饰性光晕与描边，保留背景色等功能态 */
.app.lighting-off .pad:hover,
.app.lighting-off .chip:hover,
.app.lighting-off .step-btn:hover,
.app.lighting-off .play-btn:hover,
.app.lighting-off .panel-toggle:hover,
.app.lighting-off .toggle:hover,
.app.lighting-off .bank-btn:hover,
.app.lighting-off .vol-bar:hover,
.app.lighting-off .track-btn:hover,
.app.lighting-off .vol-track.dragging .vol-bar {
  box-shadow: none;
}

.app.lighting-off .pad:hover::before,
.app.lighting-off .chip:hover::before,
.app.lighting-off .step-btn:hover::before,
.app.lighting-off .play-btn:hover::before,
.app.lighting-off .panel-toggle:hover::before,
.app.lighting-off .toggle:hover::before,
.app.lighting-off .bank-btn:hover::before,
.app.lighting-off .vol-bar:hover::before,
.app.lighting-off .track-btn:hover::before,
.app.lighting-off .vol-track.dragging .vol-bar::before,
.app.lighting-off .vol-track.dragging .vol-bar::after,
.app.lighting-off .pad.active,
.app.lighting-off .chip.active,
.app.lighting-off .play-btn.playing,
.app.lighting-off .bank-btn.active,
.app.lighting-off .track-btn.active {
  box-shadow: none;
}

.app.lighting-off .play-btn.playing,
.app.lighting-off .bank-btn.active {
  animation: none;
}

.app.lighting-off .beat-dot.active::before {
  box-shadow: none;
}

.app.lighting-off .beat-dot:hover::before,
.app.lighting-off .beat-number:hover,
.app.lighting-off .beat-number.accent-number:hover {
  box-shadow: none;
  text-shadow: none;
}

.app.lighting-off .pad-layer-marker {
  display: none !important;
}

.app.lighting-off .beat-number.active {
  animation: beat-pop-no-glow var(--beat-accent-duration, 1.4s) forwards;
}

@keyframes beat-pop-no-glow {
  0% {
    transform: scale(0.95) rotate(-1deg);
    color: var(--text-muted);
    text-shadow: none;
    animation-timing-function: cubic-bezier(0.4, 0, 0.8, 1);
  }
  50% {
    transform: scale(1.95) rotate(3deg);
    color: #fff;
    text-shadow: none;
    animation-timing-function: cubic-bezier(0.2, 0, 0.6, 1);
  }
  100% {
    transform: scale(1.7) rotate(2deg);
    color: #fff;
    text-shadow: none;
  }
}

.app.lighting-off .beat-number.weak.active {
  animation: beat-pop-weak-no-glow 0.35s ease forwards, beat-breathe-weak-no-glow 1.4s ease-in-out 0.35s infinite;
}

@keyframes beat-pop-weak-no-glow {
  0% {
    transform: scale(1) rotate(0deg);
    color: var(--text-muted);
    text-shadow: none;
  }
  60% {
    transform: scale(1.45) rotate(3deg);
    color: #fff;
    text-shadow: none;
  }
  100% {
    transform: scale(1.35) rotate(2deg);
    color: #fff;
    text-shadow: none;
  }
}

@keyframes beat-breathe-weak-no-glow {
  0%, 100% {
    text-shadow: none;
    transform: scale(1.35) rotate(2deg);
  }
  50% {
    text-shadow: none;
    transform: scale(1.4) rotate(3deg);
  }
}

/* 音序器 + 每轨音量条容器 */
.sequencer-area {
  display: flex;
  gap: 6px;
  align-items: stretch;
  justify-content: flex-end;
  width: 100%;
  min-height: 0;
  transition:
    gap var(--fold-duration) var(--fold-easing),
    width var(--fold-duration) var(--fold-easing);
}

.app.collapsed .beat-markers {
  width: calc(100% - 98px);
}

.app.collapsed .sequencer-area {
  width: 100%;
}

.sequencer {
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.track-volumes {
  position: relative;
  display: grid;
  grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: 6px;
  width: 92px;
  padding: 0 4px;
  opacity: 1;
  pointer-events: auto;
  overflow: visible;
  border-radius: 3px;
}

.track-mixer {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 4px;
  height: 100%;
  min-height: 0;
  transform: translateZ(0);
}

.track-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  width: 100%;
}

.track-btn {
  flex: 1 1 auto;
  height: 24px;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #242424;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.25s ease, transform 0.1s;
  text-align: center;
}

.track-btn:not(.active):not(:disabled):hover {
  border-color: #444;
  color: var(--text);
}

.track-btn:not(:disabled):active {
  transform: scale(0.96);
}

/* M/S 按钮悬停光效：高光描边贴合内轮廓（4px 外圆角 - 1px 边框 = 3px 内圆角），
   消除按钮边框与高光描边之间的空隙 */
.track-btn:hover {
  box-shadow: 0 0 16px 4px rgba(255, 255, 255, 0.22);
}

.track-btn::before,
.track-btn::after {
  border-width: 0.75px;
  border-radius: 3px;
}

.track-btn.active {
  background: var(--accent);
  color: var(--panel);
  border-color: var(--accent);
  font-weight: 500;
  box-shadow: 0 0 18px 3px rgba(255, 255, 255, 0.2);
}

/* 被 solo 联动禁用的 M 按钮仍保持 active 视觉 */
.track-btn.active:disabled {
  opacity: 1;
  background: var(--accent);
  color: var(--panel);
  border-color: var(--accent);
}

/* 被 solo 排除的轨道：音量条变灰、音量显示为 0 */
.vol-track.dimmed .vol-bar {
  background: rgba(255, 255, 255, 0.15);
}

.vol-track.dimmed .vol-fill {
  width: 0 !important;
  background: rgba(255, 255, 255, 0.35);
  box-shadow: none;
}

.vol-track.dimmed .vol-thumb {
  left: 0% !important;
  background: rgba(255, 255, 255, 0.35);
  box-shadow: none;
}

.vol-track {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  width: 100%;
  height: 18px;
  cursor: pointer;
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 0.35s ease calc(var(--i) * 55ms),
    transform 0.35s ease calc(var(--i) * 55ms);
}

.vol-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 1.5px;
  position: relative;
  transition: height 0.25s ease, border-radius 0.25s ease, box-shadow 0.25s ease;
}

.vol-track:hover .vol-bar,
.vol-track.dragging .vol-bar {
  height: 6px;
  border-radius: 3px;
}

.vol-track.dragging .vol-bar {
  box-shadow: 0 0 18px 4px rgba(255, 255, 255, 0.32);
}

.vol-track.dragging .vol-bar::before,
.vol-track.dragging .vol-bar::after {
  opacity: 1;
  transform: scale(1);
}

.vol-track.dragging .vol-thumb {
  width: 10px;
  height: 10px;
  margin-left: -5px;
  margin-top: -5px;
}

.vol-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  background: #fff;
  border-radius: inherit;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.3);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--i, 0) * 55ms + 0.12s);
}

.master-vol-track .vol-fill {
  transition-delay: 0s;
}

.vol-track.dragging .vol-fill,
.vol-track.dragging .vol-thumb {
  transition: none;
}

.app:not(.collapsed) .vol-fill {
  width: var(--level, 80%);
}

.vol-thumb {
  position: absolute;
  left: var(--level, 80%);
  top: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  margin-top: -3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
  pointer-events: none;
  transition: left 0.45s cubic-bezier(0.22, 1, 0.36, 1), width 0.25s ease, height 0.25s ease, margin 0.25s ease;
}

.vol-track:hover .vol-thumb {
  width: 10px;
  height: 10px;
  margin-left: -5px;
  margin-top: -5px;
}

/* 右侧设置面板 */
.settings {
  position: relative;
  box-sizing: border-box;
  width: 240px;
  min-width: 240px;
  flex-shrink: 0;
  z-index: 1;
  background: var(--panel-light);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow: hidden;
  opacity: 1;
  transform: scale(1);
  transform-origin: center center;
  will-change: width, opacity, transform;
  border-radius: 0 4px 4px 0;
}

@keyframes settings-collapse {
  0% {
    width: 240px;
    min-width: 240px;
    opacity: 1;
    transform: scale(1);
    border-color: var(--border);
  }
  45% {
    width: 240px;
    min-width: 240px;
    opacity: 1;
    transform: scale(1.05);
    border-color: var(--border);
  }
  100% {
    width: 0;
    min-width: 0;
    opacity: 0;
    transform: scale(1.05);
    border-color: transparent;
  }
}

@keyframes settings-expand {
  0% {
    width: 0;
    min-width: 0;
    opacity: 0;
    transform: scale(1.05);
    border-color: transparent;
  }
  55% {
    width: 240px;
    min-width: 240px;
    opacity: 1;
    transform: scale(1.05);
    border-color: var(--border);
  }
  100% {
    width: 240px;
    min-width: 240px;
    opacity: 1;
    transform: scale(1);
    border-color: var(--border);
  }
}

.app.animate-settings.collapsed .settings {
  animation: settings-collapse 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.app.animate-settings:not(.collapsed) .settings {
  animation: settings-expand 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.settings-inner {
  width: 240px;
  padding: 72px 14px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100%;
  opacity: 1;
  will-change: opacity;
  transition: opacity var(--fold-duration) var(--fold-easing);
}

.app.collapsed .settings-inner {
  opacity: 0;
}

.settings-header,
.setting-row,
.setting-section {
  opacity: 0;
  transform: translateX(18px);
  will-change: transform, opacity;
  transition:
    opacity 0.35s var(--fold-easing),
    transform 0.35s var(--fold-easing);
}

.app:not(.collapsed) .settings-header { opacity: 1; transform: translateX(0); transition-delay: 0.05s; }
.app:not(.collapsed) .setting-row      { opacity: 1; transform: translateX(0); transition-delay: 0.12s; }
.app:not(.collapsed) .setting-section:nth-of-type(1) { opacity: 1; transform: translateX(0); transition-delay: 0.19s; }
.app:not(.collapsed) .setting-section:nth-of-type(2) { opacity: 1; transform: translateX(0); transition-delay: 0.26s; }
.app:not(.collapsed) .setting-section:nth-of-type(3) { opacity: 1; transform: translateX(0); transition-delay: 0.33s; }
.app:not(.collapsed) .setting-section:nth-of-type(4) { opacity: 1; transform: translateX(0); transition-delay: 0.40s; }

.settings-header {
  position: absolute;
  top: 36px;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 12px;
  pointer-events: none;
}

.app.collapsed .settings-header {
  top: 38px;
}

.settings-header h2 {
  font-size: 16px;
  font-weight: 500;
  line-height: 16px;
  text-align: left;
}

.panel-toggle {
  position: absolute;
  top: 78px; /* 顶部扬声器条 + 2×2 控制区垂直居中 */
  right: 252px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--panel-light);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: right var(--fold-duration) var(--fold-easing),
              background 0.15s,
              color 0.15s,
              border-color var(--fold-duration) var(--fold-easing),
              box-shadow 0.25s ease,
              transform 0.1s;
  z-index: 20;
}

.app.collapsed .panel-toggle {
  top: 78px;
}

.panel-toggle:hover {
  color: var(--text);
  background: var(--panel);
}

.app.collapsed .panel-toggle {
  right: 12px;
}

.panel-toggle svg {
  width: 22px;
  height: 22px;
  transition: transform 0.35s ease;
}

.app.collapsed .panel-toggle svg {
  transform: rotate(180deg);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.toggle {
  position: relative;
  width: 38px;
  height: 20px;
  border-radius: 20px;
  cursor: pointer;
  transition: box-shadow 0.25s ease;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #3a3a3a;
  border-radius: 20px;
  transition: background 0.2s, transform 0.1s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #888;
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.toggle input:checked + .toggle-slider {
  background: #2a2a2a;
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: var(--accent);
}

.setting-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.section-header .section-label {
  margin: 0;
  flex: 1;
}

.section-header .toggle {
  flex-shrink: 0;
}

.section-label {
  font-size: 12px;
  color: var(--text-muted);
}

.bpm-control {
  display: flex;
  align-items: center;
  gap: 14px;
}

.bpm-control .step-btn {
  width: 40px;
  height: 40px;
  font-size: 22px;
}

.bpm-control .bpm-value {
  font-size: 28px;
  font-weight: 600;
  width: 68px;
  text-align: center;
}

.step-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #242424;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.25s ease, transform 0.1s;
  flex-shrink: 0;
}

.step-btn:hover {
  background: #2f2f2f;
}

.bpm-value {
  font-size: 22px;
  font-weight: 600;
  width: 52px;
  text-align: center;
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.chip {
  padding: 6px 2px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #242424;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.25s ease, transform 0.1s;
  text-align: center;
}

.chip:hover {
  border-color: #444;
  color: var(--text);
}

.chip.active {
  background: var(--accent);
  color: var(--panel);
  border-color: var(--accent);
  font-weight: 500;
}

.chip-add {
  font-size: 14px;
  line-height: 1;
}

/* 打击模式节奏芯片：左侧色条区分于音序节奏 */
.dp-rhythm-chip {
  border-left: 3px solid var(--accent, #7c6aef);
}

.rhythm-actions {
  display: none;
  gap: 6px;
  margin-top: 8px;
}

.rhythm-actions.visible {
  display: flex;
}

.rhythm-action-btn {
  flex: 1;
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #242424;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-align: center;
}

.rhythm-action-btn:hover {
  border-color: #444;
  color: var(--text);
  background: #2a2a2a;
}

.rhythm-action-btn.primary:hover {
  border-color: rgba(255, 255, 255, 0.45);
  color: var(--text);
}

.rhythm-action-btn.danger:hover {
  border-color: rgba(255, 100, 100, 0.5);
  color: #ff8080;
}

.smart-drums-section {
  display: none;
}

.random-btn {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #242424;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.random-btn:hover {
  background: #2f2f2f;
}

/* Smart Drums 随机鼓垫 */
.smart-drums {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sd-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sd-power,
.sd-dice {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #242424;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.sd-power:hover,
.sd-dice:hover {
  background: #2f2f2f;
  color: var(--text);
}

.sd-power:active,
.sd-dice:active {
  transform: scale(0.96);
}

.sd-power.active {
  color: #00e676;
  border-color: rgba(0, 230, 118, 0.4);
}

.sd-pad {
  position: relative;
  flex: 1;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  background:
    radial-gradient(circle at 25% 20%, rgba(224, 64, 251, 0.28), transparent 45%),
    radial-gradient(circle at 80% 75%, rgba(68, 138, 255, 0.24), transparent 45%),
    #1a1220;
  box-shadow:
    inset 0 0 40px rgba(0, 0, 0, 0.6),
    0 6px 18px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  cursor: crosshair;
  transition: opacity 0.2s;
}

.sd-pad.off {
  opacity: 0.45;
}

.sd-axis {
  position: absolute;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.sd-axis-x {
  top: 50%;
  left: 8%;
  right: 8%;
  height: 1px;
}

.sd-axis-y {
  left: 50%;
  top: 8%;
  bottom: 8%;
  width: 1px;
}

.sd-label {
  position: absolute;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 500;
  pointer-events: none;
}

.sd-top {
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.sd-bottom {
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.sd-left {
  left: 8px;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: center;
}

.sd-right {
  right: 8px;
  top: 50%;
  transform: translateY(-50%) rotate(90deg);
  transform-origin: center;
}

.sd-dot {
  position: absolute;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  background: var(--sd-color);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 0 16px var(--sd-color),
    inset 0 0 10px rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  cursor: grab;
  user-select: none;
  transition: transform 0.12s, box-shadow 0.12s;
  z-index: 2;
}

.sd-dot.dragging {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.12);
  z-index: 10;
}

/* ---------- 移动端性能分级光效：tier-minimal / tier-reduced / tier-full ---------- */

/* ===== tier-minimal：低端设备，最简效果 ===== */

/* 静态光晕：移动端禁用持续呼吸动画，避免合成器过载 */
.app[data-lighting-scheme="aura"].tier-minimal .play-btn.playing {
  animation: none;
  box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.22);
}

.app[data-lighting-scheme="aura"].tier-minimal .play-btn.playing::before {
  display: none;
}

.app[data-lighting-scheme="aura"].tier-minimal .bank-btn.active {
  animation: none;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.app[data-lighting-scheme="aura"].tier-minimal .bank-btn.active::before {
  display: none;
}

/* 共享呼吸动画 keyframes（桌面 AURA tier-full 使用） */
@keyframes play-breathe-opacity {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

@keyframes bank-breathe-opacity {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

.app[data-lighting-scheme="aura"].tier-minimal .play-btn:hover,
.app[data-lighting-scheme="aura"].tier-minimal .bank-btn:hover {
  box-shadow: none;
}

.app[data-lighting-scheme="aura"].tier-minimal .pad.active {
  background: var(--pad-active);
  box-shadow: 0 0 10px 2px rgba(255, 255, 255, calc(0.25 * var(--layer-ratio, 1)));
}

.app[data-lighting-scheme="aura"].tier-minimal .pad.current.active {
  background: var(--pad-active);
  box-shadow: 0 0 12px 3px rgba(255, 255, 255, calc(0.28 * var(--layer-ratio, 1)));
}

.app[data-lighting-scheme="aura"].tier-minimal .chip.active,
.app[data-lighting-scheme="aura"].tier-minimal .track-btn.active {
  box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.15);
}

.app[data-lighting-scheme="aura"].tier-minimal .beat-dot.active::before {
  box-shadow: 0 0 4px 0.5px rgba(255, 255, 255, 0.6);
}

.app[data-lighting-scheme="aura"].tier-minimal .motion-layer {
  display: none;
}

/* 弱设备（tier-minimal）：待机扫描光带隐藏、基线转为静态，避免低端机持续动画开销 */
.app.tier-minimal .screen-idle::before {
  animation: none;
  opacity: 0.7;
}

.app.tier-minimal .screen-idle::after {
  display: none;
}

.app[data-lighting-scheme="aura"].tier-minimal .pad::after,
.app[data-lighting-scheme="aura"].tier-minimal .chip::after,
.app[data-lighting-scheme="aura"].tier-minimal .step-btn::after,
.app[data-lighting-scheme="aura"].tier-minimal .play-btn::after,
.app[data-lighting-scheme="aura"].tier-minimal .panel-toggle::after,
.app[data-lighting-scheme="aura"].tier-minimal .toggle::after,
.app[data-lighting-scheme="aura"].tier-minimal .bank-btn::after,
.app[data-lighting-scheme="aura"].tier-minimal .vol-bar::after,
.app[data-lighting-scheme="aura"].tier-minimal .track-btn::after {
  display: none;
}

.app[data-lighting-scheme="aura"].tier-minimal .beat-number:hover,
.app[data-lighting-scheme="aura"].tier-minimal .beat-number.accent-number:hover {
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.6);
}

.app[data-lighting-scheme="aura"].tier-minimal .pad::before,
.app[data-lighting-scheme="aura"].tier-minimal .chip::before,
.app[data-lighting-scheme="aura"].tier-minimal .step-btn::before,
.app[data-lighting-scheme="aura"].tier-minimal .play-btn::before,
.app[data-lighting-scheme="aura"].tier-minimal .panel-toggle::before,
.app[data-lighting-scheme="aura"].tier-minimal .toggle::before,
.app[data-lighting-scheme="aura"].tier-minimal .bank-btn::before,
.app[data-lighting-scheme="aura"].tier-minimal .vol-bar::before,
.app[data-lighting-scheme="aura"].tier-minimal .track-btn::before {
  display: none;
}

/* ===== tier-reduced：中端设备，恢复桌面视觉但保持 GPU 友好 ===== */

.app[data-lighting-scheme="aura"].tier-reduced .play-btn.playing {
  animation: none;
  box-shadow: 0 0 16px 3px rgba(255, 255, 255, 0.28);
}

.app[data-lighting-scheme="aura"].tier-reduced .play-btn.playing::before {
  display: none;
}

.app[data-lighting-scheme="aura"].tier-reduced .bank-btn.active {
  animation: none;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.15);
  overflow: visible;
}

.app[data-lighting-scheme="aura"].tier-reduced .bank-btn.active::before {
  display: none;
}

.app[data-lighting-scheme="aura"].tier-reduced .play-btn:hover,
.app[data-lighting-scheme="aura"].tier-reduced .bank-btn:hover {
  box-shadow: none;
}

.app[data-lighting-scheme="aura"].tier-reduced .pad.active {
  background: var(--pad-active);
  box-shadow: 0 0 18px 4px rgba(255, 255, 255, calc(0.28 * var(--layer-ratio, 1)));
}

.app[data-lighting-scheme="aura"].tier-reduced .pad.current.active {
  background: var(--pad-active);
  box-shadow: 0 0 22px 5px rgba(255, 255, 255, calc(0.32 * var(--layer-ratio, 1)));
}

.app[data-lighting-scheme="aura"].tier-reduced .chip.active,
.app[data-lighting-scheme="aura"].tier-reduced .track-btn.active {
  box-shadow: 0 0 18px 3px rgba(255, 255, 255, 0.2);
}

.app[data-lighting-scheme="aura"].tier-reduced .beat-dot.active::before {
  box-shadow: 0 0 6px 1px rgba(255, 255, 255, 0.75);
}

.app[data-lighting-scheme="aura"].tier-reduced .motion-layer {
  display: block;
  mix-blend-mode: normal;
  opacity: 0;
}

.app[data-lighting-scheme="aura"].tier-reduced .motion-layer.on {
  opacity: 0.1;
}

.app[data-lighting-scheme="aura"].tier-reduced .beat-number:hover,
.app[data-lighting-scheme="aura"].tier-reduced .beat-number.accent-number:hover {
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
}

/* reduced 保留 ::after 用于 Reveal Highlight 静态描边，但禁用 hover 描边 */
.app[data-lighting-scheme="aura"].tier-reduced .pad::before,
.app[data-lighting-scheme="aura"].tier-reduced .chip::before,
.app[data-lighting-scheme="aura"].tier-reduced .step-btn::before,
.app[data-lighting-scheme="aura"].tier-reduced .play-btn::before,
.app[data-lighting-scheme="aura"].tier-reduced .panel-toggle::before,
.app[data-lighting-scheme="aura"].tier-reduced .toggle::before,
.app[data-lighting-scheme="aura"].tier-reduced .bank-btn::before,
.app[data-lighting-scheme="aura"].tier-reduced .vol-bar::before,
.app[data-lighting-scheme="aura"].tier-reduced .track-btn::before {
  display: none;
}

/* ===== tier-full：高端设备 / 桌面，完整动态光效 ===== */

.tier-full .pad,
.tier-full .beat-number.active {
  will-change: transform;
}

/* Contain paint/layout for display-stage on all tiers.
   sequencer and beat-markers are excluded because accent glows / .time-sig
   extend beyond their boundaries and would be clipped by contain:paint. */
.display-stage {
  contain: layout style paint;
}


/* KEYLIGHT 在最低端设备上的进一步降级：仅保留静态 active 微光，移除 hover 光效 */
.app[data-lighting-scheme="keylight"].tier-minimal .pad:hover,
.app[data-lighting-scheme="keylight"].tier-minimal .chip:hover,
.app[data-lighting-scheme="keylight"].tier-minimal .step-btn:hover,
.app[data-lighting-scheme="keylight"].tier-minimal .play-btn:hover,
.app[data-lighting-scheme="keylight"].tier-minimal .panel-toggle:hover,
.app[data-lighting-scheme="keylight"].tier-minimal .bank-btn:hover,
.app[data-lighting-scheme="keylight"].tier-minimal .vol-bar:hover,
.app[data-lighting-scheme="keylight"].tier-minimal .track-btn:hover {
  box-shadow: none;
}

.app[data-lighting-scheme="keylight"].tier-minimal .chip.active,
.app[data-lighting-scheme="keylight"].tier-minimal .play-btn.playing,
.app[data-lighting-scheme="keylight"].tier-minimal .bank-btn.active,
.app[data-lighting-scheme="keylight"].tier-minimal .track-btn.active {
  box-shadow: inset 0 0 10px var(--keylight-active);
}

.app[data-lighting-scheme="keylight"].tier-minimal .pad.active {
  background: var(--pad-active);
  box-shadow: inset 0 0 10px var(--keylight-active);
}

.app[data-lighting-scheme="keylight"].tier-minimal .pad.active.layer-1 { background: var(--pad-layer-1); box-shadow: inset 0 0 10px var(--pad-glow-1); }
.app[data-lighting-scheme="keylight"].tier-minimal .pad.active.layer-2 { background: var(--pad-layer-2); box-shadow: inset 0 0 10px var(--pad-glow-2); }
.app[data-lighting-scheme="keylight"].tier-minimal .pad.active.layer-3 { background: var(--pad-layer-3); box-shadow: inset 0 0 10px var(--pad-glow-3); }

.app[data-lighting-scheme="keylight"].tier-minimal .pad.active.layer-1 .pad-layer-marker { color: var(--pad-layer-1); }
.app[data-lighting-scheme="keylight"].tier-minimal .pad.active.layer-2 .pad-layer-marker { color: var(--pad-layer-2); }
.app[data-lighting-scheme="keylight"].tier-minimal .pad.active.layer-3 .pad-layer-marker { color: var(--pad-layer-3); }

.app[data-lighting-scheme="keylight"].tier-minimal .beat-dot.active::before,
.app[data-lighting-scheme="keylight"].tier-minimal .beat-dot:hover::before {
  box-shadow: none;
}

[hidden] {
  display: none !important;
}

/* ===== 录制按钮 / 计时器 ===== */
.play-btn.record-btn .stop-icon {
  display: none;
}

.play-btn.record-btn.recording .record-icon {
  display: none;
}

.play-btn.record-btn.recording .stop-icon {
  display: block;
}

.play-btn.record-btn.recording {
  background: #ff4d4f;
  color: #fff;
  box-shadow: 0 0 16px 3px rgba(255, 77, 79, 0.35);
}

.play-btn.record-btn.recording::before,
.play-btn.record-btn.recording::after {
  border-color: transparent;
}

.record-timer {
  grid-column: 2;
  grid-row: 2;
  justify-self: start;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  user-select: none;
}

.record-timer[hidden] {
  display: none;
}

/* ===== Number pop-in (Transitions.dev) ===== */
:root {
  --digit-dur: 500ms;
  --digit-distance: 8px;
  --digit-stagger: 70ms;
  --digit-blur: 2px;
  --digit-ease: cubic-bezier(0.34, 1.45, 0.64, 1);
  --digit-dir-x: 0;
  --digit-dir-y: 1;
}

@keyframes t-digit-pop-in {
  0% {
    transform: translate(
      calc(var(--digit-distance) * var(--digit-dir-x)),
      calc(var(--digit-distance) * var(--digit-dir-y))
    );
    opacity: 0;
    filter: blur(var(--digit-blur));
  }
  100% { transform: translate(0, 0); opacity: 1; filter: blur(0); }
}

.t-digit-group {
  display: inline-flex;
  align-items: baseline;
}

.t-digit {
  display: inline-block;
  will-change: transform, opacity, filter;
}

.t-digit-group.is-animating .t-digit {
  animation: t-digit-pop-in var(--digit-dur) var(--digit-ease) both;
}

.t-digit-group.is-animating .t-digit[data-stagger="1"] {
  animation-delay: var(--digit-stagger);
}

.t-digit-group.is-animating .t-digit[data-stagger="2"] {
  animation-delay: calc(var(--digit-stagger) * 2);
}

@media (prefers-reduced-motion: reduce) {
  .t-digit-group .t-digit { animation: none !important; }
}

/* ===== 清空确认弹窗 ===== */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.confirm-modal-panel {
  position: relative;
  background: var(--panel-light);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  width: 320px;
  max-width: 90vw;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  color: var(--text);
}

.confirm-modal-panel h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.confirm-modal-panel p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.confirm-modal-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-light);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.confirm-modal-btn:active {
  transform: scale(0.96);
}

.confirm-modal-btn.confirm {
  background: #ff4d4f;
  border-color: #ff4d4f;
  color: #fff;
}

.confirm-modal-btn.confirm:hover {
  background: #ff6b6d;
}

.confirm-modal-btn.cancel:hover {
  background: #252525;
}

/* ===== 通用自定义弹窗（替代浏览器 prompt/confirm/alert） ===== */
.dialog-modal {
  position: fixed;
  inset: 0;
  /* 需高于全屏"采样 & 鼓组管理"界面（z-index: 2000），确保弹窗可点击 */
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.dialog-modal:not([hidden]) {
  opacity: 1;
  visibility: visible;
}

.dialog-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.dialog-modal-panel {
  position: relative;
  width: 360px;
  max-width: 90vw;
  padding: 26px;
  background: linear-gradient(180deg, #242424 0%, #1e1e1e 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(0, 0, 0, 0.35);
  color: var(--text);
  transform: scale(0.94) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
  overflow: hidden;
}

.dialog-modal-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06) 0%,
    transparent 35%,
    transparent 100%
  );
  z-index: 0;
}

.dialog-modal:not([hidden]) .dialog-modal-panel {
  transform: scale(1) translateY(0);
}

.dialog-modal-panel > * {
  position: relative;
  z-index: 1;
}

.dialog-modal-panel h3,
.dialog-modal-panel p,
.dialog-modal-input-wrap,
.dialog-modal-actions {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.dialog-modal:not([hidden]) .dialog-modal-panel h3 {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.04s;
}

.dialog-modal:not([hidden]) .dialog-modal-panel p {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.08s;
}

.dialog-modal:not([hidden]) .dialog-modal-input-wrap {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.12s;
}

.dialog-modal:not([hidden]) .dialog-modal-actions {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.16s;
}

.dialog-modal-panel h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.3;
}

.dialog-modal-panel p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.55;
}

.dialog-modal-input-wrap {
  display: none;
  margin-bottom: 22px;
}

.dialog-modal-input-wrap.visible {
  display: block;
}

.dialog-modal-input {
  width: 100%;
  padding: 11px 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.dialog-modal-input::placeholder {
  color: #666;
}

.dialog-modal-input:focus {
  background: rgba(0, 0, 0, 0.45);
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.dialog-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.dialog-modal-btn {
  position: relative;
  overflow: hidden;
  padding: 9px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.25s ease;
}

.dialog-modal-btn:hover {
  box-shadow: 0 0 24px 5px rgba(255, 255, 255, 0.14);
}

.dialog-modal-btn:active {
  transform: scale(0.96);
}

/* Reveal highlight border for dialog buttons */
.dialog-modal-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1.5px solid transparent;
  background: linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.55)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  transform: scale(0.97);
  pointer-events: none;
  z-index: 0;
}

.dialog-modal-btn:hover::before {
  opacity: 1;
  transform: scale(1);
}

.dialog-modal-btn.confirm {
  background: #ffffff;
  border-color: #ffffff;
  color: var(--panel);
}

.dialog-modal-btn.confirm:hover {
  background: #e8e8e8;
  border-color: #e8e8e8;
  box-shadow: 0 0 24px 5px rgba(255, 255, 255, 0.22);
}

.dialog-modal-btn.confirm::before {
  background: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)) border-box;
}

.dialog-modal-btn.danger {
  background: rgba(255, 90, 90, 0.12);
  border-color: rgba(255, 100, 100, 0.45);
  color: #ff9a9a;
}

.dialog-modal-btn.danger:hover {
  background: rgba(255, 90, 90, 0.2);
  border-color: rgba(255, 120, 120, 0.65);
  box-shadow: 0 0 24px 5px rgba(255, 80, 80, 0.18);
}

.dialog-modal-btn.danger::before {
  background: linear-gradient(rgba(255, 160, 160, 0.65), rgba(255, 160, 160, 0.65)) border-box;
}

.dialog-modal-btn.cancel:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
}



/* ============================================================
   打击模式 Drum Pad Mode
   ============================================================ */

/* 进入打击模式时隐藏音序器网格与拍号标记，保留顶部工具栏与频谱舞台 */
.app.pad-mode-active .sequencer-area,
.app.pad-mode-active .beat-markers {
  display: none;
}

.pad-mode {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 10px;
  margin-top: 8px;
  margin-left: 86px;
  margin-right: 98px; /* 与音频可视化面板(display-stage)左右对齐 */
}

.app.pad-mode-active .pad-mode {
  display: flex;
  animation: pad-mode-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes pad-mode-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.996);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 顶部模式切换（音序 / 打击）：紧凑图标式，与播放按钮行对齐 */
.mode-switch {
  grid-column: 2;
  grid-row: 1;
  justify-self: start;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: 10px;
  flex-shrink: 0;
}

.mode-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.25s ease, transform 0.1s ease;
}

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

.mode-btn svg {
  display: block;
}

.mode-btn.active {
  background: #2c2c2c;
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 12px rgba(255, 255, 255, 0.07);
}

/* 工具栏 */
.dp-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 30px;
}

.dp-mode-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.dp-mode-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
}

.dp-toolbar-spacer {
  flex: 1;
}

.dp-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text);
  background: var(--panel-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.25s ease, transform 0.1s ease;
}

.dp-pill:hover {
  background: #252525;
}

.dp-pill:active {
  transform: scale(0.96);
}

.dp-pill.primary {
  background: var(--accent);
  color: var(--panel);
  border-color: transparent;
  font-weight: 600;
}

.dp-pill.primary:hover {
  background: #ffffff;
}

@keyframes dp-rec-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* 打击板舞台：桌面端 4 列 × 2 行（两行四列）：
   左半 erdf（e r / d f 两行两列），右半 uijk（u i / j k 两行两列）。
   contain: layout 仅保留定位包含块，不用 paint——避免光晕溢出被裁剪 */
.pad-stage {
  position: relative;
  height: auto;
  min-height: 0;
  display: grid;
  grid-auto-flow: row;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, auto);
  gap: 14px;
  contain: layout;
}

.app.dp-coarse .pad-stage {
  display: block;
  height: 452px;
}

/* 单个打击 pad：黑白配色。
   overflow 保持可见：命中时 aura 光晕可溢出 pad 边缘向四周扩散，
   与 Reveal 光源描边（周围元素的高光）配合，还原旧版光效 */
.dp-pad {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  background-color: var(--panel-light);
  background-image:
    radial-gradient(120% 90% at 50% 10%, rgba(255, 255, 255, 0.05) 0%, rgba(0, 0, 0, 0) 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 42%);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 2px 6px rgba(0, 0, 0, 0.25);
  transition: background-color 0.12s ease, border-color 0.2s ease, opacity 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  /* 桌面默认正方形：高度由列宽推导（coarse 绝对定位显式 w/h 会覆盖此比例） */
  aspect-ratio: 1 / 1;
}

.app.dp-coarse .dp-pad {
  position: absolute;
  width: 46%;
  height: 24%;
}

.dp-pad:hover {
  background-color: #232323;
}

.dp-pad:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

.dp-pad:active {
  transform: scale(0.98);
}

/* 命中：pad 变白 + 高光描边 + 光晕；小幅回弹更接近真实鼓面。
   命中 pad 同时作为 Reveal 光源，aura 描边向周围 pad 与其他 UI 元素扩散 */
.dp-pad.hit {
  animation: dp-pad-bounce 0.2s cubic-bezier(0.34, 1.4, 0.64, 1);
  background-color: #ffffff !important;
  background-image: none !important;
  color: #111;
  border-color: rgba(255, 255, 255, 0.95);
  box-shadow:
    0 0 0 1.5px rgba(255, 255, 255, 0.95),
    0 0 42px 16px rgba(255, 255, 255, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  z-index: 2;
}

.dp-pad.hit .dp-label {
  color: #111;
  text-shadow: none;
}

.dp-pad.hit .dp-key {
  color: #111;
  background: rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.25);
}

.dp-pad.hit .dp-layers i.on {
  background: #111;
  box-shadow: none;
}

@keyframes dp-pad-bounce {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(0.965);
  }
  65% {
    transform: scale(1.008);
  }
  100% {
    transform: scale(1);
  }
}

/* 命中光效：白色内芯闪光 + 覆盖整个 pad 并向四周溢出的白色 aura */
.dp-aura {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.22) 55%, transparent 78%);
  will-change: transform, opacity;
}

.dp-flash {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.25) 45%, transparent 75%);
  will-change: transform, opacity;
}

.dp-pad.hit .dp-aura {
  animation: dp-aura-burst 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.dp-pad.hit .dp-flash {
  animation: dp-flash-burst 0.3s ease-out forwards;
}

@keyframes dp-aura-burst {
  0% {
    opacity: 0.95;
    transform: scale(0.72);
  }
  100% {
    opacity: 0;
    transform: scale(1.45);
  }
}

@keyframes dp-flash-burst {
  0% {
    opacity: 1;
    transform: scale(0.96);
  }
  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}

/* 播放时（loop 自动播放 / 网格回放）：只让 pad 上的层级小圆点闪动，
   不给整个 pad 加效果 */
.dp-pad.sounding .dp-layers i {
  animation: dp-dot-flash 0.22s ease-out;
}

@keyframes dp-dot-flash {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);
  }
  45% {
    transform: scale(1.7);
    box-shadow: 0 0 9px rgba(255, 255, 255, 0.95);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);
  }
}

.dp-label {
  position: absolute;
  top: 10px;
  left: 12px;
  max-width: 68%;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app.dp-coarse .dp-label {
  font-size: 11px;
  top: 8px;
  left: 10px;
}

.dp-key {
  position: absolute;
  bottom: 10px;
  right: 12px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.dp-layers {
  position: absolute;
  bottom: 14px;
  left: 12px;
  display: flex;
  gap: 4px;
  pointer-events: none;
}

.app.dp-coarse .dp-layers {
  bottom: 12px;
  left: 10px;
}

/* iPad 触控优化：工具栏与 Loop 按钮放大 */
.app.dp-coarse .dp-toolbar {
  gap: 10px;
  min-height: 52px;
}
.app.dp-coarse .dp-pill {
  padding: 9px 14px;
  font-size: 13px;
  border-radius: 10px;
  min-height: 40px;
}
.app.dp-coarse .dp-pill svg {
  width: 15px;
  height: 15px;
}
/* Loop 按钮：主操作，尺寸更大、边框更明显 */
.app.dp-coarse .dp-pill.dp-loop {
  padding: 12px 22px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 14px;
  min-height: 52px;
  gap: 8px;
  border-color: rgba(255, 255, 255, 0.18);
  background: var(--panel);
}
.app.dp-coarse .dp-pill.dp-loop svg {
  width: 20px;
  height: 20px;
}
.app.dp-coarse .dp-pill.dp-loop .dp-loop-count {
  min-width: 20px;
  height: 20px;
  font-size: 11px;
  border-radius: 10px;
}
.app.dp-coarse .dp-pill.dp-loop.recording {
  background: rgba(255, 77, 79, 0.12);
  border-color: rgba(255, 77, 79, 0.6);
  box-shadow: 0 0 20px 4px rgba(255, 77, 79, 0.3);
}
.app.dp-coarse .dp-pill:active {
  transform: scale(0.94);
}

.dp-layers i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.dp-layers i.on {
  background: #fff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

/* 编辑模式：高亮被编辑的 pad，其余 pad 轻微变暗 */
.pad-stage.edit-mode .dp-pad:not(.editing) {
  opacity: 0.7;
}

.dp-pad.editing {
  overflow: visible; /* 四角把手伸出 pad 边缘，不能被裁剪 */
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.14),
    0 0 28px 5px rgba(255, 255, 255, 0.1);
}

.dp-pad.dragging {
  transition: none;
}

/* 四角缩放把手（仅 iPad 编辑模式显示） */
.dp-handle {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--panel);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.5),
    0 0 12px rgba(255, 255, 255, 0.3);
  display: none;
  z-index: 3;
}

.dp-pad.editing .dp-handle {
  display: block;
}

.dp-handle.nw { top: -8px; left: -8px; }
.dp-handle.ne { top: -8px; right: -8px; }
.dp-handle.sw { bottom: -8px; left: -8px; }
.dp-handle.se { bottom: -8px; right: -8px; }

/* 编辑工具栏（iPad）：移动 / 通道 / 层级 / 完成 */
.dp-edit-bar {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%) translateY(10px);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  background: rgba(20, 20, 20, 0.92);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 0.2s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.dp-edit-bar.on {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.dp-edit-hint {
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 4px;
  white-space: nowrap;
}

.dp-edit-bar button {
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #262626;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, transform 0.1s ease;
}

.dp-edit-bar button:active {
  transform: scale(0.95);
}

.dp-edit-bar button.primary {
  background: var(--accent);
  color: var(--panel);
  border-color: transparent;
  font-weight: 600;
}

/* 通道 / 层级 浮动菜单 */
.dp-menu {
  position: fixed;
  z-index: 130;
  min-width: 172px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--panel-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(255, 255, 255, 0.06);
  animation: dp-menu-in 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
  transform-origin: top left;
}

@keyframes dp-menu-in {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.dp-menu-head {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 10px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dp-menu-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 8px 10px 4px;
}

.dp-menu-opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--text);
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s ease;
}

.dp-menu-opt:hover {
  background: rgba(255, 255, 255, 0.1);
}

.dp-menu-opt[aria-selected="true"] {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

/* Loop 双模型工具栏：模式按钮 / 拍子脉冲点 / 固定长度菜单 */
.dp-pill.dp-loop-mode.locked {
  border-color: rgba(255, 255, 255, 0.22);
  background: var(--panel);
}

.dp-loop-menu {
  min-width: 148px;
}

.dp-beat-dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--border);
  opacity: 0.35;
  transition: opacity 0.2s ease;
}

@keyframes dp-beat-pulse {
  0% {
    transform: scale(1.35);
    background: var(--accent);
    opacity: 1;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
  }
  100% {
    transform: scale(1);
    background: var(--border);
    opacity: 0.35;
    box-shadow: none;
  }
}

.dp-beat-dot.beat {
  animation: dp-beat-pulse 0.16s ease-out;
}

.dp-beat-dot.beat-strong {
  animation: dp-beat-pulse 0.28s ease-out;
}

/* 拍号指示（1 2 3 4）：已移入打击模式工具栏最左（取代原“打击模式”标题），
   锁定模式播放/录制或接龙播放时常显，当前拍高亮；平时隐藏只余下左侧脉冲小点 */
.dp-beat-numbers {
  display: none;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.dp-beat-numbers.show {
  display: flex;
}

.dp-beat-numbers .beat-digit {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  opacity: 0.26;
  /* 默认（非高亮）无过渡 → 旧拍高亮消失即时（修 4→1 时 4 残留白色辉光） */
  transition: none;
}

.dp-beat-numbers .beat-digit.active {
  opacity: 1;
  color: #fff;
  transform: scale(1.22);
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.7);
  /* 激活时短暂淡入（仅影响“出现”，不影响“消失”） */
  transition: opacity 0.06s ease, transform 0.06s ease, color 0.06s ease;
}

.dp-beat-numbers .beat-digit.down.active {
  color: var(--accent);
}

.dp-bar-indicator {
  display: none;
  align-self: center;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent);
  opacity: 0.9;
  padding: 1px 6px;
  margin-right: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.dp-bar-indicator.show {
  display: inline-block;
}

.dp-layer-num {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.09);
}

/* 键位映射弹窗 */
.keymap-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.keymap-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.keymap-panel {
  position: relative;
  background: var(--panel-light);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  width: 400px;
  max-width: 92vw;
  max-height: 84vh;
  overflow-y: auto;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  color: var(--text);
  animation: keymap-in 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes keymap-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.keymap-panel h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.keymap-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.keymap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.keymap-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.keymap-row-name {
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.keymap-row-name small {
  color: var(--text-muted);
  font-size: 11px;
  margin-left: 6px;
}

.keymap-row-name small.conflict-msg {
  color: #ff8a8c;
}

.keymap-key {
  min-width: 36px;
  height: 30px;
  padding: 0 8px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.keymap-key:active {
  transform: scale(0.94);
}

.keymap-row.listening .keymap-key {
  background: rgba(255, 255, 255, 0.24);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.45),
    0 0 16px rgba(255, 255, 255, 0.35);
  animation: keymap-listen 0.9s ease-in-out infinite;
}

@keyframes keymap-listen {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}

.keymap-row.conflict .keymap-key {
  border-color: #ff4d4f;
  color: #ff8a8c;
  box-shadow: 0 0 10px rgba(255, 77, 79, 0.4);
}

.keymap-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  gap: 10px;
}

/* 低性能档位：命中时缩小外发光范围，仅保留按压与白色 pad 效果 */
.app.tier-minimal .dp-pad.hit {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.95),
    0 0 18px 6px rgba(255, 255, 255, 0.3);
}

.app.tier-minimal .dp-pad.hit .dp-aura,
.app.tier-minimal .dp-pad.hit .dp-flash {
  animation-duration: 0.22s;
}

@media (prefers-reduced-motion: reduce) {
  .pad-mode,
  .dp-menu,
  .keymap-panel,
  .dp-edit-bar {
    animation: none !important;
    transition: none !important;
  }
  .dp-pad .dp-aura,
  .dp-pad .dp-flash,
  .dp-pad.hit,
  .dp-pad.sounding,
  .dp-pill.dp-loop.recording svg,
  .keymap-row.listening .keymap-key {
    animation: none !important;
  }
  .dp-pad.hit,
  .dp-pad.sounding {
    transform: none;
  }
}

/* ============================================================
   合并时间线模式（ABCD 合并为一条 64 列连续音序）
   ============================================================ */
.app.merged .playhead-bar {
  display: none;
}

/* 合并时间线：底部圆点行 = 前置 80px 槽位 + 可横向滚动的圆点区 + 末尾 80px 槽位。
   圆点区与上方 seq-scroll 同步横向滚动；圆点数量 = pad 列数。
   宽度取 calc(100% - 12px) 使圆点区宽度 = seq-scroll 宽度（前槽 80 + 2*gap 12 + 末槽 80，
   末槽落在下方 track-volumes 区域的投影内，与 seq-scroll 列宽完全对齐）。 */
.beat-markers.merged-row {
  display: flex;
  width: calc(100% - 12px);
  margin-top: 10px;
  gap: 6px;
  align-items: center;
  overflow: hidden;
}

.beat-markers.merged-row .beat-marker {
  width: 100%;
}

/* 前置/末尾 80px 固定槽位：放 +/- 按钮，不随圆点滚动 */
.merged-slot {
  flex: 0 0 80px;
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
}

/* 可滚动圆点区：overflow hidden，scrollLeft 由 JS 与 seq-scroll 同步；
   宽度与 seq-scroll 一致，二者同时溢出、同时滚动 */
.merged-dots-scroll {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.merged-dots-grid {
  display: grid;
  align-items: center;
  justify-items: center;
  gap: 6px;
  /* width 由 JS 显式设置（= 列数 × 46px + gap），确保可横向滚动 */
}

.beat-markers.merged-row .beat-dot::before {
  width: clamp(3px, 0.68cqi, 5px);
  height: clamp(3px, 0.68cqi, 5px);
  background: #666;
}

.beat-markers.merged-row .beat-dot.active::before {
  background: #fff;
  box-shadow: 0 0 8px 1px rgba(255, 255, 255, 0.85);
  transform: scale(1.25);
}



/* 时间线滚动条：适配整体界面风格（深色细条 + 柔和高光） */
.app.merged .seq-scroll::-webkit-scrollbar {
  height: 8px;
}

.app.merged .seq-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
}

.app.merged .seq-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.35);
}

.app.merged .seq-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.34);
}

.app.merged .seq-scroll::-webkit-scrollbar-corner {
  background: transparent;
}

.app.merged .bank-btn:not(.bank-merge) {
  opacity: 0.35;
  pointer-events: none;
}

.app.merged .bank-merge {
  background: var(--accent);
  color: var(--panel);
}

.bank-btn.bank-merge {
  display: grid;
  place-items: center;
}

.bank-btn.bank-merge svg {
  display: block;
}

/* Loop 按钮状态 */
.dp-pill.dp-loop .dp-loop-count {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: var(--panel);
  background: #fff;
  border-radius: 8px;
}

.dp-pill.dp-loop.recording {
  border-color: rgba(255, 77, 79, 0.55);
  box-shadow: 0 0 16px 2px rgba(255, 77, 79, 0.25);
}

.dp-pill.dp-loop.recording svg {
  color: #ff4d4f;
  animation: dp-rec-blink 1.1s ease-in-out infinite;
}

/* 重音叠录：录制态用暖黄闪烁（与 Loop 录制一致的“正在录”反馈，区别录音红） */
.dp-pill.dp-accent.recording {
  border-color: rgba(255, 213, 79, 0.6);
  box-shadow: inset 0 0 0 1px rgba(255, 213, 79, 0.25), 0 0 16px 2px rgba(255, 213, 79, 0.22);
}

.dp-pill.dp-accent.recording svg {
  color: #ffd54f;
  animation: dp-rec-blink 1.1s ease-in-out infinite;
}

.dp-pill.dp-clear {
  color: var(--text-muted);
}

.dp-pill.dp-clear:hover {
  color: #ff9a9a;
  border-color: rgba(255, 100, 100, 0.45);
}

/* 存为 Loop：下一步字母后缀 */
.dp-pill.dp-save-loop .dp-save-loop-letter {
  font-weight: 700;
  color: var(--text);
  margin-left: 2px;
}

/* 接龙播放：顶栏第二行最右的紧凑圆形播放钮（仅图标，与上方 Loop/Bank 标题同列居中；
   视觉与主播放键完全一致：基础/悬停/按下沿用 .dp-pill（=同 .play-btn），playing 态为白底，play↔pause 图标切换 */
.dp-pill.dp-arrange-play {
  width: 40px;
  height: 40px;
  padding: 0;
  gap: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.dp-pill.dp-arrange-play > span {
  display: none;
}
.dp-pill.dp-arrange-play .pause-icon {
  display: none;
}
.app.dp-coarse .dp-pill.dp-arrange-play {
  width: 44px;
  height: 44px;
  padding: 0;
}

/* 接龙播放：playing 态与主播放键一致（白底 + 深色图标，图标切成暂停） */
.dp-pill.dp-arrange-play.playing {
  background: var(--accent);
  color: var(--panel);
}
.dp-pill.dp-arrange-play.playing .play-icon {
  display: none;
}
.dp-pill.dp-arrange-play.playing .pause-icon {
  display: block;
}

/* 接龙序列：休止槽（描边斜纹区分） */
.seq-slot.rest {
  border-style: solid;
  border-color: var(--border);
  color: var(--text-muted);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.06) 0,
    rgba(255, 255, 255, 0.06) 3px,
    transparent 3px,
    transparent 7px
  );
}

/* 接龙序列末尾“+”：与音序模式完全一致的圆形 .slot-add（点击加休止，拖入 Loop 可追加） */

/* 工作区层芯片（重录/删除指定层） */
.dp-layer-chips {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 2px;
}

.dp-layer-chip {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #242424;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.dp-layer-chip:hover {
  color: var(--text);
  border-color: #444;
}

.dp-layer-chip.active {
  color: #78c8ff;
  border-color: rgba(120, 200, 255, 0.6);
  background: rgba(120, 200, 255, 0.12);
}

/* 合并时间线底部：循环终点（黄色）与循环起点（绿色）标记 */
.beat-markers.merged-row .beat-dot.loop-marker::before {
  background: #ffd54f;
  box-shadow: 0 0 8px 2px rgba(255, 213, 79, 0.7);
}

.beat-markers.merged-row .beat-dot.start-marker::before {
  background: #4caf50;
  box-shadow: 0 0 8px 2px rgba(76, 175, 80, 0.7);
}

.col-btn {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.col-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

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

/* 录制提示气泡 */
.dp-hint {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 12px;
  color: #ffd54f;
  opacity: 0;
  transition: max-width 0.35s ease, opacity 0.3s ease, margin 0.3s ease;
}

.dp-hint.show {
  max-width: 320px;
  margin-left: 10px;
  opacity: 1;
}

/* ============================================================
   采样管理 Sample Manager
   ============================================================ */
.sample-manager-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #242424;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.25s ease, transform 0.1s;
}

.sample-manager-btn:hover {
  border-color: #444;
  color: var(--text);
}

.sample-manager-btn:active {
  transform: scale(0.96);
}

.sample-manager-modal {
  position: fixed;
  inset: 0;
  z-index: 1002;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sample-manager-modal:not([hidden]) {
  opacity: 1;
  visibility: visible;
}

.sm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.sample-manager-panel {
  position: relative;
  width: 660px;
  max-width: 94vw;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #242424 0%, #1e1e1e 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(0, 0, 0, 0.35);
  color: var(--text);
  transform: scale(0.94) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
  overflow: hidden;
}

.sample-manager-modal:not([hidden]) .sample-manager-panel {
  transform: scale(1) translateY(0);
}

.sample-manager-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06) 0%,
    transparent 35%,
    transparent 100%
  );
  z-index: 0;
}

.sample-manager-panel > * {
  position: relative;
  z-index: 1;
}

.sm-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px 12px;
}

.sm-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}

.sm-tabs {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 4px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.sm-tab {
  flex: 1;
  padding: 6px 10px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.25s ease, transform 0.1s;
}

.sm-tab:hover {
  color: var(--text);
}

.sm-tab:active {
  transform: scale(0.97);
}

.sm-tab.active {
  background: #2f2f2f;
  color: var(--text);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.08);
}

.sm-close {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.25s ease, transform 0.1s;
}

.sm-close:hover {
  border-color: #444;
  color: var(--text);
}

.sm-close:active {
  transform: scale(0.92);
}

.sm-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 0 20px;
}

.sm-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  padding: 22px 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #1a1a1a;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.sm-upload-zone.dragover {
  border-color: var(--accent);
  background: #242424;
  color: var(--text);
}

.sm-upload-main {
  margin: 0;
  font-size: 13px;
  color: var(--text);
}

.sm-upload-hint {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}

.sm-library {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 110px;
  max-height: 42vh;
  overflow-y: auto;
  padding: 2px 2px 6px;
}

.sm-empty {
  margin: auto;
  padding: 26px 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.sm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #1e1e1e;
  transition: border-color 0.15s, opacity 0.15s;
}

.sm-item.missing {
  opacity: 0.55;
}

.sm-play {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #242424;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.25s ease;
}

.sm-play:hover {
  border-color: #444;
  color: var(--text);
}

.sm-play.playing {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.18);
}

.sm-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sm-name {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sm-meta {
  font-size: 10px;
  color: var(--text-muted);
}

.sm-cat {
  flex-shrink: 0;
  max-width: 118px;
  padding: 7px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #242424;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

.sm-input {
  flex-shrink: 0;
  width: 150px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #242424;
  color: var(--text);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.25s ease;
}

.sm-input::placeholder {
  color: #757575;
}

.sm-input:focus::placeholder {
  color: transparent;
}

.sm-input:focus {
  border-color: #555;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.sm-input:hover:not(:focus) {
  border-color: #444;
}

.sm-btn {
  flex-shrink: 0;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #242424;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.25s ease, transform 0.1s;
}

.sm-btn:hover {
  border-color: #444;
  color: var(--text);
}

.sm-btn:active {
  transform: scale(0.96);
}

.sm-btn.danger {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--text-muted);
}

.sm-btn.danger:hover {
  border-color: rgba(255, 100, 100, 0.55);
  color: #ff9a9a;
  box-shadow: 0 0 12px rgba(255, 80, 80, 0.15);
}

.sm-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px 18px;
}

.sm-status {
  margin: 0;
  min-height: 14px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.sm-status.err {
  color: #ff9a9a;
}

.sm-done {
  flex-shrink: 0;
  padding: 9px 24px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  transition: box-shadow 0.25s ease, transform 0.1s;
}

.sm-done:hover {
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.18);
}

.sm-done:active {
  transform: scale(0.96);
}

.sm-tab-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.sm-add-channel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.25s ease, transform 0.1s;
}

.sm-add-channel:hover {
  border-color: var(--accent);
  color: var(--text);
}

.sm-add-channel:active {
  transform: scale(0.97);
}

.sm-channels {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 110px;
  max-height: 46vh;
  overflow-y: auto;
  padding: 2px 2px 6px;
}

.sm-channel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #1e1e1e;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sm-channel-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sm-channel-name {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #242424;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.25s ease;
}

.sm-channel-name::placeholder {
  color: #757575;
}

.sm-channel-name:focus {
  border-color: #555;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.sm-channel-layers {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sm-layer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #1a1a1a;
}

.sm-layer.missing {
  opacity: 0.55;
}

.sm-layer-order {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #2f2f2f;
  color: var(--text-muted);
  font-size: 10px;
}

.sm-layer-play {
  width: 34px;
  height: 34px;
}

.sm-layer-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sm-layer-remove {
  width: 30px;
  height: 30px;
  min-height: 30px;
  font-size: 13px;
}

.sm-channel-hint {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 2px;
}

.sm-channel-add {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sm-channel-add .sm-cat {
  flex: 1;
  max-width: none;
}

@media (max-width: 600px) {
  .sm-item {
    flex-wrap: wrap;
  }

  .sm-cat {
    flex: 1;
    max-width: none;
    order: 3;
  }

  .sm-input {
    flex: 1;
    min-width: 0;
    order: 4;
    padding: 9px 10px;
  }

  .sm-name {
    font-size: 13px;
  }

  .sm-play {
    width: 44px;
    height: 44px;
  }

  .sm-btn {
    min-height: 40px;
  }

  .sm-btn.danger {
    width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .sm-tab {
    padding: 8px 10px;
  }

  .sm-layer-play {
    width: 40px;
    height: 40px;
  }

  .sm-layer-remove {
    width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .sm-channel-name {
    padding: 9px 10px;
  }
}


