:root {
    --bg: #08090a;
    --fg: #f4efe6;
    --muted: #a7a197;
    --line: rgba(244, 239, 230, 0.14);
    --panel: rgba(20, 22, 24, 0.86);
    --strong: #131619;
    --amber: #d89b55;
    --teal: #75b8ac;
    --red: #b94e44;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(180deg, rgba(8, 9, 10, 0.2), #08090a 48%),
        radial-gradient(circle at 14% 18%, rgba(117, 184, 172, 0.2), transparent 28%),
        var(--bg);
    color: var(--fg);
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: inherit;
}

h1, h2, h3, p {
    overflow-wrap: anywhere;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    min-height: 64px;
    padding: 0 clamp(18px, 4vw, 64px);
    border-bottom: 1px solid var(--line);
    background: rgba(8, 9, 10, 0.82);
    backdrop-filter: blur(16px);
}

.brand {
    color: #fff7ed;
    font-size: 20px;
    font-weight: 900;
    text-decoration: none;
}

.topbar nav {
    display: flex;
    gap: 18px;
}

.topbar nav a {
    color: #d8d0c4;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.hero {
    display: grid;
    grid-template-columns: minmax(280px, 0.84fr) minmax(360px, 1.16fr);
    gap: 34px;
    align-items: center;
    min-height: calc(92vh - 64px);
    padding: 46px clamp(18px, 4vw, 64px) 34px;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--teal);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.hero h1 {
    margin: 0;
    max-width: 760px;
    font-size: clamp(44px, 8vw, 104px);
    line-height: 0.94;
    letter-spacing: 0;
}

.lede {
    max-width: 560px;
    margin: 24px 0 0;
    color: #d8d0c4;
    font-size: 19px;
    line-height: 1.55;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 28px;
}

.button {
    min-height: 42px;
    border: 0;
    border-radius: 6px;
    background: #e8dfd0;
    color: #15110c;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    padding: 10px 16px;
    text-decoration: none;
}

.button.primary {
    min-height: 46px;
    background: var(--amber);
}

.button.full {
    width: 100%;
}

.button.small {
    min-height: 34px;
    padding: 7px 12px;
}

.pill, .status {
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #d9d3c9;
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
}

.hero-frame {
    position: relative;
    min-height: 360px;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #111;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
}

.hero-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero-frame:after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(8, 9, 10, 0.68), transparent 46%);
}

.frame-overlay {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 18px;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    color: #f6efe6;
    padding-top: 12px;
}

.frame-overlay span {
    color: #d8d0c4;
}

.band, .page {
    padding: 28px clamp(18px, 4vw, 64px) 60px;
}

.band {
    display: grid;
    grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
    gap: 24px;
    align-items: center;
}

.three {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.three p {
    min-height: 96px;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    display: flex;
    align-items: end;
    background: rgba(255, 255, 255, 0.04);
    color: #f1e8db;
    line-height: 1.35;
    padding: 14px;
}

.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 22px;
}

.narrow {
    max-width: 920px;
}

.page-title {
    margin: 0;
    font-size: clamp(34px, 5vw, 62px);
    line-height: 1;
    letter-spacing: 0;
}

.subtle {
    color: #d8d0c4;
    line-height: 1.55;
}

label {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

label span {
    color: #d7cfc3;
    font-size: 13px;
    font-weight: 700;
}

textarea, input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.055);
    color: var(--fg);
    outline: none;
    padding: 12px;
}

textarea:focus, input:focus {
    border-color: rgba(117, 184, 172, 0.8);
    box-shadow: 0 0 0 3px rgba(117, 184, 172, 0.14);
}

