:root {
    --bg-color: #0A0A0A;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --primary: #7C3AED;
    --primary-hover: #6D28D9;
    --secondary: #EC4899;
    --accent: #06B6D4;
    --success: #10B981;
    --text-main: #FFFFFF;
    --text-muted: #A1A1AA;
    --glow-spread: 20px;
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* 动感流光背景点 */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    animation: float 10s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
    opacity: 0.3;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: var(--secondary);
    bottom: -50px;
    right: -50px;
    opacity: 0.25;
    animation-delay: -5s;
}

.blob-3 {
    width: 250px;
    height: 250px;
    background: var(--accent);
    top: 50%;
    right: 10%;
    opacity: 0.2;
    animation-delay: -8s;
}

/* 科技感网格底纹 */
.grid-overlay {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(to right, rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 0;
    pointer-events: none;
}

@keyframes float {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(20px) scale(1.1); }
}

/* 核心容器 (Glassmorphism) */
.container {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    width: 90%;
    max-width: 600px;
    z-index: 10;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
}

.glow-text {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 4px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 var(--glow-spread) rgba(124, 58, 237, 0.3);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 300;
    letter-spacing: 1px;
}

/* 首页云端图库 */
.gallery-section {
    text-align: center;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--glass-border);
}

.gallery-header {
    margin-bottom: 1rem;
}

.gallery-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.06em;
}

.gallery-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    font-weight: 300;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 0.65rem;
    min-height: 2.5rem;
}

.gallery-card {
    position: relative;
    padding: 0;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--glass-border);
    aspect-ratio: 9 / 16;
    transition: var(--transition);
}

.gallery-card:hover,
.gallery-card:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary), 0 8px 24px rgba(124, 58, 237, 0.35);
    transform: translateY(-2px);
}

.gallery-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-empty,
.gallery-loading {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.75rem;
    text-align: center;
}

/* 展示区 */
.image-showcase {
    position: relative;
    width: 100%;
    aspect-ratio: 9/16;
    max-width: 360px;
    margin: 0 auto;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

.placeholder-content {
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.image-showcase img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.5s ease;
}

/* 控制面板 */
.controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-main);
    font-size: 0.95rem;
    resize: vertical;
    min-height: 80px;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
}

.button-group {
    display: flex;
    gap: 1rem;
}

.btn {
    flex: 1;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.5);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 状态样式 */
.hidden {
    display: none !important;
}

.loader {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader p {
    color: var(--secondary);
    font-size: 0.9rem;
    letter-spacing: 1px;
    animation: pulse 1.5s infinite;
}

.error-msg {
    color: #ef4444;
    font-size: 0.85rem;
    text-align: center;
    background: rgba(239, 68, 68, 0.1);
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* 顶部导航 */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 1.5rem 0;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 1rem;
}

.logo-link {
    text-decoration: none;
    color: inherit;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-main);
}

.top-nav--with-links {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "logo actions"
        "links links";
    align-items: center;
    column-gap: 1rem;
    row-gap: 0.65rem;
}

.top-nav--with-links .logo-link {
    grid-area: logo;
}

.top-nav--with-links .nav-main {
    grid-area: links;
    justify-self: center;
}

.top-nav--with-links .nav-actions {
    grid-area: actions;
    justify-self: end;
}

@media (min-width: 720px) {
    .top-nav--with-links {
        grid-template-columns: auto 1fr auto;
        grid-template-areas: "logo links actions";
    }

    .top-nav--with-links .nav-main {
        justify-self: center;
    }
}

.nav-main {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    justify-content: center;
}

.nav-main__link {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.42rem 0.95rem;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.nav-main__link:hover {
    color: var(--text-main);
    border-color: var(--glass-border);
}

.nav-main__link--active {
    color: var(--text-main);
    background: rgba(124, 58, 237, 0.18);
    border-color: rgba(124, 58, 237, 0.4);
}

.nav-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    transform: translateY(-2px);
}

/* 风格选择器 */
.style-selector {
    margin-bottom: 1.5rem;
}

