:root {
  --bg0: #0f1a17;
  --bg1: #163028;
  --ink: #e8f2ec;
  --muted: #9bb5a8;
  --accent: #d4a017;
  --accent-2: #2db88a;
  --danger: #e35d5d;
  --line: rgba(232, 242, 236, 0.12);
  --panel: rgba(18, 34, 29, 0.82);
  --font-display: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-display);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(45, 184, 138, 0.28), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(212, 160, 23, 0.22), transparent 55%),
    linear-gradient(160deg, var(--bg0), var(--bg1));
}

.page {
  width: min(860px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 3rem;
}

.hero {
  margin-bottom: 1.5rem;
}

h1 {
  margin: 0.35rem 0 0.4rem;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 750;
}

.sub {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.nav {
  margin: 0.75rem 0 0;
}

.nav a {
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 600;
}

.nav a:hover {
  text-decoration: underline;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem;
  backdrop-filter: blur(10px);
}

.section-title {
  margin: 0 0 0.9rem;
  font-size: 1.05rem;
}

.form-grid {
  display: grid;
  gap: 0.85rem;
}

.form-grid label {
  display: grid;
  gap: 0.4rem;
}

.form-grid input[type="text"],
.form-grid input[type="file"],
.form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
  padding: 0.7rem 0.85rem;
  font: inherit;
}

button.ghost,
a.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  margin-left: auto;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.25rem;
  border-radius: 10px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  box-sizing: border-box;
}

.home-top-actions .ghost,
.manage-top-actions .ghost,
.studio-user-actions .ghost {
  margin-left: 0;
}

button.danger {
  background: var(--danger);
  color: #fff;
  padding: 0.45rem 0.85rem;
}

.voice-list {
  margin-top: 1rem;
  display: grid;
  gap: 0.65rem;
}

.voice-pager {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}

.voice-pager-size {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.voice-pager-size select {
  min-width: 4.5rem;
  padding: 0.25rem 0.4rem;
}

.voice-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
}

.voice-item-actions {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.voice-item-actions button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.btn-voice-custom {
  background: transparent;
  color: #9ec0e8;
  border: none;
  padding: 0.2rem 0.15rem;
  font-size: 0.88rem;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.btn-voice-custom:hover {
  color: #c5dcff;
}

.btn-voice-delete {
  background: #4a2424;
  color: #ffd6d6;
  border: 1px solid #7a3a3a;
}

.btn-voice-delete:hover {
  background: #5c2e2e;
  color: #fff;
}

.custom-preview-dialog {
  width: min(92vw, 22rem);
  background: #1c2420;
  border: 1px solid var(--line, #2d3b34);
  border-radius: 14px;
  padding: 1.1rem 1.15rem 1rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.custom-preview-dialog h3 {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #eef4f0;
  text-align: center;
}

.custom-preview-dialog input {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #3a4a42;
  background: #e8ece9;
  color: #1a221e;
  font-size: 0.95rem;
}

.custom-preview-count {
  margin: 0.45rem 0 0;
  text-align: right;
  font-size: 0.78rem;
  color: var(--muted, #9bb0a6);
}

.custom-preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}

.custom-preview-actions #btnCustomPreviewOk {
  background: transparent;
  border: none;
  color: #f0a060;
  font-weight: 700;
  padding: 0.35rem 0.5rem;
}

.manage-log {
  margin: 1rem 0 0;
  max-height: 180px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0.8rem 1rem;
  font-size: 0.82rem;
  white-space: pre-wrap;
  color: #cfe3d9;
}

.controls.single {
  grid-template-columns: 1fr;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 160px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
  padding: 0.9rem 1rem;
  font: inherit;
  line-height: 1.55;
}

input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
  padding: 0.7rem 0.85rem;
  font: inherit;
  margin: 0.35rem 0 0.9rem;
}

textarea:focus {
  outline: 2px solid rgba(45, 184, 138, 0.45);
  border-color: transparent;
}

.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
}

.field label {
  margin-bottom: 0.4rem;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
  padding: 0.7rem 0.85rem;
  font: inherit;
  /* Native dropdown popup follows OS chrome; force dark so white labels stay readable. */
  color-scheme: dark;
}

select option,
select optgroup {
  background-color: #1a2e27;
  color: #e8f2ec;
}

select:focus {
  outline: 2px solid rgba(45, 184, 138, 0.45);
  border-color: transparent;
}

.hint {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .controls {
    grid-template-columns: 1fr;
  }
}

.row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 0.7rem 1.25rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

#btnRun.btn-run {
  background: var(--accent-2);
  color: #062018;
}

#btnRun.btn-run.running {
  background: var(--danger);
  color: #fff;
}

#btnPause,
.btn-pause {
  background: #2a3d36;
  color: #e8f2ec;
  border: 1px solid #3d5a4e;
}

#btnPreview,
.btn-preview {
  background: #24354f;
  color: #dce8f8;
  border: 1px solid #3a5478;
}

.btn-rename {
  background: #2a3d36;
  color: #e8f2ec;
  border: 1px solid #3d5a4e;
}

.play-voice-name {
  color: #d7e2ea;
  font-size: 0.9rem;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.badge {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
}

.badge.on {
  color: #9ff0ce;
  border-color: rgba(45, 184, 138, 0.45);
}

.meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 1.1rem;
}

.meta > div {
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}

.meta span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

.meta strong {
  font-weight: 600;
  line-height: 1.45;
  word-break: break-word;
}

.current-line #currentText {
  display: block;
  height: calc(1.45em * 3);
  max-height: calc(1.45em * 3);
  overflow: auto;
  line-height: 1.45;
}

.log-wrap {
  margin-top: 1rem;
}

.log-title {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

#log {
  margin: 0;
  max-height: 240px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0.8rem 1rem;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: #cfe3d9;
}

/* Non-blocking toasts — never use alert/confirm (they freeze audio). */
.toast-host {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4000;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: min(420px, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  padding: 0.7rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(21, 35, 30, 0.96);
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.4;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-error {
  border-color: rgba(227, 93, 93, 0.45);
  background: rgba(58, 24, 24, 0.96);
}

.toast-ok {
  border-color: rgba(45, 184, 138, 0.45);
}

.notify-confirm-dialog {
  min-width: min(22rem, calc(100vw - 2rem));
  text-align: left;
}

.notify-confirm-text {
  margin: 0 0 1rem !important;
  line-height: 1.5;
}

.notify-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
}

.upload-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(6, 12, 10, 0.62);
  backdrop-filter: blur(2px);
}

.upload-mask[hidden] {
  display: none;
}

.upload-dialog {
  min-width: 12rem;
  padding: 1.25rem 1.6rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #15231e;
  color: #e8f2ec;
  text-align: center;
}

.upload-dialog p {
  margin: 0.85rem 0 0;
  font-size: 0.95rem;
}

.upload-spinner {
  width: 1.6rem;
  height: 1.6rem;
  margin: 0 auto;
  border: 2px solid rgba(159, 240, 206, 0.25);
  border-top-color: #9ff0ce;
  border-radius: 50%;
  animation: upload-spin 0.8s linear infinite;
}

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

.train-job-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.manage-train-job-section {
  padding: 0.75rem 0.9rem;
}

.train-job-list {
  margin: 0;
  display: grid;
  gap: 0.45rem;
}

.train-job-line {
  margin: 0;
  color: #cfe3d9;
  font-size: 0.9rem;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: nowrap;
}

