@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-dark: #0f050a;
    --bg-mesh: radial-gradient(at 0% 0%, hsla(328, 70%, 20%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(280, 70%, 20%, 1) 0, transparent 50%),
        radial-gradient(at 100% 100%, hsla(330, 80%, 15%, 1) 0, transparent 50%),
        radial-gradient(at 0% 100%, hsla(260, 80%, 15%, 1) 0, transparent 50%);

    --card-bg: rgba(25, 10, 15, 0.45);
    --card-border: rgba(236, 72, 153, 0.25);
    --card-hover: rgba(40, 10, 25, 0.75);

    --text-main: #fff0f5;
    --text-muted: #fbcfe8;

    --primary: #ec4899;
    /* Pink-500 */
    --primary-glow: rgba(236, 72, 153, 0.5);
    --accent: #e11d48;

    --glass: blur(20px);
    --radius: 28px;
    --transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    background-image: var(--bg-mesh);
    background-attachment: fixed;
    background-size: cover;
    color: var(--text-main);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    position: relative;
}

/* Baddie Background Pattern using multiple emojis in an SVG tile */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.08;
    /* Increased opacity for better visibility */
    /* Varied sizes: Big Kisses, Medium Nails, Mixed Lipstick */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 300 300'%3E%3Ctext x='20' y='70' font-size='80'%3E💋%3C/text%3E%3Ctext x='160' y='60' font-size='40'%3E💅%3C/text%3E%3Ctext x='80' y='180' font-size='60'%3E💄%3C/text%3E%3Ctext x='220' y='160' font-size='30'%3E💋%3C/text%3E%3Ctext x='50' y='260' font-size='50'%3E💅%3C/text%3E%3Ctext x='180' y='250' font-size='70'%3E💄%3C/text%3E%3Ctext x='250' y='80' font-size='25'%3E💅%3C/text%3E%3C/svg%3E");
    background-size: 300px 300px;
    /* Larger tile for more spread */
}

/* Secondary glow just for vibe */
body::after {
    content: "";
    position: fixed;
    top: 50%;
    left: 50%;
    width: 80vw;
    height: 80vh;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.15) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    z-index: -2;
    pointer-events: none;
}

.wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 24px;
}

/* Header */
header {
    text-align: center;
    padding: 60px 0 80px;
}

h1 {
    font-size: 4.5rem;
    font-weight: 800;
    margin: 0 0 16px;
    background: linear-gradient(to right, #f9a8d4, #e879f9, #f472b6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 20px rgba(236, 72, 153, 0.5));
    letter-spacing: -2px;
    line-height: 1.1;
}

.sub {
    font-size: 1.25rem;
    color: var(--text-muted);
    font-weight: 300;
    background: rgba(255, 255, 255, 0.05);
    display: inline-block;
    padding: 8px 24px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

/* Controls - The main fix for layout */
.controls {
    display: grid;
    grid-template-columns: 2fr 180px 180px 200px 80px;
    /* Search gets more space */
    gap: 16px;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: var(--glass);
    border: 1px solid var(--card-border);
    padding: 24px;
    border-radius: 36px;
    box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.5);
    margin-bottom: 50px;
    align-items: center;
}

/* Inputs & Buttons */
input,
select,
button {
    width: 100%;
    padding: 16px 24px;
    border-radius: 99px;
    border: 1px solid var(--card-border);
    background: rgba(10, 5, 8, 0.4);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
    height: 54px;
    /* Uniform height */
}

input:focus,
select:focus {
    border-color: var(--primary);
    background: rgba(10, 5, 8, 0.7);
    box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.15);
}

::placeholder {
    color: rgba(255, 240, 245, 0.4);
}

button {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    background: var(--primary);
    border: none;
    box-shadow: 0 8px 20px rgba(236, 72, 153, 0.3);
}

button:hover {
    transform: translateY(-2px);
    background: #be185d;
    box-shadow: 0 12px 30px rgba(236, 72, 153, 0.5);
}

button#reset {
    background: transparent;
    border: 1px solid var(--card-border);
    box-shadow: none;
    color: var(--text-muted);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    /* Icon size */
}

button#reset:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(236, 72, 153, 0.1);
}

