/* =========================================
   快码系统 - 前台样式表
   顶级 SaaS 级设计规范 (Linear / Vercel 风格)
   ========================================= */
:root {
    --bg-body: #000000;
    --bg-surface: #0a0a0a;
    --bg-surface-hover: #141414;
    --bg-element: rgba(255, 255, 255, 0.04);
    --bg-element-hover: rgba(255, 255, 255, 0.08);

    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    --border-glow: rgba(255, 255, 255, 0.25);

    --text-title: #ffffff;
    --text-body: #a1a1aa;
    --text-muted: #71717a;

    --brand-primary: #ffffff;
    --brand-accent: #3b82f6;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --shadow-subtle: 0 4px 20px -2px rgba(0, 0, 0, 0.8);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* 浅色模式 */
body.light-mode {
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;
    --bg-element: rgba(0, 0, 0, 0.03);
    --bg-element-hover: rgba(0, 0, 0, 0.06);

    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.15);
    --border-glow: rgba(0, 0, 0, 0.3);

    --text-title: #0f172a;
    --text-body: #475569;
    --text-muted: #94a3b8;

    --brand-primary: #0f172a;
    --brand-accent: #2563eb;

    --shadow-subtle: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-tap-highlight-color: transparent; }

body {
    background-color: var(--bg-body); color: var(--text-title);
    height: 100vh; display: flex; flex-direction: column; overflow: hidden;
    transition: background-color 0.4s var(--ease-out), color 0.4s var(--ease-out);
    background-image: linear-gradient(var(--border-subtle) 1px, transparent 1px), linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
    background-size: 32px 32px;
    background-position: center top;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }
* { -ms-overflow-style: none; scrollbar-width: none; }

svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; transition: stroke 0.2s; }

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
}
.modal-overlay.show { display: flex; }
.modal {
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 28px;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    background: var(--bg-surface);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border: none;
    border-radius: 6px;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}
.modal-close:hover { color: var(--text-title); background: var(--bg-element); }
.modal-close svg { width: 20px; height: 20px; stroke: currentColor; }

.auth-link-btn {
    width: 100%;
    margin-top: 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    text-align: center;
}
.auth-link-btn:hover { color: var(--text-title); }
.auth-reset-hint {
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: var(--bg-element);
    color: var(--text-body);
    font-size: 13px;
    line-height: 1.6;
}
.auth-code-row { display: flex; gap: 8px; }
.auth-code-btn {
    width: 108px;
    flex-shrink: 0;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--bg-element);
    color: var(--text-title);
    font-size: 12px;
    cursor: pointer;
}
.auth-code-btn:disabled { opacity: 0.58; cursor: not-allowed; }

/* =========================================
   顶级组件规范
   ========================================= */
.glass-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-subtle);
    transition: border-color 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}

.bento-hover:hover {
    border-color: var(--border-strong);
    box-shadow: 0 8px 30px -4px rgba(0, 0, 0, 0.5);
}

/* 生成数量 */
.batch-count-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}
.batch-count-btn {
    min-height: 34px;
    border: 1px solid var(--border-subtle);
    border-radius: 7px;
    background: var(--bg-element);
    color: var(--text-body);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s var(--ease-out);
}
.batch-count-btn:hover {
    color: var(--text-title);
    border-color: var(--border-strong);
    background: var(--bg-element-hover);
}
.batch-count-btn.active {
    color: #1d4ed8;
    border-color: rgba(59,130,246,0.58);
    background: rgba(59,130,246,0.10);
    box-shadow: inset 0 0 0 1px rgba(59,130,246,0.06);
}
.checkin-card-body {
    display: grid;
    gap: 8px;
}
.checkin-main {
    display: grid;
    gap: 5px;
}
.checkin-main strong {
    color: var(--text-title);
    font-size: 22px;
    letter-spacing: -0.04em;
}
.checkin-main span,
.checkin-main em {
    color: var(--text-body);
    font-size: 12px;
    font-style: normal;
}
.checkin-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
    margin-top: 8px;
}
.checkin-day {
    display: grid;
    gap: 2px;
    justify-items: center;
    padding: 6px 3px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
}
.checkin-day span { font-size: 10px; color: var(--text-muted); }
.checkin-day strong { font-size: 11px; color: var(--text-body); }
.checkin-day.checked {
    border-color: rgba(34,197,94,0.48);
    background: rgba(34,197,94,0.12);
}
.checkin-day.today:not(.checked) {
    border-color: rgba(59,130,246,0.58);
    background: rgba(59,130,246,0.10);
}
.missions-list,
.credit-ledger-list {
    display: grid;
    gap: 10px;
}
.mission-item,
.credit-ledger-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: rgba(255,255,255,0.035);
}
.mission-item div,
.credit-ledger-item div { display: grid; gap: 4px; min-width: 0; }
.mission-item strong,
.credit-ledger-item strong { color: var(--text-title); font-size: 13px; }
.mission-item span,
.credit-ledger-item span,
.credit-ledger-item small { color: var(--text-muted); font-size: 12px; }
.mission-item em,
.credit-ledger-item em { font-style: normal; font-weight: 800; color: #22c55e; }
.credit-ledger-item em.negative { color: #ef4444; }
.mission-item button {
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.mission-status { padding: 5px 8px; border-radius: 999px; background: rgba(255,255,255,0.06); }
.profile-empty { padding: 22px; text-align: center; color: var(--text-muted); font-size: 13px; }
body.light-mode .checkin-day,
body.light-mode .mission-item,
body.light-mode .credit-ledger-item {
    background: rgba(255,255,255,0.72);
    border-color: rgba(15,23,42,0.10);
}
body.light-mode .checkin-day.checked { background: rgba(34,197,94,0.10); }
body.light-mode .checkin-day.today:not(.checked) { background: rgba(59,130,246,0.08); }
.notification-entry {
    position: relative;
}
.notification-badge {
    position: absolute;
    top: -5px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.daily-inspiration-card {
    position: relative;
    display: grid;
    grid-template-columns: 124px minmax(0, 1fr) 124px;
    align-items: center;
    gap: 10px;
    width: min(460px, 100%);
    margin: 18px auto 0;
    padding: 13px 8px 13px 14px;
    border: 1px solid rgba(148,163,184,0.18);
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(255,255,255,0.62), rgba(239,246,255,0.42));
    box-shadow: 0 14px 42px rgba(15,23,42,0.08), inset 0 1px 0 rgba(255,255,255,0.72);
    backdrop-filter: blur(18px);
}
.daily-inspiration-card::after {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: 19px;
    pointer-events: none;
    background: radial-gradient(circle at 12% 0%, rgba(96,165,250,0.18), transparent 34%);
}
.daily-inspiration-label {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: start;
    width: 124px;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(37,99,235,0.1);
    color: #2563eb;
    font-size: 15px;
    font-weight: 950;
    line-height: 1;
    letter-spacing: 0.01em;
}
.daily-inspiration-copy {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 4px;
    width: min(190px, calc(100% - 220px));
    min-width: 0;
    text-align: center;
    transform: translate(-50%, -50%);
}
.daily-inspiration-copy strong {
    max-width: 100%;
    color: var(--text-title);
    font-size: 15px;
    font-weight: 880;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.daily-inspiration-copy em {
    max-width: 100%;
    color: var(--text-body);
    font-size: 12px;
    font-style: normal;
    line-height: 1.48;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: .84;
}
.daily-inspiration-card button,
.mini-action-btn,
.activity-item button {
    border: 1px solid var(--border-subtle);
    border-radius: 9px;
    padding: 8px 12px;
    background: var(--text-title);
    color: var(--bg-body);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}
.daily-inspiration-card button {
    justify-self: end;
    position: absolute;
    right: 18px;
    top: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transform: translateY(-50%);
    z-index: 2;
    width: 124px;
    min-height: 36px;
    margin-right: 0;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px;
    padding: 0 14px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    box-shadow: 0 12px 28px rgba(37,99,235,0.26), 0 0 0 1px rgba(255,255,255,0.08) inset;
    font-size: 13px;
    font-weight: 950;
    letter-spacing: 0.01em;
}
.daily-inspiration-card button::before {
    content: '✦';
    font-size: 12px;
    line-height: 1;
}
.daily-inspiration-card button::after {
    content: '→';
    font-size: 13px;
    line-height: 1;
}
.daily-inspiration-card button:hover {
    background: linear-gradient(135deg, #1d4ed8, #6d28d9);
    color: #fff;
    box-shadow: 0 16px 34px rgba(37,99,235,0.34), 0 0 0 1px rgba(255,255,255,0.12) inset;
    transform: translateY(calc(-50% - 1px));
}
.notifications-list,
.activities-list {
    display: grid;
    gap: 10px;
}
.notification-item,
.activity-item {
    display: grid;
    gap: 6px;
    padding: 13px;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    cursor: pointer;
}
.notification-item.unread { border-color: rgba(59,130,246,0.38); background: rgba(59,130,246,0.08); }
.notification-item strong,
.activity-item strong { color: var(--text-title); font-size: 13px; }
.notification-item span,
.activity-item span,
.notification-item small { color: var(--text-muted); font-size: 12px; line-height: 1.6; }
.level-hero {
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 1px solid rgba(59,130,246,0.28);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(124,58,237,0.06));
    margin-bottom: 12px;
}
.level-hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.level-hero-top div { display: grid; gap: 6px; min-width: 0; }
.level-hero strong { color: var(--text-title); font-size: 24px; line-height: 1.15; }
.level-hero span,
.level-hero em { color: var(--text-body); font-size: 13px; font-style: normal; }
.level-hero-top > em {
    flex-shrink: 0;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(59,130,246,0.14);
    color: #93c5fd;
    font-weight: 800;
}
.level-progress-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-body);
    font-size: 12px;
}
.level-progress {
    height: 9px;
    border-radius: 999px;
    background: rgba(148,163,184,0.18);
    overflow: hidden;
}
.level-progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb, #7c3aed);
}
.level-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}
.level-stats span {
    display: grid;
    gap: 4px;
    padding: 12px 10px;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    color: var(--text-body);
    font-size: 12px;
    text-align: center;
}
.level-stats strong { color: var(--text-title); font-size: 18px; line-height: 1; }
.level-stats em { color: var(--text-body); font-size: 12px; font-style: normal; font-weight: 800; }
.level-stats small { color: var(--text-muted); font-size: 10px; line-height: 1.3; }
.level-section-title {
    margin: 4px 0 10px;
    color: var(--text-title);
    font-size: 13px;
    font-weight: 900;
}
.level-route-list { display: grid; gap: 8px; margin-bottom: 14px; }
.level-route-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: rgba(255,255,255,0.035);
}
.level-route-item div { display: grid; gap: 3px; min-width: 0; }
.level-route-item strong { color: var(--text-title); font-size: 13px; }
.level-route-item span { color: var(--text-muted); font-size: 11px; }
.level-route-item em {
    flex-shrink: 0;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(148,163,184,0.12);
    color: var(--text-body);
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
}
.level-route-item.current { border-color: rgba(59,130,246,0.42); background: rgba(59,130,246,0.09); }
.level-route-item.current em { background: rgba(37,99,235,0.18); color: #93c5fd; }
.level-route-item.reached em { color: #86efac; background: rgba(34,197,94,0.12); }
.level-benefits {
    display: grid;
    gap: 5px;
    padding: 12px;
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: 12px;
    background: rgba(59,130,246,0.06);
    margin-bottom: 14px;
}
.level-benefits strong { color: var(--text-title); font-size: 13px; }
.level-benefits span { color: var(--text-body); font-size: 12px; line-height: 1.55; }
.level-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.level-actions button {
    min-height: 36px;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    background: var(--bg-element);
    color: var(--text-body);
    padding: 0 14px;
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
}
.level-actions button:hover { color: var(--text-title); border-color: var(--border-strong); background: var(--bg-element-hover); }
.level-actions .level-action-primary { background: var(--text-title); color: var(--bg-body); border-color: transparent; }
.onboarding-box { width: min(460px, 92vw); }
.onboarding-content {
    display: grid;
    gap: 10px;
    padding: 8px 0 18px;
}
.onboarding-content strong { color: var(--text-title); font-size: 22px; }
.onboarding-content p { color: var(--text-body); font-size: 14px; line-height: 1.7; margin: 0; }
.onboarding-step-count { color: var(--text-muted); font-size: 12px; }
.onboarding-actions { display: flex; justify-content: flex-end; gap: 10px; }
body.light-mode .notification-item,
body.light-mode .activity-item,
body.light-mode .level-stats span { background: rgba(255,255,255,0.78); border-color: rgba(15,23,42,0.1); }
body.light-mode .daily-inspiration-card {
    background: linear-gradient(145deg, rgba(255,255,255,0.86), rgba(239,246,255,0.72));
    border-color: rgba(37,99,235,0.16);
    box-shadow: 0 14px 42px rgba(37,99,235,0.09), inset 0 1px 0 rgba(255,255,255,0.82);
}
body.light-mode .daily-inspiration-label {
    background: rgba(37,99,235,0.1);
    color: #1d4ed8;
}
body.light-mode .daily-inspiration-card button {
    color: #fff;
    box-shadow: 0 12px 28px rgba(37,99,235,0.22), 0 0 0 1px rgba(255,255,255,0.16) inset;
}
body.light-mode .model-select-card {
    background: linear-gradient(135deg, rgba(37,99,235,0.11), rgba(124,58,237,0.06)), rgba(255,255,255,0.86);
    border-color: rgba(37,99,235,0.18);
    box-shadow: 0 12px 30px rgba(37,99,235,0.08), inset 0 1px 0 rgba(255,255,255,0.78);
}
body.light-mode .model-select-head em {
    background: rgba(37,99,235,0.1);
    color: #1d4ed8;
}
body.light-mode #model-select {
    background: rgba(255,255,255,0.88);
    border-color: rgba(37,99,235,0.2);
    color: #0f172a;
}
body.light-mode #model-select:hover,
body.light-mode #model-select:focus {
    border-color: rgba(37,99,235,0.42);
    background: #ffffff;
}
body.light-mode .level-hero { background: rgba(59,130,246,0.07); }
.profile-panel-modal {
    padding: 20px;
    z-index: 10020;
}
.profile-panel-modal-box {
    width: min(960px, 94vw);
    max-width: min(960px, 94vw);
    max-height: min(82vh, 760px);
    padding: 24px;
    overflow-y: auto;
}
.profile-panel-modal-narrow {
    width: min(680px, 94vw);
    max-width: min(680px, 94vw);
}
.profile-panel-modal .modal-header {
    position: sticky;
    top: -24px;
    z-index: 2;
    margin: -24px -24px 18px;
    padding: 20px 24px 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    border-radius: 16px 16px 0 0;
}
.profile-panel-modal .modal-close svg {
    width: 20px;
    height: 20px;
}
@media (max-width: 768px) {
    .profile-panel-modal {
        padding: 12px;
        align-items: flex-end;
    }
    .profile-panel-modal-box,
    .profile-panel-modal-narrow {
        width: 100%;
        max-width: 100%;
        max-height: 86vh;
        border-radius: 18px 18px 0 0;
        padding: 18px;
    }
    .profile-panel-modal .modal-header {
        top: -18px;
        margin: -18px -18px 14px;
        padding: 16px 18px 14px;
        border-radius: 18px 18px 0 0;
    }
    #referral-stats {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .level-hero-top,
    .level-progress-text {
        flex-direction: column;
        align-items: flex-start;
    }
    .level-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .level-route-item {
        align-items: flex-start;
    }
    .level-actions {
        justify-content: stretch;
    }
    .level-actions button {
        flex: 1;
    }
    .mission-item,
    .credit-ledger-item {
        grid-template-columns: minmax(0, 1fr) auto;
    }
    .credit-ledger-item > small {
        grid-column: 1 / -1;
    }
}
#checkin-btn:disabled,
#checkin-btn.is-disabled {
    opacity: 0.62;
    cursor: not-allowed;
}
body.light-mode .batch-count-btn {
    background: #f8fafc;
    color: #475569;
    border-color: rgba(15,23,42,0.12);
}
body.light-mode .batch-count-btn.active {
    color: #1d4ed8;
    border-color: rgba(59,130,246,0.58);
    background: rgba(59,130,246,0.08);
}

/* 顶部导航 */
header {
    height: 56px; margin: 14px 24px 0 24px; padding: 0 18px;
    display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
    border-radius: var(--radius-lg); backdrop-filter: blur(12px);
}

.logo-area { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }
.logo-svg { width: 22px; height: 22px; stroke: var(--brand-primary); }

.nav-tabs { display: flex; gap: 4px; background: var(--bg-element); padding: 4px; border-radius: 10px; border: 1px solid var(--border-subtle); }
.nav-tab {
    padding: 6px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500;
    color: var(--text-body); display: flex; align-items: center; gap: 6px; transition: all 0.2s var(--ease-out);
}
.nav-tab svg { width: 14px; height: 14px; }
.nav-tab:hover { color: var(--text-title); background: var(--bg-element-hover); }
.nav-tab.active { background-color: var(--bg-surface); color: var(--text-title); box-shadow: 0 1px 3px rgba(0,0,0,0.2); border: 1px solid var(--border-subtle); }
.nav-tab.is-loading { pointer-events: none; opacity: 0.82; }
.nav-tab.is-loading::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.72;
    animation: navPulse 0.75s ease-in-out infinite alternate;
}
@keyframes navPulse { from { transform: scale(0.72); opacity: 0.45; } to { transform: scale(1.18); opacity: 0.9; } }

