/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #eef2ff;  /* 浅蓝色基调 */
    color: #1e293b;
    height: 100vh;
    overflow: hidden;
}

.app-wrapper {
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

/* ========= 左侧边栏 ========= */
.sidebar {
    width: 280px;
    background: #ffffffdd;
    backdrop-filter: blur(12px);
    border-right: 1px solid #cbd5e1;
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    gap: 20px;
    overflow-y: auto;
}

.sidebar-header .logo {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-align: center;
}

.new-chat-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 32px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    font-size: 16px;
}
.new-chat-btn:hover {
    background: #2563eb;
    transform: scale(0.98);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 16px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: 0.1s;
}
.history-item:hover, .history-item.active {
    background: #dbeafe;
    color: #1e40af;
}

/* ========= 主区域 ========= */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 0 24px 24px;
}

.top-nav {
    display: flex;
    justify-content: flex-end;
    padding: 16px 0;
}
.auth-links a, .user-info a {
    margin-left: 20px;
    text-decoration: none;
    color: #3b82f6;
    font-weight: 500;
}

.marquee-wrapper {
    background: #bfdbfe;
    border-radius: 40px;
    padding: 10px 20px;
    margin: 8px 0 20px;
    overflow: hidden;
}
.marquee-text {
    white-space: nowrap;
    animation: scroll 40s linear infinite;
    font-weight: 500;
    color: #1e3a8a;
}
@keyframes scroll {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* 广告位：一行三列，居中，有卡片感 */
.ads-row {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.ad-card {
    background: white;
    border-radius: 24px;
    padding: 12px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    transition: 0.2s;
    min-width: 140px;
    text-align: center;
}
.ad-card a {
    text-decoration: none;
    color: #1e293b;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.ad-img {
    max-width: 100px;
    border-radius: 12px;
}
.ad-card:hover {
    background: #f0f4ff;
    transform: translateY(-2px);
}

/* 聊天面板 */
.chat-panel {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(8px);
    border-radius: 48px;
    padding: 24px 28px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.05);
}

.brand-header {
    text-align: center;
    margin-bottom: 24px;
}
.brand-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.messages-container {
    background: #ffffffcc;
    border-radius: 32px;
    padding: 20px;
    height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

.message {
    display: flex;
}
.message.user {
    justify-content: flex-end;
}
.message .bubble {
    max-width: 75%;
    padding: 10px 18px;
    border-radius: 24px;
    font-size: 0.95rem;
    line-height: 1.4;
    background: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.message.user .bubble {
    background: #3b82f6;
    color: white;
    border-bottom-right-radius: 4px;
}
.message.assistant .bubble {
    background: #f1f5f9;
    color: #0f172a;
    border-bottom-left-radius: 4px;
}

/* 输入框 */
.input-group {
    display: flex;
    gap: 12px;
    background: white;
    border-radius: 48px;
    padding: 6px 6px 6px 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid #cbd5e1;
}
.input-group textarea {
    flex: 1;
    border: none;
    padding: 12px 0;
    font-size: 15px;
    resize: none;
    outline: none;
    font-family: inherit;
    background: transparent;
}
.input-group button {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 0 28px;
    border-radius: 40px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.input-group button:hover {
    background: #2563eb;
}

/* 底部链接 */
.bottom-links {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}
.bottom-links a {
    color: #3b82f6;
    text-decoration: none;
    margin: 0 8px;
}
.bottom-links .dot {
    color: #94a3b8;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.4);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-card {
    background: white;
    border-radius: 32px;
    width: 90%;
    max-width: 500px;
    padding: 24px;
    position: relative;
}
.close-modal {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #64748b;
}
/* 手机底部固定广告 */
.mobile-bottom-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    text-align: center;
    padding: 8px;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
    z-index: 99;
    display: none;
}
@media (max-width: 768px) {
    .sidebar { display: none; }
    .mobile-bottom-fixed { display: block; }
    .ads-row { gap: 12px; }
    .ad-card { min-width: 100px; }
    .chat-panel { padding: 16px; }
}
/* ========= 手机端专项优化 ========= */
@media (max-width: 768px) {
    /* 跑马灯容器：确保文字完整显示 */
    .marquee-wrapper {
        padding: 8px 16px;
        margin: 8px 0 12px;
        border-radius: 30px;
        overflow-x: auto;      /* 允许横向滚动，但隐藏滚动条 */
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    .marquee-text {
        animation: none;       /* 手机端可禁用跑马灯滚动，改为可手动滑动 */
        display: inline-block;
        white-space: nowrap;
        padding-right: 20px;
    }
    /* 或者保留滚动但速度更慢且不溢出 */
    /* 如果仍想自动滚动，可用下面代码代替上面两行 */
    /*
    .marquee-text {
        animation: scroll 30s linear infinite;
        white-space: nowrap;
        padding-left: 100%;
        display: inline-block;
    }
    */

    /* 压缩顶部间距，让输入框直接可见 */
    .main-content {
        padding: 0 12px 12px;
    }
    .top-nav {
        padding: 8px 0;
    }
    .brand-title {
        font-size: 1.4rem;
        margin: 4px 0;
    }
    .brand-header {
        margin-bottom: 8px;
    }
    .ads-row {
        gap: 8px;
        margin-bottom: 12px;
    }
    .ad-card {
        padding: 6px 10px;
        min-width: 80px;
    }
    .ad-card span {
        font-size: 12px;
    }
    .chat-panel {
        padding: 12px;
        border-radius: 28px;
    }
    .messages-container {
        height: 350px;          /* 减小聊天区域高度 */
        padding: 12px;
        margin-bottom: 12px;
    }
    .input-group {
        padding: 4px 4px 4px 16px;
    }
    .input-group textarea {
        font-size: 14px;
        padding: 8px 0;
    }
    .input-group button {
        padding: 0 20px;
        font-size: 14px;
    }
    .bottom-links {
        margin-top: 12px;
        font-size: 12px;
    }
}
/* 模型标签样式 */
.model-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: #3b82f6;
    margin-bottom: 6px;
    border-left: 3px solid #3b82f6;
    padding-left: 8px;
}
.model-thinking {
    color: #64748b;
    font-style: italic;
}
.message.assistant .bubble {
    background: #f8fafc;
}