:root {
    color-scheme: light;
    --bg: #f7f7f4;
    --surface: #ffffff;
    --ink: #242424;
    --muted: #70706a;
    --line: #deded6;
    --accent: #225c72;
    --accent-strong: #17485a;
    --danger: #9d2b2b;
    --shadow: 0 18px 45px rgba(36, 36, 36, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
    max-width: 820px;
    margin: 0 auto;
    padding: 1.25rem;
}

.chat-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: calc(100vh - 2.5rem);
}

.chat-shell.is-empty {
    justify-content: center;
    padding-bottom: 12vh;
}

.chat-shell.has-completion {
    padding-top: 1.5rem;
}

.intro {
    text-align: center;
}

.intro h1 {
    font-size: 2rem;
    font-weight: 600;
    margin: 0 0 0.65rem;
}

.intro p {
    color: var(--muted);
    line-height: 1.55;
    margin: 0 auto;
    max-width: 42rem;
}

.conversation {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.85rem;
    justify-content: flex-start;
    min-height: 21rem;
}

.message {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    line-height: 1.65;
    max-width: 82%;
    padding: 0.9rem 1rem;
}

.message p {
    margin: 0;
    white-space: pre-wrap;
}

.user-message {
    align-self: flex-end;
    background: #eef5f7;
    border-color: rgba(34, 92, 114, 0.22);
}

.model-message {
    align-self: flex-start;
}

.message-label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.composer {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 0.65rem;
    position: sticky;
    bottom: 1rem;
}

label {
    color: var(--muted);
    display: grid;
    font-size: 0.9rem;
    font-weight: 650;
    gap: 0.35rem;
}

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

.input-bar {
    align-items: flex-end;
    display: flex;
    gap: 0.65rem;
}

textarea {
    width: 100%;
    border: 0;
    border-radius: 18px;
    color: var(--ink);
    font: inherit;
    padding: 0.7rem 0.75rem;
}

textarea {
    min-height: 3.2rem;
    resize: vertical;
}

textarea:focus {
    outline: 3px solid rgba(34, 92, 114, 0.14);
}

.primary-button {
    align-items: center;
    appearance: none;
    background: var(--accent);
    border: 0;
    border-radius: 18px;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    gap: 0.65rem;
    justify-content: center;
    min-width: 7.5rem;
    padding: 0.75rem 1rem;
}

.primary-button:hover {
    background: var(--accent-strong);
}

.primary-button:disabled {
    cursor: wait;
    opacity: 0.82;
}

.spinner {
    animation: spin 0.8s linear infinite;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    display: none;
    height: 1rem;
    width: 1rem;
}

.is-submitting .spinner {
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.error {
    border-left: 4px solid var(--danger);
    color: var(--danger);
    margin: 1rem 0 0;
    padding-left: 0.75rem;
}

.examples {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: center;
    margin-top: -0.15rem;
}

.examples button {
    appearance: none;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    padding: 0.55rem 0.8rem;
}

.examples button:hover {
    border-color: rgba(34, 92, 114, 0.35);
    color: var(--ink);
}

@media (max-width: 820px) {
    .message {
        max-width: 92%;
    }

    .input-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .primary-button {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .shell {
        padding: 0.75rem;
    }

    .intro {
        padding-top: 1.25rem;
    }

    .intro h1 {
        font-size: 1.55rem;
    }
}
