:root {
  color-scheme: dark;
  --bg: #07100f;
  --surface: rgba(17, 27, 25, 0.88);
  --surface-soft: rgba(230, 238, 224, 0.055);
  --surface-strong: rgba(230, 238, 224, 0.105);
  --line: rgba(230, 238, 224, 0.16);
  --line-strong: rgba(230, 238, 224, 0.28);
  --text: #edf4e8;
  --muted: #aebcae;
  --dim: #68766f;
  --cyan: #7bf3dc;
  --amber: #f1b15b;
  --leaf: #a8e36f;
  --blue: #4b8cff;
  --violet: oklch(73% 0.12 305);
  --glow: oklch(79% 0.13 184 / 0.34);
  --red: #ff7867;
  --shadow: rgba(0, 0, 0, 0.42);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(90deg, rgba(237, 244, 232, 0.03) 1px, transparent 1px),
    linear-gradient(180deg, rgba(237, 244, 232, 0.025) 1px, transparent 1px),
    linear-gradient(135deg, #07100f 0%, #121612 46%, #081816 100%);
  background-size: 42px 42px, 42px 42px, auto;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: var(--font);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0%, rgba(123, 243, 220, 0.085) 24%, transparent 42%),
    linear-gradient(75deg, transparent 18%, rgba(241, 177, 91, 0.07) 50%, transparent 72%);
  opacity: 0.82;
  animation: pageSweep 10s ease-in-out infinite;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(123, 243, 220, 0.34);
  outline-offset: 2px;
}

.studio {
  position: relative;
  width: min(1580px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 34px;
}

.studio::before {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  top: 104px;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(123, 243, 220, 0.5), rgba(241, 177, 91, 0.32), transparent);
  opacity: 0.65;
  animation: scanDrop 5.2s linear infinite;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(330px, 0.42fr) minmax(520px, 1fr);
  gap: 16px;
  align-items: center;
  min-height: 68px;
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  position: relative;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(123, 243, 220, 0.58);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(123, 243, 220, 0.95), rgba(241, 177, 91, 0.8)),
    #0b1513;
  box-shadow: 0 0 34px rgba(123, 243, 220, 0.22), inset 0 0 0 1px rgba(237, 244, 232, 0.18);
  overflow: hidden;
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(6, 16, 14, 0.32);
  border-radius: 6px;
}

.brand-mark::after {
  content: "C";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(6, 16, 14, 0.78);
  font-size: 23px;
  font-weight: 950;
}

.brand b,
.brand span {
  display: block;
}

.brand b {
  font-size: 20px;
  line-height: 1;
  letter-spacing: 0;
}

.brand span {
  margin-top: 5px;
  color: rgba(174, 188, 174, 0.72);
  font-size: 12px;
}

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

.step {
  position: relative;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  color: var(--dim);
  background: rgba(230, 238, 224, 0.045);
  text-align: left;
  overflow: hidden;
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease, transform 180ms ease;
}

.step::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 0%, rgba(123, 243, 220, 0.12) 48%, transparent 74%);
  transform: translateX(-120%);
  transition: transform 220ms ease;
}

.step:hover {
  transform: translateY(-1px);
  border-color: rgba(123, 243, 220, 0.32);
}

.step:hover::after,
.step.is-current::after {
  transform: translateX(120%);
}

.step b,
.step span {
  display: block;
}

.step b {
  margin-bottom: 2px;
  color: inherit;
  font-size: 11px;
}

.step span {
  font-size: 12px;
  white-space: nowrap;
}

.step.is-on {
  border-color: rgba(123, 243, 220, 0.45);
  color: var(--cyan);
  background: rgba(123, 243, 220, 0.075);
}

.step.is-current {
  border-color: rgba(241, 177, 91, 0.58);
  color: var(--amber);
  box-shadow: inset 0 0 0 1px rgba(241, 177, 91, 0.12);
}

.top-actions,
.button-row,
.tabs,
.download-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.server-mode {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--muted);
  background: rgba(230, 238, 224, 0.05);
  font-size: 12px;
  font-weight: 700;
}

.server-mode.real {
  border-color: rgba(168, 227, 111, 0.42);
  color: var(--leaf);
}

.server-mode.mock {
  border-color: rgba(241, 177, 91, 0.42);
  color: var(--amber);
}

.layout {
  display: grid;
  grid-template-columns: minmax(330px, 430px) minmax(0, 1fr);
  gap: 16px;
  margin-top: 18px;
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(230, 238, 224, 0.09), rgba(230, 238, 224, 0.035)),
    rgba(7, 16, 15, 0.72);
  box-shadow:
    0 24px 80px var(--shadow),
    inset 0 1px 0 rgba(237, 244, 232, 0.08);
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.panel::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--amber), transparent);
  opacity: 0.72;
  pointer-events: none;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-height: 70px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head h1,
.panel-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.05;
  letter-spacing: 0;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.55;
}

.form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

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

.field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(230, 238, 224, 0.18);
  border-radius: 8px;
  color: var(--text);
  background: rgba(4, 9, 8, 0.76);
}

input::placeholder,
textarea::placeholder {
  color: rgba(237, 244, 232, 0.34);
  font-weight: 560;
}

input:placeholder-shown,
textarea:placeholder-shown {
  color: rgba(237, 244, 232, 0.44);
}

input,
select {
  height: 46px;
  padding: 0 12px;
}

