:root {
  color-scheme: light;
  --page: oklch(97% 0.018 230);
  --page-soft: oklch(94% 0.035 235);
  --surface: oklch(99% 0.008 235);
  --surface-raised: oklch(96% 0.018 235);
  --ink: oklch(22% 0.045 255);
  --text: oklch(31% 0.034 250);
  --muted: oklch(55% 0.034 245);
  --faint: oklch(67% 0.032 240);
  --line: oklch(88% 0.026 235);
  --line-strong: oklch(76% 0.062 235);
  --sky: oklch(65% 0.18 238);
  --sky-strong: oklch(55% 0.205 242);
  --sky-soft: oklch(92% 0.055 232);
  --indigo: oklch(47% 0.14 268);
  --success: oklch(62% 0.13 165);
  --amber: oklch(73% 0.15 78);
  --danger: oklch(64% 0.18 28);
  --shadow: 0 18px 50px oklch(45% 0.08 240 / 16%);
  --radius: 8px;
  --fast: 180ms cubic-bezier(0.22, 1, 0.36, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(90deg, oklch(75% 0.08 235 / 10%) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(0deg, oklch(75% 0.08 235 / 8%) 1px, transparent 1px) 0 0 / 34px 34px,
    radial-gradient(circle at 14% 0%, oklch(82% 0.11 226 / 36%), transparent 32rem),
    radial-gradient(circle at 86% 8%, oklch(87% 0.08 175 / 28%), transparent 30rem),
    var(--page);
}

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

button {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.app-shell {
  width: min(1760px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(560px, 1.6fr);
  align-items: center;
  gap: 28px;
  padding: 12px 14px 16px;
  border: 1px solid oklch(87% 0.04 235);
  border-radius: var(--radius);
  background: oklch(99% 0.01 235 / 86%);
  box-shadow: var(--shadow);
}

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

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid oklch(79% 0.09 235);
  border-radius: 8px;
  background:
    radial-gradient(circle at 35% 25%, oklch(98% 0.03 225), transparent 46%),
    linear-gradient(145deg, oklch(88% 0.09 230), oklch(66% 0.16 238));
  box-shadow: inset 0 0 0 7px oklch(100% 0 0 / 40%);
}

.brand-mark span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  color: oklch(32% 0.09 245);
  background: oklch(98% 0.018 230);
  font-size: 1.15rem;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--sky-strong);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
}

.brand h1 {
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1.2;
}

.brand p:last-child {
  max-width: 58ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.topbar-intro {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.case-library-entry,
.api-key-entry {
  display: inline-flex;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 7px;
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 880;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--fast), background var(--fast), box-shadow var(--fast), color var(--fast), transform var(--fast);
}

.case-library-entry {
  min-width: 110px;
  border: 1px solid oklch(72% 0.12 236);
  color: var(--sky-strong);
  background: linear-gradient(180deg, oklch(99% 0.018 235), oklch(94% 0.05 232));
  box-shadow:
    0 12px 26px oklch(55% 0.12 238 / 13%),
    inset 0 0 0 1px oklch(100% 0 0 / 52%);
}

.api-key-entry {
  min-width: 104px;
  border: 1px solid var(--sky-strong);
  color: oklch(98% 0.012 235);
  background: linear-gradient(100deg, var(--sky-strong), var(--sky));
  box-shadow: 0 12px 26px oklch(55% 0.16 238 / 22%);
}

.case-library-entry:hover,
.case-library-entry:focus-visible,
.api-key-entry:hover,
.api-key-entry:focus-visible {
  border-color: var(--sky-strong);
  color: oklch(97% 0.018 235);
  background: linear-gradient(100deg, var(--sky-strong), var(--sky));
  box-shadow: 0 16px 34px oklch(55% 0.16 238 / 22%);
  outline: none;
  transform: translateY(-1px);
}

.api-key-entry:hover,
.api-key-entry:focus-visible {
  filter: saturate(1.12) brightness(1.03);
}

.api-key-entry.is-complete {
  border-color: oklch(60% 0.13 165);
  background: linear-gradient(100deg, oklch(54% 0.13 170), oklch(68% 0.13 188));
}

.case-library-entry svg,
.api-key-entry svg {
  width: 16px;
  height: 16px;
}

.case-save-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid oklch(70% 0.14 236);
  border-radius: 999px;
  color: oklch(97% 0.016 235);
  background: linear-gradient(100deg, var(--sky-strong), var(--sky));
  padding: 0 18px;
  font-size: 0.82rem;
  font-weight: 880;
  cursor: pointer;
  box-shadow: 0 18px 40px oklch(50% 0.16 238 / 28%);
  transition: transform var(--fast), box-shadow var(--fast), filter var(--fast);
}

.case-save-fab:hover,
.case-save-fab:focus-visible {
  outline: none;
  transform: translateY(-2px);
  filter: saturate(1.08);
  box-shadow: 0 22px 48px oklch(50% 0.16 238 / 34%);
}

.case-save-fab.is-saved {
  border-color: oklch(66% 0.13 165);
  background: linear-gradient(100deg, var(--success), oklch(72% 0.13 185));
}

.case-save-fab.is-warning {
  border-color: oklch(75% 0.14 72);
  background: linear-gradient(100deg, var(--amber), oklch(72% 0.13 96));
  color: oklch(24% 0.045 80);
}

.case-save-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: oklch(20% 0.04 250 / 36%);
}

.case-save-auth-overlay[hidden] {
  display: none;
}

.case-save-auth-dialog {
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: hidden auto;
  border: 1px solid oklch(78% 0.06 235);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 68px oklch(25% 0.06 245 / 30%);
}

.case-save-auth-head {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: oklch(97% 0.024 232);
  padding: 16px 18px;
}

.case-save-auth-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid oklch(76% 0.08 234);
  border-radius: 7px;
  color: var(--sky-strong);
  background: var(--surface);
}

.case-save-auth-icon svg {
  width: 19px;
  height: 19px;
}

.case-save-auth-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.3;
}

.case-save-auth-form {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.case-save-auth-form label {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 840;
}

.case-save-auth-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid oklch(78% 0.045 235);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
  padding: 0 12px;
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--fast), box-shadow var(--fast);
}

.case-save-auth-form input:focus {
  border-color: var(--sky-strong);
  box-shadow: 0 0 0 3px oklch(62% 0.15 236 / 14%);
}

.case-save-auth-form input[readonly] {
  color: var(--muted);
  background: oklch(96% 0.012 230);
}

.case-save-auth-help {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
}

.case-save-auth-status {
  display: flex;
  min-height: 40px;
  align-items: center;
  margin: 2px 0 0;
  border: 1px solid oklch(84% 0.035 235);
  border-radius: 6px;
  color: var(--muted);
  background: oklch(97% 0.014 232);
  padding: 8px 10px;
  font-size: 0.76rem;
  font-weight: 720;
  line-height: 1.4;
}

.case-save-auth-status[data-state="loading"] {
  border-color: oklch(76% 0.09 236);
  color: var(--sky-strong);
  background: oklch(96% 0.026 235);
}

.case-save-auth-status[data-state="success"] {
  border-color: oklch(76% 0.09 165);
  color: oklch(43% 0.12 165);
  background: oklch(97% 0.024 165);
}

.case-save-auth-status[data-state="error"] {
  border-color: oklch(80% 0.08 28);
  color: var(--danger);
  background: oklch(97% 0.02 28);
}

.case-save-auth-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 4px;
}

.case-save-auth-actions button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 6px;
  padding: 0 13px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 840;
  cursor: pointer;
}

.case-save-auth-cancel {
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface);
}

.case-save-auth-cancel:hover,
.case-save-auth-cancel:focus-visible {
  border-color: var(--sky);
  color: var(--sky-strong);
  outline: none;
}

.case-save-auth-submit {
  border: 1px solid var(--sky-strong);
  color: oklch(98% 0.01 235);
  background: var(--sky-strong);
}

.case-save-auth-submit:hover,
.case-save-auth-submit:focus-visible {
  filter: brightness(1.06);
  outline: none;
}

.case-save-auth-submit:disabled {
  cursor: wait;
  opacity: 0.72;
}

.case-save-auth-submit.is-loading svg {
  animation: case-save-auth-spin 0.85s linear infinite;
}

@keyframes case-save-auth-spin {
  to {
    transform: rotate(360deg);
  }
}

.case-library-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 22px;
  background: oklch(20% 0.04 250 / 28%);
  backdrop-filter: blur(3px);
}

.case-library-overlay[hidden] {
  display: none;
}

.case-library-drawer {
  display: grid;
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 22px);
  margin: 0;
  overflow: hidden;
  border: 1px solid oklch(82% 0.048 235);
  border-radius: 8px;
  background: oklch(99% 0.01 235);
  box-shadow: 0 28px 80px oklch(32% 0.08 245 / 28%);
}

.case-library-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, oklch(72% 0.08 236 / 10%) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(180deg, oklch(99% 0.018 235), oklch(95% 0.04 232));
  padding: 18px;
}

.case-library-head h2 {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 1.22rem;
  line-height: 1.25;
}

.case-library-head p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.case-library-close {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
}

.case-library-close:hover,
.case-library-close:focus-visible {
  border-color: var(--sky);
  color: var(--sky-strong);
  outline: none;
}

.case-library-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 12px 18px;
}

.case-library-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.case-library-actions p[data-state="loading"] {
  color: var(--sky-strong);
}

.case-library-actions p[data-state="success"] {
  color: oklch(43% 0.11 165);
}

.case-library-actions p[data-state="error"] {
  color: var(--danger);
}

.case-demo-button,
.case-card button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid oklch(74% 0.1 236);
  border-radius: 6px;
  color: var(--sky-strong);
  background: oklch(97% 0.025 235);
  padding: 0 11px;
  font-size: 0.74rem;
  font-weight: 820;
  cursor: pointer;
}

.case-demo-button:hover,
.case-demo-button:focus-visible,
.case-card button:hover,
.case-card button:focus-visible {
  border-color: var(--sky-strong);
  color: oklch(97% 0.016 235);
  background: var(--sky-strong);
  outline: none;
}

.case-library-body {
  min-height: 280px;
  max-height: min(68vh, 680px);
  overflow: auto;
  padding: 16px 18px 18px;
}

.case-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: start;
  gap: 14px;
}

.case-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  border: 1px solid oklch(84% 0.04 235);
  border-radius: 8px;
  background: oklch(99% 0.008 235);
  padding: 12px;
}

.case-card-cover {
  position: relative;
  display: grid;
  width: min(100%, 220px);
  min-height: 300px;
  aspect-ratio: 9 / 16;
  justify-self: center;
  overflow: hidden;
  border: 1px solid oklch(82% 0.048 235);
  border-radius: 7px;
  background: var(--sky-soft);
}

.case-card-cover::after {
  content: attr(data-preview-type);
  position: absolute;
  right: 8px;
  bottom: 8px;
  border: 1px solid oklch(100% 0 0 / 56%);
  border-radius: 999px;
  color: oklch(99% 0.006 235);
  background: oklch(20% 0.035 245 / 62%);
  padding: 3px 8px;
  font-size: 0.66rem;
  font-weight: 820;
  backdrop-filter: blur(4px);
}

.case-card-cover img,
.case-card-cover video {
  width: 100%;
  height: 100%;
  min-height: 300px;
  object-fit: cover;
}

.case-card-cover span {
  display: grid;
  place-items: center;
  color: var(--sky-strong);
  font-size: 0.75rem;
  font-weight: 850;
  text-align: center;
}

.case-card-main {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.case-card-title {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.case-card-title h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.3;
}

.case-card-title span {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 0.68rem;
  font-weight: 780;
}

.case-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
}

.case-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.case-card-meta span {
  border: 1px solid oklch(82% 0.045 235);
  border-radius: 999px;
  color: oklch(42% 0.06 245);
  background: oklch(96% 0.02 235);
  padding: 2px 7px;
  font-size: 0.66rem;
  font-weight: 780;
}

.case-card[data-source="public"] .case-card-meta span:first-child {
  border-color: oklch(76% 0.08 165);
  color: oklch(42% 0.11 165);
  background: oklch(96% 0.025 165);
}

.case-card[data-source="local"] .case-card-meta span:first-child {
  color: oklch(48% 0.045 250);
  background: oklch(95% 0.012 245);
}

.case-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}

.case-card button.case-delete-button {
  border-color: oklch(82% 0.05 28);
  color: var(--danger);
  background: oklch(97% 0.018 28);
}

.case-empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed oklch(78% 0.06 235);
  border-radius: 8px;
  background: oklch(97% 0.02 235);
  padding: 22px;
  text-align: center;
}

.case-empty-state[hidden] {
  display: none;
}

.case-empty-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 999px;
  color: var(--sky-strong);
  background: var(--sky-soft);
}

.case-empty-state h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
}

.case-empty-state p {
  max-width: 34ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.api-key-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 22px;
  background: oklch(20% 0.04 250 / 32%);
  backdrop-filter: blur(3px);
}

.api-key-overlay[hidden] {
  display: none;
}

.api-key-dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: hidden auto;
  border: 1px solid oklch(80% 0.055 235);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 28px 80px oklch(32% 0.08 245 / 30%);
}

.api-key-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, oklch(72% 0.08 236 / 10%) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(180deg, oklch(99% 0.018 235), oklch(95% 0.04 232));
  padding: 17px 18px;
}

.api-key-head h2 {
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 1.18rem;
  line-height: 1.25;
}

.api-key-head p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.api-key-close {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface);
  padding: 0;
  cursor: pointer;
}

.api-key-close:hover,
.api-key-close:focus-visible {
  border-color: var(--sky);
  color: var(--sky-strong);
  background: var(--sky-soft);
  outline: none;
}

.api-key-close svg {
  width: 17px;
  height: 17px;
}

.api-key-form {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.device-code-field {
  gap: 7px;
  border-left: 3px solid var(--sky);
  border-radius: 6px;
  background: oklch(96% 0.035 233);
  padding: 10px 12px;
}

.device-code-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.device-code-label span {
  flex: 0 0 auto;
  color: var(--sky-strong);
  font-size: 0.68rem;
  font-weight: 860;
  line-height: 1.2;
}

.device-code-field input {
  background: var(--surface);
}

.device-code-field small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.api-key-status {
  min-height: 18px;
  margin: 0;
  color: var(--sky-strong);
  font-size: 0.74rem;
  font-weight: 760;
  line-height: 1.45;
}

.api-key-status[data-state="success"] {
  color: oklch(48% 0.13 165);
}

.api-key-status[data-state="error"] {
  color: var(--danger);
}

.api-key-save {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--sky-strong);
  border-radius: 7px;
  color: oklch(98% 0.012 235);
  background: linear-gradient(100deg, var(--sky-strong), var(--sky));
  padding: 0 16px;
  font-size: 0.82rem;
  font-weight: 860;
  cursor: pointer;
  box-shadow: 0 12px 24px oklch(55% 0.16 238 / 18%);
  transition: filter var(--fast), box-shadow var(--fast), transform var(--fast);
}

.api-key-save:hover,
.api-key-save:focus-visible {
  outline: none;
  filter: saturate(1.1);
  box-shadow: 0 16px 30px oklch(55% 0.16 238 / 25%);
  transform: translateY(-1px);
}

.api-key-save svg {
  width: 16px;
  height: 16px;
}

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

.step-tab {
  display: flex;
  min-height: 52px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: oklch(98% 0.01 235);
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color var(--fast), background var(--fast), transform var(--fast), box-shadow var(--fast);
}

.step-tab:hover,
.step-tab:focus-visible {
  border-color: var(--line-strong);
  box-shadow: 0 10px 24px oklch(55% 0.12 238 / 12%);
  outline: none;
  transform: translateY(-1px);
}

.step-tab strong {
  color: var(--faint);
  font-size: 0.72rem;
  font-weight: 850;
}

.step-tab span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

.step-tab.active {
  border-color: oklch(70% 0.12 236);
  background: var(--sky-soft);
}

.step-tab.active strong,
.step-tab.active span {
  color: var(--sky-strong);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(380px, 420px) minmax(0, 1fr);
  gap: 16px;
  padding-top: 16px;
}

.input-panel,
.result-panel {
  overflow: hidden;
  border: 1px solid oklch(86% 0.035 235);
  border-radius: var(--radius);
  background: oklch(99% 0.008 235 / 94%);
  box-shadow: var(--shadow);
}

.panel-head,
.result-head,
.endpoint-map {
  padding: 18px;
}

