
/* =============================================
   GPT Image - 全局变量 & Reset
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* 浅色主题（默认） */
    --bg:           #f5f5f7;
    --surface:      #ffffff;
    --surface2:     #f8f8fb;
    --border:       #e8e8f0;
    --border2:      #d8d8e8;
    --text:         #1a1a2e;
    --text-2:       #4a4a6a;
    --text-3:       #8888aa;
    --accent:       #7c6af7;
    --accent-light: #ede9fe;
    --accent-hover: #6b58e8;
    --accent-glow:  rgba(124,106,247,.18);
    --danger:       #ef4444;
    --success:      #10b981;
    --warn:         #f59e0b;
    --shadow-sm:    0 1px 4px rgba(0,0,0,.06);
    --shadow:       0 4px 16px rgba(0,0,0,.08);
    --shadow-lg:    0 12px 40px rgba(0,0,0,.12);
    --radius:       12px;
    --radius-sm:    8px;
    --radius-xs:    6px;
    --sidebar-w:    300px;
    --topbar-h:     56px;
    --bottom-nav-h: 60px;
    --font:         'PingFang SC','Microsoft YaHei','Helvetica Neue',Arial,sans-serif;
}

[data-theme="dark"] {
    --bg:           #0f0f13;
    --surface:      #1a1a24;
    --surface2:     #22222f;
    --border:       #2e2e3e;
    --border2:      #3a3a50;
    --text:         #e8e8f0;
    --text-2:       #a0a0c0;
    --text-3:       #606080;
    --accent-light: rgba(124,106,247,.15);
    --shadow-sm:    0 1px 4px rgba(0,0,0,.3);
    --shadow:       0 4px 16px rgba(0,0,0,.4);
    --shadow-lg:    0 12px 40px rgba(0,0,0,.6);
}

html { font-size: 15px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
button { font-family: var(--font); cursor: pointer; }
a { text-decoration: none; color: inherit; }
input, textarea, select { font-family: var(--font); }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* =============================================
   顶部导航栏
   ============================================= */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 200;
    box-shadow: var(--shadow-sm);
}
.topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 32px;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-shrink: 0;
}
.logo-mark {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.logo-text {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.01em;
}

/* 中间导航 */
.topnav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}
.topnav-item {
    padding: 6px 14px;
    border-radius: var(--radius-xs);
    font-size: .9rem;
    color: var(--text-2);
    transition: color .15s, background .15s;
}
.topnav-item:hover { color: var(--text); background: var(--surface2); }
.topnav-item.active { color: var(--accent); font-weight: 600; }

/* 右侧操作 */
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}
.icon-btn {
    width: 34px; height: 34px;
    border: none;
    background: transparent;
    color: var(--text-2);
    border-radius: var(--radius-xs);
    display: flex; align-items: center; justify-content: center;
    transition: color .15s, background .15s;
}
.icon-btn:hover { color: var(--text); background: var(--surface2); }

.nav-auth { display: flex; align-items: center; gap: 8px; }
.btn-ghost {
    padding: 7px 16px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-2);
    font-size: .88rem;
    font-weight: 500;
    transition: all .15s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary {
    padding: 7px 18px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font-size: .88rem;
    font-weight: 600;
    transition: background .15s, transform .1s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(.97); }

/* 积分胶囊 */
.credits-pill {
    display: flex; align-items: center; gap: 5px;
    padding: 6px 13px;
    border: 1px solid var(--border2);
    border-radius: 20px;
    background: var(--surface2);
    color: var(--text-2);
    font-size: .85rem;
    font-weight: 600;
    transition: all .15s;
}
.credits-pill:hover { border-color: var(--accent); color: var(--accent); }
.credits-pill svg { color: var(--warn); }

