/* YMM's 16:9 layout on top of the Dark Cinema stylesheet. */
:root { --preview-width: 100%; }
.shell { grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr); padding: 18px 20px 24px; }
[data-shotstack-studio] { aspect-ratio: 16 / 9; }
#frame { position: relative; }
#stage:fullscreen #frame { width: min(100vw, calc((100vh - 76px) * 16 / 9)); height: auto; aspect-ratio: 16 / 9; }
/* The four steps, always at the top: done steps ticked, the current one highlighted. */
#steps { padding: 10px 20px 0; }
#steps ol { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: none; }
#steps li { min-width: 0; }
#steps button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 6px 12px; color: var(--muted); text-align: left; background: var(--field); border: 1px solid var(--line); border-radius: 12px; }
#steps .dot { display: inline-grid; flex: none; place-items: center; width: 28px; height: 28px; font: 600 14px/1 system-ui, sans-serif; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 50%; }
#steps .step-label { overflow: hidden; font-size: 15px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
#steps button[data-done="true"] { color: var(--text); }
#steps button[data-done="true"] .dot { color: var(--on-gold); background: var(--good); border-color: var(--good); }
#steps button[aria-current="step"] { color: var(--text); background: rgba(214, 170, 110, .12); border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
#steps button[aria-current="step"] .dot { color: var(--on-gold); background: var(--gold); border-color: var(--gold); }
#steps button[aria-current="step"][data-done="true"] .dot { background: var(--good); border-color: var(--gold); }
.step-line { margin: 8px 2px 0; color: var(--muted); font-size: 14px; }
.step-line b { color: var(--gold); }
#step-buttons { display: flex; gap: 10px; }
#step-buttons:empty { display: none; }
#step-buttons button { flex: 1 1 0; min-height: 48px; padding: 8px 14px; font-size: 15px; }
.actions[hidden] { display: none; }

/* Under the video: jump to a text scene, and why the full video cannot play yet. */
#scenes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
#scenes { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; width: 100%; box-sizing: border-box; }
#scenes .scene-button { width: 100%; min-height: 48px; padding: 8px 16px; color: var(--text); font-size: 16px; font-weight: 600; background: rgba(214, 170, 110, .12); border: 1px solid var(--gold); border-radius: 12px; cursor: pointer; }
#scenes .scene-button:hover { background: rgba(214, 170, 110, .22); }
#scenes .scene-button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
#sketch-note { margin: 10px 0 0; padding: 10px 12px; color: var(--text); font-size: 14px; line-height: 1.45; background: rgba(214, 170, 110, .1); border: 1px solid var(--gold); border-radius: 10px; }
#sketch-note[hidden] { display: none; }

.photo-meter { display: grid; gap: 6px; margin-bottom: 12px; }
.photo-meter b { font-size: 15px; }
.photo-meter[data-ready="true"] b { color: var(--good); }
.photo-meter .bar { position: relative; display: block; height: 10px; background: var(--field); border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.photo-meter .fill { position: absolute; inset: 0 auto 0 0; background: var(--gold); transition: width .2s ease; }
.photo-meter[data-ready="true"] .fill { background: var(--good); }
.photo-meter .min-mark { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); opacity: .7; }
.photo-meter small { color: var(--muted); font-size: 12px; }
.song { display: grid; gap: 6px; margin-top: 16px; padding: 12px; background: var(--field); border: 1px solid var(--line); border-radius: 12px; }
.song b { font-size: 14px; }
.song audio { width: 100%; }
.watch-progress { margin: 10px 0; font-size: 15px; }
/* What to do in Preview and Approve, in the same quiet panel as the Favorites note. */
.instructions { display: grid; gap: 8px; margin: 0 0 12px; padding: 12px 14px; font-size: 15px; line-height: 1.5; background: rgba(214, 170, 110, .08); border: 1px solid var(--line-strong); border-radius: 10px; }
.instructions p { margin: 0; }
.wordmark { font: 700 24px/1 var(--serif); }
/* The brand: wordmark with a circled TM, and the copyright line under it. */
.brand { display: inline-grid; gap: 4px; }
.wordmark .tm { display: inline-grid; place-items: center; width: 17px; height: 17px; margin-left: 4px; vertical-align: super; font: 700 7px/1 system-ui, sans-serif; letter-spacing: .02em; color: var(--gold); border: 1px solid var(--gold); border-radius: 50%; }
.copyright { color: var(--muted); font-size: 11px; letter-spacing: .03em; }
#save-state[data-state="saved"] i { background: var(--good); }
#save-state[data-state="saving"] i { background: var(--gold); }
#save-state[data-state="failed"] i { background: var(--bad); }
#save-state[data-state="unsaved"] i { background: transparent; border: 2px solid var(--gold); box-sizing: border-box; }
#save-state[data-state="failed"] { border-color: var(--bad); }
#status button[data-action="retry-save"] { width: auto; min-height: 32px; margin-left: 6px; padding: 4px 14px; }

