/* =========================================================
   CZ AI STUDIO
   Responsive Blue / Black Theme
========================================================= */


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


:root {

    --bg: #050810;

    --panel: rgba(8, 14, 28, 0.78);

    --panel-light: rgba(15, 25, 48, 0.72);

    --border: rgba(66, 143, 255, 0.18);

    --blue: #3b8cff;

    --blue-light: #69b5ff;

    --text: #e8f1ff;

    --text-secondary: #7f91ad;

    --input: rgba(10, 18, 35, 0.88);

    --shadow:
        0 0 40px rgba(30, 110, 255, 0.08);

}


/* =========================================================
   基础
========================================================= */

html,
body {

    width: 100%;
    height: 100%;

    min-height: 100%;

    overflow: hidden;

    font-family:
        Inter,
        "Segoe UI",
        Arial,
        sans-serif;

    color: var(--text);

    background: var(--bg);

}


/*
   防止手机点击按钮时出现蓝色高亮
*/

button,
input,
textarea,
select {

    -webkit-tap-highlight-color:
        transparent;

}


/* =========================================================
   开场 Logo
========================================================= */

#intro {

    position: fixed;

    inset: 0;

    z-index: 9999;

    display: flex;

    justify-content: center;

    align-items: center;

    background: #02040a;

    animation:
        introFade 2.8s ease forwards;

}


#intro img {

    width:
        min(420px, 55vw);

    max-height: 45vh;

    object-fit: contain;

    animation:
        logoEnter 1.8s ease;

}


@keyframes logoEnter {

    0% {

        opacity: 0;

        transform:
            scale(.92)
            translateY(12px);

        filter:
            blur(12px);

    }

    100% {

        opacity: 1;

        transform:
            scale(1)
            translateY(0);

        filter:
            blur(0);

    }

}


@keyframes introFade {

    0%,
    65% {

        opacity: 1;

        visibility: visible;

    }

    100% {

        opacity: 0;

        visibility: hidden;

        pointer-events: none;

    }

}


/* =========================================================
   背景网格
========================================================= */

.background-grid {

    position: fixed;

    inset: 0;

    pointer-events: none;

    opacity: .22;

    background-image:

        linear-gradient(
            rgba(55, 130, 255, .08) 1px,
            transparent 1px
        ),

        linear-gradient(
            90deg,
            rgba(55, 130, 255, .08) 1px,
            transparent 1px
        );

    background-size:
        48px 48px;

    mask-image:
        linear-gradient(
            to bottom,
            black,
            transparent
        );

}


.glow {

    position: fixed;

    width: 500px;

    height: 500px;

    border-radius: 50%;

    pointer-events: none;

    filter: blur(120px);

    opacity: .12;

}


.glow-1 {

    background: #006eff;

    top: -250px;

    left: 20%;

}


.glow-2 {

    background: #0051ff;

    right: -250px;

    bottom: -250px;

}


/* =========================================================
   App
========================================================= */

.app {

    position: relative;

    display: flex;

    width: 100%;

    height: 100dvh;

    min-height: 100dvh;

}


/* =========================================================
   Sidebar
========================================================= */

.sidebar {

    width: 270px;

    min-width: 270px;

    height: 100%;

    padding:
        26px 18px;

    background:
        linear-gradient(
            180deg,
            rgba(7, 13, 27, .94),
            rgba(4, 8, 17, .96)
        );

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

    display: flex;

    flex-direction: column;

    z-index: 10;

}


.brand {

    display: flex;

    align-items: center;

    gap: 12px;

    margin-bottom: 28px;

}


.brand-logo {

    width: 40px;

    height: 40px;

    object-fit: contain;

}


.brand-title {

    font-size: 15px;

    font-weight: 700;

    letter-spacing: 2px;

}


.brand-subtitle {

    margin-top: 3px;

    font-size: 8px;

    letter-spacing: 1.5px;

    color:
        var(--text-secondary);

}


.new-chat {

    width: 100%;

    height: 46px;

    border:
        1px solid
        rgba(70, 145, 255, .28);

    border-radius: 8px;

    background:
        linear-gradient(
            135deg,
            rgba(34, 104, 220, .22),
            rgba(25, 55, 110, .12)
        );

    color: #dceaff;

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 8px;

    cursor: pointer;

    transition: .25s;

}


.new-chat:hover {

    border-color:
        var(--blue);

    box-shadow:
        0 0 25px
        rgba(45, 125, 255, .18);

}


