:root {
    color-scheme: dark;
    --bg: #07090d;
    --panel: #11151d;
    --panel-soft: #171c26;
    --text: #f4f5f7;
    --muted: #aeb6c3;
    --line: #303746;
    --accent: #d6aa52;
    --accent-strong: #f2ca78;
    --danger: #ff9e9e;
    --focus: #9fc8ff;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    margin: 0;
    min-width: 320px;
}

button,
select,
input {
    font: inherit;
}

button,
select {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: .65rem;
    color: var(--text);
}

button {
    cursor: pointer;
    min-height: 2.75rem;
    padding: .65rem 1rem;
}

button:hover {
    border-color: var(--accent);
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #171107;
    font-weight: 700;
}

.cinematic-app {
    margin: 0 auto;
    max-width: 1500px;
    padding: 1rem clamp(.75rem, 3vw, 2.5rem) 2rem;
}

.cinematic-header {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.cinematic-header h1,
.settings-dialog h2,
.idle-dialog h2 {
    font-weight: 650;
    margin: 0;
}

.cinematic-header h1 {
    font-size: clamp(1.45rem, 3vw, 2.2rem);
}

.eyebrow {
    color: var(--accent-strong);
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .12em;
    margin: 0 0 .25rem;
    text-transform: uppercase;
}

.header-actions {
    align-items: center;
    display: flex;
    gap: .75rem;
}

.connection-state {
    color: var(--muted);
    font-size: .9rem;
    text-align: right;
}

.connection-state.error {
    color: var(--danger);
}

.icon-button {
    align-items: center;
    display: inline-flex;
    gap: .45rem;
    justify-content: center;
}

.icon-button svg {
    height: 1.2rem;
    width: 1.2rem;
}

.stage-shell {
    align-items: center;
    display: flex;
    justify-content: center;
}

.stage {
    aspect-ratio: 16 / 9;
    background: #020304;
    max-height: calc(100vh - 13rem);
    min-height: 280px;
    overflow: hidden;
    position: relative;
    touch-action: pan-y pinch-zoom;
    width: 100%;
}

.stage:fullscreen {
    height: 100vh;
    max-height: none;
    width: 100vw;
    max-width: none !important;
    aspect-ratio: auto !important;
}

.stage-layer {
    inset: 0;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    transform: translateX(0) scale(1);
    transition: opacity var(--transition-ms, 1000ms) ease,
        transform var(--transition-ms, 1000ms) cubic-bezier(.2, .72, .2, 1);
}

.stage-layer.active {
    opacity: 1;
    z-index: 2;
}

.stage.transition-slide .stage-layer.slide-enter-forward {
    transform: translateX(8%) scale(1.015);
}

.stage.transition-slide .stage-layer.active.slide-enter-forward {
    transform: translateX(0) scale(1);
}

.stage.transition-slide .stage-layer.slide-exit-forward {
    transform: translateX(-4%) scale(.992);
}

.stage.transition-slide .stage-layer.slide-enter-backward {
    transform: translateX(-8%) scale(1.015);
}

.stage.transition-slide .stage-layer.active.slide-enter-backward {
    transform: translateX(0) scale(1);
}

.stage.transition-slide .stage-layer.slide-exit-backward {
    transform: translateX(4%) scale(.992);
}

.camera-flash {
    background:
        radial-gradient(circle at 52% 44%, rgba(255, 255, 255, .9) 0, rgba(225, 238, 255, .56) 26%, rgba(255, 255, 255, 0) 68%),
        linear-gradient(120deg, rgba(255, 255, 255, .28), rgba(214, 232, 255, .08));
    box-shadow: inset 0 0 16vmax rgba(255, 255, 255, .14);
    inset: 0;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    will-change: opacity;
    z-index: 5;
}

.stage.motion-off .camera-flash {
    display: none;
}

.camera-flash.active {
    animation: camera-pop 170ms cubic-bezier(.12, .78, .18, 1) both;
}

@keyframes camera-pop {
    0% { opacity: 0; }
    8% { opacity: .72; }
    34% { opacity: .38; }
    68% { opacity: .09; }
    100% { opacity: 0; }
}


.stage-backdrop,
.stage-image {
    height: 100%;
    inset: 0;
    position: absolute;
    width: 100%;
}

.stage-backdrop {
    filter: blur(24px) saturate(.72) brightness(.72);
    object-fit: cover;
    opacity: .72;
    transform: scale(1.1);
}

.stage-image {
    object-fit: cover;
    will-change: transform;
}

.stage-layer.motion-landscape .stage-image {
    animation: drift-landscape var(--slide-duration, 8000ms) ease-in-out both;
}

.stage-layer.motion-portrait .stage-image {
    animation: drift-portrait var(--slide-duration, 8000ms) ease-in-out both;
}

.stage-layer.motion-square .stage-image {
    animation: drift-square var(--slide-duration, 8000ms) ease-in-out both;
}

.stage.paused .stage-image,
.stage.motion-off .stage-image {
    animation-play-state: paused;
}

.stage.motion-off .stage-image {
    animation: none !important;
}

.stage.motion-cinematic .stage-layer.motion-landscape .stage-image {
    animation-name: drift-landscape-strong;
}

.stage.motion-cinematic .stage-layer.motion-portrait .stage-image {
    animation-name: drift-portrait-strong;
}

.stage-status {
    inset: 0;
    pointer-events: none;
    position: absolute;
    z-index: 7;
}

.stage-status span {
    backdrop-filter: blur(10px);
    background: rgba(5, 8, 12, .76);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
    font-size: .8rem;
    padding: .35rem .65rem;
    position: absolute;
    white-space: nowrap;
}

#playlist-mode {
    left: .85rem;
    top: .85rem;
}