.panel-head,
.result-head {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, oklch(98% 0.018 235), oklch(99% 0.006 235));
}

.panel-head h2,
.result-head h2,
.endpoint-map h2 {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 1.42rem;
  line-height: 1.2;
}

.panel-head p:last-child,
.result-head p,
.endpoint-map p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.65;
}

.campaign-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

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

.voice-source-field {
  min-width: 0;
}

.voice-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: oklch(95% 0.025 235);
  padding: 4px;
}

.voice-mode-button {
  display: inline-flex;
  min-width: 0;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  padding: 0 9px;
  font-size: 0.74rem;
  font-weight: 820;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--fast), background var(--fast), box-shadow var(--fast), color var(--fast);
}

.voice-mode-button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.voice-mode-button:hover,
.voice-mode-button:focus-visible {
  color: var(--sky-strong);
  background: oklch(98% 0.018 235);
  outline: none;
}

.voice-mode-button.is-active,
.voice-mode-button.active,
.voice-mode-button[aria-pressed="true"] {
  border-color: oklch(78% 0.08 236);
  color: var(--sky-strong);
  background: var(--surface);
  box-shadow: 0 5px 12px oklch(55% 0.12 238 / 11%);
}

.voice-source-panel {
  min-width: 0;
}

.voice-clone-panel {
  display: grid;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: oklch(98% 0.015 235);
  padding: 12px;
}

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

.voice-clone-tip {
  margin: 0;
  border-left: 3px solid var(--sky);
  color: var(--muted);
  background: var(--sky-soft);
  padding: 8px 10px;
  font-size: 0.74rem;
  line-height: 1.5;
}

.clone-voice-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid oklch(72% 0.11 236);
  border-radius: 7px;
  color: var(--sky-strong);
  background: oklch(96% 0.03 235);
  padding: 0 13px;
  font-size: 0.78rem;
  font-weight: 840;
  cursor: pointer;
  transition: border-color var(--fast), background var(--fast), color var(--fast), transform var(--fast);
}

.clone-voice-button:hover,
.clone-voice-button:focus-visible {
  border-color: var(--sky-strong);
  color: oklch(98% 0.012 235);
  background: var(--sky-strong);
  outline: none;
  transform: translateY(-1px);
}

.clone-voice-button svg {
  width: 15px;
  height: 15px;
}

.clone-voice-button:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
}

.voice-clone-status {
  min-height: 17px;
  margin: -2px 0 0;
  color: var(--sky-strong);
  font-size: 0.72rem;
  font-weight: 740;
  line-height: 1.45;
}

.voice-clone-status[data-state="success"] {
  color: oklch(48% 0.13 165);
}

.voice-clone-status[data-state="error"] {
  color: var(--danger);
}

.voice-clone-status[data-state="loading"] {
  color: var(--sky-strong);
}

.voice-preset-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  max-height: 246px;
  overflow: hidden auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background:
    linear-gradient(90deg, oklch(72% 0.08 236 / 8%) 1px, transparent 1px) 0 0 / 22px 22px,
    oklch(98% 0.016 235);
  padding: 7px;
}

.voice-preset-list > span {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-group {
  display: grid;
  grid-column: 1 / -1;
  min-width: 0;
  gap: 4px;
}

.voice-group + .voice-group {
  margin-top: 2px;
}

.voice-group-head {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1.3;
}

.voice-group-head small,
.voice-group-head span:last-child {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-grid {
  display: flex;
  min-width: 0;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.voice-grid::-webkit-scrollbar {
  display: none;
}

/* The input panel becomes full-width in this range, so keep both voice groups
   on one compact row instead of leaving half of the panel empty. */
@media (min-width: 721px) and (max-width: 1240px) {
  .voice-preset-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    max-height: none;
    overflow: visible;
  }

  .voice-group {
    grid-column: auto;
  }

  .voice-group + .voice-group {
    margin-top: 0;
  }

  .voice-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 64px));
    overflow: visible;
  }
}

.voice-option {
  position: relative;
  display: grid;
  min-width: 0;
  width: 64px;
  min-width: 64px;
  min-height: 64px;
  aspect-ratio: 1 / 1;
  align-content: space-between;
  gap: 2px;
  overflow: hidden;
  border: 1px solid oklch(84% 0.035 235);
  border-radius: 6px;
  color: var(--text);
  background: oklch(99% 0.008 235);
  padding: 6px;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--fast), background var(--fast), box-shadow var(--fast), transform var(--fast);
}

.voice-option:not(:has(.voice-preview-button))::before {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  border: 1px solid oklch(77% 0.08 236);
  border-radius: 999px;
  background: oklch(98% 0.018 235 / 92%);
}

.voice-option:not(:has(.voice-preview-button))::after {
  content: "";
  position: absolute;
  top: 11px;
  right: 11px;
  width: 0;
  height: 0;
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
  border-left: 5px solid var(--sky-strong);
}

.voice-option:hover,
.voice-option:focus-visible {
  border-color: var(--sky);
  background: oklch(98% 0.02 235);
  box-shadow: 0 8px 18px oklch(55% 0.12 238 / 10%);
  outline: none;
  transform: translateY(-1px);
}

.voice-option[aria-selected="true"] {
  border-color: var(--sky-strong);
  background: var(--sky-soft);
  box-shadow:
    inset 0 0 0 2px oklch(60% 0.16 238 / 32%),
    0 10px 24px oklch(55% 0.12 238 / 14%);
}

.voice-option[aria-selected="true"]:not(:has(.voice-preview-button))::before {
  border-color: var(--sky-strong);
  background: var(--sky-strong);
}

.voice-option[aria-selected="true"]:not(:has(.voice-preview-button))::after {
  border-left-color: oklch(98% 0.015 235);
}

.voice-option-top {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 2px;
  padding-right: 16px;
}

.voice-option-top strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.64rem;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-option-top small {
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid oklch(80% 0.05 235);
  border-radius: 999px;
  color: var(--sky-strong);
  background: oklch(97% 0.018 235 / 86%);
  padding: 1px 3px;
  font-size: 0.48rem;
  font-weight: 780;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-option-copy {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.6rem;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.voice-option-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-height: 17px;
  min-width: 0;
  overflow: hidden;
}

.voice-option-tags span {
  border: 1px solid oklch(80% 0.05 235);
  border-radius: 999px;
  color: oklch(40% 0.055 245);
  background: oklch(97% 0.018 235);
  padding: 1px 4px;
  font-size: 0.52rem;
  font-weight: 760;
  line-height: 1.25;
}

.voice-option svg,
.voice-option i,
.voice-option [data-lucide="play"],
.voice-option-play {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}

.voice-preview-button {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 1;
  display: inline-grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border: 1px solid oklch(77% 0.08 236);
  border-radius: 999px;
  color: var(--sky-strong);
  background: oklch(98% 0.018 235 / 94%);
  padding: 0;
  cursor: pointer;
  transition: border-color var(--fast), background var(--fast), color var(--fast), transform var(--fast);
}

.voice-preview-button::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 2px;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  border-left: 4.5px solid currentColor;
}

.voice-preview-button.is-playing::before {
  width: 7px;
  height: 8px;
  margin-left: 0;
  border-width: 0 2px;
  border-style: solid;
  border-color: currentColor;
}

.voice-preview-button:hover,
.voice-preview-button:focus-visible,
.voice-preview-button.is-playing {
  border-color: var(--sky-strong);
  color: oklch(98% 0.015 235);
  background: var(--sky-strong);
  outline: none;
}

.voice-preview-button:hover,
.voice-preview-button:focus-visible {
  transform: scale(1.04);
}

.voice-preview-button svg,
.voice-preview-button i {
  width: 10px;
  height: 10px;
}

.voice-option-id {
  display: none;
}

label {
  color: oklch(34% 0.05 250);
  font-size: 0.82rem;
  font-weight: 780;
}

input[type="text"],
input[type="password"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
  padding: 12px 13px;
  outline: none;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}

input[readonly] {
  color: var(--sky-strong);
  background: oklch(97% 0.028 235);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

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

textarea {
  min-height: 98px;
  resize: vertical;
  line-height: 1.55;
}

input::placeholder,
textarea::placeholder {
  color: var(--faint);
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: var(--sky);
  background: oklch(99% 0.012 235);
  box-shadow: 0 0 0 3px oklch(72% 0.12 238 / 18%);
}

.range-field,
.storyboard-count-field {
  display: grid;
  min-width: 0;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: oklch(98% 0.014 235);
  padding: 12px;
}

.upload-grid > .storyboard-count-field,
.upload-grid > .range-field:has(#storyboard-count) {
  grid-column: 1 / -1;
}

.range-label {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.range-field label,
.storyboard-count-field label {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.range-field small,
.storyboard-count-field small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.range-field output,
.storyboard-count-field output,
.range-field .range-value,
.storyboard-count-field .range-value,
.storyboard-count-field .storyboard-count-value,
#storyboard-count-value {
  display: inline-flex;
  min-width: 34px;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  border: 1px solid oklch(78% 0.07 236);
  border-radius: 999px;
  color: var(--sky-strong);
  background: oklch(96% 0.03 232);
  padding: 0 8px;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.range-field input[type="range"],
.storyboard-count-field input[type="range"],
input#storyboard-count {
  width: 100%;
  min-width: 0;
  height: 24px;
  margin: 0;
  accent-color: var(--sky-strong);
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.range-field input[type="range"]::-webkit-slider-runnable-track,
.storyboard-count-field input[type="range"]::-webkit-slider-runnable-track,
input#storyboard-count::-webkit-slider-runnable-track {
  height: 8px;
  border: 1px solid oklch(82% 0.04 235);
  border-radius: 999px;
  background: linear-gradient(90deg, oklch(91% 0.055 232), oklch(98% 0.016 235));
}

.range-field input[type="range"]::-moz-range-track,
.storyboard-count-field input[type="range"]::-moz-range-track,
input#storyboard-count::-moz-range-track {
  height: 8px;
  border: 1px solid oklch(82% 0.04 235);
  border-radius: 999px;
  background: linear-gradient(90deg, oklch(91% 0.055 232), oklch(98% 0.016 235));
}

.range-field input[type="range"]::-webkit-slider-thumb,
.storyboard-count-field input[type="range"]::-webkit-slider-thumb,
input#storyboard-count::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 2px solid oklch(99% 0.01 235);
  border-radius: 999px;
  background: var(--sky-strong);
  box-shadow: 0 3px 8px oklch(55% 0.12 238 / 22%);
  appearance: none;
}

.range-field input[type="range"]::-moz-range-thumb,
.storyboard-count-field input[type="range"]::-moz-range-thumb,
input#storyboard-count::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid oklch(99% 0.01 235);
  border-radius: 999px;
  background: var(--sky-strong);
  box-shadow: 0 3px 8px oklch(55% 0.12 238 / 22%);
}

.range-field input[type="range"]:focus-visible,
.storyboard-count-field input[type="range"]:focus-visible,
input#storyboard-count:focus-visible {
  outline: none;
}

.range-field input[type="range"]:focus-visible::-webkit-slider-thumb,
.storyboard-count-field input[type="range"]:focus-visible::-webkit-slider-thumb,
input#storyboard-count:focus-visible::-webkit-slider-thumb {
  box-shadow:
    0 0 0 4px oklch(72% 0.12 238 / 18%),
    0 3px 8px oklch(55% 0.12 238 / 22%);
}

.range-field input[type="range"]:focus-visible::-moz-range-thumb,
.storyboard-count-field input[type="range"]:focus-visible::-moz-range-thumb,
input#storyboard-count:focus-visible::-moz-range-thumb {
  box-shadow:
    0 0 0 4px oklch(72% 0.12 238 / 18%),
    0 3px 8px oklch(55% 0.12 238 / 22%);
}

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

.upload-grid {
  align-items: start;
}

.file-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

#voice-sample {
  position: static;
  width: 100%;
  height: auto;
  overflow: visible;
  border: 1px dashed oklch(76% 0.075 236);
  border-radius: 7px;
  clip: auto;
  color: var(--muted);
  background: var(--surface);
  padding: 6px;
  font-size: 0.72rem;
  white-space: normal;
  cursor: pointer;
}

#voice-sample::file-selector-button {
  min-height: 31px;
  margin-right: 9px;
  border: 1px solid oklch(76% 0.08 236);
  border-radius: 5px;
  color: var(--sky-strong);
  background: var(--sky-soft);
  padding: 0 10px;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

#voice-sample:hover,
#voice-sample:focus-visible {
  border-color: var(--sky);
  outline: none;
  box-shadow: 0 0 0 3px oklch(72% 0.12 238 / 14%);
}

.file-button,
.secondary-action,
.view-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid oklch(78% 0.07 236);
  border-radius: 7px;
  color: var(--sky-strong);
  background: oklch(98% 0.018 235);
  padding: 0 13px;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--fast), background var(--fast), border-color var(--fast), box-shadow var(--fast);
}

.file-button:hover,
.secondary-action:hover,
.view-button:hover,
.file-button:focus-visible,
.secondary-action:focus-visible,
.view-button:focus-visible {
  border-color: var(--sky);
  background: var(--sky-soft);
  box-shadow: 0 10px 24px oklch(55% 0.12 238 / 12%);
  outline: none;
  transform: translateY(-1px);
}

.view-button.active {
  border-color: var(--sky);
  color: oklch(97% 0.018 235);
  background: var(--sky-strong);
}

.file-name {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone {
  position: relative;
  min-height: 180px;
  border: 1px dashed oklch(74% 0.08 236);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, oklch(72% 0.08 236 / 12%) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(0deg, oklch(72% 0.08 236 / 10%) 1px, transparent 1px) 0 0 / 24px 24px,
    oklch(98% 0.016 235);
  transition: border-color var(--fast), background var(--fast);
}

.dropzone.is-dragging {
  border-color: var(--sky-strong);
  background-color: var(--sky-soft);
}

.dropzone label {
  display: grid;
  min-height: 178px;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
}

.dropzone label > svg {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid oklch(78% 0.07 236);
  border-radius: 7px;
  color: var(--sky-strong);
  background: var(--sky-soft);
}

.dropzone strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.dropzone small {
  max-width: 16rem;
  color: var(--sky-strong);
  font-size: 0.74rem;
  line-height: 1.45;
}

.preview-strip {
  display: none;
  grid-template-columns: repeat(auto-fit, minmax(min(92px, 100%), 1fr));
  gap: 8px;
  padding: 0 10px 10px;
}

.preview-strip.has-preview {
  display: grid;
}

#product-drop:has(.preview-strip.has-preview),
#model-drop:has(.preview-strip.has-preview) {
  min-height: 0;
  border-style: solid;
  background: oklch(99% 0.008 235);
}

#product-drop:has(.preview-strip.has-preview) label,
#model-drop:has(.preview-strip.has-preview) label {
  display: none;
}

.dropzone:has(.preview-strip.has-preview) label {
  min-height: auto;
  grid-template-columns: auto minmax(0, 1fr);
  place-items: center start;
  gap: 4px 10px;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
}

.dropzone:has(.preview-strip.has-preview) label > svg {
  grid-row: 1 / span 2;
  width: 28px;
  height: 28px;
}

.dropzone:has(.preview-strip.has-preview) label strong,
.dropzone:has(.preview-strip.has-preview) label small {
  justify-self: start;
}

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

#product-drop .preview-strip {
  width: min(100%, 344px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  justify-content: start;
  padding: 10px;
}

#product-drop .preview-strip.single {
  width: min(100%, 124px);
  grid-template-columns: minmax(0, 104px);
}

#model-drop .preview-strip,
#model-drop .preview-strip.single {
  width: min(100%, 168px);
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  justify-content: start;
  padding: 10px;
}

#product-drop .preview-card figcaption,
#product-drop .preview-caption,
#model-drop .preview-card figcaption,
#model-drop .preview-caption {
  display: none;
}

.preview-card {
  display: grid;
  min-width: 0;
  overflow: hidden;
  margin: 0;
  border: 1px solid oklch(79% 0.05 235);
  border-radius: 8px;
  background: oklch(99% 0.008 235);
  box-shadow: 0 10px 24px oklch(55% 0.12 238 / 10%);
  cursor: zoom-in;
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast);
}

.preview-card:hover,
.preview-card:focus-visible,
.result-image-card:hover,
.result-image-card:focus-visible {
  border-color: var(--sky);
  box-shadow: 0 12px 26px oklch(55% 0.12 238 / 16%);
  outline: none;
  transform: translateY(-1px);
}

