:root {
  color-scheme: dark;
  --bg: #07110f;
  --panel: rgba(13, 27, 24, 0.9);
  --panel-strong: rgba(17, 34, 30, 0.96);
  --surface: rgba(255, 255, 255, 0.035);
  --surface-strong: rgba(255, 255, 255, 0.06);
  --line: rgba(161, 235, 211, 0.16);
  --line-strong: rgba(141, 245, 223, 0.42);
  --text: #f4fff8;
  --muted: rgba(235, 255, 245, 0.68);
  --soft: rgba(235, 255, 245, 0.42);
  --mint: #79f4da;
  --green: #a8eac0;
  --gold: #f4bd5f;
  --orange: #f2a449;
  --danger: #ff8f79;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  font-family:
    ui-sans-serif, -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

/* Page states must be mutually exclusive: CSS component display rules may not override HTML's hidden state. */
[hidden] {
  display: none !important;
}

body {
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(121, 244, 218, 0.06), transparent 260px),
    linear-gradient(110deg, rgba(244, 189, 95, 0.08), transparent 32%, rgba(121, 244, 218, 0.05) 68%, transparent),
    linear-gradient(rgba(127, 244, 218, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(127, 244, 218, 0.032) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 44px 44px, 44px 44px, auto;
}

.login-screen {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 24px;
}

.login-card {
  display: grid;
  width: min(100%, 420px);
  gap: 16px;
  padding: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(121, 244, 218, 0.1), transparent 42%),
    var(--panel-strong);
  box-shadow: var(--shadow);
}

.login-card .brand-mark {
  width: 48px;
  height: 48px;
  font-size: 24px;
}

.login-card h1 {
  margin: -6px 0 0;
  font-size: 27px;
}

.login-copy {
  margin: -6px 0 6px;
  color: var(--muted);
  font-weight: 650;
}

.login-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.login-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  outline: none;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
}

.login-field input:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(121, 244, 218, 0.12);
}

.login-error {
  min-height: 20px;
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 750;
}

.login-button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--mint), var(--gold));
  color: #13221e;
  font-weight: 950;
}

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

button {
  cursor: pointer;
}

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

.app-shell {
  width: min(1720px, calc(100vw - 48px));
  min-height: 100dvh;
  margin: 0 auto;
  padding: 24px 0 36px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(480px, 1.45fr) minmax(180px, auto);
  gap: 20px;
  align-items: center;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 1px solid rgba(244, 189, 95, 0.48);
  border-radius: 8px;
  background: linear-gradient(135deg, #7bf4da, #f2bd62);
  color: #13221e;
  font-size: 30px;
  font-weight: 900;
  box-shadow:
    inset 0 0 0 10px rgba(8, 19, 16, 0.14),
    0 12px 34px rgba(121, 244, 218, 0.12);
}

.brand h1,
.panel-heading h2,
.stage-header h2,
.card-title h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: clamp(24px, 2vw, 32px);
  line-height: 1.1;
}

.brand p,
.panel-heading p,
.stage-header p,
.note {
  color: var(--muted);
}

.brand p {
  margin: 8px 0 0;
  font-weight: 700;
}

.step-track {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 8px;
}

.step-pill {
  min-height: 56px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.026);
  color: var(--soft);
  font-weight: 800;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.step-pill b {
  display: block;
  color: var(--soft);
  font-size: 14px;
}

.step-pill.active {
  border-color: rgba(244, 189, 95, 0.75);
  color: var(--gold);
  background:
    linear-gradient(90deg, rgba(121, 244, 218, 0.1), rgba(244, 189, 95, 0.1)),
    rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 -2px 0 rgba(244, 189, 95, 0.46);
}

.step-pill.done {
  border-color: rgba(121, 244, 218, 0.54);
  color: var(--mint);
}

.command-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.command-bar span {
  max-width: 190px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 470px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding-top: 18px;
}

.input-panel,
.stage-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.input-panel {
  padding: 20px;
}

.panel-heading {
  margin: -20px -20px 18px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(121, 244, 218, 0.075), transparent 64%),
    rgba(255, 255, 255, 0.02);
}

.kicker {
  margin: 0 0 8px;
  color: var(--mint);
  font-size: 13px;
  font-weight: 900;
}

.panel-heading h2,
.stage-header h2 {
  font-size: clamp(24px, 1.7vw, 30px);
  line-height: 1.16;
}

