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

:root {
    --bg: #0a0a0b;
    --surface: #141416;
    --surface-2: #1c1c1f;
    --border: #2a2a2e;
    --text: #fafafa;
    --text-secondary: #888;
    --accent: #7c3aed;
    --accent-hover: #8b5cf6;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    font-size: 2rem;
}

.logo-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
}

.tagline {
    color: var(--text-secondary);
}

/* Main layout */
main {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 3rem;
    flex: 1;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.optional {
    font-weight: 400;
    opacity: 0.6;
}

.input-group input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--text);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.input-group input::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

/* Templates */
.templates label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.template-btn {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
}

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

.template-btn.active {
    border-color: var(--accent);
    background: rgba(124, 58, 237, 0.1);
}

.template-btn span {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.template-preview {
    width: 100%;
    aspect-ratio: 1200/630;
    border-radius: 4px;
}

.gradient-preview {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.dark-preview {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.minimal-preview {
    background: #fafafa;
}

.bold-preview {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.tech-preview {
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
}

/* Download button */
.download-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s, transform 0.1s;
    margin-top: auto;
}

.download-btn:hover {
    background: var(--accent-hover);
}

.download-btn:active {
    transform: scale(0.98);
}

/* Preview */
.preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.preview-wrapper {
    width: 100%;
    max-width: 600px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.preview {
    width: 1200px;
    height: 630px;
    transform-origin: top left;
    transform: scale(0.5);
    margin-bottom: -315px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.preview-content {
    text-align: center;
    z-index: 1;
    max-width: 900px;
}

.preview h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 72px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 24px;
    word-wrap: break-word;
}

.preview p {
    font-size: 32px;
    opacity: 0.9;
    line-height: 1.4;
}

.preview-decoration {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.preview-size {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Template styles */
.template-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.template-gradient .preview-decoration::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.template-dark {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
}

.template-dark .preview-decoration::before {
    content: '';
    position: absolute;
    bottom: -100px;
    left: -100px;
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), transparent);
    border-radius: 50%;
}

.template-dark .preview-decoration::after {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, rgba(118, 75, 162, 0.2), transparent);
    border-radius: 50%;
}

.template-minimal {
    background: #fafafa;
    color: #1a1a1a;
}

.template-minimal .preview-decoration::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.template-bold {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.template-bold .preview-decoration::before {
    content: '';
    position: absolute;
    top: 40px;
    left: 40px;
    right: 40px;
    bottom: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-radius: 20px;
}

.template-tech {
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    color: #00ff88;
}

.template-tech h1 {
    font-family: 'Space Grotesk', monospace;
    text-shadow: 0 0 30px rgba(0, 255, 136, 0.5);
}

.template-tech p {
    color: rgba(0, 255, 136, 0.7);
}

.template-tech .preview-decoration::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        linear-gradient(90deg, transparent 49.5%, rgba(0,255,136,0.03) 49.5%, rgba(0,255,136,0.03) 50.5%, transparent 50.5%),
        linear-gradient(0deg, transparent 49.5%, rgba(0,255,136,0.03) 49.5%, rgba(0,255,136,0.03) 50.5%, transparent 50.5%);
    background-size: 60px 60px;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

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

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

/* Responsive */
@media (max-width: 900px) {
    main {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .preview {
        transform: scale(0.4);
        margin-bottom: -378px;
    }

    .preview-wrapper {
        max-width: 480px;
    }

    .template-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 600px) {
    .app {
        padding: 1rem;
    }

    .preview {
        transform: scale(0.28);
        margin-bottom: -454px;
    }

    .preview-wrapper {
        max-width: 336px;
    }

    .template-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