textarea {
  min-height: 132px;
  resize: vertical;
  padding: 12px;
  line-height: 1.6;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 18px, calc(100% - 12px) 18px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.upload-grid,
.select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.upload-box {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 220px;
  border: 1px dashed rgba(123, 243, 220, 0.38);
  border-radius: 8px;
  padding: 12px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(230, 238, 224, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(230, 238, 224, 0.035) 1px, transparent 1px),
    rgba(4, 9, 8, 0.62);
  background-size: 22px 22px, 22px 22px, auto;
  text-align: center;
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.upload-box::before,
.upload-box::after {
  content: "";
  position: absolute;
  pointer-events: none;
  opacity: 0.62;
}

.upload-box::before {
  inset: 10px;
  border: 1px solid rgba(123, 243, 220, 0.11);
  border-radius: 8px;
}

.upload-box::after {
  left: 12px;
  right: 12px;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(123, 243, 220, 0.42), transparent);
  transform: translateY(-50%);
}

.upload-box:hover {
  transform: translateY(-1px);
  border-color: rgba(123, 243, 220, 0.6);
  box-shadow: inset 0 0 0 1px rgba(123, 243, 220, 0.12), 0 0 32px rgba(123, 243, 220, 0.08);
}

.upload-box.is-dragover {
  border-color: var(--amber);
  box-shadow: inset 0 0 0 1px rgba(241, 177, 91, 0.32);
}

.upload-box.has-preview {
  border-style: solid;
  border-color: rgba(123, 243, 220, 0.54);
  background: rgba(3, 7, 7, 0.82);
}

.upload-box input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-title,
.upload-help,
.upload-box b {
  position: relative;
  z-index: 2;
  display: block;
}

.upload-title {
  color: var(--text);
  font-weight: 800;
  font-size: 13px;
}

.upload-help {
  margin-top: 4px;
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.upload-box b {
  margin-top: 16px;
  max-width: 150px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.45;
}

.upload-box > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.82;
  transition: opacity 180ms ease, filter 180ms ease, transform 180ms ease;
}

.upload-box.has-preview > img {
  opacity: 1;
  filter: saturate(1.06) contrast(1.03);
}

.upload-box.has-preview:hover > img {
  transform: scale(1.025);
}

.upload-box.has-preview .upload-title,
.upload-box.has-preview .upload-help,
.upload-box.has-preview b {
  opacity: 0;
}

.upload-box > img + b {
  align-self: end;
  width: calc(100% - 18px);
  max-width: none;
  margin: 150px 0 0;
  border: 1px solid rgba(230, 238, 224, 0.2);
  border-radius: 8px;
  padding: 7px 8px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.48);
}

.upload-preview-grid {
  position: absolute;
  inset: 8px;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: minmax(0, 1fr);
  gap: 6px;
}

.upload-preview-grid:has(figure:nth-child(2)) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.upload-preview-grid:has(figure:nth-child(3)) figure:first-child {
  grid-column: 1 / -1;
}

.upload-preview-grid figure {
  position: relative;
  min-height: 0;
  margin: 0;
  border: 1px solid rgba(123, 243, 220, 0.24);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(4, 9, 8, 0.78);
}

.upload-preview-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.upload-preview-grid figcaption {
  position: absolute;
  left: 6px;
  bottom: 6px;
  border: 1px solid rgba(230, 238, 224, 0.18);
  border-radius: 999px;
  padding: 4px 7px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.54);
  font-size: 10px;
  font-weight: 850;
}

.primary-button,
.ghost-button,
.tab,
.copy-button,
.link-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 820;
}

.primary-button {
  position: relative;
  flex: 1;
  min-height: 58px;
  border: 1px solid rgba(123, 243, 220, 0.58);
  color: #06100e;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0%, transparent 28%, rgba(255, 255, 255, 0.14) 52%, transparent 76%),
    linear-gradient(135deg, var(--cyan), var(--amber));
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(123, 243, 220, 0.16), 0 0 28px rgba(241, 177, 91, 0.1);
  transition: transform 180ms ease, box-shadow 180ms ease;
  font-size: 14px;
  letter-spacing: 0;
}

.primary-button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 0%, rgba(237, 244, 232, 0.42) 46%, transparent 72%);
  transform: translateX(-120%);
  transition: transform 240ms ease;
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 52px rgba(123, 243, 220, 0.22), 0 0 36px rgba(241, 177, 91, 0.16);
}

.primary-button:hover::after {
  transform: translateX(120%);
}

.primary-button.compact {
  min-height: 46px;
  width: 100%;
}

.video-download-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 132px;
  width: auto;
  text-decoration: none;
}

.ghost-button,
.tab,
.copy-button,
.link-button {
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(230, 238, 224, 0.052);
}

.tab.is-active,
.copy-button:hover,
.link-button:hover {
  border-color: rgba(123, 243, 220, 0.48);
  color: var(--cyan);
  background: rgba(123, 243, 220, 0.075);
}

.note {
  margin: 0;
  border: 1px solid rgba(241, 177, 91, 0.24);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  background: rgba(241, 177, 91, 0.06);
  font-size: 12px;
  line-height: 1.65;
}

.progress-shell {
  position: relative;
  padding: 14px 16px 15px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(123, 243, 220, 0.055), rgba(241, 177, 91, 0.035), rgba(75, 140, 255, 0.045)),
    rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.progress-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 0%, rgba(123, 243, 220, 0.12) 48%, transparent 74%);
  transform: translateX(-110%);
  animation: progressSweep 2.4s ease-in-out infinite;
  pointer-events: none;
}

.progress-meta {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 17px;
  font-weight: 850;
  line-height: 1.35;
}

.progress-meta span {
  min-width: 0;
}

.progress-meta b {
  color: var(--cyan);
  font-size: 22px;
  text-shadow: 0 0 18px rgba(123, 243, 220, 0.28);
}

.progress-bar {
  position: relative;
  z-index: 1;
  height: 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  overflow: hidden;
  background: rgba(230, 238, 224, 0.052);
}