.side-title {

    margin:
        30px
        10px
        12px;

    color: #526783;

    font-size: 9px;

    letter-spacing: 2px;

}


.history {

    flex: 1;

    overflow-y: auto;

}


.history-item {

    display: flex;

    align-items: center;

    gap: 10px;

    height: 40px;

    padding: 0 10px;

    border-radius: 6px;

    color: #8ea0ba;

    font-size: 12px;

    cursor: pointer;

}


.history-item.active {

    background:
        rgba(44, 112, 220, .12);

    color: #d7e7ff;

}


.history-dot {

    width: 5px;

    height: 5px;

    border-radius: 50%;

    background: #3d8fff;

}


.sidebar-bottom {

    padding-top: 15px;

    border-top:
        1px solid
        rgba(255,255,255,.05);

}


.system-status {

    display: flex;

    align-items: center;

    gap: 10px;

}


.status-dot {

    width: 8px;

    height: 8px;

    border-radius: 50%;

    background: #28e38a;

    box-shadow:
        0 0 12px #28e38a;

}


.status-title {

    font-size: 9px;

    letter-spacing: 1px;

    color: #82a0c8;

}


.status-desc {

    margin-top: 3px;

    font-size: 8px;

    color: #53647c;

}


/* =========================================================
   Main
========================================================= */

.main {

    position: relative;

    flex: 1;

    min-width: 0;

    min-height: 0;

    display: flex;

    flex-direction: column;

}


/* =========================================================
   Topbar
========================================================= */

.topbar {

    height: 76px;

    min-height: 76px;

    padding:
        0 32px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    border-bottom:
        1px solid
        rgba(70, 130, 220, .12);

    background:
        rgba(4, 8, 17, .55);

    backdrop-filter:
        blur(20px);

    -webkit-backdrop-filter:
        blur(20px);

    z-index: 5;

}


.model-title {

    font-size: 15px;

    font-weight: 600;

}


.model-status {

    margin-top: 5px;

    display: flex;

    align-items: center;

    gap: 6px;

    font-size: 8px;

    letter-spacing: 1.5px;

    color: #5f7698;

}


.model-status span {

    width: 5px;

    height: 5px;

    border-radius: 50%;

    background: #35dc8b;

}


.top-actions {

    display: flex;

    gap: 8px;

}


.top-actions button {

    border:
        1px solid
        rgba(85, 130, 190, .16);

    background:
        rgba(10, 20, 38, .55);

    color: #7286a4;

    padding:
        8px 12px;

    border-radius: 5px;

    font-size: 8px;

    letter-spacing: 1px;

    cursor: pointer;

}


.top-actions button:hover {

    color: white;

    border-color:
        var(--blue);

}


/* =========================================================
   Chat
========================================================= */

.chat {

    flex: 1;

    min-height: 0;

    overflow-y: auto;

    overscroll-behavior:
        contain;

    -webkit-overflow-scrolling:
        touch;

    padding:
        40px
        max(5vw, 30px)
        150px;

    scrollbar-width:
        thin;

    scrollbar-color:
        rgba(66,143,255,.25)
        transparent;

}


/* Chrome / Safari scrollbar */

.chat::-webkit-scrollbar {

    width: 5px;

}


.chat::-webkit-scrollbar-track {

    background:
        transparent;

}


.chat::-webkit-scrollbar-thumb {

    background:
        rgba(66,143,255,.25);

    border-radius: 10px;

}


/* =========================================================
   Welcome
========================================================= */

.welcome {

    max-width: 720px;

    margin:
        12vh auto 0;

    text-align: center;

}


.welcome-logo {

    width: 70px;

    height: 70px;

    margin: auto;

    display: flex;

    align-items: center;

    justify-content: center;

    border:
        1px solid
        rgba(67, 139, 255, .2);

    border-radius: 18px;

    background:
        rgba(16, 30, 58, .5);

    box-shadow:
        0 0 40px
        rgba(20, 100, 255, .1);

}


.welcome-logo img {

    width: 100%;

    height: 100%;

    object-fit: cover;

}


.welcome-title {

    margin-top: 24px;

    font-size: 25px;

    letter-spacing: 5px;

    font-weight: 700;

}


.welcome-desc {

    margin-top: 13px;

    line-height: 1.8;

    font-size: 12px;

    color: #71839e;

}


.suggestions {

    margin-top: 28px;

    display: flex;

    justify-content: center;

    flex-wrap: wrap;

    gap: 8px;

}


