:root {
    --bg-color: #050b14;
    --card-bg: rgba(16, 28, 45, 0.7);
    --primary-color: #00f2ff;
    --secondary-color: #7000ff;
    --text-main: #e0f7ff;
    --text-dim: #64748b;
    --border-color: rgba(0, 242, 255, 0.2);
    --input-bg: rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    background-image:
        linear-gradient(rgba(0, 242, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 242, 255, 0.03) 1px, transparent 1px),
        radial-gradient(circle at 50% 0%, #1a2c4e 0%, #050b14 80%);
    background-size: 40px 40px, 40px 40px, 100% 100%;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    -webkit-tap-highlight-color: rgba(0, 242, 255, 0.1);
    -webkit-touch-callout: none;
}

.container {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    max-width: 900px;
    width: 100%;
    padding: 30px;
    position: relative;
    overflow: hidden;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
}

h1 {
    color: var(--text-main);
    margin-bottom: 20px;
    font-size: 2.2em;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 15px rgba(0, 242, 255, 0.5);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.btn-history {
    padding: 10px 20px;
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    background: rgba(0, 242, 255, 0.1);
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.4em;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Consolas', monospace;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.btn-history:hover {
    background: rgba(0, 242, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
    transform: translateY(-2px);
}

.btn-history:active {
    transform: translateY(0);
}

.form-group {
    margin-bottom: 25px;
}

label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Consolas', 'Monaco', monospace;
}

.label-hint {
    font-weight: normal;
    color: var(--text-dim);
    font-size: 0.8em;
    margin-left: 8px;
    text-transform: none;
}

.btn-paste {
    padding: 6px 12px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    background: rgba(0, 242, 255, 0.05);
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.75em;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Consolas', 'Monaco', monospace;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    white-space: nowrap;
}

.btn-paste:hover {
    background: rgba(0, 242, 255, 0.15);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
}

.btn-paste:active {
    transform: scale(0.95);
}

.btn-paste.success {
    background: rgba(0, 255, 100, 0.2);
    border-color: #00ff64;
    color: #00ff64;
}

.btn-paste.error {
    background: rgba(255, 50, 50, 0.2);
    border-color: #ff4d4d;
    color: #ff4d4d;
}

textarea {
    width: 100%;
    padding: 12px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    transition: all 0.3s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.1);
    background: rgba(0, 0, 0, 0.5);
}

textarea::placeholder {
    color: rgba(224, 247, 255, 0.3);
}

.ratio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

/* Model selection */
.model-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.model-btn {
    padding: 12px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(0, 242, 255, 0.05);
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    gap: 4px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.model-btn:hover {
    background: rgba(0, 242, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.model-btn.active {
    border-color: var(--primary-color);
    background: rgba(0, 242, 255, 0.15);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
}

.model-btn.active .model-name {
    color: var(--primary-color);
}

.model-name {
    font-family: 'Consolas', monospace;
    font-size: 0.9em;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.model-desc {
    font-size: 0.7em;
    color: var(--text-dim);
    font-family: 'Consolas', monospace;
}

.model-tag {
    background: rgba(112, 0, 255, 0.15);
    border-color: rgba(112, 0, 255, 0.3);
    color: #b07aff;
}

.ratio-btn {
    padding: 8px 5px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: rgba(0, 242, 255, 0.05);
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.3s;
    text-align: center;
    color: var(--text-main);
    font-family: 'Consolas', monospace;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.ratio-btn:hover {
    background: rgba(0, 242, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.ratio-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #000;
    font-weight: bold;
    box-shadow: 0 0 15px var(--primary-color);
}

.size-input-group {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 15px;
    transition: all 0.3s;
}

.input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.1);
}

.input-wrapper input {
    background: transparent;
    border: none;
    padding: 0;
    width: 100%;
    text-align: center;
    font-weight: 500;
    color: var(--text-main);
    font-family: 'Consolas', monospace;
    font-size: 1em;
}

.input-wrapper input:focus {
    outline: none;
}

.seed-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.seed-container input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    width: 100%;
    text-align: left;
    font-weight: 500;
    color: var(--text-main);
    font-family: 'Consolas', monospace;
    font-size: 1em;
    flex: 1;
}

.seed-container input:focus {
    outline: none;
}

.link-icon {
    color: var(--text-dim);
    font-size: 1.2em;
}

.unit {
    color: var(--text-dim);
    font-weight: 600;
    font-size: 0.8em;
    font-family: monospace;
}

.btn-random-seed {
    padding: 10px 20px;
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    background: transparent;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-random-seed:hover {
    background: rgba(0, 242, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.2);
}

.api-select {
    width: 100%;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    font-size: 0.9em;
    font-family: 'Consolas', monospace;
    cursor: pointer;
    transition: all 0.3s;
}

.api-select:hover {
    border-color: var(--primary-color);
    background: rgba(0, 0, 0, 0.5);
}

.api-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.1);
}

.api-select option {
    background: var(--card-bg);
    color: var(--text-main);
    padding: 10px;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.button-group button {
    flex: 1;
    padding: 12px 15px;
    font-size: 0.9em;
    white-space: nowrap;
}

button {
    flex: 1;
    padding: 14px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn-generate {
    background: linear-gradient(135deg, var(--secondary-color), #00c3ff);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 195, 255, 0.3);
}

.btn-generate::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: 0.5s;
}

.btn-generate:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 195, 255, 0.5);
}

.btn-generate:hover::before {
    left: 100%;
}

.btn-generate:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(100%);
}

.btn-cancel {
    background: rgba(255, 150, 0, 0.1);
    color: #ff9600;
    border: 1px solid #ff9600;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-cancel:hover:not(:disabled) {
    background: rgba(255, 150, 0, 0.2);
    box-shadow: 0 0 20px rgba(255, 150, 0, 0.3);
    transform: translateY(-2px);
}

.btn-cancel:active {
    transform: translateY(0);
    background: rgba(255, 150, 0, 0.3);
}

.btn-cancel:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.save-history-btn {
    background: rgba(0, 242, 255, 0.1);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.save-history-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: #000;
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.4);
    transform: translateY(-2px);
}

.save-history-btn.success {
    background: rgba(0, 255, 100, 0.2);
    border-color: #00ff64;
    color: #00ff64;
}

.save-history-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.loading {
    display: none;
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.loading.active {
    display: block;
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    position: relative;
    border: 3px solid transparent;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}

.spinner::before {
    content: "";
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--secondary-color);
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: var(--primary-color);
    font-family: 'Consolas', monospace;
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.result {
    display: none;
    margin-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 30px;
}

.result.active {
    display: block;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-title {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.1em;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-title::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
}

.image-container {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.result-image {
    width: 100%;
    height: auto;
    display: block;
}

.error {
    display: none;
    background: rgba(255, 50, 50, 0.1);
    color: #ff4d4d;
    padding: 12px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid #ff4d4d;
    font-family: monospace;
}

.error.active {
    display: block;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        background-size: 20px 20px, 20px 20px, 100% 100%;
    }

    .container {
        padding: 15px 12px;
        border-radius: 12px;
        max-width: 100%;
    }

    h1 {
        font-size: 1.5em;
        letter-spacing: 1px;
        margin-bottom: 15px;
    }

    .ratio-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .model-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .model-btn {
        padding: 10px 8px;
    }

    .model-name {
        font-size: 0.8em;
    }

    .model-desc {
        font-size: 0.65em;
    }

    .button-group {
        gap: 8px;
    }

    .button-group button {
        padding: 10px 8px;
        font-size: 0.85em;
    }
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #050b14;
}

::-webkit-scrollbar-thumb {
    background: #1a2c4e;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* 历史记录弹窗样式 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

.modal-content {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 0 60px rgba(0, 242, 255, 0.3);
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 242, 255, 0.03);
    flex-shrink: 0;
}

.modal-title {
    color: var(--primary-color);
    font-size: 1.5em;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Consolas', monospace;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}

.modal-close:active {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(0, 242, 255, 0.1);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.history-stats {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(0, 242, 255, 0.05);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 2em;
    color: var(--primary-color);
    font-weight: bold;
    font-family: 'Consolas', monospace;
}

.stat-label {
    font-size: 0.8em;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 5px;
}

.history-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.btn-clear-history {
    flex: 1;
    padding: 12px 20px;
    border: 1px solid #ff4d4d;
    border-radius: 8px;
    background: rgba(255, 50, 50, 0.1);
    color: #ff4d4d;
    cursor: pointer;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Consolas', monospace;
}

.btn-clear-history:active {
    background: rgba(255, 50, 50, 0.2);
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.history-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
}

.history-item:active {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.2);
}

.history-item-image {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.5);
}

.history-item-content {
    padding: 15px;
}

.history-item-prompt {
    color: var(--text-main);
    font-size: 0.85em;
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.history-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.meta-tag {
    font-size: 0.7em;
    padding: 3px 8px;
    background: rgba(0, 242, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--primary-color);
    font-family: 'Consolas', monospace;
}

.history-item-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.btn-history-action {
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: rgba(0, 242, 255, 0.05);
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.7em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-history-action:active {
    background: rgba(0, 242, 255, 0.15);
    border-color: var(--primary-color);
}

.btn-history-delete {
    background: rgba(255, 50, 50, 0.05);
    border-color: rgba(255, 50, 50, 0.3);
    color: #ff4d4d;
}

.btn-history-delete:active {
    background: rgba(255, 50, 50, 0.15);
    border-color: #ff4d4d;
}

.empty-history {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
}

.empty-history-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-history-text {
    font-size: 1.2em;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Consolas', monospace;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 0;
        align-items: stretch;
    }

    .modal-content {
        max-height: 100vh;
        height: 100%;
        border-radius: 0;
        max-width: 100%;
    }

    .modal-header {
        padding: 15px;
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--card-bg);
        backdrop-filter: blur(20px);
    }

    .modal-title {
        font-size: 1em;
        letter-spacing: 1px;
        gap: 5px;
    }

    .modal-close {
        width: 36px;
        height: 36px;
        font-size: 1.2em;
    }

    .modal-body {
        padding: 15px;
    }

    .history-stats {
        padding: 12px;
        margin-bottom: 15px;
    }

    .stat-value {
        font-size: 1.5em;
    }

    .stat-label {
        font-size: 0.7em;
    }

    .history-actions {
        gap: 10px;
        margin-bottom: 15px;
    }

    .btn-clear-history {
        padding: 10px 15px;
        font-size: 0.8em;
    }

    .history-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .history-item-image {
        height: auto;
        max-height: 167px;
    }

    .history-item-content {
        padding: 12px;
    }

    .history-item-prompt {
        font-size: 0.8em;
        margin-bottom: 8px;
    }

    .history-item-meta {
        gap: 6px;
        margin-bottom: 10px;
    }

    .meta-tag {
        font-size: 0.65em;
        padding: 2px 6px;
    }

    .history-item-actions {
        gap: 8px;
    }

    .btn-history-action {
        width: 24px;
        height: 24px;
        font-size: 0.75em;
    }

    .empty-history {
        padding: 40px 15px;
    }

    .empty-history-icon {
        font-size: 3em;
        margin-bottom: 15px;
    }

    .empty-history-text {
        font-size: 1em;
        letter-spacing: 1px;
    }
}

/* 小屏手机优化 */
@media (max-width: 480px) {
    .modal-title {
        font-size: 0.9em;
    }

    .history-stats {
        padding: 10px;
    }

    .stat-value {
        font-size: 1.3em;
    }

    .stat-label {
        font-size: 0.75em;
    }

    .history-item-actions {
        gap: 10px;
    }

    .btn-history-action {
        width: 27px;
        height: 27px;
        font-size: 0.8em;
    }
}

/* ========================================
   Recent Generations Section
   ======================================== */
.recent-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.recent-title {
    color: var(--primary-color);
    font-size: 1.1em;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Consolas', monospace;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.recent-title-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
}

.recent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.recent-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
}

.recent-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.2);
    transform: translateY(-3px);
}