.train-job-line.train-job-busy {
  color: #9ff0ce;
}

.train-job-spinner {
  width: 0.85rem;
  height: 0.85rem;
  flex: 0 0 auto;
  border: 2px solid rgba(159, 240, 206, 0.28);
  border-top-color: #9ff0ce;
  border-radius: 50%;
  animation: upload-spin 0.8s linear infinite;
}

.voice-item.train-job-busy {
  border-color: rgba(159, 240, 206, 0.28);
}

.manage-train-job-section.train-job-busy {
  border-color: rgba(159, 240, 206, 0.28);
}

/* —— AI 主播控制台 —— */
.page.studio {
  width: min(1280px, calc(100% - 2rem));
  padding: 1.25rem 0 5.5rem;
}

.page.studio .panel {
  padding: 0.9rem 1rem;
  border-radius: 14px;
}

.studio-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.top-bar .top-row + .top-row {
  margin-top: 1rem;
}

.voice-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.voice-pick {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.voice-row label,
.voice-pick label {
  margin: 0;
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text, #e8f0ee);
  letter-spacing: 0.02em;
}

.voice-row select,
.voice-pick select {
  /* Override global select { width:100% } or it fills the whole voice-row. */
  flex: 0 0 280px;
  width: 280px;
  max-width: min(280px, 46vw);
  min-width: 0;
  box-sizing: border-box;
}

.voice-pick + .voice-pick {
  margin-left: 2rem;
}

.cohost-mute-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  margin: 0;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  color: var(--muted, #9aa7b0) !important;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.cohost-mute-toggle input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: #f0c674;
  cursor: pointer;
}

.btn-danmu-log {
  flex: 0 0 auto;
  margin-left: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  border-radius: 12px;
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  color: #062018;
  background: var(--accent-2);
}

.top-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.btn-adv-settings {
  flex: 0 0 auto;
  border: 0;
  border-radius: 12px;
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  color: #062018;
  background: var(--accent-2);
}

.btn-adv-settings:hover {
  filter: brightness(1.08);
}

.btn-script-gen {
  flex: 0 0 auto;
  border: 0;
  border-radius: 12px;
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  color: #d7eef6;
  background: #2f6b82;
}

.btn-script-gen:hover {
  filter: brightness(1.1);
}

.script-gen-dialog {
  width: min(720px, calc(100vw - 2rem));
  max-height: min(92vh, 900px);
  overflow: auto;
  background: #121a18;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.script-gen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.script-gen-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.script-gen-tip {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.script-gen-step {
  margin: 0 0 0.85rem;
}

.script-gen-step h4 {
  margin: 0 0 0.25rem;
  font-size: 0.98rem;
}

.script-gen-sub {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.script-gen-step textarea {
  width: 100%;
  min-height: 7rem;
  resize: vertical;
}

.script-gen-out-wrap {
  position: relative;
}

.script-gen-busy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border-radius: 12px;
  background: rgba(8, 14, 12, 0.78);
  color: #e8f5ef;
  text-align: center;
  padding: 1rem;
  z-index: 2;
}

.script-gen-busy[hidden] {
  display: none !important;
}

.script-gen-busy p {
  margin: 0;
  font-size: 0.92rem;
}

.btn-script-gen-run,
.btn-script-gen-copy {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  margin: 0 0 0.85rem;
  color: #062018;
  background: var(--accent-2);
}

.btn-script-gen-run:disabled,
.btn-script-gen-copy:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-script-gen-copy.is-dirty {
  background: #93c5fd;
}

.btn-danmu-log:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-danmu-log-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.adv-settings-dialog {
  width: min(760px, calc(100vw - 2rem));
  max-height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.25rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #15231e;
  color: #e8f2ec;
  text-align: left;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.adv-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.adv-settings-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.adv-settings-body {
  flex: 1 1 auto;
  overflow: auto;
  padding-right: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.adv-block {
  border: 1px solid rgba(232, 242, 236, 0.1);
  border-radius: 12px;
  padding: 0.85rem 0.9rem 1rem;
  background: rgba(8, 16, 13, 0.4);
}

.adv-block h4 {
  margin: 0 0 0.35rem;
  color: var(--accent-2);
  font-size: 0.98rem;
}

.adv-hint {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.adv-block textarea {
  width: 100%;
  min-height: 6.5rem;
  margin: 0 0 0.65rem;
  resize: vertical;
}

.adv-block > input[type="text"] {
  width: 100%;
  max-width: none;
  margin: 0;
}

.adv-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
  margin: 0;
}

.adv-field input {
  width: 100%;
  max-width: 220px;
  margin: 0;
}

.adv-field-wide {
  margin-top: 0.65rem;
}

.adv-field-wide input {
  max-width: none;
}

.adv-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

@media (max-width: 640px) {
  .adv-row {
    grid-template-columns: 1fr;
  }
}

.adv-settings-foot {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.85rem;
}

.rewrite-extra-dialog {
  width: min(560px, calc(100vw - 2rem));
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.15rem 1.25rem 1.2rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #15231e;
  color: #e8f2ec;
  text-align: left;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.rewrite-extra-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.rewrite-extra-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.rewrite-extra-sub {
  margin: 0;
  color: #9db5aa;
  font-size: 0.92rem;
}

.rewrite-extra-dialog textarea {
  width: 100%;
  min-height: 12rem;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0f1a16;
  color: inherit;
  padding: 0.75rem 0.85rem;
  font: inherit;
  line-height: 1.55;
}

.rewrite-extra-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  padding-top: 0.25rem;
}

.rewrite-extra-foot .ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  border-radius: 10px;
  padding: 0.55rem 1rem;
  font: inherit;
  cursor: pointer;
}

.rewrite-extra-foot button:not(.ghost) {
  border: 0;
  border-radius: 10px;
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: #062018;
  background: var(--accent-2);
}

.btn-adv-save {
  border: 0;
  border-radius: 12px;
  padding: 0.7rem 1.25rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: #062018;
  background: var(--accent-2);
}

.reply-log-dialog {
  width: min(720px, calc(100vw - 2rem));
  max-height: min(80vh, 640px);
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.25rem 1.15rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #15231e;
  color: #e8f2ec;
  text-align: left;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.reply-log-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem 1rem;
  align-items: start;
  margin-bottom: 0.85rem;
}

.reply-log-head h3 {
  margin: 0;
  font-size: 1.1rem;
  white-space: nowrap;
}

.reply-log-tip {
  margin: 0.15rem 0 0;
  color: #e8a06a;
  font-size: 0.82rem;
  line-height: 1.45;
}

.reply-log-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.15rem;
}

.reply-log-close:hover {
  color: var(--ink);
}

.reply-log-simulate {
  display: flex;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.reply-log-simulate input {
  flex: 1;
  margin: 0;
}

.reply-log-simulate button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 12px;
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: #062018;
  background: var(--accent-2);
  white-space: nowrap;
}

.reply-log-simulate button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.reply-log-list {
  flex: 1 1 auto;
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 16, 13, 0.55);
  padding: 0.75rem;
}

.reply-log-empty {
  margin: 4.5rem 0;
  text-align: center;
  color: var(--muted);
}

.reply-log-item {
  padding: 0.65rem 0.55rem;
  border-bottom: 1px solid rgba(232, 242, 236, 0.08);
}

.reply-log-item:last-child {
  border-bottom: 0;
}

