* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0d0d0d;
    color: #e8e8e8;
    font-family: 'Space Grotesk', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

:root {
    --accent: #6c5ce7;
    --accent-light: #a29bfe;
    --accent-glow: rgba(108, 92, 231, 0.3);
    --success: #00cec9;
    --warning: #fdcb6e;
    --danger: #ff7675;
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-input: #0f3460;
    --border: rgba(108, 92, 231, 0.2);
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0b0;
    --text-muted: #6c6c80;
}

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

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

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 5px var(--accent-glow); }
    50% { box-shadow: 0 0 20px var(--accent-glow), 0 0 40px rgba(108, 92, 231, 0.1); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

@keyframes confetti-fall {
    0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.animate-in {
    animation: fadeIn 0.4s ease-out;
}

.animate-slide-up {
    animation: slideUp 0.5s ease-out;
}

/* Layout */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.app-title {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--accent-light), var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mint-counter {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
}

.mint-counter span {
    color: var(--accent-light);
    font-weight: 700;
}

/* Panels */
.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    animation: fadeIn 0.4s ease-out;
}

.panel-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Form inputs */
.input-field {
    width: 100%;
    background: rgba(15, 52, 96, 0.4);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    outline: none;
}

.input-field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-field::placeholder {
    color: var(--text-muted);
}

textarea.input-field {
    resize: vertical;
    min-height: 80px;
}

.select-field {
    width: 100%;
    background: rgba(15, 52, 96, 0.4);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c5ce7' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.select-field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Trait System */
.trait-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(108, 92, 231, 0.1);
    border-radius: 8px;
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease-out;
}

.trait-row:hover {
    border-color: var(--border);
}

.trait-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(108, 92, 231, 0.2);
    border-radius: 2px;
    outline: none;
    flex: 1;
}

.trait-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 6px var(--accent-glow);
}

.trait-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 6px var(--accent-glow);
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--accent), #5a4bd1);
    border: none;
    border-radius: 10px;
    color: white;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent-light);
}

.btn-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(255, 118, 117, 0.3);
    border-radius: 6px;
    color: var(--danger);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-icon:hover {
    background: rgba(255, 118, 117, 0.1);
    border-color: var(--danger);
}

.btn-add-trait {
    padding: 8px 14px;
    background: rgba(108, 92, 231, 0.1);
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--accent-light);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-align: center;
}

.btn-add-trait:hover {
    background: rgba(108, 92, 231, 0.2);
    border-color: var(--accent);
}

/* Preview Card */
.preview-container {
    position: relative;
    aspect-ratio: 1/1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-placeholder {
    text-align: center;
    color: var(--text-muted);
}

.preview-placeholder .icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.preview-placeholder p {
    font-size: 0.85rem;
}

/* NFT Meta Card */
.nft-meta {
    margin-top: 16px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.nft-meta-name {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.nft-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 0.8rem;
}

.nft-meta-label {
    color: var(--text-muted);
}

.nft-meta-value {
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
}

.nft-meta-value.price {
    color: var(--success);
    font-weight: 600;
}

/* Rarity Badges */
.rarity-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.rarity-common { background: rgba(150,150,150,0.15); color: #aaa; border: 1px solid rgba(150,150,150,0.3); }
.rarity-rare { background: rgba(0,206,201,0.15); color: var(--success); border: 1px solid rgba(0,206,201,0.3); }
.rarity-epic { background: rgba(108,92,231,0.15); color: var(--accent-light); border: 1px solid rgba(108,92,231,0.3); }
.rarity-legendary { background: rgba(253,203,110,0.15); color: var(--warning); border: 1px solid rgba(253,203,110,0.3); }

/* Trait Tags */
.trait-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(108, 92, 231, 0.1);
    border: 1px solid rgba(108, 92, 231, 0.2);
    border-radius: 20px;
    font-size: 0.7rem;
    color: var(--accent-light);
    margin: 2px;
}

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

.gallery-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: fadeIn 0.4s ease-out;
}

.gallery-item:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.gallery-item img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
}

.gallery-item-info {
    padding: 10px;
}

.gallery-item-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.65rem;
}

.gallery-item-price {
    color: var(--success);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

/* Loading */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.loading-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

/* Tabs */
.tab-bar {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-secondary);
}

.tab-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px var(--accent-glow);
}

/* Output action buttons (Download, Regenerate, Copy) */
.output-action-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.output-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.output-action-btn.download-btn {
    background: rgba(0, 206, 201, 0.1);
    border-color: rgba(0, 206, 201, 0.3);
    color: var(--success);
}

.output-action-btn.download-btn:hover {
    background: rgba(0, 206, 201, 0.2);
    border-color: var(--success);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 206, 201, 0.2);
}

.output-action-btn.regen-btn {
    background: rgba(108, 92, 231, 0.1);
    border-color: rgba(108, 92, 231, 0.3);
    color: var(--accent-light);
}

.output-action-btn.regen-btn:hover {
    background: rgba(108, 92, 231, 0.2);
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.output-action-btn.copy-btn {
    background: rgba(253, 203, 110, 0.08);
    border-color: rgba(253, 203, 110, 0.3);
    color: var(--warning);
}

.output-action-btn.copy-btn:hover {
    background: rgba(253, 203, 110, 0.15);
    border-color: var(--warning);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(253, 203, 110, 0.15);
}

.output-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Full view image container */
.preview-container.full-view {
    aspect-ratio: auto;
    max-height: 500px;
}

.preview-container.full-view img.generated-image-full {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
}

/* Action buttons row */
.action-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.action-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.action-btn:hover {
    border-color: var(--accent);
    color: var(--accent-light);
}

.action-btn.danger:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.action-btn.favorited {
    border-color: rgba(253, 203, 110, 0.4);
    color: var(--warning);
    background: rgba(253, 203, 110, 0.05);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 24px;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    animation: slideUp 0.3s ease-out;
}

/* Drop zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.drop-zone:hover {
    border-color: var(--accent);
    background: rgba(108, 92, 231, 0.05);
}

.drop-zone-active {
    border-color: var(--accent);
    background: rgba(108, 92, 231, 0.1);
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 32px 0 16px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

.app-footer p {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-bottom: 8px;
}

.app-footer a {
    color: var(--accent-light);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s;
}

.app-footer a:hover {
    color: var(--accent);
}

/* Confetti */
.confetti-particle {
    position: fixed;
    pointer-events: none;
    animation: confetti-fall 2s ease-out forwards;
    z-index: 200;
}

/* Keyboard Shortcuts */
.shortcuts-trigger {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(108, 92, 231, 0.1);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.shortcuts-trigger:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    background: rgba(108, 92, 231, 0.2);
}

.shortcuts-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 24px;
    animation: fadeIn 0.15s ease-out;
}

.shortcuts-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: 14px;
    padding: 24px 28px;
    max-width: 400px;
    width: 100%;
    animation: slideUp 0.25s ease-out;
    box-shadow: 0 20px 60px rgba(108, 92, 231, 0.2), 0 0 0 1px rgba(108, 92, 231, 0.1);
}

.shortcuts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.shortcuts-header span {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent-light);
}

.shortcuts-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.shortcuts-close:hover {
    color: var(--danger);
    background: rgba(255, 118, 117, 0.1);
}

.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.shortcut-item kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--accent-light);
    box-shadow: 0 2px 0 rgba(108, 92, 231, 0.15);
    white-space: nowrap;
}

.shortcut-item span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.shortcuts-note {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.85rem;
}

/* Section divider */
.section-divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}