:root {
    color-scheme: dark;

    --bg: #0f0f10;
    --panel: #1b1b1d;
    --panel-hover: #232326;
    --panel-strong: #2a2a2d;

    --text: #f3f3f3;
    --muted: #98989f;
    --muted-2: #727278;

    --border: rgba(255,255,255,.09);
    --border-strong: rgba(255,255,255,.14);

    --user: #2a2a2d;
    --accent: #ffffff;
    --accent-text: #111112;

    --max: 760px;
}

* {
    box-sizing: border-box;
}

html {
    height: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    width: 100%;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "SF Pro Text",
        "Segoe UI",
        sans-serif;

    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

button,
textarea {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.app {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;

    display: grid;
    grid-template-rows:
        auto
        minmax(0, 1fr)
        auto;

    background: var(--bg);
}

.header {
    min-height: 62px;

    padding:
        max(12px, env(safe-area-inset-top))
        18px
        8px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;

    font-size: 17px;
    line-height: 1;
    font-weight: 620;
    letter-spacing: -.025em;
}

.brand-icon {
    width: 30px;
    height: 30px;

    display: grid;
    place-items: center;

    border-radius: 9px;

    background: #f4f4f4;
    color: #111;

    font-size: 14px;
    font-weight: 700;
}

.dev-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    color: var(--muted);

    font-size: 12px;
    white-space: nowrap;
}

.dev-badge > span {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: #a98cff;

    box-shadow:
        0 0 10px rgba(169, 140, 255, .45);
}

.main {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;

    scrollbar-width: none;
}

.main::-webkit-scrollbar {
    display: none;
}

.start {
    width: min(var(--max), calc(100% - 32px));
    min-height: 100%;

    margin: 0 auto;

    display: flex;
    flex-direction: column;
    justify-content: center;

    padding:
        32px
        0
        86px;
}

.start h1 {
    margin:
        0
        0
        28px;

    text-align: center;

    font-size: clamp(26px, 5vw, 31px);
    line-height: 1.16;

    font-weight: 540;
    letter-spacing: -.035em;
}

.composer {
    width: 100%;

    border: 1px solid var(--border-strong);
    border-radius: 24px;

    background: var(--panel);

    box-shadow:
        0 2px 12px rgba(0,0,0,.14);

    transition:
        border-color .18s ease,
        background .18s ease;
}

.composer:focus-within {
    border-color: rgba(255,255,255,.22);
}

.composer textarea {
    display: block;

    width: 100%;
    min-height: 54px;
    max-height: 150px;

    padding:
        17px
        18px
        5px;

    resize: none;

    border: 0;
    outline: 0;

    overflow-y: auto;

    background: transparent;
    color: var(--text);

    font-size: 16px;
    line-height: 1.42;
}

.composer textarea::placeholder {
    color: #88888e;
}

.composer-bottom {
    min-height: 48px;

    padding:
        3px
        9px
        9px;

    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.composer-tool,
.send {
    width: 36px;
    height: 36px;

    flex: 0 0 36px;

    display: grid;
    place-items: center;

    border-radius: 50%;
}

.composer-tool {
    border: 1px solid var(--border);

    background: transparent;
    color: #d6d6d8;

    font-size: 22px;
    font-weight: 300;
}

.send {
    border: 0;

    background: var(--accent);
    color: var(--accent-text);

    font-size: 20px;
    font-weight: 600;

    cursor: pointer;

    transition:
        opacity .15s ease,
        transform .15s ease;
}

.send:disabled {
    opacity: .22;
    cursor: default;
}

.send:not(:disabled):active {
    transform: scale(.92);
}

.suggestions {
    width: 100%;

    margin-top: 14px;

    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 8px;
}

.suggestions button {
    min-width: 0;
    min-height: 48px;

    padding:
        10px
        13px;

    display: flex;
    align-items: center;
    gap: 9px;

    overflow: hidden;

    text-align: left;

    border: 1px solid var(--border);
    border-radius: 15px;

    background: transparent;
    color: #c8c8cc;

    cursor: pointer;

    transition:
        background .16s ease,
        border-color .16s ease;
}

.suggestions button:hover {
    background: var(--panel);
    border-color: var(--border-strong);
}

.suggestions button:active {
    background: var(--panel-hover);
}

.suggestions button > span:last-child {
    min-width: 0;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 13px;
}

.suggestion-icon {
    flex: 0 0 auto;

    color: #a9a9af;

    font-size: 15px;
}

.chat {
    width: min(var(--max), calc(100% - 32px));
    margin: 0 auto;

    padding:
        24px
        0
        150px;

    display: flex;
    flex-direction: column;
    gap: 28px;
}

.message {
    width: 100%;

    animation:
        appear .22s ease both;
}

.message.user {
    display: flex;
    justify-content: flex-end;
}

.user-bubble {
    max-width: min(82%, 560px);

    padding:
        10px
        15px;

    border-radius:
        19px
        19px
        5px
        19px;

    background: var(--user);
    color: var(--text);

    font-size: 15px;
    line-height: 1.5;
}

.message.assistant {
    display: grid;
    grid-template-columns:
        31px
        minmax(0, 1fr);

    gap: 12px;
}

.assistant-icon {
    width: 31px;
    height: 31px;

    display: grid;
    place-items: center;

    border-radius: 9px;

    background: #f0f0f0;
    color: #111;

    font-size: 13px;
    font-weight: 700;
}

.assistant-text {
    padding-top: 4px;

    color: #e7e7e9;

    font-size: 15px;
    line-height: 1.66;
}

.assistant-text p {
    margin: 0;
}

.typing {
    height: 24px;

    display: flex;
    align-items: center;
    gap: 4px;
}

.typing i {
    width: 5px;
    height: 5px;

    border-radius: 50%;

    background: #8d8d94;

    animation:
        typing 1.15s ease-in-out infinite;
}

.typing i:nth-child(2) {
    animation-delay: .14s;
}

.typing i:nth-child(3) {
    animation-delay: .28s;
}

.chat-composer-wrap {
    width: 100%;

    padding:
        10px
        16px
        max(10px, env(safe-area-inset-bottom));

    background:
        linear-gradient(
            to top,
            var(--bg) 78%,
            rgba(15,15,16,0)
        );
}

.chat-composer-wrap[hidden] {
    display: none;
}

.composer-chat {
    width: min(var(--max), 100%);
    margin: 0 auto;
}

.footnote {
    width: min(var(--max), 100%);

    margin:
        7px
        auto
        0;

    text-align: center;

    color: var(--muted-2);

    font-size: 10px;
    line-height: 1.3;
}

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

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

@keyframes typing {
    0%,
    60%,
    100% {
        opacity: .32;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

@media (max-width: 620px) {
    .header {
        min-height: 56px;

        padding-left: 14px;
        padding-right: 14px;
    }

    .brand {
        font-size: 16px;
    }

    .brand-icon {
        width: 28px;
        height: 28px;

        border-radius: 8px;
    }

    .dev-badge {
        font-size: 11px;
    }

    .start {
        width: calc(100% - 24px);

        padding:
            20px
            0
            64px;
    }

    .start h1 {
        margin-bottom: 22px;

        font-size: 27px;
    }

    .composer {
        border-radius: 22px;
    }

    .suggestions {
        grid-template-columns: 1fr;
        gap: 7px;

        margin-top: 11px;
    }

    .suggestions button {
        min-height: 44px;
    }

    .chat {
        width: calc(100% - 24px);

        padding:
            18px
            0
            136px;
    }

    .user-bubble {
        max-width: 87%;
    }

    .chat-composer-wrap {
        padding-left: 10px;
        padding-right: 10px;
    }
}

@media (max-height: 700px) {
    .start {
        justify-content: flex-start;
        padding-top: 52px;
    }
}

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