.preview-card img,
.preview-strip > img {
  display: block;
  width: 100%;
  min-height: 0;
  aspect-ratio: 4 / 3;
  background: oklch(98% 0.016 235);
  cursor: zoom-in;
  object-fit: cover;
}

#product-drop .preview-card img,
#product-drop .preview-strip > img {
  aspect-ratio: 1 / 1;
}

#model-drop .preview-card img,
#model-drop .preview-strip > img {
  aspect-ratio: 4 / 5;
  max-height: 184px;
}

.preview-strip > img {
  border: 1px solid oklch(79% 0.05 235);
  border-radius: 8px;
  box-shadow: 0 10px 24px oklch(55% 0.12 238 / 10%);
}

.preview-strip.single .preview-card img,
.preview-strip.single > img {
  min-height: 0;
  max-height: 225px;
  aspect-ratio: 4 / 5;
}

#product-drop .preview-strip.single .preview-card img,
#product-drop .preview-strip.single > img {
  max-height: none;
  aspect-ratio: 1 / 1;
}

.primary-action {
  display: inline-flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 7px;
  color: oklch(98% 0.015 235);
  background: linear-gradient(100deg, var(--sky-strong), var(--sky), oklch(61% 0.16 214));
  font-weight: 880;
  cursor: pointer;
  transition: transform var(--fast), filter var(--fast), box-shadow var(--fast);
  box-shadow: 0 16px 34px oklch(55% 0.16 238 / 24%);
}

.primary-action:hover,
.primary-action:focus-visible {
  outline: none;
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.primary-action.is-running {
  cursor: wait;
  filter: saturate(0.9);
}

.primary-action.is-running svg {
  animation: spin 1s linear infinite;
}

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

.plain-tip {
  border: 1px solid oklch(82% 0.06 220);
  border-radius: 7px;
  color: oklch(42% 0.052 250);
  background: oklch(96% 0.025 225);
  padding: 12px 13px;
  font-size: 0.8rem;
  line-height: 1.65;
}

.plain-tip strong {
  color: var(--sky-strong);
}

.result-panel {
  min-width: 0;
}

.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.progress-block {
  position: relative;
  overflow: hidden;
  margin: 0 0 2px;
  padding: 20px 18px 18px;
  border-top: 1px solid oklch(91% 0.035 235);
  border-bottom: 1px solid oklch(91% 0.035 235);
  background:
    linear-gradient(90deg, oklch(72% 0.12 238 / 7%) 1px, transparent 1px) 0 0 / 18px 18px,
    linear-gradient(0deg, oklch(72% 0.12 238 / 6%) 1px, transparent 1px) 0 0 / 18px 18px,
    radial-gradient(circle at 92% 20%, oklch(74% 0.18 238 / 22%), transparent 16rem),
    linear-gradient(180deg, oklch(99% 0.012 235), oklch(96% 0.028 235));
}

.progress-block::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 0 34%, oklch(100% 0 0 / 42%) 46%, transparent 58% 100%);
  opacity: 0;
  transform: translateX(-42%);
  pointer-events: none;
}

:where(html, body).is-processing .progress-block::before {
  opacity: 1;
  animation: progress-panel-scan 1.8s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

.api-status {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 0 18px 14px;
  border: 1px solid oklch(82% 0.06 235);
  border-radius: var(--radius);
  background: oklch(98% 0.016 235);
  padding: 14px 16px;
}

.api-status h3 {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.25;
}

.api-status p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.api-status > span {
  flex: 0 0 auto;
  border: 1px solid oklch(79% 0.07 235);
  border-radius: 999px;
  color: var(--sky-strong);
  background: oklch(96% 0.03 232);
  padding: 5px 9px;
  font-size: 0.72rem;
  font-weight: 830;
  white-space: nowrap;
}

.api-status[data-state="loading"] {
  border-color: oklch(70% 0.14 236);
  background: var(--sky-soft);
}

.api-status[data-state="success"] {
  border-color: oklch(72% 0.12 165);
  background: oklch(95% 0.035 165);
}

.api-status[data-state="error"] {
  border-color: oklch(72% 0.14 28);
  background: oklch(96% 0.03 28);
}

.status-line {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.status-line strong {
  color: var(--ink);
  font-size: 1rem;
}

.status-line span {
  position: relative;
  display: inline-flex;
  min-width: 92px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid oklch(70% 0.14 236);
  border-radius: 999px;
  color: oklch(42% 0.16 244);
  background:
    radial-gradient(circle at 28% 20%, oklch(100% 0 0 / 76%), transparent 36%),
    linear-gradient(135deg, oklch(99% 0.02 226), oklch(88% 0.09 235));
  padding: 0 16px;
  font-size: 1.72rem;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  box-shadow:
    inset 0 0 0 1px oklch(100% 0 0 / 62%),
    0 12px 30px oklch(54% 0.15 238 / 22%);
}

.status-line span::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid oklch(74% 0.12 236 / 54%);
  border-radius: inherit;
  pointer-events: none;
}

.status-line span::after {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: -58%;
  width: 44%;
  background: linear-gradient(90deg, transparent, oklch(100% 0 0 / 82%), transparent);
  transform: skewX(-16deg);
  pointer-events: none;
}

:where(html, body).is-processing .status-line span {
  color: oklch(98% 0.018 235);
  background:
    linear-gradient(135deg, oklch(47% 0.2 244), oklch(66% 0.18 224), oklch(67% 0.14 170));
  text-shadow: 0 0 14px oklch(96% 0.06 220 / 62%);
  box-shadow:
    inset 0 0 0 1px oklch(100% 0 0 / 42%),
    0 0 0 4px oklch(66% 0.16 238 / 16%),
    0 18px 42px oklch(52% 0.18 238 / 34%);
  animation: percent-meter-glow 1.25s ease-in-out infinite;
}

:where(html, body).is-processing .status-line span::after {
  animation: percent-meter-scan 1.15s ease-in-out infinite;
}

.progress-track {
  position: relative;
  z-index: 1;
  height: 16px;
  overflow: hidden;
  border: 1px solid oklch(76% 0.08 235);
  border-radius: 999px;
  background:
    linear-gradient(90deg, oklch(70% 0.13 238 / 11%) 1px, transparent 1px) 0 0 / 18px 100%,
    linear-gradient(180deg, oklch(99% 0.01 235 / 64%), transparent),
    oklch(94% 0.018 235);
  box-shadow:
    inset 0 2px 6px oklch(44% 0.08 245 / 14%),
    0 0 0 1px oklch(100% 0 0 / 50%);
}

.progress-fill {
  position: relative;
  overflow: hidden;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sky-strong), var(--sky), var(--success));
  transition: width 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

:where(html, body).is-processing .progress-track {
  border-color: oklch(68% 0.13 236);
  background:
    linear-gradient(90deg, oklch(100% 0 0 / 18%) 1px, transparent 1px) 0 0 / 22px 100%,
    repeating-linear-gradient(
      -45deg,
      oklch(90% 0.055 232) 0 9px,
      oklch(96% 0.034 235) 9px 18px
    );
  box-shadow:
    inset 0 0 0 1px oklch(100% 0 0 / 46%),
    inset 0 2px 8px oklch(36% 0.1 245 / 18%),
    0 0 0 3px oklch(68% 0.14 236 / 14%),
    0 0 28px oklch(58% 0.18 238 / 24%);
}

:where(html, body).is-processing .progress-fill {
  min-width: 7%;
  background:
    linear-gradient(
      90deg,
      var(--sky-strong) 0%,
      var(--sky) 24%,
      oklch(99% 0.018 220) 38%,
      var(--success) 54%,
      var(--sky) 74%,
      var(--sky-strong) 100%
    );
  background-size: 240% 100%;
  box-shadow:
    inset 0 0 0 1px oklch(100% 0 0 / 34%),
    0 0 18px oklch(62% 0.16 238 / 46%),
    0 0 34px oklch(70% 0.16 188 / 24%);
  animation: progress-flow 720ms linear infinite, progress-flash 1.35s ease-in-out infinite;
}

:where(html, body).is-processing .progress-track::after {
  content: "";
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: -35%;
  width: 38%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, oklch(100% 0 0 / 86%), transparent);
  filter: blur(0.2px);
  animation: progress-scan 900ms ease-in-out infinite;
  pointer-events: none;
}

.stage-hero {
  display: none;
}

.hero-copy {
  position: relative;
  z-index: 1;
  width: min(680px, calc(100% - 200px));
  padding: 58px 36px 26px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid oklch(75% 0.1 236);
  border-radius: 7px;
  color: var(--sky-strong);
  background: oklch(98% 0.018 235 / 88%);
  padding: 0 11px;
  font-size: 0.75rem;
  font-weight: 850;
}

.hero-copy h3 {
  margin: 12px 0 12px;
  color: var(--ink);
  font-size: 2.08rem;
  line-height: 1.12;
}

.hero-copy p {
  max-width: 65ch;
  color: oklch(42% 0.038 250);
  font-size: 0.95rem;
  line-height: 1.72;
}

.run-counter {
  position: absolute;
  top: 64px;
  right: 36px;
  display: grid;
  width: 116px;
  min-height: 116px;
  align-content: center;
  border: 1px solid oklch(76% 0.09 236);
  border-radius: 8px;
  background: oklch(98% 0.012 235 / 90%);
  padding: 14px;
  box-shadow: 0 16px 34px oklch(55% 0.12 238 / 12%);
}

.run-counter strong {
  color: var(--sky-strong);
  font-size: 2.05rem;
  line-height: 1;
}

.run-counter span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.flow-line {
  position: absolute;
  right: 36px;
  bottom: 38px;
  left: 36px;
  height: 30px;
  border: 1px solid oklch(80% 0.05 235);
  border-radius: 7px;
  background: linear-gradient(90deg, var(--sky-strong), var(--sky), var(--success));
  background-clip: content-box;
  padding: 13px 9px;
}

.flow-line span {
  position: absolute;
  top: 9px;
  width: 44px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, oklch(99% 0.015 235), oklch(80% 0.12 225));
}

.flow-line span:nth-child(1) {
  left: 24px;
}

.flow-line span:nth-child(2) {
  left: 52%;
}

.flow-line span:nth-child(3) {
  right: 24px;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(128px, 1fr));
  gap: 10px;
  padding: 0 18px 16px;
}

.pipeline-step {
  position: relative;
  min-height: 132px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 15px 15px 20px;
  transition: border-color var(--fast), background var(--fast), transform var(--fast), box-shadow var(--fast);
}

.pipeline-step > * {
  position: relative;
  z-index: 1;
}

.pipeline-step span {
  color: var(--sky-strong);
  font-size: 0.78rem;
  font-weight: 880;
}

.pipeline-step h3 {
  margin: 14px 0 8px;
  color: var(--ink);
  font-size: 1rem;
}

.pipeline-step p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.pipeline-step.active {
  border-color: var(--sky);
  background: var(--sky-soft);
  box-shadow: 0 14px 30px oklch(55% 0.12 238 / 12%);
  transform: translateY(-2px);
  animation: active-step-card 1.05s ease-in-out infinite;
}

.pipeline-step.active::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(
      110deg,
      transparent 0%,
      transparent 24%,
      oklch(100% 0 0 / 62%) 39%,
      transparent 56%,
      transparent 100%
    );
  transform: translateX(-115%);
  animation: active-card-sheen 1.45s ease-in-out infinite;
  pointer-events: none;
}

.pipeline-step.active::after {
  content: "";
  position: absolute;
  z-index: 2;
  right: 12px;
  bottom: 9px;
  left: 12px;
  height: 5px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--sky-strong), oklch(99% 0.015 220), var(--success), var(--sky), var(--sky-strong));
  background-size: 260% 100%;
  box-shadow: 0 0 14px oklch(62% 0.16 238 / 42%);
  animation: running-feedback 760ms linear infinite, running-strip-pulse 1.05s ease-in-out infinite;
  pointer-events: none;
}

.pipeline-step.active {
  animation: none;
}

.pipeline-step.active::before,
.pipeline-step.active::after {
  opacity: 0;
  animation: none;
}

:where(html, body).is-processing .pipeline-step.active {
  animation: active-step-card 1.05s ease-in-out infinite;
}

:where(html, body).is-processing .pipeline-step.active::before,
:where(html, body).is-processing .pipeline-step.active::after {
  opacity: 1;
}

:where(html, body).is-processing .pipeline-step.active::before {
  animation: active-card-sheen 1.45s ease-in-out infinite;
}

:where(html, body).is-processing .pipeline-step.active::after {
  animation: running-feedback 760ms linear infinite, running-strip-pulse 1.05s ease-in-out infinite;
}

.pipeline-step.done {
  border-color: oklch(70% 0.1 165);
}

.pipeline-step.done span {
  color: var(--success);
}

.workflow-results,
.step-results {
  display: grid;
  gap: 12px;
  margin: 0 18px 16px;
  border: 1px solid oklch(82% 0.05 235);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, oklch(72% 0.08 236 / 8%) 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(180deg, oklch(99% 0.012 235), oklch(97% 0.02 235));
  padding: 14px;
}

.workflow-results h2,
.workflow-results h3,
.workflow-results h4,
.step-results h2,
.step-results h3,
.step-results h4 {
  margin-bottom: 4px;
  color: var(--ink);
  line-height: 1.25;
}

.workflow-results p,
.step-results p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.storyboard-workbench {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 14px;
  margin: 0 18px 16px;
  border: 1px solid oklch(82% 0.05 235);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, oklch(72% 0.08 236 / 7%) 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(180deg, oklch(99% 0.012 235), oklch(97% 0.02 235));
  padding: 14px;
}

.step-result-card .storyboard-workbench {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0;
  box-shadow: none;
}

