/* SenseAudio 产品 UI —— 分轨重混台（Stem Studio）样式。
   方向：平面工业 / Ableton 浅色学派。零圆角、零阴影、零玻璃、零 emoji；
   结构 = 实线网格，层级 = 字重与密度，专业感 = 单元格对齐 + mono 读数 + 中英双语刻度牌。
   色彩只允许出现在：左色牌 6px、波形、S 激活态、通道 VU；动作只用产品蓝 #0068D6，
   黑色实底按钮 = 全局动作（导出）。所有选择器 st- 前缀，类名与 studio.js emit 一一对应。

   字体决策：本方案签名是 IBM Plex Sans + IBM Plex Mono。产品当前未加载 IBM Plex
   （index.html 由后续接线任务负责加 webfont），故此处用「IBM Plex 优先 + 产品 token 兜底」：
   sans → "IBM Plex Sans" 在前、回落产品 --sans；mono → "IBM Plex Mono" 在前、回落 --mono。
   接线任务加上 webfont link 后即自动生效，未加时也能用产品现有字形正常呈现，绝不渲染空白。 */

.page[data-page="studio"] {
  /* —— 平面工业 token，但全部消费产品 tokens.css 的变量：
     结构（零圆角/实线/mono/密度）是 Studio 的，颜色是产品的——
     亮/暗主题切换自动跟随，与其余页面同一张皮。 —— */
  --st-bg: var(--s1);
  --st-panel: var(--s1);
  --st-cell: var(--s2);
  --st-cell-hov: var(--s3);
  --st-rule: var(--line-strong);
  --st-rule-soft: var(--line);
  --st-ink: var(--ink);
  --st-ink2: var(--ink-soft);
  --st-ink3: var(--ink-mute);
  --st-acc: var(--accent);       /* 唯一动作色 = 产品蓝 */
  --st-acc-dim: color-mix(in srgb, var(--accent) 9%, transparent);
  --st-acc-hov: color-mix(in srgb, var(--accent) 82%, var(--ink) 18%);
  --st-ok: var(--ok);
  --st-err: #E0685A;
  /* stem 色牌（暗底提亮档）。vocals/drums/bass/guitar/piano/other；S 激活实底上的字色 */
  --st-1: #E36B5C;
  --st-2: #D9A445;
  --st-3: #3AC0AE;
  --st-4: #9C90E8;
  --st-5: #5B9BD5;
  --st-6: #D87BA8;
  --st-ck-fg: #0C0C0F;
  --st-sans: "IBM Plex Sans", "Noto Sans SC", var(--sans, -apple-system, sans-serif);
  --st-mono: "IBM Plex Mono", var(--mono, ui-monospace, monospace);

  background: transparent;       /* 让产品 mesh 背景透出来，与其他页面一致 */
  color: var(--st-ink);
  font-family: var(--st-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding: 28px clamp(12px, 3vw, 48px) 60px;
}
/* 浅色主题：stem 色牌换浅底深饱和档（白底上对比度够 AA），错误色同步压深 */
html[data-theme="light"] .page[data-page="studio"] {
  --st-1: #C2473B;
  --st-2: #B07D10;
  --st-3: #20847A;
  --st-4: #6258A8;
  --st-5: #3E78AE;
  --st-6: #B05A86;
  --st-ck-fg: #FFFFFF;
  --st-err: #C2473B;
}

/* 平面工业铁律：本视图内零圆角 */
.page[data-page="studio"] *,
.page[data-page="studio"] *::before,
.page[data-page="studio"] *::after {
  border-radius: 0 !important;
}

.page[data-page="studio"] .mono,
.st-frame .mono {
  font-family: var(--st-mono);
  font-variant-numeric: tabular-nums;
}
.st-frame .st-cap {
  font-family: var(--st-mono);
  font-size: 9px;
  letter-spacing: .14em;
  color: var(--st-ink3);
}

/* ===== 应用框：一张平面，title bar 一条线 ===== */
.st-frame {
  border: 1px solid var(--st-rule);
  background: var(--st-bg);
}
.st-tbar {
  display: flex;
  align-items: center;
  height: 30px;
  border-bottom: 1px solid var(--st-rule);
  background: var(--st-panel);
  padding: 0 12px;
  gap: 12px;
}
.st-tbar .st-nm {
  font-family: var(--st-mono);
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--st-ink2);
}
.st-sp { flex: 1; }

