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

:root {
    --sky-blue: #87CEEB;
    --sky-light: #B0E0E6;
    --positive: #22C55E;
    --negative: #EF4444;
    --text-dark: #1a1a2e;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);
}

body {
    font-family: 'Bricolage Grotesque', sans-serif;
    background: linear-gradient(180deg, var(--sky-blue) 0%, var(--sky-light) 100%);
    min-height: 100vh;
    color: var(--text-dark);
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    padding: 0.75rem 1rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.02em;
}

.tagline {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    position: relative;
}

/* Controls panel */
.controls-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1rem;
    width: 100%;
    max-width: 600px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.input-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.ticker-input {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
    text-align: center;
    max-width: 120px;
}

.ticker-input:focus {
    outline: none;
    border-color: var(--sky-blue);
    box-shadow: 0 0 0 4px rgba(135, 206, 235, 0.3);
}

.ticker-input::placeholder {
    color: #94a3b8;
    text-transform: uppercase;
}

.generate-btn {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%);
    color: var(--text-dark);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
    white-space: nowrap;
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.5);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.quick-select {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.quick-btn {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-dark);
}

.quick-btn:hover:not(:disabled) {
    border-color: var(--sky-blue);
    background: #f0f9ff;
}

.quick-btn.active {
    background: var(--sky-blue);
    border-color: var(--sky-blue);
    color: white;
}

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

.aspect-toggle {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.aspect-btn {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.35rem 0.7rem;
    background: transparent;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.aspect-btn.active {
    background: var(--text-dark);
    border-color: var(--text-dark);
    color: white;
}

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

/* Image container */
.image-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.1);
}

.image-container.1-1 {
    aspect-ratio: 1 / 1;
}

.image-container.16-9 {
    aspect-ratio: 16 / 9;
}

.image-container.9-16 {
    aspect-ratio: 9 / 16;
    max-width: 450px;
}

.generated-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, var(--sky-blue) 0%, var(--sky-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-content {
    text-align: center;
}

.building-animation {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 1rem;
}

.block {
    width: 20px;
    background: var(--glass-bg);
    border-radius: 4px;
    animation: buildUp 1.2s ease-in-out infinite;
}

.block-1 { height: 40px; animation-delay: 0s; }
.block-2 { height: 60px; animation-delay: 0.2s; }
.block-3 { height: 50px; animation-delay: 0.4s; }

@keyframes buildUp {
    0%, 100% { transform: scaleY(0.3); opacity: 0.5; }
    50% { transform: scaleY(1); opacity: 1; }
}

.loading-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

.progress-bar {
    width: 200px;
    height: 6px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    overflow: hidden;
    margin: 0 auto;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FBBF24, #F59E0B);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Stock badge */
.stock-badge {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    z-index: 20;
}

.badge-content {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.badge-ticker {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-dark);
    display: block;
}

.badge-date {
    font-size: 0.55rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.3rem;
}

.badge-price-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-price {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-dark);
}

.badge-change {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
}

.badge-change.positive {
    background: rgba(34, 197, 94, 0.15);
    color: var(--positive);
}

.badge-change.negative {
    background: rgba(239, 68, 68, 0.15);
    color: var(--negative);
}

/* Action buttons */
.action-buttons {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 20;
}

.action-btn {
    width: 40px;
    height: 40px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Error message */
.error-message {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    text-align: center;
}

.error-message p {
    font-size: 0.9rem;
    color: var(--negative);
    margin-bottom: 1rem;
}

.retry-btn {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    background: var(--text-dark);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

/* Footer */
.footer {
    padding: 0.75rem 1rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--glass-border);
    text-align: center;
}

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

.footer a {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 600;
}

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

/* Mobile responsiveness */
@media (max-width: 640px) {
    .header {
        padding: 0.5rem;
    }

    .title {
        font-size: 1.25rem;
    }

    .tagline {
        font-size: 0.65rem;
    }

    .main-content {
        padding: 0.75rem;
    }

    .controls-panel {
        padding: 0.75rem;
    }

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

    .ticker-input {
        max-width: 100%;
    }

    .generate-btn {
        width: 100%;
    }

    .quick-btn {
        font-size: 0.65rem;
        padding: 0.3rem 0.6rem;
    }

    .stock-badge {
        bottom: 0.5rem;
        left: 0.5rem;
    }

    .badge-content {
        padding: 0.5rem 0.7rem;
    }

    .badge-ticker {
        font-size: 0.6rem;
    }

    .badge-price {
        font-size: 0.55rem;
    }

    .action-buttons {
        bottom: 0.5rem;
        right: 0.5rem;
    }

    .action-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
}

@media (max-width: 380px) {
    .quick-select {
        gap: 0.3rem;
    }

    .quick-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.6rem;
    }
}