.storyboard-workbench.is-confirmed {
  border-color: oklch(72% 0.1 165);
  background:
    linear-gradient(90deg, oklch(62% 0.11 165 / 7%) 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(180deg, oklch(99% 0.012 235), oklch(97% 0.024 210));
}

.storyboard-workbench.is-script-only {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  align-items: start;
  gap: 10px;
}

.storyboard-workbench.is-script-only .storyboard-actions {
  grid-column: 1 / -1;
}

.storyboard-workbench.is-script-only .storyboard-item,
.storyboard-workbench.is-script-only .storyboard-item:has(:is(.storyboard-shot-image, .storyboard-shot-empty)) {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 11px;
}

.storyboard-workbench.is-script-only .storyboard-fields,
.storyboard-workbench.is-script-only .storyboard-controls {
  grid-column: 1 / -1;
}

.storyboard-workbench.is-script-only .storyboard-field textarea {
  min-height: 86px;
}

.storyboard-workbench.is-script-only :is(.storyboard-shot-image, .storyboard-shot-empty) {
  display: none;
}

.storyboard-workbench.has-inline-shots {
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.storyboard-workbench.has-inline-shots .storyboard-actions {
  grid-column: 1 / -1;
}

.storyboard-workbench.has-inline-shots .storyboard-item,
.storyboard-workbench.has-inline-shots .storyboard-item:has(:is(.storyboard-shot-image, .storyboard-shot-empty, .storyboard-inline-preview, .storyboard-inline-empty, .storyboard-item-media)) {
  grid-template-columns: minmax(330px, 1.18fr) minmax(176px, 230px) 44px minmax(176px, 230px);
  align-items: start;
  grid-auto-rows: auto;
  gap: 12px 16px;
  padding: 14px;
}

.storyboard-workbench.has-inline-shots .storyboard-item:has(.storyboard-shot-title) {
  overflow: visible;
}

.storyboard-workbench.has-inline-shots .storyboard-item:has(.storyboard-shot-title) .storyboard-shot-title {
  grid-column: 1 / -1;
  grid-row: 1;
}

.storyboard-workbench.has-inline-shots .storyboard-item:has(.storyboard-shot-title) .storyboard-fields {
  grid-column: 1;
  grid-row: 2;
}

.storyboard-workbench.has-inline-shots .storyboard-item:has(.storyboard-shot-title) .storyboard-controls {
  grid-column: 1;
  grid-row: 3;
}

.storyboard-workbench.has-inline-shots .storyboard-item:has(.storyboard-shot-title) :is(.storyboard-shot-image, .storyboard-shot-empty, .storyboard-item-media) {
  grid-column: 2;
  grid-row: 2 / span 2;
  align-self: start;
}

.storyboard-workbench.has-inline-shots .storyboard-item:has(.storyboard-shot-title) .storyboard-item-video {
  grid-column: 4;
  grid-row: 2 / span 2;
  align-self: start;
}

.storyboard-workbench.has-inline-shots .storyboard-item:has(.storyboard-shot-title) > :is(.storyboard-inline-preview, .storyboard-inline-empty) {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
}

.storyboard-workbench.has-inline-shots .storyboard-item:has(.storyboard-shot-title) > .storyboard-inline-actions {
  grid-column: 2;
  grid-row: 3;
  align-self: start;
}

.storyboard-workbench.has-inline-shots .storyboard-item:has(.storyboard-shot-title) > :is(.storyboard-video-preview, .storyboard-video-empty) {
  grid-column: 4;
  grid-row: 2;
  align-self: start;
}

.storyboard-workbench.has-inline-shots .storyboard-item:has(.storyboard-shot-title) > .storyboard-video-actions {
  grid-column: 4;
  grid-row: 3;
  align-self: start;
}

.storyboard-workbench.has-inline-shots .storyboard-item:has(.storyboard-shot-title) .storyboard-flow-arrow {
  grid-row: 2 / span 2;
}

.storyboard-workbench.has-inline-shots .storyboard-fields,
.storyboard-workbench.has-inline-shots .storyboard-controls {
  grid-column: 1;
}

.storyboard-workbench.has-inline-shots .storyboard-item > .storyboard-item-head {
  display: none;
}

.storyboard-workbench.has-inline-shots .storyboard-fields {
  grid-template-columns: 1fr;
}

.storyboard-workbench.has-inline-shots .storyboard-field:not(:has(textarea)) {
  display: none;
}

.storyboard-workbench.has-inline-shots .storyboard-field textarea {
  min-height: 78px;
}

.storyboard-workbench.has-inline-shots :is(.storyboard-shot-image, .storyboard-shot-empty) {
  display: grid;
  grid-column: 2;
  grid-row: 1 / span 2;
}

.storyboard-workbench.has-inline-shots img.storyboard-shot-image,
.storyboard-workbench.has-inline-shots img.storyboard-inline-preview {
  display: block;
}

.storyboard-item-media {
  display: grid;
  min-width: 0;
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: stretch;
  align-content: start;
  gap: 7px;
}

.storyboard-workbench.has-inline-shots .storyboard-item > :is(.storyboard-inline-preview, .storyboard-inline-empty, .storyboard-inline-actions) {
  grid-column: 2;
}

.storyboard-item-video {
  display: grid;
  min-width: 0;
  grid-column: 4;
  grid-row: 1 / span 2;
  align-self: stretch;
  align-content: start;
  gap: 7px;
}

.storyboard-workbench.has-inline-shots .storyboard-item > :is(.storyboard-video-preview, .storyboard-video-empty, .storyboard-video-actions) {
  grid-column: 4;
}

.storyboard-flow-arrow {
  display: grid;
  grid-column: 3;
  grid-row: 1 / span 3;
  width: 100%;
  min-width: 0;
  min-height: 260px;
  align-self: start;
  place-items: center;
  color: transparent;
  font-size: 0;
  pointer-events: none;
}

.storyboard-flow-arrow::before {
  content: "\2192";
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid oklch(75% 0.09 236);
  border-radius: 999px;
  background:
    linear-gradient(180deg, oklch(99% 0.014 235), oklch(93% 0.052 232));
  color: var(--sky-strong);
  box-shadow:
    0 10px 22px oklch(55% 0.12 238 / 13%),
    inset 0 0 0 1px oklch(100% 0 0 / 55%);
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1;
}

.storyboard-flow-arrow > :is(svg, i) {
  display: none;
}

.storyboard-shot-title .storyboard-progress-mini {
  flex: 0 1 220px;
}

.storyboard-progress-mini {
  display: grid;
  grid-column: 1 / -1;
  min-width: min(160px, 100%);
  align-content: center;
  gap: 6px;
  border: 1px solid oklch(84% 0.055 236);
  border-radius: 7px;
  background:
    linear-gradient(90deg, oklch(72% 0.12 238 / 8%) 1px, transparent 1px) 0 0 / 14px 14px,
    oklch(98% 0.014 235);
  padding: 7px 8px;
  box-shadow: inset 0 0 0 1px oklch(100% 0 0 / 58%);
}

.storyboard-progress-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 760;
  line-height: 1.2;
}

.storyboard-progress-meta strong {
  display: inline-flex;
  min-width: 40px;
  min-height: 22px;
  align-items: center;
  justify-content: center;
  border: 1px solid oklch(76% 0.09 236);
  border-radius: 999px;
  color: var(--sky-strong);
  background: linear-gradient(180deg, oklch(99% 0.018 235), oklch(93% 0.045 232));
  padding: 0 7px;
  font-size: 0.72rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1px oklch(100% 0 0 / 58%);
}

.storyboard-progress-bar {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border: 1px solid oklch(79% 0.07 236);
  border-radius: 999px;
  background: oklch(92% 0.03 235);
  box-shadow: inset 0 1px 2px oklch(52% 0.06 240 / 15%);
}

.storyboard-progress-fill {
  position: relative;
  display: block;
  overflow: hidden;
  width: var(--storyboard-progress, 0%);
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, var(--sky-strong), var(--sky), oklch(78% 0.14 178));
  transition: width 260ms ease;
  box-shadow: 0 0 14px oklch(62% 0.15 238 / 28%);
}

.storyboard-progress-mini.is-running .storyboard-progress-fill {
  min-width: 12%;
  background:
    linear-gradient(90deg, var(--sky-strong), oklch(92% 0.075 220), var(--success), var(--sky));
  background-size: 220% 100%;
  animation: storyboard-progress-flow 780ms linear infinite, storyboard-progress-pulse 920ms ease-in-out infinite;
}

.storyboard-progress-mini.is-running .storyboard-progress-fill::after {
  content: "";
  position: absolute;
  top: -25%;
  bottom: -25%;
  left: -42%;
  width: 40%;
  background: linear-gradient(90deg, transparent, oklch(100% 0 0 / 82%), transparent);
  transform: skewX(-18deg);
  animation: mini-progress-scan 980ms ease-in-out infinite;
}

.storyboard-progress-mini.is-running .storyboard-progress-meta strong {
  color: oklch(98% 0.018 235);
  border-color: oklch(67% 0.16 236);
  background: linear-gradient(120deg, var(--sky-strong), var(--sky));
  box-shadow:
    0 0 0 3px oklch(66% 0.14 238 / 14%),
    0 0 16px oklch(56% 0.17 238 / 28%);
  animation: percent-pulse 1.05s ease-in-out infinite;
}

.storyboard-inline-preview,
.storyboard-inline-empty,
.storyboard-video-preview,
.storyboard-video-empty {
  width: 100%;
  min-width: 0;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
}

.storyboard-inline-preview,
.storyboard-video-preview {
  display: grid;
  min-height: 124px;
  max-height: 178px;
  overflow: hidden;
  place-items: center;
  border: 1px solid oklch(80% 0.05 235);
  background: oklch(96% 0.018 235);
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast);
}

img.storyboard-inline-preview,
.storyboard-inline-preview img,
video.storyboard-video-preview,
.storyboard-video-preview video {
  display: block;
  width: 100%;
  min-height: 124px;
  max-height: 178px;
  aspect-ratio: 16 / 9;
  background: oklch(96% 0.018 235);
  object-fit: contain;
}

.storyboard-video-preview {
  background:
    linear-gradient(135deg, oklch(98% 0.016 235), oklch(93% 0.035 232));
}

.storyboard-inline-preview[data-open-image],
.storyboard-inline-preview:has([data-open-image]),
.storyboard-inline-preview [data-open-image] {
  cursor: zoom-in;
}

.storyboard-inline-preview[data-open-image]:hover,
.storyboard-inline-preview[data-open-image]:focus-visible,
.storyboard-inline-preview:has([data-open-image]:hover),
.storyboard-inline-preview:has([data-open-image]:focus-visible),
.storyboard-video-preview:hover,
.storyboard-video-preview:focus-visible {
  border-color: var(--sky);
  box-shadow: 0 12px 24px oklch(55% 0.12 238 / 16%);
  outline: none;
  transform: translateY(-1px);
}

.storyboard-inline-empty,
.storyboard-video-empty {
  display: grid;
  min-height: 124px;
  max-height: 178px;
  overflow: hidden;
  place-items: center;
  border: 1px dashed oklch(74% 0.08 236);
  color: var(--muted);
  background:
    linear-gradient(135deg, oklch(99% 0.01 235), oklch(96% 0.025 232));
  padding: 12px;
  font-size: 0.72rem;
  font-weight: 760;
  line-height: 1.45;
  text-align: center;
}

.storyboard-video-empty {
  border-style: solid;
  background:
    linear-gradient(135deg, oklch(99% 0.01 235), oklch(94% 0.035 232));
}

.storyboard-inline-actions,
.storyboard-video-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.storyboard-inline-actions .storyboard-button,
.storyboard-video-actions .storyboard-button {
  width: 100%;
  min-height: 30px;
  padding: 0 9px;
  font-size: 0.72rem;
}

.storyboard-final-actions {
  display: flex;
  grid-column: 1 / -1;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 2px;
  border-top: 1px solid oklch(86% 0.035 235);
  padding-top: 9px;
}

.storyboard-final-link {
  display: inline-flex;
  min-height: 34px;
  flex: 0 1 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid oklch(78% 0.08 236);
  border-radius: 6px;
  color: var(--sky-strong);
  background: linear-gradient(180deg, oklch(99% 0.012 235), oklch(95% 0.035 232));
  padding: 0 12px;
  font-size: 0.76rem;
  font-weight: 840;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 10px 22px oklch(55% 0.12 238 / 10%);
  transition: transform var(--fast), background var(--fast), border-color var(--fast), color var(--fast), box-shadow var(--fast);
}

.storyboard-final-link:hover,
.storyboard-final-link:focus-visible {
  border-color: var(--sky);
  color: var(--sky-strong);
  background: var(--sky-soft);
  box-shadow: 0 12px 24px oklch(55% 0.12 238 / 14%);
  outline: none;
  transform: translateY(-1px);
}

.storyboard-final-note {
  flex: 1 1 220px;
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 680;
  line-height: 1.5;
}

.storyboard-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.storyboard-button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid oklch(80% 0.055 236);
  border-radius: 6px;
  color: var(--sky-strong);
  background: oklch(98% 0.014 235);
  padding: 0 10px;
  font-size: 0.76rem;
  font-weight: 830;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--fast), background var(--fast), border-color var(--fast), color var(--fast), box-shadow var(--fast);
}

.storyboard-button:hover,
.storyboard-button:focus-visible {
  border-color: var(--sky);
  background: var(--sky-soft);
  box-shadow: 0 10px 22px oklch(55% 0.12 238 / 12%);
  outline: none;
  transform: translateY(-1px);
}

.storyboard-button.primary {
  min-height: 36px;
  border-color: var(--sky-strong);
  color: oklch(98% 0.015 235);
  background: var(--sky-strong);
  padding: 0 14px;
  box-shadow: 0 12px 24px oklch(55% 0.16 238 / 20%);
}

.storyboard-button.primary:hover,
.storyboard-button.primary:focus-visible {
  background: var(--sky);
  box-shadow: 0 14px 28px oklch(55% 0.16 238 / 26%);
}

.storyboard-button.secondary {
  border-color: oklch(82% 0.045 236);
  color: var(--sky-strong);
  background: oklch(99% 0.01 235);
}

.storyboard-button.is-running {
  border-color: var(--sky);
  color: var(--sky-strong);
  background: var(--sky-soft);
  box-shadow: 0 0 0 3px oklch(72% 0.12 238 / 14%);
  animation: storyboard-button-flash 940ms ease-in-out infinite;
}

.storyboard-button.is-done {
  border-color: oklch(72% 0.1 165);
  color: var(--success);
  background: oklch(96% 0.032 165);
}

.storyboard-button.is-error {
  border-color: oklch(72% 0.14 28);
  color: var(--danger);
  background: oklch(97% 0.025 28);
}

.storyboard-button.danger {
  border-color: oklch(74% 0.12 28);
  color: var(--danger);
  background: oklch(98% 0.02 28);
}

.storyboard-button.danger:hover,
.storyboard-button.danger:focus-visible {
  border-color: var(--danger);
  color: oklch(98% 0.015 28);
  background: var(--danger);
}

.storyboard-button:disabled,
.storyboard-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.storyboard-item {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 9px 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: oklch(99% 0.006 235);
  padding: 10px;
  transition: border-color var(--fast), background var(--fast), box-shadow var(--fast), transform var(--fast);
}

.storyboard-item:has(:is(.storyboard-shot-image, .storyboard-shot-empty)) {
  grid-template-columns: minmax(0, 1fr) minmax(168px, 236px);
  align-items: start;
}

.storyboard-item > * {
  position: relative;
  z-index: 1;
}

.storyboard-item-head {
  display: flex;
  grid-column: 1 / -1;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 9px;
}

.storyboard-item-head > :first-child {
  min-width: 0;
}

.storyboard-item-head h3,
.storyboard-item-head h4,
.storyboard-item-head strong {
  margin: 0;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.25;
}

.storyboard-item-head p,
.storyboard-item-head small {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.storyboard-shot-title {
  display: flex;
  width: 100%;
  max-width: none;
  min-height: 24px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  border-radius: 0;
  color: var(--sky-strong);
  background: transparent;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 880;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.storyboard-shot-title-main {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid oklch(78% 0.07 236);
  border-radius: 999px;
  background: oklch(96% 0.03 232);
  padding: 0 9px;
}

.storyboard-fields {
  display: grid;
  min-width: 0;
  grid-column: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.storyboard-field {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 4px;
}

.storyboard-field:has(textarea) {
  grid-column: 1 / -1;
}

.storyboard-field label {
  color: oklch(36% 0.046 250);
  font-size: 0.7rem;
  font-weight: 820;
  line-height: 1.3;
}

.storyboard-field textarea,
.storyboard-field input {
  min-height: 32px;
  border-color: oklch(86% 0.026 235);
  border-radius: 6px;
  background: oklch(99% 0.008 235);
  padding: 7px 9px;
  font-size: 0.78rem;
}

.storyboard-field textarea {
  min-height: 64px;
  resize: vertical;
  line-height: 1.44;
}

.storyboard-controls {
  display: flex;
  grid-column: 1;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.storyboard-error {
  flex: 1 1 180px;
  margin: 0;
  color: var(--danger);
  font-size: 0.72rem;
  line-height: 1.45;
}

.storyboard-shot-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 24px;
  border: 1px solid oklch(78% 0.07 236);
  border-radius: 999px;
  color: var(--sky-strong);
  background: oklch(96% 0.03 232);
  padding: 0 8px;
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.storyboard-shot-status::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: currentColor;
}

.storyboard-shot-image,
.storyboard-shot-empty {
  grid-column: 2;
  grid-row: 2 / span 2;
  align-self: stretch;
  min-width: 0;
}

.storyboard-shot-image {
  display: grid;
  min-height: 120px;
  overflow: hidden;
  place-items: center;
  border: 1px solid oklch(80% 0.05 235);
  border-radius: 6px;
  background: oklch(96% 0.018 235);
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast);
}

img.storyboard-shot-image,
.storyboard-shot-image img {
  display: block;
  width: 100%;
  min-height: 120px;
  max-height: 196px;
  aspect-ratio: 16 / 9;
  background: oklch(96% 0.018 235);
  object-fit: contain;
}

.storyboard-shot-image[data-open-image],
.storyboard-shot-image:has([data-open-image]),
.storyboard-shot-image [data-open-image] {
  cursor: zoom-in;
}

.storyboard-shot-image[data-open-image]:hover,
.storyboard-shot-image[data-open-image]:focus-visible,
.storyboard-shot-image:has([data-open-image]:hover),
.storyboard-shot-image:has([data-open-image]:focus-visible) {
  border-color: var(--sky);
  box-shadow: 0 12px 26px oklch(55% 0.12 238 / 16%);
  outline: none;
  transform: translateY(-1px);
}

.storyboard-shot-empty {
  display: grid;
  min-height: 120px;
  place-items: center;
  border: 1px dashed oklch(74% 0.08 236);
  border-radius: 6px;
  color: var(--muted);
  background: oklch(97% 0.018 235);
  padding: 12px;
  font-size: 0.74rem;
  font-weight: 760;
  line-height: 1.45;
  text-align: center;
}

.storyboard-workbench figcaption,
.shot-gallery-card figcaption {
  display: none;
}

.storyboard-item.is-confirmed {
  border-color: oklch(76% 0.075 165);
  background: oklch(99% 0.014 175);
}

.storyboard-item.is-running {
  border-color: var(--sky);
  background: var(--sky-soft);
  box-shadow: 0 14px 30px oklch(55% 0.12 238 / 12%);
}

.storyboard-item.is-running::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(
      110deg,
      transparent 0%,
      transparent 24%,
      oklch(100% 0 0 / 62%) 39%,
      transparent 56%,
      transparent 100%
    );
  transform: translateX(-115%);
  animation: active-card-sheen 1.45s ease-in-out infinite;
  pointer-events: none;
}

.storyboard-item.is-running::after {
  content: "";
  position: absolute;
  z-index: 2;
  right: 12px;
  bottom: 7px;
  left: 12px;
  height: 4px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--sky-strong), oklch(99% 0.015 220), var(--success), var(--sky), var(--sky-strong));
  background-size: 260% 100%;
  box-shadow: 0 0 14px oklch(62% 0.16 238 / 36%);
  animation: running-feedback 760ms linear infinite, running-strip-pulse 1.05s ease-in-out infinite;
  pointer-events: none;
}

