* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.navbar {
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 2px 16px rgba(255,60,60,0.05);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-left { display: flex; align-items: center; gap: 24px; }
.nav-logo {
    font-size: 18px;
    font-weight: 700;
    color: #ff6b6b;
    text-decoration: none;
    text-shadow: 0 0 10px rgba(255,60,60,0.4), 0 0 20px rgba(255,60,60,0.15);
    animation: neonTextPulse 4s ease-in-out infinite;
}
.nav-link {
    font-size: 14px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}
.nav-link:hover { color: #7c6cff; background: rgba(124,108,255,0.1); }
.nav-link.active { color: #1677ff; font-weight: 600; }
.nav-dropdown-parent { position: relative; }
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(30,28,60,0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    min-width: 120px;
    z-index: 200;
    padding: 4px 0;
}
.nav-dropdown-parent:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
    display: block;
    padding: 8px 14px;
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.15s;
}
.nav-dropdown-menu a:hover { color: #7c6cff; background: rgba(124,108,255,0.1); }
.nav-right { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.nav-credits {
    font-size: 13px;
    color: #ffd700;
    background: rgba(255,215,0,0.1);
    border: 1px solid rgba(255,215,0,0.2);
    padding: 4px 12px;
    border-radius: 12px;
    text-shadow: 0 0 8px rgba(255,215,0,0.3);
    box-shadow: 0 0 12px rgba(255,215,0,0.1);
    animation: neonCreditsPulse 3s ease-in-out infinite;
}

@keyframes neonCreditsPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(255,60,60,0.15); text-shadow: 0 0 8px rgba(255,60,60,0.4); }
    33% { box-shadow: 0 0 14px rgba(255,255,255,0.2); text-shadow: 0 0 12px rgba(255,255,255,0.5); }
    66% { box-shadow: 0 0 14px rgba(255,215,0,0.25); text-shadow: 0 0 12px rgba(255,215,0,0.5); }
}
.nav-auth-btn {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
}
.nav-login { background: linear-gradient(135deg, #667eea, #7c6cff); color: #fff; }
.nav-login:hover { background: linear-gradient(135deg, #5a6fd6, #6a5fe0); }
.nav-register { background: transparent; color: #7c6cff; border: 1px solid #7c6cff; }
.nav-register:hover { background: rgba(124,108,255,0.1); }
.nav-user-wrap { position: relative; }
.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}
.nav-avatar:hover { transform: scale(1.1); }
.nav-dropdown {
    position: absolute;
    top: 42px;
    right: 0;
    background: rgba(30,28,60,0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    min-width: 180px;
    display: none;
    overflow: hidden;
    z-index: 200;
}
.nav-dropdown.show { display: block; }
.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 14px;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}
.nav-dropdown-item:hover { background: rgba(124,108,255,0.1); }
.nav-dropdown-divider { height: 1px; background: rgba(255,255,255,0.08); }
.nav-dropdown-item.danger { color: #ff4d4f; }

.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 24px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    height: calc(100vh - 56px);
    overflow: hidden;
}

.main-content.split {
    align-items: stretch;
    justify-content: flex-start;
}

.center-card {
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px;
    width: 100%;
    max-width: 680px;
    padding: 24px 28px 20px;
    position: relative;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3), 0 0 80px rgba(255,60,60,0.06), 0 0 2px rgba(255,60,60,0.15);
    animation: cardFadeIn 0.6s ease-out, neonCardPulse 4s ease-in-out infinite;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    overflow: visible;
}

.main-content.split .center-card {
    max-width: 480px;
    width: 480px;
    flex-shrink: 0;
    align-self: center;
}

@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.card-help-link {
    position: absolute;
    top: 16px;
    right: 16px;
    color: #ff3c3c;
    transition: all 0.25s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,60,60,0.08);
    border: 1px solid rgba(255,60,60,0.2);
    animation: neonHelpPulse 4s ease-in-out infinite;
    text-decoration: none;
}
.card-help-link .help-icon-text {
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    font-family: serif;
}
.card-help-link:hover {
    color: #ff5555;
    background: rgba(255,60,60,0.15);
    border-color: rgba(255,60,60,0.4);
    box-shadow: 0 0 12px rgba(255,60,60,0.3);
}

@keyframes neonHelpPulse {
    0%, 100% { box-shadow: 0 0 4px rgba(255,60,60,0.08); border-color: rgba(255,60,60,0.12); }
    33% { box-shadow: 0 0 8px rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.18); }
    66% { box-shadow: 0 0 8px rgba(255,215,0,0.15); border-color: rgba(255,215,0,0.2); }
}

.center-card-header {
    text-align: center;
    margin-bottom: 16px;
}

.center-card-body {
    position: relative;
}

.prompt-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.shimmer-placeholder {
    position: absolute;
    top: 8px;
    left: 0;
    font-size: 15px;
    color: rgba(255,255,255,0.35);
    pointer-events: none;
    background: linear-gradient(90deg, rgba(255,255,255,0.35) 0%, rgba(255,60,60,0.8) 25%, rgba(255,215,0,0.8) 50%, rgba(255,255,255,0.35) 75%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmerScan 2.5s ease-in-out infinite;
    cursor: text;
    pointer-events: auto;
    transition: opacity 0.2s;
    line-height: 1.6;
}

@keyframes shimmerScan {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.gallery-card {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255,60,60,0.12);
    transition: transform 0.2s, box-shadow 0.3s;
    position: relative;
    box-shadow: 0 0 12px rgba(255,60,60,0.1), 0 0 24px rgba(255,60,60,0.04);
    animation: neonCardPulse 4s ease-in-out infinite;
}
.gallery-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 18px rgba(255,60,60,0.3), 0 0 36px rgba(255,215,0,0.15);
}
.gallery-card-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    cursor: pointer;
}
.gallery-card-info {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(rgba(0,0,0,0.85), transparent);
    color: #fff;
    padding: 10px 10px 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
    font-size: 11px;
    line-height: 1.4;
}
.gallery-card:hover .gallery-card-info {
    opacity: 1;
}
.gallery-card-info .info-model {
    font-weight: 600;
    margin-bottom: 2px;
}
.gallery-card-info .info-params {
    color: rgba(255,255,255,0.7);
    margin-bottom: 2px;
}
.gallery-card-info .info-prompt {
    color: rgba(255,255,255,0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gallery-card-credits {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.55);
    color: #ffd700;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}
.gallery-card-placeholder {
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0.06));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.3);
}
.gallery-card-placeholder .spinner {
    width: 32px; height: 32px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: #7c6cff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.gallery-card-placeholder span { font-size: 13px; }

.gallery-card-error {
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(135deg, rgba(255,77,79,0.08), rgba(255,77,79,0.15));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ff4d4f;
}
.gallery-card-error svg { width: 48px; height: 48px; margin-bottom: 8px; opacity: 0.6; }
.gallery-card-error .error-text { font-size: 13px; margin-bottom: 4px; }
.gallery-card-error .error-code { font-size: 11px; color: #cf1322; background: rgba(255,77,79,0.1); padding: 2px 8px; border-radius: 4px; font-family: monospace; }
.gallery-card-error .error-combined { font-size: 12px; color: #cf1322; font-family: monospace; }

.gallery-card-actions {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    gap: 4px;
}
.card-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 4px 8px;
    border: 1px solid rgba(255,60,60,0.1);
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
    box-shadow: 0 0 6px rgba(255,60,60,0.06);
    animation: neonBorderPulse 5s ease-in-out infinite;
}
.card-action-btn:hover { background: rgba(255,255,255,0.12); box-shadow: 0 0 12px rgba(255,60,60,0.15); }
.card-action-btn.primary { background: rgba(255,60,60,0.15); color: #ff6b6b; animation: neonBtnPulse 4s ease-in-out infinite; }
.card-action-btn.primary:hover { background: rgba(255,60,60,0.25); box-shadow: 0 0 16px rgba(255,60,60,0.3); }
.card-action-btn svg { width: 12px; height: 12px; }
.card-more-btn {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.4);
    transition: all 0.2s;
}
.card-more-btn:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.8); }
.card-more-menu {
    position: absolute;
    bottom: 48px;
    right: 12px;
    background: rgba(30,28,60,0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    min-width: 120px;
    display: none;
    overflow: hidden;
    z-index: 50;
}
.card-more-menu.show { display: block; }
.card-more-menu-item {
    padding: 10px 16px;
    font-size: 13px;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    transition: background 0.2s;
}
.card-more-menu-item:hover { background: rgba(124,108,255,0.1); }
.card-more-menu-item.danger { color: #ff4d4f; }

.input-section {
    position: relative;
    width: 100%;
    background: transparent;
    padding: 0;
    box-shadow: none;
    z-index: auto;
    animation: none;
}

.kk-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 14px;
    border: 1px dashed #7c6cff;
    background: rgba(124,108,255,0.08);
    font-size: 12px;
    color: #7c6cff;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
}
.kk-add-btn:hover {
    background: rgba(124,108,255,0.15);
    border-color: #8b7fff;
    color: #8b7fff;
}

.kk-quick-bar {
    margin-bottom: 10px;
    max-height: 120px;
    overflow: visible;
}
.kk-cat-bar {
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
    margin-bottom: 4px;
    position: relative;
}
.kk-cat-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.05);
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.kk-cat-btn:hover { border-color: #7c6cff; color: #7c6cff; background: rgba(124,108,255,0.1); }
.kk-cat-btn .arrow { font-size: 10px; transition: transform 0.2s; }
.kk-cat-btn .arrow.open { transform: rotate(90deg); }
.kk-cat-popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 6px;
    background: rgba(30,28,60,0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    min-width: 180px;
    max-width: 280px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 500;
    padding: 6px 0;
}
.kk-cat-popup.show { display: block; }
.kk-pop-item {
    padding: 8px 14px;
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: background 0.15s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: relative;
}
.kk-pop-item:hover { background: rgba(124,108,255,0.15); color: #7c6cff; }
.kk-tip {
    display: none;
    position: fixed;
    background: #333;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    max-width: 280px;
    white-space: normal;
    line-height: 1.5;
    z-index: 999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    pointer-events: none;
}

.sys-prompt-btn {
    background: linear-gradient(135deg, #667eea, #7c6cff);
    color: #fff;
    border-color: #667eea;
}
.sys-prompt-btn:hover {
    background: linear-gradient(135deg, #5a6fd6, #6a5fe0);
    color: #fff;
    border-color: #5a6fd6;
}
.sys-prompt-popup {
    min-width: 360px;
    max-width: 480px;
    padding: 0;
    overflow: hidden;
}
.sys-tree {
    display: flex;
    min-height: 120px;
    max-height: 260px;
}
.sys-tree-left {
    width: 110px;
    min-width: 110px;
    border-right: 1px solid rgba(255,255,255,0.08);
    overflow-y: auto;
    padding: 6px 0;
    background: rgba(255,255,255,0.02);
    border-radius: 10px 0 0 10px;
}
.sys-tree-cat {
    padding: 8px 12px;
    font-size: 12px;
    color: rgba(255,255,255,0.55);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}
.sys-tree-cat .sys-cat-arrow {
    font-size: 8px;
    color: rgba(255,255,255,0.25);
    transition: color 0.15s;
}
.sys-tree-cat:hover {
    background: rgba(124,108,255,0.08);
    color: #7c6cff;
}
.sys-tree-cat:hover .sys-cat-arrow {
    color: #7c6cff;
}
.sys-tree-cat.active {
    background: rgba(124,108,255,0.15);
    color: #7c6cff;
    font-weight: 500;
}
.sys-tree-cat.active .sys-cat-arrow {
    color: #7c6cff;
}
.sys-tree-right {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}
.sys-tree-sent {
    padding: 8px 14px;
    font-size: 12px;
    color: rgba(255,255,255,0.65);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sys-tree-sent:hover {
    background: rgba(124,108,255,0.1);
    color: #7c6cff;
}


.ref-images-panel {
    margin-bottom: 8px;
}
.ref-images-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}
.ref-images-count {
    color: rgba(255,255,255,0.35);
}
.ref-images-panel-body {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-start;
}
.ref-images-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.ref-img-card {
    position: relative;
    width: 100px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0,0,0,0.2);
    cursor: pointer;
    transition: all 0.2s;
}
.ref-img-card:hover {
    border-color: #7c6cff;
    box-shadow: 0 0 8px rgba(124,108,255,0.2);
}
.ref-img-del {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(218,54,51,0.85);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    z-index: 5;
    display: none;
}
.ref-img-card:hover .ref-img-del {
    display: block;
}
.ref-img-del:hover {
    background: #f85149;
}
.ref-img-label {
    background: rgba(124,108,255,0.2);
    color: #7c6cff;
    text-align: center;
    padding: 3px 0;
    font-size: 11px;
    font-weight: bold;
}
.ref-img-thumb {
    width: 100px;
    height: 75px;
    object-fit: cover;
    display: block;
}
.ref-img-name {
    padding: 3px 6px;
    font-size: 9px;
    color: rgba(255,255,255,0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ref-upload-area {
    width: 100px;
    min-height: 110px;
    border: 2px dashed rgba(255,255,255,0.12);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255,255,255,0.02);
    flex-shrink: 0;
}
.ref-upload-area:hover {
    border-color: #7c6cff;
    background: rgba(124,108,255,0.06);
}
.ref-upload-plus {
    font-size: 22px;
    color: rgba(255,255,255,0.25);
    line-height: 1;
}
.ref-upload-text {
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    margin-top: 4px;
}
.ref-upload-area input {
    display: none;
}
.ref-img-loading {
    opacity: 0.7;
}
.ref-img-loading .ref-img-del {
    display: none;
}
.ref-img-error {
    opacity: 0.5;
    border-color: rgba(255,60,60,0.3);
}
.ref-img-error .ref-img-label {
    color: #ff6b6b;
    background: rgba(255,60,60,0.15);
}
.input-top {
    margin-bottom: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 12px 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 0 8px rgba(255,60,60,0.05), inset 0 0 4px rgba(255,60,60,0.02);
    animation: neonBorderPulse 4s ease-in-out infinite;
}
.ref-remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #ff4d4f;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.prompt-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    color: #fff;
    resize: none;
    min-height: 80px;
    max-height: 160px;
    padding: 8px 0;
    line-height: 1.6;
    background: transparent;
    width: 100%;
    animation: neonInputColor 6s ease-in-out infinite;
}
.prompt-input::placeholder {
    color: rgba(255,255,255,0.25);
    animation: neonPlaceholderColor 6s ease-in-out infinite;
}

@keyframes neonInputColor {
    0%, 100% { color: #fff; text-shadow: 0 0 6px rgba(255,60,60,0.2); }
    33% { color: #fff; text-shadow: 0 0 8px rgba(255,255,255,0.3); }
    66% { color: #fff; text-shadow: 0 0 8px rgba(255,215,0,0.3); }
}

@keyframes neonPlaceholderColor {
    0%, 100% { color: rgba(255,120,120,0.35); text-shadow: 0 0 6px rgba(255,60,60,0.15); }
    33% { color: rgba(255,255,255,0.35); text-shadow: 0 0 8px rgba(255,255,255,0.2); }
    66% { color: rgba(255,215,0,0.4); text-shadow: 0 0 8px rgba(255,215,0,0.2); }
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,60,60,0.12);
    flex-wrap: wrap;
    animation: neonBorderPulse 4s ease-in-out infinite;
}

.tool-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    user-select: none;
    position: relative;
    box-shadow: 0 0 6px rgba(255,60,60,0.06), inset 0 0 4px rgba(255,60,60,0.02);
    animation: neonBorderPulse 5s ease-in-out infinite;
}
.tool-item:hover { background: rgba(255,255,255,0.08); box-shadow: 0 0 10px rgba(255,60,60,0.12); }
.tool-item svg { width: 14px; height: 14px; }
.tool-item select {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
}

.send-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}
.cost-label {
    font-size: 12px;
    color: rgba(255,255,255,0.35);
}
.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff4d4d, #ffd700);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 0 12px rgba(255,60,60,0.25), 0 0 24px rgba(255,60,60,0.08);
    animation: neonBtnPulse 3s ease-in-out infinite;
}
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.send-btn svg { width: 18px; height: 18px; color: #fff; }

.lightbox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.lightbox.show { display: flex; }
.lightbox img {
    max-width: 90%;
    max-height: 85vh;
    border-radius: 8px;
}
.lightbox-close {
    position: absolute;
    top: 20px; right: 20px;
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-close:hover { background: rgba(255,255,255,0.3); }
.lightbox-download {
    position: absolute;
    bottom: 30px;
    padding: 10px 24px;
    background: linear-gradient(135deg, #667eea, #7c6cff);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.lightbox-download:hover { background: linear-gradient(135deg, #5a6fd6, #6a5fe0); }

.error-toast {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff4d4f;
    color: #fff;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 16px rgba(255,77,79,0.3);
}
.error-toast.show { display: block; animation: fadeInDown 0.3s; }
@keyframes fadeInDown { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* 自定义弹窗 */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.55); z-index: 9999;
    display: none; align-items: center; justify-content: center;
    animation: fadeIn .2s;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: #1a1a2e; border-radius: 16px; padding: 32px 28px 24px;
    width: 340px; text-align: center;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-icon { margin-bottom: 16px; }
.modal-icon svg { width: 44px; height: 44px; color: #4ecca3; }
.modal-message {
    font-size: 16px; color: rgba(255,255,255,0.85);
    margin-bottom: 24px; line-height: 1.6;
}
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-btn {
    padding: 10px 24px; border-radius: 10px; font-size: 14px;
    font-weight: 600; border: none; cursor: pointer;
    text-decoration: none; display: inline-flex; align-items: center;
    font-family: inherit; transition: all .2s;
}
.modal-btn-cancel {
    background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.6);
}
.modal-btn-cancel:hover { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.8); }
.modal-btn-confirm {
    background: #4ecca3; color: #0a0a1a;
}
.modal-btn-confirm:hover { background: #45b893; }

.load-more-indicator {
    text-align: center;
    padding: 16px;
    color: rgba(255,255,255,0.35);
    font-size: 13px;
}
.load-more-indicator .spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,0.1);
    border-top-color: #7c6cff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}
.red-link {
    color: red;
}
.gallery-card-generating {
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(-45deg, #0f2027, #203a43, #2c5364, #0f2027);
    background-size: 400% 400%;
    animation: genBgMove 4s ease infinite;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.gallery-card-generating::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent, rgba(64,224,208,0.15), transparent, rgba(0,206,209,0.15), transparent);
    animation: genRotate 6s linear infinite;
}
.gallery-card-generating::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(64,224,208,0.2) 0%, transparent 70%);
    animation: genPulse 2s ease-in-out infinite;
}
@keyframes genBgMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes genRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@keyframes genPulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}
.gallery-card-generating .gen-icon {
    position: relative;
    z-index: 1;
    width: 48px;
    height: 48px;
    border: 2px solid rgba(64,224,208,0.6);
    border-top-color: #40e0d0;
    border-radius: 50%;
    animation: genSpin 1s linear infinite;
    margin-bottom: 12px;
}
@keyframes genSpin {
    to { transform: rotate(360deg); }
}
.gallery-card-generating .gen-text {
    position: relative;
    z-index: 1;
    font-size: 13px;
    color: rgba(255,255,255,0.9);
    letter-spacing: 1px;
}

.login-prompt {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-prompt-card {
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px;
    padding: 48px 40px;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3), 0 0 80px rgba(255,60,60,0.06);
    animation: cardFadeIn 0.6s ease-out;
}

.result-panel {
    display: none;
    flex: 1;
    min-width: 0;
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 24px;
    overflow-y: auto;
    animation: resultPanelIn 0.5s cubic-bezier(0.4, 0, 0.2, 1), neonCardPulse 4s ease-in-out infinite;
    align-self: center;
    max-height: calc(100vh - 96px);
}

.main-content.split .result-panel {
    display: flex;
    flex-direction: column;
}

.result-panel::-webkit-scrollbar { width: 4px; }
.result-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

@keyframes resultPanelIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.result-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.result-gen-anim {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.result-gen-anim svg {
    position: relative;
    z-index: 2;
    color: rgba(124,108,255,0.8);
}

.result-gen-ring {
    position: absolute;
    inset: -8px;
    border: 2px solid transparent;
    border-top-color: #7c6cff;
    border-right-color: rgba(124,108,255,0.3);
    border-radius: 50%;
    animation: resultRingSpin 1.5s linear infinite;
}

.result-gen-ring.delay {
    inset: -16px;
    border-top-color: #40e0d0;
    border-right-color: rgba(64,224,208,0.3);
    animation-duration: 2.5s;
    animation-direction: reverse;
}

@keyframes resultRingSpin {
    to { transform: rotate(360deg); }
}

.result-gen-text {
    font-size: 15px;
    color: rgba(255,255,255,0.6);
    letter-spacing: 1px;
}

.result-image-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
}

.result-image-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}

.result-image-wrap img:hover {
    transform: scale(1.02);
}

.result-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
    justify-content: center;
    flex-shrink: 0;
}

.result-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    box-shadow: 0 0 8px rgba(255,60,60,0.06);
    animation: neonBorderPulse 5s ease-in-out infinite;
}

