* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #070b14;
    --panel: #0d1422;
    --border: #1d293b;
    --text: #f3f6fc;
    --muted: #8492a8;
    --blue: #528bff;
    --cyan: #54e4ff;
}

body {
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.app {
    min-height: 100vh;
    display: flex;
    background: radial-gradient(ellipse at 60% 35%, #10203b 0%, transparent 55%), var(--bg);
}
.sidebar {
    width: 260px;
    min-height: 100vh;
    padding: 25px 18px;
    background: #0a101c;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-brand h2,
.topbar h2 {
    font-size: 23px;
    letter-spacing: 2px;
    font-weight: 800;
}

.sidebar-brand h2 span,
.topbar h2 span {
    color: var(--cyan);
}

.sidebar-brand p,
.topbar p {
    color: var(--muted);
    margin-top: 7px;
    font-size: 12px;
}

.new-chat-button {
    width: 100%;
    margin-top: 35px;
    padding: 13px;
    border: 1px solid #29466d;
    border-radius: 11px;
    background: #13243c;
    color: #e8f1ff;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
}

.new-chat-button:hover {
    background: #1a3455;
    border-color: var(--blue);
}
.history-section {
    margin-top: 38px;
}

.history-title {
    color: #687991;
    font-size: 10px;
    letter-spacing: 1.5px;
    font-weight: 700;
    margin-bottom: 15px;
}

.empty-history {
    color: #66758d;
    font-size: 12px;
    line-height: 1.6;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    color: #718198;
    font-size: 11px;
}
.main-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    padding: 22px 5%;
    border-bottom: 1px solid rgba(132, 146, 168, 0.14);
    background: rgba(7, 11, 20, 0.45);
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 35px;
    padding: 40px 20px;
}

.welcome {
    text-align: center;
    max-width: 650px;
}

.welcome h1 {
    font-size: clamp(30px, 5vw, 46px);
    line-height: 1.2;
    margin-bottom: 15px;
    letter-spacing: -1.2px;
}

.welcome p {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.7;
}

.chat-box {
    width: 100%;
    max-width: 760px;
    height: 460px;
    background: rgba(13, 20, 34, 0.92);
    border: 1px solid var(--border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
}
.messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.ai-message {
    background: #142238;
    color: #e1eaff;
    padding: 15px 18px;
    border: 1px solid #243650;
    border-radius: 4px 15px 15px 15px;
    max-width: 88%;
    line-height: 1.7;
    overflow-wrap: anywhere;
    margin: 15px auto 15px 0;
}

.input-area {
    display: flex;
    gap: 12px;
    padding: 17px;
    border-top: 1px solid var(--border);
    background: rgba(7, 11, 20, 0.45);
}

.input-area input {
    flex: 1;
    min-width: 0;
    padding: 15px 16px;
    border: 1px solid #293750;
    border-radius: 12px;
    background: #080e19;
    color: var(--text);
    outline: none;
    font-size: 14px;
}

.input-area input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(82, 139, 255, 0.12);
}

.input-area button {
    padding: 12px 23px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--blue), #3970e8);
    color: white;
    cursor: pointer;
    font-weight: 700;
}

.input-area button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.thinking-message {
    margin-top: 15px;
    color: var(--cyan);
    font-size: 14px;
}

@media (max-width: 700px) {
    .sidebar {
        width: 190px;
        padding: 20px 12px;
    }

    .sidebar-brand h2 {
        font-size: 19px;
    }

    .topbar {
        padding: 18px;
    }

    .chat-container {
        padding: 30px 12px;
        gap: 25px;
    }

    .welcome h1 {
        font-size: 28px;
    }

    .welcome p {
        font-size: 13px;
    }

    .chat-box {
        height: 450px;
    }

    .messages {
        padding: 15px;
    }

    .ai-message {
        max-width: 96%;
        font-size: 14px;
    }

    .input-area {
        gap: 8px;
        padding: 10px;
    }

    .input-area input {
        padding: 12px 9px;
        font-size: 12px;
    }

    .input-area button {
        padding: 11px 13px;
    }
}

@media (max-width: 420px) {
    .sidebar {
        width: 145px;
        padding: 16px 9px;
    }

    .sidebar-brand h2 {
        font-size: 16px;
        letter-spacing: 1px;
    }

    .sidebar-brand p {
        font-size: 10px;
    }

    .new-chat-button {
        padding: 10px 7px;
        font-size: 12px;
    }

    .history-title {
        font-size: 9px;
    }

    .empty-history {
        font-size: 10px;
    }

    .sidebar-footer {
        flex-direction: column;
        gap: 5px;
    }
}
.user-message {
    width: fit-content;
    max-width: 75%;
    margin: 15px 0 15px auto;
    padding: 12px 16px;
    border-radius: 14px 14px 3px 14px;
    background: #174b83;
    color: white;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.thinking-message {
    width: fit-content;
    margin: 15px 0;
    padding: 12px 16px;
    border-radius: 12px;
    background: #142238;
    color: #65b8ff;
    font-size: 13px;
    animation: typingPulse 1.2s ease-in-out infinite;
}

@keyframes typingPulse {
    0%, 100% {
        opacity: 0.45;
    }
    50% {
        opacity: 1;
    }
}