/* —— 1 · 项目行 —— */
.st-prow {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--st-rule);
  background: var(--st-panel);
}
.st-prow .st-id {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-right: 1px solid var(--st-rule);
}
.st-prow .st-id b {
  font-size: 14.5px;
  font-weight: 600;
}
.st-prow .st-id .st-cap { margin-top: 1px; }
.st-pcell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 7px 14px;
  border-right: 1px solid var(--st-rule);
  min-width: 74px;
}
.st-pcell .st-v {
  font-family: var(--st-mono);
  font-size: 12px;
  font-weight: 500;
}
.st-pcell .st-v.hit { color: var(--st-ok); }
.st-pbtn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  border-left: 1px solid var(--st-rule);
  font-family: var(--st-sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  background: var(--st-panel);
  border-top: none;
  border-right: none;
  border-bottom: none;
  color: var(--st-ink);
}
.st-pbtn:hover { background: var(--st-cell); }
.st-pbtn .st-cap { color: var(--st-ink3); }
/* 实底 = 全局动作（导出多轨）——走产品 ctrl 规范：浅色黑底白字 / 暗色白底黑字 */
.st-pbtn.solid {
  background: var(--ctrl-bg);
  color: var(--ctrl-fg);
}
.st-pbtn.solid .st-cap { color: color-mix(in srgb, var(--ctrl-fg) 55%, transparent); }
.st-pbtn.solid:hover { background: var(--ctrl-bg-h); }
.st-pbtn.busy { opacity: .55; cursor: default; }
.st-pbtn[disabled] { opacity: .45; cursor: default; }

/* —— 2 · 传输行 —— */
.st-trow {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--st-rule);
  background: var(--st-panel);
  height: 54px;
}
.st-tcellb {
  display: flex;
  align-items: center;
  border-right: 1px solid var(--st-rule);
}
.st-tbtn {
  width: 54px;
  height: 100%;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: none;
  border-right: 1px solid var(--st-rule);
  background: var(--st-panel);
}
.st-tbtn:hover { background: var(--st-cell); }
.st-tbtn.on { background: var(--st-acc-dim); }
/* 几何图标：播放三角 / 停止方块（零 emoji） */
.st-tri {
  width: 0; height: 0;
  border-left: 13px solid var(--st-ink);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}
.st-tbtn.on .st-tri { border-left-color: var(--st-acc); }
.st-sq {
  width: 12px; height: 12px;
  background: var(--st-ink2);
}
.st-time {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 18px;
  border-right: 1px solid var(--st-rule);
}
.st-time .st-big {
  font-family: var(--st-mono);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: .01em;
}
.st-time .st-bars {
  font-family: var(--st-mono);
  font-size: 10.5px;
  color: var(--st-ink3);
}
.st-mastr {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  border-left: 1px solid var(--st-rule);
}
.st-mnum {
  font-family: var(--st-mono);
  font-size: 10.5px;
  color: var(--st-ink2);
  text-align: right;
  line-height: 1.6;
}
.st-mnum b { font-weight: 600; color: var(--st-ink); }

/* —— 3 · rack —— */
.st-rack {
  position: relative;
  background: var(--st-panel);
  --con-w: 236px;
}
.st-ruler {
  position: relative;
  height: 24px;
  border-bottom: 1px solid var(--st-rule);
  margin-left: var(--con-w);
  background: var(--st-cell);
}
.st-ruler b {
  position: absolute;
  top: 6px;
  font-family: var(--st-mono);
  font-weight: 500;
  font-size: 9px;
  color: var(--st-ink2);
  transform: translateX(3px);
}
.st-ruler b:last-child { transform: translateX(-100%); }
.st-grid {
  position: absolute;
  left: var(--con-w);
  right: 0;
  top: 24px;
  bottom: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to right, color-mix(in srgb, var(--ink) 5%, transparent) 0 1px, transparent 1px 8.66%);
}
.st-lane {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--st-rule);
}
.st-lane:last-of-type { border-bottom: none; }