.storyboard-item.is-running .storyboard-shot-status {
  border-color: var(--sky);
  background: oklch(94% 0.055 232);
  animation: storyboard-status-flash 940ms ease-in-out infinite;
}

.storyboard-item.is-running .storyboard-shot-status::before {
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-bottom-color: transparent;
  background: transparent;
  animation: status-spin 840ms linear infinite;
}

.storyboard-item.is-done {
  border-color: oklch(72% 0.1 165);
  background: oklch(98% 0.018 165);
}

.storyboard-item.is-done .storyboard-shot-status {
  border-color: oklch(72% 0.1 165);
  color: var(--success);
  background: oklch(95% 0.035 165);
}

.storyboard-item.is-error {
  border-color: oklch(72% 0.14 28);
  background: oklch(97% 0.022 28);
}

.storyboard-item.is-error .storyboard-shot-status {
  border-color: oklch(72% 0.14 28);
  color: var(--danger);
  background: oklch(96% 0.03 28);
}

.shot-gallery {
  display: grid;
  min-width: 0;
  grid-column: 1 / -1;
  gap: 10px;
  border: 1px solid oklch(82% 0.05 235);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, oklch(72% 0.08 236 / 7%) 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(180deg, oklch(99% 0.012 235), oklch(97% 0.02 235));
  padding: 12px;
}

.shot-gallery-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 10px;
}

.shot-gallery-card {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: oklch(99% 0.006 235);
  padding: 9px;
  transition: border-color var(--fast), background var(--fast), box-shadow var(--fast), transform var(--fast);
}

.shot-gallery-card:hover,
.shot-gallery-card:focus-within {
  border-color: oklch(78% 0.07 236);
  box-shadow: 0 12px 26px oklch(55% 0.12 238 / 12%);
}

.shot-gallery-card :is(img, .storyboard-shot-image) {
  display: block;
  width: 100%;
  min-height: 132px;
  max-height: 240px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid oklch(80% 0.05 235);
  border-radius: 6px;
  background: oklch(96% 0.018 235);
  object-fit: contain;
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast);
}

.shot-gallery-card :is([data-open-image], button[data-open-image], a[data-open-image], img[data-open-image]) {
  cursor: zoom-in;
}

.shot-gallery-card :is([data-open-image], button[data-open-image], a[data-open-image], img[data-open-image]):hover,
.shot-gallery-card :is([data-open-image], button[data-open-image], a[data-open-image], img[data-open-image]):focus-visible {
  border-color: var(--sky);
  box-shadow: 0 12px 26px oklch(55% 0.12 238 / 16%);
  outline: none;
  transform: translateY(-1px);
}

.shot-gallery-actions {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.shot-gallery-actions .storyboard-button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 0.72rem;
}

.shot-gallery-status {
  display: inline-flex;
  flex: 0 1 auto;
  min-width: 0;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid oklch(78% 0.07 236);
  border-radius: 999px;
  color: var(--sky-strong);
  background: oklch(96% 0.03 232);
  padding: 0 8px;
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.shot-gallery-status::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: currentColor;
}

.shot-gallery-card.is-running {
  border-color: var(--sky);
  background: var(--sky-soft);
  box-shadow: 0 14px 30px oklch(55% 0.12 238 / 12%);
}

.shot-gallery-card.is-running::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(
      110deg,
      transparent 0%,
      transparent 28%,
      oklch(100% 0 0 / 48%) 43%,
      transparent 58%,
      transparent 100%
    );
  transform: translateX(-115%);
  animation: active-card-sheen 1.7s ease-in-out infinite;
  pointer-events: none;
}

.shot-gallery-card.is-running > * {
  position: relative;
  z-index: 1;
}

.shot-gallery-card.is-running .shot-gallery-status,
.shot-gallery-status.is-running {
  border-color: var(--sky);
  background: oklch(94% 0.055 232);
  animation: storyboard-status-flash 1.05s ease-in-out infinite;
}

.shot-gallery-card.is-running .shot-gallery-status::before,
.shot-gallery-status.is-running::before {
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-bottom-color: transparent;
  background: transparent;
  animation: status-spin 900ms linear infinite;
}

.shot-gallery-card.is-done {
  border-color: oklch(72% 0.1 165);
  background: oklch(98% 0.018 165);
}

.shot-gallery-card.is-done .shot-gallery-status,
.shot-gallery-status.is-done {
  border-color: oklch(72% 0.1 165);
  color: var(--success);
  background: oklch(95% 0.035 165);
}

.shot-gallery-card.is-error {
  border-color: oklch(72% 0.14 28);
  background: oklch(97% 0.022 28);
}

.shot-gallery-card.is-error .shot-gallery-status,
.shot-gallery-status.is-error {
  border-color: oklch(72% 0.14 28);
  color: var(--danger);
  background: oklch(96% 0.03 28);
}

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

.step-result-card {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(160px, 240px) minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 42px 12px 14px;
  transition: border-color var(--fast), background var(--fast), box-shadow var(--fast), transform var(--fast);
}

.step-result-card:not(:has(.result-media)) {
  grid-template-columns: 1fr;
}

.step-result-card::before {
  display: none;
  content: none;
}

.step-result-card::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 11px;
  height: 11px;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
}

.step-result-card.is-pending {
  color: var(--muted);
  background: oklch(98% 0.01 235);
}

.step-result-card.is-pending::before {
  background: oklch(82% 0.035 235);
}

.step-result-card.is-pending::after {
  border-color: oklch(78% 0.045 235);
}

.step-result-card.is-active {
  border-color: var(--sky);
  background:
    linear-gradient(
      110deg,
      transparent 0%,
      transparent 24%,
      oklch(100% 0 0 / 54%) 38%,
      transparent 52%,
      transparent 100%
    ) -140% 0 / 68% 100% no-repeat,
    var(--sky-soft);
  box-shadow: 0 14px 30px oklch(55% 0.12 238 / 12%);
  transform: translateY(-1px);
  animation: active-result-card 1.05s ease-in-out infinite, active-result-sheen 1.45s ease-in-out infinite;
}

.step-result-card.is-active::before,
.step-result-card.is-active::after {
  border-color: var(--sky-strong);
  background: var(--sky-strong);
}

.step-result-card.is-active::before {
  content: "";
  position: absolute;
  right: 40px;
  bottom: 7px;
  left: 12px;
  display: block;
  height: 5px;
  border: 0;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--sky-strong), oklch(99% 0.015 220), var(--success), var(--sky), var(--sky-strong));
  background-size: 260% 100%;
  box-shadow: 0 0 14px oklch(62% 0.16 238 / 42%);
  animation: running-feedback 760ms linear infinite, running-strip-pulse 1.05s ease-in-out infinite;
  pointer-events: none;
}

.step-result-card.is-active::after {
  width: 12px;
  height: 12px;
  border-color: var(--sky-strong) oklch(70% 0.08 236 / 28%) oklch(70% 0.08 236 / 28%) var(--sky-strong);
  background: transparent;
  animation: status-spin 840ms linear infinite;
}

.step-result-card.is-done {
  border-color: oklch(72% 0.1 165);
  background: oklch(98% 0.018 165);
}

.step-result-card.is-done::before {
  background: var(--success);
}

.step-result-card.is-done::after {
  width: 7px;
  height: 12px;
  border-width: 0 2px 2px 0;
  border-color: var(--success);
  border-radius: 0;
  background: transparent;
  animation: none;
  transform: rotate(45deg);
}

.step-result-card.is-error {
  border-color: oklch(72% 0.14 28);
  background: oklch(97% 0.022 28);
}

.step-result-card.is-error::before,
.step-result-card.is-error::after {
  border-color: var(--danger);
  background: var(--danger);
  animation: none;
}

.result-media {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  align-content: start;
  gap: 8px;
}

.step-result-head {
  display: flex;
  grid-column: 1 / -1;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.step-result-head > div:first-child {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.step-result-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.step-result-head span {
  display: inline-grid;
  min-width: 34px;
  min-height: 26px;
  place-items: center;
  border: 1px solid oklch(78% 0.07 236);
  border-radius: 7px;
  color: var(--sky-strong);
  background: oklch(96% 0.03 232);
  font-size: 0.74rem;
  font-weight: 880;
}

.step-result-head h3 {
  margin: 0;
  font-size: 1rem;
}

.step-result-head > strong {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
}

.step-result-status > strong {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
  white-space: nowrap;
}

.step-percent,
.pipeline-percent,
.step-result-percent {
  position: relative;
  display: inline-flex;
  min-width: 50px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid oklch(72% 0.11 236);
  border-radius: 999px;
  color: oklch(42% 0.16 244);
  background:
    radial-gradient(circle at 28% 20%, oklch(100% 0 0 / 76%), transparent 40%),
    linear-gradient(135deg, oklch(99% 0.018 235), oklch(89% 0.07 234));
  padding: 0 9px;
  font-size: 0.78rem;
  font-weight: 940;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow:
    inset 0 0 0 1px oklch(100% 0 0 / 58%),
    0 8px 22px oklch(55% 0.14 238 / 18%);
}

.step-percent::after,
.pipeline-percent::after,
.step-result-percent::after {
  content: "";
  position: absolute;
  top: -35%;
  bottom: -35%;
  left: -70%;
  width: 48%;
  background: linear-gradient(90deg, transparent, oklch(100% 0 0 / 86%), transparent);
  transform: skewX(-16deg);
  pointer-events: none;
}

.pipeline-step:has(:is(.step-percent, .pipeline-percent, .step-result-percent)) {
  padding-right: 64px;
}

.pipeline-step :is(.step-percent, .pipeline-percent, .step-result-percent) {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
}

.step-result-card:has(:is(.step-percent, .pipeline-percent, .step-result-percent)) {
  padding-right: 84px;
}

.step-result-card > :is(.step-percent, .pipeline-percent, .step-result-percent) {
  position: absolute;
  top: 12px;
  right: 36px;
  z-index: 3;
}

.step-result-head :is(.step-percent, .pipeline-percent, .step-result-percent) {
  flex: 0 0 auto;
  margin-left: auto;
}

.pipeline-step.active :is(.step-percent, .pipeline-percent, .step-result-percent),
.step-result-card.is-active :is(.step-percent, .pipeline-percent, .step-result-percent) {
  border-color: var(--sky-strong);
  color: oklch(98% 0.018 235);
  background:
    linear-gradient(120deg, oklch(45% 0.19 244), var(--sky), oklch(67% 0.14 175));
  text-shadow: 0 0 12px oklch(98% 0.06 220 / 52%);
  box-shadow:
    inset 0 0 0 1px oklch(100% 0 0 / 38%),
    0 0 0 3px oklch(66% 0.16 238 / 16%),
    0 12px 28px oklch(54% 0.18 238 / 28%);
}

.pipeline-step.done :is(.step-percent, .pipeline-percent, .step-result-percent),
.step-result-card.is-done :is(.step-percent, .pipeline-percent, .step-result-percent) {
  border-color: oklch(72% 0.1 165);
  color: var(--success);
  background: oklch(95% 0.035 165);
}

.step-result-card.is-error :is(.step-percent, .pipeline-percent, .step-result-percent) {
  border-color: oklch(72% 0.14 28);
  color: var(--danger);
  background: oklch(96% 0.03 28);
}

:where(html, body).is-processing :is(.step-percent, .pipeline-percent, .step-result-percent),
:is(.pipeline-step, .step-result-card).is-processing :is(.step-percent, .pipeline-percent, .step-result-percent) {
  animation: percent-pulse 1.05s ease-in-out infinite, percent-hue-shift 1.4s ease-in-out infinite;
}

:where(html, body).is-processing :is(.step-percent, .pipeline-percent, .step-result-percent)::after,
:is(.pipeline-step, .step-result-card).is-processing :is(.step-percent, .pipeline-percent, .step-result-percent)::after {
  animation: percent-pill-scan 1s ease-in-out infinite;
}

.step-result-empty {
  grid-column: 1 / -1;
}

.result-media figure {
  overflow: hidden;
  margin: 0;
  border: 1px solid oklch(80% 0.05 235);
  border-radius: 7px;
  background: var(--surface);
}

.result-image-card {
  cursor: zoom-in;
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast);
}

.result-media figcaption {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 760;
  line-height: 1.35;
  padding: 8px;
}

.result-media img,
.result-media video {
  display: block;
  width: 100%;
  min-height: 120px;
  max-height: 260px;
  aspect-ratio: 16 / 9;
  border: 1px solid oklch(80% 0.05 235);
  border-radius: 7px;
  background: oklch(96% 0.018 235);
  object-fit: contain;
}

.step-result-card:has(.result-media > :only-child) {
  grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
}

.step-result-card:has(.result-media > :nth-child(2)):not(:has(.result-media > :nth-child(3))) {
  grid-template-columns: minmax(320px, 460px) minmax(0, 1fr);
}

.step-result-card:has(.result-media):not(:has(.result-fields, .storyboard-workbench)) {
  grid-template-columns: 1fr;
}

.result-media img {
  cursor: zoom-in;
}

.result-media a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-media-note {
  display: grid;
  min-height: 120px;
  place-items: center;
  border: 1px solid oklch(82% 0.04 235);
  border-radius: 7px;
  background: oklch(96% 0.018 235);
  padding: 14px;
  text-align: center;
}

.result-fields {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 9px;
}

.result-fields section {
  display: grid;
  gap: 5px;
  border: 1px solid oklch(84% 0.035 235);
  border-radius: 7px;
  background: oklch(99% 0.006 235);
  padding: 10px;
}

.result-fields section > strong {
  color: var(--sky-strong);
  font-size: 0.75rem;
  font-weight: 850;
}

.result-fields > * {
  min-width: 0;
}

.result-fields dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
  gap: 8px;
  margin: 0;
}

.result-fields dt,
.result-fields small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 780;
  line-height: 1.35;
}