.header-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn {
    background: transparent; border: 1px solid var(--border-subtle); color: var(--text-body);
    width: 32px; height: 32px; border-radius: var(--radius-sm); cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.icon-btn:hover { color: var(--text-title); background: var(--bg-element); border-color: var(--border-strong); }

/* 主体布局 */
#main-container { flex: 1; padding: 14px 24px 20px 24px; overflow: hidden; position: relative; min-height: 0; }
.page-content { display: none; height: 100%; width: 100%; opacity: 0; transition: opacity 0.14s var(--ease-out); flex-direction: column; }
body.page-switching .page-content:not(.active-page) { transition: none !important; }
.page-content.active-page { display: flex; opacity: 1; gap: 20px; }

/* --- 首页引导 --- */
#home-page {
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding-bottom: 28px;
}
.landing-shell {
    position: relative;
    height: auto;
    min-height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.82fr);
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas:
        "hero showcase"
        "map map";
    gap: clamp(18px, 2.2vw, 30px) clamp(22px, 2.8vw, 38px);
    align-items: center;
    padding: clamp(30px, 3.6vw, 52px);
    border: 1px solid rgba(148,163,184,0.14);
    border-radius: 34px;
    overflow: hidden;
    background:
        radial-gradient(circle at 12% 16%, rgba(59,130,246,0.24), transparent 32%),
        radial-gradient(circle at 56% 8%, rgba(168,85,247,0.1), transparent 30%),
        radial-gradient(circle at 86% 66%, rgba(34,197,94,0.16), transparent 34%),
        linear-gradient(135deg, rgba(255,255,255,0.11), rgba(255,255,255,0.03) 46%, rgba(255,255,255,0.08));
    box-shadow: 0 24px 84px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.08);
}
body.light-mode .landing-shell {
    background:
        radial-gradient(circle at 12% 16%, rgba(37,99,235,0.18), transparent 32%),
        radial-gradient(circle at 56% 8%, rgba(124,58,237,0.08), transparent 30%),
        radial-gradient(circle at 86% 66%, rgba(16,185,129,0.14), transparent 34%),
        linear-gradient(135deg, rgba(255,255,255,0.99), rgba(248,250,252,0.9));
    box-shadow: 0 24px 74px rgba(15,23,42,0.08), inset 0 1px 0 rgba(255,255,255,0.94);
}
.landing-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(circle at center, black, transparent 72%);
    pointer-events: none;
}
body.light-mode .landing-shell::before { background-image: linear-gradient(rgba(15,23,42,0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(15,23,42,0.06) 1px, transparent 1px); }
.landing-orb { position: absolute; border-radius: 999px; filter: blur(7px); opacity: 0.72; pointer-events: none; }
.landing-orb-a { width: 220px; height: 220px; left: -64px; top: 16%; background: rgba(59,130,246,0.24); animation: landingFloat 7s ease-in-out infinite; }
.landing-orb-b { width: 160px; height: 160px; right: 9%; bottom: 9%; background: rgba(34,197,94,0.18); animation: landingFloat 8s ease-in-out infinite reverse; }
.landing-orb-c { width: 140px; height: 140px; left: 48%; top: 8%; background: rgba(168,85,247,0.16); animation: landingFloat 9s ease-in-out infinite; }
.landing-hero, .landing-map, .landing-showcase { position: relative; z-index: 1; }
.landing-hero {
    grid-area: hero;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}
.landing-kicker {
    width: fit-content;
    padding: 8px 12px;
    border: 1px solid rgba(125,211,252,0.34);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(14,165,233,0.16), rgba(59,130,246,0.1));
    color: #7dd3fc;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 18px;
    box-shadow: 0 10px 30px rgba(14,165,233,0.08);
}
body.light-mode .landing-kicker { color: #0369a1; background: rgba(14,165,233,0.11); border-color: rgba(14,165,233,0.24); }
.landing-hero h1 {
    max-width: 760px;
    font-size: clamp(46px, 5.2vw, 76px);
    line-height: 1.08;
    letter-spacing: -0.07em;
    color: var(--text-title);
    margin-bottom: 18px;
    text-wrap: balance;
}
.landing-hero p {
    max-width: 520px;
    color: var(--text-body);
    font-size: clamp(15px, 1.35vw, 18px);
    line-height: 1.78;
}
.landing-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}
.landing-tags span {
    border: 1px solid rgba(148,163,184,0.18);
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    color: var(--text-body);
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 800;
}
body.light-mode .landing-tags span { background: rgba(255,255,255,0.7); border-color: rgba(15,23,42,0.08); }
.landing-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.landing-primary, .landing-secondary {
    min-height: 48px;
    border-radius: 999px;
    padding: 0 19px;
    border: 1px solid rgba(148,163,184,0.18);
    font-family: inherit;
    font-weight: 900;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    transition: transform 0.18s var(--ease-out), border-color 0.18s var(--ease-out), background 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out);
}
.landing-primary { background: linear-gradient(135deg, #f8fafc, #dbeafe); color: #0f172a; border-color: transparent; box-shadow: 0 18px 46px rgba(37,99,235,0.2); }
.landing-primary svg { stroke: #0f172a; width: 16px; height: 16px; }
.landing-secondary { background: rgba(255,255,255,0.07); color: var(--text-title); }
body.light-mode .landing-secondary { background: rgba(255,255,255,0.78); }
.landing-primary:hover, .landing-secondary:hover { transform: translateY(-2px); border-color: rgba(96,165,250,0.36); box-shadow: 0 18px 46px rgba(37,99,235,0.16); }
.landing-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 24px;
    max-width: 580px;
}
.landing-metrics div {
    border: 1px solid rgba(148,163,184,0.14);
    border-radius: 16px;
    background: rgba(255,255,255,0.055);
    padding: 12px;
    display: grid;
    gap: 5px;
}
body.light-mode .landing-metrics div { background: rgba(255,255,255,0.72); border-color: rgba(15,23,42,0.08); }
.landing-metrics strong { color: #93c5fd; font-size: 18px; line-height: 1; }
body.light-mode .landing-metrics strong { color: #2563eb; }
.landing-metrics span { color: var(--text-body); font-size: 12px; font-weight: 800; line-height: 1.35; }
.landing-map {
    grid-area: map;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    align-self: stretch;
}
.landing-card {
    min-height: 96px;
    border: 1px solid rgba(148,163,184,0.14);
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(15,23,42,0.62), rgba(15,23,42,0.34));
    color: var(--text-title);
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 9px;
    text-align: left;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), 0 12px 32px rgba(0,0,0,0.1);
    transition: transform 0.22s var(--ease-out), border-color 0.22s var(--ease-out), background 0.22s var(--ease-out), box-shadow 0.22s var(--ease-out);
}
body.light-mode .landing-card { background: rgba(255,255,255,0.82); box-shadow: 0 16px 44px rgba(15,23,42,0.06), inset 0 1px 0 rgba(255,255,255,0.9); }
.landing-card:hover { transform: translateY(-4px); border-color: rgba(125,211,252,0.44); background: linear-gradient(145deg, rgba(30,41,59,0.86), rgba(15,23,42,0.58)); box-shadow: 0 22px 58px rgba(0,0,0,0.2); }
body.light-mode .landing-card:hover { background: rgba(255,255,255,0.96); }
@media (max-width: 760px) {
    .landing-map {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}
.landing-card-main {
    min-height: 112px;
    background:
        linear-gradient(145deg, rgba(37,99,235,0.38), rgba(124,58,237,0.13)),
        rgba(15,23,42,0.66);
}
.landing-showcase {
    grid-area: showcase;
    align-self: center;
    display: grid;
    gap: 14px;
    min-width: 0;
}
.landing-preview-card {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(148,163,184,0.14);
    border-radius: 30px;
    background: linear-gradient(160deg, rgba(15,23,42,0.72), rgba(15,23,42,0.34));
    box-shadow: 0 20px 58px rgba(0,0,0,0.16), inset 0 1px 0 rgba(255,255,255,0.08);
    padding: 16px;
}
body.light-mode .landing-preview-card { background: rgba(255,255,255,0.86); box-shadow: 0 20px 56px rgba(15,23,42,0.09), inset 0 1px 0 rgba(255,255,255,0.94); }
.landing-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.landing-preview-head span { color: var(--text-title); font-size: 13px; font-weight: 900; }
.landing-preview-head em { color: #bfdbfe; font-style: normal; font-size: 11px; font-weight: 900; border: 1px solid rgba(96,165,250,0.32); border-radius: 999px; padding: 5px 9px; background: rgba(59,130,246,0.14); }
body.light-mode .landing-preview-head em { color: #1d4ed8; background: rgba(37,99,235,0.1); }
.landing-preview-art {
    position: relative;
    min-height: 238px;
    border-radius: 24px;
    background:
        radial-gradient(circle at 34% 26%, rgba(96,165,250,0.2), transparent 28%),
        radial-gradient(circle at 72% 72%, rgba(34,197,94,0.14), transparent 28%),
        linear-gradient(135deg, rgba(255,255,255,0.075), rgba(255,255,255,0.02));
    border: 1px solid rgba(148,163,184,0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
body.light-mode .landing-preview-art { background: linear-gradient(135deg, rgba(239,246,255,0.9), rgba(240,253,244,0.72)); border-color: rgba(15,23,42,0.08); }
.landing-preview-glow { position: absolute; inset: 20px; border-radius: 999px; background: radial-gradient(circle, rgba(96,165,250,0.24), transparent 66%); filter: blur(10px); }
.landing-preview-art .mascot-stage { min-height: 190px; margin: 0; }
.landing-preview-art .mascot-bubble { right: 10%; top: 10px; }
.landing-prompt-box {
    margin-top: 12px;
    border: 1px solid rgba(148,163,184,0.14);
    border-radius: 16px;
    background: rgba(255,255,255,0.055);
    padding: 12px;
    display: grid;
    gap: 6px;
}
body.light-mode .landing-prompt-box { background: rgba(255,255,255,0.72); border-color: rgba(15,23,42,0.08); }
.landing-prompt-box span { color: var(--text-muted); font-size: 11px; font-weight: 800; }
.landing-prompt-box strong { color: var(--text-title); font-size: 12px; line-height: 1.55; }
.landing-progress-list { display: grid; gap: 8px; margin-top: 12px; }
.landing-progress-list div { display: flex; align-items: center; gap: 9px; color: var(--text-body); font-size: 12px; font-weight: 800; }
.landing-progress-list i { width: 8px; height: 8px; border-radius: 50%; background: #60a5fa; box-shadow: 0 0 18px rgba(96,165,250,0.72); }
.landing-mini-panel {
    border: 1px solid rgba(148,163,184,0.14);
    border-radius: 22px;
    background: rgba(255,255,255,0.055);
    padding: 16px;
    display: grid;
    gap: 12px;
}
body.light-mode .landing-mini-panel { background: rgba(255,255,255,0.78); border-color: rgba(15,23,42,0.08); }
.landing-mini-panel strong { color: var(--text-title); font-size: 13px; }
.landing-mini-panel div { display: flex; gap: 8px; flex-wrap: wrap; }
.landing-mini-panel span { color: var(--text-body); border: 1px solid rgba(148,163,184,0.16); background: rgba(255,255,255,0.06); border-radius: 999px; padding: 6px 9px; font-size: 11px; font-weight: 800; }
.mascot-stage {
    position: relative;
    width: 100%;
    min-height: 142px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}
.mascot-stage::before {
    content: "";
    position: absolute;
    width: 220px;
    height: 118px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(125,211,252,0.28), transparent 70%);
    filter: blur(2px);
    transform: translateY(14px);
}
.mascot-bubble {
    position: absolute;
    top: 0;
    right: 8px;
    max-width: min(230px, 92%);
    padding: 8px 11px;
    border-radius: 14px 14px 14px 4px;
    background: rgba(255,255,255,0.88);
    color: #0f172a;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
    box-shadow: 0 14px 40px rgba(15,23,42,0.14);
    animation: mascotBubble 4.8s ease-in-out infinite;
    transition: transform 0.22s var(--ease-out), opacity 0.22s var(--ease-out);
    z-index: 2;
}
.ai-mascot {
    --eye-x: 0px;
    --eye-y: 0px;
    position: relative;
    width: 104px;
    height: 104px;
    border-radius: 32px 32px 38px 38px;
    background:
        radial-gradient(circle at 34% 26%, rgba(255,255,255,0.95), transparent 16%),
        linear-gradient(145deg, #dff7ff 0%, #8bd7ff 42%, #3b82f6 100%);
    border: 3px solid rgba(255,255,255,0.82);
    box-shadow:
        0 20px 42px rgba(37,99,235,0.26),
        inset 0 -12px 24px rgba(15,23,42,0.12);
    animation: mascotFloat 3.8s ease-in-out infinite;
    z-index: 1;
    transition: transform 0.22s var(--ease-out), filter 0.22s var(--ease-out);
}
.landing-card-main:hover .ai-mascot,
.ai-mascot.is-curious { filter: saturate(1.08) brightness(1.04); }
.ai-mascot.is-excited { animation: mascotFloat 3.8s ease-in-out infinite, mascotBounce 0.58s var(--ease-out); }
.ai-mascot.is-thinking .mascot-antenna::after { background: #facc15; box-shadow: 0 0 26px rgba(250,204,21,0.9); }
.ai-mascot.is-calm .mascot-antenna::after { background: #a7f3d0; box-shadow: 0 0 20px rgba(167,243,208,0.72); }
.ai-mascot.is-poked { animation: mascotFloat 3.8s ease-in-out infinite, mascotPoke 0.48s var(--ease-out); }
.mascot-antenna {
    position: absolute;
    left: 50%;
    top: -24px;
    width: 4px;
    height: 26px;
    transform: translateX(-50%);
    background: #1e3a8a;
    border-radius: 99px;
}
.mascot-antenna::after {
    content: "";
    position: absolute;
    left: 50%;
    top: -8px;
    width: 14px;
    height: 14px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: #86efac;
    box-shadow: 0 0 24px rgba(134,239,172,0.9);
}
.mascot-ear {
    position: absolute;
    top: 28px;
    width: 24px;
    height: 32px;
    border-radius: 16px;
    background: #60a5fa;
    border: 3px solid rgba(255,255,255,0.82);
    z-index: -1;
}
.mascot-ear-left { left: -16px; transform: rotate(-10deg); }
.mascot-ear-right { right: -16px; transform: rotate(10deg); }
.mascot-face {
    position: absolute;
    inset: 24px 16px 18px;
    border-radius: 24px;
    background: rgba(255,255,255,0.86);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}
.mascot-eye {
    position: absolute;
    top: 23px;
    width: 13px;
    height: 16px;
    border-radius: 999px;
    background: #0f172a;
    transform: translate(var(--eye-x), var(--eye-y));
    animation: mascotBlink 5s ease-in-out infinite;
}
.mascot-eye::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #fff;
}
.mascot-eye-left { left: 18px; }
.mascot-eye-right { right: 18px; }
.mascot-mouth {
    position: absolute;
    left: 50%;
    bottom: 15px;
    width: 24px;
    height: 12px;
    border-bottom: 4px solid #0f172a;
    border-radius: 0 0 999px 999px;
    transform: translateX(-50%);
    transition: width 0.2s var(--ease-out), height 0.2s var(--ease-out), border-width 0.2s var(--ease-out);
}
.ai-mascot.is-excited .mascot-mouth,
.ai-mascot.is-poked .mascot-mouth { width: 30px; height: 15px; border-bottom-width: 5px; }
.ai-mascot.is-thinking .mascot-mouth { width: 18px; height: 4px; border-bottom-width: 3px; }
.mascot-arm {
    position: absolute;
    top: 68px;
    width: 28px;
    height: 12px;
    border-radius: 999px;
    background: #2563eb;
    border: 2px solid rgba(255,255,255,0.72);
}
.mascot-arm-left { left: -22px; transform: rotate(-22deg); animation: mascotWaveLeft 3.8s ease-in-out infinite; }
.mascot-arm-right { right: -22px; transform: rotate(22deg); animation: mascotWaveRight 3.8s ease-in-out infinite; }
.mascot-shadow {
    position: absolute;
    bottom: 4px;
    width: 102px;
    height: 18px;
    border-radius: 50%;
    background: rgba(15,23,42,0.18);
    filter: blur(8px);
    animation: mascotShadow 3.8s ease-in-out infinite;
}
body.light-mode .mascot-shadow { background: rgba(15,23,42,0.12); }
.landing-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.09);
    border: 1px solid var(--border-subtle);
    color: var(--text-title);
}
body.light-mode .landing-card-icon { background: rgba(15,23,42,0.035); border-color: rgba(15,23,42,0.08); }
.landing-card strong { font-size: 15px; letter-spacing: -0.02em; }
.landing-card em { color: var(--text-muted); font-style: normal; font-size: 11px; line-height: 1.45; }

/* --- 联系客服 --- */
.contact-float {
    position: fixed;
    right: 22px;
    bottom: 82px;
    z-index: 10009;
    min-height: 42px;
    padding: 0 15px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.22);
    background: rgba(15,23,42,0.76);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(18px);
    transition: transform 0.18s var(--ease-out), border-color 0.18s var(--ease-out), background 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out);
}
body.light-mode .contact-float { background: rgba(255,255,255,0.92); color: #0f172a; border-color: rgba(37,99,235,0.16); box-shadow: 0 14px 34px rgba(15,23,42,0.1); }
.contact-float:hover { transform: translateY(-2px); border-color: rgba(96,165,250,0.38); background: rgba(30,41,59,0.9); box-shadow: 0 18px 46px rgba(0,0,0,0.3); }
body.light-mode .contact-float:hover { background: #ffffff; }
.contact-float svg { width: 18px; height: 18px; }
.contact-float span { font-size: 13px; font-weight: 800; }
.contact-modal-panel { width: min(440px, calc(100vw - 32px)); }
.contact-desc { margin-top: 6px; color: var(--text-muted); font-size: 13px; line-height: 1.6; font-weight: 400; }
.contact-methods { display: flex; flex-direction: column; gap: 12px; }
.contact-method {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    background: var(--bg-element);
}
.contact-method-head { display: flex; align-items: center; gap: 12px; }
.contact-method-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--text-title);
    color: var(--bg-body);
    font-size: 14px;
    font-weight: 900;
    flex-shrink: 0;
}
.contact-method strong { color: var(--text-title); font-size: 14px; }
.contact-method p { margin-top: 4px; color: var(--text-body); font-size: 13px; word-break: break-all; }
.contact-group-method {
    border-color: rgba(96,165,250,0.28);
    background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(124,58,237,0.08), var(--bg-element));
}
.contact-group-icon {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
}
.contact-group-qr-wrap {
    box-shadow: inset 0 0 0 1px rgba(15,23,42,0.04);
}
.contact-qr-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 12px;
    background: #fff;
}
.contact-qr-wrap img { width: 176px; height: 176px; object-fit: contain; display: block; }
.contact-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.contact-action-btn {
    min-height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-title);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s var(--ease-out);
}
.contact-action-btn:hover { border-color: var(--border-strong); background: var(--bg-element-hover); }
.contact-action-primary { background: var(--text-title); color: var(--bg-body); border-color: transparent; }
.contact-action-primary:hover { background: var(--text-title); opacity: 0.88; }
@keyframes landingFloat {
    0%, 100% { transform: translate3d(0,0,0) scale(1); }
    50% { transform: translate3d(18px,-14px,0) scale(1.06); }
}
@keyframes mascotFloat {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50% { transform: translateY(-10px) rotate(2deg); }
}
@keyframes mascotShadow {
    0%, 100% { transform: scaleX(1); opacity: 0.78; }
    50% { transform: scaleX(0.78); opacity: 0.48; }
}
@keyframes mascotBlink {
    0%, 92%, 100% { height: 16px; top: 23px; }
    95% { height: 3px; top: 29px; }
}
@keyframes mascotBubble {
    0%, 100% { transform: translateY(0); opacity: 0.92; }
    50% { transform: translateY(-5px); opacity: 1; }
}
@keyframes mascotWaveLeft {
    0%, 100% { transform: rotate(-22deg); }
    50% { transform: rotate(-34deg); }
}
@keyframes mascotWaveRight {
    0%, 100% { transform: rotate(22deg); }
    50% { transform: rotate(34deg); }
}
@keyframes mascotBounce {
    0% { transform: translateY(0) scale(1); }
    36% { transform: translateY(-16px) scale(1.06, 0.96) rotate(-3deg); }
    68% { transform: translateY(2px) scale(0.98, 1.04) rotate(2deg); }
    100% { transform: translateY(0) scale(1); }
}
@keyframes mascotPoke {
    0%, 100% { transform: translateY(0) rotate(-1deg) scale(1); }
    34% { transform: translateY(-6px) rotate(-7deg) scale(1.04); }
    68% { transform: translateY(1px) rotate(4deg) scale(0.99); }
}

/* 创作工作台：桌面端侧边栏(左) + 画板(右) */
@media (min-width: 769px) {
    #create-page { flex-direction: row !important; }
    #create-sidebar { order: 1; }
    #create-page .workspace-canvas { order: 2; }
}

/* --- 侧边栏与表单 --- */
.sidebar { width: 292px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; padding-right: 4px; flex-shrink: 0; min-height: 0; }
.bento-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

.section-header { display: flex; align-items: center; justify-content: space-between; }
.section-title { font-size: 12px; font-weight: 600; color: var(--text-title); text-transform: uppercase; letter-spacing: 0.5px; display: flex; align-items: center; gap: 6px; }
.section-title svg { width: 14px; height: 14px; stroke: var(--text-body); }

textarea, select, input {
    width: 100%; background: var(--bg-element); border: 1px solid var(--border-subtle);
    color: var(--text-title); padding: 10px 12px; border-radius: var(--radius-sm);
    font-size: 13px; outline: none; transition: all 0.2s var(--ease-out); line-height: 1.5; resize: none; font-family: inherit;
}
textarea:focus, select:focus, input:focus { border-color: var(--border-glow); background: var(--bg-surface); }
textarea::placeholder { color: var(--text-muted); }
.model-select-card {
    position: relative;
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid rgba(96,165,250,0.28);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(37,99,235,0.12), rgba(124,58,237,0.06)), var(--bg-element);
    box-shadow: 0 12px 30px rgba(37,99,235,0.1), inset 0 1px 0 rgba(255,255,255,0.06);
}
.model-select-card::before {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: 15px;
    pointer-events: none;
    background: radial-gradient(circle at 14% 0%, rgba(96,165,250,0.18), transparent 42%);
}
.model-select-card > * {
    position: relative;
    z-index: 1;
}
.model-select-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.model-select-head span {
    color: var(--text-title);
    font-size: 13px;
    font-weight: 900;
}
.model-select-head em {
    flex-shrink: 0;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(59,130,246,0.14);
    color: #93c5fd;
    font-size: 11px;
    font-style: normal;
    font-weight: 900;
}
.model-select-control {
    position: relative;
}
.model-select-control::before {
    content: '';
    position: absolute;
    right: 20px;
    top: 50%;
    z-index: 2;
    width: 7px;
    height: 7px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    pointer-events: none;
    transform: translateY(-65%) rotate(45deg);
}
.model-select-control::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    pointer-events: none;
    transform: translateY(-50%);
    box-shadow: 0 8px 18px rgba(37,99,235,0.28);
}
#model-select {
    min-height: 46px;
    padding: 11px 50px 11px 13px;
    border-color: rgba(96,165,250,0.34);
    border-radius: 13px;
    background: rgba(255,255,255,0.07);
    color: var(--text-title);
    cursor: pointer;
    font-size: 13px;
    font-weight: 900;
    appearance: none;
    -webkit-appearance: none;
}
#model-select:hover,
#model-select:focus {
    border-color: rgba(96,165,250,0.68);
    background: rgba(255,255,255,0.1);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.model-select-hint {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.55;
}
@media (max-width: 768px) {
    .model-select-card {
        gap: 7px;
        padding: 11px;
        border-radius: 14px;
    }
    .model-select-control::before {
        right: 18px;
        width: 6px;
        height: 6px;
    }
    .model-select-control::after {
        right: 9px;
        width: 26px;
        height: 26px;
        border-radius: 9px;
    }
    #model-select {
        min-height: 44px;
        padding-right: 46px;
        font-size: 12px;
    }
    .model-select-hint {
        font-size: 10.5px;
    }
}
#prompt {
    min-height: 92px;
    max-height: 360px;
    overflow-y: auto;
}