.panel-heading p,
.stage-header p {
  margin: 8px 0 0;
  line-height: 1.65;
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.source-mode-field {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 16px;
  border: 0;
  padding: 0;
}

.source-mode-field legend {
  grid-column: 1 / -1;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 950;
}

.mode-option {
  position: relative;
  display: grid;
  gap: 5px;
  min-height: 74px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px 13px 46px;
  background:
    linear-gradient(110deg, rgba(121, 244, 218, 0.045), transparent 54%),
    var(--surface);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.mode-option input {
  position: absolute;
  left: 14px;
  top: 19px;
  width: 18px;
  height: 18px;
  accent-color: var(--mint);
}

.mode-option:active {
  transform: translateY(1px);
}

.mode-option span {
  color: var(--text);
  font-size: 17px;
  font-weight: 950;
}

.mode-option small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.mode-option.active {
  border-color: rgba(121, 244, 218, 0.72);
  background:
    linear-gradient(110deg, rgba(121, 244, 218, 0.18), rgba(244, 189, 95, 0.075)),
    rgba(255, 255, 255, 0.045);
  box-shadow:
    inset 0 0 0 1px rgba(121, 244, 218, 0.16),
    inset 0 0 24px rgba(121, 244, 218, 0.06);
}

.image-flow-panel,
.video-flow-panel {
  display: grid;
  gap: 14px;
}

.image-step-card,
.video-flow-panel {
  border: 1px solid rgba(121, 244, 218, 0.18);
  border-radius: 8px;
  padding: 15px;
  background:
    linear-gradient(90deg, rgba(121, 244, 218, 0.065), transparent 44%),
    var(--surface);
}

.image-flow-panel[hidden],
.video-flow-panel[hidden] {
  display: none;
}

.mini-step-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.mini-step-header > span {
  border: 1px solid rgba(121, 244, 218, 0.34);
  border-radius: 8px;
  padding: 5px 8px;
  color: var(--mint);
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
  background: rgba(121, 244, 218, 0.07);
}

.mini-step-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  letter-spacing: 0;
}

.mini-step-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  line-height: 1.55;
}

.step-slot {
  display: grid;
}

.step-slot .drop-card {
  width: 100%;
}

.drop-card {
  position: relative;
  display: flex;
  min-height: 210px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 16px;
  border: 1px dashed rgba(121, 244, 218, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(121, 244, 218, 0.08), transparent 48%),
    linear-gradient(rgba(121, 244, 218, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(121, 244, 218, 0.032) 1px, transparent 1px),
    rgba(0, 0, 0, 0.25);
  background-size: auto, 22px 22px, 22px 22px, auto;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.drop-card:hover {
  border-color: rgba(121, 244, 218, 0.58);
  background:
    linear-gradient(135deg, rgba(121, 244, 218, 0.12), transparent 48%),
    linear-gradient(rgba(121, 244, 218, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(121, 244, 218, 0.04) 1px, transparent 1px),
    rgba(0, 0, 0, 0.28);
}

.drop-card:active {
  transform: translateY(1px);
}

.drop-card input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.drop-title {
  position: relative;
  z-index: 1;
  font-size: 18px;
  font-weight: 900;
}

.drop-meta {
  position: relative;
  z-index: 1;
  max-width: 100%;
  margin-top: 8px;
  color: var(--mint);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
  text-align: center;
}

.drop-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.22);
  object-fit: contain;
  object-position: center;
}

.drop-card video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.22);
  object-fit: contain;
  object-position: center;
}

.avatar-drop.has-preview {
  min-height: 300px;
  border-style: solid;
  background: rgba(0, 0, 0, 0.34);
}

.drop-card.has-preview::after {
  display: none;
}

.drop-card.has-preview .drop-title,
.drop-card.has-preview .drop-meta {
  display: none;
}

.drop-card audio {
  position: relative;
  z-index: 1;
  width: min(100%, 240px);
  margin-top: 16px;
}

.beautify-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  border: 1px solid rgba(121, 244, 218, 0.22);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(110deg, rgba(121, 244, 218, 0.09), rgba(244, 189, 95, 0.045)),
    rgba(0, 0, 0, 0.16);
}

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

.beautify-panel span {
  display: block;
  color: var(--text);
  font-size: 15px;
  font-weight: 950;
}

.beautify-panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.55;
}

.beautify-panel textarea {
  min-height: 92px;
  resize: vertical;
}

.beautify-actions {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
  gap: 10px;
}

