:root {
  --bg: #050607;
  --surface: #101214;
  --surface-2: #171a1d;
  --ink: #f7f4ee;
  --muted: rgba(247, 244, 238, 0.68);
  --faint: rgba(247, 244, 238, 0.42);
  --line: rgba(247, 244, 238, 0.13);
  --accent: #c8ff6a;
  --accent-2: #79b7ff;
  --warn: #ffbd6b;
  --danger: #ff7d8d;
  --text-xs: 10.5px;
  --text-sm: 11.5px;
  --text-md: 12px;
  --text-lg: 13px;
  --text-xl: 15px;
  --text-title: clamp(17px, 1.55vw, 24px);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
button, textarea, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button, input, textarea, select, .scene, .session, .export-item, .job, .pricing, .cost-item, .frame, .video-slide {
  min-width: 0;
}
button:disabled {
  cursor: wait;
  opacity: .62;
}

.app-shell {
  min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) clamp(10px, 2.4vw, 24px) max(14px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 16% 4%, rgba(121, 183, 255, .18), transparent 26%),
    radial-gradient(circle at 78% 8%, rgba(200, 255, 106, .13), transparent 24%),
    linear-gradient(180deg, #070809, #020303 52%, #070809);
}

.topbar {
  position: relative;
  z-index: 5;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand, .top-actions, .credits {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  padding: 4px;
}

.brand strong { display: block; font-size: 15px; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }

.credits, .lang-toggle, .account-button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.055);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.credits { flex-direction: row; }
.credits strong { color: var(--accent); font-size: 15px; }
.lang-toggle { color: var(--ink); }
.account-menu {
  position: relative;
}
.account-button {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 210px;
  color: var(--ink);
}
.account-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-button i {
  color: var(--accent);
  font-style: normal;
  transition: transform .18s ease;
}
.account-menu.open .account-button i {
  transform: rotate(180deg);
}
.account-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(430px, calc(100vw - 28px));
  max-height: calc(100dvh - 88px);
  display: none;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(13, 15, 16, .98);
  box-shadow: 0 28px 90px rgba(0,0,0,.5);
}
.account-menu.open .account-popover {
  display: block;
}

.workspace {
  height: calc(100dvh - 74px);
  min-height: 720px;
  display: grid;
  grid-template-columns: minmax(236px, .48fr) minmax(720px, 2.8fr) minmax(190px, .42fr);
  gap: 12px;
}

.composer, .preview, .inspector {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.026));
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
}

.rail {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 10px;
  overflow: auto;
}

.primary-action, #generateBtn, #refineBtn, #saveBrandBtn, .export-item {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.045);
  color: var(--muted);
  font-weight: 850;
  font-size: 12px;
}

.primary-action, #generateBtn {
  color: #050607;
  background: var(--accent);
  border-color: var(--accent);
}
#generateBtn.is-loading {
  color: #050607;
  background: var(--warn);
  border-color: var(--warn);
}