.progress-bar i {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--amber), var(--leaf));
  transition: width 240ms ease;
  box-shadow: 0 0 24px rgba(123, 243, 220, 0.34);
}

.output-body {
  min-height: 720px;
  padding: 16px;
}

.empty-state,
.loading-state {
  min-height: 640px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(230, 238, 224, 0.12);
  border-radius: 8px;
  padding: 26px;
  text-align: center;
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(230, 238, 224, 0.025) 0,
      rgba(230, 238, 224, 0.025) 1px,
      transparent 1px,
      transparent 14px
    ),
    rgba(4, 9, 8, 0.36);
}

.empty-state b,
.loading-state b {
  display: block;
  margin-bottom: 8px;
  font-size: 26px;
}

.empty-state span,
.loading-state span {
  color: var(--muted);
  line-height: 1.7;
}

.failed-state {
  border-color: rgba(255, 120, 103, 0.28);
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(255, 120, 103, 0.035) 0,
      rgba(255, 120, 103, 0.035) 1px,
      transparent 1px,
      transparent 14px
    ),
    rgba(4, 9, 8, 0.42);
}

.loading-line {
  width: min(520px, 100%);
  height: 8px;
  border: 1px solid var(--line);
  border-radius: 99px;
  margin: 18px auto 0;
  overflow: hidden;
  background: rgba(230, 238, 224, 0.052);
}

.loading-line i {
  display: block;
  width: 34%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--amber), var(--leaf));
  animation: sweep 1.1s ease-in-out infinite alternate;
}

@keyframes sweep {
  from {
    transform: translateX(-26%);
  }
  to {
    transform: translateX(220%);
  }
}

@keyframes pageSweep {
  0%,
  100% {
    transform: translateX(-12%) skewX(-8deg);
  }
  50% {
    transform: translateX(12%) skewX(-8deg);
  }
}

@keyframes scanDrop {
  from {
    transform: translateY(0);
    opacity: 0;
  }
  12% {
    opacity: 0.7;
  }
  to {
    transform: translateY(calc(100vh - 130px));
    opacity: 0;
  }
}

@keyframes progressSweep {
  0%,
  35% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(110%);
  }
}

.idle-showcase {
  position: relative;
  min-height: 640px;
  display: grid;
  align-content: center;
  gap: 24px;
  border: 1px solid rgba(123, 243, 220, 0.18);
  border-radius: 8px;
  padding: 34px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(123, 243, 220, 0.055) 1px, transparent 1px),
    linear-gradient(180deg, rgba(241, 177, 91, 0.04) 1px, transparent 1px),
    repeating-linear-gradient(
      -45deg,
      rgba(230, 238, 224, 0.025) 0,
      rgba(230, 238, 224, 0.025) 1px,
      transparent 1px,
      transparent 16px
    ),
    rgba(4, 9, 8, 0.42);
  background-size: 34px 34px, 34px 34px, auto, auto;
  isolation: isolate;
}

.idle-showcase::before {
  content: "";
  position: absolute;
  inset: -35% -18%;
  z-index: -1;
  background:
    linear-gradient(110deg, transparent 0%, rgba(123, 243, 220, 0.18) 20%, transparent 36%),
    linear-gradient(72deg, transparent 16%, rgba(241, 177, 91, 0.14) 42%, transparent 64%),
    linear-gradient(148deg, transparent 28%, rgba(168, 227, 111, 0.1) 58%, transparent 78%);
  opacity: 0.8;
  animation: idleSweep 6.4s ease-in-out infinite;
}

.idle-showcase::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, transparent 0%, rgba(237, 244, 232, 0.045) 50%, transparent 100%);
  transform: translateY(-100%);
  animation: idleScan 4.8s linear infinite;
}

.idle-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 18px;
  align-items: stretch;
}

.idle-copy {
  min-width: 0;
}

.idle-copy span,
.idle-copy b,
.idle-copy p {
  display: block;
}

.idle-copy span {
  width: fit-content;
  border: 1px solid rgba(123, 243, 220, 0.38);
  border-radius: 8px;
  padding: 5px 8px;
  color: var(--cyan);
  background: rgba(123, 243, 220, 0.07);
  font-size: 11px;
  font-weight: 900;
}

.idle-copy b {
  margin-top: 12px;
  font-size: 46px;
  line-height: 1.03;
}

.idle-copy p {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.idle-status {
  position: relative;
  min-height: 116px;
  border: 1px solid rgba(241, 177, 91, 0.3);
  border-radius: 8px;
  padding: 12px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(241, 177, 91, 0.08), rgba(123, 243, 220, 0.05)),
    rgba(3, 7, 7, 0.5);
}

.idle-status i {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34%;
  background: linear-gradient(180deg, rgba(123, 243, 220, 0.05), rgba(123, 243, 220, 0.22));
  animation: idleLevel 4.2s ease-in-out infinite;
}

.idle-status strong,
.idle-status small {
  position: relative;
  z-index: 1;
  display: block;
}

.idle-status strong {
  color: var(--amber);
  font-size: 34px;
  line-height: 1;
}

.idle-status small {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.idle-route {
  position: relative;
  height: 38px;
  border: 1px solid rgba(230, 238, 224, 0.13);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(230, 238, 224, 0.035);
}

.idle-beam {
  position: absolute;
  left: 22px;
  right: 22px;
  top: 18px;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--amber), var(--leaf), var(--blue));
  box-shadow: 0 0 22px rgba(123, 243, 220, 0.45);
}