.beautify-actions span {
  grid-column: 1 / -1;
  color: var(--soft);
  font-size: 12px;
  font-weight: 900;
  text-align: left;
}

.beautify-percent {
  display: grid;
  min-width: 92px;
  min-height: 42px;
  place-items: center;
  border: 1px solid rgba(121, 244, 218, 0.28);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--mint);
  font-size: 27px;
  font-weight: 1000;
  line-height: 1;
  text-align: right;
  text-shadow:
    0 0 10px rgba(121, 244, 218, 0.9),
    0 0 28px rgba(121, 244, 218, 0.4),
    0 0 44px rgba(244, 189, 95, 0.18);
}

.beautify-percent.is-running {
  animation: percent-jump 0.9s ease-in-out infinite;
}

.beautify-percent.is-done {
  color: var(--gold);
  text-shadow:
    0 0 10px rgba(244, 189, 95, 0.9),
    0 0 28px rgba(121, 244, 218, 0.28);
}

.primary-ghost {
  border-color: rgba(121, 244, 218, 0.5);
  background: rgba(121, 244, 218, 0.08);
}

.beautified-result,
.selected-image-card {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  border: 1px solid rgba(121, 244, 218, 0.24);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(110deg, rgba(121, 244, 218, 0.06), transparent 58%),
    rgba(0, 0, 0, 0.2);
}

.beautified-result[hidden] {
  display: none;
}

.beautified-result span,
.selected-image-card span {
  color: var(--text);
  font-size: 15px;
  font-weight: 950;
}

.beautified-result p,
.selected-image-card small {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
}

.beautified-result img,
.selected-image-card img {
  width: 100%;
  max-height: 280px;
  border: 1px solid rgba(121, 244, 218, 0.22);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  object-fit: contain;
}

.selected-image-card {
  min-height: 160px;
  align-content: center;
  margin: 0 0 12px;
}

.selected-image-card img[hidden] {
  display: none;
}

.approve-button {
  min-height: 58px;
  margin-top: 0;
}

.voice-preview-control {
  position: relative;
  z-index: 2;
  width: min(100%, 286px);
}

.voice-preview-control[hidden] {
  display: none;
}

.voice-play-button {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 72px;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(121, 244, 218, 0.46);
  border-radius: 8px;
  padding: 11px 13px;
  background:
    linear-gradient(90deg, rgba(121, 244, 218, 0.18), rgba(244, 189, 95, 0.08)),
    rgba(0, 0, 0, 0.36);
  color: var(--text);
  font-weight: 950;
  box-shadow: inset 0 0 22px rgba(121, 244, 218, 0.08), 0 0 20px rgba(121, 244, 218, 0.12);
}

.voice-play-button::before {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(121, 244, 218, 0.14), transparent);
  transform: translateX(-70%);
}

.voice-play-button.is-playing::before {
  animation: scan-line 1.25s linear infinite;
}

.play-core {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--mint);
  color: #06130f;
  font-size: 14px;
  box-shadow: 0 0 18px rgba(121, 244, 218, 0.54);
}

.voice-duration {
  border: 1px solid rgba(244, 189, 95, 0.42);
  border-radius: 8px;
  padding: 5px 8px;
  color: var(--gold);
  font-size: 13px;
}

.voice-wave {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  align-items: end;
  height: 18px;
}

.voice-wave i {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--mint), rgba(244, 189, 95, 0.7));
  opacity: 0.62;
}

.voice-wave i:nth-child(2) {
  height: 14px;
}

.voice-wave i:nth-child(3) {
  height: 10px;
}

.voice-wave i:nth-child(4) {
  height: 17px;
}

@keyframes scan-line {
  to {
    transform: translateX(70%);
  }
}

.script-field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.script-field span {
  display: block;
  font-size: 15px;
  font-weight: 900;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid rgba(121, 244, 218, 0.16);
  border-radius: 8px;
  outline: none;
  padding: 15px;
  background: rgba(0, 0, 0, 0.42);
  color: var(--text);
  line-height: 1.7;
}

textarea:focus {
  border-color: rgba(121, 244, 218, 0.62);
  box-shadow: 0 0 0 3px rgba(121, 244, 218, 0.1);
}

.field-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  color: var(--soft);
  font-size: 13px;
}