.result-fields dd {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 760;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.result-fields p {
  color: oklch(39% 0.038 250);
  font-size: 0.83rem;
}

.result-fields code {
  border: 1px solid oklch(83% 0.04 235);
  border-radius: 6px;
  color: var(--sky-strong);
  background: oklch(96% 0.025 235);
  padding: 2px 5px;
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.result-link,
.result-fields a:not(.result-link),
.result-media a:not(.result-link) {
  display: inline-flex;
  min-width: 0;
  width: fit-content;
  max-width: 100%;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  border: 1px solid oklch(75% 0.1 236);
  border-radius: 7px;
  color: var(--sky-strong);
  background: oklch(97% 0.028 235);
  padding: 0 11px;
  font-size: 0.8rem;
  font-weight: 820;
  line-height: 1.2;
  text-decoration: none;
  transition: border-color var(--fast), background var(--fast), color var(--fast), box-shadow var(--fast), transform var(--fast);
}

.result-link::after,
.result-fields a:not(.result-link)::after,
.result-media a:not(.result-link)::after {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

.result-link:hover,
.result-link:focus-visible,
.result-fields a:not(.result-link):hover,
.result-fields a:not(.result-link):focus-visible,
.result-media a:not(.result-link):hover,
.result-media a:not(.result-link):focus-visible {
  border-color: var(--sky);
  color: oklch(97% 0.018 235);
  background: var(--sky-strong);
  box-shadow: 0 10px 24px oklch(55% 0.12 238 / 12%);
  outline: none;
  transform: translateY(-1px);
}

.result-media figure:not(:has(figcaption)) {
  border: 0;
  background: transparent;
}

.result-media a:not(.result-link):has(:is(img, video, .storyboard-shot-image)),
.shot-gallery-card :is(a, button)[data-open-image]:has(:is(img, .storyboard-shot-image)) {
  display: block;
  width: 100%;
  min-height: 0;
  overflow: visible;
  border: 0;
  border-radius: 7px;
  color: inherit;
  background: transparent;
  padding: 0;
  font-size: 0;
  line-height: 0;
  box-shadow: none;
  cursor: zoom-in;
  transform: none;
}

.result-media a:not(.result-link):has(:is(img, video, .storyboard-shot-image))::after,
.shot-gallery-card :is(a, button)[data-open-image]:has(:is(img, .storyboard-shot-image))::after {
  display: none;
  content: none;
}

.result-media a:not(.result-link):has(:is(img, video, .storyboard-shot-image)):hover,
.result-media a:not(.result-link):has(:is(img, video, .storyboard-shot-image)):focus-visible,
.shot-gallery-card :is(a, button)[data-open-image]:has(:is(img, .storyboard-shot-image)):hover,
.shot-gallery-card :is(a, button)[data-open-image]:has(:is(img, .storyboard-shot-image)):focus-visible {
  border-color: transparent;
  color: inherit;
  background: transparent;
  box-shadow: none;
  outline: none;
  transform: none;
}

.result-media a:not(.result-link):has(:is(img, video, .storyboard-shot-image)) > :is(img, video, .storyboard-shot-image),
.shot-gallery-card :is(a, button)[data-open-image]:has(:is(img, .storyboard-shot-image)) > :is(img, .storyboard-shot-image) {
  width: 100%;
  font-size: initial;
  line-height: normal;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: oklch(19% 0.04 250 / 64%);
}

.image-lightbox[hidden] {
  display: none !important;
}

.image-lightbox-panel {
  position: relative;
  display: grid;
  width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  gap: 10px;
  border: 1px solid oklch(79% 0.045 235);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  box-shadow: 0 24px 60px oklch(10% 0.035 250 / 34%);
}

.image-lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid oklch(78% 0.04 235);
  border-radius: 7px;
  color: var(--ink);
  background: oklch(99% 0.008 235 / 92%);
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color var(--fast), background var(--fast), box-shadow var(--fast), transform var(--fast);
}

.image-lightbox-close:hover,
.image-lightbox-close:focus-visible {
  border-color: var(--sky);
  background: var(--sky-soft);
  box-shadow: 0 10px 24px oklch(20% 0.05 250 / 16%);
  outline: none;
  transform: translateY(-1px);
}

.image-lightbox img {
  display: block;
  width: 100%;
  max-height: min(76vh, 720px);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: oklch(96% 0.018 235);
  object-fit: contain;
}

.image-lightbox-caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

@keyframes progress-flow {
  to {
    background-position: 240% 0;
  }
}

@keyframes progress-flash {
  0%,
  100% {
    filter: saturate(1);
  }

  50% {
    filter: saturate(1.32) brightness(1.1);
  }
}

@keyframes progress-scan {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(360%);
  }
}

@keyframes progress-panel-scan {
  0% {
    transform: translateX(-52%);
  }

  100% {
    transform: translateX(72%);
  }
}

@keyframes percent-meter-glow {
  0%,
  100% {
    filter: saturate(1) brightness(1);
    transform: translateY(0);
  }

  50% {
    filter: saturate(1.18) brightness(1.08);
    transform: translateY(-1px);
  }
}

@keyframes percent-meter-scan {
  0% {
    opacity: 0;
    transform: translateX(0) skewX(-16deg);
  }

  28%,
  72% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateX(360%) skewX(-16deg);
  }
}

@keyframes active-step-card {
  0%,
  100% {
    box-shadow: 0 14px 30px oklch(55% 0.12 238 / 12%);
    transform: translateY(-2px);
  }

  50% {
    box-shadow: 0 18px 36px oklch(55% 0.12 238 / 22%);
    transform: translateY(-5px);
  }
}

@keyframes active-result-card {
  0%,
  100% {
    box-shadow: 0 14px 30px oklch(55% 0.12 238 / 12%);
    transform: translateY(-1px);
  }

  50% {
    box-shadow: 0 17px 34px oklch(55% 0.12 238 / 22%);
    transform: translateY(-4px);
  }
}

@keyframes active-card-sheen {
  0%,
  28% {
    transform: translateX(-115%);
    opacity: 0;
  }

  42%,
  72% {
    opacity: 1;
  }

  100% {
    transform: translateX(115%);
    opacity: 0;
  }
}

@keyframes active-result-sheen {
  0%,
  28% {
    background-position: -140% 0, 0 0;
  }

  100% {
    background-position: 180% 0, 0 0;
  }
}

@keyframes running-feedback {
  to {
    background-position: 260% 0;
  }
}

@keyframes running-strip-pulse {
  0%,
  100% {
    opacity: 0.82;
    transform: scaleX(0.92);
  }

  50% {
    opacity: 1;
    transform: scaleX(1);
  }
}

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

@keyframes storyboard-button-flash {
  0%,
  100% {
    border-color: oklch(76% 0.08 236);
    box-shadow: 0 0 0 2px oklch(72% 0.12 238 / 10%);
  }

  50% {
    border-color: var(--sky-strong);
    box-shadow:
      0 0 0 4px oklch(72% 0.12 238 / 18%),
      0 8px 18px oklch(55% 0.12 238 / 14%);
  }
}

@keyframes storyboard-progress-pulse {
  0%,
  100% {
    filter: saturate(1);
    opacity: 0.78;
  }

  50% {
    filter: saturate(1.25);
    opacity: 1;
  }
}

@keyframes storyboard-progress-flow {
  to {
    background-position: 220% 0;
  }
}

@keyframes mini-progress-scan {
  0% {
    opacity: 0;
    transform: translateX(0) skewX(-18deg);
  }

  25%,
  75% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateX(360%) skewX(-18deg);
  }
}

@keyframes storyboard-status-flash {
  0%,
  100% {
    box-shadow: inset 0 0 0 1px oklch(100% 0 0 / 34%);
  }

  50% {
    box-shadow:
      inset 0 0 0 1px oklch(100% 0 0 / 58%),
      0 0 0 3px oklch(72% 0.12 238 / 14%);
  }
}

@keyframes percent-pulse {
  0%,
  100% {
    box-shadow: inset 0 0 0 1px oklch(100% 0 0 / 48%);
    transform: scale(1);
  }

  50% {
    border-color: var(--sky);
    box-shadow:
      inset 0 0 0 1px oklch(100% 0 0 / 62%),
      0 0 0 4px oklch(72% 0.12 238 / 16%);
    transform: scale(1.04);
  }
}

@keyframes percent-pill-scan {
  0% {
    opacity: 0;
    transform: translateX(0) skewX(-16deg);
  }

  30%,
  72% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateX(380%) skewX(-16deg);
  }
}

@keyframes percent-hue-shift {
  0%,
  100% {
    filter: saturate(1);
  }

  50% {
    filter: saturate(1.22) brightness(1.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  :where(html, body).is-processing .progress-fill,
  :where(html, body).is-processing .progress-block::before,
  :where(html, body).is-processing .progress-track::after,
  :where(html, body).is-processing .status-line span,
  :where(html, body).is-processing .status-line span::after,
  :where(html, body).is-processing :is(.step-percent, .pipeline-percent, .step-result-percent),
  :where(html, body).is-processing :is(.step-percent, .pipeline-percent, .step-result-percent)::after,
  :is(.pipeline-step, .step-result-card).is-processing :is(.step-percent, .pipeline-percent, .step-result-percent),
  :is(.pipeline-step, .step-result-card).is-processing :is(.step-percent, .pipeline-percent, .step-result-percent)::after,
  .pipeline-step.active,
  .pipeline-step.active::before,
  .pipeline-step.active::after,
  .step-result-card.is-active,
  .step-result-card.is-active::before,
  .step-result-card.is-active::after,
  .storyboard-item.is-running::before,
  .storyboard-item.is-running::after,
  .storyboard-item.is-running .storyboard-shot-status,
  .storyboard-item.is-running .storyboard-shot-status::before,
  .storyboard-button.is-running,
  .storyboard-progress-mini.is-running .storyboard-progress-fill,
  .storyboard-progress-mini.is-running .storyboard-progress-fill::after,
  .storyboard-progress-mini.is-running .storyboard-progress-meta strong,
  .shot-gallery-card.is-running::before,
  .shot-gallery-card.is-running .shot-gallery-status,
  .shot-gallery-card.is-running .shot-gallery-status::before,
  .shot-gallery-status.is-running,
  .shot-gallery-status.is-running::before {
    animation: none;
  }

  .pipeline-step.active::before,
  .storyboard-item.is-running::before,
  .shot-gallery-card.is-running::before {
    opacity: 0;
  }

  .step-result-card.is-active {
    background: var(--sky-soft);
  }
}

.endpoint-map {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  border-top: 1px solid var(--line);
}

.endpoint-list {
  display: grid;
  grid-template-columns: repeat(7, minmax(118px, 1fr));
  gap: 8px;
}

.endpoint-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 11px;
}

.endpoint-item strong {
  display: block;
  color: var(--sky-strong);
  font-size: 0.74rem;
}

.endpoint-item span {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 780;
}

.endpoint-item code {
  display: block;
  overflow: hidden;
  margin-top: 6px;
  color: var(--faint);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-button svg,
.secondary-action svg,
.view-button svg,
.primary-action svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

@media (min-width: 1241px) and (max-width: 1280px) {
  .storyboard-workbench.has-inline-shots .storyboard-item,
  .storyboard-workbench.has-inline-shots .storyboard-item:has(:is(.storyboard-shot-image, .storyboard-shot-empty, .storyboard-inline-preview, .storyboard-inline-empty, .storyboard-item-media)) {
    grid-template-columns: minmax(286px, 1fr) minmax(148px, 188px) 36px minmax(148px, 188px);
    gap: 12px;
  }

  .storyboard-inline-actions,
  .storyboard-video-actions {
    grid-template-columns: 1fr;
  }
}

/* Final interaction polish: uploaded assets behave like thumbnails, storyboard media stays uncluttered. */
#product-drop:has(.preview-strip.has-preview) label,
#model-drop:has(.preview-strip.has-preview) label {
  display: none;
}

#product-drop .preview-strip.has-preview {
  width: min(100%, 344px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  justify-content: start;
  padding: 10px;
}

#product-drop .preview-strip.has-preview[data-preview-count="1"] {
  width: min(100%, 104px);
  grid-template-columns: minmax(0, 104px);
}

#product-drop .preview-strip.has-preview[data-preview-count="2"] {
  width: min(100%, 224px);
  grid-template-columns: repeat(2, minmax(0, 104px));
}

#model-drop .preview-strip.has-preview {
  width: min(100%, 170px);
  grid-template-columns: minmax(0, 1fr);
  justify-content: center;
  padding: 10px;
}

#product-drop .preview-card,
#model-drop .preview-card {
  border-radius: 7px;
  box-shadow: 0 8px 18px oklch(55% 0.12 238 / 8%);
}

#product-drop .preview-card img {
  aspect-ratio: 1 / 1;
  object-fit: contain;
  padding: 4px;
}

#model-drop .preview-card img {
  max-height: 210px;
  object-fit: cover;
}

.public-model-library {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.public-model-library:has(.public-model-list:empty),
.public-model-library:has(.public-model-list:empty) + .model-upload-divider {
  display: none;
}

.public-model-library-head {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink);
  font-size: 0.74rem;
}

.public-model-library-head small {
  color: var(--muted);
  font-size: 0.66rem;
}

.public-model-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.public-model-option {
  position: relative;
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface);
  padding: 3px;
  cursor: pointer;
}

.public-model-option img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 4px;
  object-fit: cover;
}

.public-model-option span {
  overflow: hidden;
  padding: 4px 2px 2px;
  font-size: 0.62rem;
  font-weight: 760;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.public-model-option:hover,
.public-model-option:focus-visible,
.public-model-option.is-selected {
  border-color: var(--sky-strong);
  color: var(--sky-strong);
  background: var(--sky-soft);
  outline: none;
  box-shadow: 0 0 0 2px oklch(62% 0.16 236 / 15%);
}

.model-upload-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  font-size: 0.64rem;
}

.model-upload-divider::before,
.model-upload-divider::after {
  height: 1px;
  flex: 1;
  content: "";
  background: var(--line);
}

#model-drop:has(.preview-strip.has-preview) > label {
  display: grid;
  min-height: 46px;
  border-top: 1px solid var(--line);
  padding: 8px 10px;
}

#model-drop:has(.preview-strip.has-preview) > label small {
  display: none;
}