.reply-log-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.3rem;
}

.reply-log-q,
.reply-log-a {
  margin: 0.2rem 0;
  line-height: 1.45;
  font-size: 0.92rem;
  word-break: break-word;
}

.reply-log-q strong,
.reply-log-a strong {
  color: var(--accent-2);
  font-weight: 700;
  margin-right: 0.35rem;
}

.slot-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.65rem 1.25rem;
  margin: 0 0 0.55rem;
  font-size: 0.98rem;
}

.studio-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.studio-top-main {
  min-width: 0;
  flex: 1 1 auto;
}

.studio-slot-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.55rem 1rem;
}

.studio-slot-title {
  margin: 0;
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: var(--accent-2, #7dffa6);
  text-shadow: 0 0 18px rgba(125, 255, 166, 0.18);
}

.studio-slot-pick {
  align-items: center;
}

.studio-slot-pick label {
  color: var(--accent-2, #7dffa6);
  font-weight: 700;
  font-size: 1.05rem;
}

.studio-slot-pick select {
  min-width: min(18rem, 72vw);
  max-width: min(28rem, 92vw);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-2, #7dffa6);
  border-color: rgba(125, 255, 166, 0.35);
}

.slot-id-line {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.studio-user-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 0 0 auto;
}

.slot-heading .slot-remark-value {
  color: var(--accent-2);
}

.slot-heading .linkish {
  margin-left: 0.35rem;
  margin-top: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font-weight: 600;
  line-height: inherit;
  vertical-align: baseline;
}

.slot-heading .linkish:focus,
.slot-heading .linkish:focus-visible {
  outline: none;
  text-decoration: underline;
}

.inline-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.inline-row select,
.inline-row input[type="text"] {
  flex: 1;
  margin: 0;
}

.field.grow {
  width: 100%;
}

.studio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.studio-card-wide {
  grid-column: 1 / -1;
}

.studio-card label,
.studio-card .section-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.studio-card textarea {
  min-height: 120px;
  margin-bottom: 0.2rem;
}

.studio-card textarea#script,
.studio-card textarea#productDesc {
  min-height: 300px;
  height: 420px;
  width: 100%;
  resize: none;
}

.char-count {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.script-char-count {
  justify-content: space-between;
}

.script-char-count .char-count-num {
  flex: 0 0 auto;
  white-space: nowrap;
}

.play-mode-hint {
  flex: 1 1 auto;
  font-size: 0.98rem;
  font-weight: 650;
  line-height: 1.4;
  text-align: left;
  min-width: 0;
  color: #b8f5d4;
}

.play-mode-hint.is-link {
  color: #86efac;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.play-mode-hint.is-link:hover {
  color: #bbf7d0;
}

.play-mode-hint-link {
  color: #86efac;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  margin-left: 0.15rem;
}

.play-mode-hint-link:hover {
  color: #bbf7d0;
}

.char-count .is-over {
  color: var(--danger);
  font-weight: 600;
}

.muted {
  color: var(--muted);
  font-weight: 400;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
}

.reception-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: 0.65rem;
}

.reception-row:first-child {
  margin-top: 0;
}

.reception-row > .section-label,
.reception-row > label.section-label {
  flex: 0 0 auto;
  margin-bottom: 0;
  white-space: nowrap;
}

.reception-row .chip-row,
.reception-row > input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ink);
  cursor: pointer;
  margin: 0;
}

.chip[hidden] {
  display: none !important;
}

.chip input[type="radio"],
.chip input[type="checkbox"] {
  accent-color: var(--accent-2);
}

.chip.is-locked {
  cursor: default;
  opacity: 0.92;
  pointer-events: none;
}

.chip-with-action {
  gap: 0.45rem;
}

.btn-paragraph-gap {
  margin: 0;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(125, 255, 166, 0.45);
  background: rgba(125, 255, 166, 0.12);
  color: var(--accent-2, #7dffa6);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.3;
}

.btn-paragraph-gap:hover {
  background: rgba(125, 255, 166, 0.22);
}

.studio-footer {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin-top: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.65rem 0 0.35rem;
  background: linear-gradient(180deg, transparent, rgba(15, 26, 23, 0.92) 28%, rgba(15, 26, 23, 0.98));
}

.studio-footer .badge {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 0;
}

.studio-footer .badge[hidden] {
  display: none !important;
}

.btn-start-live {
  flex: 0 0 auto;
  min-width: 200px;
  width: min(280px, 70vw);
  border: 0;
  border-radius: 14px;
  padding: 0.85rem 1.5rem;
  font: inherit;
  font-size: 1.08rem;
  font-weight: 700;
  cursor: pointer;
  color: #062218;
  background: linear-gradient(135deg, #3ad4a0, #2db88a);
}

.btn-start-live.running {
  color: #fff;
  background: linear-gradient(135deg, #e35d5d, #c44747);
}

.btn-danger {
  border: 0;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: #e35d5d;
  white-space: nowrap;
}

.player-popup {
  position: fixed;
  /* default: screen center */
  left: 50%;
  right: auto;
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
  z-index: 50;
  width: min(420px, calc(100% - 2rem));
  touch-action: none;
}

.player-popup.is-dragged {
  right: auto;
  bottom: auto;
  transform: none;
}

.player-popup.hidden {
  display: none;
}

.player-popup-inner {
  background: rgba(20, 28, 32, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 0.55rem 1.15rem 0.9rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  cursor: grab;
  user-select: none;
}

.player-popup-inner:active {
  cursor: grabbing;
}

.player-popup-inner button,
.player-popup-inner a,
.player-popup-inner input {
  cursor: pointer;
  user-select: auto;
}

.player-drag-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin: 0 -0.35rem 0.55rem;
  padding: 0.35rem 0.5rem;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.04);
  min-height: 1.6rem;
  box-sizing: border-box;
}

.player-drag-hint {
  opacity: 0.75;
  user-select: none;
}

.play-time {
  font-variant-numeric: tabular-nums;
  color: var(--muted, #9bb0a6);
  font-size: 0.95rem;
  min-width: 6.5rem;
  flex: 0 0 auto;
}

.player-controls .play-speech-kind {
  flex: 0 0 2.2em;
  width: 2.2em;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: #86efac;
  white-space: nowrap;
  text-align: center;
  letter-spacing: 0.02em;
  visibility: hidden;
}

.player-controls .play-speech-kind.is-kind {
  visibility: visible;
}

.player-stage {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  min-height: 5.2rem;
  margin-bottom: 0.75rem;
}

.player-buffer-anim {
  display: none;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  min-height: 2.6rem;
  width: 100%;
}

.player-popup.is-buffering .player-buffer-anim {
  display: flex;
}

.player-buffer-anim span {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: #8ec5ff;
  opacity: 0.35;
  animation: player-buffer-bounce 0.85s ease-in-out infinite;
}

.player-buffer-anim span:nth-child(2) {
  animation-delay: 0.14s;
}

.player-buffer-anim span:nth-child(3) {
  animation-delay: 0.28s;
}

@keyframes player-buffer-bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.3;
  }
  40% {
    transform: translateY(-0.45rem);
    opacity: 1;
  }
}

.player-current {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.2rem;
  color: #f2f5f7;
  line-height: 1.45;
  font-size: 0.98rem;
  text-align: center;
}

.player-popup.is-buffering .player-current {
  text-align: center;
  color: #c5ced6;
  font-size: 0.9rem;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.player-controls .btn-pause {
  margin-left: auto;
  width: auto;
  white-space: nowrap;
}

.player-tip {
  margin: 0.65rem 0 0;
  color: #7eb6ff;
  font-size: 0.78rem;
}

/* nei.html playlist player */
body[data-page="nei"] .player-popup.player-popup-playlist {
  width: min(860px, calc(100% - 1.5rem));
}

body[data-page="nei"] .player-stage-playlist {
  min-height: 0;
  margin-bottom: 0.25rem;
  position: relative;
}

/* Subtitle block is for studio.html only; playlist UI must not show/reserve it. */
body[data-page="nei"] #currentText.player-current {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
}

body[data-page="nei"] .playlist-status {
  text-align: center;
  color: #c5ced6;
  font-size: 0.88rem;
  padding: 0.35rem 0.25rem 0.55rem;
}

/* Scroll area: fixed 8 rows tall; row height grows when sentence wraps. */
body[data-page="nei"] .playlist-scroll {
  height: calc(2.05rem + 8 * 2.75rem);
  min-height: calc(2.05rem + 8 * 2.75rem);
  max-height: calc(2.05rem + 8 * 2.75rem);
  overflow: auto;
  border: none;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  cursor: default;
}

body[data-page="nei"] .playlist-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.82rem;
}