.suggestions button {

    padding:
        10px 14px;

    border:
        1px solid
        rgba(71, 128, 210, .18);

    background:
        rgba(10, 20, 40, .55);

    color: #7f94b4;

    border-radius: 6px;

    font-size: 10px;

    cursor: pointer;

    transition: .2s;

}


.suggestions button:hover {

    color: #d9e9ff;

    border-color:
        rgba(65, 139, 255, .5);

}


/* =========================================================
   Message
========================================================= */

.message {

    display: flex;

    width: 100%;

    max-width: 850px;

    margin:
        20px auto;

    animation:
        messageIn .3s ease;

}


@keyframes messageIn {

    from {

        opacity: 0;

        transform:
            translateY(8px);

    }

    to {

        opacity: 1;

        transform:
            translateY(0);

    }

}


.message.user {

    justify-content:
        flex-end;

}


.message-content {

    max-width: 78%;

    padding:
        14px 17px;

    border-radius: 10px;

    font-size: 14px;

    line-height: 1.7;

    word-break:
        break-word;

    overflow-wrap:
        anywhere;

}


.message.user
.message-content {

    background:
        linear-gradient(
            135deg,
            rgba(27, 91, 190, .65),
            rgba(21, 57, 117, .62)
        );

    border:
        1px solid
        rgba(83, 151, 255, .22);

}


.message.ai
.message-content {

    background:
        rgba(10, 18, 34, .82);

    border:
        1px solid
        rgba(67, 124, 215, .13);

}


/* =========================================================
   Markdown
========================================================= */

.message-content p {

    margin-bottom: 8px;

}


.message-content p:last-child {

    margin-bottom: 0;

}


.message-content ul,
.message-content ol {

    margin:
        8px 0
        8px 20px;

}


.message-content li {

    margin:
        4px 0;

}


.message-content blockquote {

    margin:
        10px 0;

    padding:
        8px 12px;

    border-left:
        3px solid
        var(--blue);

    background:
        rgba(40, 100, 200, .08);

    color:
        #9cafc9;

}


.message-content pre {

    margin:
        14px 0;

    padding:
        15px;

    overflow-x: auto;

    border-radius: 7px;

    background:
        #050a13;

}


.message-content code {

    font-family:
        Consolas,
        "SFMono-Regular",
        monospace;

    font-size: 12px;

}


.message-content
:not(pre) > code {

    padding:
        2px 5px;

    border-radius: 4px;

    background:
        rgba(60, 120, 220, .12);

    color:
        #8fc4ff;

}


/* =========================================================
   Input Area
========================================================= */

.input-area {

    position: absolute;

    left: 0;

    right: 0;

    bottom: 0;

    padding:
        18px
        max(5vw, 30px)
        20px;

    background:
        linear-gradient(
            transparent,
            rgba(5,8,16,.96) 35%
        );

    z-index: 4;

    pointer-events:
        none;

}


.input-area > * {

    pointer-events:
        auto;

}


/* =========================================================
   Input Header
========================================================= */

.input-header {

    max-width: 850px;

    margin:
        0 auto 8px;

    display: flex;

    align-items: center;

    justify-content: space-between;

}


.input-brand {

    display: flex;

    align-items: center;

    gap: 7px;

    font-size: 8px;

    letter-spacing: 1.5px;

    color: #6e84a4;

}


.input-brand img {

    width: 18px;

    height: 18px;

    object-fit: contain;

}


.input-info {

    display: flex;

    gap: 8px;

    font-size: 7px;

    color: #455a77;

    letter-spacing: 1px;

}


.separator {

    color: #243954;

}


/* =========================================================
   Input Box
========================================================= */

.input-box {

    max-width: 850px;

    min-height: 64px;

    margin:
        0 auto;

    display: flex;

    align-items: flex-end;

    gap: 10px;

    padding:
        10px
        10px
        10px
        17px;

    border:
        1px solid
        rgba(65, 130, 230, .25);

    border-radius: 11px;

    background:
        rgba(8, 15, 29, .92);

    box-shadow:
        0 10px 50px
        rgba(0,0,0,.35);

    transition: .25s;

}


.input-box:focus-within {

    border-color:
        rgba(66, 145, 255, .55);

    box-shadow:
        0 0 35px
        rgba(38, 112, 255, .1);

}


#messageInput {

    flex: 1;

    width: 100%;

    min-width: 0;

    resize: none;

    max-height: 180px;

    border: none;

    outline: none;

    background:
        transparent;

    color: #e9f2ff;

    font-size: 14px;

    line-height: 1.6;

    padding:
        7px 0;

    font-family:
        inherit;

}


