:root {
    --bg: rgb(177, 208, 219);
    --surface: #ffffff;
    --surface-raised: #f0f4f8;
    --line: #d1d9e6;
    --text: #2d3748;
    --muted: #718096;
    --accent: #3182ce;
    --user-bg: #ed8936;
    --user-text: #fff;
    --font-mono: "JetBrains Mono", monospace;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ---- shell ---- */
.console {
    width: 100%;
    max-width: 700px;
    height: 80vh;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---- header ---- */
.console__header {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-raised);
}

.header__mark {
    font-size: 18px;
    color: var(--accent);
}

.console__header h1 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.status {
    font-size: 11px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.status__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted);
}

.status--live .status__dot {
    background: #48bb78;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(72, 187, 120, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(72, 187, 120, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(72, 187, 120, 0);
    }
}

/* ---- log ---- */
.log {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.log__empty {
    margin: auto;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    animation: rise 0.2s ease;
}

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

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

.msg--user {
    align-self: flex-end;
    background: var(--user-bg);
    color: var(--user-text);
    border-bottom-right-radius: 2px;
}

.msg--model {
    align-self: flex-start;
    background: var(--surface-raised);
    border: 1px solid var(--line);
    color: var(--text);
    border-bottom-left-radius: 2px;
}

.msg__meta {
    display: block;
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.6;
}

.msg--typing {
    display: inline-flex;
    gap: 4px;
    padding: 10px 14px;
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.msg--typing span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--muted);
    animation: blink 1s infinite;
}

.msg--typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.msg--typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }
}

/* ---- composer ---- */
.composer {
    display: flex;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid var(--line);
    background: var(--surface-raised);
}

.composer textarea {
    flex: 1;
    resize: none;
    max-height: 120px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 14px;
    padding: 10px;
    border-radius: 6px;
    outline: none;
}

.composer textarea:focus {
    border-color: var(--accent);
}

.composer button {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--accent);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
}

.composer button:hover {
    filter: brightness(1.1);
}

.composer button:active {
    transform: scale(0.96);
}

.composer button:disabled {
    background: var(--line);
    cursor: not-allowed;
}

/* ---- responsive ---- */
@media (max-width: 480px) {
    body {
        padding: 0;
    }

    .console {
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
        border: none;
    }

    .msg {
        max-width: 90%;
    }
}