/* 用户头像 + 下拉 */
.nav-user-area { position: relative; display: flex; align-items: center; gap: 8px; }
.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    border: 2px solid var(--border);
    transition: border-color .15s;
}
.user-avatar:hover { border-color: var(--accent); }
.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    padding: 6px;
    display: none;
    z-index: 300;
}
.user-menu.open { display: block; }
.user-menu-name {
    padding: 8px 10px 6px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-2);
}
.user-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }
.user-menu-item {
    display: flex; align-items: center; gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: transparent;
    color: var(--text-2);
    font-size: .88rem;
    border-radius: var(--radius-xs);
    transition: background .12s, color .12s;
    text-align: left;
}
.user-menu-item:hover { background: var(--surface2); color: var(--text); }
.user-menu-item.danger:hover { background: #fef2f2; color: var(--danger); }
[data-theme="dark"] .user-menu-item.danger:hover { background: rgba(239,68,68,.1); }

/* 移动端汉堡按钮 */
.mobile-menu-btn { display: none; }

/* =============================================
   主体布局
   ============================================= */
.app-layout {
    display: flex;
    height: calc(100vh - var(--topbar-h));
    margin-top: var(--topbar-h);
    overflow: hidden;
    gap: 0;
    padding: 0;
}

/* =============================================
   左侧面板
   ============================================= */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 1px 0 0 var(--border);
}

/* Tab 切换 */
.sidebar-tabs {
    display: flex;
    padding: 12px 12px 0;
    gap: 4px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}
.sidebar-tab {
    flex: 1;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 8px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--text-3);
    font-size: .85rem;
    font-weight: 500;
    transition: all .15s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.sidebar-tab:hover { background: var(--surface2); color: var(--text-2); }
.sidebar-tab.active {
    background: transparent;
    color: var(--accent);
    font-weight: 600;
    border-bottom-color: var(--accent);
}
.sidebar-tab svg { flex-shrink: 0; }

/* 面板内容滚动区 */
.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* 控制区块 */
.ctrl-section { display: flex; flex-direction: column; gap: 8px; }
.ctrl-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-2);
    letter-spacing: .02em;
}
.ctrl-desc {
    font-size: .75rem;
    color: var(--text-3);
    line-height: 1.5;
}

/* 模型下拉 */
.select-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.ctrl-select {
    width: 100%;
    padding: 9px 70px 9px 12px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: .9rem;
    appearance: none;
    outline: none;
    cursor: pointer;
    transition: border-color .15s;
}
.ctrl-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.model-badge {
    position: absolute;
    right: 30px;
    font-size: .65rem;
    font-weight: 700;
    background: var(--accent);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
    letter-spacing: .04em;
}
.select-arrow {
    position: absolute;
    right: 10px;
    color: var(--text-3);
    pointer-events: none;
}

/* 提示词 */
.prompt-wrap {
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
    overflow: hidden;
}
.prompt-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.prompt-input {
    width: 100%;
    min-height: 100px;
    padding: 11px 12px 6px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: .88rem;
    resize: none;
    outline: none;
    line-height: 1.6;
}
.prompt-input::placeholder { color: var(--text-3); }
.prompt-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 10px 8px;
}
.char-count { font-size: .72rem; color: var(--text-3); }
.char-count.warn { color: var(--warn); }
.random-btn {
    display: flex; align-items: center; gap: 4px;
    border: none;
    background: transparent;
    color: var(--accent);
    font-size: .75rem;
    font-weight: 500;
    padding: 3px 6px;
    border-radius: 4px;
    transition: background .12s;
}
.random-btn:hover { background: var(--accent-light); }

/* 比例按钮组 */
.ratio-group, .quality-group, .count-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.ratio-btn, .quality-btn, .count-btn {
    padding: 7px 14px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-2);
    font-size: .85rem;
    font-weight: 500;
    transition: all .15s;
    min-width: 44px;
    text-align: center;
}
.ratio-btn:hover, .quality-btn:hover, .count-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.ratio-btn.active, .quality-btn.active, .count-btn.active {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}
.ratio-btn:disabled, .quality-btn:disabled, .count-btn:disabled {
    opacity: .35;
    cursor: not-allowed;
    pointer-events: none;
}

