:root {
  color-scheme: light;
  --bg: #eef2ff;
  --surface: #ffffff;
  --panel: #fbfcfd;
  --ink: #172026;
  --muted: #66717d;
  --line: #dbe2f0;
  --accent: #316cff;
  --accent-2: #7a4cff;
  --gold: #f4b63f;
  --blue: #2878d4;
  --shadow: 0 18px 45px rgba(30, 39, 49, 0.12);
}

@media (min-width: 1000px) {
  body.preview-landscape-mode {
    min-width: 0;
    overflow-x: hidden;
  }

  body.preview-landscape-mode .flow-column.wide {
    grid-template-columns: 710px minmax(460px, 1fr) !important;
    align-items: start;
    justify-content: stretch;
    max-width: calc(100vw - 156px);
    overflow: hidden;
  }

  body.preview-landscape-mode .flow-column.wide > :first-child,
  body.preview-landscape-mode .panel {
    width: 710px !important;
    max-width: 710px !important;
    min-width: 710px !important;
  }

  body.preview-landscape-mode .preview {
    width: min(620px, calc(100vw - 900px)) !important;
    max-width: 620px !important;
    min-width: 460px !important;
    justify-self: stretch;
  }

  body.preview-landscape-mode .preview .phone {
    width: min(580px, 100%) !important;
    max-width: 580px !important;
    margin-inline: auto;
  }

  body.preview-landscape-mode .phone-screen {
    width: min(540px, 100%) !important;
    max-width: 540px !important;
    aspect-ratio: 16 / 9;
    min-height: 0;
    height: auto !important;
    border-radius: 28px;
  }

  body.preview-landscape-mode .phone-screen .caption {
    width: min(82%, 430px);
  }

  body.preview-landscape-mode .preview-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}


* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 255, 255, 0.95), transparent 30%),
    linear-gradient(135deg, #f8fbff 0%, #e9f3ff 38%, #eee5ff 100%);
  background-size: cover;
  background-attachment: fixed;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.async-progress {
  display: none;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  margin: -4px 0 2px;
  color: #a8b3c7;
  font-size: 13px;
}

.async-progress.show {
  display: grid;
}

.async-progress-bar {
  overflow: hidden;
  height: 8px;
  background: rgba(148, 163, 184, 0.22);
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 999px;
}

.async-progress-fill {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  border-radius: inherit;
  transition: width 0.25s ease;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.45);
}

.async-progress-text {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.async-progress-text b {
  color: #22c55e;
}

.visually-hidden {
  display: none !important;
}

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

.mic-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #fff;
  background: linear-gradient(135deg, #8b5cf6, #d946ef);
  border-radius: 999px;
  font-size: 13px;
}

.record-wave {
  display: none;
  align-items: end;
  gap: 3px;
  height: 18px;
}

.record-wave i {
  width: 4px;
  height: 8px;
  background: #fbbf24;
  border-radius: 999px;
  animation: recordWave 0.7s ease-in-out infinite;
}

.record-wave i:nth-child(2) {
  height: 15px;
  animation-delay: 0.1s;
}

.record-wave i:nth-child(3) {
  height: 11px;
  animation-delay: 0.2s;
}

.record-wave i:nth-child(4) {
  height: 17px;
  animation-delay: 0.3s;
}

.mic-toggle.recording {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.72);
  background: rgba(127, 29, 29, 0.22);
}

.mic-toggle.recording .record-wave {
  display: inline-flex !important;
}

.mic-toggle.recording .mic-icon {
  background: linear-gradient(135deg, #ef4444, #f97316);
}

@keyframes recordWave {
  50% {
    transform: scaleY(0.42);
  }
}

.shell {
  display: block;
  min-height: 100vh;
}

.workspace {
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px;
}

.topbar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
  text-align: center;
}

.mode-tabs {
  display: flex;
  gap: 14px;
  justify-content: center;
}

.hero-title p {
  margin: 8px 0 0;
  color: #64748b;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  color: #1f2937;
  font-size: clamp(32px, 4vw, 48px);
}

h2 {
  font-size: 20px;
}

.top-actions,
.split-actions,
.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.panel {
  display: grid;
  gap: 18px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(219, 226, 240, 0.9);
  border-radius: 12px;
  box-shadow: 0 18px 45px rgba(87, 103, 132, 0.13);
}

.panel-head,
.preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.panel .eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  color: #4f46e5;
  background: #eef2ff;
  border-left: 4px solid #7a4cff;
  border-radius: 6px;
}

.button-group {
  display: flex;
  gap: 8px;
}

.field,
.range-field {
  display: grid;
  gap: 8px;
}

.field span,
.range-field span {
  color: #34404b;
  font-size: 13px;
  font-weight: 700;
}

.field.compact {
  flex: 1 1 190px;
}

textarea,
input,
select {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 88px;
  padding: 12px;
  line-height: 1.65;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(12, 124, 89, 0.1);
}

.primary,
.ghost {
  min-height: 42px;
  padding: 0 16px;
  font-weight: 800;
  border-radius: 8px;
  border: 1px solid transparent;
}