.param-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.param-btn {
    background: var(--bg-element); border: 1px solid var(--border-subtle); color: var(--text-body);
    padding: 8px 4px; border-radius: var(--radius-sm); text-align: center; cursor: pointer; font-size: 12px; font-weight: 500; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.param-btn:hover { border-color: var(--border-strong); color: var(--text-title); }
.param-btn.active { background: var(--text-title); color: var(--bg-body); border-color: transparent; }

.btn-primary {
    background: var(--text-title); color: var(--bg-body); border: none; padding: 12px 14px;
    border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px; transition: transform 0.1s; margin-top: auto; font-family: inherit;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary svg { stroke: var(--bg-body); }

/* --- 画布区 --- */
.workspace { flex: 1; display: flex; flex-direction: column; padding: 24px; overflow: hidden; min-width: 0; }
.workspace-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; overflow-y: auto; flex: 1; align-content: start; }
.img-card {
    background: var(--bg-element); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
    aspect-ratio: 1 / 1; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center;
    min-height: 200px;
}
.img-card img {
    width: 100%; height: 100%; object-fit: cover; display: none; position: absolute; inset: 0;
}
.img-card img.loaded { display: block; }
.empty-state {
    color: var(--text-muted); font-size: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; width: 100%; height: 100%; text-align: center; padding: 16px;
}
.empty-state svg { width: 24px; height: 24px; stroke: var(--text-muted); opacity: 0.5; }

.hover-actions { position: absolute; bottom: 12px; right: 12px; display: flex; opacity: 0; transform: translateY(10px); transition: all 0.2s var(--ease-out); gap: 6px; }
.img-card:hover .hover-actions { opacity: 1; transform: translateY(0); }
.action-icon-btn {
    background: rgba(0,0,0,0.75); backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,0.1); color: #fff;
    width: 28px; height: 28px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.2s;
}
.action-icon-btn:hover { background: var(--text-title); color: var(--bg-body); }
.action-icon-btn:hover svg { stroke: var(--bg-body); }

/* --- 广场页面 --- */
#square-page {
    flex-direction: column;
    position: relative;
    overflow: hidden;
}
#square-page::before {
    content: '';
    position: absolute;
    inset: -18% -8% auto;
    height: 260px;
    background: radial-gradient(circle at 24% 18%, rgba(59,130,246,0.16), transparent 34%), radial-gradient(circle at 82% 0%, rgba(244,114,182,0.12), transparent 32%);
    pointer-events: none;
    opacity: 0.85;
}
.square-toolbar {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    margin-bottom: 0;
    gap: 14px;
    flex-shrink: 0;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.025));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}
body.light-mode .square-toolbar { background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(248,250,252,0.76)); }
.search-area {
    width: min(40vw, 500px);
    min-width: 260px;
    position: relative;
    display: flex;
    align-items: center;
}
.search-input {
    width: 100%;
    min-height: 44px;
    padding: 0 14px 0 42px;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: rgba(255,255,255,0.06);
    color: var(--text-title);
    outline: none;
    transition: all 0.2s var(--ease-out);
}
.search-input:focus { border-color: rgba(59,130,246,0.48); box-shadow: 0 0 0 4px rgba(59,130,246,0.12); }
.search-input::placeholder { color: var(--text-muted); }
body.light-mode .search-input { background: rgba(255,255,255,0.86); }
.search-area svg { position: absolute; left: 15px; stroke: var(--text-muted); width: 16px; height: 16px; pointer-events: none; }
.filter-area {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
}
.square-sort-tabs {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    background: rgba(255,255,255,0.05);
}
body.light-mode .square-sort-tabs { background: rgba(255,255,255,0.72); }
.square-sort-btn {
    min-height: 34px;
    padding: 0 13px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-body);
    cursor: pointer;
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
    transition: color 0.18s var(--ease-out), background 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out);
}
.square-sort-btn.active {
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    box-shadow: 0 10px 24px rgba(37,99,235,0.2);
}
.filter-area .btn {
    min-height: 42px !important;
    padding: 0 18px !important;
    border-radius: 999px !important;
    background: var(--text-title) !important;
    color: var(--bg-body) !important;
    border: 1px solid var(--text-title) !important;
    box-shadow: 0 12px 30px rgba(0,0,0,0.18) !important;
    transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out) !important;
}
.filter-area .btn:hover { transform: translateY(-1px); box-shadow: 0 16px 36px rgba(0,0,0,0.24) !important; }
.filter-select { width: 120px; padding: 8px 12px; font-size: 12px; border-radius: var(--radius-sm); background: var(--bg-surface); }

.square-gallery {
    position: relative;
    z-index: 1;
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
    grid-auto-rows: 268px;
    gap: 18px;
    padding: 2px 4px 24px;
    align-content: start;
}
.square-gallery.is-refreshing::after {
    content: '正在刷新';
    position: sticky;
    top: 8px;
    justify-self: center;
    grid-column: 1 / -1;
    z-index: 6;
    width: max-content;
    padding: 7px 13px;
    border-radius: 999px;
    background: rgba(15,23,42,0.78);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 12px 30px rgba(0,0,0,0.18);
}
.square-card {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    background: var(--bg-element);
    box-shadow: 0 18px 44px rgba(0,0,0,0.26);
    isolation: isolate;
    transform: translateZ(0);
    transition: transform 0.24s var(--ease-out), border-color 0.24s var(--ease-out), box-shadow 0.24s var(--ease-out);
}
.square-card::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(135deg, rgba(255,255,255,0.18), transparent 28%, transparent 72%, rgba(255,255,255,0.08));
    opacity: 0;
    transition: opacity 0.24s var(--ease-out);
    pointer-events: none;
}
.square-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255,255,255,0.24);
    box-shadow: 0 24px 70px rgba(0,0,0,0.36);
}
body.light-mode .square-card { box-shadow: 0 18px 42px rgba(15,23,42,0.12); }
body.light-mode .square-card:hover { border-color: rgba(37,99,235,0.26); box-shadow: 0 24px 62px rgba(15,23,42,0.18); }
.square-card-skeleton {
    cursor: default;
    background: linear-gradient(110deg, rgba(255,255,255,0.06), rgba(255,255,255,0.14), rgba(255,255,255,0.06));
    background-size: 220% 100%;
    animation: squareSkeleton 1.05s ease-in-out infinite;
}
.square-card-skeleton span,
.square-card-skeleton em {
    position: absolute;
    left: 18px;
    right: 18px;
    height: 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.16);
}
.square-card-skeleton span { bottom: 54px; }
.square-card-skeleton em { bottom: 28px; right: 46%; }
body.light-mode .square-card-skeleton { background: linear-gradient(110deg, rgba(226,232,240,0.64), rgba(248,250,252,0.94), rgba(226,232,240,0.64)); background-size: 220% 100%; }
body.light-mode .square-card-skeleton span,
body.light-mode .square-card-skeleton em { background: rgba(148,163,184,0.22); }
@keyframes squareSkeleton { from { background-position: 160% 0; } to { background-position: -60% 0; } }
.square-card:hover::before { opacity: 1; }
.square-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.01);
    transition: transform 0.42s var(--ease-out), filter 0.42s var(--ease-out);
}
.square-card:hover img { transform: scale(1.055); filter: saturate(1.08) contrast(1.04); }
.card-mask {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.52) 42%, rgba(0,0,0,0.08) 72%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 18px;
    opacity: 1;
    transition: background 0.24s var(--ease-out);
}
.square-card:hover .card-mask { background: linear-gradient(to top, rgba(0,0,0,0.94) 0%, rgba(0,0,0,0.56) 48%, rgba(0,0,0,0.12) 78%, transparent 100%); }
.card-prompt-info {
    color: rgba(255,255,255,0.94);
    font-size: 13px;
    font-weight: 650;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.45;
    text-shadow: 0 2px 12px rgba(0,0,0,0.45);
}
.square-card-actions {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-bottom: 0;
    max-height: 0;
    opacity: 0;
    overflow: visible;
    pointer-events: none;
    transform: translateY(8px);
    transition: max-height 0.24s var(--ease-out), margin-bottom 0.24s var(--ease-out), opacity 0.2s var(--ease-out), transform 0.24s var(--ease-out);
}
.square-card:hover .square-card-actions,
.square-card.square-more-open .square-card-actions {
    max-height: 52px;
    margin-bottom: 12px;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.square-more-toggle {
    min-width: 82px;
}
.square-more-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 5;
    width: min(176px, 76vw);
    padding: 7px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 16px;
    background: rgba(15,23,42,0.82);
    box-shadow: 0 18px 46px rgba(0,0,0,0.34);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    display: grid;
    gap: 4px;
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.18s var(--ease-out), transform 0.18s var(--ease-out);
}
.square-card.square-more-open .square-more-menu {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.square-more-item {
    width: 100%;
    min-height: 34px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: rgba(255,255,255,0.92);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
}
.square-more-item:hover { background: rgba(255,255,255,0.12); }
.square-more-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.square-more-item.is-disabled { opacity: 0.48; cursor: not-allowed; }
.square-action-btn {
    min-width: 0;
    min-height: 34px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 11px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.18s var(--ease-out);
}
.square-card-actions .square-action-btn:not(.square-favorite-btn) { width: 100%; }
.square-card-stats {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(0,0,0,0.34);
    border: 1px solid rgba(255,255,255,0.16);
    box-shadow: 0 8px 18px rgba(0,0,0,0.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.square-favorite-btn {
    min-width: 38px;
    min-height: 22px;
    padding: 0 5px;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}
.square-favorite-btn span { min-width: 10px; text-align: left; }
.square-card-stats .square-action-btn { gap: 3px; font-size: 10px; }
.square-card-stats .square-action-btn svg { width: 11px; height: 11px; }
.square-action-btn svg { width: 13px; height: 13px; stroke: currentColor; flex-shrink: 0; }
.square-action-btn:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.32); transform: translateY(-1px); }
.square-action-primary { grid-column: auto; background: rgba(255,255,255,0.94); color: #050505; border-color: rgba(255,255,255,0.72); }
.square-action-primary:hover { background: #fff; color: #050505; }
.square-action-btn.is-disabled { opacity: 0.48; cursor: not-allowed; transform: none; }
@media (hover: none) {
    .square-card-actions { max-height: 52px; margin-bottom: 12px; opacity: 1; pointer-events: auto; transform: none; }
}
.card-meta {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 7px;
    border-top: 1px solid rgba(255,255,255,0.12);
    padding-top: 11px;
    min-width: 0;
}
.square-author-row {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    min-width: 0;
    color: rgba(255,255,255,0.78);
    font-size: 11px;
    font-weight: 750;
}
.square-author-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.square-info-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.author-level-badge {
    justify-self: start;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(59,130,246,0.22);
    border: 1px solid rgba(147,197,253,0.26);
    color: #dbeafe;
    font-size: 10px;
    font-style: normal;
    font-weight: 800;
    line-height: 1;
}
.author-avatar { width: 20px; height: 20px; border-radius: 50%; background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.16); display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.author-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.author-avatar svg { width: 11px; height: 11px; stroke: #fff; }
.author-link { text-decoration: none; cursor: pointer; transition: color .18s ease, opacity .18s ease; }
.author-link:hover { color: #fff; opacity: .96; }
.square-size-badge {
    max-width: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    justify-self: end;
    flex-shrink: 0;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.72) !important;
    font-size: 10px !important;
    font-weight: 700;
}
.square-reuse-badge {
    flex-shrink: 0;
    padding: 0 6px;
    min-height: 22px;
    border-radius: 999px;
    background: rgba(34,197,94,0.14);
    border: 1px solid rgba(134,239,172,0.2);
    color: #bbf7d0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}
#square-loading, #square-empty {
    position: relative;
    z-index: 1;
    border: 1px dashed var(--border-subtle);
    border-radius: 22px;
    background: rgba(255,255,255,0.035);
}
body.light-mode #square-loading, body.light-mode #square-empty { background: rgba(255,255,255,0.72); }

/* --- AI 对话 --- */
#chat-page { flex-direction: column; }
.chat-shell { flex: 1; min-height: 0; padding: 0; overflow: hidden; }
.chat-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); height: 100%; min-height: 0; }
.chat-sidebar { border-right: 1px solid var(--border-subtle); padding: 18px; display: flex; flex-direction: column; gap: 14px; min-height: 0; background: linear-gradient(180deg, var(--bg-element), transparent 32%); }
.chat-new-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border-subtle); background: var(--text-title); color: var(--bg-body); font-size: 14px; font-weight: 700; cursor: pointer; }
.chat-new-btn svg { width: 15px; height: 15px; stroke: var(--bg-body); }
.chat-conversations { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.chat-conversation-item { width: 100%; text-align: left; border: 1px solid var(--border-subtle); background: var(--bg-element); color: var(--text-title); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; transition: all 0.2s var(--ease-out); }
.chat-conversation-item:hover { border-color: var(--border-strong); background: var(--bg-surface-hover); }
.chat-conversation-item.active { border-color: var(--text-title); background: var(--bg-surface-hover); box-shadow: inset 0 0 0 1px var(--text-title); }
.chat-conversation-title { font-size: 13px; font-weight: 600; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-conversation-time { font-size: 11px; color: var(--text-muted); }
.chat-list-empty { font-size: 12px; color: var(--text-muted); padding: 12px; border: 1px dashed var(--border-subtle); border-radius: 12px; text-align: center; }
.chat-panel { height: 100%; display: flex; flex-direction: column; padding: 24px; min-height: 0; }
.chat-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--border-subtle); }
.chat-hero h2 { font-size: 22px; font-weight: 700; margin-top: 10px; letter-spacing: 0; }
.chat-balance { background: var(--bg-element); border: 1px solid var(--border-subtle); color: var(--text-body); border-radius: 999px; padding: 8px 12px; font-size: 12px; white-space: nowrap; }
.chat-balance span { color: var(--text-title); font-weight: 700; }
.chat-messages { flex: 1; overflow-y: auto; padding: 22px 4px; display: flex; flex-direction: column; gap: 14px; }
.chat-empty { margin: auto; color: var(--text-muted); max-width: 460px; text-align: center; font-size: 14px; line-height: 1.7; border: 1px dashed var(--border-subtle); border-radius: var(--radius-md); padding: 24px; background: var(--bg-element); }
.chat-message { display: flex; width: 100%; }
.chat-message.user { justify-content: flex-end; }
.chat-message.assistant { justify-content: flex-start; }
.chat-bubble { max-width: min(720px, 82%); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 13px 15px; font-size: 14px; line-height: 1.7; color: var(--text-title); background: var(--bg-element); word-break: break-word; }
.chat-message.user .chat-bubble { background: var(--text-title); color: var(--bg-body); border-color: transparent; }
.chat-composer { display: grid; grid-template-columns: 1fr auto; gap: 12px; border-top: 1px solid var(--border-subtle); padding-top: 16px; }
.chat-composer textarea { min-height: 52px; max-height: 140px; resize: vertical; }
.chat-composer .btn-primary { margin-top: 0; min-width: 112px; }
.chat-hint { font-size: 12px; color: var(--text-muted); padding-top: 10px; }

