:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --success: #10b981;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Utilities */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0.5rem 1rem;
}

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

.hidden {
    display: none !important;
}

/* Header */
header {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Header layout: logo left, ad right */
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    width: 100%;
    padding: 0 1rem;
    box-sizing: border-box;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Keep the icon visible */
.logo svg {
    color: var(--primary);
}

/* Apply the gradient to the text only */
.logo .logo-text {
    background: linear-gradient(135deg, var(--primary) 0%, #a855f7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    min-width: 280px;
    margin-left: auto;
}

/* Header ad: keeps 728x90 on desktop, wraps nicely on smaller screens */
.ad-header {
    width: 728px;
    max-width: 100%;
    aspect-ratio: 728 / 90;
    height: auto;
    flex: 0 1 728px;
}

/* Ad container */
.ad-space {
    background-color: var(--card-bg);
    border: 1px dashed var(--border-color);
    border-radius: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Header promo banner (uses the 728x90 slot) */
.ad-banner {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    font-family: var(--font-sans);
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
}

.ad-accent-left {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    background-color: var(--ad-accent, #4169E1);
}

.ad-left-content {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: 10px;
}

.ad-icon-container {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-pin-icon {
    width: 36px;
    height: 36px;
    fill: var(--ad-icon, #DC143C);
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

.ad-text-content {
    display: flex;
    flex-direction: column;
}

.ad-headline {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    line-height: 1.1;
}

.ad-subtext {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
}

.ad-cta-button {
    background-color: var(--ad-button, #4169E1);
    color: white;
    text-decoration: none;
    padding: 10px 24px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(65, 105, 225, 0.3);
    transition: filter 0.2s;
    white-space: nowrap;
}

.ad-cta-button:hover {
    filter: brightness(0.92);
}

@media (max-width: 520px) {
    .ad-banner {
        padding: 0 12px;
    }

    .ad-headline {
        font-size: 16px;
    }

    .ad-cta-button {
        padding: 8px 14px;
        font-size: 12px;
    }
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 3rem;
}

.hero {
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.25rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Generator Card */
.generator-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    width: 100%;
    max-width: 800px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.tab-content {
    padding: 2rem;
    min-height: 300px;
}

/* Inputs */
.input-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
}

input[type="text"],
input[type="color"],
select {
    width: 100%;
    padding: 0.75rem;
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

input[type="color"] {
    width: 50px;
    height: 50px;
    padding: 0;
    border: none;
    cursor: pointer;
    background: none;
}

/* Upload Zone */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 1rem;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

/* Preview Section */
.preview-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.preview-box {
    background: #000;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 100px;
    min-height: 100px;
}

.preview-box img {
    max-width: 64px;
    height: auto;
}

.preview-info {
    flex: 1;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
    font-size: 1rem;
}

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

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

/* Stats */
.stats {
    margin-top: 4rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.stat-number {
    color: var(--text-main);
    font-weight: 700;
}

/* Footer */
footer {
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    margin-top: auto;
}

/* Spinner */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.5rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Emoji Grid */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
}

.emoji-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0.25rem;
    line-height: 1;
}

.emoji-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.emoji-btn.selected {
    background: var(--primary);
    border-color: var(--primary-hover);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}