:root {
    --background: #0c0d0f;
    --panel: #131519;
    --panel-soft: #191c21;
    --panel-border: rgba(255,255,255,.08);

    --text: #f3f0e9;
    --muted: #9c9da1;

    --accent: #c49a67;
    --accent-soft: rgba(196,154,103,.14);

    --user: #252a31;
    --clair: #181b20;

    --success: #74b78b;

    --radius-large: 24px;
    --radius-medium: 16px;
    --radius-small: 10px;
}

* {
    box-sizing: border-box;
}

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

body {
    min-height: 100vh;
    background:
        radial-gradient(
            circle at 15% 15%,
            rgba(196,154,103,.08),
            transparent 30%
        ),
        var(--background);

    color: var(--text);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
textarea {
    font: inherit;
}

.app-shell {
    min-height: 100vh;

    display: grid;
    grid-template-columns:
        minmax(280px, 360px)
        minmax(0, 1fr);
}

.clair-panel {
    min-height: 100vh;

    padding: 38px 32px;

    display: flex;
    flex-direction: column;

    border-right: 1px solid var(--panel-border);

    background:
        linear-gradient(
            180deg,
            rgba(255,255,255,.025),
            rgba(255,255,255,.005)
        );
}

.portrait-stage {
    position: relative;
}

.portrait-placeholder {
    width: 100%;
    aspect-ratio: 4 / 5;

    display: grid;
    place-items: center;

    overflow: hidden;

    border: 1px solid var(--panel-border);
    border-radius: var(--radius-large);

    background:
        radial-gradient(
            circle at 50% 30%,
            #34302c,
            #18191c 58%,
            #101114
        );

    box-shadow:
        0 30px 80px rgba(0,0,0,.35);
}

.portrait-monogram {
    font-family: Georgia, serif;
    font-size: 64px;
    letter-spacing: -.08em;

    color: rgba(243,240,233,.78);
}

.presence {
    position: absolute;
    right: 16px;
    bottom: 16px;

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

    padding: 8px 12px;

    border: 1px solid var(--panel-border);
    border-radius: 999px;

    background: rgba(10,11,13,.78);
    backdrop-filter: blur(12px);

    color: #d9d9d9;
    font-size: 13px;
}

.presence-dot {
    width: 8px;
    height: 8px;

    display: inline-block;

    border-radius: 50%;
    background: var(--success);

    box-shadow:
        0 0 0 4px rgba(116,183,139,.10);
}

.identity {
    padding: 28px 4px 22px;
}

.eyebrow {
    margin: 0 0 8px;

    color: var(--accent);

    font-size: 11px;
    font-weight: 700;
    letter-spacing: .18em;
}

.identity h1 {
    margin: 0;

    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: clamp(34px, 3vw, 48px);
    font-weight: 500;
    letter-spacing: -.035em;
}

.role {
    margin: 9px 0 0;

    color: #d6d3cd;
    font-size: 16px;
}

.languages {
    margin: 12px 0 0;

    color: var(--muted);
    font-size: 13px;
    letter-spacing: .12em;
}

.system-card {
    margin-top: auto;
    padding: 8px 0;

    border-top: 1px solid var(--panel-border);
}

.system-row {
    padding: 10px 2px;

    display: flex;
    justify-content: space-between;
    gap: 20px;

    color: var(--muted);
    font-size: 12px;
}

.system-row strong {
    color: #d9d6cf;
    font-weight: 500;
}

.conversation-panel {
    min-width: 0;
    min-height: 100vh;

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

    background: rgba(12,13,15,.72);
}

.conversation-header {
    min-height: 92px;

    padding: 24px clamp(24px, 5vw, 72px);

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

    border-bottom: 1px solid var(--panel-border);
}

.conversation-header h2 {
    margin: 0;

    font-family: Georgia, serif;
    font-size: 25px;
    font-weight: 500;
}

.connection-badge {
    display: flex;
    align-items: center;
    gap: 8px;

    padding: 8px 12px;

    border: 1px solid var(--panel-border);
    border-radius: 999px;

    color: var(--muted);
    font-size: 12px;
}

.messages {
    overflow-y: auto;

    padding:
        40px
        clamp(24px, 7vw, 110px)
        24px;

    scroll-behavior: smooth;
}

.message {
    max-width: 780px;
    margin-bottom: 26px;
}

.user-message {
    margin-left: auto;
}

.message-label {
    margin: 0 0 8px 4px;

    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.user-message .message-label {
    text-align: right;
    margin-right: 4px;
}

.message-bubble {
    padding: 16px 18px;

    border: 1px solid var(--panel-border);
    border-radius: var(--radius-medium);

    background: var(--clair);

    color: #e9e7e1;

    font-size: 15px;
    line-height: 1.65;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.user-message .message-bubble {
    background: var(--user);
}

.thinking .message-bubble {
    color: var(--muted);
}

.source-panel {
    margin:
        0
        clamp(24px, 7vw, 110px)
        18px;

    padding: 14px 16px;

    border: 1px solid var(--panel-border);
    border-radius: var(--radius-medium);

    background: var(--panel-soft);
}

.source-heading {
    display: flex;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 8px;

    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.source-item {
    padding: 9px 0;

    border-top: 1px solid var(--panel-border);

    color: #d8d6d0;
    font-size: 13px;
}

.source-item a {
    color: var(--accent);
    text-decoration: none;
}

.source-item a:hover {
    text-decoration: underline;
}

.hidden {
    display: none;
}

.composer {
    margin:
        0
        clamp(24px, 7vw, 110px);

    padding: 10px 10px 10px 16px;

    display: flex;
    align-items: flex-end;
    gap: 12px;

    border: 1px solid var(--panel-border);
    border-radius: 20px;

    background: var(--panel);

    box-shadow:
        0 20px 50px rgba(0,0,0,.24);
}

.composer:focus-within {
    border-color: rgba(196,154,103,.45);
}

textarea {
    width: 100%;
    max-height: 180px;

    padding: 8px 0;

    resize: none;

    border: 0;
    outline: 0;

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

    line-height: 1.5;
}

textarea::placeholder {
    color: #717378;
}

.composer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-button,
.send-button {
    min-height: 42px;

    border: 0;
    border-radius: 13px;

    cursor: pointer;
}

.icon-button {
    width: 42px;

    background: rgba(255,255,255,.05);
    color: var(--muted);
}

.icon-button:disabled {
    opacity: .45;
    cursor: default;
}

.send-button {
    padding: 0 18px;

    background: var(--accent);
    color: #17130f;

    font-weight: 700;
}

.send-button:disabled {
    opacity: .55;
    cursor: wait;
}

.composer-hint {
    margin:
        9px
        clamp(24px, 7vw, 110px)
        20px;

    color: #686a6f;
    font-size: 11px;
    text-align: center;
}

@media (max-width: 820px) {

    .app-shell {
        grid-template-columns: 1fr;
    }

    .clair-panel {
        min-height: auto;

        padding: 20px;

        display: grid;
        grid-template-columns: 90px 1fr;
        gap: 18px;

        border-right: 0;
        border-bottom: 1px solid var(--panel-border);
    }

    .portrait-placeholder {
        aspect-ratio: 1;
        border-radius: 20px;
    }

    .portrait-monogram {
        font-size: 30px;
    }

    .presence {
        display: none;
    }

    .identity {
        padding: 6px 0;
    }

    .identity h1 {
        font-size: 30px;
    }

    .system-card {
        display: none;
    }

    .conversation-panel {
        min-height: calc(100vh - 132px);
    }

    .conversation-header {
        min-height: 72px;
        padding: 18px 20px;
    }

    .messages {
        padding: 24px 18px;
    }

    .source-panel {
        margin: 0 18px 14px;
    }

    .composer {
        margin: 0 18px;
    }

    .composer-hint {
        margin:
            8px
            18px
            14px;
    }
}

.clair-portrait {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: 50% 38%;
}