/* --- 个人主页 --- */
#profile-page { flex-direction: column; overflow-y: auto; padding-right: 4px; gap: 20px; }
.profile-grid-top { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

.user-info-card { display: flex; align-items: center; gap: 24px; padding: 24px; }
.user-avatar-large { width: 72px; height: 72px; border-radius: 16px; background: var(--bg-element); border: 1px solid var(--border-strong); display: flex; align-items: center; justify-content: center; }
.user-avatar-large svg { width: 32px; height: 32px; stroke: var(--text-title); }
.user-details { min-width: 0; }
.user-details h2 { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.user-tags { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tag { background: var(--bg-element); border: 1px solid var(--border-subtle); padding: 2px 8px; border-radius: 4px; font-size: 11px; color: var(--text-body); display: flex; align-items: center; gap: 4px; }
.tag svg { width: 10px; height: 10px; }
.profile-quota-inline { width: min(360px, 34%); min-width: 260px; margin-left: auto; }
.profile-quota-inline .credit-amount { font-size: clamp(22px, 2vw, 30px); font-weight: 800; color: var(--text-title); line-height: 1.15; margin-bottom: 12px; }
.profile-quota-inline .profile-quota-btn { width: 100%; margin-top: 12px; }

.credit-card { padding: 24px; display: flex; flex-direction: column; justify-content: center; }
.credit-title { font-size: 12px; color: var(--text-body); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }

.progress-bar { width: 100%; height: 4px; background: var(--bg-element); border-radius: 2px; overflow: hidden; margin-bottom: 16px; }
.progress-fill { height: 100%; background: var(--text-title); border-radius: 2px; }

.profile-grid-bottom { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; padding-bottom: 24px; }
@media (max-width: 900px) {
    .user-info-card {
        display: grid;
        grid-template-columns: 60px minmax(0, 1fr);
        align-items: start;
        gap: 14px;
    }
    .user-avatar-large { width: 60px; height: 60px; border-radius: 14px; }
    .user-avatar-large svg { width: 28px; height: 28px; }
    .user-details { min-width: 0; text-align: left; align-self: start; display: flex; flex-direction: column; align-items: flex-start; padding-top: 2px; }
    .user-details h2 { margin: 0 0 7px; line-height: 1.2; }
    .user-tags { justify-content: flex-start; align-items: center; margin: 0 0 8px; }
    #profile-level-tag { width: fit-content; }
    .profile-quota-inline {
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0;
        margin-left: 0;
        padding-top: 16px;
        border-top: 1px solid var(--border-subtle);
    }
}
.stat-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border-subtle); }
.stat-item:last-child { border-bottom: none; }
.stat-label { color: var(--text-body); font-size: 13px; }
.stat-value { font-weight: 600; font-size: 14px; }

.menu-list { display: flex; flex-direction: column; gap: 6px; }
.menu-item { display: flex; align-items: center; justify-content: space-between; padding: 12px; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s; border: 1px solid transparent; }
.menu-item:hover { background: var(--bg-element); border-color: var(--border-subtle); }
.menu-icon-text { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-title); font-weight: 500; }
.menu-icon-text svg { width: 16px; height: 16px; stroke: var(--text-muted); }
.menu-item:hover .menu-icon-text svg { stroke: var(--text-title); }

