* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0f0f10;
    --sidebar: #050505;
    --panel: #171719;
    --panel2: #202123;
    --text: #ececf1;
    --muted: #a6a6ad;
    --border: #303036;
    --accent: #10a37f;
    --accent2: #14cba0;
    --danger: #ef4444;
    --warning: #f59e0b;
}

body {
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.app {
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 6px;
}

.logo,
.big-logo {
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    font-weight: 900;
}

.logo {
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
}

.brand h1 {
    font-size: 1.15rem;
}

.brand p,
.topbar p,
.notice,
.help-box p,
.server-box p {
    color: var(--muted);
}

.new-chat {
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: transparent;
    color: white;
    font-weight: 800;
    text-align: left;
    cursor: pointer;
}

.new-chat:hover {
    background: var(--panel2);
}

.server-box,
.help-box {
    padding: 15px;
    border-radius: 14px;
    background: var(--panel);
    border: 1px solid var(--border);
}

.server-title,
.help-box strong {
    display: block;
    color: white !important;
    font-weight: 900;
    margin-bottom: 8px;
}

code {
    display: block;
    margin: 9px 0;
    padding: 10px;
    border-radius: 10px;
    background: #020617;
    color: #86efac;
    font-size: .88rem;
    overflow-x: auto;
}

.chat {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr auto;
    background:
        radial-gradient(circle at top, rgba(16, 163, 127, .08), transparent 32%),
        var(--bg);
    min-width: 0;
}

.topbar {
    min-height: 72px;
    padding: 14px 22px;
    border-bottom: 1px solid var(--border);
    background: rgba(15,15,16,.82);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-btn {
    display: none;
    border: none;
    background: var(--panel2);
    color: white;
    border-radius: 10px;
    padding: 9px 12px;
    cursor: pointer;
}

.status {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--muted);
}

.status span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent2);
    box-shadow: 0 0 14px var(--accent2);
}

.welcome {
    align-self: center;
    justify-self: center;
    width: min(820px, calc(100% - 40px));
    text-align: center;
}

.big-logo {
    width: 78px;
    height: 78px;
    margin: 0 auto 22px;
    font-size: 2.7rem;
    border-radius: 24px;
}

.welcome h2 {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 10px;
}

.welcome p {
    color: var(--muted);
    margin-bottom: 26px;
}

.suggestions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.suggestions button {
    min-height: 86px;
    padding: 18px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,.035);
    color: white;
    font-weight: 800;
    text-align: left;
    cursor: pointer;
}

.suggestions button:hover {
    border-color: var(--accent);
    background: rgba(16,163,127,.10);
}

.messages {
    overflow-y: auto;
    padding: 24px 0 140px;
}

.message {
    border-bottom: 1px solid rgba(255,255,255,.04);
}

.message-inner {
    width: min(900px, calc(100% - 40px));
    margin: auto;
    padding: 24px 0;
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 16px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 900;
}

.user-message {
    background: rgba(255,255,255,.025);
}

.user-message .avatar {
    background: #3b82f6;
}

.assistant-message {
    background: rgba(16,163,127,.035);
}

.assistant-message .avatar {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
}

.error-message {
    background: rgba(239, 68, 68, .08);
}

.error-message .avatar {
    background: var(--danger);
}

.content {
    line-height: 1.7;
    white-space: pre-wrap;
}

.typing {
    display: inline-flex;
    gap: 5px;
}

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

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

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

@keyframes blink {
    0%, 80%, 100% { opacity: .25; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-4px); }
}

.input-area {
    position: fixed;
    left: 300px;
    right: 0;
    bottom: 0;
    padding: 22px 20px 16px;
    background: linear-gradient(transparent, var(--bg) 25%);
}

.input-box {
    width: min(900px, 100%);
    margin: auto;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--panel2);
    padding: 10px;
}

textarea {
    resize: none;
    max-height: 180px;
    border: none;
    outline: none;
    background: transparent;
    color: white;
    font-size: 1rem;
    line-height: 1.5;
    padding: 10px;
    font-family: inherit;
}

#sendBtn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: var(--accent);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

#sendBtn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.notice {
    width: min(900px, 100%);
    margin: 10px auto 0;
    text-align: center;
    font-size: .78rem;
}

@media (max-width: 850px) {
    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: 285px;
        z-index: 200;
        transform: translateX(-100%);
        transition: .25s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .menu-btn {
        display: block;
    }

    .input-area {
        left: 0;
    }

    .suggestions {
        grid-template-columns: 1fr;
    }
}