body[data-page="nei"] .playlist-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #1a2228;
  color: #9aa7b0;
  font-weight: 600;
  text-align: left;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body[data-page="nei"] .playlist-table thead th.col-title {
  overflow: visible;
}

body[data-page="nei"] .playlist-table .col-title .playlist-title-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  width: 100%;
}

body[data-page="nei"] .playlist-table .col-title .playlist-title-row > span:first-child {
  flex: 0 0 auto;
}

body[data-page="nei"] .playlist-cd-home {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: center;
}

body[data-page="nei"] .next-para-countdown {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  color: #f4f7fa;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

body[data-page="nei"] .next-para-countdown[hidden] {
  display: none !important;
}

body[data-page="nei"] .next-para-gap-time {
  display: inline-block;
  margin: 0 0.28rem;
  color: #f5a623;
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  vertical-align: -0.08em;
}

body[data-page="nei"] .next-para-countdown.is-zero .next-para-gap-time {
  color: #e67e22;
}

body[data-page="nei"] .playlist-table .col-idx {
  width: 2.4rem;
  text-align: right;
}

body[data-page="nei"] .playlist-table .col-dur {
  width: 3.4rem;
  text-align: right;
}

body[data-page="nei"] .playlist-table td {
  padding: 0.38rem 0.55rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #e8eef2;
  vertical-align: top;
  line-height: 1.4;
  min-height: 1.9rem;
  height: auto;
  box-sizing: border-box;
}

body[data-page="nei"] .playlist-table td.col-title {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
  overflow-wrap: break-word;
}

body[data-page="nei"] .playlist-table td.col-idx,
body[data-page="nei"] .playlist-table td.col-dur {
  color: #8b9aa5;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  vertical-align: top;
  padding-top: 0.45rem;
}

body[data-page="nei"] .playlist-table tbody tr.playlist-track:last-child td {
  border-bottom: none;
}

body[data-page="nei"] .playlist-table tbody tr.playlist-track {
  cursor: pointer;
}

body[data-page="nei"] .playlist-table tbody tr.playlist-track:hover {
  background: rgba(125, 255, 166, 0.08);
}

body[data-page="nei"] .playlist-table tbody tr.is-playing {
  background: rgba(125, 255, 166, 0.16);
}

body[data-page="nei"] .playlist-table tbody tr.is-playing td {
  color: #f3fff7;
}

body[data-page="nei"] .playlist-table tbody tr.is-playing td.col-dur.is-countdown {
  color: #7dffa6;
  font-weight: 700;
}

body[data-page="nei"] .playlist-table tbody tr.playlist-track.is-hard-cut-skip {
  background: rgba(255, 72, 72, 0.22);
}

body[data-page="nei"] .playlist-table tbody tr.playlist-track.is-hard-cut-skip td {
  color: #ffc9c9;
}

body[data-page="nei"] .playlist-table tbody tr.playlist-track.is-hard-cut-skip td.col-idx,
body[data-page="nei"] .playlist-table tbody tr.playlist-track.is-hard-cut-skip td.col-dur {
  color: #ff9a9a;
}

body[data-page="nei"] .playlist-table tbody tr.playlist-track.is-hard-cut-skip:hover {
  background: rgba(255, 72, 72, 0.3);
}

/* Partial hard-cut: green = kept/playable share, red = cut share */
body[data-page="nei"] .playlist-table tbody tr.playlist-track.is-hard-cut-partial {
  --hard-cut-keep: 1;
  background: linear-gradient(
    to right,
    rgba(125, 255, 166, 0.32) calc(var(--hard-cut-keep) * 100%),
    rgba(255, 72, 72, 0.24) calc(var(--hard-cut-keep) * 100%)
  );
}

body[data-page="nei"] .playlist-table tbody tr.playlist-track.is-hard-cut-partial td {
  background: transparent;
  color: #f3fff7;
}

body[data-page="nei"] .playlist-table tbody tr.playlist-track.is-hard-cut-partial.is-playing {
  background: linear-gradient(
    to right,
    rgba(125, 255, 166, 0.42) calc(var(--hard-cut-keep) * 100%),
    rgba(255, 72, 72, 0.28) calc(var(--hard-cut-keep) * 100%)
  );
}

body[data-page="nei"] .playlist-table tbody tr.playlist-track.is-hard-cut-partial:hover {
  background: linear-gradient(
    to right,
    rgba(125, 255, 166, 0.38) calc(var(--hard-cut-keep) * 100%),
    rgba(255, 72, 72, 0.3) calc(var(--hard-cut-keep) * 100%)
  );
}

body[data-page="nei"] .playlist-table tbody tr.playlist-track.is-cohost td.col-title {
  color: #f0c674;
}

body[data-page="nei"] .playlist-table tbody tr.playlist-track.is-cohost.is-playing td.col-title {
  color: #ffe09a;
}

body[data-page="nei"] .playlist-table tbody tr.is-played.is-cohost td.col-title {
  color: #c4a35a;
}

body[data-page="nei"] .playlist-table tbody tr.is-played td.col-title {
  color: #9aa7b0;
}

body[data-page="nei"] .playlist-table tr.playlist-gap td {
  padding: 0.45rem 0.55rem;
  border-bottom: none;
  height: auto;
  line-height: 1;
  background: transparent;
  text-align: center;
  vertical-align: middle;
}

body[data-page="nei"] .playlist-table tr.playlist-gap .playlist-gap-label {
  display: inline-block;
  position: relative;
  padding: 0 0.65rem;
  color: #7dd3a8;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  opacity: 0.9;
}

body[data-page="nei"] .playlist-table tr.playlist-gap.is-current .playlist-gap-label {
  color: #f5a623;
  opacity: 1;
}

body[data-page="nei"] .playlist-table tr.playlist-gap .playlist-gap-label::before,
body[data-page="nei"] .playlist-table tr.playlist-gap .playlist-gap-label::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 3.2rem;
  border-top: 1px dashed rgba(125, 211, 168, 0.45);
}

body[data-page="nei"] .playlist-table tr.playlist-gap .playlist-gap-label::before {
  right: 100%;
}