#ref-image-area:hover { border-color: var(--border-strong); background: var(--bg-element); }
.create-field-title { margin-top: 12px; }
.create-limit-text { font-size: 10px; color: var(--text-muted); font-weight: 500; text-transform: none; letter-spacing: 0; }
.create-ref-count-wrap { display: inline-flex; align-items: center; gap: 6px; }
.creative-tool-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.creative-tool-btn { flex-wrap: wrap; row-gap: 2px; }
.creative-tool-btn small { font-size: 10px; line-height: 1.2; color: var(--text-muted); font-weight: 500; margin-left: 4px; }
.creative-tool-hint { margin-top: -4px; font-size: 11px; line-height: 1.5; color: var(--text-muted); }
.reverse-cost-note { font-size: 11px; line-height: 1.5; color: var(--text-muted); text-align: center; margin-top: -2px; }
.create-resolution-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.create-size-btn {
    min-height: 48px;
    flex-direction: column;
    gap: 3px;
    padding: 9px 6px;
    border-radius: 8px;
    background: var(--bg-element);
    border-color: var(--border-subtle);
}
.create-size-btn strong { font-size: 13px; color: inherit; line-height: 1; }
.create-size-btn span { font-size: 9px; color: var(--text-muted); font-weight: 500; line-height: 1; }
.create-size-btn.active { background: rgba(37,99,235,0.12); border-color: var(--brand-accent); color: var(--text-title); box-shadow: inset 0 0 0 1px rgba(37,99,235,0.18); }
.create-size-btn.active span { color: var(--brand-accent); }
.ratio-preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ratio-btn {
    min-height: 56px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--bg-element);
    color: var(--text-body);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    font-family: inherit;
}
.ratio-btn:hover { border-color: var(--border-strong); color: var(--text-title); }
.ratio-btn.active { background: rgba(37,99,235,0.12); border-color: var(--brand-accent); color: var(--text-title); box-shadow: inset 0 0 0 1px rgba(37,99,235,0.18); }
.ratio-icon {
    width: 24px;
    height: 18px;
    aspect-ratio: var(--ratio-w) / var(--ratio-h);
    border: 2px solid currentColor;
    border-radius: 3px;
    opacity: 0.9;
    object-fit: contain;
}
.ratio-btn strong { font-size: 10px; line-height: 1; }
.ref-source-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ref-source-btn, .ref-upload-btn {
    min-height: 38px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--bg-element);
    color: var(--text-body);
    font-size: 11px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s var(--ease-out);
    font-family: inherit;
}
.ref-source-btn:hover, .ref-upload-btn:hover, .ref-upload-btn.drag-over { border-color: var(--border-strong); color: var(--text-title); background: var(--bg-element-hover); }
.ref-source-btn svg, .ref-upload-btn svg { width: 14px; height: 14px; }
.ref-upload-btn { grid-column: span 2; min-height: 72px; border-style: dashed; flex-direction: column; gap: 8px; }
.ref-upload-btn input { display: none; }
.ref-selected-area {
    position: relative;
    min-height: 74px;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: var(--bg-element);
    padding: 10px;
}
.ref-images-preview { display: flex; flex-wrap: wrap; gap: 8px; padding-right: 42px; }
.ref-empty-state { min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: var(--text-muted); font-size: 11px; }
.ref-empty-state svg { width: 20px; height: 20px; opacity: 0.55; }
.ref-clear-btn { position: absolute; right: 8px; top: 8px; display: none; align-items: center; justify-content: center; border: none; border-radius: 999px; background: rgba(15,23,42,0.75); color: #fff; height: 24px; padding: 0 9px; font-size: 10px; cursor: pointer; }
.ref-picker-panel { border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg-surface); padding: 10px; }
.ref-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; color: var(--text-title); font-size: 12px; }
.ref-picker-head button { border: 1px solid var(--border-subtle); background: var(--bg-element); color: var(--text-body); border-radius: 6px; height: 24px; padding: 0 8px; font-size: 11px; cursor: pointer; }
.ref-picker-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-height: 178px; overflow-y: auto; }
.ref-picker-item { border: 1px solid var(--border-subtle); border-radius: 8px; padding: 0; overflow: hidden; background: var(--bg-element); aspect-ratio: 1; cursor: pointer; }
.ref-picker-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-picker-empty { grid-column: 1 / -1; padding: 18px 8px; text-align: center; color: var(--text-muted); font-size: 12px; }
.cost-box { color: var(--text-muted); font-size: 12px; line-height: 1.7; padding: 5px 0 0; }
.cost-box #cost-preview { color: var(--text-title); font-weight: 800; }
.cost-box #balance-preview { color: #22c55e; font-weight: 700; }
.create-run-btn { min-height: 44px; border-radius: 8px; background: #0f172a; color: #fff; flex-shrink: 0; }
.create-run-btn svg { stroke: #fff; }
body.light-mode .create-run-btn { background: #0f172a; color: #fff; }
body.light-mode .create-run-btn svg { stroke: #fff; }
.ref-thumb { position: relative; width: 64px; height: 64px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border-subtle); flex-shrink: 0; }
    .ref-thumb img { width: 100%; height: 100%; object-fit: cover; }
    .ref-thumb .remove-btn { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; background: rgba(0,0,0,0.8); border: none; color: #fff; border-radius: 50%; cursor: pointer; font-size: 11px; line-height: 18px; text-align: center; }
    .ref-thumb .canvas-add-btn { position: absolute; left: 4px; right: 4px; bottom: 4px; height: 20px; border: none; border-radius: 5px; background: rgba(0,0,0,0.72); color: #fff; font-size: 10px; cursor: pointer; }
    .size-grid-wrapper { display: flex; flex-direction: column; gap: 4px; }
    .size-preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
    .size-preset-grid.create-resolution-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .size-inputs-row { flex-wrap: wrap; }
    .workspace-canvas { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 14px; box-shadow: var(--shadow-subtle); }
    .workspace-canvas-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); flex-shrink: 0; gap: 10px; }
    .canvas-header-controls { display: flex; gap: 10px; align-items: center; min-width: 0; }
    .canvas-mode-toggle { display: inline-flex; align-items: center; gap: 9px; min-height: 42px; padding: 6px 12px 6px 8px; color: var(--text-title); font-size: 12px; white-space: nowrap; cursor: pointer; user-select: none; border: 1px solid rgba(96,165,250,0.28); border-radius: 999px; background: linear-gradient(135deg, rgba(59,130,246,0.16), rgba(15,23,42,0.46)); box-shadow: 0 12px 30px rgba(0,0,0,0.16); transition: all 0.2s var(--ease-out); }
    .canvas-mode-toggle:hover { border-color: rgba(96,165,250,0.52); transform: translateY(-1px); }
    .canvas-mode-toggle input { display: none; }
    .canvas-mode-switch { position: relative; width: 52px; height: 28px; border-radius: 999px; background: rgba(148,163,184,0.28); border: 1px solid rgba(148,163,184,0.42); transition: all 0.2s var(--ease-out); flex-shrink: 0; }
    .canvas-mode-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 3px 10px rgba(0,0,0,0.28); transition: transform 0.2s var(--ease-out); }
    .canvas-mode-copy { display: grid; gap: 1px; line-height: 1.1; }
    .canvas-mode-copy strong { color: #ffffff; font-size: 12px; font-weight: 900; letter-spacing: 0.02em; }
    .canvas-mode-copy em { color: #bfdbfe; font-size: 10px; font-style: normal; font-weight: 700; }
    .canvas-mode-toggle input:checked + .canvas-mode-switch { background: linear-gradient(135deg, #2563eb, #7c3aed); border-color: rgba(147,197,253,0.72); box-shadow: 0 0 0 4px rgba(37,99,235,0.16); }
    .canvas-mode-toggle input:checked + .canvas-mode-switch::after { transform: translateX(24px); }
    .canvas-mode-toggle:has(input:checked) { border-color: rgba(147,197,253,0.62); background: linear-gradient(135deg, rgba(37,99,235,0.88), rgba(124,58,237,0.76)); }
    body.light-mode .canvas-mode-toggle { background: #ffffff; border-color: rgba(37,99,235,0.26); box-shadow: 0 12px 28px rgba(15,23,42,0.08); }
    body.light-mode .canvas-mode-copy strong { color: #0f172a; }
    body.light-mode .canvas-mode-copy em { color: #2563eb; }
    body.light-mode .canvas-mode-toggle:has(input:checked) { background: linear-gradient(135deg, #2563eb, #7c3aed); }
    body.light-mode .canvas-mode-toggle:has(input:checked) .canvas-mode-copy strong, body.light-mode .canvas-mode-toggle:has(input:checked) .canvas-mode-copy em { color: #ffffff; }
    .canvas-mode-off #workspace-actions { display: none !important; }
    .canvas-mode-off #infinite-canvas-shell { display: none !important; }
    .canvas-mode-off #mobile-output-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; padding: 14px; min-height: 320px; overflow-y: auto; align-content: start; }
    .canvas-mode-off #mobile-recent-output-panel { grid-column: 1 / -1; }
    .canvas-mode-off #mobile-output-grid .canvas-card { min-height: 220px; }
    .canvas-mode-off #mobile-output-grid .canvas-card-overlay { opacity: 1; }
    .canvas-mode-off .canvas-add-btn { display: none !important; }
    .canvas-project-select { min-width: 118px; max-width: 170px; height: 28px; background: rgba(255,255,255,0.06); border: 1px solid var(--border); color: var(--text-body); border-radius: 6px; padding: 0 8px; font-size: 12px; outline: none; cursor: pointer; }
    body.light-mode .canvas-project-select { background: rgba(255,255,255,0.82); }
    .infinite-canvas-shell { position: relative; flex: 1; min-height: 0; overflow: hidden; background: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.08) 1px, transparent 0); background-size: 28px 28px; }
    .infinite-canvas-shell.canvas-panning, .infinite-canvas-shell.canvas-panning-ready { cursor: grab; }
    .infinite-canvas-shell.canvas-panning { cursor: grabbing; }
    body.light-mode .infinite-canvas-shell { background: radial-gradient(circle at 1px 1px, rgba(0,0,0,0.08) 1px, transparent 0); background-size: 28px 28px; }
    .infinite-canvas-view { position: absolute; inset: 0; width: 100%; height: 100%; }
    .canvas-empty-state { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--text-muted); text-align: center; padding: 40px; pointer-events: none; z-index: 2; }
    .canvas-empty-icon { width: 80px; height: 80px; border-radius: 20px; background: var(--bg-element); border: 2px dashed var(--border-strong); display: flex; align-items: center; justify-content: center; }
    .canvas-empty-icon svg { width: 36px; height: 36px; stroke: var(--text-muted); opacity: 0.6; }
    .canvas-empty-title { font-size: 16px; font-weight: 600; color: var(--text-body); }
    .canvas-empty-desc { font-size: 13px; color: var(--text-muted); max-width: 280px; line-height: 1.5; }
    .canvas-hint { position: absolute; left: 16px; bottom: 14px; z-index: 3; color: var(--text-muted); background: rgba(0,0,0,0.45); border: 1px solid rgba(255,255,255,0.08); backdrop-filter: blur(8px); border-radius: 8px; padding: 6px 10px; font-size: 11px; pointer-events: none; }
    body.light-mode .canvas-hint { background: rgba(255,255,255,0.75); border-color: rgba(0,0,0,0.08); }
    .canvas-loading-overlay { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(10,10,10,0.38); backdrop-filter: blur(4px); pointer-events: none; }
    body.light-mode .canvas-loading-overlay { background: rgba(255,255,255,0.5); }
    .canvas-load-error { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 5; padding: 10px 14px; border-radius: 8px; background: rgba(239,68,68,0.14); border: 1px solid rgba(239,68,68,0.35); color: #fca5a5; font-size: 12px; }
    .canvas-version-panel { position: absolute; top: 16px; right: 16px; bottom: 16px; width: min(360px, calc(100% - 32px)); z-index: 6; flex-direction: column; background: rgba(10,14,22,0.86); border: 1px solid rgba(148,163,184,0.22); border-radius: 16px; box-shadow: 0 24px 70px rgba(0,0,0,0.32); backdrop-filter: blur(18px); overflow: hidden; }
    body.light-mode .canvas-version-panel { background: rgba(255,255,255,0.9); border-color: rgba(15,23,42,0.12); }
    .canvas-version-head { display: flex; justify-content: space-between; gap: 12px; padding: 16px; border-bottom: 1px solid var(--border-subtle); }
    .canvas-version-title { color: var(--text-title); font-size: 15px; font-weight: 700; }
    .canvas-version-subtitle { margin-top: 4px; color: var(--text-muted); font-size: 11px; line-height: 1.4; }
    .canvas-version-close { width: 28px; height: 28px; border: 1px solid var(--border-subtle); border-radius: 8px; background: var(--bg-element); color: var(--text-muted); cursor: pointer; }
    .canvas-version-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
    .canvas-version-empty { color: var(--text-muted); font-size: 12px; line-height: 1.5; padding: 18px; text-align: center; }
    .canvas-version-item { display: flex; gap: 10px; padding: 10px; border: 1px solid var(--border-subtle); border-radius: 12px; background: rgba(255,255,255,0.04); cursor: pointer; transition: all 0.18s ease; }
    .canvas-version-item:hover { border-color: rgba(56,189,248,0.45); transform: translateY(-1px); }
    .canvas-version-item img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--bg-element); flex-shrink: 0; }
    .canvas-version-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
    .canvas-version-row { display: flex; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 10px; }
    .canvas-version-badge { color: #7dd3fc; background: rgba(56,189,248,0.12); border: 1px solid rgba(56,189,248,0.22); border-radius: 999px; padding: 2px 7px; white-space: nowrap; }
    .canvas-version-node { color: var(--text-title); font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .canvas-version-parent, .canvas-version-prompt { color: var(--text-muted); font-size: 11px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .canvas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; padding: 20px; overflow-y: auto; flex: 1; align-content: start; }
    .canvas-card { background: var(--bg-element); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; min-height: 180px; transition: all 0.3s var(--ease-out); }
    .canvas-card:hover { border-color: var(--border-strong); box-shadow: 0 8px 30px -8px rgba(0,0,0,0.4); transform: translateY(-2px); }
    .canvas-card img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
    .canvas-card-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 50%); opacity: 0; transition: opacity 0.2s; display: flex; align-items: flex-end; padding: 12px; gap: 8px; flex-wrap: wrap; }
    .canvas-card:hover .canvas-card-overlay { opacity: 1; }
    .canvas-action-btn { background: rgba(255,255,255,0.15); backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,0.2); color: #fff; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
    .canvas-action-btn:hover { background: rgba(255,255,255,0.9); color: #000; }
    .gallery-publish-btn { width: auto; min-width: 86px; padding: 0 10px; gap: 5px; font-size: 12px; font-weight: 700; }
    .regenerate-btn { width: auto; min-width: 68px; padding: 0 10px; gap: 5px; font-size: 12px; font-weight: 700; background: rgba(59,130,246,0.72); }
    .gallery-publish-btn.is-publishing { opacity: 0.7; cursor: wait; }
    .gallery-publish-btn.is-published { background: rgba(34,197,94,0.82); border-color: rgba(134,239,172,0.42); color: #fff; cursor: default; }
    .gallery-publish-btn:disabled { pointer-events: none; }
    .canvas-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: var(--bg-element); }
    .canvas-loading-spinner { width: 32px; height: 32px; border: 3px solid var(--border-subtle); border-top-color: var(--brand-accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
    .canvas-loading-text { font-size: 12px; color: var(--text-muted); }
    .mobile-output-grid { display: none; }
.mobile-output-empty { min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; color: var(--text-muted); padding: 28px; }

.lightbox-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 99999; display: none; align-items: center; justify-content: center; cursor: zoom-out; padding: 72px 18px 88px; }
.lightbox-img { max-width: 92vw; max-height: calc(100vh - 176px); border-radius: 12px; object-fit: contain; cursor: default; box-shadow: 0 20px 60px rgba(0,0,0,0.8); }
.lightbox-close { position: fixed; top: 20px; right: 20px; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18); color: #fff; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; }
.lightbox-nav { position: fixed; top: 50%; transform: translateY(-50%); width: 44px; height: 58px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.12); color: #fff; font-size: 36px; cursor: pointer; align-items: center; justify-content: center; }
.lightbox-prev { left: 22px; }
.lightbox-next { right: 22px; }
.lightbox-actions { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 28px); }
.lightbox-actions button { min-height: 36px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.18); background: rgba(15,23,42,0.78); color: #fff; padding: 0 13px; font-size: 12px; font-weight: 800; cursor: pointer; backdrop-filter: blur(14px); }
.lightbox-actions button:hover, .lightbox-nav:hover, .lightbox-close:hover { background: rgba(255,255,255,0.22); }
.low-credit-notice { border-color: rgba(251,191,36,0.42); }
.low-credit-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.low-credit-actions button { min-height: 30px; border-radius: 999px; border: 1px solid rgba(251,191,36,0.32); background: rgba(251,191,36,0.14); color: #fde68a; padding: 0 11px; font-size: 11px; font-weight: 800; cursor: pointer; }
body.light-mode .low-credit-actions button { color: #92400e; background: rgba(251,191,36,0.18); border-color: rgba(217,119,6,0.28); }

.prompt-template-card { gap: 12px; }
.prompt-draft-bar { margin-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid rgba(56,189,248,0.22); border-radius: 10px; background: rgba(56,189,248,0.08); color: var(--text-muted); font-size: 12px; }
.prompt-draft-bar button { border: 1px solid rgba(56,189,248,0.32); background: rgba(56,189,248,0.12); color: #7dd3fc; border-radius: 999px; padding: 4px 9px; font-size: 11px; cursor: pointer; white-space: nowrap; }
.prompt-history-card { gap: 12px; }
.prompt-history-list { display: grid; gap: 8px; max-height: 230px; overflow-y: auto; }
.prompt-history-item { border: 1px solid var(--border-subtle); background: var(--bg-element); border-radius: 12px; padding: 10px; display: grid; gap: 9px; }
.prompt-history-main { display: grid; gap: 4px; min-width: 0; }
.prompt-history-main strong { color: var(--text-title); font-size: 12px; line-height: 1.45; word-break: break-word; }
.prompt-history-main span { color: var(--text-body); font-size: 11px; line-height: 1.4; word-break: break-word; }
.prompt-history-main em { color: var(--text-muted); font-size: 10px; font-style: normal; }
.prompt-history-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.prompt-history-actions button { border: 1px solid var(--border-subtle); background: rgba(255,255,255,0.06); color: var(--text-body); border-radius: 999px; padding: 5px 9px; font-size: 11px; cursor: pointer; }
.prompt-history-actions button:hover { border-color: var(--border-strong); color: var(--text-title); }
.prompt-history-empty { color: var(--text-muted); font-size: 12px; text-align: center; padding: 18px 8px; border: 1px dashed var(--border-subtle); border-radius: 12px; }
.prompt-template-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.prompt-template-tab { border: 1px solid var(--border-subtle); background: var(--bg-element); color: var(--text-body); border-radius: 999px; padding: 6px 11px; font-size: 12px; cursor: pointer; white-space: nowrap; transition: all 0.2s var(--ease-out); }
.prompt-template-tab.active, .prompt-template-tab:hover { color: var(--text-title); border-color: var(--border-strong); background: var(--bg-element-hover); }
.prompt-template-list { display: grid; gap: 8px; max-height: 240px; overflow-y: auto; }
.prompt-template-item { border: 1px solid var(--border-subtle); background: var(--bg-element); color: var(--text-title); border-radius: 12px; padding: 11px 12px; text-align: left; cursor: pointer; display: grid; gap: 5px; transition: all 0.2s var(--ease-out); }
.prompt-template-item:hover { border-color: var(--border-strong); background: var(--bg-element-hover); transform: translateY(-1px); }
.prompt-template-item strong { font-size: 13px; line-height: 1.35; }
.prompt-template-item span { color: var(--text-body); font-size: 12px; line-height: 1.45; }
.prompt-template-item em { color: var(--text-muted); font-size: 11px; font-style: normal; }
.prompt-template-empty { color: var(--text-muted); font-size: 13px; text-align: center; padding: 24px 10px; grid-column: 1 / -1; }
.square-favorite-btn.is-active { color: #f472b6; border-color: rgba(244,114,182,0.35); background: rgba(244,114,182,0.16); }
.favorite-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.favorite-card { overflow: hidden; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg-element); }
.favorite-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: var(--bg-surface); }
.favorite-card-body { padding: 12px; display: grid; gap: 10px; }
.favorite-card-prompt { color: var(--text-body); font-size: 12px; line-height: 1.5; min-height: 36px; }
.favorite-card-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.favorite-card-actions .square-action-btn { position: static; transform: none; opacity: 1; font-size: 11px; padding: 7px 9px; }

.work-share-box { width: min(520px, 92vw); display: grid; gap: 14px; }
.work-share-subtitle { margin-top: 5px; color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.work-share-preview { display: grid; grid-template-columns: 78px minmax(0, 1fr); align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg-element); }
.work-share-preview img { width: 78px; height: 78px; object-fit: cover; border-radius: 12px; background: var(--bg-surface); }
.work-share-preview strong { display: block; color: var(--text-title); font-size: 14px; line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-share-preview span { display: block; margin-top: 4px; color: var(--text-muted); font-size: 12px; }
.work-share-safe-note { padding: 10px 12px; border: 1px solid rgba(96,165,250,0.24); border-radius: 12px; background: rgba(59,130,246,0.08); color: #93c5fd; font-size: 12px; line-height: 1.55; }
.work-share-toggle { display: flex; align-items: center; gap: 9px; color: var(--text-body); font-size: 13px; cursor: pointer; }
.work-share-toggle input { width: 16px; height: 16px; accent-color: var(--brand-accent); }
.work-share-link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.work-share-link-row input { min-width: 0; height: 40px; border: 1px solid var(--border-subtle); border-radius: 10px; background: var(--bg-element); color: var(--text-title); padding: 0 12px; outline: none; }
.work-share-link-row button,
.work-share-actions button { min-height: 40px; border: 1px solid var(--border-subtle); border-radius: 10px; background: var(--bg-element); color: var(--text-title); padding: 0 13px; font-size: 12px; font-weight: 800; cursor: pointer; }
.work-share-link-row button:hover,
.work-share-actions button:hover { border-color: var(--border-strong); background: var(--bg-element-hover); }
.work-share-status { min-height: 18px; color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.work-share-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.work-share-actions .work-share-primary { background: var(--text-title); color: var(--bg-body); border-color: var(--text-title); }
.work-share-actions .work-share-primary:hover { background: #2563eb; color: #ffffff; border-color: #2563eb; }
body.light-mode .work-share-actions .work-share-primary { background: #0f172a; color: #ffffff; border-color: #0f172a; }
body.light-mode .work-share-actions .work-share-primary:hover { background: #2563eb; color: #ffffff; border-color: #2563eb; }
.work-share-actions .danger { color: #fca5a5; border-color: rgba(248,113,113,0.28); }
.work-share-actions button:disabled { opacity: .58; cursor: wait; }
@media (max-width: 560px) {
    .work-share-link-row,
    .work-share-actions { grid-template-columns: 1fr; }
}

.generation-progress { margin-top: 14px; padding: 13px; border: 1px solid rgba(59,130,246,0.24); border-radius: 14px; background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(168,85,247,0.08)); gap: 9px; }
.generation-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.generation-progress-head strong { color: var(--text-title); font-size: 13px; }
.generation-progress-head span { color: #93c5fd; font-weight: 800; }
.generation-progress-bar { height: 7px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,0.1); }
.generation-progress-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #60a5fa, #a78bfa, #f472b6); transition: width 0.45s var(--ease-out); }
.generation-progress-step { color: var(--text-body); font-size: 12px; line-height: 1.5; }
.prompt-optimize-box { margin-top: 10px; display: grid; gap: 8px; }
.prompt-optimize-main, .prompt-optimize-actions button { border: 1px solid rgba(96,165,250,0.34); background: rgba(15,23,42,0.72); color: #f8fafc; border-radius: 999px; min-height: 34px; padding: 0 12px; font-size: 12px; font-weight: 800; cursor: pointer; transition: all 0.2s var(--ease-out); box-shadow: 0 8px 22px rgba(0,0,0,0.12); }
.prompt-optimize-main { width: fit-content; display: inline-flex; align-items: center; justify-content: center; gap: 7px; color: #ffffff; border-color: rgba(96,165,250,0.56); background: linear-gradient(135deg, rgba(37,99,235,0.96), rgba(124,58,237,0.92)); }
.prompt-optimize-main svg { width: 15px; height: 15px; stroke: currentColor; }
.prompt-optimize-main:hover, .prompt-optimize-actions button:hover { color: #ffffff; border-color: rgba(147,197,253,0.72); background: rgba(30,41,59,0.92); transform: translateY(-1px); }
.prompt-optimize-main.is-loading { opacity: 0.82; cursor: wait; }
.prompt-optimize-main:disabled { cursor: not-allowed; opacity: 0.62; transform: none; }
.prompt-optimize-result { border: 1px solid rgba(96,165,250,0.34); border-radius: 12px; background: rgba(2,6,23,0.82); padding: 11px; display: grid; gap: 10px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.06); }
body.light-mode .prompt-optimize-main, body.light-mode .prompt-optimize-actions button { color: #0f172a; border-color: rgba(37,99,235,0.28); background: #ffffff; box-shadow: 0 8px 22px rgba(15,23,42,0.08); }
body.light-mode .prompt-optimize-main { color: #ffffff; border-color: rgba(37,99,235,0.48); background: linear-gradient(135deg, #2563eb, #7c3aed); }
body.light-mode .prompt-optimize-main:hover, body.light-mode .prompt-optimize-actions button:hover { color: #0f172a; border-color: rgba(37,99,235,0.42); background: #eff6ff; }
body.light-mode .prompt-optimize-main:hover { color: #ffffff; background: linear-gradient(135deg, #1d4ed8, #6d28d9); }
body.light-mode .prompt-optimize-result { background: #ffffff; border-color: rgba(37,99,235,0.22); box-shadow: 0 10px 30px rgba(15,23,42,0.08); }
.prompt-optimize-preview { color: #f8fafc; font-size: 12px; line-height: 1.7; max-height: 160px; overflow-y: auto; word-break: break-word; }
body.light-mode .prompt-optimize-preview { color: #0f172a; }
.prompt-optimize-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.prompt-optimize-actions button:first-child { color: #ffffff; border-color: rgba(96,165,250,0.52); background: rgba(37,99,235,0.92); }
body.light-mode .prompt-optimize-actions button:first-child { color: #ffffff; border-color: rgba(37,99,235,0.42); background: #2563eb; }
.prompt-optimize-error { color: #fecaca; font-size: 12px; line-height: 1.5; }
body.light-mode .prompt-optimize-error { color: #b91c1c; }
.site-notifications { position: fixed; right: 22px; top: 86px; z-index: 10020; display: grid; gap: 10px; width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.site-notification { transform: translateY(-8px); opacity: 0; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--border-subtle); background: rgba(10,10,10,0.9); backdrop-filter: blur(16px); box-shadow: 0 16px 50px rgba(0,0,0,0.32); display: grid; gap: 5px; transition: all 0.25s var(--ease-out); pointer-events: auto; }
body.light-mode .site-notification { background: rgba(255,255,255,0.92); box-shadow: 0 16px 44px rgba(15,23,42,0.14); }
.site-notification.show { transform: translateY(0); opacity: 1; }
.site-notification strong { color: var(--text-title); font-size: 13px; }
.site-notification span { color: var(--text-body); font-size: 12px; line-height: 1.45; }
.site-notification-action { justify-self: start; margin-top: 3px; min-height: 28px; border: 1px solid rgba(96,165,250,0.34); border-radius: 999px; background: rgba(59,130,246,0.14); color: #dbeafe; padding: 0 10px; font-size: 11px; font-weight: 800; cursor: pointer; }
.site-notification-action:disabled { opacity: 0.75; cursor: default; }
.site-notification.success { border-color: rgba(34,197,94,0.35); }
.site-notification.warning { border-color: rgba(251,191,36,0.38); }
.site-notification.error { border-color: rgba(248,113,113,0.38); }
.history-work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; align-items: start; }
.history-work-card { overflow: hidden; border: 1px solid var(--border-subtle); border-radius: 16px; background: var(--bg-element); box-shadow: 0 12px 34px rgba(0,0,0,0.16); }
.history-work-image { width: 100%; aspect-ratio: 1 / 1; border: 0; background: var(--bg-surface); cursor: zoom-in; display: block; overflow: hidden; }
.history-work-image img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s var(--ease-out); }
.history-work-card:hover .history-work-image img { transform: scale(1.035); }
.history-work-body { padding: 12px; display: grid; gap: 10px; }
.history-work-prompt { min-height: 38px; color: var(--text-body); font-size: 12px; line-height: 1.55; word-break: break-word; }
.history-work-meta { display: flex; flex-wrap: wrap; gap: 7px; color: var(--text-muted); font-size: 11px; }
.history-work-meta span { border: 1px solid var(--border-subtle); border-radius: 999px; padding: 3px 8px; background: rgba(255,255,255,0.04); }
.history-work-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.history-work-actions button { min-height: 32px; border: 1px solid var(--border-subtle); border-radius: 9px; background: rgba(255,255,255,0.06); color: var(--text-body); font-size: 11px; font-weight: 700; cursor: pointer; transition: all 0.2s var(--ease-out); }
.history-work-actions button:hover { color: var(--text-title); border-color: var(--border-strong); background: var(--bg-element-hover); transform: translateY(-1px); }
.history-work-actions button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.history-work-actions button.danger { color: #fca5a5; border-color: rgba(248,113,113,0.24); }
.history-work-actions button.danger:hover { background: rgba(248,113,113,0.12); color: #fecaca; }

/* --- 移动端底部导航 --- */
.mobile-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; min-height: 60px; background: rgba(0,0,0,0.8); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 1px solid var(--border-subtle); z-index: 100; justify-content: flex-start; align-items: center; gap: 4px; padding: 0 10px env(safe-area-inset-bottom); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.mobile-nav::-webkit-scrollbar { display: none; }
body.light-mode .mobile-nav { background: rgba(255,255,255,0.8); }
.m-nav-item { flex: 0 0 56px; min-width: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-muted); font-size: 10px; cursor: pointer; font-weight: 500; }
@media (max-width: 768px) {
    .square-card-stats {
        top: 8px;
        right: 0;
        gap: 2px;
        padding: 2px;
        border-radius: 999px 0 0 999px;
    }
    .square-card-stats .square-action-btn,
    .square-card-stats .square-reuse-badge {
        width: 42px;
        min-width: 42px;
        min-height: 20px;
        padding: 0;
        justify-content: center;
        font-size: 9px;
    }
    .square-card-stats .square-action-btn { gap: 2px; }
    .square-card-stats .square-action-btn svg { width: 10px; height: 10px; }
    .square-favorite-btn span { min-width: auto; text-align: center; }
}
.m-nav-item svg { width: 20px; height: 20px; stroke: currentColor; }
.m-nav-item.active { color: var(--text-title); }

/* --- 响应式 --- */
@media (max-width: 768px) {
    html, body { min-height: 100%; height: auto; overflow-x: hidden; overflow-y: auto; }
    body { display: block; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
    header { margin: 12px 16px 0 16px; height: 56px; padding: 0 16px; }
    .nav-tabs { display: none; }
    .mobile-nav { display: flex; }
    #main-container { min-height: auto; height: auto; padding: 14px 14px 18px 14px; overflow: visible; }
    .page-content { height: auto; min-height: auto; overflow: visible; }
    .page-content.active-page { gap: 14px; }
    .auth-code-row { flex-direction: column; }
    .auth-code-btn { width: 100%; min-height: 40px; }

    #home-page.active-page { overflow: visible; }
    .landing-shell { grid-template-columns: 1fr; grid-template-rows: auto; grid-template-areas: "hero" "showcase" "map"; padding: 20px; border-radius: 22px; gap: 18px; height: auto; min-height: auto; overflow: hidden; }
    .landing-hero h1 { font-size: clamp(32px, 10.5vw, 48px); line-height: 0.98; letter-spacing: -0.06em; }
    .landing-hero p { font-size: 14px; line-height: 1.7; }
    .landing-tags { gap: 7px; margin-top: 14px; }
    .landing-tags span { font-size: 11px; padding: 6px 9px; }
    .landing-actions { flex-direction: column; margin-top: 18px; }
    .landing-primary, .landing-secondary { width: 100%; min-height: 44px; }
    .daily-inspiration-card { flex-direction: column; align-items: stretch; padding: 16px; border-radius: 18px; }
    .daily-inspiration-card button { width: 100%; min-height: 40px; }
    .landing-metrics { grid-template-columns: 1fr; margin-top: 18px; gap: 8px; }
    .landing-metrics div { grid-template-columns: auto 1fr; align-items: center; }
    .landing-showcase { order: 2; }
    .landing-map { order: 3; grid-template-columns: 1fr; }
    .landing-preview-card { border-radius: 22px; padding: 13px; }
    .landing-preview-art { min-height: 210px; border-radius: 18px; }
    .landing-preview-art .mascot-stage { min-height: 170px; }
    .landing-mini-panel { border-radius: 18px; }
    .landing-card, .landing-card-main { min-height: 116px; grid-column: auto; grid-row: auto; border-radius: 18px; }
    .landing-card-main { min-height: 126px; }
    .mascot-stage { min-height: 136px; }
    .mascot-bubble { right: 0; font-size: 11px; }
    .ai-mascot { width: 92px; height: 92px; border-radius: 28px 28px 34px 34px; }

    #create-page.active-page { flex-direction: column !important; overflow: visible; gap: 14px; }
    .sidebar { width: 100%; overflow: visible; padding-right: 0; gap: 12px; }
    .bento-card { padding: 14px; border-radius: 14px; }
    .workspace-canvas { min-height: auto; overflow: visible; }
    .workspace-canvas-header { flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px; }
    .canvas-header-controls { width: 100%; }
    .canvas-mode-toggle { display: none; }
    #workspace-actions { display: none !important; }
    #canvas-meta { font-size: 12px; }
    #infinite-canvas-shell { display: none !important; }
    .mobile-output-grid { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 12px; min-height: 280px; }
    .mobile-output-grid .canvas-card { min-height: 260px; aspect-ratio: 1 / 1; }
    .mobile-output-grid .canvas-card-overlay { opacity: 1; }
    .lightbox-overlay { padding: 62px 10px 112px; }
    .lightbox-img { max-width: 96vw; max-height: calc(100vh - 190px); }
    .lightbox-nav { width: 38px; height: 50px; font-size: 30px; }
    .lightbox-prev { left: 10px; }
    .lightbox-next { right: 10px; }
    .lightbox-actions { bottom: calc(78px + env(safe-area-inset-bottom)); gap: 6px; }
    .lightbox-actions button { min-height: 34px; padding: 0 10px; font-size: 11px; }
    .regenerate-btn { min-width: 58px; padding: 0 8px; }
    .workspace { padding: 14px; overflow: visible; min-height: auto; margin-bottom: 16px; }
    .generation-progress { margin-top: 12px; padding: 12px; border-radius: 13px; }
    .prompt-optimize-main { width: 100%; min-height: 38px; }
    .site-notifications { top: 76px; right: 12px; left: 12px; width: auto; }
    .history-work-grid { grid-template-columns: 1fr; gap: 12px; }
    .history-work-card { border-radius: 15px; }
    .history-work-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
    .history-work-actions button { min-height: 34px; font-size: 10px; }
    .image-grid { grid-template-columns: 1fr; gap: 12px; overflow-y: visible; }
    .img-card { min-height: 280px; }
    .hover-actions { opacity: 1; transform: none; bottom: 8px; right: 8px; }

    .square-toolbar {
        flex-direction: column;
        padding: 12px;
        gap: 10px;
        align-items: stretch;
        border-radius: 18px;
    }
    #square-page { overflow: visible; }
    #square-page::before { height: 210px; inset: -8% -30% auto; }
    .search-area { width: 100%; min-width: 0; max-width: 100%; }
    .search-input { min-height: 42px; font-size: 13px; }
    .filter-area { justify-content: stretch; overflow-x: visible; margin-left: 0; }
    .filter-area .btn { width: auto; min-width: 64px; min-height: 40px !important; }
    .square-sort-tabs { width: 100%; justify-content: center; }
    .square-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: 236px;
        gap: 10px;
        padding: 0 1px 18px;
        overflow: visible;
    }
    .square-card {
        border-radius: 18px;
        box-shadow: 0 12px 28px rgba(0,0,0,0.24);
    }
    .square-card:hover { transform: none; }
    .square-card img { transform: none; }
    .square-card:hover img { transform: none; filter: none; }
    .card-mask {
        padding: 10px;
        background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.48) 50%, rgba(0,0,0,0.08) 78%, transparent 100%);
    }
    .card-prompt-info {
        font-size: 10px;
        line-height: 1.35;
        -webkit-line-clamp: 1;
        margin-bottom: 6px;
    }
    .square-card-actions {
        grid-template-columns: 1fr 1fr;
        gap: 5px;
        max-height: 32px;
        margin-bottom: 8px;
        opacity: 1;
        pointer-events: auto;
        transform: none;
    }
    .square-action-btn {
        min-height: 28px;
        padding: 0 6px;
        font-size: 9px;
        gap: 3px;
    }
    .square-favorite-btn {
        top: 8px;
        right: 8px;
        min-width: 48px;
        min-height: 28px;
        padding: 0 8px;
        font-size: 10px;
    }
    .square-action-btn svg { width: 11px; height: 11px; }
    .square-action-primary { min-height: 28px; }
    .card-meta {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        align-items: stretch;
        padding-top: 7px;
        gap: 4px;
        min-height: 42px;
        position: relative;
        z-index: 4;
    }
    .square-author-row {
        grid-template-columns: 18px minmax(0, 1fr);
        gap: 5px;
        font-size: 10px;
    }
    .square-info-row {
        grid-template-columns: minmax(0, 1fr) max-content;
        gap: 5px;
    }
    .author-level-badge { max-width: 92px; padding: 3px 6px; font-size: 9px; }
    .author-avatar { width: 18px; height: 18px; }
    .square-size-badge {
        justify-self: end;
        max-width: 82px;
        padding: 3px 6px;
        font-size: 9px !important;
    }
    .chat-shell { overflow: visible; }
    .chat-layout { grid-template-columns: 1fr; height: auto; }
    .chat-sidebar { border-right: none; border-bottom: 1px solid var(--border-subtle); padding: 16px; }
    .chat-conversations { max-height: 180px; overflow-y: auto; }
    .chat-panel { padding: 16px; height: auto; min-height: 520px; }
    .chat-hero { flex-direction: column; }
    .chat-composer { grid-template-columns: 1fr; }
    .chat-composer .btn-primary { width: 100%; }
    .chat-bubble { max-width: 92%; }

    .profile-grid-top, .profile-grid-bottom { grid-template-columns: 1fr; gap: 16px; }
    .user-info-card { flex-direction: column; text-align: center; padding: 20px; gap: 16px; }
    .user-tags { justify-content: center; flex-wrap: wrap; }
}

.task-center-floating {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 10010;
    min-height: 42px;
    padding: 0 9px 0 15px;
    border-radius: 999px;
    border: 1px solid rgba(96,165,250,0.3);
    background: linear-gradient(135deg, rgba(15,23,42,0.88), rgba(30,41,59,0.78));
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    backdrop-filter: blur(18px);
    box-shadow: 0 18px 48px rgba(37,99,235,0.18), 0 14px 38px rgba(0,0,0,0.22);
    font-size: 12px;
    font-weight: 850;
    transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out), border-color 0.18s var(--ease-out);
}
.task-center-floating:hover { transform: translateY(-2px); border-color: rgba(147,197,253,0.48); box-shadow: 0 20px 52px rgba(37,99,235,0.24), 0 16px 42px rgba(0,0,0,0.26); }
body.light-mode .task-center-floating { background: rgba(255,255,255,0.94); color: #0f172a; border-color: rgba(37,99,235,0.22); box-shadow: 0 16px 42px rgba(37,99,235,0.12), 0 10px 28px rgba(15,23,42,0.08); }
.task-center-floating strong {
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}
.task-center-panel {
    position: fixed;
    right: 22px;
    bottom: 132px;
    z-index: 10011;
    width: min(460px, calc(100vw - 32px));
    max-height: min(680px, calc(100vh - 164px));
    border: 1px solid var(--border-subtle);
    border-radius: 22px;
    background: rgba(10,10,10,0.94);
    color: var(--text-title);
    box-shadow: 0 24px 80px rgba(0,0,0,0.45);
    backdrop-filter: blur(20px);
    display: none;
    overflow: hidden;
}
body.light-mode .task-center-panel { background: rgba(255,255,255,0.96); box-shadow: 0 22px 70px rgba(15,23,42,0.18); }
.task-center-panel.show { display: flex; flex-direction: column; }
.task-center-head {
    padding: 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border-subtle);
}
.task-center-head strong { display: block; font-size: 15px; margin-bottom: 4px; }
.task-center-head span { color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.task-center-head button {
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    background: var(--bg-element);
    color: var(--text-body);
    min-height: 30px;
    padding: 0 11px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}
.task-center-head button:hover { color: var(--text-title); border-color: var(--border-strong); background: var(--bg-element-hover); }
.task-center-list { padding: 12px; display: grid; gap: 10px; overflow-y: auto; }
.task-center-empty { padding: 34px 12px; text-align: center; color: var(--text-muted); font-size: 13px; border: 1px dashed var(--border-subtle); border-radius: 16px; }
.task-card {
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    background: rgba(255,255,255,0.045);
    padding: 12px;
    display: grid;
    gap: 10px;
}
body.light-mode .task-card { background: rgba(15,23,42,0.035); }
.task-card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.task-card-title strong { font-size: 13px; }
.task-card-title span { color: var(--text-muted); font-size: 11px; }
.task-progress { height: 7px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
body.light-mode .task-progress { background: rgba(15,23,42,0.08); }
.task-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #60a5fa, #a78bfa); transition: width 0.3s var(--ease-out); }
.task-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.task-meta span { padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border-subtle); color: var(--text-body); font-size: 11px; background: var(--bg-element); }
.task-prompt { color: var(--text-body); font-size: 12px; line-height: 1.55; word-break: break-word; }
.task-error { color: #fecaca; background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.2); border-radius: 11px; padding: 8px 10px; font-size: 11px; line-height: 1.5; word-break: break-word; }
body.light-mode .task-error { color: #b91c1c; background: rgba(239,68,68,0.08); }
.task-images { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.task-images img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--border-subtle); background: var(--bg-surface); cursor: zoom-in; }
.task-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.task-actions button { min-height: 30px; border-radius: 999px; border: 1px solid var(--border-subtle); background: var(--bg-element); color: var(--text-body); padding: 0 10px; font-size: 11px; font-weight: 800; cursor: pointer; }
.task-actions button:hover { color: var(--text-title); border-color: var(--border-strong); background: var(--bg-element-hover); }
.task-running, .task-queued { border-color: rgba(96,165,250,0.26); }
.task-success { border-color: rgba(34,197,94,0.24); }
.task-partial { border-color: rgba(251,191,36,0.28); }
.task-failed, .task-cancelled { border-color: rgba(248,113,113,0.22); }
.reverse-task-card { border-color: rgba(96,165,250,0.28); background: linear-gradient(180deg, rgba(59,130,246,0.08), rgba(255,255,255,0.035)); }
.reverse-task-card.task-running { border-color: rgba(96,165,250,0.42); }
.reverse-task-card.task-failed { border-color: rgba(248,113,113,0.28); }
body.light-mode .reverse-task-card { background: linear-gradient(180deg, rgba(37,99,235,0.07), rgba(255,255,255,0.82)); }
.reverse-task-top { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; align-items: start; }
.reverse-task-thumb { width: 74px; aspect-ratio: 1 / 1; border: 1px solid var(--border-subtle); border-radius: 13px; padding: 0; overflow: hidden; background: var(--bg-element); cursor: zoom-in; }
.reverse-task-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reverse-task-prompt { color: var(--text-title); font-weight: 700; }
.reverse-task-negative { color: var(--text-muted); }
.reverse-task-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.reverse-task-tags span { padding: 4px 8px; border-radius: 999px; background: rgba(59,130,246,0.12); color: #93c5fd; font-size: 11px; font-weight: 800; }
body.light-mode .reverse-task-tags span { color: #2563eb; }
.reverse-task-actions button:first-child { background: #0f172a; color: #fff; border-color: #0f172a; }
@media (max-width: 768px) {
    .contact-float { right: 14px; bottom: calc(126px + env(safe-area-inset-bottom)); min-height: 40px; padding: 0 14px; }
    .task-center-floating { right: 14px; bottom: calc(76px + env(safe-area-inset-bottom)); min-height: 40px; z-index: 10013; }
    .task-center-panel {
        inset: 72px 12px calc(132px + env(safe-area-inset-bottom)) 12px;
        width: auto;
        max-height: none;
        border-radius: 20px;
        overflow: hidden;
    }
    .task-center-panel.show { display: flex; flex-direction: column; }
    .task-center-head {
        flex: 0 0 auto;
        position: sticky;
        top: 0;
        z-index: 2;
        padding: 14px;
        background: inherit;
        backdrop-filter: blur(20px);
    }
    .task-center-head button {
        min-width: 54px;
        min-height: 34px;
        flex: 0 0 auto;
    }
    .task-center-list {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px 12px calc(18px + env(safe-area-inset-bottom));
    }
    .task-images { grid-template-columns: repeat(3, 1fr); }
    .task-actions button { flex: 1 1 auto; }
}

/* --- 极简首页 --- */
#home-page.active-page {
    justify-content: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 10px;
    padding-bottom: 10px;
}
#home-page .landing-shell {
    position: relative;
    width: min(1180px, 100%);
    min-height: auto;
    height: auto;
    margin: 0 auto;
    padding: clamp(24px, 4vw, 52px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: clamp(20px, 3vw, 34px);
    border-radius: 34px;
    border: 1px solid rgba(148,163,184,0.14);
    overflow: hidden;
    background:
        radial-gradient(circle at 18% 12%, rgba(59,130,246,0.18), transparent 28%),
        radial-gradient(circle at 88% 18%, rgba(168,85,247,0.12), transparent 26%),
        linear-gradient(145deg, rgba(255,255,255,0.1), rgba(255,255,255,0.035));
    box-shadow: 0 24px 76px rgba(0,0,0,0.16), inset 0 1px 0 rgba(255,255,255,0.08);
}
body.light-mode #home-page .landing-shell {
    background:
        radial-gradient(circle at 18% 12%, rgba(37,99,235,0.12), transparent 30%),
        radial-gradient(circle at 88% 18%, rgba(124,58,237,0.08), transparent 28%),
        linear-gradient(145deg, rgba(255,255,255,0.98), rgba(248,250,252,0.9));
    box-shadow: 0 22px 64px rgba(15,23,42,0.08), inset 0 1px 0 rgba(255,255,255,0.95);
}
#home-page .landing-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255,255,255,0.08), transparent 42%);
    mask-image: none;
}
body.light-mode #home-page .landing-shell::before { background: linear-gradient(180deg, rgba(255,255,255,0.72), transparent 46%); }
#home-page .landing-orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(16px);
    opacity: 0.62;
    pointer-events: none;
    animation: none;
}
#home-page .landing-orb-a {
    width: 260px;
    height: 260px;
    left: -92px;
    top: -90px;
    background: rgba(59,130,246,0.24);
}
#home-page .landing-orb-b {
    width: 220px;
    height: 220px;
    right: -72px;
    bottom: -82px;
    background: rgba(34,197,94,0.15);
}
#home-page .landing-hero,
#home-page .landing-map,
#home-page .landing-steps {
    position: relative;
    z-index: 1;
}
#home-page .landing-hero {
    max-width: 760px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
#home-page .landing-kicker {
    margin: 0 0 16px;
    padding: 8px 13px;
    border-radius: 999px;
    border: 1px solid rgba(125,211,252,0.28);
    background: rgba(59,130,246,0.12);
    color: #93c5fd;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: none;
    box-shadow: none;
}
body.light-mode #home-page .landing-kicker {
    color: #1d4ed8;
    background: rgba(37,99,235,0.08);
    border-color: rgba(37,99,235,0.16);
}
#home-page .landing-hero h1 {
    max-width: 820px;
    margin: 0;
    color: var(--text-title);
    font-size: clamp(42px, 6vw, 78px);
    line-height: 1.04;
    letter-spacing: -0.06em;
    text-wrap: balance;
}
#home-page .landing-hero p {
    max-width: 620px;
    margin: 20px auto 0;
    color: var(--text-body);
    font-size: clamp(15px, 1.35vw, 18px);
    line-height: 1.8;
}
#home-page .landing-actions {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}
#home-page .landing-primary,
#home-page .landing-secondary {
    min-height: 50px;
    padding: 0 22px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.18s var(--ease-out), border-color 0.18s var(--ease-out), background 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out);
}
#home-page .landing-primary {
    min-width: 150px;
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    box-shadow: 0 18px 44px rgba(37,99,235,0.26);
}
#home-page .landing-primary svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}
#home-page .landing-secondary {
    min-width: 126px;
    color: var(--text-title);
    background: rgba(255,255,255,0.07);
}
body.light-mode #home-page .landing-secondary { background: rgba(255,255,255,0.84); }
#home-page .landing-primary:hover,
#home-page .landing-secondary:hover {
    transform: translateY(-2px);
    border-color: rgba(96,165,250,0.36);
    box-shadow: 0 20px 48px rgba(37,99,235,0.18);
}
#home-page .landing-map {
    width: min(900px, 100%);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    align-self: center;
}
#home-page .landing-card,
#home-page .landing-card-main {
    min-height: 156px;
    padding: 20px;
    border-radius: 24px;
    border: 1px solid rgba(148,163,184,0.14);
    background: rgba(255,255,255,0.06);
    color: var(--text-title);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 12px;
    text-align: left;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
    transition: transform 0.2s var(--ease-out), border-color 0.2s var(--ease-out), background 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}
body.light-mode #home-page .landing-card,
body.light-mode #home-page .landing-card-main {
    background: rgba(255,255,255,0.82);
    border-color: rgba(15,23,42,0.08);
    box-shadow: 0 14px 36px rgba(15,23,42,0.05), inset 0 1px 0 rgba(255,255,255,0.92);
}
#home-page .landing-card-main {
    background: linear-gradient(145deg, rgba(37,99,235,0.2), rgba(124,58,237,0.1)), rgba(255,255,255,0.06);
}
#home-page .landing-card:hover,
#home-page .landing-card-main:hover {
    transform: translateY(-4px);
    border-color: rgba(96,165,250,0.34);
    background: rgba(255,255,255,0.1);
    box-shadow: 0 20px 48px rgba(0,0,0,0.16);
}
body.light-mode #home-page .landing-card:hover,
body.light-mode #home-page .landing-card-main:hover {
    background: rgba(255,255,255,0.98);
    box-shadow: 0 18px 44px rgba(15,23,42,0.1);
}
#home-page .landing-card-icon {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: rgba(96,165,250,0.13);
    border: 1px solid rgba(96,165,250,0.18);
    color: #bfdbfe;
    display: flex;
    align-items: center;
    justify-content: center;
}
body.light-mode #home-page .landing-card-icon {
    color: #2563eb;
    background: rgba(37,99,235,0.08);
    border-color: rgba(37,99,235,0.12);
}
#home-page .landing-card-icon svg {
    width: 22px;
    height: 22px;
}
#home-page .landing-card strong {
    color: var(--text-title);
    font-size: 18px;
    letter-spacing: -0.02em;
}
#home-page .landing-card em {
    max-width: 220px;
    color: var(--text-muted);
    font-style: normal;
    font-size: 13px;
    line-height: 1.6;
}
#home-page .landing-steps {
    width: min(680px, 100%);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
#home-page .landing-steps div {
    min-height: 44px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.12);
    background: rgba(255,255,255,0.045);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
body.light-mode #home-page .landing-steps div {
    background: rgba(255,255,255,0.68);
    border-color: rgba(15,23,42,0.07);
}
#home-page .landing-steps strong {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgba(96,165,250,0.16);
    color: #bfdbfe;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 900;
}
body.light-mode #home-page .landing-steps strong { color: #2563eb; background: rgba(37,99,235,0.09); }
#home-page .landing-steps span {
    color: var(--text-body);
    font-size: 13px;
    font-weight: 850;
}

@media (max-width: 768px) {
    #home-page.active-page {
        justify-content: flex-start;
        overflow: visible;
    }
    #home-page .landing-shell {
        width: 100%;
        min-height: auto;
        padding: 24px 18px;
        border-radius: 24px;
        gap: 24px;
    }
    #home-page .landing-orb-a {
        width: 180px;
        height: 180px;
        left: -72px;
        top: -62px;
    }
    #home-page .landing-orb-b {
        width: 160px;
        height: 160px;
        right: -62px;
        bottom: -58px;
    }
    #home-page .landing-kicker {
        margin-bottom: 13px;
        font-size: 11px;
    }
    #home-page .landing-hero h1 {
        font-size: clamp(34px, 11vw, 46px);
        line-height: 1.08;
        letter-spacing: -0.055em;
    }
    #home-page .landing-hero p {
        margin-top: 16px;
        font-size: 14px;
        line-height: 1.72;
    }
    #home-page .landing-actions {
        width: 100%;
        margin-top: 22px;
        flex-direction: column;
    }
    #home-page .landing-primary,
    #home-page .landing-secondary {
        width: 100%;
        min-height: 46px;
    }
    #home-page .landing-map {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    #home-page .landing-card,
    #home-page .landing-card-main {
        min-height: 126px;
        padding: 17px;
        border-radius: 20px;
    }
    #home-page .landing-card:hover,
    #home-page .landing-card-main:hover {
        transform: none;
    }
    #home-page .landing-steps {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    #home-page .landing-steps div {
        justify-content: flex-start;
        min-height: 42px;
    }
}

