/* PicsToFlix Studio — shares the landing page's palette and type. */
:root {
  --paper: #faf7f2;
  --card: #ffffff;
  --ink: #292c2c;
  --muted: #656763;
  --line: #deded5;
  --coral: #ef654b;
  --film: #1f2121;
  --danger: #b42318;
  --radius: 14px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.top {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; }
.brand-mark { color: var(--coral); font-size: 0.85em; }
.brand span:not(.brand-mark) { font-family: var(--serif); font-style: italic; font-weight: 400; }
.brand-dot { color: var(--coral); }

.top { flex-wrap: wrap; gap: 12px; }
.studio-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-left: auto; }
.booth-link { padding: 8px 14px; background: var(--ink); color: white; border-radius: 999px; font-size: 0.85rem; font-weight: 600; }
.booth-link:hover { background: #424747; }
.booth-link:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.booth-name { width: 100%; max-width: 360px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; }
.booth-group { margin: 32px 0; padding: 24px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.booth-slot { margin: 22px 0; }
.booth-slot input[type=file] { display: block; max-width: 100%; margin-top: 12px; }
.booth-slot input::file-selector-button { padding: 8px 12px; margin-right: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); font: inherit; cursor: pointer; }
.booth-photos { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.booth-photos img { width: 100%; height: 140px; object-fit: contain; background: var(--paper); }
.booth-photos p { font-size: 0.8rem; }
.collage-previews { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 20px 0; }
.collage-previews figure { margin: 0; }
.collage-previews img { width: 100%; max-height: 320px; object-fit: contain; background: var(--paper); }
.collage-previews figcaption { font-size: 0.875rem; margin: 8px 0; }
.identity-collages { margin-bottom: 26px; padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.identity-collages h2 { font-size: 1.5rem; }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 20px 80px;
}

h1, h2 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 14px;
}
h1 { font-size: clamp(2.1rem, 6vw, 3.2rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.1rem); }
h1 em, h2 em { color: var(--coral); }

.lede { color: var(--muted); max-width: 52ch; margin: 0 0 30px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
}
.narrow { max-width: 480px; margin: 36px auto 0; }
.center { text-align: center; }
.center .lede { margin: 0 auto; }

/* Form */
.field { margin-bottom: 26px; }
.label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}
.label output { font-weight: 600; color: var(--muted); }
.hint { color: var(--muted); font-size: 0.875rem; margin: 6px 0 0; }

.row { display: flex; gap: 22px; align-items: flex-start; }
.row .grow { flex: 1; min-width: 0; }

