:root {
  --bg: #0a0a0a;
  --bg-elevated: #141414;
  --ink: #ffffff;
  --muted: #8e8e93;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --grad-a: #ff9900;
  --grad-b: #ff007f;
  --grad-c: #a020f0;
  --grad: linear-gradient(90deg, var(--grad-a), var(--grad-b), var(--grad-c));
  --accent: #ff2d92;
  --radius: 14px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 1.5rem 1.15rem 4rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.brand {
  margin: 0;
  font-family: Outfit, system-ui, sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pill-pro {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  background: var(--grad);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  border: 0;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.7rem;
  color: var(--muted);
}

h1 {
  margin: 0.35rem 0 0.55rem;
  font-family: Outfit, system-ui, sans-serif;
  font-size: clamp(1.85rem, 5vw, 2.35rem);
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.lede {
  margin: 0 0 1.5rem;
  color: var(--muted);
  line-height: 1.45;
}

form {
  display: grid;
  gap: 0.95rem;
}

label {
  display: grid;
  gap: 0.4rem;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
}

label > span {
  color: var(--ink);
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

input::placeholder,
textarea::placeholder {
  color: rgba(142, 142, 147, 0.85);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(255, 0, 127, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 0, 127, 0.12);
}

.aspect-field {
  margin: 0;
  padding: 0;
  border: 0;
}

.aspect-field legend {
  margin-bottom: 0.4rem;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
}

.aspect-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}

.aspect-options-2 {
  grid-template-columns: repeat(2, 1fr);
}

.aspect-option {
  position: relative;
  display: grid;
  gap: 0.15rem;
  padding: 0.75rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.aspect-option input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.aspect-option span {
  font-weight: 700;
  color: var(--ink);
}

.aspect-option small {
  color: var(--muted);
  font-size: 0.72rem;
}

.aspect-option:has(input:checked) {
  border-color: transparent;
  background:
    linear-gradient(var(--bg-elevated), var(--bg-elevated)) padding-box,
    var(--grad) border-box;
  border: 1.5px solid transparent;
}

.aspect-option:has(input:focus-visible) {
  outline: 2px solid var(--grad-b);
  outline-offset: 2px;
}

button {
  border: 0;
  border-radius: var(--radius-pill);
  padding: 0.95rem 1.25rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 28px rgba(255, 0, 127, 0.22);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
  box-shadow: none;
}

.btn-render {
  margin-top: 0;
  width: 100%;
}

.btn-server {
  width: 100%;
  justify-content: center;
}

.export-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.action-stack {
  display: grid;
  gap: 0.55rem;
}

.action-stack-2 {
  grid-template-columns: 1fr 1fr;
}

.action-stack-2 .progress-host {
  grid-column: 1 / -1;
}

.btn-export {
  width: 100%;
  justify-content: center;
  min-height: 2.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
}

.preview-stage {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

.preview-stage[hidden] {
  display: none !important;
}

.preview-frame-wrap {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  aspect-ratio: 9 / 16;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

.preview-stage[data-aspect="1:1"] .preview-frame-wrap {
  max-width: 420px;
  aspect-ratio: 1 / 1;
}

.preview-stage[data-aspect="16:9"] .preview-frame-wrap {
  max-width: 100%;
  aspect-ratio: 16 / 9;
}

.preview-transport {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
}

.preview-transport input[type="range"] {
  width: 100%;
  accent-color: var(--grad-b);
}

.preview-time {
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 5.5rem;
  text-align: right;
}

.preview-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.progress-host:empty {
  display: none;
}

.render-dock {
  margin-top: 1rem;
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
}

.render-dock[hidden] {
  display: none !important;
}

.render-options {
  display: grid;
  gap: 0.75rem;
}

.render-options > label {
  display: grid;
  gap: 0.35rem;
}

.btn-ghost {
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  box-shadow: none;
}

.btn-ghost:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-tiny {
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
}

.progress {
  margin-top: 0;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-elevated);
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
  font-size: 0.84rem;
}

#progressLabel {
  color: var(--ink);
  font-weight: 600;
}

#progressPct {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--grad);
  transition: width 0.35s ease;
}

.step-list {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.22rem;
}

.step-list li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.step-list li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.step-list li.active {
  color: #ff7ab8;
}

.step-list li.active::before {
  background: var(--grad-b);
  box-shadow: 0 0 0 3px rgba(255, 0, 127, 0.22);
}

.step-list li.done {
  color: rgba(255, 255, 255, 0.75);
}

.step-list li.done::before {
  background: #34d399;
}

.storyboard {
  margin-top: 1.35rem;
  display: grid;
  gap: 0.65rem;
}

.storyboard-head {
  display: grid;
  gap: 0.55rem;
}

.storyboard-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.storyboard-head h2 {
  margin: 0;
  font-family: Outfit, system-ui, sans-serif;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.beat-summary {
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.storyboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.storyboard-actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.3rem;
}

.beat-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.beat-chip {
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  box-shadow: none;
}

.beat-chip.on {
  color: #fff;
  background: rgba(255, 0, 127, 0.18);
  border-color: rgba(255, 0, 127, 0.45);
}

.beat-chip:disabled {
  opacity: 0.9;
  cursor: default;
}

.beat-feat-count {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0 0.15rem;
}

.scene-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

.scene-dur {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}

.scene-duration {
  margin-bottom: 0.4rem;
}

.scene-duration input {
  max-width: 5.5rem;
  padding: 0.5rem 0.65rem;
}

.scene-cards {
  display: grid;
  gap: 0.4rem;
}

.scene-card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}

.scene-card.open {
  border-color: rgba(255, 0, 127, 0.4);
  background: #181018;
}

.scene-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
}

.scene-toggle-main {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
  flex: 1;
}

.scene-title {
  font-family: Outfit, system-ui, sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}

.scene-preview {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scene-card.open .scene-preview {
  display: none;
}

.scene-chevron {
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-top: -2px;
}

.scene-card.open .scene-chevron {
  transform: rotate(-135deg);
  margin-top: 3px;
  border-color: var(--grad-b);
}

.scene-body {
  padding: 0 0.85rem 0.85rem;
}

.scene-fields {
  display: grid;
  gap: 0.5rem;
}

.scene-field-row {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 0.55rem;
}

.scene-field {
  display: grid;
  gap: 0.25rem;
}

.scene-field span {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.scene-field input,
.scene-field textarea {
  padding: 0.55rem 0.7rem;
  font-size: 0.9rem;
}

.status,
.error {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
}

.status {
  background: rgba(255, 0, 127, 0.12);
  color: #ff9acc;
}

.error {
  background: rgba(251, 113, 133, 0.14);
  color: #fb7185;
}

#result {
  margin-top: 1.5rem;
  display: grid;
  gap: 0.8rem;
}

video {
  width: 100%;
  max-height: 70vh;
  border-radius: 18px;
  background: #000;
  border: 1px solid var(--line);
  object-fit: contain;
  justify-self: center;
}

#result[data-aspect="9:16"] video {
  max-width: min(360px, 100%);
  aspect-ratio: 9 / 16;
}

#result[data-aspect="1:1"] video {
  max-width: min(420px, 100%);
  aspect-ratio: 1 / 1;
}

#result[data-aspect="16:9"] video {
  max-width: 100%;
  aspect-ratio: 16 / 9;
}

.download {
  display: inline-flex;
  justify-content: center;
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius-pill);
  text-decoration: none;
  font-weight: 700;
  color: #fff;
  border: 0;
  background: var(--grad);
}

.shots {
  display: grid;
  gap: 0.55rem;
}

.shots-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
}

.file {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  border: 0;
  background: var(--grad);
  color: #fff;
}

.file input {
  display: none;
}

.shots-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  min-height: 0;
}

.opt-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  padding: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
  cursor: pointer;
}

.opt-check input {
  width: auto;
  margin-top: 0.2rem;
  accent-color: var(--grad-b);
}

.opt-check small {
  color: rgba(142, 142, 147, 0.9);
  font-weight: 400;
}

.opt-check[hidden] {
  display: none !important;
}

.logo-upload {
  margin-top: 0.15rem;
}

.logo-row .shot {
  width: 88px;
  height: 88px;
  background: rgba(255, 255, 255, 0.06);
}

.logo-row .shot img {
  object-fit: contain;
  padding: 8px;
}

.logo-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.shot {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

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

.shot button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  box-shadow: none;
}