body[data-page="nei"] .playlist-table tr.playlist-gap .playlist-gap-label::after {
  left: 100%;
}

body[data-page="nei"] .playlist-table tr.playlist-empty-row td {
  text-align: center;
  color: #7a8790;
  padding: 1.4rem 0.75rem;
  border-bottom: none;
  height: auto;
  white-space: normal;
}

body[data-page="nei"] .player-controls .btn-buyin-link {
  margin-left: auto;
  margin-right: 2.25rem;
  width: auto;
  white-space: nowrap;
  padding: 0.7rem 1.25rem;
  border-radius: 10px;
  border: 1px solid #2f9e6b;
  background: #1a7a52;
  color: #e8fff4;
  font-weight: 650;
  font: inherit;
  cursor: pointer;
}

body[data-page="nei"] .player-controls .btn-buyin-link:hover:not(:disabled) {
  background: #219463;
}

body[data-page="nei"] .player-controls .btn-buyin-link:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

body[data-page="nei"] .player-controls .btn-pause {
  margin-left: 0;
}

body[data-page="nei"] .playlist-table .buyin-mark {
  color: #3ddea0;
  font-weight: 700;
  margin: 0 0.15em;
  letter-spacing: 0.02em;
}

body[data-page="nei"] .player-popup.is-buffering .player-buffer-anim {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: rgba(12, 16, 20, 0.72);
  border-radius: 10px;
}

body[data-page="nei"] .player-popup.is-buffering .playlist-scroll {
  opacity: 0.35;
}

/* nei: 1 参考话术 / 2 智能回复 上下全宽，不再左右分栏 */
body[data-page="nei"] .studio-grid > .studio-card:nth-child(1),
body[data-page="nei"] .studio-grid > .studio-card:nth-child(2) {
  grid-column: 1 / -1;
}

body[data-page="nei"] .studio-card textarea#script {
  height: 280px;
  min-height: 180px;
}

body[data-page="nei"] .studio-card textarea#productDesc {
  height: 2.4rem;
  min-height: 2.4rem;
  resize: vertical;
}

/* nei video sync */
body[data-page="nei"] .btn-video-sync {
  background: #2a3340;
  color: #dce8f8;
  border: 1px solid #3a5478;
}

body[data-page="nei"] .btn-video-sync.is-on {
  background: #1f3d32;
  color: #b7f0d2;
  border-color: rgba(125, 255, 166, 0.45);
}

body[data-page="nei"] .video-sync-stage {
  position: fixed;
  right: 1rem;
  bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  z-index: 45;
  width: min(360px, calc(100vw - 2rem));
  background: rgba(12, 16, 20, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 0.55rem 0.65rem 0.65rem;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

/* Modal open: keep preview above dimmed mask so user can scrub for cue marking. */
body[data-page="nei"] .video-sync-stage.is-cue-picking {
  z-index: 1100;
  pointer-events: auto;
  filter: none;
  opacity: 1;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65), 0 0 0 2px rgba(125, 211, 168, 0.55);
}

body[data-page="nei"] .video-sync-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  color: #c5ced6;
  font-size: 0.78rem;
}

body[data-page="nei"] .video-sync-meta {
  color: #7dd3a8;
  font-size: 0.72rem;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="nei"] .video-sync-stage video {
  display: block;
  width: 100%;
  max-height: 220px;
  border-radius: 10px;
  background: #000;
}

body[data-page="nei"] .video-sync-pip-placeholder {
  display: none;
  box-sizing: border-box;
  width: 100%;
  min-height: 72px;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: #0a0c0e;
  color: #c5ced6;
  font-size: 0.78rem;
  line-height: 1.4;
  text-align: center;
}

body[data-page="nei"] .video-sync-stage.is-capture-open .video-sync-pip-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

body[data-page="nei"] .video-sync-stage.is-capture-open video {
  /* video moved to system window */
  display: none !important;
}

/* 采集弹出后仍在本页浮窗显示进度（浏览器地址栏无法自定义进度条） */
body[data-page="nei"] .video-sync-stage.is-capture-open .video-sync-scrub {
  display: flex;
  margin-top: 0.55rem;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(125, 211, 168, 0.28);
}

body[data-page="nei"] .video-sync-stage.is-capture-open .video-sync-time-label {
  color: #7dd3a8;
  font-size: 0.85rem;
  font-weight: 600;
}

body[data-page="nei"] .video-sync-scrub {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.4rem;
}

body[data-page="nei"] .video-sync-scrub input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 0.35rem;
  margin: 0;
  accent-color: #7dd3a8;
  cursor: pointer;
}

body[data-page="nei"] .video-sync-time-label {
  flex: 0 0 auto;
  color: #9aa7b2;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

body[data-page="nei"] .video-sync-dialog {
  width: min(520px, calc(100vw - 1.5rem));
  max-height: min(86vh, 720px);
  overflow: auto;
  background: #151b20;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 1rem 1.1rem 1.1rem;
  color: #e8eef2;
}

body[data-page="nei"] .video-sync-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

body[data-page="nei"] .video-sync-close {
  flex: 0 0 auto;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  background: #243039;
  color: #f2f6f8;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

body[data-page="nei"] .video-sync-close:hover {
  background: #314049;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

body[data-page="nei"] .video-sync-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

body[data-page="nei"] .video-sync-sub {
  margin: 0 0 0.85rem;
  color: #9aa7b0;
  font-size: 0.82rem;
  line-height: 1.45;
}

body[data-page="nei"] .video-sync-enable {
  margin-bottom: 0.75rem;
}

body[data-page="nei"] .video-sync-dialog .adv-field {
  display: block;
  margin-bottom: 0.85rem;
}

body[data-page="nei"] .video-sync-cues-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
  font-size: 0.82rem;
  color: #c5ced6;
}

body[data-page="nei"] .video-sync-cues-actions {
  display: flex;
  gap: 0.35rem;
}

body[data-page="nei"] .video-sync-cues {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  max-height: 220px;
  overflow: auto;
}

body[data-page="nei"] .video-sync-cues-empty {
  margin: 0;
  padding: 0.55rem 0.65rem;
  color: #8b9aa5;
  font-size: 0.82rem;
  line-height: 1.45;
}

body[data-page="nei"] .video-sync-cue-row {
  display: grid;
  grid-template-columns: 2.4rem 1fr auto;
  gap: 0.4rem;
  align-items: center;
}

body[data-page="nei"] .video-sync-cue-idx {
  color: #8b9aa5;
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-size: 0.8rem;
}

body[data-page="nei"] .video-sync-cue-row input {
  width: 100%;
}

body[data-page="nei"] .video-sync-status {
  margin: 0 0 0.85rem;
  color: #7dd3a8;
  font-size: 0.82rem;
}

body[data-page="nei"] .video-sync-list-wrap {
  margin-top: 0.35rem;
}

body[data-page="nei"] .video-sync-seg-scroll {
  overflow-x: hidden;
  border: 1px solid rgba(125, 255, 166, 0.18);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

body[data-page="nei"] .video-sync-seg-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.86rem;
}

body[data-page="nei"] .video-sync-seg-table th,
body[data-page="nei"] .video-sync-seg-table td {
  padding: 0.12rem 0.3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}

body[data-page="nei"] .video-sync-seg-table th {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.28rem 0.3rem;
}

body[data-page="nei"] .video-sync-seg-table .col-idx {
  width: 2.4rem;
  text-align: center;
  color: var(--muted);
}

body[data-page="nei"] .video-sync-seg-table.is-link-sync .col-idx {
  width: 4.6rem;
}

body[data-page="nei"] .video-sync-seg-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
}

body[data-page="nei"] .video-sync-seg-order .seg-ord-num {
  min-width: 1.4rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

body[data-page="nei"] .video-sync-seg-order button {
  margin: 0;
  padding: 0;
  width: 1.25rem;
  min-width: 1.25rem;
  height: 1.35rem;
  line-height: 1.2;
  font-size: 0.72rem;
}

body[data-page="nei"] .video-sync-seg-order button:disabled {
  opacity: 0.28;
  cursor: default;
}

body[data-page="nei"] .video-sync-seg-table .col-cue {
  width: 6.4rem;
}

body[data-page="nei"] .video-sync-seg-table .col-product {
  width: 7.2rem;
}

body[data-page="nei"] .video-sync-seg-table .col-loop {
  display: none;
  width: 9.5rem;
  vertical-align: middle;
}

body[data-page="nei"] .video-sync-seg-table.is-link-sync .col-loop {
  display: table-cell;
}

body[data-page="nei"] .video-sync-loop-cell {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
  min-width: 0;
}

body[data-page="nei"] .video-sync-loop-name {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 9rem;
}

body[data-page="nei"] .video-sync-loop-name.is-bound {
  color: #7dd3a8;
}

body[data-page="nei"] .video-sync-loop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
}

body[data-page="nei"] .video-sync-loop-actions button {
  margin: 0;
  padding: 0.12rem 0.35rem;
  font-size: 0.72rem;
}

body[data-page="nei"] .video-sync-seg-table .col-cue input,
body[data-page="nei"] .video-sync-seg-table .col-product input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 1.5rem;
  margin: 0;
  padding: 0 0.35rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.28);
  color: #e8eef8;
  line-height: 1.5rem;
  font-size: 0.86rem;
}