textarea, select, .passcode {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
textarea { resize: vertical; min-height: 120px; }
select { width: auto; min-width: 11rem; }
.passcode { font-size: 1.5rem; letter-spacing: 0.35em; text-align: center; margin-bottom: 16px; }

:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
textarea:focus-visible, select:focus-visible, .passcode:focus-visible { outline-offset: 0; border-color: var(--coral); }

input[type="range"] { width: 100%; accent-color: var(--coral); margin: 6px 0 0; }
.ticks { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.8rem; }

/* The first-frame drop target, drawn as a strip of film */
.frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: 0 34px;
  background: var(--film);
  border-radius: 10px;
  color: #f1ede6;
  cursor: pointer;
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.frame::before,
.frame::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 34px;
  background: radial-gradient(circle at center, var(--paper) 0 5px, transparent 5.5px) 0 0 / 34px 28px repeat-y;
}
.frame::before { left: 0; }
.frame::after { right: 0; }
.frame:hover, .frame.dragging { box-shadow: 0 0 0 3px var(--coral); }
.frame:has(input:focus-visible) { outline: 3px solid var(--coral); outline-offset: 2px; }
.frame input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.frame img { display: block; width: 100%; max-height: 420px; object-fit: contain; }
.frame-hint { display: grid; gap: 4px; text-align: center; padding: 24px 0; }
.frame-hint strong { font: 400 1.35rem/1.2 var(--serif); }
.frame-hint span { color: #c9c4b9; font-size: 0.9rem; }

/* Shape: two big choices, with the other ratios opening below */
.choices { display: grid; gap: 10px; }
.choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.choice:has(input:focus-visible) { outline: 3px solid var(--coral); outline-offset: 2px; }
.choice input { margin-top: 4px; accent-color: var(--coral); width: 1.1rem; height: 1.1rem; flex: none; }
.choice-text { display: grid; gap: 2px; }
.choice-text small { color: var(--muted); font-size: 0.875rem; }
.other-shapes { margin-top: 14px; }

/* Photo quality verdict, under the first frame */
.quality {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 10px;
  background: var(--card);
}
.quality-title { margin: 0; font-weight: 600; }
.quality-title::before { margin-right: 8px; font-weight: 700; }
.quality-issues { margin: 6px 0 0; padding-left: 1.2rem; }
.quality-tip { margin: 8px 0 0; color: var(--muted); font-size: 0.9rem; }
.quality-replace { margin-top: 12px; padding: 11px 18px; font-size: 0.95rem; }
.quality.is-ok { border-left-color: #2f7d4f; }
.quality.is-ok .quality-title::before { content: "✓"; color: #2f7d4f; }
.quality.is-warn { border-left-color: #b7791f; }
.quality.is-warn .quality-title::before { content: "!"; color: #b7791f; }
.quality.is-block { border-left-color: var(--danger); background: #fdf3f1; }
.quality.is-block .quality-title { color: var(--danger); }
.quality.is-block .quality-title::before { content: "✕"; color: var(--danger); }
.quality:focus-visible { outline-offset: 2px; }
#generate.is-blocked { opacity: 0.55; }

/* Crop position, shown only when the picture is cropped to the video's shape */
.crop { margin-top: 14px; }
.crop .label { margin-bottom: 4px; }
.crop .label output { font-weight: 400; color: var(--muted); font-size: 0.9rem; }
.crop .hint { margin-top: 4px; }

/* Story mode: the cast and places */
.cast-hint { margin: 0 0 14px; max-width: 60ch; }
.cast-groups { display: grid; gap: 20px; margin-bottom: 14px; }
.cast-group-head { position: relative; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cast-group-title { font-weight: 600; }
.cast-slots { color: var(--muted); font-size: 0.85rem; }
.tip-wrap { display: inline-flex; }
.cast-list:empty { display: none; }
.cast-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.cast-item {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 8px 14px;
  align-items: start;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 10px;
}
.cast-item.is-ok { border-left-color: #2f7d4f; }
.cast-item.is-warn { border-left-color: #b7791f; }
.cast-item.is-block { border-left-color: var(--danger); background: #fdf3f1; }
.cast-photo { position: relative; width: 84px; height: 84px; grid-row: span 2; }
.cast-thumb { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 8px; background: var(--film); }
.cast-tag {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(31, 33, 33, 0.82);
  color: #fff;
  font: 600 0.7rem/1.4 var(--sans);
  letter-spacing: 0.01em;
}

/* The info icon beside "Cast & places" and its tip */
.cast-label-row { position: relative; justify-content: flex-start; }
.label-text { display: inline-flex; align-items: center; gap: 8px; }
.info {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1.5px solid var(--muted);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font: italic 700 0.8rem/1 var(--serif);
  cursor: pointer;
}
.info:hover, .info[aria-expanded="true"] { color: var(--ink); border-color: var(--ink); }
.tip {
  position: absolute;
  z-index: 10;
  top: calc(100% + 6px);
  left: 0;
  width: min(380px, calc(100vw - 40px));
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(31, 33, 33, 0.18);
  font-weight: 400;
  font-size: 0.9rem;
  line-height: 1.5;
}
.tip-title { margin: 0 0 6px; font-weight: 600; }
.tip ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 6px; }
.tip code { font: 0.85em ui-monospace, Menlo, Consolas, monospace; background: var(--paper); padding: 1px 4px; border-radius: 4px; }
.cast-fields { display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }
.cast-fields input[type="text"] {
  flex: 1 1 9rem;
  min-width: 0;
  font: inherit;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
}
.cast-fields input[type="text"]:focus-visible { outline-offset: 0; border-color: var(--coral); }
.cast-fields select { min-width: 0; width: auto; padding: 9px 11px; border-radius: 8px; }
.cast-note { grid-column: 2 / 4; margin: 0; font-size: 0.875rem; color: var(--muted); }
.cast-item.is-block .cast-note { color: var(--danger); font-weight: 500; }
.cast-item.is-warn .cast-note { color: #8a5a12; }
.cast-remove { padding: 6px 4px; align-self: start; }
.continue {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 14px;
  align-items: start;
  margin: 0 0 12px;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--coral);
  border-radius: 10px;
}
.continue .hint { margin: 2px 0 8px; }
.continue .check { margin: 0; }
.continue .cast-photo { grid-row: auto; }
.cast-add {
  position: relative;
  display: grid;
  gap: 2px;
  justify-items: center;
  padding: 14px 16px;
  border: 2px dashed var(--line);
  border-radius: 10px;
  background: var(--card);
  text-align: center;
  cursor: pointer;
}
.cast-add span { color: var(--muted); font-size: 0.875rem; }
.cast-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cast-add:hover, .cast-add.dragging { border-color: var(--coral); }
.cast-add:has(input:focus-visible) { outline: 3px solid var(--coral); outline-offset: 2px; }
.cast-add[aria-disabled="true"] { opacity: 0.5; cursor: default; }
.cast-warning {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-left: 4px solid #b7791f;
  border-radius: 8px;
  background: #fff8ec;
  font-size: 0.9rem;
}

/* Template picker */
#template { width: 100%; }
#template-blurb { margin-top: 8px; max-width: 60ch; }

/* Story builder */
.story {
  margin: 4px 0 28px;
  padding: 24px 22px 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.story h2 { font-size: 1.5rem; margin-bottom: 8px; }
.story-hint { max-width: 60ch; margin: 0 0 24px; }
.story textarea { background: var(--paper); }
.sub { font: 600 1.05rem/1.3 var(--sans); margin: 0 0 8px; }
.sub label { cursor: pointer; }
.optional { font-weight: 400; font-size: 0.85rem; color: var(--muted); }

/* One shot: a timecode on a coral rule, like a film's shot list */
.shots { list-style: none; margin: 0 0 26px; padding: 0; display: grid; gap: 16px; }
.shot { padding-left: 14px; border-left: 3px solid var(--coral); }
.shot-top { position: relative; display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.shot-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-weight: 600;
}
.shot-time { font: 400 0.95rem/1 var(--serif); color: var(--muted); font-variant-numeric: tabular-nums; }
.shot-secs { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-variant-numeric: tabular-nums; }
.shot-len {
  width: 4.4rem;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
}
.shot-len:focus-visible { outline-offset: 0; border-color: var(--coral); }
.shot-len:disabled { opacity: 0.6; }
.shot textarea { min-height: 84px; }
.shot-words { margin: 4px 0 0; }
#shot-split.is-off { color: var(--danger); font-weight: 500; }
.sums-off .shot-len { border-color: var(--danger); }
#shot-reset { margin: 6px 0 0 -4px; font-size: 0.9rem; }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 20px; cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--coral); width: 1.1rem; height: 1.1rem; flex: none; }

.full-prompt { margin: 0 0 20px; color: var(--muted); font-size: 0.9rem; }
.full-prompt summary { cursor: pointer; width: fit-content; }
.full-prompt summary:hover { color: var(--ink); }
.full-prompt pre {
  margin: 10px 0 0;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  font: 0.85rem/1.55 var(--sans);
  color: var(--ink);
  background: var(--paper);
  border-radius: 10px;
}

/* Story mode: scenes so far, the choice after a scene, and the final join */
.tray { margin: 0 0 28px; padding: 18px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.tray h2 { font-size: 1.3rem; margin-bottom: 12px; }
.tray-list, .finale-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.tray-list { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.tray-item { display: grid; gap: 4px; font-size: 0.875rem; color: var(--muted); }
.tray-item video { width: 100%; aspect-ratio: 9 / 16; max-height: 150px; object-fit: cover; border-radius: 8px; background: var(--film); }
.tray-item strong { color: var(--ink); font-weight: 600; }

.scene-actions { margin: 0 0 20px; padding: 18px 20px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--coral); border-radius: var(--radius); }
.scene-ask { margin: 0 0 14px; font-weight: 600; }
.scene-actions .link { margin-top: 10px; }

.finale-list { margin-top: 22px; }
.finale-item {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px 16px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.finale-item video { width: 96px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 8px; background: var(--film); grid-row: span 2; }
.finale-item.wide video { aspect-ratio: 16 / 9; }
.finale-meta { font-weight: 600; align-self: end; }
.finale-meta span { font-weight: 400; color: var(--muted); }
.finale-tools { display: flex; gap: 4px 14px; flex-wrap: wrap; align-self: start; }
.finale-tools .link, .finale-tools a { font-size: 0.9rem; color: var(--muted); text-decoration: underline; padding: 6px 0; }
.finale-tools .link:disabled { opacity: 0.4; cursor: default; text-decoration: none; }
.combine-status { margin: 16px 0 0; }
.combined { margin-top: 32px; }
.finale-foot { margin: 28px 0 0; }
#download.secondary { text-decoration: none; }
a.primary, a.secondary { text-decoration: none; }

/* Buttons: dark like the landing page's primary actions; coral is for accents. */
.primary, .secondary {
  display: inline-block;
  font: 600 1rem/1 var(--sans);
  padding: 15px 24px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  cursor: pointer;
  text-align: center;
}
.primary { background: var(--ink); color: #fff; }
.primary:hover { background: #000; }
.primary:disabled { opacity: 0.6; cursor: wait; }
.secondary { background: transparent; color: var(--ink); }
.secondary:hover { background: var(--card); }
form > .primary { width: 100%; }
.link { background: none; border: 0; padding: 4px; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; }
.link:hover { color: var(--ink); }

.error { color: var(--danger); font-weight: 500; margin: 0 0 16px; }

/* Progress: a film leader countdown */
.leader {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: var(--film);
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 6px var(--film), inset 0 0 0 8px #4a4d4d;
  overflow: hidden;
}
.leader::before, .leader::after { content: ""; position: absolute; background: #4a4d4d; }
.leader::before { left: 50%; top: 8px; bottom: 8px; width: 1px; }
.leader::after { top: 50%; left: 8px; right: 8px; height: 1px; }
.sweep {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(239, 101, 75, 0.6), rgba(239, 101, 75, 0) 70%);
  animation: sweep 2.4s linear infinite;
}
.leader-time {
  position: relative;
  z-index: 1;
  font: 400 1.9rem/1 var(--serif);
  color: #fff;
  background: var(--film);
  padding: 8px 10px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}
@keyframes sweep { to { transform: rotate(360deg); } }

/* Result */
.music-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.music-picker > div { min-width: 0; }
.music-picker select { width: 100%; min-width: 0; max-width: 100%; }
.music-filter { margin-top: 14px; font-size: 0.85rem; }
.music-license { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.music-license p { margin: 4px 0; }
.music-picker .label { font-size: 0.875rem; margin-top: 12px; }
.music-preview { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 0 14px 14px; }
.music-preview audio { width: 100%; }
.music-preview input { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
#music-upload { display: block; max-width: 100%; }
.music-credit { overflow-wrap: anywhere; white-space: pre-wrap; user-select: text; }
.music-credit:empty { display: none; }
.screen { background: var(--film); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
.screen video { display: block; width: 100%; max-height: min(62vh, 620px); background: var(--film); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }

@media (max-width: 560px) {
  .music-picker { grid-template-columns: 1fr; }
  .panel { padding: 22px 18px; }
  .row { flex-direction: column; align-items: stretch; gap: 0; }
  select { width: 100%; }
  .story { padding: 20px 16px 4px; }
  .shot textarea { min-height: 132px; }
  #style { min-height: 170px; }
  .frame { min-height: 200px; }
  .cast-item { grid-template-columns: 68px 1fr auto; gap: 8px 12px; }
  .cast-photo { width: 68px; height: 68px; }
  .continue { grid-template-columns: 68px 1fr; gap: 12px; }
  .cast-photo { grid-row: auto; }
  .cast-note { grid-column: 1 / 4; }
  .cast-fields select { flex: 1 1 100%; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .sweep { animation-duration: 12s; }
  .frame { transition: none; }
}