.task-id-card {
  display: grid;
  gap: 5px;
  margin-top: 14px;
  border: 1px solid rgba(121, 244, 218, 0.28);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(90deg, rgba(121, 244, 218, 0.09), rgba(244, 189, 95, 0.06)),
    rgba(255, 255, 255, 0.026);
}

.task-id-card span {
  color: var(--soft);
  font-size: 12px;
  font-weight: 900;
}

.task-id-card b {
  color: var(--mint);
  font-size: 14px;
  font-weight: 950;
  overflow-wrap: anywhere;
  text-shadow: 0 0 14px rgba(121, 244, 218, 0.3);
}

.start-digital-button {
  display: grid;
  width: 100%;
  min-height: 70px;
  margin-top: 14px;
  border: 1px solid rgba(121, 244, 218, 0.2);
  border-radius: 8px;
  padding: 13px 16px;
  background:
    linear-gradient(90deg, rgba(121, 244, 218, 0.075), rgba(244, 189, 95, 0.035)),
    rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-weight: 950;
  text-align: left;
  box-shadow: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.start-digital-button.is-ready {
  border-color: transparent;
  background: linear-gradient(100deg, var(--mint), #bce8b3 54%, var(--gold));
  color: #10211d;
  box-shadow:
    0 0 0 1px rgba(244, 189, 95, 0.16),
    0 18px 42px rgba(121, 244, 218, 0.14);
}

.start-digital-button:not(:disabled):hover {
  border-color: rgba(121, 244, 218, 0.48);
}

.start-digital-button.is-ready:not(:disabled):hover {
  box-shadow:
    0 0 0 1px rgba(244, 189, 95, 0.22),
    0 22px 54px rgba(121, 244, 218, 0.22);
}

.start-digital-button:not(:disabled):active {
  transform: translateY(1px);
}

.start-digital-button span {
  font-size: 18px;
}

.start-digital-button b {
  margin-top: 4px;
  color: var(--soft);
  font-size: 12px;
}

.start-digital-button.is-ready b {
  color: rgba(16, 33, 29, 0.72);
}

.start-digital-button:disabled {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--soft);
  box-shadow: none;
}

.start-digital-button:disabled b {
  color: var(--soft);
}

.ghost-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--mint);
  font-weight: 900;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.ghost-button:not(:disabled):hover {
  border-color: rgba(121, 244, 218, 0.48);
  background: rgba(121, 244, 218, 0.08);
}

.ghost-button:not(:disabled):active {
  transform: translateY(1px);
}

.note {
  margin: 18px 0 0;
  border: 1px solid rgba(244, 189, 95, 0.35);
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(90deg, rgba(121, 244, 218, 0.08), rgba(244, 189, 95, 0.1));
  line-height: 1.7;
}

.artifact-list,
.final-video-list {
  display: grid;
  gap: 10px;
}

.artifact-item b,
.final-video-slot b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-panel {
  overflow: visible;
}

.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(95deg, rgba(121, 244, 218, 0.075), transparent 56%),
    var(--panel-strong);
}

#progressNumber {
  display: grid;
  min-width: 168px;
  min-height: 96px;
  place-items: center;
  border: 1px solid rgba(121, 244, 218, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(121, 244, 218, 0.08), rgba(0, 0, 0, 0.12)),
    rgba(0, 0, 0, 0.18);
  color: var(--mint);
  font-size: clamp(48px, 5vw, 76px);
  font-weight: 1000;
  line-height: 1;
  text-align: right;
  text-shadow:
    0 0 12px rgba(121, 244, 218, 0.78),
    0 0 34px rgba(121, 244, 218, 0.36),
    0 0 58px rgba(244, 189, 95, 0.18);
}

.action-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
  padding: 18px 24px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.stage-display {
  position: relative;
  display: grid;
  min-height: 132px;
  grid-template-columns: auto 1fr auto;
  gap: 7px 12px;
  align-items: start;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(121, 244, 218, 0.045), transparent 48%),
    rgba(255, 255, 255, 0.032);
  color: var(--muted);
  font-weight: 950;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.stage-display::before {
  position: absolute;
  inset: 0;
  content: "";
  opacity: 0;
  background: linear-gradient(120deg, transparent, rgba(121, 244, 218, 0.2), transparent);
  transform: translateX(-70%);
}

.stage-display.active::before {
  animation: scan-line 1.65s linear infinite;
  opacity: 1;
}

.module-index {
  grid-row: 1 / 5;
  color: var(--gold);
  font-size: 18px;
  line-height: 1;
}