.idle-packet {
  position: absolute;
  top: 12px;
  width: 58px;
  height: 12px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(123, 243, 220, 0.08), var(--cyan), var(--amber));
  box-shadow: 0 0 18px rgba(241, 177, 91, 0.32);
  animation: packetMove 4.5s linear infinite;
}

.idle-packet.two {
  animation-delay: -1.45s;
}

.idle-packet.three {
  animation-delay: -2.9s;
}

.idle-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.idle-step-card {
  position: relative;
  min-height: 132px;
  border: 1px solid rgba(230, 238, 224, 0.13);
  border-radius: 8px;
  padding: 14px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(230, 238, 224, 0.065), rgba(230, 238, 224, 0.025)),
    rgba(3, 7, 7, 0.52);
  animation: cardPulse 3.7s ease-in-out infinite;
  animation-delay: var(--delay);
}

.idle-step-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(123, 243, 220, 0.14) 42%, transparent 68%);
  transform: translateX(-100%);
  animation: cardShine 3.7s ease-in-out infinite;
  animation-delay: var(--delay);
}

.idle-step-card span,
.idle-step-card b,
.idle-step-card small,
.idle-step-card i {
  position: relative;
  z-index: 1;
  display: block;
}

.idle-step-card span {
  color: var(--amber);
  font-size: 12px;
  font-weight: 900;
}

.idle-step-card b {
  margin-top: 16px;
  color: var(--text);
  font-size: 16px;
}

.idle-step-card small {
  margin-top: 7px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.45;
}

.idle-step-card i {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 13px;
  height: 5px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(230, 238, 224, 0.08);
}

.idle-step-card i::after {
  content: "";
  display: block;
  width: 58%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--amber));
  animation: idleMeter 3.7s ease-in-out infinite;
  animation-delay: var(--delay);
}

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

.idle-preview-grid article {
  position: relative;
  min-height: 126px;
  border: 1px solid rgba(123, 243, 220, 0.16);
  border-radius: 8px;
  padding: 14px;
  overflow: hidden;
  background: rgba(123, 243, 220, 0.04);
}

.idle-preview-grid b,
.idle-preview-grid span {
  display: block;
  position: relative;
  z-index: 1;
}

.idle-preview-grid b {
  color: var(--cyan);
  font-size: 13px;
}

.idle-preview-grid span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.idle-preview-grid i {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 13px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--amber), transparent);
  animation: previewGlow 2.8s ease-in-out infinite alternate;
}

@keyframes idleSweep {
  0%,
  100% {
    transform: translateX(-18%) skewX(-10deg);
  }
  50% {
    transform: translateX(18%) skewX(-10deg);
  }
}

@keyframes idleScan {
  to {
    transform: translateY(100%);
  }
}

@keyframes idleLevel {
  0%,
  100% {
    height: 24%;
  }
  50% {
    height: 78%;
  }
}

@keyframes packetMove {
  from {
    transform: translateX(-80px);
  }
  to {
    transform: translateX(calc(100vw + 80px));
  }
}

@keyframes cardPulse {
  0%,
  100% {
    border-color: rgba(230, 238, 224, 0.13);
  }
  45% {
    border-color: rgba(123, 243, 220, 0.45);
  }
}

@keyframes cardShine {
  0%,
  45% {
    transform: translateX(-100%);
  }
  78%,
  100% {
    transform: translateX(100%);
  }
}

@keyframes idleMeter {
  0%,
  100% {
    transform: translateX(-45%);
  }
  50% {
    transform: translateX(92%);
  }
}

@keyframes previewGlow {
  from {
    opacity: 0.3;
  }
  to {
    opacity: 1;
  }
}

.section-stack {
  display: grid;
  gap: 12px;
}

.process-card {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(241, 177, 91, 0.34);
  border-radius: 8px;
  padding: 16px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(241, 177, 91, 0.14), rgba(123, 243, 220, 0.08), rgba(75, 140, 255, 0.06)),
    rgba(4, 9, 8, 0.66);
  box-shadow: inset 0 0 0 1px rgba(237, 244, 232, 0.035), 0 0 34px rgba(123, 243, 220, 0.08);
}

.process-card::after {
  content: "";
  position: absolute;
  left: -20%;
  right: -20%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--amber), transparent);
  animation: processLine 2s linear infinite;
}

.spinner {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 4px solid rgba(230, 238, 224, 0.14);
  border-top-color: var(--cyan);
  border-right-color: var(--amber);
  animation: spin 0.82s linear infinite;
  box-shadow: 0 0 22px rgba(123, 243, 220, 0.16);
}

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

@keyframes processLine {
  from {
    transform: translateX(-30%);
  }
  to {
    transform: translateX(30%);
  }
}

.process-card b,
.process-card span,
.process-card small {
  display: block;
}

.process-card b {
  color: var(--text);
  font-size: 18px;
  line-height: 1.25;
}

.process-card span {
  margin-top: 6px;
  color: var(--amber);
  font-size: 14px;
  font-weight: 850;
}

.process-card small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.stage-meter {
  height: 8px;
  margin-top: 12px;
  border: 1px solid rgba(230, 238, 224, 0.16);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(230, 238, 224, 0.055);
}

.stage-meter i {
  display: block;
  height: 100%;
  min-width: 4%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--amber), var(--leaf));
  box-shadow: 0 0 20px rgba(123, 243, 220, 0.25);
  transition: width 260ms ease;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(4, 9, 8, 0.5);
}

.notice-card {
  border: 1px solid rgba(241, 177, 91, 0.28);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(241, 177, 91, 0.06);
}

.notice-card.error {
  border-color: rgba(255, 120, 103, 0.38);
  background: rgba(255, 120, 103, 0.075);
}

.notice-card b,
.notice-card span {
  display: block;
}

.notice-card b {
  color: var(--red);
  font-size: 13px;
}