.composer, .inspector {
  padding: 14px;
  overflow: auto;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.panel-head span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

h1, h2, p { margin: 0; }
h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(17px, 1.55vw, 24px);
  line-height: 1.12;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
h2 {
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.field, .field-grid {
  display: grid;
  gap: 6px;
}
.field + .field, .field-grid + .field, .field + .field-grid { margin-top: 12px; }
.field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}
.composer .field-grid,
.composer .media-tools {
  grid-template-columns: 1fr;
}

.field span {
  color: var(--faint);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1.25;
}

.prompt-suggestions {
  margin: 10px 0 12px;
}
.suggestion-head {
  display: grid;
  gap: 3px;
  margin-bottom: 6px;
}
.suggestion-head strong {
  font-size: 12px;
}
.suggestion-head span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
.suggestion-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 156px;
  overflow: auto;
  padding-right: 2px;
}
.composer .suggestion-list {
  grid-template-columns: 1fr;
  max-height: 132px;
}
.suggestion-list button {
  min-height: 34px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.045);
  text-align: left;
}
.suggestion-list strong {
  display: block;
  color: var(--accent);
  font-size: 11px;
  line-height: 1.15;
  white-space: nowrap;
}
.suggestion-list span {
  display: block;
  min-width: 0;
  margin-top: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-kit {
  margin: 12px 0 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.18);
}
.media-tools {
  display: grid;
  grid-template-columns: 1fr minmax(130px, .45fr) auto;
  align-items: end;
  gap: 8px;
}
.secondary-action {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.055);
  font-size: 11px;
  font-weight: 850;
}
.upload-drop {
  min-height: 66px;
  display: grid;
  place-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 11px;
  border: 1px dashed rgba(247,244,238,.28);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
  text-align: center;
  cursor: pointer;
}
.upload-drop input {
  display: none;
}
.upload-drop strong {
  font-size: 11px;
}
.upload-drop span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}
.media-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.media-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 62px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0,0,0,.24);
}
.media-thumb {
  width: 54px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255,255,255,.08);
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
}
.media-thumb img, .media-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-item strong {
  display: block;
  font-size: 12px;
}
.media-item span {
  display: block;
  max-width: 100%;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.media-item button {
  min-width: 44px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,125,141,.16);
  color: #ffd5da;
  font-size: 10.5px;
  font-weight: 900;
}
.media-item button:hover {
  border-color: rgba(255,125,141,.58);
  background: rgba(255,125,141,.24);
}

textarea, select, input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  background: rgba(0,0,0,.34);
  color: var(--ink);
  padding: 10px;
  line-height: 1.42;
  font-size: 11.5px;
}
textarea { resize: vertical; min-height: 128px; }
#promptInput {
  min-height: 136px;
  font-size: 12px;
  line-height: 1.45;
}
input { min-height: 42px; }
select, input { min-height: 38px; }

.brand-kit {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
#saveBrandBtn { padding: 0 14px; }

.login-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto;
  gap: 8px;
}
.login-row button,
.link-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.055);
  font-size: 12px;
  font-weight: 850;
}
.link-button {
  min-height: 32px;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  text-align: left;
}
.signup-box {
  display: grid;
  gap: 9px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.22);
}
.signup-box[hidden] {
  display: none;
}
.reset-box {
  display: grid;
  gap: 9px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(121,183,255,.28);
  border-radius: 14px;
  background: rgba(121,183,255,.08);
}
.reset-box[hidden] {
  display: none;
}
.reset-box h3 {
  margin: 0;
  font-size: var(--text-lg);
  line-height: 1.25;
}
.reset-box p {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.35;
}
.signup-box h3 {
  margin: 0;
  font-size: var(--text-lg);
  line-height: 1.25;
}
.signup-grid {
  display: grid;
  gap: 8px;
}
.signup-box button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.055);
  font-size: var(--text-md);
  font-weight: 850;
}
.consent-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.35;
}
.consent-row input {
  width: 16px;
  min-height: 16px;
  margin-top: 1px;
}
.account-popover p {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.account-metrics { margin-top: 10px; }
.account-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.preview {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  align-content: start;
  padding: 16px;
  overflow: auto;
}

.preview-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.preview-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}
.preview-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.preview-line span {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.preview-line p {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}
.title-line {
  align-items: flex-start;
}
.preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.preview-actions button {
  min-width: 112px;
  padding-inline: 12px;
}

.progress-wrap {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.work-area {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(330px, 1.05fr) minmax(360px, .95fr);
  gap: 12px;
  align-items: stretch;
}
.progress {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,.08);
}
.progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .35s ease;
}

.frame-grid {
  min-height: 0;
  height: 100%;
  display: block;
  position: relative;
}

.script-editor {
  width: 100%;
  min-height: 0;
  max-height: none;
  height: 100%;
  overflow: auto;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0,0,0,.34);
  color: var(--ink);
  padding: 34px 12px 12px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.frame-grid .empty-storyboard {
  min-height: 100%;
  padding-top: 30px;
}

