:root {
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --surface: #ffffff;
  --border: rgba(0, 0, 0, 0.1);
  --input-fill: #ffffff;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  --focus: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow-x: hidden;
}

body {
  height: 100%;
  margin: 0;
  color: var(--text);
  overflow-x: hidden;
  font-family: ui-sans-serif, system-ui, -apple-system, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", Arial, sans-serif;
  background: #ffffff;
}

/* —— Site top nav (Homepage / Voice / Interaction) —— */
.siteNav {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  max-width: 100vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem clamp(12px, 3vw, 28px);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
}

.siteNav__brand {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.siteNav__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.siteNav__localeWrap {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.siteNav__localeSelect {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.45rem;
  background: #ffffff;
  color: var(--text);
  font-size: 0.82rem;
}

.siteNav__localeSelect:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.siteNav__link {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.siteNav__link:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
}

.siteNav__link.is-active {
  color: var(--text);
  background: #f4f5fb;
  border-color: var(--border);
}

body[data-site-page="home"] #uploadCard {
  display: none !important;
}

body[data-site-page="voice"] #nameCard,
body[data-site-page="voice"] #petTypeCard {
  display: none !important;
}

body[data-site-page="interaction"] {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: #000000;
  color: #f0f0f0;
}

body[data-site-page="interaction"] .siteNav {
  background: rgba(0, 0, 0, 0.94);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

body[data-site-page="interaction"] .siteNav__brand,
body[data-site-page="interaction"] .siteNav__link.is-active {
  color: #f5f5f5;
}

body[data-site-page="interaction"] .siteNav__link {
  color: #9a9a9a;
}

body[data-site-page="interaction"] .siteNav__link:hover {
  color: #f5f5f5;
  background: rgba(255, 255, 255, 0.06);
}

body[data-site-page="interaction"] .siteNav__link.is-active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
}

.interactionFrame {
  flex: 1;
  width: 100%;
  min-height: calc(100dvh - 52px);
  border: 0;
  background: #000000;
}

.page {
  min-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(12px, 3vw, 28px);
  overflow-x: hidden;
}

.flow {
  width: 100%;
  max-width: min(42rem, 100%);
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  /* 与 card 的 grid-area:1/1 堆叠：子项须拉满栏宽，避免 justify-items:center 把卡片收成内容宽并导致错位/横向溢出 */
  justify-items: stretch;
  text-align: center;
}

/* Step 3 — vertical pipeline cards (each block + its outputs) */
/* Step 3 流水线：加宽以适配桌面窗口 */
.flow[data-step="3"],
.flow.force-step3 {
  max-width: min(76rem, calc(100vw - 2 * clamp(12px, 3vw, 28px)));
}

.step3Stack {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  margin-top: 4px;
  text-align: left;
}