.notice-card span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.retry-button {
  margin-top: 10px;
  border: 1px solid rgba(255, 120, 103, 0.42);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  background: linear-gradient(135deg, rgba(255, 120, 103, 0.18), rgba(241, 177, 91, 0.16));
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.retry-button:hover {
  border-color: rgba(255, 120, 103, 0.7);
  box-shadow: 0 0 0 1px rgba(255, 120, 103, 0.16);
}

.retry-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.result-card h3 {
  margin: 0;
  font-size: 15px;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.caption {
  margin-top: 5px;
  color: var(--dim);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid rgba(241, 177, 91, 0.36);
  border-radius: 8px;
  padding: 6px 8px;
  color: var(--amber);
  background: rgba(241, 177, 91, 0.075);
  font-size: 11px;
  white-space: nowrap;
}

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

.metric {
  min-height: 118px;
  border: 1px solid rgba(230, 238, 224, 0.115);
  border-radius: 8px;
  padding: 11px;
  background: rgba(230, 238, 224, 0.035);
}

.metric b,
.metric span {
  display: block;
}

.metric b {
  color: var(--text);
  font-size: 12px;
}

.metric span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

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

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

.timeline {
  display: grid;
  gap: 8px;
}

.timeline-item {
  display: grid;
  grid-template-columns: minmax(92px, 0.18fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(230, 238, 224, 0.1);
  border-radius: 8px;
  padding: 9px 10px;
  background: rgba(230, 238, 224, 0.032);
}

.timeline-item.is-error {
  border-color: rgba(255, 120, 103, 0.28);
  background: rgba(255, 120, 103, 0.055);
}

.timeline-item b {
  color: var(--text);
  font-size: 12px;
}

.timeline-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.timeline-item small {
  color: var(--dim);
  font-size: 11px;
  white-space: nowrap;
}

.thumb {
  position: relative;
  min-height: 180px;
  border: 1px solid rgba(230, 238, 224, 0.12);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(237, 244, 232, 0.92);
}

.thumb img {
  width: 100%;
  height: 180px;
  object-fit: contain;
}

.thumb-row.single .thumb,
.thumb-row.single .thumb img {
  height: auto;
  min-height: 260px;
  max-height: 560px;
}

.is-image-error {
  position: relative;
  min-height: 180px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(123, 243, 220, 0.08), rgba(241, 177, 91, 0.05)),
    rgba(4, 9, 8, 0.72);
}

.is-image-error img[data-safe-image] {
  opacity: 0;
  visibility: hidden;
}

.is-image-error::after {
  content: attr(data-error-text);
  position: absolute;
  inset: 12px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(123, 243, 220, 0.28);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  font-weight: 850;
}

.viral-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.46fr) minmax(280px, 0.54fr);
  gap: 12px;
  align-items: stretch;
}

.viral-preview {
  position: relative;
  min-height: 260px;
  border: 1px solid rgba(123, 243, 220, 0.18);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(123, 243, 220, 0.08), rgba(241, 177, 91, 0.08)),
    rgba(4, 9, 8, 0.6);
}

.viral-preview.is-playable {
  cursor: pointer;
}

.viral-preview.is-playable:hover {
  border-color: rgba(123, 243, 220, 0.42);
  box-shadow: 0 0 0 1px rgba(123, 243, 220, 0.14), 0 18px 50px rgba(123, 243, 220, 0.08);
}

.viral-preview video,
.viral-preview img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 260px;
  object-fit: contain;
  background: #020504;
}

.viral-preview .pending {
  display: grid;
  min-height: 260px;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.viral-play-button {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 2;
  border: 1px solid rgba(123, 243, 220, 0.55);
  border-radius: 8px;
  padding: 10px 16px;
  color: #06100d;
  background: linear-gradient(135deg, var(--cyan), var(--leaf));
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 34px rgba(123, 243, 220, 0.22);
}

.viral-frame-preview {
  min-height: 260px;
  border: 1px solid rgba(230, 238, 224, 0.12);
  border-radius: 8px;
  overflow: auto;
  background: rgba(237, 244, 232, 0.92);
}

.viral-frame-preview img {
  display: block;
  width: 100%;
}

.viral-frame-preview img {
  height: auto;
  min-height: 260px;
  object-fit: contain;
}

.viral-frame-preview .pending {
  display: grid;
  min-height: 260px;
  place-items: center;
  color: #425047;
  font-size: 13px;
  font-weight: 800;
}

.frame-strip {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

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

.frame-thumb {
  position: relative;
  display: block;
  aspect-ratio: 9 / 16;
  border: 1px solid rgba(230, 238, 224, 0.12);
  border-radius: 8px;
  overflow: hidden;
  background: #020504;
}

.frame-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.frame-thumb span {
  position: absolute;
  left: 6px;
  bottom: 6px;
  border-radius: 7px;
  padding: 3px 6px;
  color: var(--text);
  background: rgba(4, 9, 8, 0.68);
  font-size: 11px;
  font-weight: 800;
}

.replaced-frame-strip {
  border-top: 1px solid rgba(230, 238, 224, 0.1);
  padding-top: 12px;
}

.replaced-storyboard {
  display: block;
  border: 1px solid rgba(123, 243, 220, 0.2);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(237, 244, 232, 0.92);
}

.replaced-storyboard img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
}

.replaced-reference-card {
  overflow: visible;
}

.replaced-storyboard-preview {
  display: block;
  width: 100%;
  border: 1px solid rgba(123, 243, 220, 0.2);
  border-radius: 8px;
  overflow: auto;
  background: rgba(237, 244, 232, 0.94);
}

.replaced-storyboard-preview img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.base-image-preview {
  max-height: none;
}

.skill-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.55fr) minmax(0, 1fr);
  gap: 12px;
}