.recent-item-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.recent-item-overlay {
    padding: 12px;
    background: rgba(0, 0, 0, 0.6);
}

.recent-item-prompt {
    color: var(--text-main);
    font-size: 0.75em;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    opacity: 0.9;
}

.recent-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 6px;
}

.recent-item-time {
    font-size: 0.65em;
    color: var(--text-dim);
    font-family: 'Consolas', monospace;
}

.recent-item-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.btn-recent-action {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: rgba(0, 242, 255, 0.08);
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.8em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-recent-action:hover {
    background: rgba(0, 242, 255, 0.2);
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.btn-recent-action.btn-delete {
    background: rgba(255, 50, 50, 0.08);
    border-color: rgba(255, 50, 50, 0.3);
    color: #ff4d4d;
}

.btn-recent-action.btn-delete:hover {
    background: rgba(255, 50, 50, 0.2);
    border-color: #ff4d4d;
}

/* 移动端适配 - 最近生成 */
@media (max-width: 768px) {
    .recent-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .recent-item-image {
        height: 140px;
    }

    .recent-item-overlay {
        padding: 8px;
    }

    .recent-item-prompt {
        font-size: 0.7em;
        -webkit-line-clamp: 1;
    }

    .recent-title {
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .recent-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .recent-item-image {
        height: 120px;
    }

    .btn-recent-action {
        width: 24px;
        height: 24px;
        font-size: 0.7em;
    }
}

/* ========================================
   Image Preview Overlay
   ======================================== */
.image-preview-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    flex-direction: column;
}

.image-preview-overlay.active {
    display: flex;
}

.image-preview-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    flex-shrink: 0;
}

.image-preview-close,
.image-preview-newtab {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    text-decoration: none;
    flex: none;
}

.image-preview-close:hover,
.image-preview-newtab:hover {
    background: rgba(0, 242, 255, 0.2);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.image-preview-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 10px;
    -webkit-overflow-scrolling: touch;
}

.image-preview-body img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
    -webkit-user-drag: none;
}

/* 可点击预览的图片添加指针样式 */
.result-image,
.recent-item-image,
.history-item-image {
    cursor: pointer;
}
