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

:root {
    --bg-primary: #0a0a0b;
    --bg-secondary: #141416;
    --bg-tertiary: #1c1c1f;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --border: #27272a;
    --success: #22c55e;
    --error: #ef4444;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background Gallery */
.bg-gallery {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
    opacity: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-top: 30px;
}

.bg-gallery-track {
    display: flex;
    gap: 20px;
    animation: scroll-left 60s linear infinite;
}

.bg-gallery-track.reverse {
    animation: scroll-right 60s linear infinite;
}

.bg-card {
    flex-shrink: 0;
    width: 220px;
    height: auto;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

@keyframes scroll-left {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes scroll-right {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(0); }
}

/* Container */
.container {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: 0 auto;
    padding: 48px 32px;
    background: rgba(10, 10, 11, 0.97);
    border-radius: 24px;
    margin-top: 32px;
    margin-bottom: 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
}

/* Header */
header {
    text-align: center;
    margin-bottom: 32px;
}

.badge {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 100px;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

header h1 {
    font-size: 2.75rem;
    font-weight: 800;
    margin-bottom: 12px;
    line-height: 1.1;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.125rem;
    max-width: 480px;
    margin: 0 auto;
}

/* Steps */
.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 100px;
}

.step-number {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 50%;
}

.step-text {
    font-size: 0.875rem;
    font-weight: 500;
}

.step-arrow {
    color: var(--text-secondary);
    font-size: 1.25rem;
}

@media (max-width: 500px) {
    .step-arrow {
        display: none;
    }
    .steps {
        gap: 8px;
    }
    header h1 {
        font-size: 2rem;
    }
}

/* Form */
form {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    backdrop-filter: blur(8px);
}

.form-group {
    margin-bottom: 24px;
}

.form-group:last-of-type {
    margin-bottom: 32px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 500px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

input, select {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

input::placeholder {
    color: var(--text-secondary);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.style-suggestion {
    font-size: 0.75rem;
    color: var(--success);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

button[type="submit"] {
    width: 100%;
    padding: 16px 24px;
    font-size: 1.0625rem;
    font-weight: 600;
    font-family: inherit;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

button[type="submit"]:hover {
    background: var(--accent-hover);
}

button[type="submit"]:active {
    transform: scale(0.98);
}

button[type="submit"]:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-text, .btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

/* Result */
.result {
    margin-top: 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
}

.result h2 {
    font-size: 1.25rem;
    margin-bottom: 24px;
}

.image-container {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
}

.image-container img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.9375rem;
    font-weight: 600;
    background: var(--success);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: opacity 0.2s;
}

.btn-download:hover {
    opacity: 0.9;
}

.btn-regenerate, .btn-retry {
    padding: 12px 24px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-regenerate:hover, .btn-retry:hover {
    background: var(--border);
}

/* Error */
.error {
    margin-top: 32px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.error p {
    color: var(--error);
    margin-bottom: 16px;
}

/* Social Proof */
.social-proof {
    margin-top: 48px;
    text-align: center;
}

.counter {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.counter-number {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.counter-label {
    color: var(--text-secondary);
    font-size: 1rem;
}

.use-cases {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.credits-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 100px;
}

.credits-count {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--accent);
}

.credits-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.btn-my-covers {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    margin-right: 12px;
    transition: background 0.2s, border-color 0.2s;
}

.btn-my-covers:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
}

.btn-buy-credits {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 8px;
}

.free-badge {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 100px;
    margin-right: 12px;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 0 16px rgba(16, 185, 129, 0.7); }
}

.btn-signin, .btn-signout {
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-signin:hover, .btn-signout:hover {
    background: var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

#userEmail {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 100%;
    position: relative;
}

.modal-content.pricing-modal {
    max-width: 750px;
}

.modal-content.pricing-modal h2 {
    text-align: center;
    margin-bottom: 24px;
}

.modal-pricing {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

@media (max-width: 700px) {
    .modal-pricing {
        grid-template-columns: repeat(2, 1fr);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.auth-subtitle {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.btn-google {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    background: white;
    color: #333;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: background 0.2s;
}

.btn-google:hover {
    background: #f0f0f0;
}

.divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.divider span {
    padding: 0 16px;
}

#emailAuthForm input {
    margin-bottom: 12px;
}

.btn-email {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.auth-toggle {
    text-align: center;
    margin-top: 24px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.auth-toggle a {
    color: var(--accent);
    text-decoration: none;
    margin-left: 4px;
}

/* My Covers Section */
.my-covers {
    margin-top: 64px;
    text-align: center;
}

.my-covers h2 {
    font-size: 1.5rem;
    margin-bottom: 24px;
}

.covers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.cover-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
}

.cover-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

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

.cover-item-info {
    padding: 12px;
}

.cover-item-title {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cover-item-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.cover-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.cover-item-actions a {
    flex: 1;
    padding: 6px;
    font-size: 0.75rem;
    text-align: center;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.2s;
}

.cover-item-actions a:hover {
    background: var(--accent);
}

.no-covers {
    color: var(--text-secondary);
    padding: 32px;
}

/* Pricing Section */
.pricing {
    margin-top: 64px;
    text-align: center;
}

.pricing h2 {
    font-size: 1.5rem;
    margin-bottom: 32px;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 700px) {
    .pricing-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.price-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 180px;
}

.price-card .btn-buy {
    margin-top: auto;
}

.price-card.popular {
    border-color: var(--accent);
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.1) 0%, var(--bg-secondary) 100%);
}

.popular-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.price-amount {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.price-credits {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 4px;
}

.price-per {
    color: var(--success);
    font-size: 0.75rem;
    margin-bottom: 16px;
}

.btn-buy {
    width: 100%;
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-buy:hover {
    background: var(--border);
}

.price-card.popular .btn-buy {
    background: var(--accent);
    border-color: var(--accent);
}

.price-card.popular .btn-buy:hover {
    background: var(--accent-hover);
}

#btnCredits {
    opacity: 0.7;
    font-weight: 400;
}

/* Footer */
footer {
    margin-top: 64px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

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

footer a:hover {
    text-decoration: underline;
}
