:root {
    --bg: #070b12;
    --bg-soft: #0a1019;
    --panel: #141820;
    --panel-border: #293142;
    --text: #f6f8ff;
    --muted: #bcd1ff;
    --dim: #9298a6;
    --blue: #4077d9;
    --blue-soft: #2b5fc0;
    --dock-height: 148px;
    --footer-height: 64px;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    overflow-x: hidden;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: linear-gradient(180deg, #09111d 0%, var(--bg) 38%, #05080d 100%);
    color: var(--text);
}

button,
input {
    font: inherit;
}

/* =========================
   Main App Layout
   ========================= */

.app-shell {
    min-height: 100vh;
    padding: 0;
}

.top-shell {
    position: sticky;
    top: 0;
    z-index: 8;
    padding: 0;
    background: linear-gradient(180deg, #11151d 0%, #090d14 100%);
}

.banner-frame {
    width: 100vw;
    margin: 0;
    overflow: visible;
    background: #090d14;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.hero-banner {
    display: block;
    width: 100vw;
    max-width: none;
    height: auto;
    margin: 0;
    object-fit: contain;
    object-position: center center;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.hero-banner-thin {
    display: none;
}

body.chat-started .hero-banner-large {
    display: none;
}

body.chat-started .hero-banner-thin {
    display: block;
}

/* =========================
   Landing Page
   ========================= */

body:not(.chat-started) .app-shell {
    min-height: 100vh;
    padding-bottom: calc(var(--footer-height) + 24px);
}

body:not(.chat-started) .intro {
    width: min(900px, calc(100vw - 40px));
    margin: 72px auto 34px;
    text-align: center;
    transition: margin .28s ease, opacity .2s ease, max-height .28s ease;
    overflow: visible;
}

    body:not(.chat-started) .intro h1 {
        margin: 0;
        padding-bottom: 8px;
        font-size: clamp(2.7rem, 5.2vw, 4.35rem);
        line-height: 1.16;
        letter-spacing: -.06em;
        font-weight: 850;
    }

    body:not(.chat-started) .intro p {
        display: none;
    }

body:not(.chat-started) .messages {
    display: none;
}

body:not(.chat-started) .bottom-dock {
    position: static;
    width: 100%;
    margin: 0 auto 112px;
    padding: 0 24px;
    background: transparent;
    backdrop-filter: none;
}

body:not(.chat-started) .ask-form {
    width: min(880px, calc(100vw - 60px));
    margin: 0 auto;
}

/* Landing footer is the actual page footer */
body:not(.chat-started) .site-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    width: 100vw;
    max-width: none;
    min-height: var(--footer-height);
    margin: 0;
    padding: 18px 24px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px 12px;
    flex-wrap: nowrap;
    white-space: nowrap;
    background: linear-gradient(180deg, rgba(5, 8, 13, .66) 0%, rgba(5, 8, 13, .98) 38%, #05080d 100%);
    border-top: 1px solid rgba(255, 255, 255, .08);
    color: #a9b3c6;
    font-size: .78rem;
    text-align: center;
}

/* =========================
   Conversation Mode
   ========================= */

body.chat-started .app-shell {
    min-height: 100vh;
    padding-bottom: var(--dock-height);
}

body.chat-started .intro {
    max-height: 0;
    width: min(900px, calc(100vw - 40px));
    margin: 0 auto;
    opacity: 0;
    overflow: hidden;
}

.messages {
    width: min(1106px, calc(100vw - 40px));
    min-height: calc(100vh - var(--dock-height) - 96px);
    margin: 0 auto;
    padding: 32px 112px calc(var(--dock-height) + 112px);
    display: flex;
    flex-direction: column;
    gap: 22px;
    scroll-padding-bottom: calc(var(--dock-height) + 112px);
}

.message {
    max-width: min(650px, 78%);
    padding: 18px 21px;
    border-radius: 16px;
    line-height: 1.4;
    animation: appear .18s ease-out;
}

    .message.user {
        align-self: flex-end;
        margin-right: 0;
        background: linear-gradient(180deg, #467cdb, #356bc9);
        border-radius: 16px;
        color: white;
    }

    .message.dave {
        align-self: flex-start;
        background: #101721;
        border: 1px solid #2b3546;
        color: white;
    }

        .message.dave::before {
            content: "Dave: ";
            color: #5c8eff;
            font-weight: 850;
        }

    .message.status {
        align-self: flex-start;
        max-width: min(650px, 78%);
        padding: 0 6px;
        margin: -2px 0 0 4px;
        border: 0;
        border-radius: 0;
        background: transparent;
        color: #92a2bd;
        font-size: .94rem;
        font-style: italic;
    }

        .message.status::before {
            content: "System: ";
            color: #6f86ad;
            font-weight: 750;
        }

    .message:first-child {
        margin-top: 0;
    }

    .message:last-child {
        scroll-margin-bottom: calc(var(--dock-height) + 132px);
    }

/* Chat dock */
body.chat-started .bottom-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 24px;
    z-index: 20;
    padding: 14px 24px 0;
    background: linear-gradient(180deg, rgba(5, 8, 13, 0) 0%, rgba(5, 8, 13, .92) 18%, #05080d 54%);
    backdrop-filter: blur(10px);
}

body.chat-started .site-footer {
    position: static;
    width: min(1320px, calc(100vw - 32px));
    max-width: none;
    margin: 12px auto 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px 12px;
    flex-wrap: nowrap;
    white-space: nowrap;
    background: transparent;
    border-top: 0;
    color: #a9b3c6;
    font-size: .78rem;
    text-align: center;
}

/* =========================
   Form
   ========================= */

.ask-form {
    width: min(880px, calc(100vw - 60px));
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: #171a22;
    border: 1px solid #363d4d;
    border-radius: 22px;
    box-shadow: 0 20px 70px rgba(0, 0, 0, .32);
}

    .ask-form input {
        flex: 1;
        min-width: 0;
        color: var(--text);
        background: transparent;
        border: 0;
        outline: none;
        padding: 15px 18px;
        font-size: 1rem;
    }

        .ask-form input::placeholder {
            color: #9ba0aa;
        }

    .ask-form button {
        border: 0;
        border-radius: 17px;
        padding: 15px 27px;
        min-width: 117px;
        color: #06080c;
        background: #f4f7fc;
        font-weight: 800;
        cursor: pointer;
    }

        .ask-form button:disabled,
        .ask-form input:disabled {
            opacity: .65;
            cursor: wait;
        }

/* =========================
   Footer
   ========================= */

.site-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px 12px;
    color: #a9b3c6;
    font-size: .78rem;
    text-align: center;
}

    .site-footer a {
        color: #f4f7ff;
        text-decoration: underline;
        text-underline-offset: 3px;
        white-space: nowrap;
    }

/* =========================
   Terms and Agreements
   ========================= */

body.terms-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at top, rgba(65, 119, 217, .14), transparent 34rem), linear-gradient(180deg, #09111d 0%, #05080d 100%);
}

.terms-shell {
    flex: 1;
    width: min(960px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 52px 0 28px;
    display: flex;
    align-items: center;
}

.terms-card {
    width: 100%;
    background: rgba(16, 23, 33, .92);
    border: 1px solid rgba(255,255,255,.11);
    border-radius: 22px;
    padding: clamp(26px, 4vw, 44px);
    box-shadow: 0 24px 80px rgba(0,0,0,.34);
}

.terms-back {
    display: inline-flex;
    align-items: center;
    margin-bottom: 28px;
    color: #f4f7ff;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.06);
    border-radius: 999px;
    padding: 10px 14px;
    font-weight: 700;
}

.terms-header {
    border-bottom: 1px solid rgba(255,255,255,.1);
    margin-bottom: 28px;
    padding-bottom: 22px;
}

.terms-kicker {
    margin: 0 0 8px;
    color: #8fb0ff;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    font-size: .78rem;
}

.terms-header h1 {
    margin: 0;
    font-size: clamp(2.2rem, 5vw, 4rem);
    line-height: .95;
    letter-spacing: -.055em;
    text-align: left;
}

.terms-subtitle {
    margin: 14px 0 0;
    color: #a9b3c6;
    font-size: .95rem;
}

.terms-content {
    max-width: 760px;
}

    .terms-content p {
        margin: 0 0 18px;
        color: #e8edf8;
        line-height: 1.72;
        font-size: 1.02rem;
        text-align: left;
    }

.terms-footer {
    margin-top: auto;
    padding: 18px 24px 20px;
    width: 100%;
    background: linear-gradient(180deg, rgba(5, 8, 13, .66) 0%, rgba(5, 8, 13, .98) 38%, #05080d 100%);
    border-top: 1px solid rgba(255, 255, 255, .08);
}

/* =========================
   Animations
   ========================= */

@keyframes appear {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================
   Responsive
   ========================= */

@media (max-width: 1050px) {
    body:not(.chat-started) .site-footer,
    body.chat-started .site-footer,
    .terms-footer {
        flex-wrap: wrap;
        white-space: normal;
        line-height: 1.5;
    }

    body:not(.chat-started) .app-shell {
        padding-bottom: 118px;
    }

    body:not(.chat-started) .bottom-dock {
        margin-bottom: 124px;
    }
}

@media (max-width: 760px) {
    :root {
        --dock-height: 162px;
        --footer-height: 92px;
    }

    body:not(.chat-started) .intro {
        width: calc(100vw - 28px);
        margin-top: 44px;
        margin-bottom: 28px;
        overflow: visible;
    }

        body:not(.chat-started) .intro h1 {
            font-size: 2.8rem;
        }

    body:not(.chat-started) .bottom-dock {
        padding: 0 10px;
        margin-bottom: 112px;
    }

    body:not(.chat-started) .site-footer {
        padding: 14px 12px 16px;
        font-size: .74rem;
        flex-wrap: wrap;
        white-space: normal;
    }

    .messages {
        width: calc(100vw - 18px);
        padding: 28px 8px calc(var(--dock-height) + 116px);
    }

    .message {
        max-width: 88%;
    }

    body.chat-started .bottom-dock {
        bottom: 24px;
        padding: 12px 10px 0;
    }

    .ask-form {
        width: 100%;
        border-radius: 18px;
    }

        .ask-form button {
            min-width: auto;
            padding: 14px 18px;
        }

    .terms-shell {
        width: calc(100vw - 22px);
        padding: 24px 0 18px;
        align-items: flex-start;
    }

    .terms-card {
        border-radius: 18px;
        padding: 22px;
    }

    .terms-content p {
        font-size: .98rem;
    }
}