.primary {
  color: #fff;
  background: linear-gradient(135deg, #178cff, #7a4cff);
  box-shadow: 0 10px 20px rgba(49, 108, 255, 0.2);
}

.primary:hover {
  filter: brightness(0.96);
}

.run-button {
  position: relative;
  overflow: hidden;
}

.run-button .run-label {
  position: relative;
  z-index: 1;
}

.run-button .run-progress {
  position: absolute;
  inset: auto 0 0;
  width: var(--run-progress, 0%);
  height: 4px;
  background: linear-gradient(90deg, #22c55e, #86efac);
  transition: width 0.25s ease;
}

.ghost {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.ghost:hover {
  border-color: #aebbc8;
}

.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.choice-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice {
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.choice.checked {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.choice input {
  width: auto;
  min-height: 0;
}

.choice span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.range-field input {
  padding: 0;
  accent-color: var(--accent);
}

.color-field {
  display: grid;
  gap: 8px;
}

.color-field span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.color-dot {
  display: inline-block;
  width: 22px;
  height: 22px;
  background: var(--dot-color, #22c55e);
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.18), 0 6px 14px rgba(15, 23, 42, 0.18);
}

.color-trigger,
.chip-color-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
}

.color-trigger b {
  color: #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.color-popover {
  position: absolute;
  z-index: 80;
  display: none;
  width: 280px;
  padding: 10px;
  background: #24242a;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 6px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.38);
}

.color-popover.show {
  display: grid;
  gap: 10px;
}

.color-panel {
  position: relative;
  height: 132px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0), #000),
    linear-gradient(90deg, #fff, var(--picker-color, #22c55e));
  border-radius: 4px;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.color-panel i {
  position: absolute;
  left: 84%;
  top: 18%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border: 3px solid var(--picker-color, #22c55e);
  border-radius: 999px;
  box-shadow: 0 0 0 2px #fff;
  pointer-events: none;
}

.color-popover-row {
  display: grid;
  grid-template-columns: 24px minmax(120px, 1fr) 64px;
  gap: 10px;
  align-items: center;
  min-height: 34px;
}

.color-popover-row b {
  color: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  text-align: right;
}

.color-slider {
  width: 100%;
  min-height: 22px;
  padding: 0;
  background: transparent;
  accent-color: var(--slider-color, #22c55e);
}

.color-slider::-webkit-slider-runnable-track {
  height: 10px;
  background: linear-gradient(90deg, #ef4444, #f97316, #facc15, #22c55e, #06b6d4, #2563eb, #a855f7, #ef4444);
  border-radius: 999px;
}

.color-slider::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -5px;
  background: var(--slider-color, #22c55e);
  border: 3px solid #fff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.24);
  appearance: none;
}

.color-slider::-moz-range-track {
  height: 10px;
  background: linear-gradient(90deg, #ef4444, #f97316, #facc15, #22c55e, #06b6d4, #2563eb, #a855f7, #ef4444);
  border-radius: 999px;
}

.color-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--slider-color, #22c55e);
  border: 3px solid #fff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.24);
}

.subtitle-workbench {
  display: grid;
  gap: 12px;
  margin: 12px 0;
  padding: 14px;
  border: 1px solid rgba(139, 92, 246, 0.42);
  border-radius: 8px;
  background: rgba(15, 18, 32, 0.48);
}

.subtitle-workbench strong {
  color: #fff;
}

.workbench-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.workbench-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.switch-field,
.tool-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: #e5ecff;
  font-weight: 800;
}

.tool-toggle-row label,
.switch-field {
  padding: 8px 10px;
  border: 1px solid rgba(139, 92, 246, 0.38);
  border-radius: 8px;
  background: rgba(15, 18, 32, 0.64);
}

.tool-toggle-row input,
.switch-field input {
  width: 16px;
  min-height: 16px;
  margin-right: 6px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-field input {
  width: 18px;
  min-height: 18px;
}

.result-line,
.material-box,
.engine-hint {
  padding: 14px;
  color: #34404b;
  background: #f5f8fa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.material-box {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.material-box p {
  margin: 4px 0 0;
  color: var(--muted);
}

.engine-hint {
  font-size: 13px;
  line-height: 1.6;
  background: #fff9ed;
  border-color: #f0d49a;
}

.engine-hint strong {
  color: #7a4b00;
}

.chips,
.video-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips span,
.video-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  color: #0b513c;
  font-size: 12px;
  font-weight: 800;
  background: #e4f4ee;
  border-radius: 999px;
}

.keyword-workbench {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.keyword-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.subtitle-source {
  display: none;
}

.keyword-preview {
  min-height: 160px;
  padding: 12px;
  color: #e5e7eb;
  background: rgba(15, 23, 42, 0.48);
  border: 1px solid rgba(168, 85, 247, 0.58);
  border-radius: 8px;
  line-height: 1.85;
}

.keyword-editor {
  outline: none;
  white-space: pre-wrap;
  overflow: auto;
  cursor: text;
}

.keyword-editor:focus {
  border-color: #a855f7;
  box-shadow: inset 0 0 0 1px #a855f7;
}

.keyword-mark {
  display: inline;
  padding: 1px 4px;
  color: var(--keyword-color);
  font-weight: 900;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.72);
  background: color-mix(in srgb, var(--keyword-color) 26%, transparent);
  border: 1px solid color-mix(in srgb, var(--keyword-color) 72%, transparent);
  border-radius: 5px;
}

.keyword-mark.has-material {
  color: var(--keyword-color);
  background: color-mix(in srgb, var(--keyword-color) 26%, transparent);
}

.keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.keyword-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 9px 0 7px;
  color: var(--keyword-color);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--keyword-color);
  border-radius: 999px;
  font-weight: 900;
}

.keyword-chip .chip-color-button {
  width: 22px;
  min-height: 22px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  flex: 0 0 auto;
}

.keyword-chip .color-dot {
  width: 18px;
  height: 18px;
}

.keyword-chip button {
  min-height: 28px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font-weight: 900;
}

.keyword-chip .chip-color-button {
  width: 22px;
  min-height: 22px;
  color: inherit;
  border-radius: 999px;
}

.keyword-chip small {
  margin-left: 6px;
  color: #64748b;
  font-size: 11px;
}

.keyword-chip.with-material {
  color: #fff;
  background: color-mix(in srgb, var(--keyword-color) 38%, rgba(15, 23, 42, 0.9));
}

.title-list {
  display: grid;
  gap: 10px;
}

.title-item {
  width: 100%;
  min-height: 54px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.title-item.active {
  border-color: #a855f7;
  box-shadow: inset 0 0 0 1px #a855f7, 0 0 0 3px rgba(168, 85, 247, 0.14);
}

canvas {
  width: min(100%, 360px);
  aspect-ratio: 9 / 16;
  background: #172026;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 10px;
}

.platform-grid label {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.platform-grid input {
  width: auto;
  min-height: 0;
  accent-color: var(--accent);
}

.preview {
  position: sticky;
  top: 20px;
  display: grid;
  gap: 16px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(219, 226, 240, 0.9);
  border-radius: 12px;
  box-shadow: 0 18px 45px rgba(87, 103, 132, 0.13);
}

#progressBadge {
  --badge-hue: 260;
  display: grid;
  place-items: center;
  width: 54px;
  height: 34px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  background: hsl(var(--badge-hue), 84%, 60%);
  box-shadow: 0 0 18px hsla(var(--badge-hue), 84%, 60%, 0.36);
  border-radius: 999px;
}

.phone {
  width: min(100%, 300px);
  margin: 0 auto;
  padding: 10px;
  background: #101418;
  border-radius: 30px;
  box-shadow: inset 0 0 0 2px #303842;
}

.phone-screen {
  position: relative;
  overflow: hidden;
  aspect-ratio: 9 / 16;
  background:
    linear-gradient(180deg, rgba(23, 32, 38, 0) 0%, rgba(23, 32, 38, 0.92) 72%),
    linear-gradient(135deg, #2d9172, #254d7c 52%, #20242a);
  border-radius: 22px;
}

.phone-screen.template-ecommerce {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(24, 24, 27, 0.96) 72%), linear-gradient(135deg, #4a1d06, #ca8a04 54%, #111827);
}

.phone-screen.template-news {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.1), rgba(15, 23, 42, 0.96) 72%), linear-gradient(135deg, #0f172a, #1d4ed8 54%, #111827);
}

.phone-screen.template-knowledge {
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.05), rgba(15, 23, 42, 0.94) 72%), linear-gradient(135deg, #0f766e, #2563eb 54%, #111827);
}

.phone-screen.template-cinema {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.96) 72%), linear-gradient(135deg, #030712, #374151 54%, #030712);
}

.phone-screen.template-minimal {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0), rgba(15, 23, 42, 0.94) 72%), linear-gradient(135deg, #111827, #0f172a 54%, #111827);
}

.phone-screen.template-local {
  background: linear-gradient(180deg, rgba(124, 45, 18, 0.05), rgba(15, 23, 42, 0.94) 72%), linear-gradient(135deg, #7c2d12, #0f766e 54%, #111827);
}

.phone-screen.replaying .caption {
  animation: replayCaption 0.7s ease;
}

.phone-screen.replaying .sound-wave i {
  animation-duration: 0.35s;
}

.phone-screen.replaying .avatar-fallback,
.phone-screen.replaying #avatarPreview {
  animation: replayAvatar 0.7s ease;
}

@keyframes replayCaption {
  0% {
    transform: translateY(16px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes replayAvatar {
  0% {
    transform: scale(0.98);
    filter: brightness(0.8);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

.phone.ratio-square .phone-screen {
  aspect-ratio: 1 / 1;
}

.phone.ratio-landscape {
  width: min(100%, 340px);
}

.phone.ratio-landscape .phone-screen {
  aspect-ratio: 16 / 9;
}

#avatarPreview {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.face {
  position: relative;
  width: 176px;
  height: 260px;
  background: linear-gradient(180deg, #ffffff 0 20%, #0c7c59 20% 100%);
  border-radius: 72px 72px 28px 28px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
}

.face::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 28px;
  width: 120px;
  height: 120px;
  background: #f2c7aa;
  border-radius: 50%;
}

.face::before,
.face::after {
  content: "";
  position: absolute;
}

.face::after {
  top: 118px;
  left: 38px;
  width: 100px;
  height: 74px;
  background: #ffffff;
  border-radius: 18px 18px 8px 8px;
}

.face span {
  position: absolute;
  top: 58px;
  left: 70px;
  z-index: 2;
  width: 36px;
  height: 24px;
  border-top: 6px dotted #263039;
  border-bottom: 3px solid #263039;
  border-radius: 50%;
}

.video-tags {
  position: absolute;
  top: 18px;
  left: 16px;
  right: 16px;
}

.caption {
  position: absolute;
  z-index: 20;
  right: 16px;
  bottom: 72px;
  left: 16px;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.28;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.44);
}

.caption.subtitle-white {
  color: #fff;
  font-weight: 800;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.caption.subtitle-outline {
  color: #fff;
  font-weight: 900;
  -webkit-text-stroke: 1px rgba(0, 0, 0, 0.9);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

.caption.subtitle-bar {
  color: #fff;
  background: rgba(0, 0, 0, 0.58);
  padding: 10px 12px;
  border-radius: 6px;
  font-weight: 800;
}

.caption.subtitle-highlight {
  color: #111827;
  background: linear-gradient(transparent 42%, #facc15 42%);
  padding: 0 4px;
  font-weight: 900;
  text-shadow: none;
}

.caption.subtitle-news {
  color: #fff;
  background: rgba(15, 23, 42, 0.88);
  border-left: 6px solid #ef4444;
  padding: 10px 12px;
  font-weight: 800;
}

.caption.subtitle-blue {
  color: #fff;
  background: rgba(37, 99, 235, 0.86);
  padding: 10px 12px;
  border-radius: 6px;
  font-weight: 800;
}

.caption.subtitle-commerce {
  color: #facc15;
  background: rgba(0, 0, 0, 0.78);
  padding: 10px 12px;
  border-radius: 6px;
  font-weight: 900;
}

.caption.subtitle-brand {
  color: #fff;
  background: rgba(220, 38, 38, 0.88);
  padding: 10px 12px;
  border-radius: 6px;
  font-weight: 800;
}

.caption.subtitle-cinema {
  color: #fff;
  bottom: 34px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
}

.caption.subtitle-variety {
  letter-spacing: 0;
}

.caption.subtitle-neon {
  color: #67e8f9;
}

.caption.subtitle-bullet {
  color: #111827;
}

.caption.subtitle-glitch {
  color: #22d3ee;
}

.caption.subtitle-vertical {
  text-align: center;
}

.caption.subtitle-note {
  color: #111827;
}

.caption.subtitle-green {
  color: #ecfdf5;
  background: rgba(16, 185, 129, 0.72);
}

.caption.subtitle-orange {
  color: #fff7ed;
  background: rgba(249, 115, 22, 0.64);
}

.caption.subtitle-gold {
  color: #fde68a;
  background: rgba(15, 23, 42, 0.74);
}

.caption.subtitle-comic {
  color: #fff;
}

.sound-wave {
  position: absolute;
  right: 16px;
  bottom: 22px;
  left: 16px;
  display: flex;
  gap: 5px;
  align-items: end;
  height: 28px;
}

.sound-wave i {
  width: 8px;
  height: 14px;
  background: var(--gold);
  border-radius: 999px;
  animation: wave 0.9s ease-in-out infinite;
}

.sound-wave i:nth-child(2) {
  height: 24px;
  animation-delay: 0.1s;
}

.sound-wave i:nth-child(3) {
  height: 18px;
  animation-delay: 0.2s;
}

.sound-wave i:nth-child(4) {
  height: 28px;
  animation-delay: 0.3s;
}

.sound-wave i:nth-child(5) {
  height: 12px;
  animation-delay: 0.4s;
}

@keyframes wave {
  50% {
    transform: scaleY(0.45);
  }
}

.preview-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.preview-meta div {
  padding: 12px;
  background: #f5f8fa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.preview-meta span,
.preview-meta strong {
  display: block;
}

.preview-meta span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: 320px;
  padding: 12px 14px;
  color: #fff;
  background: #172026;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: 0.2s ease;
  pointer-events: none;
}

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

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

  .preview {
    position: static;
  }
}

@media (max-width: 720px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .material-box {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .split-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .choice-grid,
  .choice-grid.three,
  .platform-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 16px;
  }

  h1 {
    font-size: 26px;
  }

  .caption {
    font-size: 18px;
  }
}

/* Desktop app skin */
:root {
  color-scheme: dark;
  --ink: #f6f7fb;
  --muted: #9ca3b5;
  --line: #49305f;
  --accent: #9d4dff;
  --accent-2: #e05cff;
}

body {
  color: var(--ink);
  background: #11131d;
  overflow: auto;
}

.app-titlebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 56px;
  padding: 0 18px;
  background: #242734;
  border-bottom: 1px solid #333748;
}

.app-brand,
.app-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-logo {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, #2563eb, #c056ff);
  border-radius: 8px;
}

.app-user {
  color: #d8dbee;
  font-size: 13px;
}

.auth-status {
  color: #f4f6ff;
}

.hidden {
  display: none !important;
}

.auth-card {
  max-width: 520px;
}

.app-nav {
  position: fixed;
  top: 56px;
  bottom: 0;
  left: 0;
  z-index: 25;
  display: grid;
  align-content: start;
  gap: 10px;
  width: 76px;
  padding: 14px 10px;
  background: #202331;
  border-right: 1px solid #303445;
}

.app-nav button {
  height: 56px;
  color: #c7cad8;
  background: transparent;
  border: 0;
  border-radius: 10px;
}

.app-nav button.active,
.app-nav button:hover {
  color: #fff;
  background: linear-gradient(135deg, rgba(125, 80, 255, 0.52), rgba(224, 92, 255, 0.28));
  box-shadow: inset 4px 0 0 #b14cff;
}

.workspace {
  max-width: none;
  margin-left: 76px;
  padding: 12px 16px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 48px;
  margin-bottom: 10px;
}

.hero-title {
  grid-column: 2;
}

.hero-title h1 {
  display: none;
}

.hero-title p {
  margin: 0;
  color: #c9cce0;
}

.top-actions {
  justify-self: end;
}

.mode-tabs {
  justify-self: center;
  padding: 8px;
  background: #1a1c28;
  border: 1px solid #8b3fd8;
  border-radius: 999px;
}

.editor-grid {
  grid-template-columns: 340px 340px minmax(620px, 1fr);
  align-items: start;
  gap: 12px;
}

.flow-column {
  display: grid;
  gap: 12px;
  align-content: start;
}

.flow-column.wide {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.flow-column.wide #edit,
.flow-column.wide #publish {
  grid-column: 1;
}

.flow-column.wide #cover,
.flow-column.wide .preview {
  grid-column: 2;
}

.panel,
.preview {
  min-height: auto;
  overflow: visible;
  background: #1a1d29;
  border: 1px solid #4d2c63;
  border-radius: 10px;
  box-shadow: none;
}

.preview {
  position: static;
}

.panel-head,
.preview-head {
  margin: -18px -18px 0;
  padding: 10px 12px;
  background: #222533;
  border-bottom: 1px solid #34384a;
  border-radius: 10px 10px 0 0;
}

.panel {
  gap: 10px;
  padding: 14px;
}

.panel-head,
.preview-head {
  margin: -14px -14px 0;
}

.panel h2,
.preview h2 {
  font-size: 17px;
}

.field,
.range-field {
  gap: 5px;
}

.engine-hint,
.material-box {
  padding: 9px;
}

textarea {
  min-height: 58px;
}

#sourceText,
#rewriteText,
#subtitles {
  min-height: 160px;
}

.choice-grid {
  gap: 8px;
}

.choice {
  min-height: 84px;
  padding: 10px;
}

.phone {
  width: min(100%, 300px);
}

.preview-meta {
  gap: 8px;
}

.preview-meta div {
  padding: 8px;
}

.panel .eyebrow {
  color: #fff;
  background: linear-gradient(135deg, #4b63ff, #d85cff);
  border-left: 0;
}

textarea,
input,
select {
  color: #f6f7fb;
  background: #171925;
  border-color: #72408d;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #c056ff;
  box-shadow: 0 0 0 3px rgba(192, 86, 255, 0.18);
}

.ghost {
  color: #f6f7fb;
  background: #202331;
  border-color: #49305f;
}

.primary {
  background: linear-gradient(135deg, #315bff, #d85cff);
}

.choice,
.result-line,
.material-box,
.preview-meta div,
.title-item,
.platform-grid label {
  color: #f6f7fb;
  background: #171925;
  border-color: #49305f;
}

.engine-hint {
  color: #e8d7ff;
  background: rgba(119, 64, 143, 0.16);
  border-color: #8b3fd8;
}

.engine-hint strong {
  color: #ffcb6b;
}

.choice.checked {
  border-color: #8d5cff;
  box-shadow: inset 0 0 0 1px #8d5cff;
}

.engine-hint,
.hero-title p {
  display: none;
}

#sourceLink {
  min-height: 42px;
  height: 42px;
  resize: none;
  overflow: hidden;
  white-space: nowrap;
}

.bgm-badge {
  margin: 10px auto 0;
  width: min(100%, 280px);
  padding: 7px 10px;
  border-radius: 8px;
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#coverCanvas {
  display: none;
}

.publish-cover-box {
  display: grid;
  gap: 10px;
}

#publish #coverCanvas {
  display: block;
  width: min(220px, 100%);
  height: auto;
  aspect-ratio: 9 / 16;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.04);
}

.preview-cover {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-video {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 11;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-status {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 30;
  place-items: center;
  padding: 28px;
  color: #fff;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.2), rgba(15, 23, 42, 0.82)),
    linear-gradient(135deg, #0f766e, #312e81 54%, #111827);
}

.preview-status strong {
  display: block;
  font-size: 24px;
  line-height: 1.25;
}

.preview-status span {
  display: block;
  margin-top: 10px;
  color: #dbeafe;
  font-size: 13px;
  font-weight: 800;
}

.video-controlbar {
  display: none;
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 12;
  grid-template-columns: auto minmax(68px, 1fr) auto auto auto;
  gap: 6px;
  align-items: center;
  padding: 7px 8px;
  color: #fff;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.72));
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.video-controlbar button {
  min-height: 28px;
  padding: 0 6px;
  color: #fff;
  background: transparent;
  border: 0;
  font-weight: 900;
}

.video-controlbar span {
  min-width: 70px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.video-controlbar input[type="range"] {
  min-height: 0;
  padding: 0;
  accent-color: #fff;
}

.volume-group {
  display: inline-grid;
  grid-template-columns: 26px 58px;
  gap: 2px;
  align-items: center;
}

.volume-group #videoMuteBtn {
  padding: 0;
}

#videoVolume {
  width: 58px;
}

.fullscreen-btn {
  width: 28px;
  min-width: 28px;
}

#videoSeek {
  grid-column: 1 / -1;
  width: 100%;
}

.phone-screen.cover-mode .preview-cover {
  display: block;
  animation: coverPreviewMove 6s ease-in-out infinite alternate;
}

.phone-screen.video-mode .preview-video {
  display: block;
}

.phone-screen.video-mode .video-controlbar {
  display: grid;
}

.phone-screen.video-mode:hover .video-controlbar,
.phone-screen.video-mode:focus-within .video-controlbar {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.phone-screen.generating-mode .preview-status {
  display: grid;
}

.phone-screen.cover-mode #avatarPreview,
.phone-screen.cover-mode .avatar-fallback,
.phone-screen.cover-mode .video-tags,
.phone-screen.cover-mode .caption,
.phone-screen.cover-mode .sound-wave,
.phone-screen.video-mode #avatarPreview,
.phone-screen.video-mode .avatar-fallback,
.phone-screen.video-mode .video-tags,
.phone-screen.video-mode .caption,
.phone-screen.video-mode .sound-wave {
  display: none;
}

.phone-screen.generating-mode .preview-cover,
.phone-screen.generating-mode .preview-video,
.phone-screen.generating-mode .video-controlbar,
.phone-screen.generating-mode #avatarPreview,
.phone-screen.generating-mode .avatar-fallback,
.phone-screen.generating-mode .video-tags,
.phone-screen.generating-mode .caption,
.phone-screen.generating-mode .sound-wave {
  display: none;
}

.phone-screen.caption-preview-mode .caption,
.phone-screen.caption-preview-mode.cover-mode .caption,
.phone-screen.caption-preview-mode.video-mode .caption {
  display: block;
}

@keyframes coverPreviewMove {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.035);
  }
}

.preview-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.preview-modal.show {
  display: flex;
}

#closePreviewModal {
  display: none;
}

.preview-modal-stage {
  display: grid;
  place-items: center;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  padding: 18px;
}

.expanded-preview-video {
  width: auto;
  height: min(92vh, 880px);
  max-width: 96vw;
  max-height: 92vh;
  object-fit: contain;
  background: #000;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 18px 58px rgba(0, 0, 0, 0.38);
}

body.preview-expanded .preview .phone {
  filter: blur(4px);
  transition: filter 0.18s ease;
}

body.utility-mode .process-steps,
body.utility-mode .top-actions,
body.utility-mode .preview {
  display: none;
}

body.utility-mode .editor-grid {
  grid-template-columns: minmax(620px, 980px);
}

body.utility-mode .panel.active {
  grid-column: 1 !important;
  width: 100%;
}

#publish {
  gap: 9px;
}

.status-pill {
  padding: 4px 8px;
  border-radius: 999px;
  color: #c8b8ff;
  background: rgba(139, 92, 246, 0.14);
  border: 1px solid rgba(139, 92, 246, 0.35);
  font-size: 12px;
  font-weight: 800;
}

.publish-field input {
  height: 38px;
}

#publish .platform-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

#publish .platform-grid label {
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}

.publish-row {
  display: grid;
  grid-template-columns: 0.9fr 1.5fr auto;
  gap: 8px;
}

.platform-link-box {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.platform-link-row {
  grid-template-columns: 0.8fr 2fr;
}

.publish-main {
  width: 100%;
  min-height: 46px;
}

.preview-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-preview-toggle {
  display: none;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-agree {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d8dbee;
  font-size: 14px;
}

.auth-agree b {
  color: #8fb8ff;
}

.auth-submit {
  min-height: 52px;
  font-size: 17px;
}

.auth-link {
  min-height: 44px;
}

.auth-register {
  text-align: center;
  color: #d8dbee;
}

.process-steps {
  grid-column: 1 / 3;
  display: flex;
  gap: 26px;
  align-items: center;
}

.process-step {
  position: relative;
  min-height: 38px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(139, 92, 246, 0.36);
  color: #dbe3ff;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  text-align: left;
  width: 84px;
}

.process-step b {
  display: inline;
  color: #b986ff;
  font-size: 12px;
  margin-right: 4px;
}

.process-step span {
  display: inline;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.process-step:not(:last-child)::after {
  content: "→";
  position: absolute;
  top: 50%;
  right: -24px;
  display: block;
  color: #ffffff;
  transform: translateY(-50%);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.process-step.active {
  border-color: #a855f7;
  background: linear-gradient(135deg, rgba(69, 92, 255, 0.96), rgba(205, 74, 238, 0.9));
  color: #fff;
}

.process-step.active b {
  color: #fff;
}

.process-step.done {
  border-color: rgba(34, 197, 94, 0.65);
  background: rgba(34, 197, 94, 0.22);
  color: #eafff1;
}

.process-step.done b {
  color: #86efac;
}

.profile-panel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  align-items: center;
  justify-content: center;
  background: rgba(3, 7, 18, 0.58);
}

.profile-panel.show {
  display: flex;
}

.profile-card {
  width: min(720px, calc(100vw - 48px));
  padding: 16px;
  border-radius: 10px;
  border: 1px solid rgba(168, 85, 247, 0.58);
  background: #1f2230;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.profile-card .control-row {
  gap: 16px;
}

.profile-card .field {
  gap: 4px;
}

.profile-card .field span {
  margin-bottom: 0;
  color: #b9c3d8;
}

.profile-card select,
.profile-card input {
  min-height: 42px;
}

.profile-manage-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.profile-delete {
  min-height: 42px;
  margin-bottom: 0;
}

.field span,
.range-field span,
.material-box p,
.choice span,
.preview-meta span,
.app-user,
.result-line {
  color: #aeb8cf;
}

input::placeholder,
textarea::placeholder {
  color: #8f9bb3;
}

.style-config {
  border: 1px solid rgba(139, 92, 246, 0.42);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.style-config summary {
  cursor: pointer;
  color: #e8d7ff;
  font-weight: 900;
}

.style-config[open] summary {
  margin-bottom: 10px;
}

.benchmark-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.benchmark-toolbar .active {
  color: #fff;
  background: linear-gradient(135deg, #455cff, #c84aee);
}

.benchmark-list {
  display: grid;
  gap: 9px;
}

.benchmark-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 11px;
  border: 1px solid rgba(139, 92, 246, 0.42);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.benchmark-item strong {
  display: block;
  margin-bottom: 6px;
}

.benchmark-stats {
  display: flex;
  gap: 10px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 800;
}

.avatar-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.avatar-card {
  border: 1px solid rgba(139, 92, 246, 0.42);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.avatar-card.active {
  border-color: #a855f7;
  box-shadow: inset 0 0 0 1px #a855f7;
}

.avatar-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  background: #111827;
}

.avatar-card span {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  color: #e5e7eb;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-nav {
  width: 132px;
  padding: 14px 10px;
}

.workspace {
  margin-left: 132px;
}

.app-nav button {
  width: 100%;
  min-height: 46px;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: left;
  font-size: 14px;
  font-weight: 900;
  white-space: normal;
}

.avatar-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.danger {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.16);
}

.editor-grid {
  grid-template-columns: minmax(300px, 1fr) 320px;
  align-items: start;
  gap: 12px;
  overflow: hidden;
}

.flow-column,
.flow-column.wide {
  display: contents;
}

.panel {
  display: none;
}

.panel.active {
  display: grid;
  grid-column: 1 !important;
  grid-row: 1 !important;
}

.preview {
  grid-column: 2 !important;
  grid-row: 1 !important;
  position: sticky;
  top: 92px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.preview .phone {
  max-width: 260px;
}

.preview-meta {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.preview-meta strong {
  overflow-wrap: anywhere;
}

.voice-mode-grid {
  grid-template-columns: 1fr;
}

.voice-mode-grid .choice {
  min-height: 72px;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  align-items: center;
}

.voice-mode-grid .choice input {
  grid-row: span 2;
}

.voice-mode-grid .choice span {
  margin-top: 0;
}

.compact-actions {
  justify-content: flex-start;
  margin-bottom: 8px;
}

#rewrite .control-row .field:has(#rewriteStyle),
#rewrite .control-row .field:has(#audience) {
  display: none;
}

#rewrite .control-row {
  grid-template-columns: 1fr;
}

.phone-screen {
  border: 1px dashed #9d4dff;
}

@media (max-width: 720px) {
  .workspace {
    margin-left: 0;
  }

  .app-nav {
    display: none;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .mode-tabs {
    justify-self: center;
  }

  .editor-grid {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .panel.active,
  .preview {
    grid-column: 1 !important;
  }

  .flow-column.wide {
    grid-template-columns: 1fr;
  }

  .flow-column.wide #edit,
  .flow-column.wide #publish,
  .flow-column.wide #cover,
  .flow-column.wide .preview {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .shell,
  .workspace,
  .topbar,
  .editor-grid {
    width: 100%;
    max-width: 100%;
  }

  .workspace {
    padding: 8px;
  }

  .app-titlebar {
    height: auto;
    min-height: 54px;
    padding: 8px 10px;
  }

  .app-brand strong {
    font-size: 16px;
  }

  .process-steps {
    width: 100%;
    overflow-x: auto;
    gap: 8px;
    padding: 4px 0 8px;
  }

  .process-step {
    flex: 0 0 96px;
    min-height: 46px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 10px;
  }

  .mobile-preview-toggle {
    display: inline-flex;
  }

  .editor-grid {
    grid-template-columns: 1fr;
  }

  .panel.active {
    width: 100%;
    min-width: 0;
    gap: 12px;
    padding: 14px;
  }

  .panel-head {
    gap: 12px;
    align-items: flex-start;
  }

  .split-actions {
    gap: 10px;
  }

  .field {
    gap: 8px;
  }

  .field input,
  .field select,
  .field textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .preview {
    display: none;
    position: static;
    width: 100%;
    max-width: 100%;
    margin-top: 10px;
  }

  body.mobile-preview-open .preview {
    display: grid;
  }

  .preview .phone {
    width: min(100%, 320px);
    max-width: 320px;
    margin: 0 auto;
  }

  .profile-panel {
    align-items: flex-start;
    padding: 14px;
    overflow-y: auto;
  }

  .profile-card {
    width: 100%;
    max-width: 420px;
    max-height: none;
    margin: 18px auto;
  }

  .auth-card {
    width: 100%;
    max-width: min(390px, calc(100vw - 28px));
    padding: 22px;
    border-radius: 22px;
    background: #07080c;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  }

  .auth-card .panel-head {
    align-items: center;
    justify-content: center;
    padding-bottom: 8px;
    border-bottom: 0;
  }

  .auth-card .panel-head .eyebrow,
  .auth-card #closeAuth {
    display: none;
  }

  .auth-card h2 {
    font-size: 30px;
    line-height: 1.1;
    text-align: center;
  }

  .auth-form {
    gap: 13px;
    padding-top: 12px;
  }

  .auth-card .field {
    gap: 10px;
  }

  .auth-card .field span {
    color: #ffffff;
    font-size: 15px;
    font-weight: 900;
  }

  .auth-card .field input {
    min-height: 50px;
    border-color: rgba(139, 92, 246, 0.72);
    background: #11131d;
    font-size: 16px;
  }

  .auth-agree {
    align-items: center;
    gap: 8px;
    font-size: 13px;
    line-height: 1.45;
  }

  .auth-agree input {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #8b5cf6;
  }

  .auth-submit {
    min-height: 52px;
    border-radius: 18px;
    font-size: 17px;
  }

  .auth-link {
    min-height: 46px;
    font-size: 15px;
  }

  .auth-register {
    margin-top: 2px;
    font-size: 15px;
  }

  #authResult {
    margin-top: 2px;
    font-size: 13px;
    line-height: 1.5;
  }

  .control-row,
  .publish-row,
  .platform-link-row,
  .profile-manage-row {
    grid-template-columns: 1fr !important;
  }
}

@media (min-width: 1000px) {
  body.preview-landscape-mode {
    overflow-x: hidden !important;
  }

  body.preview-landscape-mode .flow-column.wide {
    display: grid !important;
    grid-template-columns: 710px minmax(360px, clamp(360px, calc(100vw - 900px), 600px)) !important;
    column-gap: 24px !important;
    align-items: start !important;
    justify-content: start !important;
    width: auto !important;
    max-width: calc(100vw - 150px) !important;
    overflow: hidden !important;
  }

  body.preview-landscape-mode .flow-column.wide > :first-child,
  body.preview-landscape-mode .panel.active {
    grid-column: 1 !important;
    width: 710px !important;
    max-width: 710px !important;
    min-width: 710px !important;
  }

  body.preview-landscape-mode .preview {
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: clamp(360px, calc(100vw - 900px), 600px) !important;
    max-width: 600px !important;
    min-width: 0 !important;
    justify-self: start !important;
  }

  body.preview-landscape-mode .preview .phone {
    width: min(100%, 560px) !important;
    max-width: 560px !important;
    min-width: 0 !important;
    margin-inline: auto !important;
  }

  body.preview-landscape-mode .phone.ratio-landscape {
    width: min(100%, 560px) !important;
    max-width: 560px !important;
  }

  body.preview-landscape-mode .phone-screen {
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    height: auto !important;
    min-height: 0 !important;
  }

  body.preview-landscape-mode .preview-video,
  body.preview-landscape-mode .preview-cover {
    object-fit: contain !important;
  }

  body.preview-landscape-mode .editor-grid {
    grid-template-columns: 710px minmax(360px, 560px) !important;
    gap: 24px !important;
    align-items: start !important;
    justify-content: start !important;
    overflow: hidden !important;
  }

  body.preview-landscape-mode .flow-column,
  body.preview-landscape-mode .flow-column.wide {
    display: contents !important;
  }

  body.preview-landscape-mode .panel.active {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 710px !important;
    max-width: 710px !important;
    min-width: 710px !important;
  }

  body.preview-landscape-mode .preview {
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: 100% !important;
    max-width: 560px !important;
    min-width: 0 !important;
    justify-self: start !important;
    overflow: hidden !important;
  }

  body.preview-landscape-mode .preview .phone,
  body.preview-landscape-mode .phone.ratio-landscape {
    width: min(100%, 520px) !important;
    max-width: 520px !important;
  }
}