/* Hashtag area */
.hashtag {
    display: flex;
    gap: 16px;
    background: rgba(255, 255, 255, 0.015);
    padding: 12px 20px;
    border-radius: 20px;
    max-width: 600px;
    margin: 0 auto 50px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.hashtag input {
    background: transparent;
    border: none;
    padding: 10px;
    height: auto;
}

.hashtag input:focus {
    box-shadow: none;
}

.hashtag button {
    width: auto;
    padding: 10px 30px;
    height: auto;
    font-size: 0.9rem;
}

/* Hot Today Section */
.hot-section {
    margin-bottom: 60px;
}

.hot-section h2 {
    font-size: 2rem;
    margin-bottom: 24px;
    background: linear-gradient(to right, #ff4d4d, #f9cb28);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    filter: drop-shadow(0 0 10px rgba(255, 77, 77, 0.4));
}

.hot-grid {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    padding-bottom: 30px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.hot-grid::-webkit-scrollbar {
    height: 8px;
}

.hot-grid::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 20px;
}

.hot-card {
    min-width: 280px;
    background: #1a0b10;
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.hot-card:hover {
    transform: scale(1.02);
    border-color: #ff4d4d;
    box-shadow: 0 15px 40px rgba(255, 77, 77, 0.2);
}

.hot-img {
    width: 100%;
    height: 320px;
    object-fit: cover;
    display: block;
}

.hot-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
}

.hot-info h3 {
    margin: 0;
    font-size: 1.5rem;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hot-info span {
    color: #ffdddd;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Grid System */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 32px;
    padding-bottom: 80px;
}

/* Card Design */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 32px 24px;
    border-bottom: 4px solid var(--card-border);
    /* Heavy bottom */
    position: relative;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: default;
}

.card:hover {
    transform: translateY(-12px);
    border-color: var(--primary);
    background: var(--card-hover);
    box-shadow: 0 20px 40px -10px rgba(236, 72, 153, 0.3);
    z-index: 10;
}

/* Rank Number in Background */
.card::after {
    content: attr(data-rank);
    position: absolute;
    top: 5px;
    right: 15px;
    font-size: 5rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.03);
    pointer-events: none;
    line-height: 1;
}

/* Card Image */
.card-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 20px;
    padding: 4px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.4s ease;
}

.card:hover .card-img {
    transform: scale(1.1) rotate(5deg);
}

/* Typography in Card */
.card h3 {
    margin: 0 0 4px;
    font-size: 1.35rem;
    color: #fff;
    font-weight: 700;
}

.u {
    color: var(--primary);
    font-size: 0.95rem;
    margin-bottom: 16px;
    font-family: monospace;
    opacity: 0.9;
}

/* Badges */
.badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 24px;
}

.badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

.card:hover .badge {
    background: rgba(236, 72, 153, 0.15);
    border-color: rgba(236, 72, 153, 0.3);
    color: #fff;
}

/* Card Actions */
.actions {
    margin-top: auto;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.actions a {
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 12px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    transition: var(--transition);
}

.actions a:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(236, 72, 153, 0.4);
}

.actions a.sec {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.actions a.sec:hover {
    border-color: var(--primary);
    background: transparent;
    color: var(--primary);
}

/* Stats Count */
#count {
    display: block;
    text-align: center;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Footer & Note */
#note {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 40px 0;
    opacity: 0.6;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
    .controls {
        grid-template-columns: 1fr 1fr;
    }

    .controls>*:nth-child(1) {
        grid-column: span 2;
    }

    /* Search full width */
}

@media (max-width: 640px) {
    h1 {
        font-size: 3rem;
    }

    .controls {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 12px;
        background: rgba(15, 5, 10, 0.8);
        /* Less transparent on mobile */
    }

    .controls>* {
        grid-column: span 1;
    }

    .card {
        flex-direction: row;
        text-align: left;
        align-items: center;
        padding: 16px;
    }

    .card-img {
        width: 80px;
        height: 80px;
        margin-bottom: 0;
        margin-right: 16px;
    }

    .card::after {
        display: none;
    }

    /* Hide big rank number on mobile */
    .card h3 {
        font-size: 1.2rem;
    }

    .badges {
        justify-content: flex-start;
    }

    .actions {
        display: none;
        /* Simplify card on mobile or keep? Let's keep simpler */
    }

    /* Let's keep actions but stack them less intrusively? 
       Actually user wants "beautiful layout", hiding actions might be bad.
       Let's stick to vertical cards on mobile for "Instagram" feel.
    */
    .card {
        flex-direction: column;
        text-align: center;
    }

    .card-img {
        margin-right: 0;
        margin-bottom: 16px;
    }

    .actions {
        display: grid;
    }
}