.style-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.style-tab {
    padding: 0.6rem 1.2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.style-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.style-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

/* 占位内容 */
.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.placeholder-icon {
    font-size: 3rem;
    opacity: 0.5;
    animation: pulse 2s infinite;
}

.placeholder-hint {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 0.5rem;
}

/* 图片操作按钮 */
.image-actions {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    padding: 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.action-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: var(--transition);
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.action-btn svg {
    width: 16px;
    height: 16px;
}

/* 进度条 */
.progress-bar {
    width: 200px;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 2px;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* 输入提示 */
.input-hint {
    margin-top: 0.5rem;
}

.hint-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.6;
}

/* 按钮样式增强 */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-icon,
.btn-text {
    position: relative;
    z-index: 1;
}

/* 成功消息 */
.success-msg {
    color: var(--success);
    font-size: 0.85rem;
    text-align: center;
    background: rgba(16, 185, 129, 0.1);
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(16, 185, 129, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 页脚 */
.footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

.footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.6;
}

/* 侧边栏 */
.sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 350px;
    height: 100vh;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--glass-border);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
}

.close-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 2rem;
}

.history-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(-4px);
}

.history-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.history-item-info {
    flex: 1;
    min-width: 0;
}

.history-item-prompt {
    font-size: 0.8rem;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 0.25rem;
}

.history-item-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--glass-border);
}

.btn-clear {
    width: 100%;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    color: #ef4444;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-clear:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* 遮罩层 */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 粒子效果 */
.particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.3;
    animation: float 15s infinite linear;
}

/* 文本框震动动画 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ========== 伪人图库页（瀑布流） ========== */
body.page-gallery {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 1rem 0 3rem;
}

.container--gallery {
    max-width: 1280px;
    width: 94%;
}

.gallery-page-header {
    text-align: center;
    margin-bottom: 1rem;
}

.gallery-page-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.gallery-page-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-weight: 300;
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
}

.gallery-page-status {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    min-height: 1.25rem;
    margin-bottom: 0.75rem;
}

.gallery-page-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.gallery-page-footer a {
    color: var(--accent);
    text-decoration: none;
}

.gallery-page-footer a:hover {
    text-decoration: underline;
}

.masonry {
    column-count: 4;
    column-gap: 12px;
}

@media (max-width: 1100px) {
    .masonry {
        column-count: 3;
    }
}

@media (max-width: 700px) {
    .masonry {
        column-count: 2;
    }
}

.masonry-brick {
    break-inside: avoid;
    margin-bottom: 12px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.35);
    padding: 0;
    cursor: pointer;
    display: block;
    width: 100%;
    transition: var(--transition);
}

.masonry-brick:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.masonry-brick:hover {
    box-shadow: 0 8px 28px rgba(124, 58, 237, 0.25);
    border-color: rgba(124, 58, 237, 0.45);
    transform: translateY(-2px);
}

.masonry-brick img {
    width: 100%;
    height: auto;
    display: block;
    vertical-align: middle;
}

.masonry-sentinel {
    height: 4px;
    margin-top: 1rem;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.lightbox.hidden {
    display: none;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    border: none;
    cursor: zoom-out;
}

.lightbox-inner {
    position: relative;
    z-index: 1;
    max-width: min(96vw, 520px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.lightbox-inner img {
    max-width: 100%;
    max-height: 75vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.lightbox-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2001;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-main);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.22);
}

.lightbox-caption {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.75);
    text-align: center;
    max-width: 100%;
    line-height: 1.45;
    overflow-y: auto;
    max-height: 18vh;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        right: -100%;
    }

    .style-tabs {
        justify-content: center;
    }

    .image-actions {
        flex-wrap: wrap;
        justify-content: center;
        width: 90%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1.5rem;
        border-radius: 16px;
        width: 95%;
    }

    .glow-text {
        font-size: 2rem;
        letter-spacing: 2px;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .button-group {
        flex-direction: column;
    }

    .image-showcase {
        max-width: 100%;
        aspect-ratio: 3/4;
    }

    .style-tab {
        flex: 1;
        min-width: calc(50% - 0.25rem);
        text-align: center;
    }

    .nav-actions {
        gap: 0.25rem;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
    }

    .top-nav {
        flex-direction: column;
        gap: 1rem;
    }
}