.script-frame-label {
  position: absolute;
  z-index: 2;
  top: 10px;
  left: 12px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(200,255,106,.14);
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  pointer-events: none;
}

.script-editor:focus {
  border-color: rgba(200,255,106,.68);
  box-shadow: 0 0 0 3px rgba(200,255,106,.08);
}

.script-editor.saved-flash,
.frame-grid.saved-flash {
  animation: savedScriptGlow 1.35s ease;
}

.storyboard-panel {
  min-height: 0;
  margin-top: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.storyboard-panel .panel-head {
  min-height: 34px;
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 8px;
}

.storyboard-actions {
  width: 100%;
  display: grid;
  grid-template-columns: max-content max-content minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.storyboard-panel .primary-action,
.storyboard-panel .secondary-action {
  min-height: 34px;
  padding: 0 9px;
  font-size: 10.5px;
  white-space: nowrap;
}

.storyboard-panel #generateBtn {
  width: 100%;
  min-height: 34px;
  padding: 0 9px;
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.storyboard-panel #saveStoryboardBtn.saved-flash {
  animation: savedButtonGlow 1.35s ease;
}
.storyboard-panel #generateBtn:disabled,
.final-row-actions button:disabled {
  cursor: not-allowed;
  opacity: .48;
  filter: grayscale(.4);
}

.video-error-card {
  border-color: rgba(255, 120, 120, .55);
  background:
    linear-gradient(140deg, rgba(255, 120, 120, .18), rgba(14, 18, 20, .9)),
    var(--panel);
}

.video-error-card strong {
  color: #ffd2d2;
}

.video-error-card small,
.video-error-message,
.final-row-error {
  color: #ffd2d2;
}

@keyframes savedScriptGlow {
  0% {
    border-color: rgba(200,255,106,.92);
    box-shadow: 0 0 0 0 rgba(200,255,106,.36), 0 0 34px rgba(200,255,106,.24);
  }
  55% {
    border-color: rgba(200,255,106,.78);
    box-shadow: 0 0 0 5px rgba(200,255,106,.12), 0 0 28px rgba(200,255,106,.18);
  }
  100% {
    border-color: var(--line);
    box-shadow: none;
  }
}

@keyframes savedButtonGlow {
  0% {
    color: #050607;
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 0 rgba(200,255,106,.42), 0 0 32px rgba(200,255,106,.34);
  }
  55% {
    color: #050607;
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 5px rgba(200,255,106,.13), 0 0 26px rgba(200,255,106,.2);
  }
  100% {
    box-shadow: none;
  }
}

.empty-storyboard {
  grid-column: 1 / -1;
  min-height: 72px;
  display: grid;
  place-items: center;
  margin: 0;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 11.5px;
  text-align: center;
}

.frame {
  position: relative;
  min-height: 184px;
  border: 1px solid transparent;
  border-radius: 12px;
  overflow: hidden;
  padding: 9px;
  background: #151719;
  isolation: isolate;
  transition: border-color .18s ease, transform .18s ease;
}
.frame:hover, .frame.selected {
  border-color: rgba(200,255,106,.82);
  transform: translateY(-1px);
  cursor: pointer;
}
.frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 24%, rgba(255,255,255,.54), transparent 8%),
    linear-gradient(135deg, var(--frame-color), transparent 64%);
  opacity: .84;
  z-index: -1;
}
.frame-index {
  color: rgba(255,255,255,.7);
  font-size: 11px;
  font-weight: 900;
}
.frame strong {
  display: block;
  margin-top: 4px;
  color: #fff;
  font-size: 11.5px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.frame textarea {
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 24px;
  width: auto;
  min-height: 104px;
  max-height: 104px;
  overflow: auto;
  padding: 4px 5px;
  border: 0;
  border-radius: 8px;
  resize: none;
  background: rgba(0,0,0,.16);
  color: rgba(255,255,255,.84);
  font-size: 10px;
  line-height: 1.32;
}
.frame textarea:focus {
  outline: 1px solid rgba(255,255,255,.34);
  background: rgba(0,0,0,.26);
}
.frame small {
  position: absolute;
  left: 9px;
  bottom: 8px;
  color: rgba(255,255,255,.62);
  font-size: 9px;
  text-transform: uppercase;
  font-weight: 900;
}

.actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

.video-result {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  margin-top: 0;
}
.video-result .panel-head {
  min-height: 34px;
  margin-bottom: 8px;
}
.video-meta {
  display: none;
}
.video-stage {
  position: relative;
  min-height: clamp(300px, 48dvh, 520px);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #060708;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.035), 0 18px 60px rgba(0,0,0,.24);
}
.video-slide {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: end;
  gap: 8px;
  padding: 16px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.55), transparent 8%),
    linear-gradient(135deg, var(--frame-color), #111 70%);
  opacity: 0;
  animation: videoSlide 8.4s infinite;
}
.video-slide.active {
  opacity: 1;
  animation: none;
}
.play-badge,
.final-thumb i {
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #050607;
  background: rgba(200,255,106,.94);
  box-shadow: 0 10px 34px rgba(0,0,0,.38);
  font-style: normal;
  font-weight: 950;
}
.play-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 70px;
  height: 70px;
  border: 0;
  transform: translate(-50%, -50%);
  font-size: 24px;
}
.video-slide strong { font-size: clamp(20px, 2vw, 27px); line-height: 1.04; overflow-wrap: anywhere; }
.video-slide span { color: rgba(255,255,255,.82); font-size: 13px; line-height: 1.34; overflow-wrap: anywhere; }
.video-slide small { color: rgba(255,255,255,.68); font-size: 12px; font-weight: 900; }
.real-video {
  width: 100%;
  height: 100%;
  min-height: clamp(300px, 48dvh, 520px);
  display: block;
  object-fit: contain;
  background: #050607;
}
.video-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 9px 12px;
  background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.76));
}
.video-play {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  color: var(--ink);
  font-size: 12px;
  font-weight: 950;
}
.video-play.playing,
.play-badge.playing {
  color: #050607;
  background: var(--accent);
}
.video-timeline {
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,.22);
  cursor: pointer;
}
.video-timeline i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
.video-controls span {
  color: rgba(255,255,255,.84);
  font-size: var(--text-sm);
  font-weight: 850;
  white-space: nowrap;
}
.video-meta {
  display: none;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.video-meta a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 850;
}