/* Warnings the customer must act on: too many photos chosen, text that does not fit. */
.upload-warning, .text-warning { margin: 10px 0 0; padding: 10px 12px; color: var(--text); font-size: 14px; line-height: 1.45; background: rgba(214, 92, 74, .14); border: 1px solid var(--bad); border-radius: 10px; }
.text-warning[hidden] { display: none; }
.text-object[data-problem="true"] { border-color: var(--bad); }
.text-object .object-flag { color: var(--bad); font-size: 13px; font-weight: 600; }
.text-object .object-flag:empty { display: none; }

/* As many columns as the panel has room for, never narrower than a card that holds its four controls. */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 148px), 1fr)); gap: 12px; }
.photo-card { container-type: inline-size; display: grid; gap: 8px; min-width: 0; padding: 8px; background: var(--field); border: 2px solid var(--line); border-radius: 12px; }
/* Thumbnails only: the photo itself, its crop and the video are not affected. */
.photo-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: 50% 30%; background: #000; border-radius: 8px; cursor: pointer; }
.photo-card small { overflow: hidden; color: var(--muted); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
/* Favorite across the top, the two Move buttons side by side, Remove below: each labelled in words. */
.photo-card .tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.photo-card button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; width: 100%; min-width: 0; min-height: 40px; padding: 0 6px; color: var(--text); font-size: 14px; font-weight: 600; white-space: nowrap; background: rgba(255, 255, 255, .06); border: 1px solid var(--line-strong); border-radius: 9px; cursor: pointer; }
.photo-card button .icon { font-size: 16px; line-height: 1; }
.photo-card button:hover:not(:disabled) { border-color: var(--gold); background: rgba(214, 170, 110, .12); }
.photo-card button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.photo-card button:disabled { opacity: .35; cursor: not-allowed; }
.photo-card .tool-favorite { grid-column: 1 / -1; color: var(--gold); border-color: var(--gold); }
.photo-card .tool-favorite[aria-pressed="true"] { color: var(--on-gold); background: var(--gold); border-color: var(--gold); }
.photo-card .tool-favorite[data-full="true"] { color: var(--muted); border-color: var(--line-strong); }
.photo-card .tool-remove { grid-column: 1 / -1; color: #f0b3a8; border-color: rgba(214, 92, 74, .55); }
.photo-card .tool-remove:hover:not(:disabled) { color: #fff; background: rgba(214, 92, 74, .25); border-color: var(--bad); }
.photo-card .trash { display: inline-flex; }
.favorites-note { display: grid; gap: 4px; padding: 10px 12px; font-size: 14px; line-height: 1.45; background: rgba(214, 170, 110, .08); border: 1px solid var(--line-strong); border-radius: 10px; }
.favorites-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
.favorite-count { flex: none; color: var(--gold); font-size: 15px; }
.favorites-help { margin: 0; color: var(--muted); font-size: 13px; }
.favorite-limit { margin: 4px 0 0; padding: 8px 10px; color: var(--text); background: rgba(214, 92, 74, .14); border: 1px solid var(--bad); border-radius: 8px; }
/* A narrow card keeps its labels: the Move buttons stack. */
@container (max-width: 150px) {
  .photo-card .tools { grid-template-columns: 1fr; }
}
/* Add Photos: the same warm gold as Approve & Start Production. */
.upload { position: relative; display: grid; justify-items: center; gap: 4px; min-height: 76px; padding: 14px 18px; color: var(--on-gold); text-align: center; background: linear-gradient(180deg, var(--gold), var(--gold-deep)); border: 1px solid var(--gold); border-radius: 14px; box-shadow: 0 6px 18px rgba(201, 143, 85, .22); cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, filter .12s ease; }
.upload:hover { filter: brightness(1.06); box-shadow: 0 8px 24px rgba(201, 143, 85, .35); transform: translateY(-1px); }
.upload:active { transform: translateY(0); }
.upload:focus-within { outline: 3px solid var(--gold); outline-offset: 3px; }
.upload input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-label { display: inline-flex; align-items: center; gap: 10px; font: 600 20px/1.2 var(--serif); }
.upload .plus { display: inline-grid; place-items: center; width: 30px; height: 30px; font: 600 24px/1 system-ui, sans-serif; color: var(--gold); background: var(--on-gold); border-radius: 50%; }
.upload-count { font-size: 14px; opacity: .85; text-wrap: balance; }
.upload[data-full="true"] { color: var(--muted); background: var(--field); border: 1px solid var(--line-strong); box-shadow: none; cursor: default; filter: none; transform: none; }
.upload[data-full="true"] .upload-label { color: var(--text); }
.upload[data-busy="true"], .upload[aria-disabled="true"][data-full="false"] { cursor: progress; filter: saturate(.75); box-shadow: none; transform: none; }
textarea { display: block; width: 100%; min-height: 84px; margin-top: 5px; padding: 9px 12px; color: var(--text); font: inherit; background: var(--field); border: 1px solid var(--line-strong); border-radius: 10px; resize: vertical; }

/* Text: two objects, each with its own look. */
.text-chooser { display: grid; gap: 6px; }
.chooser-label { margin: 0; color: var(--muted); font-size: 13px; }
.text-objects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.text-object { display: grid; gap: 6px; min-width: 0; min-height: 76px; padding: 10px 14px; text-align: left; color: var(--text); background: var(--field); border: 1px solid var(--line-strong); border-radius: 12px; cursor: pointer; }
.text-object .object-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.text-object b { color: var(--muted); font-size: 13px; font-weight: 600; }
.text-object .object-state { color: var(--muted); font-size: 12px; white-space: nowrap; }
.text-object[aria-pressed="true"] .object-state { padding: 2px 8px; color: var(--on-gold); font-weight: 700; background: var(--gold); border-radius: 999px; }
.text-object .object-sample { overflow: hidden; font-size: 20px; line-height: 1.25; white-space: nowrap; text-overflow: ellipsis; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }
.text-object .object-sample[data-tone="dark"] { justify-self: start; max-width: 100%; padding: 0 8px; text-shadow: none; background: #efe3cc; border-radius: 6px; }
.text-object:hover { border-color: var(--gold); }
.text-object[aria-pressed="true"] { background: rgba(214, 170, 110, .1); border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.text-object[aria-pressed="true"] b { color: var(--gold); }
.object-editor { display: grid; gap: 16px; padding: 14px; border: 1px solid var(--gold); border-radius: 12px; }
.object-editor .look { display: grid; gap: 12px; padding-bottom: 0; border-bottom: 0; }
.text-field { display: grid; gap: 8px; }
.edit-heading, .look-heading { margin: 0; color: var(--text); font: 600 20px/1.2 var(--serif); }
.look-heading { padding-top: 14px; border-top: 1px solid var(--line); }
.edit-help { margin: 0; color: var(--muted); font-size: 14px; }
.text-field .top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.text-field .field-label { font-size: 14px; font-weight: 600; }
.text-field .count { color: var(--muted); font-size: 13px; }
.text-field .count[data-full="true"] { color: var(--gold); }
.text-field input[type="text"], .text-field textarea { width: 100%; min-height: 52px; padding: 12px 14px; color: var(--text); font-size: 17px; background: rgba(255, 255, 255, .07); border: 2px solid var(--gold); border-radius: 10px; }
.text-field textarea { min-height: 110px; line-height: 1.45; }
.text-field input[type="text"]:focus, .text-field textarea:focus { outline: 3px solid rgba(214, 170, 110, .45); outline-offset: 1px; }
.text-object .object-sample { font-synthesis: none; }
/* Font, B / I / U and size on one bar; the colour picker below it. */
.format-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(96px, auto); gap: 8px; align-items: stretch; }
.format-bar select { min-width: 0; min-height: 44px; padding: 6px 10px; color: var(--text); font-size: 17px; background: var(--field); border: 1px solid var(--line-strong); border-radius: 10px; }
.format-bar .size-select { font: inherit; font-size: 15px; }
.format-bar select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.format-bar option { color: #1a1612; background: #fff; }
.style-toggles { display: flex; gap: 4px; }
.style-toggle { width: 44px; min-width: 44px; min-height: 44px; padding: 0; color: var(--text); font: 600 18px/1 var(--serif); background: var(--field); border: 1px solid var(--line-strong); border-radius: 10px; }
.style-toggle.style-bold { font-weight: 800; }
.style-toggle.style-italic { font-style: italic; }
.style-toggle.style-underline { text-decoration: underline; }
.style-toggle:hover:not(:disabled) { border-color: var(--gold); }
.style-toggle[aria-pressed="true"] { color: var(--on-gold); background: var(--gold); border-color: var(--gold); }
.style-toggle:disabled { opacity: .3; cursor: not-allowed; }
.color-control { display: grid; gap: 10px; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-picker { flex: none; width: 64px; height: 44px; padding: 3px; background: var(--field); border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; }
.color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker::-webkit-color-swatch { border: 0; border-radius: 7px; }
.color-hex { width: 9.5ch; min-height: 44px; padding: 6px 10px; color: var(--text); font: 500 16px/1 ui-monospace, Consolas, monospace; letter-spacing: .04em; text-transform: uppercase; background: var(--field); border: 1px solid var(--line-strong); border-radius: 10px; }
.color-hex[data-invalid="true"] { border-color: var(--bad); }
.color-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.color-preset { width: 32px; min-width: 32px; height: 32px; min-height: 32px; padding: 0; border: 2px solid rgba(255, 255, 255, .35); border-radius: 50%; }
.color-preset[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--bg, #14110e), 0 0 0 4px var(--gold); }
.contrast-note { margin: 0; padding: 8px 12px; color: var(--text); font-size: 14px; line-height: 1.45; background: rgba(214, 170, 110, .1); border: 1px solid var(--gold); border-radius: 10px; }
.contrast-note[hidden] { display: none; }
@media (max-width: 600px) {
  .format-bar { grid-template-columns: minmax(0, 1fr) minmax(96px, auto); }
  .format-bar .style-toggles { grid-column: 1 / -1; order: 3; }
}

/* On a desktop the editor scrolls inside its column, so the preview and Approve stay in view. */
@media (min-width: 901px) {
  .shell { height: calc(100dvh - 66px - 92px); grid-template-rows: minmax(0, 1fr); align-items: stretch; padding-bottom: 16px; }
  #stage { align-self: start; }
  .side { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
  #step-buttons { flex: none; }
  #form { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .actions { flex: none; flex-wrap: nowrap; align-items: center; gap: 16px; }
  .actions p { flex: 1 1 auto; order: -1; flex-basis: auto; text-align: left; }
  .actions button { flex: none; min-height: 52px; padding: 10px 28px; }
}

/* Confirmation before a photo leaves the video. */
dialog.confirm { width: min(420px, calc(100vw - 32px)); padding: 0; color: var(--text); background: var(--card); border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, .6); }
dialog.confirm::backdrop { background: rgba(8, 6, 7, .72); }
dialog.confirm form { display: grid; gap: 12px; padding: 22px; }
dialog.confirm img { width: 100%; max-height: 180px; object-fit: contain; background: #000; border-radius: 10px; }
dialog.confirm h2 { font: 500 24px/1.2 var(--serif); }
dialog.confirm p { color: var(--muted); }
.confirm-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.confirm-actions button { flex: 1 1 140px; min-height: 48px; padding: 10px 18px; font-size: 16px; border-radius: 10px; }
.confirm-actions .danger { color: #fff; background: #a3283a; border: 1px solid #c9485a; }
.confirm-actions .danger:hover { background: #b8303f; }

.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; padding: 22px 28px 40px; }
.gallery-head { padding: 28px 28px 0; }
.gallery-head h2 { font: 500 30px/1.2 var(--serif); }
.gallery-head p { color: var(--muted); }
.style-card { display: grid; gap: 10px; align-content: start; padding: 22px; text-align: left; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.style-card:hover { border-color: var(--gold); }
.style-card[data-current="true"] { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.style-card h3 { font: 500 23px/1.2 var(--serif); }
.style-card p { color: var(--muted); }
.style-card span { color: var(--gold); font-size: 14px; }
.notice { max-width: 560px; margin: 12vh auto; padding: 28px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.notice h2 { margin-bottom: 8px; font: 500 26px/1.2 var(--serif); }
.notice p { color: var(--muted); }
/* The page "Design it" opens at once, while the order and song are checked. */
.opening { text-align: center; }
.spinner { width: 36px; height: 36px; margin: 0 auto 16px; border: 3px solid var(--line-strong); border-top-color: var(--gold); border-radius: 50%; animation: spin .9s linear infinite; }
.spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding: 12px 16px 0; }
  #steps { position: sticky; top: 0; z-index: 5; padding: 8px 16px; background: var(--bg, #141012); }
  #step-buttons { position: sticky; bottom: 0; z-index: 5; padding: 10px 0; background: var(--bg, #141012); }
}
/* On a phone only the current step keeps its name; the others show their number or tick. */
@media (max-width: 600px) {
  #steps ol { grid-template-columns: repeat(4, auto); justify-content: space-between; }
  #steps button { justify-content: center; padding: 6px 8px; }
  #steps button:not([aria-current="step"]) .step-label { display: none; }
  .gallery, .gallery-head { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 480px) {
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 128px), 1fr)); gap: 10px; }
}

/* ---- Buttons, one system for all four steps: rounded, a lift on hover, pressed on click, a clear
   keyboard ring, and a disabled look that cannot be mistaken for a live button. */
#step-buttons button, .actions button, .confirm-actions button, #scenes .scene-button, .panel-body > button.gold, .panel-body > button.ghost, .style-card {
  border-radius: 14px;
  transition: transform .12s ease, box-shadow .15s ease, filter .15s ease, background-color .15s ease, border-color .15s ease;
}
#step-buttons button, .panel-body > button.gold, .panel-body > button.ghost { min-height: 52px; padding: 10px 18px; font-size: 16px; font-weight: 600; }
.panel-body > button.gold, .panel-body > button.ghost { width: 100%; }
.gold { box-shadow: 0 6px 18px rgba(201, 143, 85, .22); }
.gold:hover:not(:disabled) { filter: brightness(1.06); box-shadow: 0 8px 24px rgba(201, 143, 85, .35); transform: translateY(-1px); }
.ghost:hover:not(:disabled) { background: rgba(214, 170, 110, .08); border-color: var(--gold); transform: translateY(-1px); }
.gold:active:not(:disabled), .ghost:active:not(:disabled), #scenes .scene-button:active { transform: translateY(1px); filter: brightness(.96); box-shadow: none; }
.gold:disabled, .ghost:disabled, #scenes .scene-button:disabled { opacity: .45; filter: saturate(.4); box-shadow: none; transform: none; cursor: not-allowed; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, .style-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.chip.end { border-radius: 99px; transition: border-color .15s ease, color .15s ease; }
.chip.end:hover { color: var(--text); border-color: var(--gold); }
.style-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0, 0, 0, .35); }
#form { border-radius: 18px; }
@media (max-width: 900px) {
  #step-buttons { padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 18px rgba(0, 0, 0, .35); }
}
@media (max-width: 600px) {
  .wordmark { font-size: 20px; }
  #step-buttons button { font-size: 15px; padding: 8px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  #step-buttons button, .actions button, .confirm-actions button, #scenes .scene-button, .panel-body > button, .style-card { transition: none; }
  .gold:hover:not(:disabled), .ghost:hover:not(:disabled), .style-card:hover { transform: none; }
}
/* Step 1: what can be uploaded, right above the upload button. */
.upload-info { display: grid; gap: 3px; margin: 12px 0 10px; padding: 12px 14px; font-size: 14px; line-height: 1.45; color: var(--muted); background: rgba(214, 170, 110, .08); border: 1px solid var(--line-strong); border-radius: 14px; }
.upload-info b { color: var(--text); font: 600 17px/1.3 var(--serif); }
