.backdrop[data-scene]:not([data-scene="terrain"]) #terrain,
.backdrop[data-scene-style="film"] #terrain {
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: .9;
}

.backdrop[data-scene]:not([data-scene="terrain"]) :is(.traces, .scan),
.backdrop[data-scene]:not([data-scene="terrain"])::after,
.backdrop[data-scene="none"] #terrain {
    display: none;
}

.animation-preview-shade {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

:is(.backdrop[data-fade], .animation-preview) :is(.backdrop-shade, .animation-preview-shade) {
    opacity: var(--fade-strength, 1);
    --shade-color: var(--fade-color, var(--scene-bg, var(--bg)));
    --shade-half-reach: calc(var(--fade-reach, 70%) / 2);
}

body :where(.backdrop[data-scene]:not([data-scene="terrain"]), .animation-preview:not([data-scene="terrain"])):is(.backdrop, .animation-preview) :is(.backdrop-shade, .animation-preview-shade) {
    background: linear-gradient(90deg, color-mix(in srgb, var(--shade-color) 91%, transparent), color-mix(in srgb, var(--shade-color) 75%, transparent) calc(var(--fade-reach, 70%) * .657), color-mix(in srgb, var(--shade-color) 12%, transparent)),
        linear-gradient(0deg, var(--shade-color), transparent 29%, transparent 80%, color-mix(in srgb, var(--shade-color) 40%, transparent));
}

body :where(body:not([data-page="start"]) .backdrop[data-scene]:not([data-scene="terrain"]), .animation-preview[data-page="inner"]:not([data-scene="terrain"])):is(.backdrop, .animation-preview) :is(.backdrop-shade, .animation-preview-shade) {
    background: linear-gradient(90deg, color-mix(in srgb, var(--shade-color) 98%, transparent), color-mix(in srgb, var(--shade-color) 91%, transparent) calc(var(--fade-reach, 70%) * .7), color-mix(in srgb, var(--shade-color) 44%, transparent));
}

body :where(body[data-page="start"] .backdrop[data-scene="terrain"], .animation-preview[data-scene="terrain"][data-page="start"]):is(.backdrop, .animation-preview) :is(.backdrop-shade, .animation-preview-shade) {
    background: linear-gradient(90deg, var(--shade-color), color-mix(in srgb, var(--shade-color) 85%, transparent) calc(var(--fade-reach, 70%) * .47), color-mix(in srgb, var(--shade-color) 20%, transparent) var(--fade-reach, 70%), color-mix(in srgb, var(--shade-color) 8%, transparent)),
        linear-gradient(0deg, var(--shade-color), transparent 22%, transparent 80%, var(--shade-color));
}

body :where(body:not([data-page="start"]) .backdrop[data-scene="terrain"], .animation-preview[data-scene="terrain"][data-page="inner"]):is(.backdrop, .animation-preview) :is(.backdrop-shade, .animation-preview-shade) {
    background: linear-gradient(90deg, color-mix(in srgb, var(--shade-color) 99%, transparent), color-mix(in srgb, var(--shade-color) 95%, transparent) calc(var(--fade-reach, 70%) * .7857), color-mix(in srgb, var(--shade-color) 60%, transparent));
}

[data-fade="left"] { --fade-direction: to right; }
[data-fade="right"] { --fade-direction: to left; }
[data-fade="top"] { --fade-direction: to bottom; }
[data-fade="bottom"] { --fade-direction: to top; }

body :is(.backdrop, .animation-preview):is([data-fade="left"], [data-fade="right"], [data-fade="top"], [data-fade="bottom"]) :is(.backdrop-shade, .animation-preview-shade) {
    background: linear-gradient(var(--fade-direction), var(--shade-color), transparent var(--fade-reach, 70%));
}

body :is(.backdrop, .animation-preview)[data-fade="center"] :is(.backdrop-shade, .animation-preview-shade) {
    background: radial-gradient(ellipse at center, var(--shade-color), transparent var(--fade-reach, 70%));
}

body :is(.backdrop, .animation-preview)[data-fade="vignette"] :is(.backdrop-shade, .animation-preview-shade) {
    background: radial-gradient(ellipse at center, transparent calc(100% - var(--fade-reach, 70%)), var(--shade-color));
}

body :is(.backdrop, .animation-preview)[data-fade="sides-in"] :is(.backdrop-shade, .animation-preview-shade) {
    background: linear-gradient(90deg, var(--shade-color), transparent var(--shade-half-reach), transparent calc(100% - var(--shade-half-reach)), var(--shade-color));
}

body :is(.backdrop, .animation-preview)[data-fade="sides-out"] :is(.backdrop-shade, .animation-preview-shade) {
    background: linear-gradient(90deg, transparent calc(50% - var(--shade-half-reach)), var(--shade-color) 50%, transparent calc(50% + var(--shade-half-reach)));
}

body :is(.backdrop, .animation-preview)[data-fade="uniform"] :is(.backdrop-shade, .animation-preview-shade) {
    background: var(--shade-color);
}

body :is(.backdrop, .animation-preview):is([data-fade="off"], [data-scene="none"]) :is(.backdrop-shade, .animation-preview-shade) {
    display: none;
}

.backdrop[data-scene="terrain"] .scan {
    display: none;
}

.animation-scene-form,
.animation-transitions {
    margin-block: 1.25rem;
}

.animation-scene-picker {
    max-width: 36rem;
    margin-block-end: 1rem;
}

.animation-preview-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: .75rem 1rem;
    margin-bottom: 1.5rem;
}