.result-action-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.2);
    box-shadow: 0 0 14px rgba(255,60,60,0.15);
}

.result-action-btn.primary {
    background: linear-gradient(135deg, #ff4d4d, #ffd700);
    border-color: transparent;
    color: #fff;
    animation: neonBtnPulse 3s ease-in-out infinite;
}

.result-action-btn.primary:hover {
    background: linear-gradient(135deg, #e64343, #e6c200);
    box-shadow: 0 0 20px rgba(255,60,60,0.4);
}

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

.result-gallery {
    margin-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 16px;
}

.result-gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.result-gallery-header span {
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    font-weight: 500;
}

.result-gallery-header a {
    font-size: 12px;
    color: #ff6b6b;
    text-decoration: none;
    text-shadow: 0 0 8px rgba(255,60,60,0.3);
    animation: neonTextPulse 4s ease-in-out infinite;
}

.result-gallery-header a:hover {
    text-decoration: underline;
}

.center-card-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #667eea, #7c6cff);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 20px rgba(255,60,60,0.3), 0 0 40px rgba(255,60,60,0.12);
    animation: neonLogoPulse 3s ease-in-out infinite;
}

@keyframes neonLogoPulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(255,60,60,0.3), 0 0 40px rgba(255,60,60,0.12); }
    33% { box-shadow: 0 4px 20px rgba(255,255,255,0.35), 0 0 50px rgba(255,255,255,0.15); }
    66% { box-shadow: 0 4px 20px rgba(255,215,0,0.35), 0 0 50px rgba(255,215,0,0.15), 0 0 80px rgba(255,180,0,0.06); }
}

