:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --panel: #fffdf8;
  --panel-strong: #ffffff;
  --ink: #172222;
  --muted: #69716f;
  --line: #d8d7cf;
  --line-strong: #b8bbb4;
  --accent: #e86332;
  --accent-dark: #b93c17;
  --blue: #276b85;
  --blue-soft: #e3eef1;
  --success: #287b61;
  --danger: #a93d32;
  --shadow: 0 18px 45px rgba(29, 42, 40, 0.09);
  font-family:
    "SF Pro Display",
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    linear-gradient(rgba(39, 107, 133, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(39, 107, 133, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  color: var(--ink);
}

button,
input,
a {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px clamp(18px, 3vw, 42px);
  border-bottom: 1px solid rgba(184, 187, 180, 0.72);
  background: rgba(244, 241, 234, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  letter-spacing: 0.01em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.runtime-status {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c68b2c;
  box-shadow: 0 0 0 4px rgba(198, 139, 44, 0.12);
}

.runtime-status.is-ready .status-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(40, 123, 97, 0.12);
}

.runtime-status.is-error .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(169, 61, 50, 0.12);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  min-height: calc(100vh - 72px);
}

.preview-stage {
  min-width: 0;
  padding: 34px clamp(22px, 4vw, 62px) 56px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 26px;
}

.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-heading h1,
.settings-heading h2 {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0;
}

.section-heading h1 {
  font-size: clamp(26px, 3vw, 42px);
  line-height: 1.05;
}

.quiet-button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

.quiet-button:hover {
  border-color: var(--line-strong);
}

.drop-zone {
  position: relative;
  display: flex;
  min-height: min(62vh, 620px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 42px;
  overflow: hidden;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.82);
  box-shadow: var(--shadow);
  text-align: center;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.drop-zone::before,
.drop-zone::after {
  position: absolute;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  content: "";
  opacity: 0.8;
}

.drop-zone::before {
  top: -90px;
  right: -60px;
  background: var(--blue-soft);
}

.drop-zone::after {
  bottom: -105px;
  left: -65px;
  background: #f7e4d7;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background: #fff9f4;
  transform: translateY(-2px);
}

.drop-icon {
  z-index: 1;
  display: grid;
  width: 68px;
  height: 68px;
  margin-bottom: 22px;
  place-items: center;
  border-radius: 18px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 15px 32px rgba(23, 34, 34, 0.18);
}

.drop-icon svg {
  width: 30px;
  height: 30px;
}

.drop-zone h2 {
  z-index: 1;
  margin: 0;
  font-size: clamp(22px, 2.5vw, 30px);
}

.drop-zone p {
  z-index: 1;
  margin: 10px 0 24px;
  color: var(--muted);
  font-size: 14px;
}

.primary-button,
.generate-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  text-decoration: none;
}

.primary-button {
  min-height: 44px;
  padding: 0 18px;
  background: var(--ink);
  color: #fff;
  font-weight: 650;
}

.primary-button:hover {
  background: #243232;
}

.upload-actions {
  z-index: 1;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.file-limit {
  z-index: 1;
  margin-top: 14px;
  color: var(--muted);
  font-size: 11px;
}

.project-view {
  animation: reveal 280ms ease both;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.file-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  margin-bottom: 18px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
}

.file-summary {
  display: flex;
  min-width: 0;
  gap: 12px;
  align-items: center;
}

.file-type {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: #f5ded2;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
}

.file-summary strong,
.file-summary span {
  display: block;
}

.file-summary strong {
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-summary span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.batch-list {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.batch-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}

.batch-order {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
}

.batch-item strong,
.batch-item span {
  display: block;
}

.batch-item strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-item span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.batch-state {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.batch-state.is-active {
  color: var(--accent-dark);
  font-weight: 700;
}

.batch-state.is-done {
  color: var(--success);
  font-weight: 700;
}

.batch-state a {
  color: var(--blue);
  text-decoration: none;
}

.batch-voice-select {
  width: 100%;
  min-height: 30px;
  margin-top: 7px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
}

.job-badge {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
}

.job-badge.is-done {
  background: #deefe9;
  color: var(--success);
}

.job-badge.is-error {
  background: #f6dfdb;
  color: var(--danger);
}

.slide-viewer {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.slide-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.slide-nav {
  display: flex;
  gap: 6px;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: #f7f6f2;
}

.slide-canvas {
  display: grid;
  min-height: 420px;
  aspect-ratio: 16 / 9;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(39, 107, 133, 0.07), transparent 42%),
    #e9e8e3;
}

.slide-canvas img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.processing-placeholder {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.loader {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(39, 107, 133, 0.17);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

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

.slide-thumbs {
  display: flex;
  gap: 9px;
  padding: 12px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.slide-thumb {
  width: 104px;
  flex: 0 0 auto;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 7px;
  background: #e7e7e3;
  cursor: pointer;
}

.slide-thumb.is-selected {
  border-color: var(--accent);
}

.slide-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.progress-panel {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.progress-copy {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.progress-label {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
}

.progress-copy strong {
  font-size: 14px;
}

.progress-copy > span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 7px;
  margin-top: 15px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e1dc;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 240ms ease;
}

.progress-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
  margin: 16px 0 0;
  list-style: none;
}

.progress-steps li {
  display: flex;
  gap: 6px;
  align-items: center;
  color: #939895;
  font-size: 11px;
}

.progress-steps li svg {
  width: 14px;
  height: 14px;
}

.progress-steps li.is-complete,
.progress-steps li.is-active {
  color: var(--success);
}

.progress-steps li.is-active {
  font-weight: 700;
}

.video-result {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
}

.video-result video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #111;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 16px;
}

.result-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.compact-select {
  width: 150px;
  min-height: 42px;
}

.result-actions strong {
  display: block;
  font-size: 13px;
}

.settings-panel {
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow-y: auto;
  border-left: 1px solid rgba(184, 187, 180, 0.72);
  background: rgba(255, 253, 248, 0.88);
  backdrop-filter: blur(18px);
}

.settings-heading {
  padding: 28px 25px 22px;
  border-bottom: 1px solid var(--line);
}

.settings-heading h2 {
  font-size: 22px;
}

.setting-section {
  padding: 21px 25px;
  border-bottom: 1px solid var(--line);
}

.setting-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 13px;
  font-size: 13px;
  font-weight: 700;
}

.selection-note,
.setting-title output {
  color: var(--blue);
  font-size: 12px;
  font-weight: 650;
}

.text-link {
  color: var(--blue);
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
}

.toggle-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 12px;
  align-items: center;
  cursor: pointer;
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row strong {
  font-size: 12px;
}

.toggle-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.toggle-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-switch {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #d5d8d4;
  transition: background 160ms ease;
}

.toggle-switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(20, 28, 28, 0.18);
  content: "";
  transition: transform 160ms ease;
}

.toggle-row input:checked + .toggle-switch {
  background: var(--blue);
}

.toggle-row input:checked + .toggle-switch::after {
  transform: translateX(18px);
}

.compact-setting-select {
  margin-top: 11px;
}

.presenter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.presenter-grid button {
  display: grid;
  min-height: 84px;
  place-items: center;
  gap: 4px;
  padding: 7px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.presenter-grid button.is-selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.presenter-grid img {
  width: 48px;
  height: 54px;
  object-fit: contain;
}

.presenter-grid button > i {
  width: 42px;
  height: 54px;
  display: grid;
  place-items: center;
}

.presenter-grid button > i svg {
  width: 28px;
  height: 28px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.segmented button,
.animation-grid button,
.voice-card {
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    color 140ms ease;
}

.segmented button {
  display: flex;
  min-height: 41px;
  gap: 7px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
}

.segmented button.is-selected,
.animation-grid button.is-selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.voice-list {
  display: grid;
  gap: 8px;
}

.cloud-tts-config {
  display: grid;
  gap: 8px;
}

.text-input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.text-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(39, 107, 133, 0.1);
}

.voice-prompt {
  min-height: 74px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.45;
}

.cloud-tts-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.secondary-button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  cursor: pointer;
  font-weight: 700;
}

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

.voice-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 8px 9px 8px 13px;
  border-radius: 9px;
  text-align: left;
}

.voice-card:hover {
  border-color: var(--line-strong);
}

.voice-card.is-selected {
  border-color: var(--accent);
  background: #fff7f1;
}

.voice-card strong,
.voice-card span {
  display: block;
}

.voice-card strong {
  font-size: 12px;
}

.voice-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.voice-card .preview-button {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  flex: 0 0 32px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #edf1f0;
  color: var(--blue);
  cursor: pointer;
  line-height: 0;
}

.voice-card .preview-button svg {
  display: block;
  width: 16px;
  height: 16px;
  margin: 0;
}

.voice-card .preview-button.is-loading svg {
  animation: spin 800ms linear infinite;
}

.range {
  width: 100%;
  height: 5px;
  margin: 7px 0 10px;
  accent-color: var(--accent);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
}

.animation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.animation-grid button {
  display: flex;
  min-height: 46px;
  gap: 7px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
}

.settings-footer {
  padding: 22px 25px 28px;
  background: var(--panel-strong);
}

.output-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 11px;
}

.output-summary span {
  color: var(--muted);
}

.generate-button {
  width: 100%;
  min-height: 50px;
  background: var(--accent);
  color: #fff;
  font-weight: 750;
  box-shadow: 0 12px 26px rgba(232, 99, 50, 0.2);
}

.generate-button:hover:not(:disabled) {
  background: var(--accent-dark);
}

.generate-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}

.error-message {
  padding: 10px 11px;
  margin: 13px 0 0;
  border-radius: 7px;
  background: #f7e2de;
  color: var(--danger);
  font-size: 11px;
  line-height: 1.55;
}

.error-message.is-success {
  background: #e8f5ee;
  color: #176b4d;
}

@media (max-width: 1050px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 350px;
  }

  .slide-canvas {
    min-height: 340px;
  }
}

@media (max-width: 820px) {
  .topbar {
    min-height: 64px;
  }

  .runtime-status {
    max-width: 48vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .workspace {
    display: block;
  }

  .preview-stage {
    padding: 26px 16px 32px;
  }

  .settings-panel {
    position: static;
    height: auto;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .drop-zone {
    min-height: 430px;
    padding: 28px 20px;
  }

  .slide-canvas {
    min-height: 220px;
  }

  .file-summary strong {
    max-width: 52vw;
  }
}

@media (max-width: 520px) {
  .brand strong {
    font-size: 13px;
  }

  .brand small {
    display: none;
  }

  .runtime-status {
    padding: 0 9px;
    font-size: 10px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .section-heading h1 {
    font-size: 28px;
  }

  .quiet-button {
    min-width: 38px;
    padding: 0 9px;
    font-size: 0;
  }

  .progress-steps li {
    justify-content: center;
    font-size: 0;
  }

  .progress-steps li svg {
    width: 17px;
    height: 17px;
  }

  .result-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