@keyframes videoSlide {
  0%, 15% { opacity: 1; transform: scale(1); }
  18%, 100% { opacity: 0; transform: scale(1.02); }
}

.inspector {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}
.inspector section + section { margin-top: 18px; }
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.metrics div {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0,0,0,.24);
}
.metrics strong { color: var(--accent); font-size: 22px; }
.metrics span { color: var(--muted); font-size: 11px; line-height: 1.25; }

ol { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.45; font-size: 13px; }
li + li { margin-top: 7px; }

.scene-list, .session-list, .export-list, .job-list, .pricing-list, .cost-list, .legal-list {
  display: grid;
  gap: 9px;
}
.scene, .session, .export-item, .job, .pricing, .cost-item, .legal-list article {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0,0,0,.26);
  text-align: left;
}
.session.active, .pricing.active { border-color: rgba(200,255,106,.62); }
.scene strong, .session strong, .export-item strong, .job strong, .pricing strong, .cost-item strong, .legal-list strong {
  display: block;
  font-size: 12.5px;
  line-height: 1.28;
  overflow-wrap: anywhere;
}
.scene span, .session span, .export-item span, .job span, .pricing span, .cost-item span, .legal-list span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.scene p, .pricing p, .provider-status p, .cost-item p {
  margin-top: 8px;
  color: rgba(247,244,238,.78);
  font-size: 11.5px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.scene-list {
  gap: 5px;
}
.scene-list .scene {
  min-height: 34px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border-radius: 10px;
}
.scene-list .scene strong {
  overflow: hidden;
  font-size: 11px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scene-list .scene span {
  min-width: 0;
  margin-top: 0;
  overflow: hidden;
  font-size: 10.5px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scene-list .scene p {
  display: none;
}

.pricing button {
  width: 100%;
  min-height: 36px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  font-size: 12px;
  font-weight: 850;
}
.pricing.active button {
  color: #050607;
  background: var(--accent);
  border-color: var(--accent);
}
.pricing.recommended {
  border-color: rgba(200,255,106,.55);
  background: rgba(200,255,106,.08);
}
.pricing.recommended button {
  color: #050607;
  background: var(--accent);
  border-color: var(--accent);
}

.provider-status {
  display: grid;
  gap: 8px;
}
.provider-status span {
  color: var(--muted);
  font-size: 12px;
}
.provider-pill {
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}
.provider-pill.demo {
  color: #050607;
  background: var(--warn);
}
.provider-pill.ready {
  color: #050607;
  background: var(--accent);
}

.company-block div,
.payment-card div {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.35;
}
.company-block strong,
.payment-card strong {
  color: var(--ink);
  font-size: var(--text-md);
}
.payment-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.24);
}
.payment-card img {
  width: 112px;
  height: 112px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  padding: 6px;
}
.payment-card small {
  color: var(--warn);
  font-size: var(--text-xs);
  line-height: 1.3;
}
.billing-status {
  margin-bottom: 10px;
}
.billing-state {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.045);
}
.billing-state strong {
  color: var(--ink);
  font-size: var(--text-md);
}
.billing-state span,
.billing-state small {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.35;
}
.billing-state.pending {
  border-color: rgba(255,211,106,.46);
  background: rgba(255,211,106,.1);
}
.billing-state.pending strong {
  color: var(--warn);
}
.billing-state.activated {
  border-color: rgba(200,255,106,.48);
  background: rgba(200,255,106,.1);
}
.billing-state.activated strong {
  color: var(--accent);
}
.billing-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.billing-flow article {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0,0,0,.2);
}
.billing-flow b {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: var(--muted);
  font-size: 11px;
}
.billing-flow span {
  min-width: 0;
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.25;
}
.billing-flow article.done {
  border-color: rgba(200,255,106,.38);
}
.billing-flow article.done b {
  color: #050607;
  background: var(--accent);
}
.pricing.pending {
  border-color: rgba(255,211,106,.46);
  background: rgba(255,211,106,.08);
}
.pricing small {
  color: var(--warn);
  font-size: var(--text-xs);
  line-height: 1.3;
}
.charge-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 10px 0 0;
  padding: 8px 10px;
  border: 1px solid rgba(200,255,106,.45);
  border-radius: 14px;
  background: rgba(200,255,106,.1);
}
.charge-notice strong {
  color: var(--accent);
  font-size: var(--text-sm);
}
.charge-notice span {
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.35;
}
#generateBtn {
  box-shadow: 0 0 0 3px rgba(200,255,106,.16), 0 12px 34px rgba(200,255,106,.16);
}