@keyframes neonCardPulse {
    0%, 100% { box-shadow: 0 0 12px rgba(255,60,60,0.12), 0 0 24px rgba(255,60,60,0.05); }
    33% { box-shadow: 0 0 16px rgba(255,255,255,0.15), 0 0 32px rgba(255,255,255,0.06); }
    66% { box-shadow: 0 0 16px rgba(255,215,0,0.18), 0 0 32px rgba(255,215,0,0.07), 0 0 50px rgba(255,180,0,0.03); }
}

@keyframes neonBorderPulse {
    0%, 100% { border-color: rgba(255,60,60,0.18); }
    33% { border-color: rgba(255,255,255,0.25); }
    66% { border-color: rgba(255,215,0,0.25); }
}

@keyframes neonBtnPulse {
    0%, 100% { box-shadow: 0 0 12px rgba(255,60,60,0.25), 0 0 24px rgba(255,60,60,0.08); }
    33% { box-shadow: 0 0 16px rgba(255,255,255,0.3), 0 0 32px rgba(255,255,255,0.1); }
    66% { box-shadow: 0 0 16px rgba(255,215,0,0.3), 0 0 32px rgba(255,215,0,0.12); }
}

@keyframes neonTextPulse {
    0%, 100% { text-shadow: 0 0 10px rgba(255,60,60,0.4), 0 0 20px rgba(255,60,60,0.12); }
    33% { text-shadow: 0 0 14px rgba(255,255,255,0.5), 0 0 28px rgba(255,255,255,0.15); }
    66% { text-shadow: 0 0 14px rgba(255,215,0,0.5), 0 0 28px rgba(255,215,0,0.18); }
}

