/* 工作台骨架：顶栏、画布、侧栏、底栏。页面本身不滚动。 */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  height: var(--topbar-height);
  padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--rail);
  flex: 0 0 var(--topbar-height);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  justify-self: start;
}

.brand__mark {
  width: 8px;
  height: 8px;
  border: 1px solid var(--accent);
  flex: 0 0 auto;
}

.brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand__name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.brand__tag {
  margin-top: 2px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.transport {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}

.workspace {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

.stage {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  padding: var(--stage-pad);
  background: var(--bg);
}

.canvas-frame {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  background: var(--artwork);
  overflow: hidden;
}

.canvas-frame canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.panel {
  display: flex;
  flex-direction: column;
  width: var(--panel-width);
  flex: 0 0 var(--panel-width);
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
}

.panel__groups {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 230, 227, 0.38) transparent;
}

.panel__groups::-webkit-scrollbar {
  width: 10px;
}

.panel__groups::-webkit-scrollbar-track {
  background: transparent;
}

.panel__groups::-webkit-scrollbar-thumb {
  background: rgba(232, 230, 227, 0.38);
  border: 2px solid var(--panel);
  border-radius: 8px;
}

.panel__footer {
  flex: 0 0 auto;
  padding: 16px 20px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.statusbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--status-height);
  padding: 0 20px;
  border-top: 1px solid var(--line);
  background: var(--rail);
  color: var(--muted);
  font-size: 12px;
  flex: 0 0 var(--status-height);
}

.status__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status__led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.status__led.is-paused {
  background: var(--faint);
  box-shadow: none;
}

.status__dot {
  color: var(--faint);
}

.num {
  color: var(--text);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* 窗口变窄时，算法切换落到第二行，避免顶栏把文字挤断。 */
@media (max-width: 680px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    height: auto;
    flex-basis: auto;
    row-gap: 8px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .segmented {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
  }
}
