/* ==========================================
   片刻 PicMoment - 精致DeepSeek风格
   ========================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #4d6bfe;
    --primary-hover: #3d5afe;
    --primary-light: #eef1ff;
    --primary-soft: #f5f7ff;
    --accent: #10b981;
    --accent-light: #d1fae5;
    --bg: #f5f5f7;
    --bg-white: #ffffff;
    --bg-sidebar: #f9f9fb;
    --bg-sidebar-hover: #f0f0f5;
    --bg-sidebar-active: #e8e8f0;
    --bg-input: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #5a5a72;
    --text-light: #9a9ab0;
    --text-sidebar: #1a1a2e;
    --text-sidebar-secondary: #8888a4;
    --border: #e8e8ef;
    --border-light: #f0f0f5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 6px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    -webkit-font-smoothing: antialiased;
    -webkit-overflow-scrolling: touch;
}
html { height: -webkit-fill-available; }

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-hover); }

/* ==========================================
   全局布局
   ========================================== */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

/* ==========================================
   左侧边栏 - 毛玻璃深色
   ========================================== */
.sidebar {
    width: 268px; background: var(--bg-sidebar); display: flex; flex-direction: column;
    flex-shrink: 0; transition: width .3s; position: relative;
    border-right: 1px solid var(--border);
}
.sidebar-header { padding: 20px 16px 16px; border-bottom: 1px solid var(--border-light); }
.sidebar-brand {
    display: flex; align-items: center; gap: 10px; color: var(--text-sidebar);
    font-size: 17px; font-weight: 700; letter-spacing: -.3px;
}
.sidebar-brand .logo {
    width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 600; background: var(--text); color: #fff;
}
.sidebar-new-btn {
    width: 100%; margin-top: 16px; padding: 10px 16px; background: var(--bg);
    border: 1.5px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary);
    font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: all .2s; font-weight: 500;
}
.sidebar-new-btn svg { opacity: .7; transition: opacity .2s; }
.sidebar-new-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.sidebar-new-btn:hover svg { opacity: 1; stroke: var(--primary); }
.sidebar-new-btn:active { transform: scale(.97); }

.sidebar-list { flex: 1; overflow-y: auto; padding: 8px 8px; }
.sidebar-list::-webkit-scrollbar { width: 3px; }
.sidebar-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }
.sidebar-item {
    padding: 10px 14px; border-radius: var(--radius-sm); cursor: pointer; margin-bottom: 2px;
    color: var(--text-sidebar-secondary); font-size: 13px; transition: all .15s;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-item:hover { background: var(--bg-sidebar-hover); color: var(--text-sidebar); }
.sidebar-item.active { background: var(--bg-sidebar-active); color: var(--text-sidebar); }
.sidebar-conv {
    padding: 9px 10px; margin-bottom: 1px; border-radius: var(--radius-sm);
    cursor: pointer; display: flex; align-items: center; gap: 8px;
    transition: all .15s; font-size: 13px; color: var(--text-sidebar-secondary);
    position: relative;
}
.sidebar-conv::before {
    content: ''; width: 4px; height: 4px; border-radius: 50%; flex-shrink: 0;
    background: var(--text-sidebar-secondary); opacity: .4;
}
.sidebar-conv.active::before { background: var(--primary); opacity: 1; }
.sidebar-conv:hover { background: var(--bg-sidebar-hover); color: var(--text-sidebar); }
.sidebar-conv.active { background: var(--bg-sidebar-active); color: var(--text-sidebar); }
.sidebar-conv-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-conv-del {
    opacity: 0; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
    border-radius: 6px; font-size: 12px; color: var(--text-sidebar-secondary);
    transition: all .15s; flex-shrink: 0; line-height: 1;
}
.sidebar-conv:hover .sidebar-conv-del { opacity: .7; }
.sidebar-conv-del:hover { opacity: 1 !important; background: rgba(239,68,68,.2); color: #ef4444; }

.sidebar-hint {
    padding: 6px 12px; font-size: 11px; color: var(--text-sidebar-secondary); opacity: .5;
    text-align: center;
}
.sidebar-footer { padding: 12px 12px 16px; border-top: 1px solid var(--border-light); }
.sidebar-user {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
    cursor: pointer; transition: all .15s;
}
.sidebar-user:hover { background: var(--bg-sidebar-hover); }
.sidebar-avatar {
    width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px;
    font-weight: 600; background: #555; overflow: hidden;
}
.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-name { color: var(--text-sidebar); font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-credits { color: var(--text-light); font-size: 11px; display: flex; align-items: center; gap: 4px; }
.credits-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }

/* ==========================================
   主内容区
   ========================================== */
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-white); }
.mobile-header { display: none; }