/* 生成按钮 */
.btn-generate {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent) 0%, #a78bfa 100%);
    color: #fff;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .02em;
    transition: opacity .15s, transform .1s, box-shadow .15s;
    box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-generate:hover:not(:disabled) {
    opacity: .92;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(124,106,247,.35);
}
.btn-generate:active:not(:disabled) { transform: scale(.98); }
.btn-generate:disabled { opacity: .55; cursor: not-allowed; }
.cost-tip {
    text-align: center;
    font-size: .75rem;
    color: var(--text-3);
    margin-top: -10px;
}

/* 旋转动画 */
.spin { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 升级卡片 */
.upgrade-card {
    border: 1px solid #e9d5ff;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #faf5ff, #f5f3ff);
    padding: 14px;
}
[data-theme="dark"] .upgrade-card {
    border-color: rgba(124,106,247,.3);
    background: rgba(124,106,247,.08);
}
.upgrade-title {
    display: flex; align-items: center; gap: 6px;
    font-size: .82rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
}
.upgrade-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.upgrade-list li {
    display: flex; align-items: center; gap: 7px;
    font-size: .8rem;
    color: var(--text-2);
}
.upgrade-btn {
    width: 100%;
    padding: 8px;
    border: none;
    border-radius: var(--radius-xs);
    background: var(--accent);
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
    transition: background .15s;
}
.upgrade-btn:hover { background: var(--accent-hover); }

/* 历史记录列表 */
.history-list { display: flex; flex-direction: column; gap: 16px; }
.history-entry { display: flex; flex-direction: column; gap: 8px; }
.history-meta {
    display: flex; align-items: center; gap: 8px;
    font-size: .75rem;
    color: var(--text-3);
}
.history-meta svg { flex-shrink: 0; }
.history-prompt {
    font-size: .82rem;
    color: var(--text-2);
    line-height: 1.5;
    cursor: pointer;
    transition: color .12s;
}
.history-prompt:hover { color: var(--accent); }
.history-img-wrap {
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}
.history-img-wrap img {
    width: 100%;
    display: block;
    object-fit: cover;
}
.history-actions {
    display: flex; gap: 12px;
    padding: 6px 0 2px;
}
.history-action-btn {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    border: none;
    background: transparent;
    color: var(--text-3);
    font-size: .7rem;
    transition: color .12s;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
}
.history-action-btn:hover { color: var(--accent); background: var(--accent-light); }
.history-divider { height: 1px; background: var(--border); }

/* =============================================
   右侧结果区
   ============================================= */
.result-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    background: var(--bg);
}

/* 结果主卡片 */
.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    flex-shrink: 0;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
}
.result-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}
.result-subtitle {
    font-size: .8rem;
    color: var(--text-3);
    margin-top: 2px;
}
.clear-btn {
    display: flex; align-items: center; gap: 5px;
    border: none;
    background: transparent;
    color: var(--text-3);
    font-size: .8rem;
    padding: 5px 10px;
    border-radius: var(--radius-xs);
    transition: all .12s;
}
.clear-btn:hover { color: var(--danger); background: #fef2f2; }
[data-theme="dark"] .clear-btn:hover { background: rgba(239,68,68,.1); }

/* 空状态 */
.result-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px 70px;
    min-height: 340px;
}
.empty-illustration { margin-bottom: 24px; }
.result-empty h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}
.result-empty p {
    font-size: .85rem;
    color: var(--text-3);
    max-width: 320px;
    line-height: 1.6;
}

/* 图片网格 */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    padding: 16px 20px;
}
.image-card {
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform .2s, box-shadow .2s;
}
.image-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}
.image-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    background: var(--surface2);
    cursor: zoom-in;
}
.image-card-actions {
    display: flex;
    padding: 10px 12px;
    gap: 6px;
}
.img-action-btn {
    flex: 1;
    display: flex; align-items: center; justify-content: center; gap: 4px;
    padding: 7px 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-2);
    font-size: .75rem;
    transition: all .12s;
    text-decoration: none;
}
.img-action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

/* Toast 提示 */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--text);
    color: var(--surface);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: .85rem;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s, transform .25s;
    white-space: nowrap;
    z-index: 500;
    box-shadow: var(--shadow);
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--success); color: #fff; }