.center-card-title {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    letter-spacing: 1px;
    text-shadow: 0 0 20px rgba(255,60,60,0.25), 0 0 40px rgba(255,60,60,0.08);
    animation: neonTextPulse 4s ease-in-out infinite;
}

.center-card-subtitle {
    font-size: 13px;
    color: rgba(255,255,255,0.45);
    text-shadow: 0 0 12px rgba(64,224,208,0.15);
}

.send-btn.active {
    box-shadow: 0 0 16px rgba(124,108,255,0.5), 0 0 32px rgba(124,108,255,0.2);
}

.send-btn.active:hover {
    background: linear-gradient(135deg, #5a6fd6, #6a5fe0);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(124,108,255,0.6), 0 0 40px rgba(124,108,255,0.25);
}

.tool-item.active {
    background: rgba(124,108,255,0.15);
    border-color: #7c6cff;
    color: #7c6cff;
    box-shadow: 0 0 8px rgba(124,108,255,0.2), inset 0 0 8px rgba(124,108,255,0.05);
}

.input-top:focus-within {
    border-color: rgba(124,108,255,0.4);
    box-shadow: 0 0 16px rgba(124,108,255,0.15), 0 0 32px rgba(124,108,255,0.06), inset 0 0 8px rgba(124,108,255,0.05);
}

.result-panel {
    box-shadow: 0 8px 40px rgba(0,0,0,0.2), 0 0 60px rgba(64,224,208,0.05), 0 0 2px rgba(64,224,208,0.15);
}

@media (max-width: 900px) {
    .main-content.split {
        flex-direction: column;
        align-items: stretch;
        overflow-y: auto;
        height: auto;
        min-height: calc(100vh - 56px);
    }

    .main-content.split .center-card {
        max-width: 100%;
        width: 100%;
        flex-shrink: 0;
        align-self: stretch;
    }

    .main-content.split .result-panel {
        max-height: none;
        align-self: stretch;
        animation-name: resultPanelInMobile;
    }

    @keyframes resultPanelInMobile {
        from { opacity: 0; transform: translateY(20px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

@media (max-width: 768px) {
    .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .toolbar { gap: 6px; }
    .tool-item { padding: 5px 10px; font-size: 12px; }
    .center-card { padding: 28px 20px 20px; margin: 10px; }
    .center-card-title { font-size: 22px; }
    .input-top { padding: 10px 12px; }
    .result-actions { gap: 8px; }
    .result-action-btn { padding: 8px 14px; font-size: 12px; }
}