.field-grid, .summary-grid {
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    gap: 14px;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.meta-grid span {
    border: 1px solid var(--line);
    border-radius: 6px;
    color: #d8d0c4;
    display: grid;
    gap: 6px;
    padding: 12px;
}

.meta-grid strong {
    color: #f4efe6;
}

.guide p {
    color: #d8d0c4;
    line-height: 1.6;
}

.ai-read-head {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.ai-read-head .eyebrow {
    margin: 0;
}

.ai-source {
    align-items: center;
    color: #8fd2c5;
    display: inline-flex;
    font-size: 11px;
    font-weight: 800;
    gap: 7px;
    text-transform: uppercase;
}

.ai-source::before {
    background: #8fd2c5;
    border-radius: 50%;
    content: "";
    height: 7px;
    width: 7px;
}

.ai-summary {
    font-size: 17px;
    margin: 18px 0 20px;
}

.ai-signals {
    border-top: 1px solid var(--line);
    display: grid;
}

.ai-signals > div {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 5px;
    padding: 14px 0;
}

.ai-signals span,
.path-reason span {
    color: #8fd2c5;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.ai-signals p,
.path-reason p {
    margin: 0;
}

.session-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.session-row {
    border: 1px solid var(--line);
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    color: #f4efe6;
    padding: 14px;
    text-decoration: none;
}

.session-row span {
    color: var(--muted);
    flex: 0 0 auto;
}

.outcomes {
    display: grid;
    gap: 18px;
    margin-top: 18px;
}

.outcome {
    background: var(--strong);
}

.outcome-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: start;
}

.outcome-head h2 {
    margin: 0;
    font-size: 32px;
    line-height: 1;
}

.outcome-head > span {
    border: 1px solid rgba(216, 155, 85, 0.35);
    border-radius: 999px;
    color: #f0c58e;
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 800;
    padding: 8px 10px;
}

.path-reason {
    border-left: 2px solid #75b8ac;
    display: grid;
    gap: 6px;
    margin-top: 16px;
    padding: 4px 0 4px 14px;
}

.path-reason p {
    color: #d8d0c4;
    line-height: 1.55;
}

.scene-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.future-reel {
    margin-top: 20px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #050607;
}

.reel-visual {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 320px;
    overflow: hidden;
    background: #090b0d;
}

.reel-scene-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.04);
    transform-origin: center;
    filter: saturate(0.78) contrast(1.05);
    will-change: transform;
}

.reel-tone-2 .reel-scene-image {
    filter: saturate(0.55) contrast(1.16) brightness(0.72);
}

.reel-tone-3 .reel-scene-image {
    filter: saturate(0.7) contrast(0.98) brightness(0.9);
}

.reel-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(4, 5, 6, 0.9) 0, rgba(4, 5, 6, 0.48) 52%, rgba(4, 5, 6, 0.12) 100%),
        linear-gradient(0deg, rgba(4, 5, 6, 0.62), transparent 48%);
}

.reel-frame {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 700ms ease;
    pointer-events: none;
}

.reel-frame.is-active {
    opacity: 1;
    z-index: 2;
}

.reel-copy {
    position: absolute;
    left: clamp(20px, 5vw, 60px);
    right: clamp(20px, 36vw, 440px);
    bottom: clamp(28px, 7vw, 72px);
    z-index: 2;
    transform: translateY(14px);
    transition: transform 700ms ease;
}

.reel-frame.is-active .reel-copy {
    transform: translateY(0);
}

.reel-copy h3 {
    margin: 0 0 10px;
    font-size: clamp(26px, 4vw, 52px);
    line-height: 1;
}

.reel-copy > p:last-child {
    display: -webkit-box;
    max-width: 680px;
    margin: 0;
    overflow: hidden;
    color: #f1e8db;
    font-size: clamp(14px, 1.6vw, 18px);
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.reel-kicker {
    margin: 0 0 10px;
    color: #f0c58e;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.reel-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 3;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    background: rgba(4, 5, 6, 0.64);
    color: #f4efe6;
    font-size: 11px;
    font-weight: 800;
    padding: 7px 10px;
    text-transform: uppercase;
}

.reel-controls {
    display: grid;
    grid-template-columns: auto minmax(120px, 1fr) 40px;
    gap: 14px;
    align-items: center;
    min-height: 58px;
    padding: 10px 14px;
}

.reel-toggle {
    min-width: 154px;
    min-height: 36px;
    border: 0;
    border-radius: 4px;
    display: inline-flex;
    gap: 9px;
    align-items: center;
    justify-content: center;
    background: var(--amber);
    color: #15110c;
    cursor: pointer;
    font-weight: 800;
    padding: 8px 12px;
}

.reel-toggle > span:first-child {
    width: 14px;
    text-align: center;
}

.reel-timeline {
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    gap: 5px;
}

.reel-timeline > span {
    height: 4px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.17);
}