#buffer-status {
    bottom: .85rem;
    right: .85rem;
}

.stage.buffer-top-right #buffer-status {
    bottom: auto;
    top: .85rem;
}

.stage.buffer-hidden #buffer-status {
    display: none;
}

.stage.buffer-bottom-right .caption {
    padding-right: clamp(8rem, 20vw, 10.5rem);
}

.caption {
    backdrop-filter: blur(13px);
    background: linear-gradient(0deg, rgba(4, 6, 10, .94), rgba(4, 6, 10, .64));
    bottom: 0;
    left: 0;
    padding: .9rem clamp(.8rem, 3vw, 1.5rem);
    position: absolute;
    right: 0;
    z-index: 6;
}

.caption strong,
.caption span {
    display: block;
}

.caption span {
    color: var(--muted);
    font-size: .86rem;
    margin-top: .2rem;
}

.caption[hidden],
.stage-message[hidden] {
    display: none;
}

.stage-message {
    background: rgba(5, 8, 12, .88);
    border: 1px solid var(--line);
    border-radius: .8rem;
    left: 50%;
    max-width: min(32rem, calc(100% - 2rem));
    padding: 1rem;
    position: absolute;
    text-align: center;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 8;
}

.transport {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    justify-content: center;
    margin-top: .8rem;
}

.position {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    min-width: 5rem;
    text-align: center;
}

#slide-progress {
    display: block;
    height: .42rem;
    margin: .8rem 0 0;
    width: 100%;
}

.current-detail {
    color: var(--muted);
    font-size: .86rem;
    margin: .65rem auto 0;
    max-width: 70rem;
    min-height: 1.3rem;
    text-align: center;
}

dialog {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 1rem;
    color: var(--text);
    max-height: calc(100vh - 2rem);
    max-width: min(54rem, calc(100vw - 2rem));
    padding: 0;
    width: 100%;
}

dialog::backdrop {
    backdrop-filter: blur(5px);
    background: rgba(0, 0, 0, .72);
}

.settings-dialog form,
.idle-dialog {
    padding: clamp(1rem, 3vw, 1.5rem);
}

.dialog-heading {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.1rem;
}