@media (max-width: 1180px) {
  .workspace {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
  }
  .preview {
    min-height: 860px;
    overflow: visible;
  }
  .work-area {
    grid-template-columns: 1fr;
  }
  .video-stage, .real-video {
    min-height: 340px;
  }
  .script-editor {
    min-height: 280px;
    height: clamp(280px, 38dvh, 440px);
  }
}

@media (max-width: 620px) {
  .app-shell { padding-inline: 10px; }
  .topbar {
    align-items: flex-start;
    gap: 10px;
  }
  .brand small { display: none; }
  .top-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 7px;
  }
  .credits, .lang-toggle, .account-button { min-height: 34px; padding: 0 9px; }
  .account-button { max-width: 144px; }
  .account-popover {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 64px);
    left: 10px;
    right: 10px;
    width: auto;
    max-height: calc(100dvh - 84px);
  }
  .field-grid, .preview-head, .actions, .metrics, .login-row, .media-tools {
    grid-template-columns: 1fr;
  }
  .charge-notice,
  .payment-card,
  .billing-flow {
    grid-template-columns: 1fr;
  }
  .preview-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .preview-actions button { min-width: 0; }
  .suggestion-list { grid-template-columns: 1fr; }
  .preview {
    min-height: 920px;
    padding: 12px;
  }
  .work-area {
    grid-template-columns: 1fr;
  }
  .video-stage, .real-video {
    min-height: 300px;
  }
  .script-editor {
    min-height: 260px;
    height: 36dvh;
  }
  h1 { font-size: 19px; }
  .video-slide strong { font-size: 21px; }
  .progress-wrap { grid-template-columns: 1fr auto; }
  .progress-wrap span { grid-column: 1 / -1; }
}