#messageInput::placeholder {

    color: #526680;

}


#sendBtn {

    flex:
        0 0 auto;

    width: 43px;

    height: 43px;

    border: none;

    border-radius: 8px;

    background:
        linear-gradient(
            135deg,
            #2c7fff,
            #1653c5
        );

    color: white;

    cursor: pointer;

    transition: .2s;

}


#sendBtn:hover {

    transform:
        translateY(-2px);

    box-shadow:
        0 0 20px
        rgba(45, 125, 255, .35);

}


#sendBtn:active {

    transform:
        scale(.94);

}


.send-icon {

    font-size: 17px;

}


/* =========================================================
   Footer
========================================================= */

.input-footer {

    max-width: 850px;

    margin:
        8px auto 0;

    display: flex;

    justify-content:
        space-between;

    font-size: 7px;

    letter-spacing: 1px;

    color: #394b64;

}


/* =========================================================
   Modal
========================================================= */

.modal {

    position: fixed;

    inset: 0;

    z-index: 5000;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 20px;

    background:
        rgba(0,0,0,.65);

    backdrop-filter:
        blur(10px);

    -webkit-backdrop-filter:
        blur(10px);

}


.modal.hidden {

    display: none;

}


.modal-box {

    width:
        min(500px, 90vw);

    max-height:
        90vh;

    overflow-y:
        auto;

    padding: 24px;

    border:
        1px solid
        rgba(69, 135, 235, .25);

    border-radius: 12px;

    background:
        #080f1e;

    box-shadow:
        0 20px 80px
        rgba(0,0,0,.6);

}


.modal-header {

    display: flex;

    justify-content:
        space-between;

    font-size: 12px;

    letter-spacing: 2px;

    margin-bottom: 24px;

}


.modal-header button {

    border: none;

    background: none;

    color: #7489a5;

    font-size: 22px;

    cursor: pointer;

}


.setting-item {

    margin-bottom: 18px;

}


.setting-item label {

    display: block;

    margin-bottom: 7px;

    font-size: 8px;

    letter-spacing: 1.5px;

    color: #7185a1;

}


.setting-item input,
.setting-item select,
.setting-item textarea {

    width: 100%;

    border:
        1px solid
        rgba(76, 124, 190, .18);

    border-radius: 7px;

    background:
        #050b16;

    color: white;

    padding: 11px;

    outline: none;

}


.setting-item textarea {

    height: 100px;

    resize: vertical;

}


.save-settings {

    width: 100%;

    padding: 12px;

    border: none;

    border-radius: 7px;

    background:
        linear-gradient(
            135deg,
            #287dff,
            #194db0
        );

    color: white;

    cursor: pointer;

}


/* =========================================================
   平板
========================================================= */

@media (max-width: 1000px) {

    .sidebar {

        width: 230px;

        min-width: 230px;

    }


    .input-area {

        padding-left: 25px;

        padding-right: 25px;

    }


    .chat {

        padding-left: 25px;

        padding-right: 25px;

    }

}


/* =========================================================
   手机
========================================================= */