.close-button {
    font-size: 1.45rem;
    min-width: 2.75rem;
    padding: .35rem;
}

.settings-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-grid label {
    color: var(--muted);
    display: grid;
    font-size: .86rem;
    gap: .38rem;
}

.settings-grid select,
.settings-grid input[type="range"] {
    min-height: 2.75rem;
    width: 100%;
}

.settings-grid select {
    padding: .55rem .7rem;
}

.settings-grid output {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.switches {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    margin-top: 1.2rem;
}

.switches label {
    align-items: center;
    display: inline-flex;
    gap: .5rem;
}

.settings-note {
    color: var(--muted);
    font-size: .86rem;
    margin: 1rem 0 0;
}

.dialog-actions {
    display: flex;
    gap: .7rem;
    justify-content: flex-end;
    margin-top: 1.2rem;
}

.idle-dialog {
    max-width: min(30rem, calc(100vw - 2rem));
}

.idle-dialog p {
    color: var(--muted);
}

@keyframes drift-landscape {
    from { transform: scale(1.035) translateX(-.9%); }
    to { transform: scale(1.085) translateX(.9%); }
}

@keyframes drift-portrait {
    from { transform: scale(1.02) translateY(.8%); }
    to { transform: scale(1.065) translateY(-.8%); }
}

@keyframes drift-square {
    from { transform: scale(1.025); }
    to { transform: scale(1.075); }
}

@keyframes drift-landscape-strong {
    from { transform: scale(1.045) translateX(-1.5%); }
    to { transform: scale(1.12) translateX(1.5%); }
}

@keyframes drift-portrait-strong {
    from { transform: scale(1.03) translateY(1.2%); }
    to { transform: scale(1.1) translateY(-1.2%); }
}

@media (prefers-reduced-motion: reduce) {
    .stage-layer {
        transition-duration: .12s;
    }

    .stage-image {
        animation: none !important;
    }

    .camera-flash,
    .camera-flash.active {
        animation: none !important;
        opacity: 0 !important;
    }

    .stage.transition-slide .stage-layer {
        transform: none !important;
        transition-property: opacity;
    }

}

@media (max-width: 720px) {
    .cinematic-header {
        align-items: flex-start;
    }

    .connection-state {
        display: none;
    }

    .icon-button span {
        display: none;
    }

    .stage {
        min-height: 220px;
    }

    .settings-dialog {
        border-radius: 1rem 1rem 0 0;
        margin-bottom: 0;
        max-height: 88vh;
        max-width: 100vw;
        width: 100vw;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 430px) {
    .cinematic-app {
        padding-inline: .55rem;
    }

    .stage {
        min-height: 190px;
    }

    .transport button {
        flex: 1 1 42%;
    }

    .position {
        flex-basis: 100%;
    }
}

/* Full-screen presentation and photo-only overlay controls. */
.stage-status,
.caption {
    transition: opacity 180ms ease, visibility 0s linear 0s;
}

.cinematic-app:fullscreen {
    background: #020304;
    height: 100vh;
    max-width: none;
    overflow: hidden;
    padding: 0;
    position: relative;
    width: 100vw;
}

.cinematic-app:fullscreen .cinematic-header,
.cinematic-app:fullscreen .current-detail {
    display: none;
}

.cinematic-app:fullscreen .stage-shell,
.cinematic-app:fullscreen .stage {
    height: 100%;
    max-height: none;
    min-height: 0;
    width: 100%;
}

.cinematic-app:fullscreen .stage {
    aspect-ratio: auto !important;
    max-width: none !important;
}

.cinematic-app:fullscreen .transport {
    backdrop-filter: blur(14px);
    background: rgba(5, 8, 12, .78);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: .9rem;
    bottom: 1rem;
    left: 50%;
    margin: 0;
    padding: .65rem;
    position: absolute;
    transform: translateX(-50%);
    transition: opacity 180ms ease, visibility 0s linear 0s;
    width: min(40rem, calc(100vw - 2rem));
    z-index: 12;
}

.cinematic-app:fullscreen .caption {
    padding-bottom: 5.8rem;
}

.cinematic-app:fullscreen .stage.buffer-bottom-right #buffer-status {
    bottom: 5.9rem;
}

.cinematic-app:fullscreen #slide-progress {
    bottom: 0;
    left: 0;
    margin: 0;
    opacity: 1;
    position: absolute;
    transition: opacity 180ms ease, visibility 0s linear 0s;
    z-index: 12;
}