.skill-select-panel {
  display: grid;
  grid-template-columns: minmax(160px, 0.32fr) minmax(180px, 0.36fr) minmax(180px, 0.32fr);
  gap: 10px;
  align-items: end;
}

.template-select-panel {
  grid-template-columns: minmax(190px, 0.9fr) minmax(190px, 1fr) minmax(190px, 1fr) minmax(190px, 0.9fr);
  align-items: stretch;
}

.formula-only-panel {
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 0.42fr);
  grid-template-areas:
    "track action"
    "guide guide"
    "formulas formulas";
  align-items: stretch;
}

.formula-guide {
  grid-area: guide;
  border: 1px solid rgba(241, 177, 91, 0.22);
  border-radius: 8px;
  padding: 10px 12px;
  background:
    linear-gradient(90deg, rgba(123, 243, 220, 0.07), rgba(241, 177, 91, 0.055)),
    rgba(230, 238, 224, 0.028);
}

.formula-guide span,
.formula-guide b,
.formula-guide small {
  display: block;
}

.formula-guide span {
  color: var(--amber);
  font-size: 11px;
  font-weight: 900;
}

.formula-guide b {
  margin-top: 4px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.3;
}

.formula-guide small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.formula-picker {
  grid-area: formulas;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  min-width: 0;
}

.formula-only-panel .auto-track-card {
  grid-area: track;
}

.formula-only-panel #applySkillButton {
  grid-area: action;
  align-self: stretch;
  min-height: 86px;
}

.formula-option {
  position: relative;
  isolation: isolate;
  min-height: 112px;
  border: 1px solid rgba(230, 238, 224, 0.16);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  text-align: left;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(230, 238, 224, 0.06), rgba(230, 238, 224, 0.025)),
    rgba(3, 7, 7, 0.48);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.formula-option::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.72;
  background: linear-gradient(112deg, transparent 0%, rgba(123, 243, 220, 0.14) 46%, transparent 72%);
  transform: translateX(-120%);
  transition: transform 220ms ease;
}

.formula-option:hover {
  transform: translateY(-1px);
  border-color: rgba(123, 243, 220, 0.36);
}

.formula-option:hover::before,
.formula-option.is-active::before {
  transform: translateX(120%);
}

.formula-option.is-active {
  border-color: rgba(123, 243, 220, 0.58);
  color: var(--text);
  background:
    linear-gradient(145deg, rgba(123, 243, 220, 0.11), rgba(241, 177, 91, 0.055)),
    rgba(3, 7, 7, 0.58);
  box-shadow: 0 0 0 1px rgba(123, 243, 220, 0.12), 0 10px 26px rgba(123, 243, 220, 0.08);
}

.formula-option span,
.formula-option b,
.formula-option small,
.formula-option i {
  position: relative;
  z-index: 1;
  display: block;
}

.formula-option span {
  color: var(--dim);
  font-size: 11px;
  font-weight: 900;
}

.formula-option b {
  margin-top: 7px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.25;
}

.formula-option.is-active b {
  color: var(--cyan);
}

.formula-option small {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.formula-option small em {
  border: 1px solid rgba(241, 177, 91, 0.24);
  border-radius: 999px;
  padding: 3px 6px;
  color: var(--amber);
  background: rgba(241, 177, 91, 0.06);
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}

.formula-option i {
  margin-top: 9px;
  color: var(--amber);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
  line-height: 1.35;
}

.auto-track-card {
  position: relative;
  min-height: 86px;
  border: 1px solid rgba(123, 243, 220, 0.24);
  border-radius: 8px;
  padding: 12px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(123, 243, 220, 0.12), rgba(241, 177, 91, 0.055)),
    rgba(230, 238, 224, 0.035);
}

.auto-track-card::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--amber), var(--leaf));
  box-shadow: 0 0 18px rgba(123, 243, 220, 0.28);
}

.auto-track-card span,
.auto-track-card b,
.auto-track-card small {
  position: relative;
  z-index: 1;
  display: block;
}

.auto-track-card span,
.template-preview-grid span {
  color: var(--dim);
  font-size: 11px;
  font-weight: 850;
}

.auto-track-card b {
  margin-top: 6px;
  color: var(--cyan);
  font-size: 22px;
  line-height: 1.1;
}

.auto-track-card small {
  margin-top: 8px;
  padding-bottom: 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.template-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.template-preview-grid article {
  position: relative;
  min-height: 128px;
  border: 1px solid rgba(123, 243, 220, 0.18);
  border-radius: 8px;
  padding: 12px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(123, 243, 220, 0.075), rgba(241, 177, 91, 0.045)),
    rgba(230, 238, 224, 0.032);
}

.template-preview-grid article::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(123, 243, 220, 0.12) 48%, transparent 74%);
  transform: translateX(-120%);
  animation: cardShine 4.6s ease-in-out infinite;
}

.template-preview-grid b,
.template-preview-grid p {
  position: relative;
  z-index: 1;
  display: block;
}

.template-preview-grid b {
  margin-top: 8px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}