.stage-display strong {
  color: var(--text);
  font-size: 22px;
  line-height: 1.1;
}

.stage-display small {
  grid-column: 2 / -1;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.module-percent {
  grid-column: 2 / -1;
  justify-self: end;
  color: var(--mint);
  font-size: clamp(38px, 3.6vw, 58px);
  font-weight: 1000;
  line-height: 0.9;
  text-shadow:
    0 0 10px rgba(121, 244, 218, 0.92),
    0 0 30px rgba(121, 244, 218, 0.44),
    0 0 48px rgba(244, 189, 95, 0.2);
  animation: percent-jump 1.5s ease-in-out infinite;
}

.stage-display:nth-child(2) .module-percent {
  animation-delay: 0.16s;
}

.stage-display:nth-child(3) .module-percent {
  animation-delay: 0.32s;
}

.phase-state {
  justify-self: end;
  border: 1px solid rgba(121, 244, 218, 0.25);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--soft);
  font-size: 12px;
  font-style: normal;
}

.module-meter {
  position: relative;
  grid-column: 1 / -1;
  display: block;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.module-fill {
  display: block;
  width: 10%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--gold));
  box-shadow: 0 0 18px rgba(121, 244, 218, 0.54);
  transition: width 240ms ease;
}

.stage-display.done {
  border-color: rgba(121, 244, 218, 0.42);
  background:
    linear-gradient(135deg, rgba(121, 244, 218, 0.08), transparent 48%),
    rgba(121, 244, 218, 0.08);
}

.stage-display.done .phase-state {
  border-color: rgba(121, 244, 218, 0.48);
  color: var(--gold);
}

.stage-display.done .module-percent {
  color: var(--gold);
  text-shadow:
    0 0 10px rgba(244, 189, 95, 0.84),
    0 0 30px rgba(121, 244, 218, 0.28);
}

.stage-display.active {
  border-color: rgba(121, 244, 218, 0.72);
  color: var(--mint);
  background:
    linear-gradient(135deg, rgba(121, 244, 218, 0.2), rgba(244, 189, 95, 0.1)),
    rgba(3, 12, 10, 0.72);
  box-shadow:
    inset 0 0 30px rgba(121, 244, 218, 0.08),
    0 0 26px rgba(121, 244, 218, 0.18);
}

.stage-display.active .phase-state {
  border-color: transparent;
  background: var(--mint);
  color: #06130f;
  box-shadow: 0 0 18px rgba(121, 244, 218, 0.42);
}

.stage-display.active .module-percent {
  animation-duration: 0.9s;
}

.stage-display.failed {
  border-color: rgba(255, 143, 121, 0.5);
}

.stage-display.failed .phase-state {
  border-color: rgba(255, 143, 121, 0.48);
  color: var(--danger);
}

.stage-display.failed .module-percent {
  color: var(--danger);
  text-shadow:
    0 0 10px rgba(255, 143, 121, 0.76),
    0 0 28px rgba(255, 143, 121, 0.28);
}

@keyframes percent-jump {
  0%,
  100% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }

  42% {
    transform: translateY(-4px) scale(1.05);
    filter: brightness(1.28);
  }
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(520px, 1.28fr);
  gap: 16px;
  align-items: start;
  padding: 22px 24px 18px;
}

.output-card {
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(121, 244, 218, 0.045), transparent 140px),
    rgba(255, 255, 255, 0.032);
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

.card-title h3 {
  font-size: 18px;
}

.card-title span {
  border: 1px solid rgba(121, 244, 218, 0.3);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--mint);
  font-size: 13px;
  font-weight: 900;
}

.card-hint {
  margin: 0;
  padding: 12px 16px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.6;
}

pre {
  min-height: 190px;
  margin: 0;
  overflow: visible;
  padding: 18px;
  color: rgba(242, 255, 247, 0.84);
  font-family: inherit;
  line-height: 1.75;
  white-space: pre-wrap;
}

.scene-list {
  display: grid;
  gap: 12px;
  overflow: visible;
  padding: 14px 16px 16px;
}

.scene-item {
  border: 1px solid rgba(121, 244, 218, 0.2);
  border-radius: 8px;
  padding: 14px 15px;
  background:
    linear-gradient(90deg, rgba(121, 244, 218, 0.052), transparent 52%),
    rgba(0, 0, 0, 0.2);
}

.scene-item header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.scene-item b {
  color: var(--gold);
}