/* 通道条：刻度牌式 */
.st-con {
  width: var(--con-w);
  flex: none;
  display: flex;
  align-items: center;
  background: var(--st-cell);
  border-right: 1px solid var(--st-rule);
}
.st-lane:hover .st-con { background: var(--st-cell-hov); transition: background 80ms linear; }
.st-ctab {
  width: 6px;
  align-self: stretch;
  background: var(--c);
  flex: none;
}
.st-cnum {
  font-family: var(--st-mono);
  font-size: 9px;
  color: var(--st-ink3);
  width: 24px;
  text-align: center;
  flex: none;
}
.st-cname {
  flex: 1;
  min-width: 0;
  padding-right: 6px;
}
.st-cname b {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
}
.st-cname .st-cap { letter-spacing: .1em; }
/* dB 字段：可拖（ns-resize），双击键入——替代图形推子 */
.st-cdb {
  font-family: var(--st-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--st-ink2);
  width: 48px;
  text-align: right;
  border: 1px solid var(--st-rule);
  background: var(--st-panel);
  padding: 2px 5px;
  margin-right: 6px;
  cursor: ns-resize;
  user-select: none;
  touch-action: none;
}
.st-cdb:hover { color: var(--st-ink); border-color: var(--st-ink3); }
/* S/M 连体方键组 */
.st-ck {
  width: 24px;
  height: 22px;
  display: grid;
  place-items: center;
  font-family: var(--st-mono);
  font-size: 9.5px;
  font-weight: 600;
  border: 1px solid var(--st-rule);
  border-right: none;
  color: var(--st-ink3);
  cursor: pointer;
  background: var(--st-panel);
  padding: 0;
}
.st-ck.m { border-right: 1px solid var(--st-rule); margin-right: 10px; }
.st-ck:hover { color: var(--st-ink); }
/* S 激活 = stem 色实底（字色随主题保证对比）；M 激活 = 墨色实底反白 */
.st-ck.s.on { background: var(--c); border-color: var(--c); color: var(--st-ck-fg); }
.st-ck.m.on { background: var(--st-ink); border-color: var(--st-ink); color: var(--bg); }
/* 通道 VU：stem 色细条 */
.st-cvu {
  width: 4px;
  align-self: stretch;
  margin: 8px 8px 8px 0;
  background: var(--st-panel);
  border: 1px solid var(--st-rule);
  position: relative;
  flex: none;
}
.st-cvu i {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--c);
  opacity: .85;
}

/* 波形：竖条（wave.js render 同构，<i style="height">）。stem 色着色。 */
.st-wv {
  flex: 1;
  position: relative;
  height: 56px;
  min-width: 0;
  background: var(--st-panel);
  display: flex;
  align-items: center;
  gap: 1.2px;
  padding: 0 1px;
  overflow: hidden;
}
.st-wv i {
  flex: 1;
  min-width: 1px;
  background: var(--c);
  opacity: .92;
  align-self: center;
}
/* 静音轨：色牌/波形/VU 全部褪到灰档 */
.st-lane.muted .st-cname b { color: var(--st-ink3); }
.st-lane.muted .st-ctab { opacity: .3; }
.st-lane.muted .st-wv i { background: var(--st-ink3); opacity: .4; }
.st-lane.muted .st-cvu i { background: var(--st-ink3); opacity: .4; }

/* 选区 / 播放头：平面，无浮签。覆盖层让出通道条宽度，内部用纯百分比定位（避开 calc 百分比相乘）。 */
.st-overlay {
  position: absolute;
  top: 24px;          /* 让出 ruler */
  left: var(--con-w);
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 2;
}
.st-region {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;            /* JS 写 left/width: N% */
  width: 0;
  pointer-events: none;
  background: var(--st-acc-dim);
  border-left: 1px solid var(--st-acc);
  border-right: 1px solid var(--st-acc);
}
.st-region[hidden] { display: none; }
.st-region .st-hdl {
  position: absolute;
  top: 0;
  width: 7px;
  height: 14px;
  background: var(--st-acc);
}
.st-region .st-hdl.l { left: 0; }
.st-region .st-hdl.r { right: 0; }
.st-phead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;            /* JS 写 left: N% */
  width: 1px;
  background: var(--st-ink);
  pointer-events: none;
  z-index: 3;
}
.st-phead::before {
  content: "";
  position: absolute;
  top: 0;
  left: -4.5px;
  border: 5px solid transparent;
  border-top: 7px solid var(--st-ink);
}