.template-preview-grid p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.formula-mini-row {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.formula-mini-row i {
  border: 1px solid rgba(123, 243, 220, 0.22);
  border-radius: 999px;
  padding: 4px 7px;
  color: var(--cyan);
  background: rgba(123, 243, 220, 0.055);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
  line-height: 1;
}

.skill-detail {
  margin-top: 12px;
  border: 1px solid rgba(123, 243, 220, 0.22);
  border-radius: 8px;
  padding: 12px;
  background: rgba(123, 243, 220, 0.045);
}

.skill-detail b,
.skill-detail p {
  display: block;
}

.skill-detail b {
  color: var(--cyan);
  font-size: 13px;
}

.skill-detail p {
  margin: 7px 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.skill-core {
  border: 1px solid rgba(123, 243, 220, 0.26);
  border-radius: 8px;
  padding: 12px;
  background: rgba(123, 243, 220, 0.055);
}

.skill-core b {
  color: var(--cyan);
}

.skill-core p {
  margin: 9px 0 0;
  color: var(--text);
  line-height: 1.65;
  font-size: 13px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-row span {
  border: 1px solid rgba(230, 238, 224, 0.14);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--muted);
  background: rgba(230, 238, 224, 0.04);
  font-size: 12px;
}

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

.script-group-list {
  display: grid;
  gap: 12px;
}

.script-group {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(123, 243, 220, 0.16);
  border-radius: 8px;
  padding: 10px;
  background: rgba(4, 9, 8, 0.26);
}

.script-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(230, 238, 224, 0.1);
  padding-bottom: 8px;
}

.script-group-head b,
.script-group-head span,
.script-group-head small {
  display: block;
}

.script-group-head b {
  color: var(--text);
  font-size: 15px;
}

.script-group-head span,
.script-group-head small {
  color: var(--muted);
  font-size: 12px;
}

.script-group-head small {
  white-space: nowrap;
}

.storyboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.42fr);
  gap: 12px;
  align-items: start;
}

.combine-panel {
  position: sticky;
  top: 14px;
}

.combine-preview {
  width: 100%;
  border: 1px solid rgba(230, 238, 224, 0.12);
  border-radius: 8px;
  overflow: auto;
  background: rgba(255, 255, 255, 0.94);
}

.combine-preview img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.combine-wait {
  min-height: 320px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 1px solid rgba(230, 238, 224, 0.12);
  border-radius: 8px;
  padding: 22px;
  text-align: center;
  background: rgba(230, 238, 224, 0.035);
}

.combine-wait b,
.combine-wait span {
  display: block;
}

.combine-wait b {
  color: var(--text);
  font-size: 14px;
}

.combine-wait span {
  max-width: 260px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.shot-status-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.shot-status-board div {
  border: 1px solid rgba(230, 238, 224, 0.12);
  border-radius: 8px;
  padding: 10px;
  background: rgba(230, 238, 224, 0.035);
}

.shot-status-board div:nth-child(2) {
  border-color: rgba(241, 177, 91, 0.28);
  background: rgba(241, 177, 91, 0.055);
}

.shot-status-board .is-error {
  border-color: rgba(255, 120, 103, 0.32);
  background: rgba(255, 120, 103, 0.065);
}

.shot-status-board b,
.shot-status-board span {
  display: block;
}

.shot-status-board b {
  color: var(--dim);
  font-size: 11px;
}

.shot-status-board span {
  margin-top: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 780;
}

.confirm-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.28fr);
  gap: 14px;
  align-items: center;
  border-color: rgba(241, 177, 91, 0.28);
  background:
    linear-gradient(135deg, rgba(241, 177, 91, 0.09), rgba(123, 243, 220, 0.045)),
    rgba(4, 9, 8, 0.58);
}

.confirm-card.is-ready {
  border-color: rgba(123, 243, 220, 0.42);
  box-shadow: 0 0 34px rgba(123, 243, 220, 0.08);
}

.confirm-card h3,
.confirm-card p,
.confirm-card small {
  display: block;
}

.confirm-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}

.confirm-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.confirm-card small {
  margin-top: 8px;
  color: var(--amber);
  font-size: 12px;
  line-height: 1.5;
}

.shot {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(3, 7, 7, 0.58);
}

.shot-num {
  min-height: 88px;
  display: grid;
  align-content: center;
  justify-items: center;
  border: 1px solid rgba(241, 177, 91, 0.32);
  border-radius: 8px;
  color: var(--amber);
  background: rgba(241, 177, 91, 0.07);
}

.shot-num b {
  font-size: 28px;
  line-height: 1;
}

.shot-num span {
  color: var(--dim);
  font-size: 11px;
}

.shot-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1fr);
  gap: 8px;
}

.shot-editor:nth-child(3) {
  grid-column: 1 / -1;
}

.shot-editor {
  display: grid;
  gap: 6px;
}

.shot-editor span {
  color: var(--dim);
  font-size: 11px;
  font-weight: 850;
}

.shot-editor textarea {
  min-height: 82px;
  border-color: rgba(230, 238, 224, 0.14);
  background:
    linear-gradient(180deg, rgba(230, 238, 224, 0.035), rgba(230, 238, 224, 0.018)),
    rgba(4, 9, 8, 0.82);
  color: var(--text);
  font-size: 13px;
}

.shot-editor textarea[data-shot-field="camera"] {
  min-height: 62px;
  color: var(--muted);
}

.shot-copy {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
}

.shot-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
}

.mini {
  border: 1px solid rgba(230, 238, 224, 0.11);
  border-radius: 8px;
  padding: 8px;
  background: rgba(230, 238, 224, 0.032);
}

.mini b,
.mini span {
  display: block;
}

.mini b {
  margin-bottom: 5px;
  color: var(--dim);
  font-size: 11px;
}

.mini span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.52;
}

.prompt-box {
  border: 1px solid rgba(123, 243, 220, 0.23);
  border-radius: 8px;
  padding: 10px;
  background: rgba(123, 243, 220, 0.045);
}

.prompt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.prompt-head b {
  color: var(--cyan);
  font-size: 12px;
}

pre {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.62;
  white-space: pre-wrap;
  word-break: break-word;
}