/* ==========================================
   对话区域
   ========================================== */
.chat-area { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.chat-area::-webkit-scrollbar { width: 5px; }
.chat-area::-webkit-scrollbar-thumb { background: #e0e0e0; border-radius: 3px; }
.chat-area::-webkit-scrollbar-thumb:hover { background: #ccc; }

/* 欢迎页 */
.chat-welcome {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; padding: 40px 24px; text-align: center;
}
.welcome-logo {
    width: 100px; height: 100px; margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.chat-welcome h1 {
    font-size: 30px; font-weight: 800; color: var(--text); margin-bottom: 8px;
    letter-spacing: -.5px;
}
.chat-welcome .subtitle {
    font-size: 15px; color: var(--text-secondary); margin-bottom: 44px; max-width: 460px;
    line-height: 1.7;
}

/* 对话消息 */
.chat-messages { max-width: 800px; margin: 0 auto; padding: 32px 24px; }
.chat-msg { display: flex; margin-bottom: 28px; animation: msgIn .3s ease; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg.ai { justify-content: flex-start; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.chat-msg-content { max-width: 85%; }
.chat-msg.user .chat-msg-content { align-items: flex-end; display: flex; flex-direction: column; }
.chat-msg.ai .chat-msg-content { align-items: flex-start; display: flex; flex-direction: column; }

.chat-msg-bubble {
    padding: 12px 16px; border-radius: 18px; font-size: 15px; line-height: 1.7; word-break: break-word;
}
.chat-msg-bubble.user {
    background: var(--bg); color: var(--text); border: 1px solid var(--border-light);
}
.chat-msg-text { color: inherit; }

.chat-msg-image {
    max-width: 320px; margin-top: 4px; border-radius: var(--radius);
    overflow: hidden; cursor: pointer; transition: transform .2s;
    box-shadow: var(--shadow);
}
.chat-msg-image:hover { transform: scale(1.02); box-shadow: var(--shadow-md); }
.chat-msg-image img { width: 100%; display: block; }
.chat-msg-meta { margin-top: 8px; font-size: 12px; color: var(--text-light); display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.regen-btn {
    display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
    color: var(--text-secondary); transition: all .15s; padding: 2px 8px;
    border-radius: 6px; font-size: 12px;
}
.regen-btn:hover { color: var(--primary); background: var(--primary-light); }
/* 生成占位框 - 粒子效果 */
.gen-placeholder {
    max-width: 320px; width: 100%; border-radius: var(--radius);
    background: #f5f7fa;
    display: flex; align-items: center; justify-content: center;
    min-height: 120px; position: relative; overflow: hidden;
}
.gen-placeholder canvas {
    position: absolute; inset: 0; width: 100%; height: 100%;
}
.gen-placeholder-inner {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    position: relative; z-index: 1;
}
.loading-text { font-size: 13px; color: var(--text-light); font-weight: 500; }
.chat-msg-error {
    color: var(--danger); font-size: 14px; padding: 12px 16px; margin-top: 4px;
    background: #fef2f2; border-radius: var(--radius-sm); border: 1px solid #fecaca;
}

.chat-msg-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chat-msg.user .chat-msg-tags { justify-content: flex-end; }
.chat-msg-tag {
    padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 500;
    background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border-light);
}

/* ==========================================
   底部输入区
   ========================================== */
.input-area { padding: 0 24px 24px; max-width: 800px; margin: 0 auto; width: 100%; }
.input-box {
    background: var(--bg-white); border: 1.5px solid var(--border); border-radius: 18px;
    box-shadow: var(--shadow); transition: all .25s;
}
.input-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(77,107,254,.1), var(--shadow); }

.input-main { display: flex; align-items: flex-end; padding: 14px 16px; gap: 12px; }
.input-textarea {
    flex: 1; border: none; outline: none; resize: none; font-size: 15px; line-height: 1.5;
    color: var(--text); background: transparent; max-height: 200px; min-height: 24px;
    font-family: inherit;
}
.input-textarea::placeholder { color: var(--text-light); }
.input-send {
    width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; transition: all .2s; flex-shrink: 0;
}
.input-send:hover { background: #3b5bdb; transform: scale(1.05); }
.input-send:active { transform: scale(.95); }
.input-send:disabled { background: #d0d0d8; cursor: not-allowed; transform: none; }

/* 上传参考图按钮 */
.input-upload {
    width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--border);
    cursor: pointer; background: var(--bg-white); color: var(--text-light);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all .2s; padding: 0;
}
.input-upload:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-light); }
.input-upload:active { transform: scale(.92); }

/* 参考图预览 */
.input-ref-preview {
    display: flex; align-items: center; padding: 10px 16px 0; position: relative;
}
.input-ref-preview img {
    width: 64px; height: 64px; object-fit: cover; border-radius: 8px;
    border: 1.5px solid var(--border);
}
.input-ref-remove {
    position: absolute; top: 6px; left: 72px; width: 18px; height: 18px;
    background: rgba(0,0,0,.55); color: #fff; border-radius: 50%;
    font-size: 10px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; line-height: 1;
}
.input-ref-remove:hover { background: rgba(0,0,0,.8); }

/* 消息中的参考图缩略图 */
.chat-msg-ref { margin: 6px 0 2px; }
.chat-msg-ref img {
    width: 48px; height: 48px; object-fit: cover; border-radius: 6px;
    border: 1px solid var(--border); opacity: .85;
}

/* 画面比例选择器 - 紧凑药丸 */
.input-options { display: flex; align-items: center; gap: 8px; padding: 2px 14px 10px; flex-wrap: wrap; }
.opt-group { display: flex; align-items: center; gap: 4px; }
.opt-group-label { font-size: 12px; color: var(--text-light); font-weight: 500; margin-right: 2px; white-space: nowrap; }
.opt-pill {
    padding: 4px 10px; border-radius: 14px; font-size: 12px; cursor: pointer; font-weight: 500;
    background: var(--bg); border: 1.5px solid transparent; color: var(--text-secondary);
    transition: all .15s; white-space: nowrap; line-height: 1.3;
    display: inline-flex; align-items: center; gap: 3px;
}
.opt-pill svg { flex-shrink: 0; vertical-align: middle; }
.opt-pill b { font-weight: 700; font-size: 12px; }
.opt-pill small { font-size: 10px; opacity: .6; font-weight: 400; }
.opt-pill:hover { border-color: var(--border); }
.opt-pill.active { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.credits-capsule {
    margin-left: auto; font-size: 11px; font-weight: 600; color: var(--primary);
    background: var(--primary-light); padding: 3px 10px; border-radius: 10px;
    white-space: nowrap;
}
.opt-pill.active small { opacity: .8; }
.opt-divider { width: 1px; height: 16px; background: var(--border); margin: 0 4px; }

.quality-row { display: flex; align-items: center; gap: 8px; padding: 2px 2px; }
.quality-label { font-size: 12px; color: var(--text-light); font-weight: 500; }
.quality-opt {
    padding: 4px 14px; border-radius: 14px; font-size: 12px; cursor: pointer; font-weight: 500;
    background: var(--bg); border: 1.5px solid transparent; color: var(--text-secondary); transition: all .2s;
}
.quality-opt:hover { border-color: var(--border); }
.quality-opt.active { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.input-hint { text-align: center; padding: 6px 0 0; font-size: 11px; color: var(--text-light); letter-spacing: .3px; }

/* ==========================================
   登录/注册弹窗
   ========================================== */
.auth-overlay {
    position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.45);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center; padding: 24px;
    animation: overlayIn .2s ease;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.auth-box {
    width: 100%; max-width: 380px; background: var(--bg-white); border-radius: 20px;
    padding: 32px 28px; box-shadow: var(--shadow-lg);
    animation: modalIn .3s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.auth-header { text-align: center; margin-bottom: 28px; }
.auth-header .logo-icon { font-size: 42px; margin-bottom: 12px; }
.auth-header h2 { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 4px; letter-spacing: -.3px; }
.auth-header p { color: var(--text-secondary); font-size: 14px; }
.auth-tabs {
    display: flex; background: var(--bg); border-radius: var(--radius-sm); padding: 3px; margin-bottom: 24px;
}
.auth-tab {
    flex: 1; text-align: center; padding: 9px; border-radius: 7px; cursor: pointer;
    font-size: 14px; color: var(--text-secondary); transition: all .2s; font-weight: 600;
}
.auth-tab.active { background: var(--bg-white); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.auth-close {
    position: absolute; top: 18px; right: 18px; background: var(--bg); border: none;
    width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 14px; cursor: pointer; color: var(--text-light); transition: all .15s;
}
.auth-close:hover { background: var(--border); color: var(--text); }

.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 7px; font-weight: 600; }
.form-input {
    width: 100%; padding: 9px 12px; background: var(--bg); border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); font-size: 13px; outline: none; transition: all .2s;
}
.form-input:focus { border-color: var(--primary); background: var(--bg-white); box-shadow: 0 0 0 3px rgba(77,107,254,.08); }
.form-input::placeholder { color: var(--text-light); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 24px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
    cursor: pointer; border: none; transition: all .2s; line-height: 1.5;
}
.btn-primary {
    background: var(--text); color: #fff;
}
.btn-primary:hover { background: #000; }
.btn-outline { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 24px; font-size: 15px; border-radius: var(--radius); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.auth-footer { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-light); }
.auth-footer strong { color: var(--primary); }

/* ==========================================
   用户面板
   ========================================== */
.user-panel {
    position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.45);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center; padding: 24px;
    animation: overlayIn .2s ease;
}
.user-card {
    width: 100%; max-width: 480px; background: var(--bg-white); border-radius: 20px;
    padding: 32px; box-shadow: var(--shadow-lg); animation: modalIn .3s ease;
}
.user-card-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.user-card-avatar {
    width: 48px; height: 48px; border-radius: 12px; position: relative;
    background: #555; overflow: visible;
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; font-weight: 600;
}
.user-card-avatar img { border-radius: 12px; }
.avatar-edit-icon {
    position: absolute; bottom: -3px; right: -3px;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--primary); color: #fff; font-size: 10px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15);
    pointer-events: none;
}
.user-card-info h3 { font-size: 18px; font-weight: 700; color: var(--text); }
.user-card-info p { font-size: 13px; color: var(--text-secondary); }

.user-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 24px; }
.stat-item {
    text-align: center; padding: 16px 8px; background: var(--bg); border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}
.stat-item .val { font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -.5px; }
.stat-item .lbl { font-size: 11px; color: var(--text-light); margin-top: 2px; font-weight: 500; }

/* 标签页 */
.up-tabs {
    display: flex; gap: 0; border-bottom: 1.5px solid var(--border-light); margin-bottom: 16px;
}
.up-tab {
    flex: 1; text-align: center; padding: 10px 0; font-size: 13px; font-weight: 600;
    color: var(--text-light); cursor: pointer; border-bottom: 2px solid transparent;
    transition: all .2s;
}
.up-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.up-tab:hover { color: var(--primary); }
.up-tab-content { display: none; }
.up-tab-content.active { display: block; }

.redeem-box {
    display: flex; gap: 8px; align-items: center;
}
.redeem-input {
    flex: 1; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14px; font-family: monospace; letter-spacing: 1px; outline: none;
    transition: border-color .2s; background: var(--bg-white); color: var(--text);
}
.redeem-input:focus { border-color: var(--primary); }
.redeem-input::placeholder { font-family: inherit; letter-spacing: normal; color: var(--text-light); }
.redeem-btn {
    padding: 10px 20px; border: none; border-radius: var(--radius-sm); font-size: 14px;
    font-weight: 600; cursor: pointer; white-space: nowrap;
    background: var(--primary); color: #fff; transition: all .2s;
}
.redeem-btn:hover { opacity: .9; }
.redeem-btn:disabled { opacity: .5; cursor: not-allowed; }

.plan-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.plan-item {
    padding: 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    transition: all .2s; cursor: pointer; text-align: center;
}
.plan-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.plan-item:active { transform: scale(.97); }

/* 购买提示弹窗 */
.buy-tip-overlay {
    position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn .2s;
}
.buy-tip-card {
    background: var(--bg-white); border-radius: 16px; padding: 28px 24px; text-align: center;
    width: 320px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.buy-tip-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.buy-tip-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 18px; }
.buy-tip-wechat {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: var(--primary-soft, #f0f0ff); border-radius: 10px; padding: 14px; margin-bottom: 16px;
}
.buy-tip-label { font-size: 13px; color: var(--text-light); }
.buy-tip-id { font-size: 18px; font-weight: 800; color: var(--primary); letter-spacing: .5px; }
.buy-tip-copy {
    width: 100%; padding: 12px; border: none; border-radius: 10px; font-size: 15px; font-weight: 600;
    background: var(--primary); color: #fff; cursor: pointer; transition: all .2s;
}
.buy-tip-copy:hover { opacity: .9; }
.buy-tip-copy:active { transform: scale(.97); }
.buy-tip-close { margin-top: 12px; font-size: 13px; color: var(--text-light); cursor: pointer; }
.plan-item .plan-price { font-size: 22px; font-weight: 800; color: var(--primary); letter-spacing: -.5px; }
.plan-item .plan-info .plan-name { font-size: 13px; font-weight: 600; margin-top: 4px; }
.plan-item .plan-info .plan-credits { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.plan-item .plan-info .plan-gen-hint { font-size: 10px; color: var(--primary); margin-top: 2px; font-weight: 500; }
.user-actions { display: flex; gap: 8px; }

/* 用户面板关闭按钮 */
.up-close-btn {
    position: absolute; top: 16px; right: 16px; z-index: 10;
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    background: var(--bg); border: 1px solid var(--border-light); border-radius: 50%;
    font-size: 14px; color: var(--text-light); cursor: pointer;
    transition: all .2s;
}
.up-close-btn:hover { background: var(--border-light); color: var(--text); }

/* 用户面板 - 分区 */
.up-section { margin-bottom: 18px; }
.up-section-title {
    font-size: 13px; font-weight: 600; color: var(--text-light);
    margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border-light);
}
.up-info-row {
    display: flex; align-items: center; padding: 10px 0;
    border-bottom: 1px solid var(--border-light); font-size: 14px;
}
.up-info-row:last-child { border-bottom: none; }
.up-label { width: 64px; color: var(--text-light); font-size: 13px; flex-shrink: 0; }
.up-val { flex: 1; color: var(--text); }
.up-edit {
    font-size: 12px; color: var(--primary); cursor: pointer; padding: 2px 10px;
    border: 1px solid var(--primary); border-radius: 12px; transition: all .2s;
}
.up-edit:hover { background: var(--primary); color: #fff; }
.up-menu-item {
    display: flex; align-items: center; padding: 12px 4px;
    border-bottom: 1px solid var(--border-light); font-size: 14px;
    cursor: pointer; transition: background .15s; border-radius: 6px;
}
.up-menu-item:last-child { border-bottom: none; }
.up-menu-item:hover { background: var(--bg); }
.up-arrow { margin-left: auto; color: var(--text-light); font-size: 18px; }

/* 协议弹窗 */
.legal-card {
    width: 100%; max-width: 560px; max-height: 85vh; background: var(--bg-white);
    border-radius: 16px; box-shadow: var(--shadow-lg); animation: modalIn .3s ease;
    display: flex; flex-direction: column; overflow: hidden;
}
.legal-body {
    padding: 20px 28px 28px; overflow-y: auto; font-size: 13.5px; line-height: 1.8; color: var(--text);
}
.legal-body h3 {
    font-size: 15px; font-weight: 700; color: var(--text); margin: 20px 0 8px; padding-left: 10px;
    border-left: 3px solid var(--primary);
}
.legal-body h3:first-child { margin-top: 0; }
.legal-body p { margin: 6px 0; }
.legal-body ul { padding-left: 20px; margin: 6px 0; }
.legal-body li { margin: 3px 0; }
.legal-body strong { color: var(--text); }

/* ==========================================
   图片预览灯箱
   ========================================== */
.lightbox-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0, 0, 0, .85); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    padding: 24px; animation: overlayIn .2s ease; cursor: zoom-out;
}
.lightbox-container {
    display: flex; flex-direction: column; align-items: center; gap: 16px;
    max-width: 90vw; max-height: 90vh; cursor: default;
}
.lightbox-img {
    max-width: 100%; max-height: calc(90vh - 70px); object-fit: contain;
    border-radius: 12px; box-shadow: 0 8px 40px rgba(0, 0, 0, .5);
    animation: modalIn .3s ease;
}
.lightbox-toolbar {
    display: flex; align-items: center; gap: 10px;
    animation: modalIn .3s ease .05s both;
}
.lightbox-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 10px 20px; border-radius: 24px; border: none;
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: all .2s; color: #fff;
    background: rgba(255, 255, 255, .15); backdrop-filter: blur(4px);
}
.lightbox-btn:hover { background: rgba(255, 255, 255, .25); transform: scale(1.03); }
.lightbox-btn:active { transform: scale(.97); }
.lightbox-close-btn { background: rgba(255, 255, 255, .08); }
.lightbox-close-btn:hover { background: rgba(255, 255, 255, .18); }

@media (max-width: 768px) {
    .lightbox-overlay { padding: 12px; }
    .lightbox-container { max-width: 100vw; }
    .lightbox-img { border-radius: 8px; max-height: calc(85vh - 60px); }
    .lightbox-toolbar { gap: 8px; }
    .lightbox-btn { padding: 8px 16px; font-size: 13px; border-radius: 20px; }
}

/* ==========================================
   Toast
   ========================================== */
.toast {
    position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-100px);
    z-index: 9999; background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 22px; font-size: 14px; font-weight: 500;
    box-shadow: var(--shadow-lg); transition: transform .3s cubic-bezier(.22,1,.36,1);
    display: flex; align-items: center; gap: 8px;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }

/* ==========================================
   加载动画
   ========================================== */
.spinner {
    width: 20px; height: 20px; border: 2.5px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================
   响应式 - 平板
   ========================================== */
@media (max-width: 1024px) {
    .sidebar { width: 220px; }
    .size-selector { flex-wrap: wrap; }
}

/* ==========================================
   响应式 - 手机
   ========================================== */
@media (max-width: 768px) {
    .app-layout { flex-direction: column; }
    .sidebar { display: none; }

    /* 手机顶部栏 */
    .mobile-header {
        display: flex; align-items: center; justify-content: space-between;
        padding: 8px 12px; background: var(--bg-white);
        border-bottom: 1px solid var(--border); flex-shrink: 0;
    }
    .mh-left, .mh-right { display: flex; align-items: center; gap: 8px; }
    .mh-brand { font-weight: 700; font-size: 16px; color: var(--text); }
    .mh-icon-btn {
        width: 34px; height: 34px; border-radius: 8px; border: none; background: transparent;
        display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-secondary);
        transition: all .15s;
    }
    .mh-icon-btn:hover, .mh-icon-btn:active { background: var(--bg); }
    .mh-newchat-btn {
        display: flex; align-items: center; gap: 5px; padding: 6px 12px;
        border-radius: 18px; border: 1.5px solid var(--border); background: var(--bg-white);
        cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-secondary);
        transition: all .2s; white-space: nowrap;
    }
    .mh-newchat-btn svg { opacity: .6; }
    .mh-newchat-btn:hover, .mh-newchat-btn:active { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
    .mh-newchat-btn:hover svg { opacity: 1; }
    .mh-newchat-btn:active { transform: scale(.95); }
    .mh-login-btn {
        display: flex; align-items: center; gap: 6px; padding: 6px 14px;
        border-radius: 18px; border: none; background: var(--text); color: #fff;
        cursor: pointer; font-size: 12px; font-weight: 600;
        transition: all .2s; white-space: nowrap;
    }
    .mh-login-btn:hover { background: #000; }
    .mh-login-btn:active { transform: scale(.95); }
    .mh-login-btn svg { opacity: .85; }
    .mh-user-btn {
        display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px;
        border-radius: 20px; border: 1.5px solid var(--border); background: var(--bg-white);
        cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text);
        transition: all .2s;
    }
    .mh-user-btn:active { transform: scale(.95); }
    .mh-avatar {
        width: 26px; height: 26px; border-radius: 50%; background: #555; color: #fff;
        display: flex; align-items: center; justify-content: center; font-size: 11px;
        font-weight: 600; overflow: hidden; flex-shrink: 0;
    }
    /* 抽屉 */
    .drawer-overlay {
        position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 900;
        opacity: 0; pointer-events: none; transition: opacity .25s;
    }
    .drawer-overlay.open { opacity: 1; pointer-events: auto; }
    .drawer {
        position: fixed; top: 0; left: 0; bottom: 0; width: 280px; max-width: 80vw;
        background: var(--bg-white); z-index: 901; transform: translateX(-100%);
        transition: transform .25s ease; display: flex; flex-direction: column;
        box-shadow: 2px 0 12px rgba(0,0,0,.1);
    }
    .drawer.open { transform: translateX(0); }
    .drawer-header {
        display: flex; align-items: center; justify-content: space-between;
        padding: 14px 12px; border-bottom: 1px solid var(--border);
    }
    .drawer-title { font-weight: 700; font-size: 15px; color: var(--text); }
    .drawer-list { flex: 1; overflow-y: auto; padding: 8px; }
    .drawer-empty { padding: 24px 12px; text-align: center; color: var(--text-light); font-size: 13px; }
    .drawer-item {
        padding: 10px 10px; margin-bottom: 2px; border-radius: 8px;
        display: flex; align-items: center; gap: 8px; cursor: pointer;
        font-size: 13px; color: var(--text-secondary); transition: all .15s;
    }
    .drawer-item.active { background: var(--primary-light); color: var(--primary); }
    .drawer-item:hover { background: var(--bg); }
    .drawer-item-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .drawer-item-del {
        opacity: 0; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
        border-radius: 6px; color: var(--text-light); flex-shrink: 0; transition: all .15s;
    }
    .drawer-item:hover .drawer-item-del { opacity: 1; }
    .drawer-item-del:hover { background: rgba(239,68,68,.1); color: #ef4444; }
    .drawer-hint { padding: 8px 12px; font-size: 11px; color: var(--text-light); text-align: center; opacity: .5; }

    /* 欢迎页 */
    .chat-welcome { padding: 20px 14px; }
    .welcome-logo { width: 48px; height: 48px; border-radius: 14px; font-size: 24px; margin-bottom: 16px; }
    .chat-welcome h1 { font-size: 20px; }
    .chat-welcome .subtitle { font-size: 13px; margin-bottom: 20px; }
    /* 对话消息 */
    .chat-messages { padding: 14px 10px; }
    .chat-msg { margin-bottom: 18px; }
    .chat-msg-content { max-width: 90%; }
    .chat-msg-bubble { padding: 10px 14px; font-size: 14px; border-radius: 14px; }
    .chat-msg-text { font-size: 13px; }
    .chat-msg-image { max-width: 100%; border-radius: 10px; }
    .chat-msg-tag { font-size: 10px; padding: 2px 6px; }

    /* 输入区 */
    .input-area { padding: 0 8px 8px; }
    .input-box { border-radius: 12px; }
    .input-main { padding: 8px 10px; gap: 8px; }
    .input-textarea { font-size: 14px; }
    .input-send { width: 32px; height: 32px; border-radius: 8px; font-size: 14px; }
    .input-upload { width: 28px; height: 28px; }
    .input-upload svg { width: 16px; height: 16px; }
    .input-ref-preview { padding: 8px 10px 0; }
    .input-ref-preview img { width: 48px; height: 48px; border-radius: 6px; }
    .input-ref-remove { top: 4px; left: 52px; width: 16px; height: 16px; font-size: 9px; }
    .chat-msg-ref img { width: 36px; height: 36px; border-radius: 4px; }

    /* 比例/分辨率选项 - 手机端两行 */
    .input-options { padding: 4px 8px 8px; gap: 4px; flex-wrap: wrap; }
    .opt-group { gap: 2px !important; flex-wrap: wrap; }
    .opt-pill { padding: 3px 6px; font-size: 10px; border-radius: 10px; }
    .opt-pill svg { width: 11px; height: 11px; }
    .opt-pill b { font-size: 10px; }
    .opt-pill small { font-size: 8px; }
    .opt-divider { height: 12px; margin: 0 2px; }

    /* 弹窗通用 */
    .auth-overlay { padding: 16px; align-items: center; }
    .auth-box { padding: 28px 20px; border-radius: 18px; max-width: 100%; }
    .auth-header { margin-bottom: 20px; }
    .auth-header h2 { font-size: 20px; }
    .auth-close { top: 14px; right: 14px; width: 26px; height: 26px; font-size: 13px; }

    /* 用户面板 */
    .user-panel { padding: 0; align-items: flex-end; }
    .user-card {
        padding: 20px 16px; border-radius: 16px 16px 0 0; max-width: 100%;
        max-height: 85vh; overflow-y: auto;
    }
    .up-close-btn { top: 12px; right: 12px; width: 28px; height: 28px; font-size: 13px; }
    .user-card-header { gap: 12px; margin-bottom: 16px; }
    .user-card-avatar { width: 44px; height: 44px; border-radius: 12px; font-size: 18px; }
    .user-card-info h3 { font-size: 16px; }
    .user-card-info p { font-size: 12px; }
    .user-stats { grid-template-columns: repeat(3,1fr); gap: 6px; margin-bottom: 16px; }
    .stat-item { padding: 10px 4px; }
    .stat-item .val { font-size: 20px; }
    .stat-item .lbl { font-size: 10px; }
    .up-section { margin-bottom: 14px; }
    .up-section-title { font-size: 12px; margin-bottom: 6px; }
    .up-menu-item { padding: 10px 4px; font-size: 13px; }
    .plan-item { padding: 10px; }
    .plan-item .plan-price { font-size: 18px; }

    /* 协议弹窗 */
    .legal-card {
        max-width: 100%; max-height: 90vh; border-radius: 16px 16px 0 0;
    }
    .legal-body { padding: 16px 18px 24px; font-size: 13px; }
    .legal-body h3 { font-size: 14px; margin: 16px 0 6px; }

    /* Toast */
    .toast { font-size: 13px; padding: 10px 18px; border-radius: 10px; }
}

/* 超小屏幕 */
@media (max-width: 380px) {
    .mobile-header .brand { font-size: 14px; gap: 6px; }
    .mh-newchat-btn span { display: none; }
    .mh-newchat-btn { padding: 7px; border-radius: 8px; }
    .mh-login-btn { padding: 6px 10px; font-size: 11px; }
    .mh-right { gap: 6px; }
    .chat-welcome h1 { font-size: 18px; }
    .opt-group { gap: 1px !important; }
    .opt-pill { padding: 2px 5px; }
    .opt-pill svg { width: 10px; height: 10px; }
    .opt-pill b { font-size: 9px; }
    .opt-pill small { display: none; }
    .opt-divider { margin: 0 1px; }
    .user-card { padding: 16px 12px; }
    .stat-item .val { font-size: 18px; }
    .auth-box { padding: 20px 14px; }
}