/* 示例提示词 */
.examples-section {
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
}
.examples-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.examples-title {
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-2);
}
.refresh-btn {
    display: flex; align-items: center; gap: 5px;
    border: none;
    background: transparent;
    color: var(--text-3);
    font-size: .78rem;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    transition: all .12s;
}
.refresh-btn:hover { color: var(--accent); background: var(--accent-light); }
.examples-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.example-card {
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    background: var(--surface);
}
.example-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.example-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    background: var(--surface2);
}
.example-text {
    padding: 8px 10px;
    font-size: .72rem;
    color: var(--text-2);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 空状态（通用） */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    color: var(--text-3);
    font-size: .85rem;
    text-align: center;
}

/* =============================================
   弹窗
   ============================================= */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 400;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px 28px;
    width: 100%;
    max-width: 400px;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: modalIn .2s ease;
}
.modal-wide { max-width: 560px; }
@keyframes modalIn {
    from { transform: translateY(12px) scale(.97); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

.modal-close {
    position: absolute; top: 14px; right: 14px;
    width: 28px; height: 28px;
    border: none; background: transparent;
    color: var(--text-3);
    border-radius: var(--radius-xs);
    display: flex; align-items: center; justify-content: center;
    transition: color .12s, background .12s;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }

.modal-logo {
    display: flex; justify-content: center;
    margin-bottom: 16px;
}
.modal-logo .logo-mark { width: 44px; height: 44px; border-radius: 12px; }
.modal-logo .logo-mark svg { width: 24px; height: 24px; }

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
    color: var(--text);
}
.modal-sub {
    text-align: center;
    font-size: .85rem;
    color: var(--text-3);
    margin-bottom: 20px;
}
.modal-sub strong { color: var(--accent); }

/* 表单 */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-2);
    letter-spacing: .03em;
}
.form-group input {
    padding: 10px 13px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: var(--surface2);
    color: var(--text);
    font-size: .9rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--surface);
}
.form-group input::placeholder { color: var(--text-3); }

.form-msg {
    min-height: 18px;
    font-size: .82rem;
    margin-bottom: 8px;
    border-radius: var(--radius-xs);
    padding: 0 2px;
}
.form-msg.error { color: var(--danger); }
.form-msg.success { color: var(--success); }

.btn-modal-submit {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    color: #fff;
    font-size: .95rem;
    font-weight: 700;
    transition: opacity .15s, transform .1s;
    box-shadow: 0 4px 12px var(--accent-glow);
}
.btn-modal-submit:hover:not(:disabled) { opacity: .9; transform: translateY(-1px); }
.btn-modal-submit:disabled { opacity: .5; cursor: not-allowed; }

.btn-modal-cancel {
    width: 100%;
    padding: 11px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-2);
    font-size: .9rem;
    margin-top: 10px;
    transition: all .12s;
}
.btn-modal-cancel:hover { background: var(--surface2); }

.modal-switch {
    text-align: center;
    margin-top: 18px;
    font-size: .85rem;
    color: var(--text-3);
}
.modal-switch a { color: var(--accent); font-weight: 600; }
.modal-switch a:hover { text-decoration: underline; }

/* 充值套餐 */
.packages-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}
.pkg-loading {
    grid-column: 1/-1;
    text-align: center;
    color: var(--text-3);
    padding: 24px;
    font-size: .88rem;
}
.pkg-card {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    transition: all .15s;
    background: var(--surface2);
    position: relative;
}
.pkg-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.pkg-card.selected {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.pkg-card.selected::after {
    content: '';
    position: absolute; top: 6px; right: 6px;
    width: 16px; height: 16px;
    background: var(--accent);
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    background-size: 10px;
    background-repeat: no-repeat;
    background-position: center;
}
.pkg-name { font-size: .75rem; color: var(--text-3); margin-bottom: 6px; font-weight: 600; }
.pkg-credits { font-size: 1.4rem; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 4px; }
.pkg-credits span { font-size: .7rem; font-weight: 500; color: var(--text-3); }
.pkg-price { font-size: .95rem; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.pkg-unit { font-size: .68rem; color: var(--text-3); }

.pay-note {
    display: flex; align-items: center; justify-content: center; gap: 5px;
    text-align: center;
    font-size: .78rem;
    color: var(--text-3);
    margin-top: 12px;
}

/* 支付等待 */
.pay-wait-body { text-align: center; padding: 28px 0 20px; }
.pay-spinner-ring {
    width: 52px; height: 52px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin: 0 auto 16px;
}
#payWaitTip { font-size: .88rem; color: var(--text-3); }

/* 全屏预览 */
.fullscreen-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.9);
    display: flex; align-items: center; justify-content: center;
    z-index: 600;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}