.cinematic-app:fullscreen.photo-only .stage-status,
.cinematic-app:fullscreen.photo-only .caption,
.cinematic-app:fullscreen.photo-only .transport,
.cinematic-app:fullscreen.photo-only #slide-progress {
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, visibility 0s linear 180ms;
    visibility: hidden;
}

.cinematic-app:fullscreen.photo-only.transport-peek .transport,
.cinematic-app:fullscreen.photo-only.transport-peek #slide-progress {
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0s;
    visibility: visible;
}
/* Homepage iframe mode. JavaScript adds these classes only when ?embed=home is actually framed. */
html.home-embed-root,
body.home-embed {
    background: transparent;
    height: 100%;
    overflow: hidden;
}

.home-embed .cinematic-app {
    height: 100vh;
    margin: 0;
    max-width: none;
    overflow: hidden;
    padding: 0;
    position: relative;
    width: 100vw;
}

.home-embed .cinematic-header {
    inset: .65rem .65rem auto auto;
    margin: 0;
    pointer-events: none;
    position: absolute;
    z-index: 14;
}

.home-embed .cinematic-header > div:first-child,
.home-embed .connection-state,
.home-embed .current-detail {
    display: none;
}

.home-embed .header-actions {
    pointer-events: auto;
}

.home-embed #settings-button {
    backdrop-filter: blur(12px);
    background: rgba(5, 8, 12, .72);
    border-color: rgba(255, 255, 255, .22);
    border-radius: 999px;
    min-height: 2.6rem;
    opacity: 0;
    padding: .6rem;
    pointer-events: none;
    transition: opacity 180ms ease, visibility 0s linear 180ms;
    visibility: hidden;
}

.home-embed #settings-button span {
    display: none;
}

.home-embed .cinematic-app.embed-controls-visible #settings-button,
.home-embed #settings-button:focus-visible {
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0s;
    visibility: visible;
}

.home-embed .stage-shell {
    height: calc(100% - 1.55rem);
    max-height: none;
    min-height: 0;
    width: 100%;
}

.home-embed .stage {
    height: 100%;
    max-height: none;
    min-height: 0;
    width: 100%;
}

.home-embed .stage {
    aspect-ratio: auto !important;
    max-width: none !important;
}
.slide-dashes[hidden] {
    display: none !important;
}

.home-embed .slide-dashes {
    align-items: center;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(34, 30, 32, .12);
    bottom: 0;
    display: flex;
    gap: clamp(.12rem, .45vw, .34rem);
    height: 1.55rem;
    justify-content: center;
    left: 50%;
    margin: 0;
    max-width: none;
    padding: .16rem .25rem;
    position: absolute;
    transform: translateX(-50%);
    width: 100%;
    z-index: 13;
}

.home-embed .slide-dash {
    appearance: none;
    background: transparent;
    border: 0;
    border-radius: 0;
    flex: 1 1 1rem;
    height: 1.1rem;
    max-width: 1.35rem;
    min-height: 1.1rem;
    min-width: .28rem;
    padding: .45rem 0;
    position: relative;
}

.home-embed .slide-dash::before {
    background: rgba(30, 32, 36, .86);
    border-radius: 999px;
    content: '';
    height: .16rem;
    inset: 50% 0 auto;
    position: absolute;
    transform: translateY(-50%);
    transition: background 150ms ease, height 150ms ease, transform 150ms ease;
}

.home-embed .slide-dash.active::before {
    background: var(--accent);
    height: .22rem;
}

