:root {
    /* Colors - Dark Theme (Royal Purple Edition) */
    --bg-primary: #0f0a14;
    /* Dark purple-black */
    --bg-secondary: #1a1221;
    /* Slightly lighter purple */
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --bg-glass: rgba(139, 92, 246, 0.05);
    /* Purple tint */

    /* Accent Colors - Royal Purple */
    --accent-primary: #9333ea;
    /* Purple 600 */
    --accent-secondary: #c084fc;
    /* Purple 400 */
    --accent-gradient: linear-gradient(135deg, #7e22ce 0%, #9333ea 50%, #db2777 100%);
    /* Deep Purple to Pink */
    --accent-glow: rgba(147, 51, 234, 0.5);

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.75);
    --text-muted: rgba(255, 255, 255, 0.5);

    /* Border Colors */
    --border-color: rgba(139, 92, 246, 0.15);
    /* Purple tint border */
    --shadow-glow: 0 0 30px var(--accent-glow);

    /* Fonts - Include Noto Color Emoji for Flags */
    --font-family: 'Inter', 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;

    --header-height: 64px;
    --sidebar-width: 160px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

/* Import Noto Color Emoji from Google Fonts (shim) or system fallback */
@import url('https://fonts.googleapis.com/css2?family=Noto+Color+Emoji&display=swap');

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* In-Feed Ad Styles */
.in-feed-ad {
    grid-column: 1 / -1;
    /* Span full width of grid */
    background: var(--bg-glass);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 100px;
    color: var(--text-muted);
}

/* Skin Tone Popup */
.skin-tone-popup {
    position: absolute;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 6px;
    display: flex;
    gap: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 200;
    animation: fadeIn 0.15s ease-out;
    transform: translate(-50%, -120%);
    /* Center above the emoji */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -110%) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -120%) scale(1);
    }
}

.skin-tone-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition-fast);
    background: var(--bg-glass);
}

.skin-tone-option:hover {
    transform: scale(1.2);
    background: var(--bg-card-hover);
    z-index: 10;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(15, 10, 20, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    height: var(--header-height);
    display: flex;
    align-items: center;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-icon {
    font-size: 1.8rem;
}

.logo h1 {
    font-size: 1.4rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    gap: 24px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
}

/* Main Layout with Sidebars */
.main-layout {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding-top: var(--header-height);
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    padding: 20px 10px;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
}

.main-content {
    flex: 1;
    max-width: 900px;
    min-width: 0;
    padding: 20px;
}

/* Ad Units */
.ad-unit {
    background: var(--bg-glass);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.ad-vertical {
    width: 100%;
    height: 600px;
    position: sticky;
    top: 100px;
}

/* Hero */
.hero {
    text-align: center;
    padding: 30px 0 20px;
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Search */
.search-container {
    max-width: 500px;
    margin: 0 auto;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 4px;
    transition: var(--transition-normal);
}

.search-box:focus-within {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.search-icon {
    position: absolute;
    left: 20px;
    font-size: 1.1rem;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 14px 16px 14px 50px;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: var(--font-family);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.clear-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    margin-right: 8px;
    transition: var(--transition-fast);
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Sticky Category Tabs */
.category-tabs {
    position: sticky;
    top: var(--header-height);
    z-index: 50;
    background: rgba(15, 10, 20, 0.95);
    backdrop-filter: blur(20px);
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.category-tab {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 8px 16px;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.category-tab:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
}

.category-tab.active {
    background: var(--accent-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.tab-icon {
    font-size: 1.1rem;
}

/* Recently Used */
.recently-used {
    padding: 20px 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.clear-recent-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition-fast);
}

.clear-recent-btn:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.recent-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Category Sections */
.all-categories {}

.emoji-category-section {
    padding: 20px 0;
    scroll-margin-top: calc(var(--header-height) + 60px);
}

.emoji-category-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

/* Emoji Grid */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 6px;
}

.emoji-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    background: var(--bg-glass);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.emoji-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    transform: scale(1.15);
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.emoji-item:active {
    transform: scale(0.95);
}

.emoji-item.copied {
    animation: copyPulse 0.3s ease;
}

@keyframes copyPulse {
    50% {
        transform: scale(1.2);
        background: var(--accent-primary);
    }
}

/* About Section */
.about-section {
    padding: 40px 0;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.about-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: var(--transition-normal);
}

.about-card:hover {
    border-color: var(--accent-primary);
}

.about-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.about-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.about-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 30px 20px;
    text-align: center;
}

.footer-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
}

.footer-links a:hover {
    color: var(--accent-primary);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent-gradient);
    padding: 12px 24px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: var(--transition-normal);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-emoji {
    font-size: 1.3rem;
}

.toast-text {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Search Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-results .emoji-large {
    font-size: 3rem;
    margin-bottom: 16px;
}

.no-results h4 {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.search-results-section {
    padding: 20px 0;
}

/* Responsive */
@media (max-width: 1200px) {
    .sidebar {
        display: none;
    }

    .main-content {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .nav {
        display: none;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .category-tab .tab-text {
        display: none;
    }

    .category-tab {
        padding: 8px 12px;
    }

    .emoji-grid {
        grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
    }

    .emoji-item {
        font-size: 1.4rem;
    }

    .about-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.5rem;
    }

    .emoji-grid {
        grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
    }

    .emoji-item {
        font-size: 1.2rem;
    }
}