.reel-timeline i {
    display: block;
    width: 0;
    height: 100%;
    background: var(--teal);
}

.reel-controls time {
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.shot-list-label {
    margin: 20px 0 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.scene {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 12px;
    border: 1px solid rgba(244, 239, 230, 0.09);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.035);
    padding: 12px;
}

.scene-number {
    color: var(--red);
    font-weight: 900;
}

.scene h3 {
    margin: 0 0 8px;
}

.scene p {
    margin: 0;
    color: #ddd5c9;
    line-height: 1.5;
}

.film-output {
    width: 100%;
    max-width: 720px;
    aspect-ratio: 16 / 9;
    display: block;
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #050607;
}

.scene-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}

.scene-note {
    margin-top: 10px;
    color: #f0c58e;
    font-size: 14px;
}

.validation, .field-validation-error {
    color: #ffb0a9;
}

.rendering-overlay[hidden] {
    display: none;
}

.rendering-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(5, 6, 7, 0.94);
    backdrop-filter: blur(12px);
}

.rendering-dialog {
    width: min(560px, 100%);
    text-align: center;
}

.rendering-dialog h2 {
    margin: 0;
    font-size: clamp(30px, 6vw, 52px);
    line-height: 1.05;
}

.rendering-status {
    min-height: 26px;
    margin: 18px 0;
    color: #d8d0c4;
    line-height: 1.5;
}

.rendering-progress {
    width: 100%;
    height: 4px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.12);
}

.rendering-progress span {
    display: block;
    width: 34%;
    height: 100%;
    background: var(--amber);
    animation: rendering-progress 1.35s ease-in-out infinite;
}

.rendering-frames {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: min(320px, 80%);
    margin: 24px auto 0;
}

.rendering-frames i {
    aspect-ratio: 16 / 10;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.045);
    animation: rendering-frame 1.4s ease-in-out infinite;
}

.rendering-frames i:nth-child(2) {
    animation-delay: 180ms;
}

.rendering-frames i:nth-child(3) {
    animation-delay: 360ms;
}

.is-rendering {
    overflow: hidden;
}

@keyframes rendering-progress {
    0% { transform: translateX(-110%); }
    55%, 100% { transform: translateX(300%); }
}

@keyframes rendering-frame {
    0%, 100% { border-color: var(--line); background: rgba(255, 255, 255, 0.045); }
    50% { border-color: rgba(117, 184, 172, 0.7); background: rgba(117, 184, 172, 0.16); }
}

@media (prefers-reduced-motion: reduce) {
    .rendering-progress span,
    .rendering-frames i,
    .reel-frame,
    .reel-copy {
        animation: none;
        transition: none;
    }
}

@media (max-width: 900px) {
    .hero, .band, .field-grid, .summary-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: auto;
    }

    .hero-frame {
        min-height: 260px;
    }

    .three, .meta-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .topbar, .session-row, .outcome-head {
        align-items: stretch;
        flex-direction: column;
    }

    .hero h1 {
        font-size: 46px;
    }

    .panel {
        padding: 16px;
    }

    .reel-visual {
        min-height: 360px;
        aspect-ratio: 4 / 5;
    }

    .reel-frame {
        inset: 0;
    }

    .reel-copy {
        left: 20px;
        right: 20px;
        bottom: 34px;
    }

    .reel-copy > p:last-child {
        -webkit-line-clamp: 5;
    }

    .reel-controls {
        grid-template-columns: 1fr 40px;
    }

    .reel-toggle {
        min-width: 0;
    }

    .reel-timeline {
        grid-column: 1 / -1;
        grid-row: 1;
    }
}
