:root {
  color-scheme: dark;
  --ink: #f8f7ff;
  --muted: #c4b8db;
  --paper: #10051f;
  --line: rgba(196, 181, 253, 0.2);
  --accent: #6d28d9;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button,
select,
input {
  min-height: 44px;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button,
.download {
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 12px 16px;
  font-weight: 600;
  background: #160a2c;
  color: var(--ink);
}
button:hover,
.download:hover {
  border-color: #a78bfa;
}
button:disabled {
  cursor: wait;
  opacity: 0.55;
}
:focus-visible {
  outline: 3px solid #c4b5fd;
  outline-offset: 3px;
}
.topbar {
  max-width: 1440px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px 40px;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
}
.brand-mark {
  font-size: 32px;
  line-height: 1;
}
.private-badge {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}
.quiet {
  background: transparent;
  border-color: transparent;
  font-size: 13px;
  padding: 10px;
}
main {
  max-width: 1300px;
  margin: auto;
  padding: 42px 32px;
}
.heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 36px;
}
.eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #c4b5fd;
  margin: 0 0 16px;
}
h1 {
  font-size: clamp(2.25rem, 4.5vw, 4rem);
  line-height: 1.08;
  letter-spacing: -2px;
  font-weight: 600;
  margin: 0;
}
h1 em {
  font-family: Georgia, serif;
  font-weight: 400;
}
.intro {
  max-width: 360px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 15px;
}
.mode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.mode {
  text-align: left;
  display: grid;
  gap: 8px;
  padding: 20px;
  min-width: 0;
}
.mode.selected {
  background: #6d28d9;
  color: white;
  border-color: #a78bfa;
}
.mode-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 30px;
  color: #c4b5fd;
  background: #25133f;
  border-radius: 50%;
  margin-bottom: 10px;
}
.selected .mode-icon {
  background: var(--accent);
  color: var(--ink);
}
.mode strong {
  font-size: 14px;
}
.mode > span:last-child {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.75;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 370px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.panel {
  background: #25133f;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px;
  min-width: 0;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.section-title h2 {
  font-size: 16px;
  margin: 0;
  font-weight: 650;
}
.step {
  font-size: 10px;
  border: 1px solid var(--line);
  padding: 6px;
  border-radius: 50%;
}
.controls .section-title:not(:first-child) {
  padding-top: 26px;
  border-top: 1px solid var(--line);
  margin-top: 24px;
}
label {
  display: block;
  font-weight: 600;
  font-size: 12px;
  margin: 14px 0;
}
small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 6px;
}
input:not([type="range"]),
select {
  width: 100%;
  display: block;
  margin-top: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: #160a2c;
}
input[type="file"] {
  font-size: 12px;
  min-width: 0;
}
input[type="range"] {
  width: 100%;
  margin: 4px 0 0;
  accent-color: #a78bfa;
}
output {
  float: right;
  color: var(--muted);
  font-weight: 400;
}
.fields.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.muted {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.65;
}
.file-field {
  border: 1px dashed #65517f;
  border-radius: 10px;
  padding: 14px;
}
.tip {
  font-size: 12px;
  line-height: 1.6;
  background: #25133f;
  padding: 12px;
  border-radius: 8px;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}
.secondary {
  background: #25133f;
}
.canvas-area {
  background: #10051f;
  min-height: 380px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  padding: 20px;
}
.empty-scene {
  text-align: center;
  padding: 30px 0;
}
.orange-demo {
  display: grid;
  place-items: center;
  width: 148px;
  height: 148px;
  margin: 0 auto 32px;
  color: #47361b;
  font:
    100px Georgia,
    serif;
  border-radius: 48%;
  background: radial-gradient(circle at 30% 25%, #ffc765, #ea8f29 70%);
  box-shadow: 7px 16px 0 #25133f;
  transform: rotate(-8deg);
}
.empty-scene h3 {
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 400;
  margin: 0;
}
.empty-scene p {
  color: var(--muted);
  font-size: 12px;
}
canvas {
  display: block;
  max-width: 100%;
  max-height: 560px;
  width: auto;
  height: auto;
  cursor: crosshair;
  touch-action: manipulation;
}
.timeline-label {
  margin-bottom: 0;
}
.render-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}
.render-actions .primary {
  flex: 1;
}
.preview-column {
  display: grid;
  gap: 18px;
}
.note-card {
  display: flex;
  gap: 16px;
  padding: 6px 8px;
}
.note-card > span {
  color: #c4b5fd;
  font-size: 28px;
}
.note-card h3,
.ai-card h3 {
  font-size: 14px;
  margin: 4px 0 8px;
}
.note-card p,
.ai-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  margin: 0;
}
.ai-card .eyebrow {
  font-size: 9px;
  margin-bottom: 12px;
}
.status-pill {
  display: inline-block;
  padding: 6px 10px;
  background: #25133f;
  border-radius: 20px;
  font-size: 10px;
  margin-top: 16px;
}
#canvas-label {
  margin-left: auto;
}
.job-status {
  margin-top: 20px;
  padding: 16px;
  background: #25133f;
  border-radius: 10px;
}
progress {
  width: 100%;
  accent-color: #a78bfa;
}
#result-video {
  display: block;
  width: 100%;
  max-height: 640px;
  background: #10051f;
  margin-top: 20px;
  border-radius: 10px;
}
.download {
  display: block;
  text-decoration: none;
  text-align: center;
  background: var(--accent);
  margin-top: 12px;
}
.history {
  margin-top: 32px;
}
.history .section-title {
  justify-content: space-between;
  margin-bottom: 0;
}
.job-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 14px 0;
  flex-wrap: wrap;
}
.job-row p {
  margin: 0;
  flex: 1;
  font-size: 13px;
  min-width: 160px;
}
.job-row small {
  margin-top: 5px;
}
.job-row a {
  color: var(--ink);
  font-size: 12px;
}
.key-list {
  padding-left: 18px;
  font-size: 12px;
}
.key-list button {
  font-size: 11px;
  margin-left: 8px;
}
.advanced {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 18px;
  font-size: 12px;
}
.advanced summary {
  cursor: pointer;
  min-height: 44px;
}
.unlock {
  max-width: 650px;
  margin: 28px auto;
  padding: 44px;
}
.unlock .intro {
  max-width: none;
}
.unlock .primary {
  width: 100%;
  margin-top: 18px;
}
.error {
  padding: 18px;
  border: 1px solid #dbb6ac;
  background: #fff0eb;
  color: #842c19;
  border-radius: 10px;
  position: sticky;
  bottom: 16px;
  overflow-wrap: anywhere;
}
footer {
  max-width: 1300px;
  margin: auto;
  padding: 24px 32px 36px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 11px;
  color: var(--muted);
}
@media (max-width: 800px) {
  .topbar {
    padding: 18px 20px;
    gap: 12px;
    flex-wrap: wrap;
  }
  .private-badge {
    display: none;
  }
  #logout {
    margin-left: auto;
  }
  main {
    padding: 28px 16px;
  }
  .heading {
    display: block;
    margin-bottom: 24px;
  }
  .heading .intro {
    margin-bottom: 0;
  }
  .mode-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .mode {
    padding: 14px;
  }
  .mode-icon {
    margin-bottom: 2px;
  }
  .workspace {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .panel {
    padding: 20px;
  }
  .canvas-area {
    min-height: 280px;
    padding: 12px;
  }
  .unlock {
    padding: 26px;
  }
  footer {
    flex-direction: column;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

/* Sakura Meraki palette, shared across the welcome screen and editor. */
body {
  background:
    radial-gradient(ellipse at 8% 10%, #6d28d929, transparent 55%), var(--paper);
}
a {
  color: #c4b5fd;
  text-underline-offset: 5px;
}
.primary,
.download {
  color: #fff;
}
.primary:hover,
.download:hover {
  background: #7c3aed;
}
.brand {
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.brand-mark {
  color: #c4b5fd;
}
.unlock.panel {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.85fr);
  gap: 70px;
  align-items: center;
  max-width: none;
  margin: 0;
  padding: 30px 0 50px;
  background: transparent;
  border: 0;
}
.welcome-story h1 {
  font-weight: 650;
}
.welcome-story h1 span {
  display: block;
  font-size: 0.54em;
  line-height: 1.3;
  letter-spacing: -0.025em;
  margin-top: 22px;
  font-weight: 500;
}
.welcome-story .intro {
  max-width: 450px;
}
.welcome-entry {
  background: #160a2ce6;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 36px;
  box-shadow: 0 24px 80px #0003;
}
.welcome-entry h2 {
  font-size: 2rem;
  letter-spacing: -0.035em;
  margin: 0 0 10px;
}
.welcome-entry .intro {
  margin-top: 0;
}
.welcome-entry form {
  margin-top: 28px;
}
.welcome-entry label {
  font-size: 0.85rem;
}
.welcome-entry input {
  background: #10051f;
  border-color: #65517f;
  min-height: 50px;
}
.welcome-entry .primary {
  width: 100%;
  min-height: 50px;
  margin-top: 16px;
}
.welcome-entry > p:last-child {
  font-size: 0.8rem;
  margin-bottom: 0;
}
.entry-mark {
  color: #c4b5fd;
  font-size: 1.8rem;
  margin-bottom: 30px;
}
.welcome-art {
  max-width: 420px;
  padding: 24px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(125deg, #25133f, #160a2c);
  transform: rotate(-2deg);
  margin: 30px 0;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 20px;
  align-items: center;
}
.welcome-art > span {
  font-size: 3rem;
  text-align: center;
  color: #ddd6fe;
}
.welcome-art > div {
  display: flex;
  height: 60px;
  align-items: center;
  gap: 9px;
}
.welcome-art i {
  flex: 1;
  height: 40%;
  background: linear-gradient(#a78bfa, #6d28d9);
  border-radius: 8px;
}
.welcome-art i:nth-child(2n) {
  height: 75%;
}
.welcome-art i:nth-child(4) {
  height: 100%;
}
.welcome-art p {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0;
}
.welcome-features {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.78rem;
}
.welcome-features li::before {
  content: "✓ ";
  color: #c4b5fd;
}
.error {
  color: #fecaca;
  background: #3c1532;
  border-color: #98526c;
}
@media (max-width: 800px) {
  .unlock.panel {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-top: 0;
  }
  .welcome-art {
    display: none;
  }
  .welcome-entry {
    width: 100%;
    max-width: 560px;
  }
  .entry-mark {
    display: none;
  }
}
@media (max-width: 420px) {
  .welcome-entry {
    padding: 24px;
  }
  .welcome-story h1 {
    letter-spacing: -0.04em;
  }
  .topbar {
    gap: 10px;
  }
}