/* --- 首页视觉精修 --- */
#home-page .landing-shell {
    width: min(1120px, 100%);
    min-height: auto;
    padding: clamp(24px, 4.2vw, 54px) clamp(22px, 5vw, 64px);
    gap: clamp(20px, 2.6vw, 30px);
    border-radius: 36px;
    background:
        radial-gradient(circle at 18% 8%, rgba(96,165,250,0.2), transparent 28%),
        radial-gradient(circle at 84% 14%, rgba(167,139,250,0.14), transparent 30%),
        radial-gradient(circle at 50% 104%, rgba(34,197,94,0.08), transparent 34%),
        linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.035));
}
body.light-mode #home-page .landing-shell {
    background:
        radial-gradient(circle at 18% 8%, rgba(37,99,235,0.13), transparent 30%),
        radial-gradient(circle at 84% 14%, rgba(124,58,237,0.08), transparent 30%),
        radial-gradient(circle at 50% 104%, rgba(16,185,129,0.08), transparent 34%),
        linear-gradient(145deg, #ffffff, #f8fbff 58%, #f4f7fb);
}
#home-page .landing-shell::after {
    content: "";
    position: absolute;
    inset: 18px;
    border-radius: 28px;
    border: 1px solid rgba(255,255,255,0.08);
    pointer-events: none;
}
body.light-mode #home-page .landing-shell::after { border-color: rgba(15,23,42,0.045); }
#home-page .landing-hero {
    max-width: 830px;
}
#home-page .landing-kicker {
    padding: 7px 14px;
    margin-bottom: 18px;
    color: #dbeafe;
    background: rgba(37,99,235,0.18);
    border-color: rgba(147,197,253,0.34);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.1em;
    box-shadow: 0 10px 30px rgba(37,99,235,0.12);
}
body.light-mode #home-page .landing-kicker {
    color: #1d4ed8;
    background: rgba(37,99,235,0.075);
    border-color: rgba(37,99,235,0.14);
}
#home-page .landing-hero h1 {
    max-width: 880px;
    font-size: clamp(42px, 5vw, 72px);
    line-height: 1.16;
    letter-spacing: -0.072em;
    font-weight: 920;
    color: transparent;
    background: linear-gradient(180deg, #ffffff 0%, #dbeafe 42%, #93c5fd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    text-shadow: 0 18px 54px rgba(59,130,246,0.12);
    display: grid;
    justify-items: center;
    gap: 0.08em;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}
