: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;
}

.pad,
.play-btn,
.bank-btn,
.chip,
.step-btn,
.panel-toggle,
.track-label,
.volume-icon-btn,
.sd-power,
.sd-dice {
  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 {
  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 {
  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 {
  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 {
  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 {
  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: visible;
  box-shadow: 0 24px 60px var(--shadow);
  transition: width var(--fold-duration) var(--fold-easing);
  /* 100%~125% 缩放区间内整体等比缩放，保持 UI 物理尺寸一致；超过 125% 不再缩放 */
  zoom: calc(1 / var(--app-scale, 1));
}

.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;
}

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

.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);
}

.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;
  margin-left: -1.5px;
  flex-shrink: 0;
}

.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 切换按钮 */
.bank-tabs {
  display: flex;
  align-items: center;
  gap: 14px;
}

.bank-btn {
  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;
}

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

.bank-btn.active {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
  animation: none;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.15);
  overflow: visible;
}

.bank-btn.active::before {
  background: none;
  border: none;
  -webkit-mask: none;
  mask: none;
  opacity: 0;
  transform: scale(1);
  box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.35);
  animation: bank-breathe-opacity 2.2s ease-in-out infinite;
}

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

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

/* 舞台显示区 */
.display-stage {
  position: relative;
  height: 90px;
  margin-left: 86px;
  width: calc(100% - 184px);
  background: var(--display);
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.12);
}

.viz-grid {
  position: absolute;
  inset: 10px 0 0;
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 6px;
  align-items: end;
  z-index: 1;
  pointer-events: none;
}

.viz-bar {
  height: 100%;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 3px 3px 0 0;
  transform-origin: bottom;
  transform: scaleY(var(--viz-scale, 0.06));
  transition: transform 0.1s ease-out;
  will-change: transform;
}

.playhead-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc((100% - 90px) / 16);
  background: rgba(0, 0, 0, 0.08);
  opacity: 0;
  transition: opacity 0.1s;
  pointer-events: none;
}

.playhead-bar.on {
  opacity: 1;
}

/* 底部拍号标记 */
.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;
}

.motion-layer.on {
  opacity: 0.45;
}

/* 音序器 */
.sequencer {
  position: relative;
  display: grid;
  grid-template-columns: 80px repeat(16, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
  contain: layout style;
}

.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, box-shadow 0.25s ease;
}

.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 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 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 {
  outline: 1px solid rgba(255, 255, 255, 0.22);
}

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

/* 拍号：更克制的 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 .display-stage {
  width: calc(100% - 184px);
}

.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;
}

.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;
}

@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: 22px;
  right: 252px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 0;
  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: 24px;
}

.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;
}

.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;
}

.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.35;
}

.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,
.tier-full .playhead-bar,
.tier-full .viz-bar {
  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 {
  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;
}

/* ===== 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;
}