.animation-preview-tools > label { min-width: min(100%, 11rem); margin: 0; }
.animation-control-group { border: 1px solid var(--border, #38424e); padding: .65rem .9rem; margin-block: 1rem; }
.animation-control-group summary { font-weight: 700; cursor: pointer; }
.animation-control-group[open] summary { margin-bottom: .8rem; }
.animation-rotation-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr)); gap: .3rem .8rem; border: 0; padding: .5rem 0; }
.animation-rotation-list label { display: flex; flex-direction: row; align-items: center; gap: .45rem; margin: 0; }
.animation-rotation-list input { flex: 0 0 auto; }

.animation-scene-picker small {
    color: var(--muted);
}

.backdrop { background-color: var(--scene-bg, transparent); }
.scene-background-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    pointer-events: none;
}
.animation-preview [data-animation-preview] { position: relative; }

.animation-preview {
    position: relative;
    overflow: hidden;
    margin: 0 0 1.25rem;
    border: 1px solid color-mix(in srgb, var(--red) 42%, transparent);
    background: var(--scene-bg, var(--bg));
}

.animation-preview canvas {
    display: block;
    width: 100%;
    height: clamp(165px, 25vw, 315px);
}

.animation-preview[data-device="mobile"] { width: min(100%, 25rem); }
.animation-preview[data-device="mobile"] canvas { height: auto; aspect-ratio: 9 / 14; }

:is(.backdrop, .animation-preview)[data-scene="nachtschicht"] {
    background: var(--bg) url('/themes/nachtschicht/stadt-hd.webp') 66% center / cover no-repeat;
}
:is(.backdrop, .animation-preview)[data-scene="nachtschicht"] > .scene-background-image { display: none; }
.backdrop[data-scene="nachtschicht"] #terrain { opacity: 1; }
.animation-preview[data-scene="nachtschicht"][data-device="mobile"] { background-position: 71% center; }
@media (max-width: 679px) {
    .backdrop[data-scene="nachtschicht"] { background-position: 71% center; }
}

:is(.backdrop, .animation-preview)[data-scene="nightcity"] {
    --circuit-art: url('/assets/nightcity-leuchtend.webp');
    --circuit-anchor: 50%;
    background: var(--bg) var(--circuit-art) var(--circuit-anchor) center / cover no-repeat;
}
:is(.backdrop, .animation-preview)[data-scene="nightcity"][data-circuit-style="quiet"] {
    --circuit-art: url('/assets/nightcity-dezent.webp');
}
:is(.backdrop, .animation-preview)[data-scene="nightcity"] > .scene-background-image { display: none; }
.backdrop[data-scene="nightcity"] #terrain { opacity: 1; }
.animation-preview[data-scene="nightcity"][data-device="mobile"] { --circuit-anchor: 82%; }
@media (max-width: 679px) {
    .backdrop[data-scene="nightcity"] { --circuit-anchor: 82%; }
}

.animation-preview figcaption {
    position: absolute;
    z-index: 2;
    inset: auto auto .75rem .75rem;
    padding: .35rem .75rem;
    color: var(--ink);
    background: var(--cms-panel);
}

.animation-scene-controls {
    min-inline-size: 0;
    border: 0;
    padding: 0;
    margin: 0 0 1.25rem;
}

.animation-scene-controls legend {
    color: var(--yellow);
    font-size: 1.3rem;
}

.animation-scene-controls p {
    color: var(--muted);
    margin-block: .25rem 1rem;
}

.animation-scene-controls input[type="range"] {
    display: block;
    width: 100%;
    accent-color: var(--yellow);
}

.animation-scene-controls output {
    display: block;
    margin-block-end: .5rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.animation-form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.animation-scene-form .text-button,
.animation-transitions .text-button {
    padding: .5rem .35rem;
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: .2em;
}

.animation-scene-form .text-button:hover,
.animation-transitions .text-button:hover {
    color: var(--yellow);
}

.animation-scene-form [hidden] {
    display: none;
}