.stackCard {
  width: 100%;
  margin: 0;
  padding: 14px 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stackCard__title {
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: #333333;
  letter-spacing: 0.02em;
  text-align: left;
}

.stackCard__ordinal {
  display: inline-block;
  margin-right: 6px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* Step 3 主卡片 1–8：可折叠 */
.stackCard--collapsible > .stackCard__title {
  list-style: none;
  cursor: pointer;
  user-select: none;
  margin-bottom: 0;
  border-bottom: 0;
}

.stackCard--collapsible > .stackCard__title::-webkit-details-marker {
  display: none;
}

.stackCard--collapsible > .stackCard__title::before {
  content: "▾ ";
  display: inline-block;
  width: 1em;
  color: var(--muted);
  font-size: 11px;
}

.stackCard--collapsible:not([open]) > .stackCard__title {
  margin-bottom: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.stackCard--collapsible:not([open]) > .stackCard__title::before {
  content: "▸ ";
}

.stackCard--collapsible[open] > .stackCard__title {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.stackCard--collapsible[open] > .stackCard__body {
  margin-top: 0;
}

.stackCard__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.stackCard__body > .button:first-of-type {
  margin-top: 0;
}

.card--step3 > .step3Stack .field {
  margin-bottom: 0;
}

.card--step3 > .step3Stack .aiToolInfo:last-child {
  margin-bottom: 0;
}

.card--step3 > .step3Stack .suggestions {
  margin-top: 0;
}

.card--step3 > .step3Stack .stackCard .resultBox {
  border-radius: 12px;
}

.step3Stack > .status {
  text-align: left;
  align-self: stretch;
}

.card {
  grid-area: 1 / 1;
  width: 100%;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}

.soulIcon {
  display: block;
  width: 54px;
  height: 62px;
  border-radius: 43% 57% 62% 38% / 46% 39% 61% 54%;
  margin-inline: auto;
  margin-bottom: 20px;
  background:
    radial-gradient(68% 60% at 34% 24%, #ffffff, rgba(255, 255, 255, 0)),
    radial-gradient(105% 88% at 72% 78%, rgba(180, 180, 180, 0.55), rgba(180, 180, 180, 0));
  box-shadow:
    0 0 20px rgba(0, 0, 0, 0.06),
    0 0 40px rgba(0, 0, 0, 0.04);
  animation: soulDrift 32000ms ease-in-out infinite, soulBreathe 5200ms ease-in-out infinite;
}

.brand {
  font-size: 12px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin-bottom: 10px;
}

.stepVersion {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.4px;
  margin-bottom: 20px;
}

.field {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
  width: 100%;
}

.label {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* Step 3 长表单：与 stackCard 左对齐，避免与全站居中文案混排显得「忽左忽中」 */
.card--step3 .label,
.step3Stack .label {
  text-align: left;
  justify-self: start;
}

#catOnly {
  transform: translateY(1px);
  margin-right: 6px;
  accent-color: #333333;
}

.control {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--input-fill);
  padding: 11px 12px;
  font-size: 15px;
  color: var(--text);
  outline: none;
}

.uploadZone {
  width: 100%;
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 18px 14px 14px;
  background: #ffffff;
  text-align: center;
  margin-bottom: 14px;
  transition: background 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.uploadZone.is-over {
  border-color: rgba(0, 0, 0, 0.28);
  background: #fafafa;
}

.uploadZone__hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.uploadZone__pick {
  display: inline-block;
  margin: 0;
  cursor: pointer;
}

.uploadZone__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.uploadZone__btn {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: #f5f5f5;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.uploadZone__pick:hover .uploadZone__btn,
.uploadZone__pick:focus-within .uploadZone__btn {
  background: #eeeeee;
  border-color: rgba(0, 0, 0, 0.2);
}

.uploadZone__files {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-wrap;
  text-align: left;
  max-height: 120px;
  overflow-y: auto;
}

.stagePaneProgress {
  margin: 0.35rem 0 0.5rem;
  padding: 0.45rem 0.65rem;
  font-size: 12px;
  line-height: 1.45;
  color: #424242;
  background: #f7f7f8;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  min-height: 1.2em;
}

.stagePaneProgress:empty {
  display: none;
}

.stagePaneProgress--active {
  border-color: rgba(123, 31, 162, 0.35);
  background: rgba(243, 229, 245, 0.45);
}


.control:focus {
  box-shadow: var(--focus);
  border-color: rgba(0, 0, 0, 0.22);
}

.control:disabled {
  opacity: 0.68;
}

.button {
  margin-top: 4px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 14px;
  background: #ffffff;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.button:hover {
  filter: brightness(1.02);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.status {
  min-height: 20px;
  margin: 10px 2px 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.status[data-kind="ok"] {
  color: #2d5a3d;
}

.status[data-kind="warn"] {
  color: #8b3a3a;
}

.resultBox {
  width: 100%;
  min-height: 88px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  padding: 12px;
  text-align: left;
  font-size: 13px;
  line-height: 1.55;
  color: #333333;
  white-space: pre-line;
}

.suggestions {
  width: 100%;
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.aiToolInfo {
  width: 100%;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  white-space: pre-line;
}

.suggestion {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
}

.suggestion input {
  accent-color: #333333;
}

.suggestion__label {
  font-size: 13px;
  color: #333333;
}

.suggestion__score {
  font-size: 12px;
  color: var(--muted);
}

.segmentRow {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  text-align: left;
}

.segmentTitle {
  font-size: 13px;
  color: #333333;
}

.segmentActions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.miniBtn {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: #333333;
  font-size: 12px;
  padding: 6px 8px;
  cursor: pointer;
}

/* confirmed (user marked as my cat) */
.miniBtn[data-action="accept"][data-confirmed="1"] {
  background: #00c853;
  border-color: #00c853;
  color: #ffffff;
  box-shadow: 0 0 0 0.15rem rgba(0, 200, 83, 0.16);
}
.miniBtn[data-action="reject"][data-confirmed="1"] {
  background: #d32f2f;
  border-color: #d32f2f;
  color: #ffffff;
}
.miniBtn[data-action="uncertain"][data-confirmed="1"] {
  background: #ffb300;
  border-color: #ffb300;
  color: #ffffff;
}

.libraryRow {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  text-align: left;
}

.libraryRow select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: #ffffff;
  color: #333333;
}

/* Stage 4A Cat Focused：试听区（人声抑制 / refined / 清洗导出） */
.workbenchPlayback {
  margin: 6px 0 10px;
  padding: 10px 0 6px;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  text-align: left;
}

.workbenchPlayback audio {
  display: block;
  margin-bottom: 2px;
}

.reveal[hidden] {
  display: none;
}

.reveal {
  animation: fadeIn 220ms ease both;
}

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

/* Step switch: cross-fade between two cards */
.card--step1,
.card--step2,
.card--step3 {
  transition: opacity 720ms ease;
  will-change: opacity;
}

.flow[data-step="1"] .card--step1 {
  opacity: 1;
  pointer-events: auto;
  animation: softFadeIn 1800ms ease both;
}
.flow[data-step="1"] .card--step2 {
  opacity: 0;
  pointer-events: none;
}
.flow[data-step="1"] .card--step3 {
  opacity: 0;
  pointer-events: none;
}

.flow[data-step="2"] .card--step1 {
  opacity: 0;
  pointer-events: none;
}
.flow[data-step="2"] .card--step2 {
  opacity: 1;
  pointer-events: auto;
  animation: softFadeIn 1800ms ease both;
}
.flow[data-step="2"] .card--step3 {
  opacity: 0;
  pointer-events: none;
}

.flow[data-step="3"] .card--step1 {
  opacity: 0;
  pointer-events: none;
}
.flow[data-step="3"] .card--step2 {
  opacity: 0;
  pointer-events: none;
}
.flow[data-step="3"] .card--step3 {
  opacity: 1;
  pointer-events: auto;
  animation: softFadeIn 1800ms ease both;
}

/* Emergency override: keep step 3 interactive even when app state briefly rolls back. */
.flow.force-step3 .card--step1,
.flow.force-step3 .card--step2 {
  opacity: 0;
  pointer-events: none;
}
.flow.force-step3 .card--step3 {
  opacity: 1;
  pointer-events: auto;
}

@keyframes softFadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* 小幅度飘动，避免大 vw 位移撑出横向滚动条或让整页「看起来偏一边」 */
@keyframes soulDrift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  20% {
    transform: translate3d(5px, -3px, 0);
  }
  40% {
    transform: translate3d(-4px, -5px, 0);
  }
  60% {
    transform: translate3d(4px, 3px, 0);
  }
  80% {
    transform: translate3d(-3px, 4px, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes soulGlow {
  0%,
  100% {
    opacity: 0.76;
    filter: saturate(0.95);
  }
  50% {
    opacity: 1;
    filter: saturate(1.08);
  }
}

@keyframes soulBreathe {
  0%,
  100% {
    transform: scale(0.82);
    opacity: 0.68;
    border-radius: 43% 57% 62% 38% / 46% 39% 61% 54%;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
    border-radius: 50% 50% 58% 42% / 40% 44% 56% 60%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card--step1,
  .card--step2,
  .card--step3 {
    transition: none;
    animation: none;
  }
  .soulIcon {
    animation: none;
  }
  .reveal {
    animation: none;
  }
}

/* YAMNet tutorial-style audio visualization */
.yamnetVizActions {
  margin-top: 8px;
}
.yamnetVizHost {
  margin: 10px 0 4px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}
.yamnetVizStack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, #faf8ff 0%, #f3effa 100%);
  border: 1px solid rgba(92, 77, 138, 0.18);
}
.yamnetVizMeta {
  font-size: 12px;
  color: #5c4d8a;
  font-weight: 600;
}
.yamnetVizCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.yamnetVizHint {
  font-size: 11px;
  line-height: 1.45;
  color: #666;
  margin-top: 4px;
}

/* IndexedDB 仓库历史档案 */
.button--icon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.button--icon.button--hasHistory {
  border-color: rgba(92, 77, 138, 0.45);
  box-shadow: 0 0 0 1px rgba(92, 77, 138, 0.12);
}
.repoHistoryIcon {
  font-size: 1.05em;
  line-height: 1;
}
.repoHistoryPanel {
  margin-top: 0.65rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px dashed rgba(92, 77, 138, 0.28);
  background: rgba(250, 248, 255, 0.85);
}
.button--danger {
  border-color: rgba(180, 60, 60, 0.35);
  color: #8b2e2e;
}

/* Step 3 — 流水线分色面板 */
.stackCard--recognition {
  border-color: rgba(46, 125, 90, 0.35);
  background: linear-gradient(180deg, rgba(232, 248, 240, 0.65) 0%, var(--surface) 48%);
}

.stackCard--upload {
  border-color: rgba(46, 125, 90, 0.32);
  background: linear-gradient(180deg, rgba(232, 248, 240, 0.45) 0%, var(--surface) 42%);
}

.stackCard--upload #runAi:not(:disabled) {
  font-weight: 700;
}
.stackCard--pipeline {
  border-color: rgba(25, 118, 210, 0.28);
  background: linear-gradient(180deg, rgba(227, 242, 253, 0.5) 0%, var(--surface) 40%);
}
.stackCard--stage4Workbench {
  border-color: rgba(123, 31, 162, 0.28);
  background: linear-gradient(180deg, rgba(243, 229, 245, 0.55) 0%, var(--surface) 42%);
}
.stackCard--archive {
  border-color: rgba(0, 131, 143, 0.28);
  background: linear-gradient(180deg, rgba(224, 247, 250, 0.55) 0%, var(--surface) 42%);
}
.stackCard--library {
  border-color: rgba(230, 126, 34, 0.3);
  background: linear-gradient(180deg, rgba(255, 243, 224, 0.55) 0%, var(--surface) 42%);
}

/* display:flex 会覆盖原生 [hidden]，必须用 !important */
.ui-stage-suppressed,
.stageActionBlock--4a[hidden],
.stageActionBlock--4feat[hidden],
.stackCard--stage4Workbench[hidden],
.stackCard--library[hidden],
.stackCard--repo[hidden] {
  display: none !important;
}

.stageActionBlock {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 4px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.stageActionBlock--3ab {
  background: linear-gradient(135deg, rgba(224, 242, 241, 0.4) 0%, rgba(255, 243, 224, 0.35) 100%);
  border-color: rgba(0, 137, 123, 0.2);
}

.stageActionBlock--3a {
  background: rgba(224, 242, 241, 0.35);
  border-color: rgba(0, 137, 123, 0.22);
}

.stageActionBlock--3b {
  background: rgba(255, 243, 224, 0.35);
  border-color: rgba(245, 124, 0, 0.22);
}

.stageActionBlock--4feat {
  background: rgba(227, 242, 253, 0.4);
  border-color: rgba(21, 101, 192, 0.22);
}

.stageActionBlock--4a {
  background: rgba(243, 229, 245, 0.35);
  border-color: rgba(106, 27, 154, 0.2);
}

.stageActionBlock--catEnhance {
  background: rgba(237, 231, 246, 0.4);
  border-color: rgba(106, 27, 154, 0.24);
}

.stageActionBlock .button {
  width: 100%;
}

.stageActionBlock__field {
  margin-bottom: 8px !important;
}

.stageActionBlock__note {
  margin-top: 8px !important;
  font-size: 12px;
  line-height: 1.45;
}

.stagePanelMount {
  margin-top: 10px;
  min-height: 0;
}

.stagePanelMount:empty {
  display: none;
}

.stagePanelMount .stagePanel {
  margin: 0;
}

.stagePanel {
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.stagePanel--collapsible {
  overflow: visible;
}

.stagePanel__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  user-select: none;
}

.stagePanel__summary::-webkit-details-marker {
  display: none;
}

.stagePanel__summary::before {
  content: "▾";
  flex-shrink: 0;
  width: 1.25rem;
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.stagePanel--collapsible:not([open]) .stagePanel__summary::before {
  transform: rotate(-90deg);
}

.stagePanel__summaryHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.stagePanel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.stagePanel__title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.stagePanel__badge {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: #333;
  white-space: nowrap;
}

.stagePanel__desc {
  margin: 0;
  padding: 8px 14px 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.stagePanel__body {
  padding: 10px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stagePanel__empty {
  margin: 8px 0 4px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed rgba(0, 0, 0, 0.1);
}

.stagePanel--stage3a {
  border-color: rgba(0, 137, 123, 0.35);
  background: rgba(224, 242, 241, 0.55);
}
.stagePanel--stage3a .stagePanel__header {
  background: rgba(0, 137, 123, 0.12);
}
.stagePanel--stage3a .stagePanel__title {
  color: #00695c;
}

.stagePanel--stage3b {
  border-color: rgba(245, 124, 0, 0.35);
  background: rgba(255, 243, 224, 0.55);
}
.stagePanel--stage3b .stagePanel__header {
  background: rgba(245, 124, 0, 0.12);
}
.stagePanel--stage3b .stagePanel__title {
  color: #e65100;
}

.stagePanel--stage4feat {
  border-color: rgba(21, 101, 192, 0.35);
  background: rgba(227, 242, 253, 0.55);
}
.stagePanel--stage4feat .stagePanel__header {
  background: rgba(21, 101, 192, 0.1);
}
.stagePanel--stage4feat .stagePanel__title {
  color: #1565c0;
}

.stagePanel--catEnhance {
  border-color: rgba(106, 27, 154, 0.35);
  background: rgba(237, 231, 246, 0.6);
}
.stagePanel--catEnhance .stagePanel__header {
  background: rgba(106, 27, 154, 0.12);
}
.stagePanel--catEnhance .stagePanel__title {
  color: #6a1b9a;
}

.pipelineSampleRow {
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.88);
  padding: 10px 12px;
}

.pipelineSampleRow--details {
  padding: 0;
  overflow: hidden;
}

.pipelineSampleRow__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 600;
  user-select: none;
}

.pipelineSampleRow__summary::-webkit-details-marker {
  display: none;
}

.pipelineSampleRow__summary::before {
  content: "▾";
  flex-shrink: 0;
  width: 1rem;
  font-size: 11px;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.pipelineSampleRow--details:not([open]) .pipelineSampleRow__summary::before {
  transform: rotate(-90deg);
}

.pipelineSampleRow__body {
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pipelineSampleRow__actions {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

.pipelineSampleRow__actions .miniBtn--primary {
  font-weight: 700;
}

.cleanTrainingBadge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(46, 125, 50, 0.15);
  color: #2e7d32;
}

.cleanTrainingBadge--ai {
  background: rgba(46, 125, 90, 0.22);
  color: #1b5e20;
  border: 1px solid rgba(46, 125, 50, 0.35);
}

.manualTrim {
  margin: 8px 0 4px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed rgba(106, 27, 154, 0.35);
  background: rgba(237, 231, 246, 0.45);
}

.manualTrim__hint {
  margin-bottom: 6px !important;
  font-size: 12px;
  color: #5e35b1;
}

.manualTrim__times {
  margin-bottom: 8px !important;
  font-variant-numeric: tabular-nums;
}

.manualTrim__start,
.manualTrim__end {
  display: block;
  width: 100%;
  margin: 6px 0;
  accent-color: #7b1fa2;
}

.manualTrim__preview {
  margin-top: 6px;
}

.manualTrim__previewSlot audio {
  width: 100%;
  margin-top: 6px;
}

.manualTrim__waveform {
  width: 100%;
  margin: 6px 0 4px;
}

.waveformTrim {
  width: 100%;
}

.waveformTrim__canvas {
  display: block;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: crosshair;
  touch-action: none;
  background: #fff;
}

.waveformTrim__ruler {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}

.manualTrim__fineLabel {
  margin: 8px 0 2px !important;
  font-size: 11px;
  color: var(--muted);
}
.pipelineSampleRow--stage3a {
  border-left: 4px solid #00897b;
}
.pipelineSampleRow--stage3b {
  border-left: 4px solid #f57c00;
}
.pipelineSampleRow--stage4feat {
  border-left: 4px solid #1976d2;
}
.pipelineSampleRow--catEnhance {
  border-left: 4px solid #8e24aa;
}

.stagePlaybackLaneTag {
  font-size: 11px;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
}

.segmentRow--recognition {
  border-left: 4px solid #43a047;
  background: rgba(232, 245, 233, 0.45);
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 8px;
}

.archiveLabelSummary {
  margin: 0.5rem 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.45;
}
.archiveLabelSummary--ok {
  background: #e8f5e9;
  border-color: #a5d6a7;
}
.archiveLabelSummary--warn {
  background: #fff8e1;
  border-color: #ffe082;
}
.archiveLabelSummary--bad {
  background: #ffebee;
  border-color: #ef9a9a;
}
.archiveLabelSummary__meta,
.archiveLabelSummary__hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.archiveSampleLabelBoard {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0.5rem 0 0.75rem;
  max-height: 280px;
  overflow: auto;
}
.archiveLabelRow {
  display: grid;
  grid-template-columns: 72px 1fr minmax(80px, 1.2fr) 52px 64px;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 12px;
  background: #fff;
}
.archiveLabelRow--head {
  font-weight: 600;
  color: var(--muted);
  background: #fafafa;
  position: sticky;
  top: 0;
  z-index: 1;
}
.archiveLabelRow__id {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.archiveLabelRow__ok {
  color: #2e7d32;
}
.archiveLabelRow__pending {
  color: #e65100;
}
.archiveLabelRow__tag {
  width: 100%;
  font-size: 11px;
}

.clonePage__card {
  max-width: 720px;
  margin: 0 auto;
}
.clonePage__title {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
}
.clonePage__version {
  margin: 0 0 0.75rem;
  font-size: 12px;
  color: var(--muted);
}
.cloneReadinessPanel {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}
.cloneReadinessPanel--ok {
  background: #e8f5e9;
}
.cloneReadinessPanel--warn {
  background: #fff8e1;
}
.cloneReadinessPanel--bad {
  background: #ffebee;
}
.cloneReadinessPanel__title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}
.cloneReadinessPanel__stats {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 13px;
}
.cloneReadinessPanel__hint {
  font-size: 12px;
  color: var(--muted);
}
.cloneSampleTable {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 320px;
  overflow: auto;
}
.cloneSampleRow {
  display: grid;
  grid-template-columns: 28px 1fr 88px 56px 48px;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  background: #fff;
}
.cloneSampleRow--head {
  font-weight: 600;
  color: var(--muted);
  background: #fafafa;
}
.cloneSampleRow__id {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cloneUploadSection {
  margin: 0.75rem 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8f9fa;
}
.cloneUploadSection__title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}
.cloneUploadSection__hint {
  margin: 0 0 0.5rem;
  font-size: 12px;
  color: var(--muted);
}
.cloneUploadSection__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.cloneUploadSection__input {
  flex: 1 1 280px;
  min-width: 220px;
}
.cloneUploadSection__list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cloneUploadRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 1.1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}
.cloneUploadRow__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}
.cloneUploadRow__meta span {
  color: var(--muted);
}
.cloneUploadRow__audio {
  width: 100%;
}
.cloneUploadRow__remove {
  white-space: nowrap;
}
@media (max-width: 760px) {
  .cloneUploadRow {
    grid-template-columns: 1fr;
  }
}
.clonePrompt {
  width: 100%;
  box-sizing: border-box;
  margin-top: 4px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font: inherit;
}
.clonePage__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0.75rem;
}
.cloneApiResult {
  margin-top: 0.75rem;
  white-space: pre-wrap;
  max-height: 240px;
  overflow: auto;
}
.button--primary {
  font-weight: 600;
}

.cloneBackendDecision {
  margin: 0.5rem 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f5f9ff;
  font-size: 13px;
}
.cloneDecisionList {
  margin: 0;
  padding-left: 1.1rem;
}
.cloneDecisionList__foot {
  margin: 0.5rem 0 0;
  font-size: 12px;
  color: var(--muted);
}
.cloneServiceStatus {
  font-size: 12px;
  margin: 0.25rem 0 0.5rem;
  color: var(--muted);
}
.cloneBackendPick {
  display: block;
  margin-top: 0.75rem;
}

/* Clone Page Tabs */
.clone-tabs {
  display: flex;
  gap: 4px;
  margin: 1rem 0 0.5rem;
  border-bottom: 2px solid #e9ecef;
}

.clone-tab {
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #6c757d;
  transition: all 0.2s;
}

.clone-tab:hover {
  color: #495057;
  background: #f8f9fa;
}

.clone-tab.active {
  color: #339af0;
  border-bottom-color: #339af0;
  background: #e7f5ff;
}

/* Clone Panels */
.clone-panel {
  display: none;
}

.clone-panel.active {
  display: block;
}

/* Emotion Variants */
.emotion-variants-intro {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  font-size: 14px;
  color: #856404;
}

.emotion-variants-ui {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.emotion-section {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e9ecef;
}

.emotion-section h4 {
  margin: 0 0 16px 0;
  font-size: 16px;
  color: #495057;
}

.sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.sample-item {
  padding: 12px;
  background: white;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.sample-item:hover {
  border-color: #adb5bd;
  transform: translateY(-2px);
}

.sample-item.selected {
  border-color: #4dabf7;
  background: #e7f5ff;
}

.sample-item .name {
  font-weight: 500;
  font-size: 13px;
  margin-bottom: 4px;
}

.sample-item .meta {
  font-size: 12px;
  color: #6c757d;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.style-item {
  padding: 16px;
  background: white;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.style-item:hover {
  border-color: #adb5bd;
  transform: translateY(-2px);
}

.style-item.selected {
  border-color: #40c057;
  background: #d3f9d8;
}

.style-item .label {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
  color: #212529;
}

.style-item .desc {
  font-size: 12px;
  color: #6c757d;
}

.emotion-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-generate-variant {
  padding: 14px 28px;
  background: linear-gradient(135deg, #4dabf7 0%, #339af0 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  min-width: 200px;
}

.btn-generate-variant:disabled {
  background: #adb5bd;
  cursor: not-allowed;
}

.variant-preview {
  background: #d3f9d8;
  border: 1px solid #40c057;
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}

.variant-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 500;
}

.variant-params {
  font-size: 13px;
  color: #495057;
  margin-bottom: 12px;
}

.saved-variants {
  margin-top: 24px;
}

.saved-variants h4 {
  margin: 0 0 16px 0;
  font-size: 16px;
  color: #495057;
}

.variant-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.variant-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
}

.variant-item.approved {
  border-color: #40c057;
  background: #f4fce3;
}

.variant-actions {
  display: flex;
  gap: 8px;
}

.btn-approve, .btn-delete-variant {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.btn-approve {
  background: #40c057;
  color: white;
}

.btn-delete-variant {
  background: #fa5252;
  color: white;
}

.btn-regenerate {
  padding: 14px 28px;
  background: #f8f9fa;
  color: #495057;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}

.btn-regenerate:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

/* ==================== Behaviour Scenes Beta ==================== */
.behaviour-scenes-container {
  max-width: 800px;
  margin: 0 auto;
}

.behaviour-scenes-intro {
  background: #fff9db;
  border: 1px solid #fcc419;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
  color: #5c4800;
}

.voice-profile-card {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.voice-profile-card h4 {
  margin: 0 0 16px 0;
  color: #495057;
}

.voice-profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}

.voice-profile-stat {
  text-align: center;
  padding: 12px;
  background: white;
  border-radius: 8px;
}

.voice-profile-stat .value {
  font-size: 24px;
  font-weight: 700;
  color: #40c057;
}

.voice-profile-stat .label {
  font-size: 12px;
  color: #868e96;
  margin-top: 4px;
}

.behaviour-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.behaviour-item {
  padding: 16px;
  background: white;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.behaviour-item:hover {
  border-color: #adb5bd;
  transform: translateY(-2px);
}

.behaviour-item.selected {
  border-color: #40c057;
  background: #d3f9d8;
}

.behaviour-item .emoji {
  font-size: 28px;
  margin-bottom: 8px;
}

.behaviour-item .label {
  font-weight: 600;
  font-size: 14px;
}

.behaviour-item .desc {
  font-size: 12px;
  color: #868e96;
  margin-top: 4px;
}

.candidate-preview {
  background: #d3f9d8;
  border: 1px solid #40c057;
  border-radius: 12px;
  padding: 20px;
  margin-top: 20px;
}

.candidate-preview .tuning-params {
  font-family: monospace;
  font-size: 12px;
  background: rgba(0,0,0,0.05);
  padding: 12px;
  border-radius: 6px;
  margin: 12px 0;
}

.candidate-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn-approve {
  padding: 12px 24px;
  background: #40c057;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.btn-reject {
  padding: 12px 24px;
  background: #fa5252;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.template-warning {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  padding: 16px;
  color: #856404;
}

.template-source {
  font-size: 12px;
  color: #868e96;
  margin: 8px 0;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 4px;
}

.template-source small {
  color: #adb5bd;
}

.behaviour-item .desc {
  font-size: 11px;
  color: #868e96;
  margin-top: 4px;
}

/* ==================== Voice Transfer Beta ==================== */
.voice-transfer-container {
  max-width: 900px;
  margin: 0 auto;
}

.voice-transfer-intro {
  background: #e7f5ff;
  border: 1px solid #74c0fc;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
  color: #1864ab;
}

.voice-transfer-behaviour-ui {
  margin-bottom: 24px;
}

.voice-transfer-reference-ui {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.reference-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.reference-item {
  padding: 12px;
  background: white;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  font-size: 14px;
}

.reference-item.selected {
  border-color: #339af0;
  background: #e7f5ff;
}

.reference-item .duration {
  font-size: 12px;
  color: #868e96;
  margin-top: 4px;
}

.voice-transfer-output {
  margin-top: 24px;
}

.candidate-comparison {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0;
}

@media (max-width: 768px) {
  .candidate-comparison {
    grid-template-columns: 1fr;
  }
}

.comparison-card {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 16px;
}

.comparison-card.template {
  border-color: #fcc419;
  background: #fff9db;
}

.comparison-card.reference {
  border-color: #339af0;
  background: #e7f5ff;
}

.comparison-card.generated {
  border-color: #40c057;
  background: #d3f9d8;
}

.comparison-card h5 {
  margin: 0 0 12px 0;
  font-size: 14px;
}

.comparison-card audio {
  width: 100%;
  margin-bottom: 12px;
}

.comparison-meta {
  font-size: 12px;
  color: #868e96;
}

.candidate-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

.btn-generate-candidate {
  padding: 16px 32px;
  background: linear-gradient(135deg, #339af0, #1971c2);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-generate-candidate:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(51, 154, 240, 0.3);
}

.btn-generate-candidate:disabled {
  background: #adb5bd;
  cursor: not-allowed;
}

/* Debug Panel */
.debug-panel {
  background: #212529;
  color: #adb5bd;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 12px;
}

.debug-panel h4 {
  margin: 0 0 12px 0;
  color: #69db7c;
  font-size: 13px;
}

.debug-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid #343a40;
}

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

.debug-row span:first-child {
  color: #868e96;
}

.debug-row span:last-child,
.debug-row pre {
  color: #ced4da;
  text-align: right;
}

.debug-row pre {
  margin: 0;
  font-size: 10px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.usage-guide {
  background: #f3d9fa;
  border: 1px solid #da77f2;
  border-radius: 8px;
  padding: 16px;
  margin-top: 24px;
}

.usage-guide h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: #862e9c;
}

.usage-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e9ecef;
  font-size: 13px;
}

.usage-item:last-child {
  border-bottom: none;
}