/* —— 4 · 选区上下文条（固定，不悬浮） —— */
.st-ctx {
  display: flex;
  align-items: stretch;
  border-top: 1px solid var(--st-rule);
  background: var(--st-panel);
  height: 46px;
}
.st-ctx[hidden] { display: none; }
.st-ctx .st-info {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  border-right: 1px solid var(--st-rule);
}
.st-ctx .st-info .st-cap { letter-spacing: .12em; }
.st-ctx .st-info .st-rng {
  font-family: var(--st-mono);
  font-size: 12.5px;
  font-weight: 500;
}
.st-cbtn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 20px;
  border: none;
  border-right: 1px solid var(--st-rule);
  font-family: var(--st-sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  background: var(--st-panel);
  color: var(--st-ink);
}
.st-cbtn .st-cap { color: var(--st-ink3); }
/* 替换此段 = 产品蓝实底（动作色）；尾部加段 = 描边 */
.st-cbtn.pri { background: var(--st-acc); color: #fff; }
.st-cbtn.pri .st-cap { color: rgba(255, 255, 255, .55); }
.st-cbtn.pri:hover { background: var(--st-acc-hov); }
.st-cbtn:not(.pri):hover { background: var(--st-cell); }
.st-ctx .st-esc {
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-family: var(--st-mono);
  font-size: 10px;
  color: var(--st-ink3);
}

/* —— 5 · 状态条：进度也在这，不开 toast —— */
.st-sbar {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--st-rule);
  background: var(--st-cell);
  height: 28px;
  font-family: var(--st-mono);
  font-size: 9.5px;
  color: var(--st-ink2);
}
.st-scell {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border-right: 1px solid var(--st-rule);
  height: 100%;
}
.st-scell[hidden] { display: none; }
.st-keys {
  border-left: 1px solid var(--st-rule);
  border-right: none;
  margin-left: auto;
}
.st-sdot { width: 6px; height: 6px; background: var(--st-ok); }
.st-sprog { gap: 8px; }
.st-sprog .st-pb {
  width: 90px;
  height: 4px;
  border: 1px solid var(--st-rule);
  background: var(--st-panel);
  position: relative;
}
.st-sprog .st-pb i {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  background: var(--st-acc);
}
.st-sbar kbd {
  font-family: var(--st-mono);
  font-size: 9px;
  color: var(--st-ink2);
  border: 1px solid var(--st-rule);
  padding: 0 4px;
  background: var(--st-panel);
  margin-left: 6px;
}
#stSaveTip.err { color: var(--st-err); }

/* —— 空态 / 加载态 —— */
.st-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 64px 24px;
  text-align: center;
}
.st-empty-ic {
  width: 40px;
  height: 40px;
  border: 2px solid var(--st-ink);
  position: relative;
}
.st-empty-ic::before {
  content: "";
  position: absolute;
  inset: 8px;
  background: repeating-linear-gradient(to right, var(--st-ink) 0 2px, transparent 2px 7px);
}
.st-empty-t { font-size: 15px; font-weight: 600; }
.st-empty-s { font-size: 12.5px; color: var(--st-ink2); max-width: 420px; }
.st-empty.err .st-empty-ic { border-color: var(--st-err); }

/* —— 分离前确认面板 —— */
.st-confirm {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 32px clamp(20px, 4vw, 48px) 36px;
}
.st-cfm-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--st-rule);
}
.st-cfm-title {
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 700;
  color: var(--st-ink);
  letter-spacing: -0.01em;
}
.st-cfm-tag { font-size: 11px; color: var(--st-ink3); letter-spacing: 0.04em; }
.st-cfm-desc { font-size: 13px; line-height: 1.6; color: var(--st-ink2); max-width: 560px; margin: 0; }
.st-cfm-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.st-cfm-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  background: var(--st-cell);
  border: 1px solid var(--st-rule);
}
.st-cfm-dot { width: 10px; height: 10px; flex: none; }
.st-cfm-zh { font-size: 13px; font-weight: 600; color: var(--st-ink); }
.st-cfm-en { font-size: 10.5px; color: var(--st-ink3); margin-left: auto; letter-spacing: 0.04em; }
.st-cfm-go {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding: 13px 26px;
  background: var(--ctrl-bg);
  color: var(--ctrl-fg);
  border: none;
  font-family: var(--st-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms;
}
.st-cfm-go .mono { font-size: 11px; color: color-mix(in srgb, var(--ctrl-fg) 55%, transparent); }
.st-cfm-go:hover { background: var(--ctrl-bg-h); }
@media (max-width: 760px) {
  .st-cfm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.st-empty.err .st-empty-s { color: var(--st-err); }

.st-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 64px 24px;
}
.st-spin {
  width: 22px;
  height: 22px;
  border: 2px solid var(--st-rule);
  border-top-color: var(--st-acc);
  animation: st-spin 700ms linear infinite;
}
@keyframes st-spin { to { transform: rotate(360deg); } }
.st-loading-tx { font-size: 13px; font-weight: 600; color: var(--st-ink); }
.st-loading-sub { font-size: 11px; color: var(--st-ink3); }

@media (prefers-reduced-motion: reduce) {
  .st-spin { animation: none; }
  .st-lane:hover .st-con { transition: none; }
}

/* —— 窄屏：通道条收窄，密度再压一档 —— */
@media (max-width: 760px) {
  .st-rack { --con-w: 168px; }
  .st-con { width: 168px; }
  .st-cdb { width: 40px; }
  .st-pcell { min-width: 60px; padding: 6px 10px; }
  .st-time .st-big { font-size: 20px; }
}