body[data-page="nei"] .video-sync-seg-table .col-content {
  width: 46%;
}

body[data-page="nei"] .video-sync-seg-table .col-prompt {
  width: 16%;
}

body[data-page="nei"] .video-sync-seg-table .col-remark {
  width: 12%;
}

body[data-page="nei"] .video-sync-seg-table .col-actions {
  width: 8.8rem;
  white-space: nowrap;
}

body[data-page="nei"] .video-sync-seg-table .col-content,
body[data-page="nei"] .video-sync-seg-table .col-prompt,
body[data-page="nei"] .video-sync-seg-table .col-remark {
  overflow: hidden;
}

body[data-page="nei"] .video-sync-cell {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  height: 1.5rem;
  margin: 0;
  padding: 0 0.4rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.28);
  color: #e8eef8;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  line-height: 1.5rem;
  font-size: 0.86rem;
}

body[data-page="nei"] .video-sync-cell.is-empty {
  color: var(--muted);
}

body[data-page="nei"] .video-sync-cell:hover {
  border-color: rgba(125, 255, 166, 0.35);
}

body[data-page="nei"] .video-sync-seg-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.25rem;
}

body[data-page="nei"] .video-sync-seg-actions button {
  margin: 0;
  padding: 0 0.3rem;
  height: 1.5rem;
  line-height: 1.5rem;
  font-size: 0.76rem;
  width: auto;
}

body[data-page="nei"] .video-sync-edit-dialog {
  width: min(640px, calc(100vw - 2rem));
}

body[data-page="nei"] .video-sync-edit-dialog textarea {
  width: 100%;
  min-height: 12rem;
  resize: vertical;
  margin: 0.55rem 0 0.85rem;
}

body[data-page="nei"] .video-sync-compare-dialog {
  width: min(920px, calc(100vw - 2rem));
}

body[data-page="nei"] .video-sync-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

body[data-page="nei"] .video-sync-compare-col {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  color: #c5d4cc;
  font-size: 0.82rem;
}

body[data-page="nei"] .video-sync-compare-col textarea {
  width: 100%;
  min-height: 16rem;
  resize: vertical;
  margin: 0;
}

body[data-page="nei"] .video-sync-list-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

body[data-page="nei"] .video-sync-list-toolbar[hidden] {
  display: none !important;
}

body[data-page="nei"] .script-char-count:has(#videoSyncToolbar:not([hidden])) {
  align-items: center;
}

body[data-page="nei"] .video-sync-file-pick {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  flex: 0 0 auto;
}

body[data-page="nei"] .video-sync-file-pick input[type="file"] {
  width: 11.5rem;
  max-width: 11.5rem;
  font-size: 0.78rem;
}

body[data-page="nei"] .video-sync-list-toolbar > button.ghost {
  margin: 0;
  padding: 0.15rem 0.45rem;
  font-size: 0.82rem;
  white-space: nowrap;
  flex: 0 0 auto;
}

body[data-page="nei"] .video-sync-link-offset {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  flex: 0 0 auto;
}

body[data-page="nei"] .video-sync-link-offset input[type="number"] {
  width: 4.2rem;
  padding: 0.12rem 0.35rem;
  font-size: 0.82rem;
}

/* hidden 会被上面的 display:inline-flex 盖掉，必须加 !important */
body[data-page="nei"] .video-sync-list-toolbar [data-vs-only][hidden],
body[data-page="nei"] .video-sync-list-toolbar [data-ls-only][hidden],
body[data-page="nei"] .video-sync-file-pick[hidden],
body[data-page="nei"] .video-sync-link-offset[hidden],
body[data-page="nei"] .video-sync-list-toolbar > button.ghost[hidden],
body[data-page="nei"] .video-sync-status-inline[hidden] {
  display: none !important;
}

/* CSS 兜底：按 body 模式强制显隐，避免 JS 漏调 */
body[data-page="nei"][data-seg-mode="linkSync"] #videoSyncToolbar [data-vs-only] {
  display: none !important;
}
body[data-page="nei"][data-seg-mode="videoSync"] #videoSyncToolbar [data-ls-only] {
  display: none !important;
}
body[data-page="nei"][data-seg-mode="linkSync"] #videoSyncStatus {
  /* 链接同步仍可显示段数状态 */
}

body[data-page="nei"] .video-sync-seg-table.is-link-sync .col-cue {
  display: none;
}

body[data-page="nei"] .video-sync-clock-label {
  flex: 0 0 auto;
  font-size: 0.8rem;
  color: #7dd3a8;
  white-space: nowrap;
}

body[data-page="nei"] .video-sync-clock-label.is-off {
  color: #9aa7b0;
}

body[data-page="nei"] .video-sync-status-inline {
  flex: 1 1 auto;
  min-width: 0;
  color: #7dd3a8;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-page="nei"] .video-sync-seg-empty td {
  text-align: center;
  color: var(--muted);
  padding: 1rem;
}