.scene-item span {
  color: var(--mint);
  font-size: 13px;
  font-weight: 900;
}

.scene-item.error-scene {
  border-color: rgba(255, 143, 121, 0.42);
  background: rgba(255, 143, 121, 0.08);
}

.scene-item.error-scene b {
  color: var(--danger);
}

.scene-item p,
.artifact-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.68;
}

.scene-meta {
  display: block;
  margin-top: 10px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 850;
}

.artifact-list,
.final-video-list {
  overflow: visible;
  padding: 14px 16px 16px;
}

.artifact-list {
  max-height: none;
}

.final-video-list {
  max-height: none;
}

.video-slots {
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  align-items: stretch;
}

.artifact-item,
.final-video-slot {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(121, 244, 218, 0.18);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(140deg, rgba(121, 244, 218, 0.04), transparent 45%),
    rgba(0, 0, 0, 0.2);
}

.video-slot {
  position: relative;
  min-height: 300px;
  align-content: start;
  overflow: hidden;
  background:
    linear-gradient(rgba(121, 244, 218, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(121, 244, 218, 0.035) 1px, transparent 1px),
    rgba(0, 0, 0, 0.24);
  background-size: 18px 18px, 18px 18px, auto;
}

.empty-video-slot {
  min-height: 160px;
  align-content: center;
}

.video-slot::after {
  position: absolute;
  inset: auto 12px 12px;
  height: 3px;
  content: "";
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mint), rgba(244, 189, 95, 0.36), var(--gold));
  opacity: 0.48;
}

.video-slot.has-video {
  border-color: rgba(121, 244, 218, 0.45);
}

.final-video-slot {
  grid-column: 1 / -1;
  min-height: 260px;
  border-color: rgba(244, 189, 95, 0.4);
  background:
    linear-gradient(135deg, rgba(244, 189, 95, 0.12), rgba(121, 244, 218, 0.08)),
    rgba(0, 0, 0, 0.24);
}

.final-video-slot.has-video {
  border-color: rgba(121, 244, 218, 0.56);
  box-shadow: inset 0 0 28px rgba(121, 244, 218, 0.08);
}

.video-placeholder {
  display: grid;
  min-height: 240px;
  align-content: center;
  justify-items: center;
  gap: 12px;
  border: 1px solid rgba(121, 244, 218, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(121, 244, 218, 0.1), transparent 48%),
    linear-gradient(rgba(121, 244, 218, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(121, 244, 218, 0.032) 1px, transparent 1px),
    rgba(0, 0, 0, 0.22);
  background-size: auto, 18px 18px, 18px 18px, auto;
  color: var(--soft);
}

.video-placeholder span {
  color: var(--gold);
  font-size: 54px;
  font-weight: 1000;
  line-height: 1;
}

.video-placeholder small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.final-video-section {
  padding: 0 24px 24px;
}

.final-output-card {
  min-height: auto;
}

.final-output-card .card-title {
  padding-block: 12px;
}

.result-video {
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 520px;
  border: 1px solid rgba(121, 244, 218, 0.24);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.42);
  object-fit: contain;
}

.final-result-video {
  aspect-ratio: 16 / 9;
}

.error-text {
  color: var(--danger);
}

@media (max-width: 1180px) {
  .topbar,
  .workspace,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .step-track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .command-bar {
    justify-content: flex-start;
  }

}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 28px, 720px);
    padding-top: 16px;
  }

  .topbar,
  .workspace {
    gap: 14px;
  }

  .command-bar {
    flex-wrap: wrap;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    font-size: 24px;
  }

  .step-track,
  .upload-grid,
  .source-mode-field,
  .action-row {
    grid-template-columns: 1fr;
  }

  .input-panel,
  .stage-header,
  .action-row {
    padding: 16px;
  }

  .panel-heading {
    margin: -16px -16px 16px;
    padding: 16px;
  }

  .stage-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .result-grid {
    padding: 16px;
  }

  .final-video-section {
    padding: 0 16px 16px;
  }

  #progressNumber {
    min-height: 84px;
    min-width: 0;
    width: 100%;
    text-align: left;
  }

  .beautify-actions {
    grid-template-columns: 1fr;
  }

  .beautify-percent {
    width: 100%;
    justify-self: stretch;
  }

  .stage-display {
    min-height: 118px;
  }

  .video-slots {
    grid-template-columns: 1fr;
  }

  .video-slot {
    min-height: 300px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