#home-page .landing-title-line {
    display: block;
    width: max-content;
    max-width: 100%;
}
#home-page .landing-title-ai {
    display: inline;
    font-size: 1.12em;
    line-height: 0.9;
    letter-spacing: -0.04em;
    vertical-align: -0.035em;
}
body.light-mode #home-page .landing-hero h1 {
    background: linear-gradient(180deg, #0f172a 0%, #172554 54%, #2563eb 100%);
    -webkit-background-clip: text;
    background-clip: text;
    text-shadow: none;
}
#home-page .landing-hero p {
    max-width: 660px;
    margin-top: 22px;
    color: color-mix(in srgb, var(--text-body) 88%, #ffffff 12%);
    font-size: clamp(16px, 1.35vw, 19px);
    line-height: 1.9;
    letter-spacing: 0.01em;
}
body.light-mode #home-page .landing-hero p { color: #526175; }
#home-page .landing-actions {
    margin-top: 32px;
    gap: 14px;
}
#home-page .landing-primary,
#home-page .landing-secondary {
    min-height: 52px;
    padding: 0 24px;
    font-size: 15px;
    letter-spacing: -0.01em;
}
#home-page .landing-secondary svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    flex: 0 0 auto;
}
#home-page .landing-primary {
    min-width: 168px;
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 48%, #7c3aed 100%);
    box-shadow: 0 18px 48px rgba(37,99,235,0.28), inset 0 1px 0 rgba(255,255,255,0.28);
}
#home-page .landing-secondary {
    min-width: 138px;
    border-color: rgba(148,163,184,0.22);
    color: var(--text-title);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.035)) padding-box,
        linear-gradient(135deg, rgba(125,211,252,0.5), rgba(168,85,247,0.24)) border-box;
    backdrop-filter: blur(14px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 14px 36px rgba(15,23,42,0.16);
}
#home-page .landing-tool {
    min-width: 144px;
    border-color: rgba(129,140,248,0.34);
    background:
        linear-gradient(135deg, rgba(37,99,235,0.2), rgba(124,58,237,0.14)) padding-box,
        linear-gradient(135deg, rgba(96,165,250,0.72), rgba(168,85,247,0.58)) border-box;
    color: #dbeafe;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 16px 42px rgba(79,70,229,0.2);
}
body.light-mode #home-page .landing-secondary {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.92), rgba(239,246,255,0.74)) padding-box,
        linear-gradient(135deg, rgba(59,130,246,0.32), rgba(168,85,247,0.22)) border-box;
    box-shadow: 0 14px 34px rgba(15,23,42,0.08), inset 0 1px 0 rgba(255,255,255,0.95);
}
body.light-mode #home-page .landing-tool {
    color: #3730a3;
    background:
        linear-gradient(135deg, rgba(239,246,255,0.98), rgba(245,243,255,0.88)) padding-box,
        linear-gradient(135deg, rgba(37,99,235,0.42), rgba(124,58,237,0.38)) border-box;
}
#home-page .landing-secondary:hover {
    transform: translateY(-3px);
    border-color: rgba(125,211,252,0.5);
    box-shadow: 0 22px 54px rgba(37,99,235,0.18), inset 0 1px 0 rgba(255,255,255,0.16);
}
#home-page .landing-tool:hover {
    border-color: rgba(168,85,247,0.64);
    box-shadow: 0 24px 58px rgba(124,58,237,0.24), inset 0 1px 0 rgba(255,255,255,0.18);
}
#home-page .landing-map {
    width: min(940px, 100%);
    gap: 16px;
}
#home-page .landing-card,
#home-page .landing-card-main {
    min-height: 144px;
    padding: 18px;
    border-radius: 26px;
    background: rgba(15,23,42,0.34);
    backdrop-filter: blur(18px);
}
body.light-mode #home-page .landing-card,
body.light-mode #home-page .landing-card-main {
    background: rgba(255,255,255,0.76);
}
#home-page .landing-card-main {
    background: linear-gradient(145deg, rgba(37,99,235,0.26), rgba(124,58,237,0.12)), rgba(15,23,42,0.38);
}
#home-page .landing-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 15px;
}
#home-page .landing-card strong {
    font-size: 17px;
    font-weight: 880;
}
#home-page .landing-card em {
    max-width: 260px;
    font-size: 13px;
    line-height: 1.65;
}
#home-page .landing-steps {
    width: min(720px, 100%);
}
#home-page .landing-steps div {
    background: rgba(255,255,255,0.055);
    backdrop-filter: blur(12px);
}

@media (max-width: 768px) {
    #home-page .landing-shell {
        min-height: auto;
        padding: 28px 18px;
        gap: 24px;
        border-radius: 26px;
    }
    #home-page .landing-shell::after {
        inset: 10px;
        border-radius: 20px;
    }
    #home-page .landing-kicker {
        margin-bottom: 14px;
        font-size: 11px;
    }
    #home-page .landing-hero h1 {
        font-size: clamp(38px, 12vw, 52px);
        line-height: 1.16;
        letter-spacing: -0.064em;
    }
    #home-page .landing-hero p {
        margin-top: 17px;
        font-size: 14px;
        line-height: 1.78;
    }
    .daily-inspiration-card {
        width: 100%;
        margin-top: 15px;
        padding: 12px;
        border-radius: 18px;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "label action"
            "copy copy";
        align-items: center;
        gap: 9px 10px;
    }
    .daily-inspiration-label {
        grid-area: label;
        width: 116px;
        min-height: 34px;
        padding: 0 12px;
        font-size: 13px;
    }
    .daily-inspiration-copy {
        grid-area: copy;
        position: relative;
        left: auto;
        top: auto;
        width: 100%;
        transform: none;
        justify-items: center;
        gap: 3px;
        text-align: center;
    }
    .daily-inspiration-copy strong,
    .daily-inspiration-copy em {
        max-width: 100%;
        white-space: normal;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .daily-inspiration-copy strong {
        font-size: 14px;
        -webkit-line-clamp: 1;
    }
    .daily-inspiration-copy em {
        font-size: 12px;
        -webkit-line-clamp: 2;
    }
    .daily-inspiration-card button {
        grid-area: action;
        position: relative;
        right: auto;
        top: auto;
        width: 116px;
        min-width: 116px;
        min-height: 34px;
        transform: none;
        padding: 0 12px;
        font-size: 12px;
    }
    .daily-inspiration-card button:hover {
        transform: translateY(-1px);
    }
    #home-page .landing-actions {
        margin-top: 24px;
        gap: 10px;
    }
    #home-page .landing-primary,
    #home-page .landing-secondary {
        min-height: 48px;
        font-size: 14px;
    }
    #home-page .landing-card,
    #home-page .landing-card-main {
        min-height: 118px;
        padding: 16px;
        border-radius: 20px;
        gap: 9px;
    }
    #home-page .landing-card-icon {
        width: 40px;
        height: 40px;
        border-radius: 14px;
    }
}

.reverse-prompt-box {
    width: min(430px, calc(100vw - 32px));
    max-height: 92vh;
    overflow: auto;
    padding: 28px;
}
.reverse-prompt-header {
    align-items: flex-start;
    margin-bottom: 18px;
}
.reverse-prompt-eyebrow {
    width: fit-content;
    margin-bottom: 8px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(37,99,235,0.10);
    color: var(--brand-accent);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.04em;
}
.reverse-prompt-subtitle {
    margin-top: 7px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
}
.reverse-prompt-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: stretch;
    min-width: 0;
}
.reverse-prompt-left,
.reverse-prompt-right {
    display: grid;
    gap: 12px;
    align-content: start;
    min-width: 0;
}
.reverse-prompt-left {
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    background: linear-gradient(180deg, var(--bg-surface), var(--bg-element));
    padding: 12px;
}
.reverse-upload-zone {
    position: relative;
    min-height: 260px;
    border: 1px dashed rgba(96,165,250,0.45);
    border-radius: 16px;
    background: radial-gradient(circle at 20% 0%, rgba(59,130,246,0.12), transparent 34%), var(--bg-element);
    overflow: hidden;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}