@media (max-width: 800px) {


    html,
    body {

        width: 100%;

        height: 100%;

        height: 100dvh;

        overflow: hidden;

    }


    /* -----------------------------------------
       隐藏侧边栏
    ----------------------------------------- */

    .sidebar {

        display: none;

    }


    /* -----------------------------------------
       主程序
    ----------------------------------------- */

    .app {

        width: 100%;

        height: 100dvh;

        min-height: 100dvh;

    }


    .main {

        width: 100%;

        height: 100%;

    }


    /* -----------------------------------------
       顶部
    ----------------------------------------- */

    .topbar {

        height: 62px;

        min-height: 62px;

        padding:
            0 16px;

        background:
            rgba(4, 8, 17, .78);

    }


    .model-title {

        font-size: 14px;

    }


    .model-status {

        margin-top: 3px;

        font-size: 7px;

    }


    /*
       手机不显示 Settings / Clear
       因为当前用户模式本身就没有
    */

    .top-actions {

        gap: 5px;

    }


    .top-actions button {

        padding:
            7px 9px;

        font-size: 7px;

    }


    /* -----------------------------------------
       Chat
    ----------------------------------------- */

    .chat {

        padding:
            25px
            14px
            150px;

        overscroll-behavior:
            contain;

    }


    /* -----------------------------------------
       Welcome
    ----------------------------------------- */

    .welcome {

        max-width: 100%;

        margin:
            10vh auto 0;

        padding:
            0 5px;

    }


    .welcome-logo {

        width: 62px;

        height: 62px;

        border-radius: 16px;

    }


    .welcome-logo img {

        width: 38px;

        height: 38px;

    }


    .welcome-title {

        margin-top: 20px;

        font-size: 21px;

        letter-spacing: 4px;

    }


    .welcome-desc {

        margin-top: 10px;

        font-size: 11px;

        line-height: 1.7;

    }


    .suggestions {

        margin-top: 22px;

        gap: 6px;

    }


    .suggestions button {

        padding:
            9px 11px;

        font-size: 9px;

    }


    /* -----------------------------------------
       消息
    ----------------------------------------- */

    .message {

        max-width: 100%;

        margin:
            14px 0;

    }


    .message-content {

        max-width: 88%;

        padding:
            11px 13px;

        border-radius: 9px;

        font-size: 14px;

        line-height: 1.65;

    }


    .message-content pre {

        margin:
            10px -3px;

        padding:
            12px;

        border-radius: 6px;

    }


    .message-content code {

        font-size: 11px;

    }


    /* -----------------------------------------
       输入区域
    ----------------------------------------- */

    .input-area {

        left: 0;

        right: 0;

        bottom: 0;

        padding:
            10px
            12px
            calc(
                10px +
                env(safe-area-inset-bottom)
            );

        background:
            linear-gradient(
                transparent,
                rgba(5,8,16,.97) 25%
            );

    }


    /* -----------------------------------------
       Input Header
    ----------------------------------------- */

    .input-header {

        margin-bottom: 6px;

        padding:
            0 2px;

    }


    .input-brand {

        font-size: 7px;

    }


    .input-brand img {

        width: 16px;

        height: 16px;

    }


    .input-info {

        display: none;

    }


    /* -----------------------------------------
       Input Box
    ----------------------------------------- */

    .input-box {

        width: 100%;

        min-height: 56px;

        padding:
            7px
            7px
            7px
            13px;

        gap: 7px;

        border-radius: 10px;

    }


    #messageInput {

        min-height: 40px;

        max-height: 140px;

        padding:
            8px 0;

        font-size: 16px;

        /*
           16px 可以防止 iPhone Safari
           自动放大输入框
        */

    }


    #sendBtn {

        width: 40px;

        height: 40px;

        border-radius: 8px;

    }


    .send-icon {

        font-size: 15px;

    }


    /* -----------------------------------------
       Footer
    ----------------------------------------- */

    .input-footer {

        margin-top: 6px;

        padding:
            0 2px;

        font-size: 6px;

    }


}


/* =========================================================
   小屏手机
========================================================= */

@media (max-width: 420px) {


    .topbar {

        padding:
            0 13px;

    }


    .model-title {

        font-size: 13px;

    }


    .chat {

        padding-left: 11px;

        padding-right: 11px;

    }


    .welcome {

        margin-top:
            8vh;

    }


    .welcome-title {

        font-size: 19px;

        letter-spacing: 3px;

    }


    .welcome-desc {

        font-size: 10px;

    }


    .suggestions button {

        font-size: 8px;

        padding:
            8px 9px;

    }


    .message-content {

        max-width: 92%;

        font-size: 13px;

    }


    .input-area {

        padding-left: 9px;

        padding-right: 9px;

    }


    .input-footer {

        font-size: 5px;

    }

}


/* =========================================================
   横屏手机
========================================================= */

@media
(max-width: 900px)
and (orientation: landscape) {


    .topbar {

        height: 54px;

        min-height: 54px;

    }


    .chat {

        padding-top: 18px;

        padding-bottom: 125px;

    }


    .welcome {

        margin-top:
            5vh;

    }


    .welcome-logo {

        width: 50px;

        height: 50px;

    }


    .welcome-logo img {

        width: 30px;

        height: 30px;

    }


    .welcome-title {

        margin-top: 10px;

        font-size: 17px;

    }


    .welcome-desc {

        margin-top: 5px;

    }


    .suggestions {

        margin-top: 12px;

    }


}


/* =========================================================
   减少动画
   用户系统开启“减少动态效果”时使用
========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {

        animation-duration:
            0.01ms !important;

        animation-iteration-count:
            1 !important;

        transition-duration:
            0.01ms !important;

        scroll-behavior:
            auto !important;

    }

}
