* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; height: 100vh; overflow: hidden; background: #0a0a1a; display: flex; }

/* 登录遮罩 */
.login-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.3); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 1000; display: flex; justify-content: center; align-items: center; }
.login-box { background: #fff; border-radius: 20px; padding: 40px 36px; width: 380px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.15); display: flex; flex-direction: column; gap: 20px; }
.login-box h2 { text-align: center; font-size: 22px; color: #1a1a2e; font-weight: 600; }
.login-box label { font-size: 13px; color: #666; font-weight: 500; }
.login-box input { width: 100%; padding: 12px 14px; border: 1px solid #e0e0e0; border-radius: 10px; font-size: 16px; outline: none; transition: border 0.2s; }
.login-box input:focus { border-color: #4a6cf7; }
.login-box .login-btn { width: 100%; padding: 12px; background: #4a6cf7; color: #fff; border: none; border-radius: 10px; font-size: 15px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.login-box .login-btn:hover { background: #3b5de7; }
.login-error { color: #e74c3c; font-size: 13px; text-align: center; display: none; }
.login-error.show { display: block; }
.login-hint { text-align: center; font-size: 12px; color: #aaa; margin-top: 8px; }

/* 用户胶囊 */
.user-corner { position: fixed; bottom: 16px; right: 20px; z-index: 500; display: none; }
.user-corner.show { display: block; }
.user-pill { background: rgba(255,255,255,0.08); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.12); border-radius: 50px; padding: 8px 16px; display: flex; align-items: center; gap: 10px; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.user-pill:hover { background: rgba(255,255,255,0.15); }
.user-pill .vip-badge { font-size: 10px; color: #ffd700; background: rgba(255,215,0,0.12); padding: 3px 9px; border-radius: 20px; font-weight: 500; }
.user-pill .vip-badge.expired { color: #ff6b6b; background: rgba(255,107,107,0.12); }
.user-pill .username-text { color: rgba(255,255,255,0.7); font-size: 12px; }
.user-pill .arrow { font-size: 8px; color: rgba(255,255,255,0.4); }
.user-dropdown { display: none; position: absolute; bottom: 110%; right: 0; background: rgba(30,30,50,0.97); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.12); border-radius: 14px; min-width: 180px; overflow: hidden; z-index: 600; padding: 8px 0; }
.user-dropdown.show { display: block; }
.user-dropdown .dd-item { padding: 11px 18px; color: #ccc; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.user-dropdown .dd-item .vip-detail { color: #ffd700; font-size: 12px; }
.user-dropdown .dd-item .vip-detail.expired { color: #ff6b6b; }
.user-dropdown .dd-logout { padding: 11px 18px; color: #ff6b6b; font-size: 13px; cursor: pointer; transition: all 0.2s; border-top: 1px solid rgba(255,255,255,0.08); margin-top: 4px; }
.user-dropdown .dd-logout:hover { background: rgba(255,80,80,0.2); }

/* 确认弹窗 */
.confirm-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 2000; display: flex; justify-content: center; align-items: center; animation: fadeIn 0.2s ease; }
.confirm-box { background: rgba(30,30,50,0.97); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.12); border-radius: 16px; padding: 28px 24px; width: 340px; max-width: 85vw; text-align: center; color: #fff; }
.confirm-box p { font-size: 14px; line-height: 1.6; margin-bottom: 24px; color: rgba(255,255,255,0.85); }
.confirm-btns { display: flex; gap: 12px; }
.confirm-btns button { flex: 1; padding: 10px; border-radius: 10px; font-size: 14px; cursor: pointer; border: none; transition: all 0.2s; }
.confirm-btns .btn-cancel { background: rgba(255,255,255,0.1); color: #ccc; }
.confirm-btns .btn-cancel:hover { background: rgba(255,255,255,0.2); }
.confirm-btns .btn-ok { background: #4a6cf7; color: #fff; }
.confirm-btns .btn-ok:hover { background: #3b5de7; }

/* 模板保存弹窗 */
.template-save-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 2100; display: none; justify-content: center; align-items: center; }
.template-save-overlay.show { display: flex; }
.template-save-box { background: rgba(30,30,50,0.97); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.12); border-radius: 16px; padding: 28px 24px; width: 340px; max-width: 85vw; text-align: center; color: #fff; }
.template-save-box h3 { font-size: 16px; margin-bottom: 16px; }
.template-save-box input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.06); color: #fff; font-size: 14px; outline: none; margin-bottom: 20px; }
.template-save-box .confirm-btns { display: flex; gap: 12px; }
.template-save-box .confirm-btns button { flex: 1; padding: 10px; border-radius: 10px; font-size: 14px; cursor: pointer; border: none; transition: all 0.2s; }
.template-save-box .btn-cancel { background: rgba(255,255,255,0.1); color: #ccc; }
.template-save-box .btn-cancel:hover { background: rgba(255,255,255,0.2); }
.template-save-box .btn-ok { background: #4a6cf7; color: #fff; }
.template-save-box .btn-ok:hover { background: #3b5de7; }

/* 左侧边栏 */
.sidebar { width: 240px; flex-shrink: 0; background: rgba(255,255,255,0.03); border-right: 1px solid rgba(255,255,255,0.06); padding: 20px 14px 50px; display: flex; flex-direction: column; height: 100vh; }
.sidebar-title { color: rgba(255,255,255,0.35); font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 16px; padding: 0 8px; }
.history-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.history-list::-webkit-scrollbar { width: 3px; }
.history-list::-webkit-scrollbar-track { background: transparent; }
.history-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 2px; }
.history-item { padding: 10px 12px; border-radius: 8px; color: rgba(255,255,255,0.4); font-size: 13px; cursor: pointer; transition: all 0.15s; display: flex; justify-content: space-between; align-items: center; position: relative; }
.history-item:hover { background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.8); }
.history-item.active { background: rgba(100,150,255,0.15); color: #fff; }
.history-item .item-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item .more-btn { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.25); font-size: 14px; cursor: pointer; flex-shrink: 0; transition: all 0.2s; opacity: 0; }
.history-item:hover .more-btn { opacity: 1; }
.history-item .more-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
.history-item .action-menu { display: none; position: absolute; right: 0; top: 100%; background: rgba(30,30,50,0.97); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.12); border-radius: 10px; overflow: hidden; z-index: 200; min-width: 80px; }
.history-item .action-menu.show { display: block; }
.history-item .action-menu .menu-option { padding: 9px 14px; font-size: 12px; color: #ff6b6b; cursor: pointer; transition: all 0.2s; }
.history-item .action-menu .menu-option:hover { background: rgba(255,80,80,0.2); }
.new-chat-btn { margin-top: 10px; padding: 10px; border-radius: 8px; border: 1px dashed rgba(255,255,255,0.1); color: rgba(255,255,255,0.35); font-size: 13px; text-align: center; cursor: pointer; transition: all 0.2s; flex-shrink: 0; }
.new-chat-btn:hover { border-color: rgba(255,255,255,0.25); color: #fff; }

/* 移动端菜单按钮与遮罩 */
.mobile-menu-btn { display: none; position: fixed; top: 12px; left: 12px; z-index: 800; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.08); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.12); color: #fff; font-size: 18px; cursor: pointer; align-items: center; justify-content: center; }
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 900; }

/* 主对话区 */
.chat-main { flex: 1; display: flex; flex-direction: column; height: 100vh; min-width: 0; padding-bottom: 50px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 30px 24px 20px; display: flex; flex-direction: column; gap: 16px; }
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }
.welcome-hint { color: rgba(255,255,255,0.5); text-align: center; margin: auto; font-size: 15px; }
.message { animation: fadeIn 0.4s ease; }
.message.user { align-self: flex-end; }
.message.user .bubble { background: rgba(255,255,255,0.1); display: inline-block; padding: 10px 16px; border-radius: 18px 4px 18px 18px; max-width: 70%; color: rgba(255,255,255,0.85); font-size: 14px; line-height: 1.6; }
.message.ai { align-self: flex-start; }
.message.ai .bubble { display: inline-block; padding: 10px 16px; border-radius: 4px 18px 18px 18px; max-width: 80%; color: rgba(255,255,255,0.9); font-size: 14px; line-height: 1.6; }
.loading-dots { display: none; padding: 4px 16px 12px; color: rgba(255,255,255,0.3); font-size: 13px; }
.loading-dots.show { display: block; }
.dot-pulse { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.3); margin: 0 3px; animation: pulse 1.4s infinite ease-in-out; }
.dot-pulse:nth-child(2) { animation-delay: 0.2s; }
.dot-pulse:nth-child(3) { animation-delay: 0.4s; }
.input-bar { padding: 10px 20px 10px; flex-shrink: 0; }
.input-bar-inner { background: rgba(255,255,255,0.06); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.1); border-radius: 20px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; max-width: 800px; margin: 0 auto; }
.model-switch { position: relative; flex-shrink: 0; }
.model-btn { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); color: rgba(255,255,255,0.8); padding: 7px 13px; border-radius: 16px; cursor: pointer; font-size: 12px; white-space: nowrap; transition: all 0.2s; }
.model-btn:hover { background: rgba(255,255,255,0.14); }
.model-btn .arrow { margin-left: 4px; font-size: 9px; }
.model-dropdown { display: none; position: absolute; bottom: 120%; left: 0; background: rgba(25,25,45,0.97); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.12); border-radius: 14px; min-width: 200px; overflow: hidden; z-index: 100; }
.model-dropdown.show { display: block; }
.model-option { padding: 10px 16px; color: #bbb; cursor: pointer; transition: all 0.2s; font-size: 13px; }
.model-option:hover { background: rgba(255,255,255,0.08); color: #fff; }
.model-option.active { color: #fff; background: rgba(100,150,255,0.2); }
.chat-input { flex: 1; background: transparent; border: none; outline: none; color: #fff; font-size: 14px; padding: 6px 0; min-width: 0; }
.chat-input::placeholder { color: rgba(255,255,255,0.3); }
.send-btn { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; flex-shrink: 0; }
.send-btn:hover { background: rgba(255,255,255,0.25); transform: scale(1.05); }
.send-btn svg { width: 16px; height: 16px; fill: #fff; }
.send-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }

.info-trigger-bar { display: none; margin-bottom: 6px; }
.info-trigger-bar.show { display: block; }
.info-trigger-btn { display: flex; align-items: center; gap: 5px; padding: 7px 13px; background: rgba(255,255,255,0.06); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.12); border-radius: 16px; color: rgba(255,255,255,0.8); font-size: 12px; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.info-trigger-btn:hover { background: rgba(255,255,255,0.14); }
.info-trigger-btn .icon { font-size: 14px; }

.article-form-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1500; display: none; justify-content: center; align-items: center; }
.article-form-overlay.show { display: flex; }
.article-form-panel { background: rgba(30,30,50,0.98); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.12); border-radius: 20px; padding: 28px 24px; width: 520px; max-width: 90vw; max-height: 85vh; overflow-y: auto; color: #fff; }
.article-form-panel h3 { text-align: center; font-size: 18px; margin-bottom: 20px; }
.article-form-panel .form-group { margin-bottom: 14px; }
.article-form-panel label { display: block; font-size: 12px; color: #aaa; margin-bottom: 5px; }
.article-form-panel input, .article-form-panel textarea { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.06); color: #fff; font-size: 14px; outline: none; resize: vertical; }
.article-form-panel textarea { min-height: 60px; }
.article-form-panel select { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.06) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23ffffff' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center; color: #fff; font-size: 14px; appearance: none; -webkit-appearance: none; -moz-appearance: none; outline: none; }
.article-form-panel select option { background: #1a1a2e; color: #fff; }
.article-form-panel .form-row { display: flex; gap: 10px; }
.article-form-panel .form-row > * { flex: 1; }
.article-form-panel .form-btns { display: flex; gap: 12px; margin-top: 20px; }
.article-form-panel .form-btns button { flex: 1; padding: 11px; border-radius: 10px; font-size: 14px; cursor: pointer; border: none; transition: all 0.2s; }
.article-form-panel .btn-cancel { background: rgba(255,255,255,0.1); color: #ccc; }
.article-form-panel .btn-cancel:hover { background: rgba(255,255,255,0.2); }
.article-form-panel .btn-submit { background: #4a6cf7; color: #fff; }
.article-form-panel .btn-submit:hover { background: #3b5de7; }
.template-actions { display: flex; gap: 10px; margin-bottom: 16px; }
.template-actions select { flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.06) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23ffffff' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center; color: #fff; font-size: 14px; appearance: none; -webkit-appearance: none; -moz-appearance: none; outline: none; }
.template-actions select option { background: #1a1a2e; color: #fff; }
.template-actions button { padding: 10px 14px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15); border-radius: 10px; color: #ccc; font-size: 13px; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.template-actions button:hover { background: rgba(255,255,255,0.2); color: #fff; }

@keyframes pulse { 0%,80%,100% { opacity: 0.2; transform: scale(0.7); } 40% { opacity: 1; transform: scale(1.1); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 700px) {
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100vh;
        width: 240px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        background: rgba(15,15,25,0.98);
        backdrop-filter: blur(20px);
        border-right: 1px solid rgba(255,255,255,0.1);
        padding: 20px 14px 50px;
        display: flex; flex-direction: column;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 900; }
    .sidebar-overlay.show { display: block; }
    .mobile-menu-btn { display: flex; }
    .sidebar-title { order: 0; }
    .new-chat-btn { order: 1; margin-top: 0; margin-bottom: 16px; }
    .history-list { order: 2; }
    .chat-main { padding-bottom: 80px; max-width: 100vw; overflow-x: hidden; }
    .input-bar { padding: 10px 12px 10px; }
    .input-bar-inner { max-width: 100%; flex-wrap: wrap; }
    .info-trigger-bar { width: auto; }
    .chat-messages { padding: 20px 14px; }
    .chat-input { font-size: 16px; }
    .user-corner { bottom: auto; top: 10px; right: 10px; }
    .user-dropdown { bottom: auto; top: 110%; right: 0; }
    .user-pill { padding: 6px 12px; gap: 6px; font-size: 11px; }
    .article-form-panel { padding: 20px 16px; }
    .article-form-panel .form-row { flex-direction: column; gap: 14px; }
    .template-actions { flex-direction: column; }
}