.reverse-upload-zone:hover { border-color: rgba(96,165,250,0.78); }
.reverse-upload-zone input { display: none; }
.reverse-upload-zone img {
    display: none;
    width: 100%;
    height: 260px;
    object-fit: contain;
    background: repeating-conic-gradient(rgba(148,163,184,0.10) 0% 25%, transparent 0% 50%) 50% / 24px 24px;
}
.reverse-upload-empty {
    min-height: 260px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 9px;
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
}
.reverse-upload-empty svg {
    width: 42px;
    height: 42px;
    color: var(--brand-accent);
    padding: 10px;
    border-radius: 16px;
    background: rgba(37,99,235,0.10);
}
.reverse-upload-empty strong {
    color: var(--text-title);
    font-size: 16px;
}
.reverse-upload-empty span {
    font-size: 12px;
    line-height: 1.6;
}
.reverse-left-actions {
    display: grid;
    gap: 10px;
}
.reverse-submit-btn,
.reverse-secondary-btn,
.reverse-actions button,
.reverse-result-head button {
    border: 1px solid var(--border-subtle);
    border-radius: 13px;
    padding: 12px 15px;
    background: var(--bg-element);
    color: var(--text-title);
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}
.reverse-submit-btn {
    min-height: 46px;
    border-color: transparent;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    box-shadow: 0 14px 32px rgba(37,99,235,0.24);
}
.reverse-submit-btn:hover { transform: translateY(-1px); }
.reverse-submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}
.reverse-secondary-btn { min-height: 44px; }
.reverse-status {
    padding: 14px 16px;
    border: 1px solid rgba(96,165,250,0.24);
    border-radius: 16px;
    background: rgba(59,130,246,0.08);
    color: var(--text-body);
    font-size: 13px;
    line-height: 1.7;
}
.reverse-result {
    display: grid;
    gap: 14px;
    border: 1px solid var(--border-subtle);
    border-radius: 22px;
    background: var(--bg-surface);
    padding: 16px;
    box-shadow: 0 18px 46px rgba(0,0,0,0.10);
    min-width: 0;
    overflow-wrap: anywhere;
}
.reverse-result-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.reverse-result-head strong {
    display: block;
    color: var(--text-title);
    font-size: 16px;
    font-weight: 900;
}
.reverse-result-head span {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 12px;
}
.reverse-result-head button {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 8px 12px;
    white-space: nowrap;
}
.reverse-result-block {
    display: grid;
    gap: 7px;
}
.reverse-result-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 900;
}
.reverse-result textarea {
    width: 100%;
    min-width: 0;
    min-height: 132px;
    resize: vertical;
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    background: var(--bg-element);
    color: var(--text-title);
    padding: 13px 14px;
    font-size: 13px;
    line-height: 1.75;
    outline: none;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.reverse-result textarea:focus {
    border-color: rgba(96,165,250,0.62);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.reverse-result-block-main textarea { min-height: 168px; }
#reverse-result-negative { min-height: 90px; }
.reverse-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
.reverse-tags span {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(59,130,246,0.12);
    color: #93c5fd;
    font-size: 12px;
    font-weight: 800;
}
body.light-mode .reverse-tags span { color: #2563eb; }
.reverse-actions {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 10px;
}
.reverse-actions .reverse-action-primary {
    border-color: transparent;
    background: #0f172a;
    color: #fff;
}
.reverse-actions button:hover,
.reverse-result-head button:hover,
.reverse-secondary-btn:hover {
    border-color: var(--border-strong);
    background: var(--bg-element-hover);
    transform: translateY(-1px);
}
.reverse-actions .reverse-action-primary:hover { background: #020617; }
.reverse-task-hint {
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px dashed rgba(96,165,250,0.34);
    border-radius: 16px;
    background: rgba(59,130,246,0.07);
    color: var(--text-body);
    line-height: 1.7;
    text-align: left;
}
.reverse-task-hint strong { color: var(--text-title); font-size: 16px; line-height: 1.35; }
.reverse-task-hint span { color: var(--text-muted); font-size: 13px; }

@media (max-width: 1180px) {
    .reverse-prompt-box {
        width: min(430px, calc(100vw - 20px));
    }
    .reverse-prompt-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .square-toolbar { flex-direction: column; align-items: stretch; }
    .filter-area { flex-wrap: wrap; justify-content: space-between; }
    .square-sort-tabs { flex: 1; min-width: 0; }
    .square-sort-btn { flex: 1; padding: 0 10px; }
    .reverse-prompt-box {
        width: min(100vw - 18px, 520px);
        max-height: 88vh;
        padding: 18px;
        border-radius: 22px;
    }
    .reverse-prompt-layout {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .reverse-prompt-left { padding: 12px; border-radius: 18px; }
    .reverse-upload-zone,
    .reverse-upload-empty,
    .reverse-upload-zone img {
        min-height: 260px;
        height: 260px;
    }
    .reverse-result { padding: 13px; border-radius: 18px; }
    .reverse-result-head { align-items: flex-start; }
    .reverse-result textarea { min-height: 118px; }
    .reverse-result-block-main textarea { min-height: 148px; }
    .reverse-actions { grid-template-columns: 1fr; }
}

/* SEO 模板落地页 */
body.seo-page { min-height: 100vh; overflow: auto; background: var(--bg-body); color: var(--text-title); }
.template-top-nav-page { display: block; }
.template-top-header { position: sticky; top: 12px; z-index: 20; }
.template-top-header .logo-area { color: var(--text-title); text-decoration: none; }
.template-top-tabs {
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}
.template-top-tabs::-webkit-scrollbar { display: none; }
.template-top-tabs .nav-tab {
    flex: 0 0 auto;
    text-decoration: none;
    white-space: nowrap;
}
.template-tool-nav {
    width: min(1180px, calc(100% - 32px));
    margin: 12px auto 0;
    display: flex;
    justify-content: flex-start;
}
.template-tool-nav-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 8px 13px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.08);
    color: var(--text-title);
    text-decoration: none;
    font-size: 13px;
    font-weight: 850;
}
.template-tool-nav-item:hover {
    background: rgba(15, 23, 42, 0.14);
}
.template-tool-nav-item svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}
body:not(.light-mode) .template-tool-nav-item {
    background: rgba(255, 255, 255, 0.12);
}
body:not(.light-mode) .template-tool-nav-item:hover {
    background: rgba(255, 255, 255, 0.18);
}
.template-top-actions { min-width: 32px; justify-content: flex-end; }
.seo-template-page,
.seo-template-detail-page { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 26px 0 60px; }
.seo-template-page { display: grid; gap: 18px; }
.seo-back-link { width: fit-content; display: inline-flex; align-items: center; gap: 6px; color: var(--text-body); text-decoration: none; font-size: 13px; font-weight: 900; padding: 8px 12px; border: 1px solid var(--border-subtle); border-radius: 999px; background: var(--bg-surface); box-shadow: 0 10px 26px rgba(0,0,0,0.08); }
.seo-back-link:hover { color: var(--text-title); border-color: var(--border-strong); background: var(--bg-element-hover); }
.seo-template-hero,
.seo-detail-hero,
.seo-prompt-panel,
.seo-related-section { border: 1px solid var(--border-subtle); border-radius: 28px; background: var(--bg-surface); box-shadow: 0 22px 64px rgba(0,0,0,0.12); }
.seo-template-hero { position: relative; overflow: hidden; padding: clamp(28px, 5vw, 58px); text-align: center; margin-bottom: 4px; }
.seo-template-hero::before { content: ''; position: absolute; width: 360px; height: 360px; left: -120px; top: -160px; border-radius: 50%; background: radial-gradient(circle, rgba(37,99,235,0.18), transparent 68%); pointer-events: none; }
.seo-template-hero::after { content: ''; position: absolute; width: 380px; height: 380px; right: -150px; bottom: -170px; border-radius: 50%; background: radial-gradient(circle, rgba(124,58,237,0.14), transparent 70%); pointer-events: none; }
.seo-template-hero > * { position: relative; z-index: 1; }
.seo-template-hero-badge { width: fit-content; margin: 0 auto 12px; padding: 6px 10px; border-radius: 999px; background: rgba(37,99,235,0.10); color: var(--brand-accent); font-size: 12px; font-weight: 900; letter-spacing: 0.03em; }
.seo-detail-nav a { color: var(--brand-accent); text-decoration: none; font-weight: 800; }
.seo-template-hero h1,
.seo-detail-hero h1 { font-size: clamp(34px, 5vw, 64px); line-height: 1.06; letter-spacing: -0.07em; margin: 0 0 12px; }
.seo-template-hero p,
.seo-detail-hero p { color: var(--text-body); line-height: 1.85; max-width: 720px; margin: 0 auto; }
.seo-template-search { width: min(680px, 100%); margin: 24px auto 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 8px; border: 1px solid var(--border-subtle); border-radius: 18px; background: var(--bg-element); }
.seo-template-search input { min-width: 0; height: 44px; border: none; outline: none; background: transparent; color: var(--text-title); padding: 0 12px; font: inherit; }
.seo-template-search button { height: 44px; border: none; border-radius: 13px; padding: 0 18px; background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; font-size: 13px; font-weight: 900; cursor: pointer; }
.seo-template-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.seo-template-stats span { padding: 6px 9px; border-radius: 999px; color: var(--text-muted); background: var(--bg-element); border: 1px solid var(--border-subtle); font-size: 12px; font-weight: 800; }
.seo-category-tabs { display: flex; flex-wrap: nowrap; justify-content: center; gap: 9px; margin-top: 22px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.seo-category-tabs::-webkit-scrollbar { display: none; }
.seo-category-tabs a { flex: 0 0 auto; color: var(--text-body); text-decoration: none; border: 1px solid var(--border); border-radius: 999px; padding: 9px 13px; font-size: 13px; font-weight: 800; background: var(--bg-element); }
.seo-category-tabs a:hover { color: var(--text-title); border-color: var(--border-strong); }
.seo-category-tabs a.active { color: #fff; background: linear-gradient(135deg, #2563eb, #7c3aed); border-color: transparent; }
.seo-template-mode-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 16px; }
.seo-template-mode-tabs a { color: var(--text-body); text-decoration: none; border: 1px solid var(--border); border-radius: 999px; padding: 9px 14px; font-size: 13px; font-weight: 900; background: var(--bg-element); }
.seo-template-mode-tabs a:hover { color: var(--text-title); border-color: var(--border-strong); }
.seo-template-mode-tabs a.active { color: #fff; background: linear-gradient(135deg, #16a34a, #2563eb); border-color: transparent; }
.seo-template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.seo-template-card,
.seo-related-card { border: 1px solid var(--border-subtle); border-radius: 22px; background: var(--bg-surface); overflow: hidden; text-decoration: none; color: inherit; }
.seo-template-card { transition: transform 0.2s var(--ease-out), border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out); }
.seo-template-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: 0 18px 46px rgba(0,0,0,0.12); }
.seo-template-cover { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 10; background: linear-gradient(135deg, rgba(37,99,235,0.16), rgba(124,58,237,0.12)); text-decoration: none; }
.seo-template-cover img { width: 100%; height: 100%; object-fit: cover; }
.seo-template-cover span { font-size: 42px; font-weight: 900; color: var(--brand-accent); }
.seo-template-card-body { display: grid; gap: 10px; padding: 16px; }
.seo-template-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--text-muted); font-size: 12px; font-weight: 800; }
.seo-template-card h2 { font-size: 18px; line-height: 1.35; margin: 0; }
.seo-template-card h2 a { color: var(--text-title); text-decoration: none; }
.seo-template-card p { color: var(--text-body); line-height: 1.7; font-size: 13px; margin: 0; }
.seo-template-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.seo-template-tags span { padding: 5px 8px; border-radius: 999px; background: var(--bg-element); color: var(--text-muted); font-size: 11px; font-weight: 800; }
.seo-template-actions,
.seo-detail-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 4px; }
.seo-template-actions a,
.seo-template-actions button,
.seo-detail-actions a,
.seo-detail-actions button { flex: 1; min-height: 38px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 12px; color: var(--text-title); text-decoration: none; font-size: 13px; font-weight: 900; background: var(--bg-element); font-family: inherit; cursor: pointer; }
.seo-template-actions a:hover,
.seo-template-actions button:hover,
.seo-detail-actions a:hover,
.seo-detail-actions button:hover { border-color: var(--border-strong); background: var(--bg-element-hover); }
.seo-template-actions a.primary,
.seo-detail-actions a.primary { background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; border-color: transparent; }
.seo-template-favorite-btn.is-active { color: #fff; background: linear-gradient(135deg, #db2777, #f97316); border-color: transparent; }
.seo-template-favorite-btn:disabled { opacity: 0.65; cursor: wait; }
.seo-detail-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 12px; }
.seo-detail-stats span { padding: 6px 9px; border-radius: 999px; color: var(--text-muted); background: var(--bg-element); border: 1px solid var(--border-subtle); font-size: 12px; font-weight: 900; }
.seo-detail-stats em { font-style: normal; color: var(--text-title); }
.seo-empty { grid-column: 1 / -1; min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 46px 24px; text-align: center; color: var(--text-muted); border: 1px dashed var(--border-subtle); border-radius: 24px; background: linear-gradient(135deg, rgba(37,99,235,0.08), rgba(124,58,237,0.05)); }
.seo-empty-icon { width: 64px; height: 64px; border-radius: 18px; display: flex; align-items: center; justify-content: center; background: var(--bg-element); color: var(--brand-accent); font-size: 22px; font-weight: 900; }
.seo-empty strong { color: var(--text-title); font-size: 20px; }
.seo-empty p { max-width: 460px; margin: 0; line-height: 1.7; }
.seo-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 4px; }
.seo-empty-actions a { min-width: 118px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 12px; color: var(--text-title); background: var(--bg-element); text-decoration: none; font-size: 13px; font-weight: 900; }
.seo-empty-actions a.primary { color: #fff; background: linear-gradient(135deg, #2563eb, #7c3aed); border-color: transparent; }
.seo-detail-nav { display: flex; flex-wrap: wrap; gap: 8px; color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }
.seo-detail-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 420px); gap: 24px; padding: clamp(24px, 4vw, 44px); align-items: center; }
.seo-detail-category { display: inline-flex; padding: 7px 11px; border-radius: 999px; background: rgba(37,99,235,0.12); color: #93c5fd; font-size: 12px; font-weight: 900; }
body.light-mode .seo-detail-category { color: #1d4ed8; }
.seo-detail-cover { min-height: 280px; border-radius: 24px; overflow: hidden; background: var(--bg-element); }
.seo-detail-cover img { width: 100%; height: 100%; min-height: 280px; object-fit: cover; }
.seo-detail-cover-empty { min-height: 280px; display: flex; align-items: center; justify-content: center; font-size: 72px; font-weight: 900; color: var(--brand-accent); }
.seo-prompt-panel { margin-top: 18px; padding: 22px; }
.seo-prompt-panel h2,
.seo-related-section h2 { margin: 0 0 12px; font-size: 20px; }
.seo-prompt-panel pre { white-space: pre-wrap; word-break: break-word; margin: 0 0 18px; padding: 16px; border-radius: 16px; background: var(--bg-element); color: var(--text-body); line-height: 1.8; font-family: inherit; }
.seo-related-section { margin-top: 18px; padding: 22px; }
.seo-related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.seo-related-card { display: grid; gap: 9px; padding: 12px; }
.seo-related-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 14px; }
.seo-related-card strong { color: var(--text-title); }
.seo-related-card span { color: var(--text-muted); font-size: 12px; line-height: 1.5; }
@media (max-width: 768px) {
    .template-top-header { position: static; height: auto; min-height: 52px; margin: 10px 12px 0; padding: 10px 12px; gap: 10px; flex-wrap: wrap; }
    .template-top-header .logo-area { flex: 1; min-width: 140px; }
    .template-top-tabs { order: 3; width: 100%; overflow-x: auto; justify-content: flex-start; }
    .template-top-tabs .nav-tab { flex: 0 0 auto; padding: 7px 12px; }
    .template-top-actions { margin-left: auto; }
    .seo-detail-hero { grid-template-columns: 1fr; flex-direction: column; align-items: flex-start; }
    .seo-template-grid { grid-template-columns: 1fr; }
    .seo-template-page,
    .seo-template-detail-page { width: min(100% - 24px, 1180px); padding-top: 22px; }
    .seo-template-hero { border-radius: 22px; padding: 26px 18px; }
    .seo-template-search { grid-template-columns: 1fr; }
    .seo-template-search button { width: 100%; }
    .seo-category-tabs { justify-content: flex-start; margin-left: -2px; margin-right: -2px; }
    .seo-template-actions a,
    .seo-template-actions button,
    .seo-detail-actions a,
    .seo-detail-actions button { flex-basis: 100%; }
    .seo-empty { min-height: 260px; padding: 34px 18px; }
}

.publish-guide-notice .publish-guide-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.publish-guide-notice .publish-guide-actions button {
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px;
    padding: 7px 12px;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.publish-guide-notice .publish-guide-actions button:first-child {
    background: #fff;
    color: #0f172a;
    border-color: #fff;
}
.publish-guide-notice .publish-guide-actions button:disabled { opacity: .65; cursor: wait; }
.square-author-link,
.public-author-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}
.square-author-link:hover,
.public-author-link:hover { color: #fff; text-decoration: underline; }
.user-works-page {
    min-height: 100vh;
    background: radial-gradient(circle at 16% 0%, rgba(59,130,246,.22), transparent 26%), linear-gradient(145deg, var(--bg-body), var(--bg-surface));
    color: var(--text-title);
    overflow-y: auto;
}
.user-works-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 26px 0 44px; }
.user-works-nav { display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; color:var(--text-muted); font-size:13px; }
.user-works-nav a { color:inherit; text-decoration:none; }
.user-works-nav strong { color:var(--text-title); font-size:16px; }
.user-works-hero { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:18px; align-items:center; border:1px solid var(--border-subtle); border-radius:28px; background:rgba(255,255,255,.045); padding:24px; box-shadow:var(--shadow-subtle); }
.user-works-author { display:flex; align-items:center; gap:16px; min-width:0; }
.user-works-avatar { width:72px; height:72px; border-radius:22px; display:grid; place-items:center; overflow:hidden; background:linear-gradient(135deg,#60a5fa,#a78bfa); color:#fff; font-size:28px; font-weight:900; }
.user-works-avatar img { width:100%; height:100%; object-fit:cover; }
.user-works-author h1 { margin:0 0 8px; font-size:clamp(26px,4vw,44px); letter-spacing:-.06em; line-height:1.08; }
.user-works-author p { margin:0; color:var(--text-body); font-size:13px; line-height:1.7; }
.user-works-stats { display:grid; grid-template-columns:repeat(3,minmax(96px,1fr)); gap:10px; }
.user-works-stats div { padding:14px; border:1px solid var(--border-subtle); border-radius:16px; background:var(--bg-element); }
.user-works-stats span { display:block; color:var(--text-muted); font-size:11px; margin-bottom:5px; }
.user-works-stats strong { display:block; font-size:22px; }
.user-works-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:16px; margin-top:18px; }
.user-work-card { border:1px solid var(--border-subtle); border-radius:22px; background:rgba(255,255,255,.045); overflow:hidden; }
.user-work-card img { width:100%; aspect-ratio:1/1; object-fit:cover; display:block; background:var(--bg-element); }
.user-work-body { display:grid; gap:10px; padding:14px; }
.user-work-body p { margin:0; min-height:42px; color:var(--text-body); font-size:13px; line-height:1.6; }
.user-work-meta { display:flex; flex-wrap:wrap; gap:7px; color:var(--text-muted); font-size:12px; }
.user-work-meta span { padding:5px 8px; border-radius:999px; background:var(--bg-element); }
.user-work-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.user-work-actions a { min-height:38px; display:flex; align-items:center; justify-content:center; border-radius:12px; border:1px solid var(--border-subtle); background:var(--bg-element); color:var(--text-title); text-decoration:none; font-size:13px; font-weight:850; }
.user-work-actions a.primary { color:#fff; background:linear-gradient(135deg,#2563eb,#7c3aed); border-color:transparent; }
.user-works-empty { margin-top:18px; min-height:280px; display:grid; place-items:center; text-align:center; border:1px dashed var(--border-subtle); border-radius:24px; color:var(--text-muted); background:var(--bg-element); }
@media (max-width: 760px) {
    .user-works-shell { width: min(100% - 24px, 1180px); padding-top:18px; }
    .user-works-hero { grid-template-columns:1fr; padding:18px; }
    .user-works-author { align-items:flex-start; }
    .user-works-avatar { width:58px; height:58px; border-radius:18px; }
    .user-works-stats { grid-template-columns:repeat(3,1fr); }
    .user-works-grid { grid-template-columns:1fr; }
}

.recent-output-panel {
    position: static;
    z-index: auto;
    width: 100%;
    align-content: start;
    gap: 20px;
    overflow: visible;
    padding: 0;
    pointer-events: auto;
}
.recent-output-section {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    box-shadow: none;
    pointer-events: auto;
}
body.light-mode .recent-output-section {
    background: transparent;
    box-shadow: none;
}
.recent-output-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}
.recent-output-head > div {
    display: grid;
    gap: 3px;
    min-width: 0;
}
.recent-output-head strong { color: var(--text-title); font-size: 14px; font-weight: 900; }
.recent-output-head span { color: var(--text-muted); font-size: 12px; }
.recent-output-view-all {
    flex-shrink: 0;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid rgba(148,163,184,0.2);
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    color: var(--text-title);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.18s var(--ease-out), border-color 0.18s var(--ease-out), background 0.18s var(--ease-out);
}
.recent-output-view-all:hover {
    transform: translateY(-1px);
    border-color: rgba(96,165,250,0.38);
    background: rgba(96,165,250,0.16);
}
body.light-mode .recent-output-view-all {
    background: rgba(255,255,255,0.82);
    border-color: rgba(15,23,42,0.1);
}
.recent-output-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
    gap: 12px;
}
.canvas-mode-off .recent-output-section:not(.recent-output-reverse) .recent-output-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}
.recent-output-reverse-grid {
    grid-template-columns: 1fr;
    gap: 10px;
}
.recent-output-loading {
    min-height: 96px;
    border: 1px dashed var(--border-subtle);
    border-radius: 16px;
    background: rgba(255,255,255,0.045);
    color: var(--text-muted);
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 700;
}
body.light-mode .recent-output-loading {
    background: rgba(248,250,252,0.78);
}
.recent-output-card {
    min-width: 0;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    background: rgba(255,255,255,0.055);
    overflow: hidden;
    display: grid;
    gap: 8px;
    padding: 9px;
}
body.light-mode .recent-output-card { background: rgba(248,250,252,0.88); }
.recent-reverse-card {
    grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
    align-items: stretch;
    gap: 14px;
    padding: 12px;
    border-color: rgba(96,165,250,0.28);
    background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(124,58,237,0.06), rgba(255,255,255,0.035));
}
.recent-reverse-body {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 10px;
}
.recent-reverse-media {
    height: 100%;
    min-height: 190px;
    aspect-ratio: 4 / 3;
}
.recent-reverse-prompt span,
.recent-reverse-prompt em {
    -webkit-line-clamp: 3;
    font-size: 12px;
    line-height: 1.55;
}
body.light-mode .recent-reverse-card { background: linear-gradient(135deg, rgba(37,99,235,0.08), rgba(124,58,237,0.05), rgba(255,255,255,0.9)); }
.recent-output-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 0;
    border-radius: 12px;
    overflow: hidden;
    padding: 0;
    background: var(--bg-element);
    cursor: zoom-in;
}
.recent-output-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recent-output-info { display: grid; gap: 4px; min-width: 0; }
.recent-output-info strong { color: var(--text-title); font-size: 12px; font-weight: 900; }
.recent-output-info span,
.recent-output-info em {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.45;
    font-style: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.recent-output-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.recent-output-tags i {
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(59,130,246,0.13);
    color: #93c5fd;
    font-size: 10px;
    font-style: normal;
    font-weight: 800;
}
body.light-mode .recent-output-tags i { color: #2563eb; }
.recent-output-error {
    padding: 7px 9px;
    border-radius: 10px;
    color: #fecaca;
    background: rgba(248,113,113,0.1);
    border: 1px solid rgba(248,113,113,0.18);
    font-size: 11px;
    line-height: 1.45;
}
body.light-mode .recent-output-error { color: #b91c1c; background: rgba(239,68,68,0.08); }
.recent-output-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
}
.recent-reverse-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.recent-output-actions button {
    min-height: 27px;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    background: var(--bg-element);
    color: var(--text-body);
    padding: 0 7px;
    font-size: 10px;
    font-weight: 850;
    cursor: pointer;
}
.recent-output-actions button:hover { color: var(--text-title); border-color: var(--border-strong); background: var(--bg-element-hover); }
.recent-reverse-card .recent-output-actions button:first-child { background: #0f172a; border-color: #0f172a; color: #fff; }

body:not(.canvas-mode-off) #recent-output-panel {
    position: absolute;
    z-index: 4;
    inset: 18px 18px auto auto;
    width: min(390px, calc(100% - 36px));
    max-height: calc(100% - 88px);
    gap: 10px;
    padding: 0 4px 8px;
    align-content: start;
    overflow-y: auto;
    overflow-x: hidden;
    pointer-events: none;
}
body:not(.canvas-mode-off) #recent-output-panel .recent-output-section {
    width: 100%;
    margin: 0;
    padding: 11px;
    border-radius: 18px;
    background: rgba(15,23,42,0.62);
    box-shadow: 0 18px 48px rgba(15,23,42,0.18);
}
body.light-mode:not(.canvas-mode-off) #recent-output-panel .recent-output-section {
    background: rgba(255,255,255,0.9);
    box-shadow: 0 18px 42px rgba(15,23,42,0.1);
}
body:not(.canvas-mode-off) #recent-output-panel .recent-output-head {
    margin-bottom: 9px;
}
body:not(.canvas-mode-off) #recent-output-panel .recent-output-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}
body:not(.canvas-mode-off) #recent-output-panel .recent-output-reverse-grid {
    grid-template-columns: 1fr;
}
body:not(.canvas-mode-off) #recent-output-panel .recent-output-card {
    border-radius: 14px;
    padding: 8px;
    gap: 7px;
}
body:not(.canvas-mode-off) #recent-output-panel .recent-reverse-card {
    grid-template-columns: 1fr;
    gap: 9px;
    padding: 9px;
}
body:not(.canvas-mode-off) #recent-output-panel .recent-reverse-media {
    min-height: 0;
    height: auto;
    aspect-ratio: 16 / 10;
}
body:not(.canvas-mode-off) #recent-output-panel .recent-reverse-prompt span,
body:not(.canvas-mode-off) #recent-output-panel .recent-reverse-prompt em {
    -webkit-line-clamp: 2;
    font-size: 11px;
    line-height: 1.45;
}
body:not(.canvas-mode-off) #recent-output-panel .recent-output-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
body:not(.canvas-mode-off) #recent-output-panel .recent-reverse-actions {
    display: flex;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .recent-output-panel {
        position: static;
        inset: auto;
        width: 100%;
        padding: 0;
        gap: 12px;
        overflow: visible;
    }
    .recent-output-section {
        width: 100%;
        margin: 0;
        padding: 12px;
        border-radius: 18px;
    }
    .recent-output-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .canvas-mode-off .recent-output-section:not(.recent-output-reverse) .recent-output-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .recent-output-reverse-grid { grid-template-columns: 1fr; }
    .recent-reverse-card {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px;
    }
    .recent-reverse-media {
        min-height: 0;
        height: auto;
        aspect-ratio: 1 / 1;
    }
    .recent-output-card { border-radius: 14px; padding: 9px; }
    .recent-output-head { margin-bottom: 10px; }
}