.home-embed .slide-dash:hover::before,
.home-embed .slide-dash:focus-visible::before {
    background: var(--accent-strong);
    height: .28rem;
    transform: translateY(-50%) scaleX(1.06);
}

.home-embed .stage-status,
.home-embed .caption {
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, visibility 0s linear 180ms;
    visibility: hidden;
}

.home-embed .cinematic-app.embed-controls-visible .stage-status,
.home-embed .cinematic-app.embed-controls-visible .caption:not([hidden]) {
    opacity: 1;
    transition-delay: 0s;
    visibility: visible;
}

.home-embed .caption {
    padding-bottom: 4.8rem;
}

.home-embed .stage.buffer-bottom-right #buffer-status {
    bottom: 4.9rem;
}

.home-embed .transport {
    backdrop-filter: blur(14px);
    background: rgba(5, 8, 12, .76);
    border: 1px solid rgba(255, 255, 255, .17);
    border-radius: .85rem;
    bottom: 2.05rem;
    left: 50%;
    margin: 0;
    max-width: calc(100vw - 1.5rem);
    opacity: 0;
    padding: .5rem;
    pointer-events: none;
    position: absolute;
    transform: translateX(-50%);
    transition: opacity 180ms ease, visibility 0s linear 180ms;
    visibility: hidden;
    width: max-content;
    z-index: 12;
}

.home-embed .transport button {
    flex: 0 0 auto;
    min-height: 2.55rem;
    padding: .5rem .8rem;
}

.home-embed .cinematic-app.embed-controls-visible .transport,
.home-embed .cinematic-app:not(.is-playing) .transport {
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0s;
    visibility: visible;
}

.home-embed .cinematic-app:not(.is-playing) .transport {
    background: transparent;
    border: 0;
    bottom: 50%;
    padding: 0;
    transform: translate(-50%, 50%);
}

.home-embed .cinematic-app:not(.is-playing) .transport > * {
    display: none;
}

.home-embed .cinematic-app:not(.is-playing) .transport #play-button {
    border-radius: 999px;
    box-shadow: 0 .35rem 1.4rem rgba(0, 0, 0, .42);
    display: block;
    min-width: 5.75rem;
}

.home-embed #slide-progress {
    bottom: 1.55rem;
    height: .24rem;
    left: 0;
    margin: 0;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transition: opacity 180ms ease, visibility 0s linear 180ms;
    visibility: hidden;
    width: 100%;
    z-index: 13;
}

.home-embed .cinematic-app.embed-controls-visible #slide-progress {
    opacity: 1;
    transition-delay: 0s;
    visibility: visible;
}

.home-embed .cinematic-app:fullscreen .stage-shell {
    height: 100%;
}

.home-embed .cinematic-app:fullscreen .slide-dashes {
    display: none;
}

.home-embed .cinematic-app:fullscreen .transport {
    bottom: 1rem;
}

.home-embed .cinematic-app:fullscreen #slide-progress {
    bottom: 0;

}

/* Home navigation shares the existing header control appearance. */
.home-link {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: .65rem;
    color: var(--text);
    font: inherit;
    min-height: 2.75rem;
    padding: .65rem 1rem;
    text-decoration: none;
    flex-shrink: 0;
}
.home-link:hover { border-color: var(--accent); }
.home-link:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}
@media (max-width: 720px) {
    .home-link { padding: .65rem; }
}
/* Keep the two presentation controls together, including on narrow screens. */
.presentation-controls {
    align-items: center;
    display: inline-flex;
    gap: .6rem;
}
.transport .presentation-controls button { flex: 1 1 auto; }
.transport #settings-button span,
.home-link span { display: inline; }
@media (max-width: 720px) {
    .cinematic-header { flex-wrap: wrap; }
    .header-actions { flex-wrap: wrap; }
}
.home-embed .transport #settings-button {
    display: inline-flex;
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}
.home-embed .cinematic-app:not(.is-playing) .transport .presentation-controls {
    display: inline-flex;
}