@media (max-width: 800px) {
  .studio-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page.studio {
    width: calc(100% - 1rem);
    padding: 0.75rem 0 calc(5.5rem + env(safe-area-inset-bottom, 0px));
  }

  .page.studio .panel {
    padding: 0.75rem 0.8rem;
  }

  .studio-top-row {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.55rem;
    margin-bottom: 0.65rem;
  }

  .studio-user-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .studio-user-actions .user-badge {
    flex: 1 1 auto;
    min-width: 0;
  }

  .studio-user-actions .ghost {
    padding: 0.45rem 0.7rem;
    font-size: 0.86rem;
  }

  .studio-slot-title {
    font-size: 1.25rem;
  }

  .slot-id-line .muted {
    display: none;
  }

  .voice-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }

  .voice-pick {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.45rem;
  }

  .voice-pick + .voice-pick {
    margin-left: 0;
  }

  .voice-row label,
  .voice-pick label {
    font-size: 0.98rem;
  }

  .voice-row select,
  .voice-pick select {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
  }

  .top-actions {
    margin-left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem;
  }

  .top-actions > button {
    width: 100%;
    justify-content: center;
    padding: 0.55rem 0.35rem;
    font-size: 0.86rem;
  }

  .studio-card textarea#script,
  .studio-card textarea#productDesc {
    min-height: 180px;
    height: 220px;
    font-size: 16px; /* avoid iOS zoom on focus */
  }

  body[data-page="nei"] .studio-card textarea#productDesc {
    height: 2.6rem;
    min-height: 2.6rem;
  }

  .chip-row {
    gap: 0.4rem;
  }

  .chip {
    font-size: 0.88rem;
    padding: 0.4rem 0.55rem;
  }

  .reception-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
  }

  .inline-row {
    flex-wrap: wrap;
  }

  .inline-row input[type="text"] {
    flex: 1 1 100%;
  }

  .inline-row .btn-danger {
    width: 100%;
  }

  .studio-footer {
    padding-bottom: calc(0.45rem + env(safe-area-inset-bottom, 0px));
  }

  .btn-start-live {
    width: min(100%, 360px);
    min-width: 0;
  }

  .player-popup {
    width: calc(100% - 1rem);
    max-width: 420px;
  }

  .player-popup-inner {
    padding: 0.5rem 0.85rem 0.75rem;
  }

  .player-controls {
    flex-wrap: wrap;
    gap: 0.45rem 0.65rem;
  }

  .play-voice-name {
    max-width: none;
    flex: 0 1 auto;
  }

  .player-controls .btn-pause {
    margin-left: 0;
    width: 100%;
  }

  .player-tip {
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .adv-settings-dialog,
  .reply-log-dialog,
  .script-gen-dialog {
    width: calc(100% - 1rem);
    max-height: min(92vh, 900px);
  }
}

/* —— login / ops home —— */
.login-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
}

.login-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  box-sizing: border-box;
}

.login-card {
  width: min(420px, 100%);
}

.login-site-footer {
  flex-shrink: 0;
  padding: 1.6rem 0 1.8rem;
  background: #0c0d10;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.92rem;
}

.login-footer-inner {
  width: min(100% - 2.5rem, 1120px);
  margin: 0 auto;
  display: grid;
  gap: 0.85rem;
  text-align: left;
}

.login-footer-brand {
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.login-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
}

.login-beian-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
}

.login-beian-link:hover {
  color: #fff;
}

.login-copy-btn {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  border-radius: 0.25rem;
  padding: 0.15rem 0.45rem;
  font-size: 0.78rem;
  cursor: pointer;
}

.login-copy-btn:hover {
  border-color: rgba(255, 255, 255, 0.45);
}

.login-card h1 {
  margin-top: 0;
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.9rem;
}

.login-switch {
  margin: 0.25rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-switch .linkish {
  border: 0;
  background: transparent;
  color: #7dd3a8;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}

.login-agree {
  margin: 0.15rem 0 0.1rem;
}

.form-grid .login-agree-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  color: #f0a35a;
  font-size: 0.86rem;
  line-height: 1.45;
  cursor: pointer;
  font-weight: 500;
}

.form-grid .login-agree-label input[type="checkbox"] {
  width: auto;
  height: auto;
  margin: 0;
  flex-shrink: 0;
  accent-color: #2db88a;
  cursor: pointer;
}

.form-grid .login-agree-label a {
  color: #ffb36b;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.form-grid .login-agree-label a:hover {
  color: #ffc58a;
}

.agreement-dialog {
  width: min(760px, 94vw);
  max-height: min(86vh, 900px);
  display: flex;
  flex-direction: column;
  padding: 0.85rem 0.85rem 0.75rem;
  gap: 0.55rem;
}

.agreement-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.agreement-dialog-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.agreement-dialog-head .ghost {
  margin-left: 0;
  padding: 0.35rem 0.75rem;
  font-size: 0.88rem;
}

.agreement-frame {
  width: 100%;
  height: min(68vh, 720px);
  border: 1px solid var(--line, rgba(255, 255, 255, 0.14));
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.form-grid input[type="password"],
.form-grid input[type="tel"],
.activate-dialog input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
  padding: 0.7rem 0.85rem;
  font: inherit;
}

.home-page {
  width: min(1100px, calc(100% - 2rem));
  padding-top: 1.25rem;
}

.page.manage-page {
  padding-top: 1.25rem;
}

.home-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.home-brand-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  min-width: 0;
}

.home-brand {
  margin: 0;
  font-size: 1.55rem;
}

.home-sys-tutorial {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.95rem 0.32rem 0.55rem;
  background: linear-gradient(135deg, rgba(26, 107, 79, 0.95), rgba(45, 184, 138, 0.88));
  color: #fff;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.2;
  border-radius: 6px;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%);
  box-shadow: 0 2px 8px rgba(45, 184, 138, 0.22);
  transition: filter 0.15s ease, transform 0.15s ease;
}

.home-sys-tutorial:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.home-sys-tutorial-icon {
  display: inline-flex;
  flex-shrink: 0;
}

.home-top-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-menu {
  position: relative;
}

.user-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.35rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.user-menu-btn:hover,
.user-menu.is-open .user-menu-btn {
  background: rgba(45, 184, 138, 0.1);
  border-color: rgba(45, 184, 138, 0.28);
}

.user-badge {
  color: var(--muted);
  font-size: 0.92rem;
}

.user-menu-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
  transition: transform 0.15s ease;
}

.user-menu.is-open .user-menu-caret {
  transform: rotate(180deg);
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 148px;
  padding: 0.35rem;
  background: var(--panel, #0f1f1c);
  border: 1px solid var(--line, rgba(255, 255, 255, 0.14));
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  z-index: 40;
  display: grid;
  gap: 0.15rem;
}

.user-menu-panel[hidden] {
  display: none;
}

.user-menu-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--ink, #e8f5f1);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.user-menu-item:hover {
  background: rgba(45, 184, 138, 0.14);
}

.home-stats {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 1.25rem;
  align-items: center;
  margin-bottom: 1rem;
}

