:root {
    --bg: #f4ede1;
    --bg-deep: #1f2937;
    --panel: rgba(255, 248, 236, 0.88);
    --panel-strong: rgba(255, 252, 246, 0.98);
    --line: rgba(31, 41, 55, 0.12);
    --text: #1f2937;
    --muted: #6b7280;
    --accent: #c9693c;
    --accent-deep: #7f2f12;
    --user: #f5d9c7;
    --assistant: #dbe7f7;
    --shadow: 0 28px 80px rgba(31, 41, 55, 0.16);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(201, 105, 60, 0.22), transparent 34%),
        radial-gradient(circle at bottom right, rgba(31, 41, 55, 0.18), transparent 28%),
        linear-gradient(135deg, #f7f0e4 0%, #efe2cf 48%, #e4d5c7 100%);
    font-family: "Aptos", "Trebuchet MS", sans-serif;
}

.ambient {
    position: fixed;
    width: 26rem;
    height: 26rem;
    border-radius: 999px;
    filter: blur(24px);
    opacity: 0.6;
    pointer-events: none;
}

.ambient-left {
    top: -10rem;
    left: -7rem;
    background: rgba(201, 105, 60, 0.22);
}

.ambient-right {
    right: -8rem;
    bottom: -11rem;
    background: rgba(31, 41, 55, 0.18);
}

.chat-shell {
    position: relative;
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 1.5rem;
    padding: 2rem;
    min-height: 100vh;
}

.brand-panel,
.chat-panel,
.gate-card {
    backdrop-filter: blur(16px);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.brand-panel {
    padding: 2rem;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.brand-panel h1,
.gate-card h2 {
    margin: 0;
    font-family: "Georgia", "Times New Roman", serif;
    font-size: clamp(2rem, 3vw, 3.2rem);
    line-height: 1;
}

.eyebrow,
.mini-label {
    display: inline-flex;
    font-size: 0.76rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

.brand-copy,
.gate-card p {
    margin: 0;
    line-height: 1.65;
    color: var(--muted);
}

.key-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.44);
    border: 1px solid rgba(31, 41, 55, 0.08);
}

.feature-list {
    margin: 0;
    padding-left: 1.1rem;
    display: grid;
    gap: 0.65rem;
    color: var(--text);
}

.chat-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-radius: var(--radius-lg);
    padding: 1.2rem;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0.4rem 1rem;
    border-bottom: 1px solid var(--line);
}

.status-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-top: 0.4rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(31, 41, 55, 0.08);
    font-size: 0.82rem;
    color: var(--accent-deep);
}

.chat-log {
    flex: 1;
    overflow: auto;
    padding: 1.2rem 0.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.message {
    max-width: min(88%, 46rem);
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(31, 41, 55, 0.08);
    line-height: 1.7;
}

.message-role {
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.45rem;
}

.message-user {
    align-self: flex-end;
    background: var(--user);
}

.message-assistant {
    align-self: flex-start;
    background: var(--assistant);
}

.message-system {
    align-self: center;
    width: min(100%, 38rem);
    background: rgba(255, 255, 255, 0.7);
}

.composer {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}

textarea,
input {
    width: 100%;
    border: 1px solid rgba(31, 41, 55, 0.12);
    border-radius: var(--radius-sm);
    padding: 0.95rem 1rem;
    font: inherit;
    color: var(--text);
    background: rgba(255, 255, 255, 0.82);
}

textarea:focus,
input:focus {
    outline: 2px solid rgba(201, 105, 60, 0.24);
    border-color: rgba(201, 105, 60, 0.5);
}

.composer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.composer-tip {
    color: var(--muted);
    font-size: 0.92rem;
}

button {
    border: 0;
    border-radius: 999px;
    padding: 0.9rem 1.3rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    transition: transform 0.15s ease, opacity 0.15s ease;
}

button:hover {
    transform: translateY(-1px);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.ghost-button {
    background: rgba(31, 41, 55, 0.08);
    color: var(--text);
}

.gate-overlay {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: rgba(31, 41, 55, 0.34);
}

.gate-overlay.hidden {
    display: none;
}

.gate-card {
    width: min(100%, 30rem);
    padding: 2rem;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
    background: var(--panel-strong);
}

.gate-feedback {
    min-height: 1.5rem;
    margin: 0;
    color: var(--muted);
}

.gate-feedback.is-error {
    color: #b42318;
}

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

@media (max-width: 980px) {
    .chat-shell {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .brand-panel {
        order: 2;
    }

    .chat-panel {
        min-height: 70vh;
    }
}

@media (max-width: 640px) {
    .chat-header,
    .composer-footer,
    .key-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .message {
        max-width: 100%;
    }
}

