:root { font-family: system-ui, sans-serif; color-scheme: dark; color: #eef6f9; background: #101923; --border: #405968; --surface: #192936; --accent: #8ae0c3; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.shell { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; padding: .6rem clamp(.75rem, 4vw, 2.5rem); border-bottom: 1px solid var(--border); }
.brand { font-weight: 750; font-size: 1.2rem; }
.storage { margin-inline-start: auto; color: #bfd5de; font-size: .88rem; }
#queue-badge { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; padding: 0; border-radius: 50%; background: var(--accent); color: #081f1d; font-weight: 750; font-variant-numeric: tabular-nums; }
#queue-dialog { width: min(calc(100% - 1rem), 27rem); margin-block-start: .65rem; margin-inline: auto clamp(.5rem, 4vw, 2.5rem); }
#queue-items { display: grid; gap: .5rem; list-style: none; margin: 0; padding: 0; }
#queue-items li { display: grid; gap: .25rem; padding: .65rem .75rem; border: 1px solid var(--border); border-radius: .55rem; background: #213747; overflow-wrap: anywhere; }
#queue-items small { color: #bfd5de; }
main { margin: 0 auto; max-width: 82rem; padding: clamp(.75rem, 4vw, 2rem); }
h1 { font-size: clamp(1.5rem, 5vw, 2.5rem); }
h2 { font-size: 1.15rem; margin: 0; }
h3 { margin: .45rem 0; }
button, select { min-height: 44px; font: inherit; color: inherit; padding: .45rem .8rem; background: #213747; border: 1px solid var(--border); border-radius: .55rem; overflow-wrap: anywhere; }
button { cursor: pointer; text-align: start; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.primary { color: #081f1d; background: var(--accent); font-weight: 700; }
.account-brand { color: inherit; text-decoration: none; }
.account-main { max-width: 46rem; }
.account-card { margin-block: clamp(1rem, 5vw, 3rem); padding: clamp(1rem, 5vw, 2rem); background: var(--surface); border: 1px solid var(--border); border-radius: .9rem; }
.account-card h1 { margin: 0 0 1.25rem; }
.account-card a { color: var(--accent); }
.account-form { display: grid; gap: 1rem; }
.account-form label { display: grid; gap: .4rem; font-weight: 600; }
.account-form input { width: 100%; min-width: 0; min-height: 44px; padding: .55rem .7rem; color: inherit; font: inherit; background: #101923; border: 1px solid var(--border); border-radius: .5rem; }
.account-note { margin: 0; color: #bfd5de; font-size: .9rem; line-height: 1.5; }
.account-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.account-actions a { display: inline-flex; align-items: center; min-height: 44px; padding: .45rem .8rem; border: 1px solid var(--border); border-radius: .55rem; color: #221b10; background: #f4d39c; text-decoration: none; font-weight: 650; }
#home { display: grid; justify-items: center; text-align: center; gap: .75rem; }
.dial { position: relative; display: grid; place-items: center; width: min(100%, 27rem, max(14rem, 64dvh)); aspect-ratio: 1; margin: .5rem auto 0; }
.dial-track { position: absolute; inset: 9%; border: 1px dashed #6c8793; border-radius: 50%; }
.dial-marker { position: absolute; top: 9%; translate: 0 -50%; display: grid; place-items: center; width: clamp(2.25rem, 10vw, 3.25rem); aspect-ratio: 1; border-radius: 50%; background: #f4d39c; color: #122429; outline: 2px solid var(--accent); outline-offset: 3px; font: 700 1rem monospace; }
.dial-start { position: relative; display: grid; place-content: center; justify-items: center; gap: .3rem; width: 63%; aspect-ratio: 1; border-radius: 50%; text-align: center; background: var(--accent); color: #081f1d; box-shadow: 0 .6rem 2.5rem #0005; padding: .65rem; }
.dial-start strong { font-size: clamp(.85rem, 4vw, 1.35rem); line-height: 1.16; }
.dial-start small { font-size: clamp(.68rem, 2.5vw, .85rem); }
.dial-description { max-width: 33rem; margin: 0; }
.dial-count { font-variant-numeric: tabular-nums; margin: 0; color: #bfd5de; }
.bar { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.scene-links, .scene-media-actions { margin-block: .75rem; }
.project-gallery { margin-block: .75rem; }
.project-gallery summary { min-height: 44px; padding-block: .65rem; cursor: pointer; }
.gallery-images { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); gap: .65rem; }
.gallery-images figure { min-width: 0; margin: 0; }
.gallery-images img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: .4rem; }
.gallery-images figcaption { margin-block: .3rem; overflow-wrap: anywhere; font-size: .85rem; }
.snapshot-list { margin-top: .75rem; }
.snapshot-list .record { overflow-wrap: anywhere; }
#snapshot-content input { display: block; width: 100%; min-height: 44px; margin-block: .35rem .65rem; font: inherit; }
.heading-row { justify-content: space-between; }
.workspace { max-width: 64rem; }
.frame-workspace { max-width: 76rem; }
.card { min-width: 0; border: 1px solid var(--border); background: var(--surface); padding: clamp(.65rem, 2vw, 1rem); border-radius: .85rem; }
.card { overflow-wrap: anywhere; }
textarea { display: block; width: 100%; min-height: 26rem; resize: vertical; margin: .6rem 0; border: 1px solid var(--border); border-radius: .5rem; padding: .65rem; background: #101923; color: #eef6f9; font: .9rem/1.55 monospace; }
#revision { color: #bfd5de; font-size: .85rem; }
#errors { margin: .6rem 0 1rem; padding: .75rem; background: #482b31; border-radius: .5rem; overflow-wrap: anywhere; }
#errors ul { margin-bottom: 0; padding-inline-start: 1.3rem; }
.play-bar { margin-top: .85rem; padding-bottom: env(safe-area-inset-bottom); }
.step-navigation { position: sticky; bottom: 0; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: .5rem; max-width: 64rem; margin-top: .75rem; padding: .55rem 0 calc(.55rem + env(safe-area-inset-bottom)); background: #101923; border-top: 1px solid var(--border); }
.step-navigation button:first-child { justify-self: start; }
.step-navigation button:last-child { justify-self: end; text-align: end; }
#step-count { color: #bfd5de; font-size: .85rem; font-variant-numeric: tabular-nums; }
.text-field { display: block; margin-top: .8rem; }
.text-field > span { font-weight: 650; }
.text-field textarea { min-height: 5rem; font: inherit; }
.text-field .scene-source { min-height: 18rem; font: .9rem/1.55 monospace; }
.prompt-editor { margin-bottom: .85rem; }
.reference-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: .75rem 1rem; }
.record { margin-block: .8rem; padding-block: .65rem; border-top: 1px solid var(--border); }
.record p { margin: .3rem 0 .6rem; }
.record img, .record video, #media-preview :is(img,video) { display: block; width: 100%; max-height: 14rem; object-fit: contain; border-radius: .5rem; margin-bottom: .65rem; background: #101923; }
.record label { display: flex; align-items: center; gap: .65rem; min-height: 44px; }
.record input[type=checkbox] { width: 1.2rem; height: 1.2rem; }
.record summary { min-height: 44px; padding: .55rem 0; cursor: pointer; }
dialog { width: min(calc(100% - 1rem), 48rem); max-height: calc(100dvh - 1rem); padding: clamp(.65rem, 3vw, 1.25rem); border: 1px solid var(--border); border-radius: 1rem; background: var(--surface); color: inherit; }
dialog::backdrop { background: #03090ed9; }
dialog .heading-row { margin-bottom: 1rem; }
#preview { width: min(calc(100% - 1rem), 68rem); }
#story-dialog { width: min(calc(100% - 1rem), 72rem); }
#story-content { display: grid; gap: .8rem; overflow-x: auto; padding: .2rem; }
.story-card { display: grid; gap: .75rem; padding: .7rem; background: #101923; border: 1px solid var(--border); border-radius: .7rem; scroll-margin: .6rem; overflow-wrap: anywhere; }
.story-card-heading { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: .3rem .65rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }
.story-card-heading h3 { margin: 0; }
.story-frame-editor { overflow-x: auto; }
.story-frame-editor .story-scene { width: min(100%, 60rem); }
.story-frame-editor .story-block-row > .story-media-block { flex-basis: 100%; }
.story-frame-editor .story-media-block > .story-frame-link { justify-self: start; }
.story-ports.story-output-ports { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, max(9rem, calc((100% - .8rem) / 3))), 1fr)); }
.story-output-ports > :not(.story-transition) { grid-column: 1 / -1; }
.story-output-ports > .story-transition { width: 100%; min-width: 0; align-content: start; }
.story-exit-editor h4 { margin-block: 0 .4rem; }
.story-exit-editor { padding: .55rem; border-radius: .5rem; background: color-mix(in srgb, var(--exit-color) 12%, #101923); }
.story-exit-destination { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .5rem; }
.story-exit-destination label { display: grid; gap: .25rem; min-width: 0; }
.story-exit-destination select { min-width: 0; width: 100%; }
.story-exit-thumbnail { width: clamp(3.75rem, 22vw, 6rem); margin: 0; }
.story-exit-thumbnail img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: .35rem; }
.story-exit-thumbnail figcaption { font-size: .7rem; color: #a4bbc9; }
.story-exit-editor summary { cursor: pointer; padding-block: .4rem; }
.story-exit-editor details p { margin-block: .2rem; }
.story-exit-media { margin-block: .35rem; }
.effect-toggles button[aria-pressed="true"] { background: #24565a; border-color: #8ae0c3; color: #eafff9; }
.effect-preview { position: relative; overflow: hidden; border-radius: .5rem; margin-top: .65rem; }
.effect-preview > img { display: block; width: 100%; max-height: 55vh; object-fit: contain; }
.effect-preview .picture-parallax-ground { object-fit: contain; }
.effect-preview.place-campfire { cursor: crosshair; }
#story-block-content select { max-width: 100%; }
.video-stitch-preview img { display: block; width: min(100%, 16rem); max-height: 9rem; object-fit: contain; }
#story-block-content > :is(img, video) { display: block; width: 100%; max-height: 55vh; object-fit: contain; border-radius: .5rem; }
.story-frame-link { border: 0; padding: 0; min-height: 0; background: none; font-weight: inherit; text-decoration: underline; text-underline-offset: .2em; }
.story-block-row { padding: .45rem 0; border-bottom: 1px solid var(--border); cursor: grab; }
.story-block-heading { display: flex; align-items: center; justify-content: space-between; gap: .35rem; font-size: .85rem; }
.story-block-visibility { display: inline-grid; place-items: center; flex: none; width: 2.75rem; min-height: 2.75rem; padding: 0; color: #8ae0c3; }
.story-block-visibility svg { width: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.story-block-visibility[aria-pressed="false"] { color: #a4bbc9; background: transparent; }
.story-visibility-controls { display: grid; justify-items: end; gap: .15rem; }
.story-visibility-feedback { max-width: 10rem; color: #bfd5de; font-size: .72rem; text-align: end; }
.story-visibility-feedback:empty { display: none; }
.story-block-hidden { border-style: dashed; }
.story-block-hidden > :is(img, video) { opacity: .55; }
.story-add-block { display: block; max-width: 100%; margin-block: .35rem; }
.story-frame-color { width: .9rem; aspect-ratio: 1; border: 1px solid #fff5; border-radius: 50%; margin-top: .2rem; }
.story-frame-identifiers { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; grid-column: 1 / -1; color: #bfd5de; }
.story-ending-badge { display: inline-block; padding: .13rem .48rem; border-radius: .35rem; background: #334455; color: #e5eff7; font-size: .8rem; font-weight: 700; }
.story-ending-badge.win { background: #205449; color: #c8ffeb; }
.story-ending-badge.loss { background: #6b313d; color: #ffe3e7; }
.story-flight { border-inline-start: 4px solid #91baff; background: #132236; }
.story-labels { display: flex; gap: .35rem; flex-wrap: wrap; }
.story-kind, .story-animation { display: inline-flex; align-items: center; gap: .3rem; width: fit-content; padding: .15rem .45rem; border-radius: .4rem; }
.story-kind { background: #263f66; color: #dce9ff; font-weight: 700; }
.story-animation { background: #3b3251; color: #f1dcff; }
.story-arrow .story-animation { display: inline-flex; color: #f1dcff; }
.story-mechanics { margin: .25rem 0 0; color: #dce9ff; }
.story-route { display: inline-block; width: fit-content; margin-block: .2rem; padding: .08em .45em; border-radius: .3rem; color: #101923; font-size: .82rem; font-weight: 750; }
.story-route-1 { background: #9dc2ff; }
.story-route-2 { background: #f7bf82; }
.story-flight-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: .4rem; }
.story-flight-mode { padding: .4rem; border: 1px solid var(--border); border-radius: .45rem; }
.story-flight-mode strong { display: block; }
.story-scene-text { margin: .25rem 0; color: #dce9ff; }
.story-card h4 { flex-basis: 100%; margin: .4rem 0 0; color: #bfd5de; }
.story-ports { display: flex; flex-wrap: wrap; align-items: start; gap: .4rem; min-width: 0; }
.story-ports > p { margin: 0; }
.story-scene { display: grid; align-content: start; gap: .4rem; width: min(100%, 28rem); min-width: 0; }
.story-media-block { display: grid; gap: .35rem; min-width: 0; padding: .4rem; border: 1px solid var(--border); border-radius: .5rem; background: #172632; }
.story-media-block > strong { font-size: .85rem; }
.story-media-block > p { margin: 0; }
.story-scene > .story-video-block { width: 50%; justify-self: center; }
.story-transition { display: grid; gap: .3rem; width: min(calc(50% - .2rem), 14rem); min-width: 0; }
[data-direction="vertical"] .story-scene { justify-self: center; }
[data-direction="vertical"] .story-ports { justify-content: center; }
[data-direction="vertical"] .story-card h4 { text-align: center; }
.story-card :is(img, video) { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; border-radius: .45rem; background: #192936; }
.story-arrow { display: block; width: 100%; padding: .45rem; border-inline-start: 3px solid var(--connection-color); }
.story-to { background: color-mix(in srgb, var(--connection-color) 14%, #101923); }
.story-arrow:is(:focus, :hover) { outline: 2px solid var(--connection-color); outline-offset: 1px; }
.story-port-address { display: inline-block; margin-inline-end: .3em; padding: .04em .35em; border-radius: .25rem; background: var(--connection-color); color: #101923; font-size: .82rem; font-weight: 750; }
.story-arrow :is(small, strong) { display: block; margin-top: .2rem; }
.story-arrow::before { content: '↓'; margin-inline-end: .3em; color: var(--connection-color); }
[data-direction="horizontal"] .story-card { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr); min-width: 36rem; }
[data-direction="horizontal"] .story-transition { width: 100%; }
[data-direction="horizontal"] .story-from::before { content: '←'; }
[data-direction="horizontal"] .story-to::before { content: '→'; }
.story-arrow small, .story-badge { color: #bfd5de; }
.story-card .story-ready { color: var(--accent); }
.story-card .story-pending { color: #f4d39c; }
#project-list { display: grid; gap: .5rem; }
.generation-inputs { display: grid; gap: .5rem; margin-block: .8rem; }
.generation-inputs label { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; min-height: 44px; }
.generation-inputs select { max-width: 100%; }
#generation-content button { margin: .25rem .25rem .25rem 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 700px) { #source { min-height: 18rem; } }