.video-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.46fr) minmax(0, 1fr);
  gap: 12px;
}

.phone-frame {
  position: relative;
  aspect-ratio: 9 / 16;
  min-height: 540px;
  border: 1px solid rgba(230, 238, 224, 0.16);
  border-radius: 8px;
  overflow: hidden;
  background: #030707;
}

.phone-frame img,
.phone-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.phone-frame .pending {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 26px;
  text-align: center;
  color: var(--muted);
  background:
    linear-gradient(135deg, rgba(123, 243, 220, 0.16), rgba(241, 177, 91, 0.1)),
    #07100f;
}

.video-side {
  display: grid;
  align-content: start;
  gap: 10px;
}

.raw-box {
  max-height: 220px;
  overflow: auto;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(430px, calc(100vw - 40px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(5, 10, 9, 0.96);
  box-shadow: 0 20px 60px var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  transition: transform 160ms ease, opacity 160ms ease;
  pointer-events: none;
  z-index: 20;
}

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

@media (max-width: 1260px) {
  .topbar,
  .layout,
  .video-layout {
    grid-template-columns: 1fr;
  }

  .template-select-panel,
  .template-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .formula-only-panel {
    grid-template-columns: 1fr;
    grid-template-areas:
      "track"
      "guide"
      "formulas"
      "action";
  }

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

  .steps {
    order: 3;
  }

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

  .shot {
    grid-template-columns: 76px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  html {
    background-size: 30px 30px, 30px 30px, auto;
  }

  .studio {
    width: 100%;
    padding: 10px 10px 28px;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    min-height: 0;
    padding-bottom: 12px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand b {
    font-size: 16px;
  }

  .brand span {
    font-size: 11px;
  }

  .steps {
    display: flex;
    gap: 8px;
    order: 0;
    overflow-x: auto;
    padding: 2px 2px 8px;
    scrollbar-width: none;
  }

  .steps::-webkit-scrollbar,
  .tabs::-webkit-scrollbar {
    display: none;
  }

  .step {
    min-width: 112px;
    min-height: 48px;
    flex: 0 0 auto;
  }

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

  .server-mode,
  .ghost-button,
  .primary-button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 12px;
  }

  .panel {
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.36);
  }

  .panel-head {
    min-height: auto;
    padding: 14px;
  }

  .panel-head h1,
  .panel-head h2 {
    font-size: 21px;
  }

  .form {
    gap: 12px;
    padding: 14px;
  }

  input,
  select {
    height: 44px;
  }

  textarea {
    min-height: 118px;
  }

  .upload-grid,
  .select-grid,
  .metric-grid,
  .thumb-row,
  .idle-hero,
  .idle-flow,
  .idle-preview-grid,
  .skill-layout,
  .skill-select-panel,
  .formula-only-panel,
  .formula-picker,
  .template-preview-grid,
  .confirm-card,
  .storyboard-layout,
  .shot-status-board,
  .shot,
  .shot-meta,
  .timeline-item {
    grid-template-columns: 1fr;
  }

  .upload-box {
    min-height: 210px;
  }

  .upload-box.has-preview {
    min-height: 240px;
  }

  .formula-option {
    min-height: 104px;
  }

  .download-row {
    align-items: stretch;
  }

  .download-row .link-button,
  .download-row .copy-button,
  .download-row .video-download-button {
    width: 100%;
    justify-content: center;
  }

  .panel-head,
  .output-head {
    display: grid;
  }

  .tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .tab {
    min-width: 86px;
    flex: 0 0 auto;
  }

  .progress-shell {
    padding: 10px 14px;
  }

  .output-body {
    min-height: 560px;
    padding: 10px;
  }

  .idle-showcase {
    min-height: 560px;
    gap: 16px;
    padding: 18px;
  }

  .idle-copy b {
    font-size: 34px;
  }

  .idle-copy p {
    font-size: 12px;
  }

  .idle-status {
    min-height: 88px;
  }

  .idle-status strong {
    font-size: 28px;
  }

  .idle-route {
    height: 32px;
  }

  .idle-flow,
  .idle-preview-grid {
    gap: 8px;
  }

  .idle-step-card {
    min-height: 112px;
    padding: 12px;
  }

  .idle-preview-grid article {
    min-height: auto;
    padding: 12px;
  }

  .metric {
    min-height: auto;
  }

  .viral-layout {
    grid-template-columns: 1fr;
  }

  .viral-preview,
  .viral-preview video,
  .viral-preview img,
  .viral-preview .pending,
  .viral-frame-preview,
  .viral-frame-preview img,
  .viral-frame-preview .pending {
    min-height: 220px;
  }

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

  .thumb,
  .thumb img {
    min-height: 220px;
    height: 220px;
  }

  .combine-panel {
    position: static;
  }

  .combine-wait {
    min-height: 220px;
  }

  .shot {
    gap: 10px;
    padding: 10px;
  }

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

  .shot-editor:nth-child(3) {
    grid-column: auto;
  }

  .confirm-card .primary-button {
    min-height: 54px;
  }

  .shot-num {
    min-height: 64px;
    justify-items: start;
    padding: 10px;
  }

  .shot-num b {
    font-size: 24px;
  }

  .phone-frame {
    min-height: 0;
    width: min(100%, 360px);
    margin: 0 auto;
  }

  .toast {
    right: 10px;
    bottom: 10px;
    max-width: calc(100vw - 20px);
  }
}

@media (max-width: 420px) {
  .top-actions,
  .button-row {
    grid-template-columns: 1fr;
  }

  .upload-box {
    min-height: 190px;
  }

  .upload-box.has-preview {
    min-height: 220px;
  }

  .idle-copy b {
    font-size: 30px;
  }

}