@media (max-width: 420px) {
  .public-model-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.storyboard-workbench.has-inline-shots .storyboard-item {
  align-items: start;
  overflow: visible;
}

.storyboard-workbench.has-inline-shots .storyboard-shot-title {
  display: flex;
  grid-column: 1 / -1;
  grid-row: 1;
}

.storyboard-workbench.has-inline-shots .storyboard-fields {
  grid-row: 2;
}

.storyboard-workbench.has-inline-shots .storyboard-item-media,
.storyboard-workbench.has-inline-shots .storyboard-item-video {
  align-self: start;
  grid-row: 2 / span 2;
}

.storyboard-inline-preview,
.storyboard-video-preview,
.storyboard-inline-empty,
.storyboard-video-empty {
  min-height: 116px;
  max-height: none;
}

.storyboard-inline-preview img,
video.storyboard-video-preview {
  min-height: 116px;
  max-height: 220px;
  object-fit: contain;
}

.storyboard-inline-preview figcaption {
  display: none;
}

.storyboard-inline-actions,
.storyboard-video-actions {
  align-self: start;
  position: static;
  z-index: 1;
}

/* Vertical UGC previews: fill the 9:16 frame instead of leaving side gutters. */
.storyboard-workbench.has-inline-shots .storyboard-shot-image,
.storyboard-workbench.has-inline-shots .storyboard-shot-empty,
.storyboard-workbench.has-inline-shots .storyboard-inline-preview,
.storyboard-workbench.has-inline-shots .storyboard-video-preview,
.storyboard-workbench.has-inline-shots .storyboard-inline-empty,
.storyboard-workbench.has-inline-shots .storyboard-video-empty {
  min-height: 260px;
  aspect-ratio: 9 / 16;
}

.storyboard-workbench.has-inline-shots img.storyboard-shot-image,
.storyboard-workbench.has-inline-shots .storyboard-shot-image img,
.storyboard-workbench.has-inline-shots img.storyboard-inline-preview,
.storyboard-workbench.has-inline-shots .storyboard-inline-preview img,
.storyboard-workbench.has-inline-shots video.storyboard-video-preview,
.storyboard-workbench.has-inline-shots .storyboard-video-preview video {
  width: 100%;
  min-height: 260px;
  max-height: none;
  aspect-ratio: 9 / 16;
  object-fit: cover;
}

.storyboard-workbench.has-inline-shots .storyboard-item-media,
.storyboard-workbench.has-inline-shots .storyboard-item-video {
  align-content: start;
  gap: 10px;
}

.result-media.has-final-video {
  grid-template-columns: minmax(220px, 320px);
  justify-content: center;
}

.result-video-card {
  display: grid;
  min-width: 0;
  overflow: hidden;
  margin: 0;
  border: 1px solid oklch(80% 0.05 235);
  border-radius: 7px;
  background: oklch(96% 0.018 235);
  box-shadow: 0 12px 26px oklch(55% 0.12 238 / 12%);
}

.result-video-card.is-final {
  max-width: 320px;
  justify-self: center;
}

.result-video-player {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  min-height: 360px;
  background: oklch(20% 0.025 245);
  object-fit: cover;
}

.result-media.has-final-video video.result-video-player {
  max-height: none;
  aspect-ratio: 9 / 16;
  object-fit: cover;
}

.result-video-card figcaption {
  border-top: 1px solid oklch(84% 0.04 235);
  color: var(--sky-strong);
  background: oklch(98% 0.014 235);
  padding: 8px 10px;
  font-size: 0.76rem;
  font-weight: 840;
}

@media (max-width: 1240px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .step-tabs {
    overflow-x: auto;
    grid-template-columns: repeat(6, minmax(136px, 1fr));
    padding-bottom: 4px;
  }

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

@media (max-width: 960px) {
  .app-shell {
    width: min(100% - 20px, 820px);
    padding-top: 12px;
  }

  .workspace {
    gap: 12px;
    padding-top: 12px;
  }

  .result-head,
  .endpoint-map {
    display: grid;
    grid-template-columns: 1fr;
  }

  .api-status {
    display: grid;
    grid-template-columns: 1fr;
  }

  .step-result-card {
    grid-template-columns: 1fr;
  }

  .step-result-card:has(.result-media > :only-child),
  .step-result-card:has(.result-media > :nth-child(2)):not(:has(.result-media > :nth-child(3))),
  .step-result-card:has(.result-media) {
    grid-template-columns: 1fr;
  }

  .upload-grid,
  .result-media,
  .shot-gallery-grid {
    grid-template-columns: 1fr;
  }

  .storyboard-item:has(:is(.storyboard-shot-image, .storyboard-shot-empty)) {
    grid-template-columns: 1fr;
  }

  .storyboard-workbench.has-inline-shots .storyboard-item,
  .storyboard-workbench.has-inline-shots .storyboard-item:has(:is(.storyboard-shot-image, .storyboard-shot-empty, .storyboard-inline-preview, .storyboard-inline-empty, .storyboard-item-media)) {
    grid-template-columns: 1fr;
  }

  .storyboard-shot-image,
  .storyboard-shot-empty {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .storyboard-workbench.has-inline-shots .storyboard-shot-title {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .storyboard-workbench.has-inline-shots .storyboard-fields,
  .storyboard-workbench.has-inline-shots .storyboard-controls,
  .storyboard-flow-arrow,
  .storyboard-item-media,
  .storyboard-item-video,
  .storyboard-workbench.has-inline-shots .storyboard-item > :is(.storyboard-inline-preview, .storyboard-inline-empty, .storyboard-inline-actions, .storyboard-video-preview, .storyboard-video-empty, .storyboard-video-actions) {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .storyboard-flow-arrow {
    min-height: 36px;
  }

  .storyboard-workbench.has-inline-shots .storyboard-inline-preview,
  .storyboard-workbench.has-inline-shots .storyboard-video-preview,
  .storyboard-workbench.has-inline-shots .storyboard-inline-empty,
  .storyboard-workbench.has-inline-shots .storyboard-video-empty,
  .storyboard-workbench.has-inline-shots .storyboard-inline-preview img,
  .storyboard-workbench.has-inline-shots video.storyboard-video-preview,
  .storyboard-workbench.has-inline-shots .storyboard-video-preview video {
    min-height: 320px;
  }

  .result-media.has-final-video {
    grid-template-columns: minmax(0, min(100%, 320px));
    justify-content: center;
  }

  .hero-copy {
    width: 100%;
    padding: 46px 22px 118px;
  }

  .hero-copy h3 {
    font-size: 1.86rem;
  }

  .run-counter {
    top: auto;
    right: 22px;
    bottom: 76px;
  }

  .flow-line {
    right: 22px;
    bottom: 30px;
    left: 22px;
  }

  .pipeline,
  .endpoint-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .topbar-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    align-self: stretch;
    overflow: hidden;
  }

  .case-library-entry,
  .api-key-entry {
    width: calc((100% - 8px) / 2);
    max-width: calc((100% - 8px) / 2);
    min-width: 0;
    flex: 1 1 0;
    padding-right: 8px;
    padding-left: 8px;
  }

  .case-save-fab {
    right: 14px;
    bottom: 14px;
    min-height: 42px;
    padding: 0 14px;
  }

  .case-library-overlay {
    align-items: end;
    justify-items: stretch;
    padding: 0;
  }

  .case-library-drawer {
    width: 100%;
    max-height: calc(100vh - 18px);
    align-self: end;
    margin: 0;
    border-radius: 8px 8px 0 0;
  }

  .api-key-overlay {
    align-items: end;
    justify-items: stretch;
    padding: 0;
  }

  .api-key-dialog {
    width: 100%;
    max-height: calc(100vh - 18px);
    border-radius: 8px 8px 0 0;
  }

  .api-key-head,
  .api-key-form {
    padding-right: 14px;
    padding-left: 14px;
  }

  .case-library-head,
  .case-library-actions,
  .case-library-body {
    padding-right: 14px;
    padding-left: 14px;
  }

  .case-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .case-card-cover {
    width: min(100%, 210px);
    min-height: 280px;
  }

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

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

  .brand h1 {
    font-size: 1.18rem;
  }

  .split-fields,
  .pipeline,
  .endpoint-list {
    grid-template-columns: 1fr;
  }

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

  .dropzone {
    min-height: 150px;
  }

  .dropzone label {
    min-height: 148px;
    padding: 12px 8px;
  }

  .panel-head,
  .campaign-form,
  .result-head,
  .progress-block,
  .endpoint-map {
    padding-right: 14px;
    padding-left: 14px;
  }

  .voice-preset-list,
  .voice-grid {
    gap: 6px;
  }

  .voice-mode-switch {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  }

  .voice-mode-button {
    padding-right: 6px;
    padding-left: 6px;
    font-size: 0.7rem;
  }

  .voice-clone-panel {
    padding: 10px;
  }

  .voice-option {
    width: 62px;
    min-width: 62px;
    min-height: 62px;
    padding: 6px;
  }

  .preview-strip {
    grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  }

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

  .image-lightbox {
    padding: 12px;
  }

  .image-lightbox-panel {
    width: min(100%, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    padding: 10px;
  }

  .api-status {
    margin-right: 14px;
    margin-left: 14px;
  }

  .workflow-results,
  .step-results,
  .storyboard-workbench {
    margin-right: 14px;
    margin-left: 14px;
    padding: 12px;
  }

  .step-result-card .storyboard-workbench {
    margin-right: 0;
    margin-left: 0;
  }

  .storyboard-actions {
    justify-content: flex-start;
  }

  .storyboard-fields {
    grid-template-columns: 1fr;
  }

  .storyboard-workbench.is-script-only,
  .shot-gallery-grid {
    grid-template-columns: 1fr;
  }

  .storyboard-field:has(textarea) {
    grid-column: auto;
  }

  .shot-gallery-actions {
    justify-content: flex-start;
  }

  .storyboard-inline-actions {
    justify-content: flex-start;
  }

  .storyboard-video-actions,
  .storyboard-final-actions {
    justify-content: flex-start;
  }

  .storyboard-button.primary {
    flex: 1 1 180px;
  }

  .step-result-card {
    padding: 12px 36px 12px 13px;
  }

  .pipeline {
    padding-right: 14px;
    padding-left: 14px;
  }

  .hero-copy h3 {
    font-size: 1.58rem;
  }

  .hero-copy p {
    font-size: 0.9rem;
  }
}

/* ========================================================================== */
/* Visual refresh: bright precision workspace                                 */
/* ========================================================================== */

:root {
  --page: oklch(97% 0.014 225);
  --page-soft: oklch(94.5% 0.024 228);
  --surface: oklch(99% 0.006 225);
  --surface-raised: oklch(96.5% 0.016 228);
  --ink: oklch(22% 0.04 248);
  --text: oklch(31% 0.032 246);
  --muted: oklch(54% 0.03 242);
  --faint: oklch(66% 0.025 238);
  --line: oklch(87% 0.03 228);
  --line-strong: oklch(76% 0.07 232);
  --sky: oklch(62% 0.19 236);
  --sky-strong: oklch(52% 0.21 244);
  --sky-soft: oklch(94% 0.042 230);
  --success: oklch(65% 0.14 164);
  --amber: oklch(75% 0.15 78);
  --danger: oklch(63% 0.19 28);
  --shadow:
    0 1px 2px oklch(38% 0.045 242 / 5%),
    0 14px 34px oklch(40% 0.075 240 / 9%);
  --focus-ring: 0 0 0 3px oklch(68% 0.16 238 / 18%);
  --fast: 200ms cubic-bezier(0.22, 1, 0.36, 1);
  --radius: 7px;
}

html {
  background: var(--page);
}

body {
  line-height: 1.5;
  background:
    linear-gradient(90deg, oklch(70% 0.07 232 / 8%) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(0deg, oklch(70% 0.07 232 / 7%) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(180deg, oklch(98.5% 0.01 224), var(--page) 420px);
  background-attachment: fixed;
}

::selection {
  color: var(--ink);
  background: oklch(86% 0.09 230);
}

:is(button, a, input, select, textarea):focus-visible {
  outline: 2px solid oklch(58% 0.18 240);
  outline-offset: 2px;
}

button:disabled,
button[aria-disabled="true"],
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  filter: saturate(0.45);
  opacity: 0.56;
  box-shadow: none;
  transform: none;
}

.app-shell {
  width: min(1800px, calc(100vw - 32px));
  padding: 16px 0 30px;
}

/* Header and six-step navigator */

.topbar {
  position: relative;
  isolation: isolate;
  padding: 11px 12px;
  border-color: oklch(83% 0.045 230);
  background: var(--surface);
  box-shadow:
    inset 0 1px 0 oklch(100% 0 0 / 76%),
    var(--shadow);
}

.topbar::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: -1px;
  right: 20px;
  left: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, oklch(68% 0.15 234 / 60%), transparent);
  pointer-events: none;
}

.topbar-intro,
.brand,
.brand > div:last-child {
  min-width: 0;
}

.brand {
  gap: 10px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-color: oklch(73% 0.11 235);
  background:
    linear-gradient(90deg, transparent 49%, oklch(55% 0.16 240 / 20%) 50%, transparent 51%),
    linear-gradient(0deg, transparent 49%, oklch(55% 0.16 240 / 18%) 50%, transparent 51%),
    oklch(92% 0.052 230);
  box-shadow:
    inset 0 0 0 1px oklch(100% 0 0 / 70%),
    0 7px 18px oklch(46% 0.1 240 / 13%);
}

.brand-mark span {
  width: 26px;
  height: 26px;
  border: 1px solid oklch(76% 0.09 233);
  border-radius: 5px;
  color: var(--sky-strong);
  background: oklch(99% 0.008 225);
  font-size: 1rem;
}

.eyebrow {
  margin-bottom: 3px;
  color: oklch(48% 0.17 242);
  font-size: 0.69rem;
  font-weight: 850;
}

.brand h1 {
  margin-bottom: 3px;
  font-size: 1.24rem;
  line-height: 1.22;
  word-break: normal;
  overflow-wrap: normal;
}

.brand p:last-child {
  font-size: 0.79rem;
  line-height: 1.4;
}

.topbar-actions {
  gap: 7px;
}

.case-library-entry,
.api-key-entry {
  min-height: 40px;
  border-radius: 6px;
  padding: 0 11px;
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 72%);
}

.case-library-entry {
  border-color: oklch(76% 0.08 234);
  background: oklch(98% 0.014 228);
}

.api-key-entry,
.api-key-save {
  background: linear-gradient(180deg, oklch(61% 0.19 236), var(--sky-strong));
}

.case-library-entry:hover,
.case-library-entry:focus-visible,
.api-key-entry:hover,
.api-key-entry:focus-visible {
  box-shadow: 0 7px 18px oklch(48% 0.15 240 / 18%);
  transform: translateY(-1px);
}

.step-tabs {
  gap: 0;
  overflow: hidden;
  border: 1px solid oklch(84% 0.035 230);
  border-radius: 6px;
  background: oklch(97% 0.014 228);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 78%);
}

.step-tab {
  position: relative;
  min-width: 0;
  min-height: 56px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 8px 10px 9px;
  box-shadow: none;
}

.step-tab:last-child {
  border-right: 0;
}

.step-tab:hover,
.step-tab:focus-visible {
  border-color: var(--line);
  background: oklch(95.5% 0.026 230);
  box-shadow: inset 0 -2px 0 oklch(66% 0.14 236 / 38%);
  transform: none;
}

.step-tab strong {
  color: oklch(59% 0.04 239);
  font-variant-numeric: tabular-nums;
}

.step-tab.active {
  border-color: var(--line);
  background: oklch(93.5% 0.05 230);
  box-shadow:
    inset 0 -2px 0 var(--sky-strong),
    inset 0 1px 0 oklch(100% 0 0 / 82%);
}

.step-tab.active::after {
  content: "";
  position: absolute;
  top: 11px;
  right: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sky);
  box-shadow: 0 0 0 3px oklch(62% 0.17 236 / 14%);
}

/* Panels, forms, and uploads */

.input-panel,
.result-panel {
  border-color: oklch(84% 0.04 230);
  background: var(--surface);
  box-shadow:
    inset 0 1px 0 oklch(100% 0 0 / 80%),
    var(--shadow);
}

.panel-head,
.result-head {
  border-bottom-color: oklch(88% 0.026 230);
  background:
    linear-gradient(90deg, oklch(66% 0.1 234 / 7%) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(180deg, oklch(98.7% 0.009 225), oklch(97.5% 0.014 228));
}

.panel-head,
.result-head,
.endpoint-map {
  padding: 16px;
}

.panel-head h2,
.result-head h2,
.endpoint-map h2 {
  margin-bottom: 5px;
  font-size: 1.3rem;
}

.panel-head p:last-child,
.result-head p,
.endpoint-map p {
  font-size: 0.81rem;
  line-height: 1.55;
}

.campaign-form {
  gap: 13px;
  padding: 16px;
}

.field {
  gap: 7px;
}

label {
  color: oklch(31% 0.045 248);
  font-size: 0.78rem;
  font-weight: 790;
}

input[type="text"],
input[type="password"],
select,
textarea {
  border-color: oklch(84% 0.035 230);
  border-radius: 6px;
  background: oklch(99% 0.005 225);
  box-shadow: inset 0 1px 2px oklch(43% 0.04 244 / 4%);
}

input[type="text"],
input[type="password"],
select {
  min-height: 44px;
}

input[type="text"]:hover,
input[type="password"]:hover,
select:hover,
textarea:hover {
  border-color: oklch(77% 0.06 233);
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: oklch(62% 0.16 238);
  box-shadow: var(--focus-ring), inset 0 1px 2px oklch(43% 0.04 244 / 4%);
}

.voice-mode-switch {
  border-color: oklch(84% 0.035 230);
  border-radius: 6px;
  background: oklch(95.5% 0.02 230);
}

.voice-mode-button {
  border-radius: 4px;
}

.voice-mode-button.is-active,
.voice-mode-button.active,
.voice-mode-button[aria-pressed="true"] {
  border-color: oklch(76% 0.08 234);
  background: var(--surface);
  box-shadow:
    inset 0 1px 0 oklch(100% 0 0 / 80%),
    0 2px 6px oklch(44% 0.06 240 / 9%);
}

.voice-preset-list,
.voice-clone-panel {
  border-color: oklch(84% 0.035 230);
  border-radius: 6px;
  background:
    linear-gradient(90deg, oklch(66% 0.09 234 / 6%) 1px, transparent 1px) 0 0 / 20px 20px,
    oklch(97.8% 0.013 228);
}

.voice-option {
  border-color: oklch(85% 0.028 230);
  border-radius: 5px;
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 78%);
}

.voice-option:hover,
.voice-option:focus-visible {
  box-shadow: 0 5px 14px oklch(49% 0.1 240 / 10%);
}

.voice-option[aria-selected="true"] {
  border-color: var(--sky-strong);
  background: oklch(94% 0.046 230);
  box-shadow:
    inset 0 0 0 1px oklch(58% 0.16 238 / 24%),
    0 5px 14px oklch(49% 0.1 240 / 12%);
}

.voice-clone-tip,
.device-code-field {
  border: 1px solid oklch(78% 0.07 234);
  border-radius: 6px;
  background: oklch(95% 0.036 231);
}

.voice-clone-tip {
  padding: 8px 10px;
}

.range-field,
.storyboard-count-field {
  border-color: oklch(84% 0.035 230);
  border-radius: 6px;
  background: oklch(97.8% 0.012 228);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 72%);
}

.range-field output,
.storyboard-count-field output,
.range-field .range-value,
.storyboard-count-field .range-value,
.storyboard-count-field .storyboard-count-value,
#storyboard-count-value {
  border-radius: 5px;
  background: oklch(94% 0.04 230);
}

