:root {
  --bg: #1d2b8f; --panel: #24349e; --line: #4256c4; --text: #f6f1e7; --muted: #c3c6ea; --accent: #ffd23f; --on-accent: #141b5c; --input-bg: #172478; --input-line: #7586dc; --pink: #ff4f9a;
  --depth: 0 18px 40px -20px rgba(6, 10, 60, .7);
  color-scheme: dark;
  font: 500 17px/1.55 var(--body-font);
  scrollbar-color: var(--input-line) var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 20px; background: var(--bg) radial-gradient(rgba(246, 241, 231, .06) 1px, transparent 1.6px) 0 0 / 7px 7px; color: var(--text); }
body::before { content: ""; display: block; height: 6px; background: linear-gradient(90deg, var(--pink), var(--accent), #6f7bff, var(--pink)); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
header > span { max-width: 60ch; }
header, footer { padding: 16px 24px; color: var(--muted); display: flex; gap: 16px; align-items: baseline; flex-wrap: wrap; }
footer { font-size: 16px; }
.logo { font-size: 22px; line-height: 1; font-weight: 900; font-stretch: 125%; letter-spacing: -.02em; text-transform: uppercase; text-decoration: none; color: var(--text); margin: 0; text-shadow: .04em .03em 0 var(--pink); }
.logo::after { content: "."; color: var(--accent); }

main { display: grid; grid-template-columns: minmax(380px, 460px) minmax(0, 560px); justify-content: center; gap: 24px; padding: 0 24px 24px; align-items: start; }
@media (max-width: 760px) { main { grid-template-columns: minmax(0, 1fr); padding: 0 16px 16px; } .preview { order: -1; } header, footer { padding-inline: 16px; } .info { padding: 24px 16px; } }

form { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 20px; box-shadow: var(--depth); }
label, .label, legend { font-size: 17px; color: var(--muted); }
label { display: grid; gap: 4px; }
output { color: var(--text); font-variant-numeric: tabular-nums; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; gap: 0; flex-wrap: wrap; }
fieldset label { position: relative; display: block; padding: 8px 18px; min-height: 44px; line-height: 26px; border: 1px solid var(--input-line); margin-left: -1px; cursor: pointer; color: var(--text); }
fieldset label:first-of-type { margin-left: 0; border-radius: 999px 0 0 999px; }
fieldset label:last-of-type { border-radius: 0 999px 999px 0; }
fieldset label:has(:checked) { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 800; z-index: 1; }
fieldset label:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; z-index: 2; }
fieldset input[type=radio] { appearance: none; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
label:has(input[type=range]) { grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 12px; }
label:has(input[type=range]) input { grid-column: 1 / -1; }
output { justify-self: end; }
@media (min-width: 761px) { #controls { grid-template-columns: 1fr 1fr; column-gap: 20px; } #controls > :not(label:has(input[type=range])) { grid-column: 1 / -1; } }
legend { padding: 0; margin-bottom: 6px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > label, select { min-width: 0; max-width: 100%; }

input:not([type=radio], [type=range], [type=color]), select { font: inherit; color: var(--text); background: var(--input-bg); border: 1px solid var(--input-line); border-radius: 14px; padding: 9px 12px; min-height: 44px; }
select { appearance: none; padding-right: 38px; background: var(--input-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23ffd23f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center; cursor: pointer; }
button { font: inherit; color: var(--text); background: transparent; border: 1px solid var(--input-line); border-radius: 999px; padding: 9px 18px; min-height: 44px; transition: transform .15s ease, border-color .15s ease, background-color .15s ease; }
#text { font-size: 20px; width: 100%; }
input[type=range] { width: 100%; accent-color: var(--accent); }
summary::marker { color: var(--accent); }
input[type=color] { width: 56px; height: 44px; padding: 2px; border: 1px solid var(--input-line); border-radius: 14px; background: var(--input-bg); }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 800; }
.row:has(#download) { gap: 8px; }
@media (min-width: 761px) { .row:has(#download) { flex-wrap: wrap; position: sticky; bottom: 0; z-index: 3; background: var(--panel); margin: 0 -20px; padding: 12px 20px; } }
.primary:hover:not(:disabled) { transform: translateY(-2px); }
button:not(.primary):hover:not(:disabled) { border-color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--on-accent); }
input { caret-color: var(--accent); }
a { color: var(--accent); text-underline-offset: .2em; }

#examples button { min-height: 36px; padding: 4px 14px; font-size: 16px; }
#words { display: flex; gap: 6px; flex-wrap: wrap; min-height: 44px; }
#words button[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 800; }

.preview { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; justify-items: center; min-width: 0; max-width: 560px; position: sticky; top: 16px; }
@media (max-width: 760px) { .preview { position: static; } }
.film-label { position: relative; max-width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: 22px; box-shadow: var(--depth); padding: 0 16px 16px; margin: 10px 0; }
.film-strip { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; font-size: 14px; font-weight: 800; font-stretch: 125%; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); white-space: nowrap; }
.film-live { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.film-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.film-live::after { content: "Paused"; }
.preview[data-playing] .film-live { color: var(--pink); }
.preview[data-playing] .film-live::after { content: "Cutting"; }
.reg { position: absolute; width: 18px; height: 18px; border: 0 solid var(--input-line); pointer-events: none; }
.reg-tl { left: -10px; top: -10px; border-width: 0 1px 1px 0; }
.reg-tr { right: -10px; top: -10px; border-width: 0 0 1px 1px; }
.reg-bl { left: -10px; bottom: -10px; border-width: 1px 1px 0 0; }
.reg-br { right: -10px; bottom: -10px; border-width: 1px 0 0 1px; }
.film-label canvas { display: block; }
canvas { max-width: 100%; max-height: calc(100vh - 270px); border-radius: 14px; border: 1px solid var(--line); }
#empty { color: var(--muted); padding: 80px 0; }
#status { margin: 0; min-height: 1.5em; font-size: 16px; }
small { color: var(--muted); }
[hidden] { display: none !important; }

.info { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; padding: 40px 24px; border-top: 3px solid var(--accent); }
.info > div { padding: 24px; border-radius: 22px; background: var(--panel); }
.info h2 { text-shadow: .04em .03em 0 #ff4f9a; font-size: 20px; font-weight: 900; font-stretch: 125%; text-transform: uppercase; letter-spacing: -.01em; margin: 0 0 8px; }
.info ol, .info ul { margin: 0; padding-left: 20px; }
details { border-bottom: 1px solid var(--line); padding: 8px 0; }
summary { cursor: pointer; }
details p { margin: 8px 0 0; color: var(--muted); }
.legal { display: block; max-width: 640px; margin: 0 auto; padding: 24px; }
.legal h1 { font-size: clamp(2.25rem, 6vw, 3.5rem); line-height: 1; font-weight: 900; font-stretch: 125%; text-transform: uppercase; letter-spacing: -.02em; margin: 24px 0 20px; }
.legal p { color: var(--muted); max-width: 65ch; }
.legal p a, .legal p a:visited { color: var(--accent); }

.editor-title { color: var(--text); font-size: 18px; line-height: 1.5; font-weight: 900; font-stretch: 125%; text-transform: uppercase; letter-spacing: -.01em; margin: 0; text-shadow: .04em .03em 0 var(--pink); }
.row:has(#download) button { padding-inline: 14px; white-space: nowrap; }

/* Wide screens: the help column sits beside the work instead of under it. */
.info { align-items: start; }
.info li::marker { color: var(--accent); font-weight: 800; }
@media (min-width: 1280px) {
  body:has(> main #controls) { display: grid; grid-template-columns: minmax(0, 1fr) 300px; column-gap: 8px; align-items: start; }
  body:has(> main #controls)::before, body:has(> main #controls) > header, body:has(> main #controls) > footer { grid-column: 1 / -1; }
  body:has(> main #controls) > main { grid-column: 1; justify-content: end; }
  body:has(> main #controls) > .info { grid-column: 2; grid-template-columns: 1fr; gap: 16px; padding: 0 24px 24px 0; border-top: 0; }
  body:has(> main #controls) > .info > div:first-child { border-top: 3px solid var(--accent); }
}
#examples { align-items: center; }
input[type=color] { cursor: pointer; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 3px; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 999px; }
input[type=color]::-moz-color-swatch { border: 0; border-radius: 999px; }
