:root {
    color-scheme: light;
    --navy: #07234a;
    --navy-deep: #00134d;
    --green: #16824f;
    --green-dark: #0d663c;
    --orange: #ed7a2c;
    --gold: #f4b51f;
    --ink: #172235;
    --muted: #5d6878;
    --line: #dce3e7;
    --white: #ffffff;
    --shadow: 0 18px 46px rgba(7, 35, 74, 0.14);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-width: 320px;
    min-height: 0;
    background: var(--navy-deep);
}

body {
    color: var(--ink);
    background: var(--navy-deep);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

button,
a {
    font: inherit;
}

button {
    cursor: pointer;
}

img {
    display: block;
    max-width: 100%;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.story-page {
    display: grid;
    place-items: start center;
    min-height: 0;
    padding: 6px 12px 8px;
    background: var(--navy-deep);
}

.story-card {
    width: min(100%, 820px);
}

.story-topline {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 4px;
}

.story-topline[hidden],
.story-controls[hidden],
.full-controls[hidden],
.cover-card[hidden],
.story-figure[hidden],
.completion-panel[hidden] {
    display: none;
}

.story-progress {
    padding: 2px 8px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.story-stage {
    position: relative;
    overflow: hidden;
    background: var(--navy-deep);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.cover-card {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    color: var(--white);
    background: var(--navy-deep);
}

.cover-card img,
.story-figure img {
    width: auto;
    max-width: 100%;
    max-height: min(560px, calc(100vh - 72px));
    margin: 0 auto;
    object-fit: contain;
}

.cover-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, transparent 48%, rgba(3, 22, 47, 0.6) 100%),
        radial-gradient(circle at 72% 68%, rgba(244, 181, 31, 0.18), transparent 32%);
    pointer-events: none;
}

.cover-cta {
    position: absolute;
    left: 50%;
    bottom: clamp(12px, 2.6vw, 26px);
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: min(82%, 360px);
    min-height: 50px;
    padding: 12px 22px;
    color: var(--white);
    background: var(--green);
    border: 2px solid rgba(255, 255, 255, 0.92);
    border-radius: 999px;
    box-shadow: 0 16px 32px rgba(3, 22, 47, 0.28);
    font-size: clamp(16px, 2vw, 20px);
    font-weight: 900;
    text-align: center;
}

.cover-card:hover .cover-cta,
.cover-card:focus-visible .cover-cta {
    background: var(--green-dark);
}

.cover-card:focus-visible,
.button:focus-visible,
.story-button:focus-visible,
.utility-button:focus-visible,
.secondary-action-button:focus-visible {
    outline: 4px solid rgba(244, 181, 31, 0.55);
    outline-offset: 4px;
}

.story-figure {
    margin: 0;
    background: var(--navy-deep);
}

.story-figure.is-changing img {
    animation: image-in 180ms ease;
}

@keyframes image-in {
    from {
        opacity: 0.62;
        transform: scale(0.992);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.story-controls {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 clamp(8px, 2vw, 16px);
    pointer-events: none;
}

.story-button,
.utility-button {
    min-height: 44px;
    border: 0;
    font-weight: 900;
}

.story-button {
    min-width: 108px;
    padding: 10px 16px;
    color: var(--navy);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(203, 213, 220, 0.9);
    border-radius: 999px;
    box-shadow: 0 10px 28px rgba(3, 22, 47, 0.22);
    pointer-events: auto;
}

.story-button-next {
    color: var(--white);
    background: rgba(7, 35, 74, 0.94);
    border-color: var(--navy);
}

.story-button:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.full-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding-top: 8px;
}

.utility-button {
    padding: 6px 10px;
    color: rgba(255, 255, 255, 0.86);
    background: transparent;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.completion-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: min(500px, calc(100vh - 72px));
    padding: clamp(22px, 5vw, 54px);
    color: var(--ink);
    background:
        radial-gradient(circle at 88% 16%, rgba(244, 181, 31, 0.25), transparent 26%),
        linear-gradient(135deg, #fffdf7 0%, #e8f7ef 100%);
}

.completion-panel-final {
    color: var(--white);
    background:
        radial-gradient(circle at 88% 16%, rgba(237, 122, 44, 0.34), transparent 28%),
        linear-gradient(135deg, #0c386e 0%, #041a38 100%);
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--green);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.completion-panel-final .eyebrow {
    color: #8fe0b5;
}

h2,
p {
    margin-top: 0;
}

h2 {
    max-width: 760px;
    margin-bottom: 14px;
    color: var(--navy-deep);
    font-size: clamp(30px, 4.8vw, 52px);
    line-height: 1.02;
    letter-spacing: -0.035em;
}

.completion-panel-final h2,
.completion-panel-final p {
    color: var(--white);
}

.completion-panel p:not(.eyebrow) {
    max-width: 690px;
    margin-bottom: 22px;
    color: var(--muted);
    font-size: clamp(16px, 1.8vw, 20px);
}

.completion-panel-final p:not(.eyebrow) {
    color: rgba(255, 255, 255, 0.86);
}

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

.secondary-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

.secondary-action-button {
    min-height: 42px;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    color: var(--white);
    background: rgba(255, 255, 255, 0.08);
    font-size: 14px;
    font-weight: 900;
}

.secondary-action-button:hover {
    background: rgba(255, 255, 255, 0.16);
}

.option-list {
    display: grid;
    gap: 12px;
    width: 100%;
    max-width: 760px;
}

.option-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 14px;
    align-items: center;
    padding: 13px 14px;
    border: 1px solid rgba(7, 35, 74, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
}

.option-copy {
    display: grid;
    gap: 3px;
}

.option-copy strong {
    color: var(--navy-deep);
    font-size: 17px;
    line-height: 1.15;
}

.option-copy span {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.35;
}

.option-cta {
    justify-self: end;
    width: 220px;
    min-height: 52px;
}

.option-list-light .option-row {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.1);
}

.option-list-light .option-copy strong,
.option-list-light .option-copy span {
    color: var(--white);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 11px 18px;
    border: 2px solid transparent;
    border-radius: 12px;
    font-weight: 900;
    text-align: center;
    text-decoration: none;
}

.button-primary {
    color: var(--white);
    background: var(--green);
}

.button-dark {
    color: var(--white);
    background: var(--navy);
}

.button-ghost {
    color: var(--navy);
    border-color: #c8d2d9;
    background: transparent;
}

.button-secondary-light {
    color: var(--white);
    border-color: rgba(255, 255, 255, 0.6);
    background: transparent;
}

.button-text-light {
    min-height: auto;
    color: var(--white);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.assistant-quiz-button {
    max-width: 310px;
    line-height: 1.18;
}

.play-store-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 52px;
    padding: 0 10px;
    border-radius: 8px;
    background: transparent;
    text-decoration: none;
}

.play-store-badge img {
    width: 150px;
    height: auto;
}

.demo-form-panel {
    background:
        radial-gradient(circle at 88% 16%, rgba(244, 181, 31, 0.26), transparent 26%),
        linear-gradient(135deg, #ffffff 0%, #eef5ff 100%);
}

.demo-request-form {
    display: grid;
    gap: 14px;
    width: 100%;
    max-width: 720px;
}

.demo-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.demo-field {
    display: grid;
    gap: 5px;
}

.demo-field.full-width {
    grid-column: 1 / -1;
}

.demo-field label {
    color: var(--navy-deep);
    font-size: 12px;
    font-weight: 900;
}

.demo-field input,
.demo-field textarea {
    width: 100%;
    border: 1px solid #b9c7d9;
    border-radius: 8px;
    padding: 10px 11px;
    color: var(--ink);
    background: var(--white);
}

.demo-field textarea {
    min-height: 86px;
    resize: vertical;
}

.demo-field input:focus,
.demo-field textarea:focus {
    outline: 3px solid rgba(22, 130, 79, 0.18);
    border-color: var(--green);
}

.demo-form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.demo-form-status {
    min-height: 18px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.demo-form-status.is-error {
    color: #b3261e;
}

.demo-form-status.is-success {
    color: var(--green-dark);
}

@media (max-width: 700px) {
    .story-page {
        padding: 4px 6px 6px;
    }

    .story-card {
        width: 100%;
    }

    .cover-card img,
    .story-figure img {
        max-height: min(520px, calc(100vh - 88px));
    }

    .story-controls {
        padding: 0 6px;
    }

    .story-button {
        min-width: 0;
        max-width: 46%;
        min-height: 40px;
        padding: 8px 10px;
        font-size: 14px;
    }

    .option-row {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px;
    }

    .option-cta {
        justify-self: stretch;
        width: 100%;
        min-width: 0;
    }

    .secondary-actions,
    .secondary-action-button {
        width: 100%;
    }

    .completion-panel {
        min-height: min(500px, calc(100vh - 96px));
        padding: 24px 18px;
    }

    .demo-form-grid {
        grid-template-columns: 1fr;
    }

    .play-store-badge {
        height: 52px;
        justify-content: center;
    }

    .play-store-badge img {
        width: 200px;
        max-width: 200px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