.brand strong,
.credits strong {
  font-size: var(--text-xl);
}

.panel-head h2,
.account-block h2,
.inspector h2,
.brand-kit h2 {
  font-size: var(--text-lg);
  line-height: 1.25;
}
.composer .panel-head h2,
.composer .brand-kit h2 {
  font-size: 12px;
}
.composer .panel-head span,
.composer .media-count,
#mediaCount {
  font-size: 11px;
}

.panel-head span,
.preview-line span,
.progress-wrap,
.video-meta,
.account-popover p,
.provider-status span {
  font-size: var(--text-md);
}

.primary-action,
#generateBtn,
#refineBtn,
#saveBrandBtn,
.secondary-action,
.login-row button,
.signup-box button,
.pricing button,
.export-item {
  font-size: var(--text-md);
}
.composer .primary-action,
.composer #saveBrandBtn,
.composer .secondary-action {
  font-size: 11px;
}

.suggestion-list span,
.frame span,
.frame small {
  font-size: var(--text-xs);
}

.suggestion-list strong,
.media-item span,
.metrics span,
.scene span,
.session span,
.export-item span,
.job span,
.pricing span,
.cost-item span,
.legal-list span {
  font-size: var(--text-sm);
}

.media-item strong,
.scene strong,
.session strong,
.export-item strong,
.job strong,
.pricing strong,
.cost-item strong,
.legal-list strong {
  font-size: var(--text-md);
}

.session-list {
  min-height: 0;
  max-height: none;
  display: grid;
  align-content: start;
  overflow: auto;
}
.session-list .session {
  min-height: 0;
}
.final-video-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(0,0,0,.24);
}
.final-video-row.active {
  border-color: rgba(200,255,106,.62);
}

.final-video-row.failed {
  border-color: rgba(255,120,120,.5);
}
.final-video-open {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 0;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  background: transparent;
  text-align: left;
}
.final-row-info {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.final-row-info strong,
.final-row-info small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.final-row-info small {
  color: var(--muted);
  font-size: 10px;
}
.session .final-row-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin-top: 0;
  color: inherit;
  font-size: inherit;
  line-height: 1;
}
.final-row-actions button {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.055);
  color: var(--ink);
  font-size: 10px;
  font-weight: 850;
}
.final-row-actions [data-download-video] {
  border-color: rgba(200,255,106,.55);
  background: rgba(200,255,106,.16);
  color: var(--accent);
}
.final-row-actions [data-download-video]:disabled {
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.045);
  color: var(--muted);
}
.final-row-actions [data-delete-session] {
  border-color: rgba(255,125,141,.45);
  background: rgba(255,125,141,.18);
}
.legal-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.legal-links a {
  min-height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--accent);
  font-size: var(--text-md);
  font-weight: 850;
  text-decoration: none;
  background: rgba(255,255,255,.045);
}
.legal-page {
  width: min(760px, calc(100vw - 28px));
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom));
  color: var(--ink);
}
.legal-page h1 {
  max-width: none;
  margin-bottom: 12px;
}
.legal-page section {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.045);
}
.legal-page p {
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--text-lg);
  line-height: 1.55;
}
.scene-list .scene strong {
  font-size: 11px;
}
.scene-list .scene span {
  font-size: var(--text-xs);
}