.stats-user {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 1.05;
  background: linear-gradient(145deg, rgba(45, 184, 138, 0.55), rgba(212, 160, 23, 0.45));
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.avatar span {
  display: block;
}

.stats-title {
  margin: 0;
  font-weight: 650;
}

.stats-sub {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.stats-metrics {
  display: flex;
  gap: 1.75rem;
}

.metric-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.metric-value {
  margin: 0.2rem 0 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.stats-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.btn-link,
a.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.9rem;
  border-radius: 12px;
  background: var(--accent-2);
  color: #062018;
  text-decoration: none;
  font-weight: 700;
  border: none;
  cursor: pointer;
}

.btn-warn {
  background: #c45c4a;
  color: #fff;
}

.slots-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.slot-table {
  display: grid;
  gap: 0.75rem;
}

.slot-row {
  display: grid;
  grid-template-columns: 2.2fr 0.8fr 0.9fr 1.2fr;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 0.5rem;
  border-top: 1px solid var(--line);
}

.slot-row.slot-head {
  border-top: none;
  color: var(--muted);
  font-size: 0.88rem;
  padding-top: 0;
}

.slot-row.slot-head > span {
  text-align: left;
}

.slot-row.slot-head > span:last-child {
  text-align: center;
}

.slot-info {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.slot-info p {
  margin: 0.15rem 0;
}

.slot-info .muted,
.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.mono {
  font-family: ui-monospace, Consolas, monospace;
}

.slot-badge {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.15;
}

.slot-badge.ok {
  background: rgba(45, 184, 138, 0.2);
  color: var(--accent-2);
  border: 1px solid rgba(45, 184, 138, 0.45);
}

.slot-badge.pending {
  background: rgba(227, 93, 93, 0.15);
  color: var(--danger);
  border: 1px solid rgba(227, 93, 93, 0.4);
}

.slot-badge.expired {
  background: rgba(155, 181, 168, 0.12);
  color: var(--muted);
  border: 1px solid rgba(155, 181, 168, 0.35);
}

.slot-title-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: baseline;
  margin: 0.15rem 0 !important;
}

.slot-remark .remark-edit {
  margin-top: 0;
}

.slot-ops {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

.slot-ops .go-live {
  background: var(--accent-2);
}

.slot-ops .go-live.is-disabled,
.slot-ops .go-live:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: rgba(155, 181, 168, 0.35);
  color: var(--muted);
}

button.linkish {
  background: none;
  border: none;
  color: var(--accent-2);
  padding: 0;
  margin-top: 0.2rem;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}

.activate-dialog {
  width: min(420px, calc(100% - 2rem));
  text-align: left;
  display: grid;
  gap: 0.75rem;
}

.activate-dialog h3 {
  margin: 0;
}

.activate-dialog label {
  display: grid;
  gap: 0.35rem;
}

.activate-dialog .row {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 0.25rem;
}

.remark-dialog {
  width: min(320px, calc(100% - 2rem));
  background: #f5f5f5;
  color: #1a1a1a;
  border-radius: 14px;
  padding: 1.25rem 1.15rem 1rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  display: grid;
  gap: 0.85rem;
  text-align: center;
}

.remark-dialog h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #111;
}

.remark-dialog input[type="text"] {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: #222;
  padding: 0.7rem 0.8rem;
  font: inherit;
}

.remark-dialog input[type="text"]::placeholder {
  color: #999;
}

.remark-actions {
  display: flex;
  justify-content: space-around;
  gap: 0.5rem;
  padding-top: 0.15rem;
}

.remark-actions button {
  background: none;
  border: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0.45rem 1rem;
  color: #222;
}

.remark-actions .remark-ok {
  color: #e03535;
}

.remark-dialog .form-error {
  text-align: left;
}

.manage-page .manage-create {
  display: grid;
  gap: 1.15rem;
}

.manage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.manage-brand {
  margin: 0;
  font-size: 1.45rem;
}

.manage-top-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.manage-disclaimer {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem 1rem;
  border-radius: 12px;
  background: #fff6e0;
  border: 1px solid #ecd9a8;
  color: #8a5a18;
}

.manage-disclaimer-title {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #9a4e0a;
}

.manage-disclaimer-list {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.28rem;
  font-size: 0.86rem;
  line-height: 1.45;
}

.manage-disclaimer-list li {
  padding-left: 0.1rem;
}

.manage-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: start;
}

.manage-step-num {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #0b1a14;
  background: var(--accent, #7dffa6);
}

.manage-step-title {
  margin: 0 0 0.55rem;
  font-size: 1rem;
}

.manage-quota-tip {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: #9fb0a8;
  text-align: right;
  flex: 1 1 auto;
}

.manage-voice-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.manage-voice-list-head .section-title {
  margin: 0;
  flex: 0 0 auto;
}

.manage-voice-list-head + .voice-list {
  margin-top: 0;
}

.manage-quota-tip.is-limit {
  color: #ff8f8f;
}

.manage-step-body input[type="text"] {
  width: 100%;
  box-sizing: border-box;
}

.manage-name-hint {
  margin: 0.45rem 0 0;
  font-size: 0.84rem;
  line-height: 1.4;
  color: #9fb0a8;
}

.manage-name-hint.is-ok {
  color: #7dffa6;
}

.manage-name-hint.is-error {
  color: #ff8a8a;
}

.manage-mode-row {
  margin: 0;
}

.manage-mode-hint {
  margin: 0.65rem 0 0;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid rgba(125, 255, 166, 0.22);
  background: rgba(125, 255, 166, 0.08);
  color: #cfe3d9;
  font-size: 0.86rem;
  line-height: 1.45;
}

.manage-step3-slot {
  height: 9rem;
  min-height: 9rem;
}

.manage-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  align-items: center;
  height: 100%;
  min-height: 9rem;
}

.manage-step3-panel {
  height: 100%;
}

.manage-step3-panel[hidden] {
  display: none !important;
}

.manage-gender-card {
  cursor: default;
}

.manage-gender-card:hover {
  border-color: var(--line);
  background: rgba(0, 0, 0, 0.16);
}

.manage-gender-card .chip-row {
  justify-content: center;
  margin: 0;
}

.manage-gender-side-hint {
  visibility: hidden;
  pointer-events: none;
  user-select: none;
}

.manage-upload-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 7.75rem;
  min-height: 7.75rem;
  box-sizing: border-box;
  padding: 0.9rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.16);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.manage-upload-card:hover {
  border-color: #7dd3a8;
  background: rgba(0, 0, 0, 0.22);
}

.manage-upload-card[hidden] {
  display: none !important;
}

.manage-upload-grid:has(#loraUploadCard[hidden]):not(:has(.manage-upload-side-hint)) {
  grid-template-columns: 1fr;
}

.manage-upload-side-hint {
  margin: 0;
  padding: 0.2rem 0.25rem 0.2rem 0.5rem;
  border: none;
  background: transparent;
  color: #9bb5a8;
  font-size: 0.86rem;
  line-height: 1.5;
  align-self: center;
  box-sizing: border-box;
  display: grid;
  gap: 0.45rem;
}

.manage-upload-side-hint .manage-upload-tip,
.manage-upload-side-hint .manage-upload-side-quality {
  margin: 0;
}

.manage-upload-side-hint .manage-upload-tip[hidden] {
  display: none !important;
}

.manage-upload-side-quality {
  color: #9bb5a8;
  font-size: 0.86rem;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .manage-upload-grid {
    grid-template-columns: 1fr;
  }
}

.manage-upload-label {
  font-weight: 600;
}

.manage-upload-label[hidden] {
  display: none !important;
}

.manage-upload-tip {
  font-size: 0.82rem;
  color: #9bb5a8;
}

.manage-upload-card input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.manage-file-name {
  margin: 0;
  font-size: 0.9rem;
  color: #cfe3d9;
  word-break: break-all;
  text-align: center;
}

.manage-file-name.is-empty {
  color: #9bb5a8;
}

.btn-start-clone {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-weight: 700;
}

.voice-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.3rem;
}

.voice-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.75rem;
  color: #cfe3d9;
}

@media (max-width: 900px) {
  .home-stats {
    grid-template-columns: 1fr;
  }

  .slot-row,
  .slot-row.slot-head {
    grid-template-columns: 1fr;
  }

  .slot-ops {
    justify-content: flex-start;
  }
}