.fullscreen-overlay.active { opacity: 1; pointer-events: all; }
.fullscreen-overlay img {
    max-width: 100%; max-height: 100%;
    border-radius: var(--radius);
    object-fit: contain;
}
.fullscreen-close {
    position: absolute; top: 16px; right: 16px;
    width: 36px; height: 36px;
    border: none;
    background: rgba(255,255,255,.15);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: background .12s;
}
.fullscreen-close:hover { background: rgba(255,255,255,.25); }

/* =============================================
   移动端底部导航
   ============================================= */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-h);
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 200;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    border: none;
    background: transparent;
    color: var(--text-3);
    font-size: .68rem;
    font-weight: 500;
    padding: 6px 4px;
    border-radius: var(--radius-xs);
    transition: color .15s;
}
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item svg { flex-shrink: 0; }

/* =============================================
   响应式 - 移动端
   ============================================= */
@media (max-width: 768px) {
    :root { --topbar-h: 52px; }

    /* 隐藏PC导航，显示汉堡 */
    .topnav { display: none; }
    .mobile-menu-btn { display: flex; }
    .btn-ghost { display: none; }

    /* 主体变单列 */
    .app-layout {
        flex-direction: column;
        height: auto;
        overflow: visible;
        padding-bottom: var(--bottom-nav-h);
    }

    /* 侧边栏变全宽 */
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow: visible;
        height: auto;
    }
    .panel-content {
        overflow: visible;
        padding: 14px 14px 20px;
    }

    /* 结果区 */
    .result-area {
        padding: 12px 12px;
        overflow: visible;
        min-height: 60vh;
    }

    /* 示例网格 2列 */
    .examples-grid { grid-template-columns: repeat(2, 1fr); }

    /* 图片网格 1列 */
    .image-grid { grid-template-columns: 1fr; padding: 12px; }

    /* 底部导航显示 */
    .bottom-nav { display: flex; }

    /* 充值套餐 2列 */
    .packages-grid { grid-template-columns: repeat(2, 1fr); }

    /* 弹窗全屏 */
    .modal {
        padding: 24px 18px;
        border-radius: 16px 16px 0 0;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        max-width: 100%;
        margin: 0;
        animation: slideUp .25s ease;
    }
    .modal-overlay { align-items: flex-end; padding: 0; }
    @keyframes slideUp {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    /* 移动端历史记录在右侧区域显示 */
    #panelHistory { display: none !important; }
}

@media (max-width: 480px) {
    .topbar-inner { padding: 0 14px; gap: 12px; }
    .logo-text { font-size: .9rem; }
    .result-area { padding: 14px 12px; }
    .examples-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

/* =============================================
   PC 端微调
   ============================================= */
@media (min-width: 769px) {
    .bottom-nav { display: none !important; }
    .mobile-menu-btn { display: none !important; }
}

@media (min-width: 1200px) {
    :root { --sidebar-w: 320px; }
    .examples-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1440px) {
    :root { --sidebar-w: 340px; }
}

/* =============================================
   进度条（生成中）
   ============================================= */
.gen-progress {
    height: 2px;
    background: var(--border);
    border-radius: 1px;
    overflow: hidden;
    margin-top: -14px;
}
.gen-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #a78bfa);
    animation: progressAnim 1.8s ease-in-out infinite;
}
@keyframes progressAnim {
    0%   { width: 0; margin-left: 0; }
    50%  { width: 60%; margin-left: 20%; }
    100% { width: 0; margin-left: 100%; }
}