.dropzone {
  min-height: 176px;
  border-color: oklch(72% 0.09 234);
  border-radius: 6px;
  background:
    linear-gradient(90deg, oklch(66% 0.1 234 / 8%) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(0deg, oklch(66% 0.1 234 / 7%) 1px, transparent 1px) 0 0 / 22px 22px,
    oklch(97.5% 0.016 228);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 80%);
  transition: border-color var(--fast), background var(--fast), box-shadow var(--fast);
}

.dropzone:hover,
.dropzone:focus-within,
.dropzone.is-dragging {
  border-color: var(--sky-strong);
  background:
    linear-gradient(90deg, oklch(60% 0.15 238 / 10%) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(0deg, oklch(60% 0.15 238 / 9%) 1px, transparent 1px) 0 0 / 22px 22px,
    oklch(94.5% 0.04 230);
  box-shadow: var(--focus-ring), inset 0 1px 0 oklch(100% 0 0 / 82%);
}

.dropzone label {
  min-height: 174px;
}

.dropzone label > svg {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: oklch(93% 0.052 230);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 72%);
}

.dropzone small {
  color: var(--muted);
}

.preview-card,
.preview-strip > img {
  border-color: oklch(80% 0.05 232);
  border-radius: 6px;
  box-shadow: 0 6px 16px oklch(47% 0.08 240 / 10%);
}

.primary-action,
.api-key-save,
.clone-voice-button,
.storyboard-button.primary {
  border-radius: 6px;
  background: linear-gradient(180deg, oklch(61% 0.19 236), var(--sky-strong));
  box-shadow:
    inset 0 1px 0 oklch(100% 0 0 / 24%),
    0 9px 20px oklch(48% 0.17 242 / 20%);
}

.primary-action {
  min-height: 54px;
  border: 1px solid oklch(49% 0.2 245);
}

.primary-action:hover,
.primary-action:focus-visible,
.api-key-save:hover,
.api-key-save:focus-visible,
.clone-voice-button:hover,
.clone-voice-button:focus-visible,
.storyboard-button.primary:hover,
.storyboard-button.primary:focus-visible {
  filter: brightness(1.03) saturate(1.04);
  box-shadow:
    inset 0 1px 0 oklch(100% 0 0 / 28%),
    0 11px 24px oklch(48% 0.17 242 / 24%);
}

.plain-tip {
  border-color: oklch(82% 0.045 218);
  border-radius: 6px;
  background: oklch(96.5% 0.022 220);
}

/* Progress and runtime states */

.progress-block {
  margin: 0;
  padding: 17px 16px 16px;
  border-color: oklch(87% 0.035 230);
  background:
    linear-gradient(90deg, oklch(63% 0.12 236 / 7%) 1px, transparent 1px) 0 0 / 18px 18px,
    linear-gradient(0deg, oklch(63% 0.12 236 / 6%) 1px, transparent 1px) 0 0 / 18px 18px,
    oklch(96.8% 0.021 229);
}

.status-line {
  margin-bottom: 12px;
}

.status-line strong {
  font-size: 0.95rem;
}

.status-line span {
  min-width: 76px;
  min-height: 36px;
  border-color: oklch(69% 0.12 236);
  border-radius: 6px;
  color: oklch(42% 0.16 244);
  background: oklch(93% 0.052 230);
  padding: 0 12px;
  font-size: 1.28rem;
  box-shadow:
    inset 0 1px 0 oklch(100% 0 0 / 72%),
    0 5px 14px oklch(49% 0.12 240 / 12%);
}

.status-line span::before {
  inset: 2px;
  border-color: oklch(74% 0.1 235 / 42%);
  border-radius: 4px;
}

:where(html, body).is-processing .status-line span {
  background: linear-gradient(180deg, oklch(61% 0.19 236), var(--sky-strong));
  text-shadow: none;
  box-shadow:
    inset 0 1px 0 oklch(100% 0 0 / 24%),
    0 0 0 3px oklch(64% 0.15 238 / 12%),
    0 8px 20px oklch(47% 0.15 240 / 20%);
}

.progress-track {
  height: 10px;
  border-color: oklch(78% 0.06 233);
  border-radius: 4px;
  background:
    linear-gradient(90deg, oklch(66% 0.1 236 / 10%) 1px, transparent 1px) 0 0 / 16px 100%,
    oklch(91.5% 0.024 231);
  box-shadow: inset 0 1px 3px oklch(41% 0.06 243 / 12%);
}

.progress-fill {
  border-radius: 3px;
  background: linear-gradient(90deg, var(--sky-strong), var(--sky), var(--success));
}

:where(html, body).is-processing .progress-track {
  border-color: oklch(67% 0.12 236);
  background:
    linear-gradient(90deg, oklch(62% 0.12 238 / 12%) 1px, transparent 1px) 0 0 / 18px 100%,
    oklch(91.5% 0.032 231);
  box-shadow:
    inset 0 1px 3px oklch(41% 0.06 243 / 15%),
    0 0 0 2px oklch(65% 0.14 238 / 10%);
}

:where(html, body).is-processing .progress-fill {
  background: linear-gradient(90deg, var(--sky-strong), var(--sky) 58%, var(--success));
  background-size: 180% 100%;
  box-shadow: 0 0 12px oklch(60% 0.16 238 / 32%);
  animation: visual-refresh-progress 1.1s linear infinite;
}

:where(html, body).is-processing .progress-track::after {
  animation-duration: 1.45s;
}

.api-status {
  position: relative;
  margin: 12px 16px;
  border-color: oklch(81% 0.05 233);
  border-radius: 6px;
  background: oklch(97.5% 0.015 229);
  padding: 13px 14px 13px 38px;
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 74%);
}

.api-status::before {
  content: "";
  position: absolute;
  top: 19px;
  left: 16px;
  width: 8px;
  height: 8px;
  border: 2px solid oklch(99% 0.006 225);
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 1px oklch(67% 0.04 236);
}

.api-status > span,
.step-percent,
.pipeline-percent,
.step-result-percent {
  border-radius: 5px;
  background: oklch(94% 0.038 231);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 72%);
}

.api-status[data-state="loading"] {
  border-color: oklch(67% 0.13 237);
  background: oklch(94% 0.044 231);
}

.api-status[data-state="loading"]::before {
  background: var(--sky);
  box-shadow:
    0 0 0 1px oklch(58% 0.15 238),
    0 0 10px oklch(62% 0.18 236 / 48%);
}

.api-status[data-state="success"]::before {
  background: var(--success);
  box-shadow: 0 0 0 1px oklch(56% 0.11 164);
}

.api-status[data-state="error"]::before {
  background: var(--danger);
  box-shadow: 0 0 0 1px oklch(55% 0.15 28);
}

.pipeline {
  gap: 0;
  padding: 0 16px 16px;
}

.pipeline-step {
  min-height: 118px;
  border-color: oklch(84% 0.034 230);
  border-right: 0;
  border-radius: 0;
  background: oklch(98.7% 0.008 226);
  padding: 13px 12px 17px;
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 72%);
}

.pipeline-step:first-child {
  border-radius: 6px 0 0 6px;
}

.pipeline-step:last-child {
  border-right: 1px solid oklch(84% 0.034 230);
  border-radius: 0 6px 6px 0;
}

.pipeline-step h3 {
  margin: 11px 0 6px;
  font-size: 0.92rem;
}

.pipeline-step p {
  font-size: 0.73rem;
  line-height: 1.48;
}

.pipeline-step.active {
  z-index: 1;
  border-color: oklch(65% 0.14 237);
  background: oklch(93.5% 0.05 231);
  box-shadow:
    inset 0 0 0 1px oklch(60% 0.15 238 / 18%),
    inset 0 1px 0 oklch(100% 0 0 / 74%);
  transform: none;
}

.pipeline-step.active::after {
  right: 10px;
  bottom: 7px;
  left: 10px;
  height: 2px;
  border-radius: 1px;
  box-shadow: 0 0 8px oklch(62% 0.16 238 / 38%);
}

.pipeline-step.done {
  border-color: oklch(75% 0.08 164);
  background: oklch(97% 0.022 166);
}

/* Result stream and storyboard workbench */

.workflow-results,
.step-results {
  gap: 10px;
  margin: 0;
  border: 0;
  border-top: 1px solid oklch(87% 0.032 230);
  border-radius: 0;
  background: transparent;
  padding: 0 16px 16px;
}

.step-results > .result-head,
.workflow-results > .result-head {
  margin: 0 -16px 2px;
  padding: 15px 16px;
}

.step-result-list {
  gap: 9px;
}

.step-result-card {
  border-color: oklch(84% 0.034 230);
  border-radius: 6px;
  background: oklch(99% 0.005 225);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 78%);
}

.step-result-card.is-pending {
  background: oklch(97.8% 0.01 228);
}

.step-result-card.is-active {
  border-color: oklch(64% 0.14 237);
  background:
    linear-gradient(90deg, oklch(62% 0.13 237 / 7%) 1px, transparent 1px) 0 0 / 18px 18px,
    oklch(94% 0.044 231);
  box-shadow:
    inset 0 0 0 1px oklch(61% 0.14 238 / 13%),
    0 6px 18px oklch(48% 0.11 240 / 11%);
  transform: none;
}

.step-result-card.is-active::before {
  right: 38px;
  bottom: 6px;
  left: 11px;
  height: 2px;
  border-radius: 1px;
  box-shadow: 0 0 8px oklch(62% 0.16 238 / 36%);
}

.step-result-card.is-done {
  border-color: oklch(76% 0.08 164);
  background: oklch(97.5% 0.02 166);
}

.step-result-head span {
  border-radius: 5px;
  background: oklch(94% 0.04 231);
}

.step-percent,
.pipeline-percent,
.step-result-percent {
  min-width: 48px;
  min-height: 27px;
  border-color: oklch(72% 0.09 235);
  font-size: 0.75rem;
  text-shadow: none;
}

.pipeline-step.active :is(.step-percent, .pipeline-percent, .step-result-percent),
.step-result-card.is-active :is(.step-percent, .pipeline-percent, .step-result-percent) {
  border-color: oklch(52% 0.19 243);
  background: var(--sky-strong);
  text-shadow: none;
  box-shadow:
    inset 0 1px 0 oklch(100% 0 0 / 20%),
    0 4px 12px oklch(48% 0.15 240 / 18%);
}

.storyboard-workbench,
.shot-gallery {
  border-color: oklch(83% 0.04 231);
  border-radius: 6px;
  background:
    linear-gradient(90deg, oklch(63% 0.1 236 / 6%) 1px, transparent 1px) 0 0 / 22px 22px,
    oklch(97.5% 0.015 229);
}

.step-result-card .storyboard-workbench {
  border: 0;
  border-top: 1px solid oklch(86% 0.032 230);
  border-radius: 0;
  background: transparent;
  padding: 12px 0 0;
}

.storyboard-item,
.shot-gallery-card {
  border-color: oklch(83% 0.036 230);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 76%);
}

.storyboard-item.is-running,
.shot-gallery-card.is-running {
  border-color: oklch(64% 0.14 237);
  background: oklch(94.5% 0.042 231);
  box-shadow:
    inset 0 0 0 1px oklch(61% 0.14 238 / 12%),
    0 6px 18px oklch(48% 0.11 240 / 10%);
}

.storyboard-item.is-running::after {
  right: 10px;
  bottom: 6px;
  left: 10px;
  height: 2px;
  border-radius: 1px;
}

.storyboard-shot-title-main,
.storyboard-shot-status,
.shot-gallery-status,
.storyboard-progress-meta strong {
  border-radius: 5px;
}

.storyboard-progress-mini {
  border-radius: 6px;
  background:
    linear-gradient(90deg, oklch(64% 0.1 236 / 6%) 1px, transparent 1px) 0 0 / 14px 14px,
    oklch(97.5% 0.014 229);
}

.storyboard-progress-bar {
  height: 7px;
  border-radius: 3px;
}

.storyboard-progress-fill {
  border-radius: 2px;
}

.storyboard-flow-arrow::before {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: oklch(94% 0.044 231);
  box-shadow:
    inset 0 1px 0 oklch(100% 0 0 / 74%),
    0 5px 14px oklch(48% 0.1 240 / 10%);
}

.storyboard-inline-preview,
.storyboard-video-preview,
.storyboard-inline-empty,
.storyboard-video-empty,
.storyboard-shot-image,
.storyboard-shot-empty,
.result-media figure,
.result-media img,
.result-media video,
.result-media-note,
.result-video-card {
  border-color: oklch(80% 0.05 232);
  border-radius: 5px;
  background: oklch(95.5% 0.018 230);
}

.result-fields section {
  border-color: oklch(85% 0.03 230);
  border-radius: 5px;
  background: oklch(98.8% 0.006 225);
}

.storyboard-button,
.storyboard-final-link,
.result-link,
.result-fields a:not(.result-link),
.result-media a:not(.result-link),
.file-button,
.secondary-action,
.view-button,
.clone-voice-button {
  border-radius: 5px;
}

/* Dialogs and persistent actions */

.case-save-fab {
  min-height: 44px;
  border-radius: 7px;
  background: linear-gradient(180deg, oklch(61% 0.19 236), var(--sky-strong));
  box-shadow:
    inset 0 1px 0 oklch(100% 0 0 / 24%),
    0 12px 28px oklch(45% 0.16 242 / 24%);
}

.case-library-overlay,
.case-save-auth-overlay,
.api-key-overlay {
  background:
    linear-gradient(90deg, oklch(96% 0.015 230 / 5%) 1px, transparent 1px) 0 0 / 24px 24px,
    oklch(20% 0.035 248 / 42%);
  backdrop-filter: none;
}

.case-library-drawer,
.case-save-auth-dialog,
.api-key-dialog,
.image-lightbox-panel {
  border-color: oklch(76% 0.07 233);
  border-radius: 7px;
  background: var(--surface);
  box-shadow:
    0 1px 0 oklch(100% 0 0 / 60%) inset,
    0 26px 70px oklch(20% 0.05 248 / 26%);
}

.case-library-head,
.case-save-auth-head,
.api-key-head {
  border-bottom-color: oklch(85% 0.036 230);
  background:
    linear-gradient(90deg, oklch(64% 0.1 236 / 7%) 1px, transparent 1px) 0 0 / 22px 22px,
    oklch(96.8% 0.022 230);
}

.case-library-close,
.api-key-close,
.image-lightbox-close {
  border-radius: 5px;
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 76%);
}

.case-card,
.case-empty-state {
  border-color: oklch(83% 0.04 231);
  border-radius: 6px;
  background: oklch(98.5% 0.009 227);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 74%);
}

.case-card-cover {
  border-radius: 5px;
}

.case-card-cover::after {
  border-radius: 5px;
  backdrop-filter: none;
}

.case-card-meta span {
  border-radius: 4px;
}

.image-lightbox {
  background: oklch(18% 0.035 248 / 68%);
}

/* Desktop geometry. The 560px intro floor prevents 1280px brand collapse. */

@media (min-width: 1241px) {
  .topbar {
    grid-template-columns: minmax(560px, 0.95fr) minmax(600px, 1.05fr);
    gap: 16px;
  }

  .topbar-intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
  }

  .brand > div:last-child {
    min-width: 260px;
  }

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

  .workspace {
    grid-template-columns: minmax(390px, 420px) minmax(0, 1fr);
    gap: 14px;
    padding-top: 14px;
  }
}

@media (min-width: 1241px) and (max-width: 1380px) {
  .app-shell {
    width: calc(100vw - 24px);
    padding-top: 12px;
  }

  .topbar {
    grid-template-columns: minmax(548px, 0.94fr) minmax(570px, 1.06fr);
    gap: 12px;
  }

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

  .brand > div:last-child {
    min-width: 248px;
  }

  .brand h1 {
    font-size: 1.12rem;
  }

  .brand p:last-child {
    font-size: 0.72rem;
    line-height: 1.34;
  }

  .case-library-entry,
  .api-key-entry {
    min-width: 96px;
    padding: 0 9px;
    font-size: 0.74rem;
  }

  .step-tab {
    padding-right: 7px;
    padding-left: 7px;
  }

  .step-tab span {
    font-size: 0.76rem;
  }

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

@keyframes visual-refresh-progress {
  to {
    background-position: 180% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  :where(html, body).is-processing .progress-fill {
    animation: none;
  }

  .topbar,
  .input-panel,
  .result-panel,
  .case-library-drawer,
  .case-save-auth-dialog,
  .api-key-dialog {
    scroll-behavior: auto;
  }
}
