:root {
    /* Colors */
    --bg-dark: #0f0a1e;
    --bg-card: #1a1429;
    --primary: #a855f7;
    /* Purple */
    --primary-glow: #c084fc;
    --secondary: #fbbf24;
    /* Gold */
    --secondary-glow: #fde047;
    --text-main: #ffffff;
    --text-muted: #94a3b8;

    /* Fonts */
    --font-heading: 'Cinzel', serif;
    --font-body: 'Outfit', sans-serif;

    /* Spacing (Converted to vh, approx 1rem = 1.6vh) */
    --spacing-xs: 0.8vh;
    /* 0.5rem */
    --spacing-sm: 1.6vh;
    /* 1rem */
    --spacing-md: 3.2vh;
    /* 2rem */
    --spacing-lg: 6.4vh;
    /* 4rem */

    /* Effects */
    --shadow-glow: 0 0 2vh rgba(168, 85, 247, 0.5);
    --border-radius: 1.6vh;
    /* 16px */
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

ul {
    list-style: none;
}

/* Typography */
h1,
h2,
h3 {
    font-family: var(--font-heading);
    color: var(--text-main);
    font-weight: 700;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-glow), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Layout */
.app-container {
    max-width: 140vh;
    /* 1400px -> 140vh */
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) 0;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 10, 30, 0.8);
    backdrop-filter: blur(1vh);
}

.logo {
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: 2.4vh;
    /* 1.5rem */
    color: var(--primary);
    text-shadow: 0 0 1vh rgba(251, 191, 36, 0.5);
    display: flex;
    align-items: center;
    gap: 0.8vh;
}

.logo-img {
    height: 4vh;
    /* 40px */
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 0.5vh rgba(168, 85, 247, 0.5));
}

.nav-links {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
}

.nav-links a:not(.btn) {
    font-weight: 600;
    position: relative;
    font-size: 1.6vh;
    /* Implicit base size */
}

.nav-links a:not(.btn):hover {
    color: var(--primary-glow);
}

/* Buttons */
.btn {
    padding: 1.2vh 2.4vh;
    /* 0.75rem 1.5rem */
    border-radius: 5vh;
    /* 50px */
    font-weight: 700;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.8vh;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 1.6vh;
}

.btn:hover {
    transform: translateY(-0.2vh);
    box-shadow: var(--shadow-glow);
}

.btn-primary {
    background: var(--primary);
    color: white;
    background: linear-gradient(135deg, var(--primary), #7e22ce);
}

.btn-secondary {
    background: transparent;
    border: 0.2vh solid var(--primary);
    /* 2px */
    color: var(--primary);
}

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

.btn-icon {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 1.2vh;
    border-radius: 50%;
    font-size: 1.6vh;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon svg {
    width: 2.4vh;
    height: 2.4vh;
}

/* Contract Address Container */
.ca-banner {
    display: flex;
    justify-content: center;
    padding: 1.2vh 0;
    margin-bottom: 1.6vh;
}

.ca-content {
    display: inline-flex;
    align-items: center;
    gap: 1vh;
    background: rgba(26, 20, 41, 0.6);
    backdrop-filter: blur(1vh);
    border: 0.1vh solid rgba(168, 85, 247, 0.3);
    border-radius: 1.2vh;
    padding: 1vh 1.6vh;
}

.ca-label {
    font-weight: 600;
    color: var(--secondary);
    font-size: 1.4vh;
    white-space: nowrap;
}

.ca-address {
    background: rgba(0, 0, 0, 0.4);
    padding: 0.6vh 1.2vh;
    border-radius: 0.6vh;
    border: 0.1vh solid rgba(168, 85, 247, 0.2);
    color: var(--text-main);
    font-family: 'Courier New', monospace;
    font-size: 1.3vh;
    letter-spacing: 0.05em;
    max-width: 40vh;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ca-copy-btn {
    background: var(--primary);
    border: none;
    padding: 0.6vh 1.2vh;
    border-radius: 0.6vh;
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4vh;
    transition: all 0.3s ease;
    font-size: 1.3vh;
}

.ca-copy-btn:hover {
    background: var(--primary-glow);
    transform: translateY(-0.2vh);
    box-shadow: 0 0 1.5vh rgba(168, 85, 247, 0.6);
}

.ca-copy-btn i {
    width: 1.6vh;
    height: 1.6vh;
}

.ca-copy-btn.copied {
    background: #10b981;
}


/* Hero Section */
.hero {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg) 0;
}

.hero-content {
    flex: 1;
    max-width: 60vh;
    /* 600px */
}

.hero-title {
    font-size: 6.4vh;
    /* 4rem */
    line-height: 1.1;
    margin-bottom: var(--spacing-md);
}

.hero-subtitle {
    font-size: 2vh;
    /* 1.25rem */
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
    max-width: 45vh;
    /* 450px */
}

.hero-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.hero-visual {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.floating-prop {
    width: 60vh;
    /* 600px */
    height: auto;
    filter: drop-shadow(0 0 2vh rgba(251, 191, 36, 0.4));
    animation: pimpFloat 4s ease-in-out infinite;
}

@keyframes pimpFloat {
    0% {
        transform: translateY(0vh) rotate(15deg);
    }

    50% {
        transform: translateY(-3vh) rotate(25deg);
    }

    100% {
        transform: translateY(0vh) rotate(15deg);
    }
}

/* Pimpifier Section */
.pimpifier-section {
    padding: var(--spacing-lg) 0;
    text-align: center;
    scroll-margin-top: 12vh;
}

.section-header {
    margin-bottom: var(--spacing-lg);
}

.section-header h2 {
    font-size: 4.8vh;
    /* 3rem */
    margin-bottom: var(--spacing-xs);
    color: var(--secondary);
}

.section-header p {
    font-size: 1.6vh;
}

.pimp-tool-container {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    max-width: 80vh;
    /* 800px */
    margin: 0 auto;
    border: 0.1vh solid rgba(168, 85, 247, 0.2);
    min-height: 40vh;
    /* 400px */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.mode-toggle {
    display: flex;
    gap: 1.6vh;
    margin-bottom: var(--spacing-md);
    background: rgba(0, 0, 0, 0.3);
    padding: 0.8vh;
    border-radius: 5vh;
}

.mode-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.8vh 2.4vh;
    border-radius: 5vh;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.8vh;
    font-size: 1.6vh;
}

.mode-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 1.5vh rgba(168, 85, 247, 0.4);
}

.mode-btn:hover:not(.active) {
    color: white;
}

.upload-zone {
    border: 0.2vh dashed var(--primary);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    width: 100%;
    cursor: pointer;
    transition: background 0.3s;
}

.upload-zone:hover {
    background: rgba(168, 85, 247, 0.1);
}

.upload-icon {
    width: 4.8vh;
    /* 48px */
    height: 4.8vh;
    color: var(--primary);
    margin-bottom: var(--spacing-sm);
}

.upload-zone h3 {
    font-size: 2vh;
    /* approx 1.25rem */
}

.upload-zone p {
    font-size: 1.6vh;
}

.preview-zone {
    width: 100%;
}

.canvas-wrapper {
    position: relative;
    margin-bottom: var(--spacing-md);
    border-radius: var(--border-radius);
    overflow: hidden;
    max-width: 100%;
    background: #000;
}

canvas {
    max-width: 100%;
    width: auto;
    max-height: 50vh;
    /* 500px */
    display: block;
    margin: 0 auto;
}

.processing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-spinner {
    width: 5vh;
    /* 50px */
    height: 5vh;
    border: 0.5vh solid var(--primary);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.6vh;
}

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

.controls {
    display: flex;
    gap: 1.6vh;
    justify-content: center;
    margin-bottom: 1.6vh;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Pro Mode Bridge - Legacy Styles just in case */
.pro-bridge-container {
    margin-top: 3.2vh;
    background: rgba(168, 85, 247, 0.1);
    border: 0.1vh solid var(--primary);
    border-radius: var(--border-radius);
    padding: 2.4vh;
    width: 100%;
}

.bridge-header h4 {
    color: var(--secondary);
    margin-bottom: 0.8vh;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8vh;
    font-size: 1.8vh;
}

.prompt-box {
    position: relative;
    margin: 1.6vh 0;
}

.prompt-box textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 0.1vh solid var(--primary-glow);
    color: var(--text-muted);
    padding: 1.6vh;
    padding-bottom: 4.8vh;
    border-radius: 0.8vh;
    height: 10vh;
    /* 100px */
    resize: none;
    font-family: monospace;
    font-size: 1.4vh;
}

.prompt-actions {
    position: absolute;
    bottom: 1vh;
    right: 1vh;
    display: flex;
    gap: 0.8vh;
}

.api-settings {
    margin-bottom: 1.6vh;
    background: rgba(0, 0, 0, 0.3);
    padding: 1.6vh;
    border-radius: 0.8vh;
}

.api-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.8vh;
}

.api-input-group label {
    font-size: 1.4vh;
    color: var(--secondary);
    font-weight: 600;
}

.api-input {
    background: rgba(255, 255, 255, 0.1);
    border: 0.1vh solid rgba(255, 255, 255, 0.1);
    padding: 0.8vh;
    border-radius: 0.4vh;
    color: white;
    font-family: monospace;
    font-size: 1.4vh;
}

.api-input:focus {
    outline: none;
    border-color: var(--secondary);
}

.small-text {
    font-size: 1.3vh;
    color: var(--text-muted);
    width: 100%;
    text-align: center;
    margin-bottom: 0.8vh;
}

.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

.btn-ai {
    font-size: 1.4vh;
    padding: 0.8vh 1.6vh;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-ai:hover {
    border-color: var(--secondary);
    color: var(--secondary);
}

/* Tokenomics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(25vh, 1fr));
    /* 250px -> 25vh */
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    border: 0.1vh solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-0.5vh);
    border-color: var(--secondary);
}

.stat-card h3 {
    color: var(--primary);
    font-size: 2vh;
    margin-bottom: 0.8vh;
}

.stat-card p {
    font-size: 2.4vh;
    font-weight: 700;
}

/* Footer */
.footer {
    padding: var(--spacing-md) 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 1.4vh;
    border-top: 0.1vh solid rgba(255, 255, 255, 0.05);
    margin-top: var(--spacing-lg);
}

/* Meme Gallery - Artistic & Floating */
.meme-gallery {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10vh 0;
    gap: 1.5vh;
    perspective: 1000px;
    margin-bottom: 5vh;
}

.meme-card {
    max-width: 33%;
    height: auto;
    transition: all 0.3s ease;
    /* Switched to box-shadow for cleaner edges */
    box-shadow: 0 1vh 2vh rgba(0, 0, 0, 0.5);
    cursor: pointer;
    will-change: transform;
    /* Ensure clean rendering */
    transform: translateZ(0);
    backface-visibility: hidden;
}

.meme-card:hover {
    box-shadow: 0 2vh 4vh rgba(168, 85, 247, 0.4);
    z-index: 20;
}

.meme-card-1 {
    transform: translateY(2vh);
    animation: galleryFloat1 6s ease-in-out infinite;
}

.meme-card-2 {
    transform: translateY(-2vh);
    z-index: 5;
    animation: galleryFloat2 7s ease-in-out infinite;
}

.meme-card-3 {
    transform: translateY(1vh);
    animation: galleryFloat3 5s ease-in-out infinite 1s;
}

@keyframes galleryFloat1 {

    0%,
    100% {
        transform: translateY(2vh);
    }

    50% {
        transform: translateY(0vh);
    }
}

@keyframes galleryFloat2 {

    0%,
    100% {
        transform: translateY(-2vh);
    }

    50% {
        transform: translateY(-4vh);
    }
}

@keyframes galleryFloat3 {

    0%,
    100% {
        transform: translateY(1vh);
    }

    50% {
        transform: translateY(-1vh);
    }
}

/* --- Mobile Responsiveness --- */
/* Breakpoints usually stick to px/em, but logic inside uses vh */
@media (max-width: 768px) {
    .app-container {
        padding: 0 1.6vh;
    }

    .navbar {
        flex-direction: column;
        gap: 1.6vh;
        padding: 1.6vh 0;
    }

    .hero {
        flex-direction: column-reverse;
        text-align: center;
        padding: 3.2vh 0;
        gap: 3.2vh;
    }

    .hero-title {
        font-size: 4vh;
    }

    .hero-subtitle {
        margin: 0 auto 2.4vh auto;
        font-size: 1.6vh;
    }

    .hero-actions {
        justify-content: center;
    }

    .floating-prop {
        width: 28vh;
        margin-bottom: 3.2vh;
    }

    .mode-toggle {
        flex-direction: column;
        width: 100%;
    }

    .section-header h2 {
        font-size: 3.2vh;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .meme-gallery {
        flex-direction: column;
        gap: 4vh;
        padding: 5vh 0;
    }

    .meme-card {
        max-width: 80%;
    }

    /* Keep some float but less rotation on mobile */
    .meme-card-1 {
        animation: galleryFloatMobile 5s infinite;
    }

    .meme-card-2 {
        animation: galleryFloatMobile 5s infinite 1s;
    }

    .meme-card-3 {
        animation: galleryFloatMobile 5s infinite 2s;
    }
}

@keyframes galleryFloatMobile {

    0%,
    100% {
        transform: translateY(0) rotate(0);
    }

    50% {
        transform: translateY(-1.5vh) rotate(0);
    }
}

/* Chaotic Meme Collage */
.meme-collage {
    position: relative;
    height: 40vh;
    overflow: hidden;
    margin-bottom: -10vh;
    z-index: 0;
    pointer-events: none;
}

.meme-item {
    position: absolute;
    opacity: 0.8;
    filter: drop-shadow(0 0 0.5vh rgba(168, 85, 247, 0.5));
    animation: floatMeme 6s ease-in-out infinite alternate;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    will-change: transform;
    /* Display at exact native resolution - no scaling */
    max-width: none;
}

.meme-1 {
    top: 5vh;
    left: 0%;
    transform: rotate(-15deg);
    width: 750px;
    /* Exact native width for 1:1 pixel ratio */
    animation-name: floatMeme1;
}

.meme-2 {
    top: 10vh;
    left: 50%;
    transform: translateX(-50%) rotate(10deg);
    width: 747px;
    /* Exact native width for 1:1 pixel ratio */
    animation-delay: 2s;
    z-index: 1;
    animation-name: floatMeme2;
}

.meme-3 {
    top: 15vh;
    right: 0%;
    transform: rotate(-5deg);
    width: 748px;
    /* Exact native width for 1:1 pixel ratio */
    animation-delay: 1s;
    animation-name: floatMeme3;
}

@keyframes floatMeme1 {
    0% {
        transform: translateY(0) rotate(-15deg);
    }

    100% {
        transform: translateY(-3vh) rotate(-20deg);
    }
}

@keyframes floatMeme2 {
    0% {
        transform: translateY(0) rotate(10deg);
    }

    100% {
        transform: translateY(3vh) rotate(15deg);
    }
}

@keyframes floatMeme3 {
    0% {
        transform: translateY(0) rotate(-5deg);
    }

    100% {
        transform: translateY(-2vh) rotate(0deg);
    }
}

/* Falling Money Effect */
.money-particle {
    position: fixed;
    pointer-events: none;
    color: #85bb65;
    font-size: 24px;
    font-weight: bold;
    font-family: 'Cinzel', serif;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
    z-index: 9999;
    user-select: none;
    will-change: transform, opacity;
    animation: fallDown 1.5s forwards ease-in;
}

@keyframes fallDown {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(var(--fall-x), var(--fall-y)) rotate(var(--rot)) scale(0.5);
        opacity: 0;
    }
}

.booty-particle {
    position: fixed;
    pointer-events: none;
    width: 80px;
    /* Set a fixed width for the image */
    height: auto;
    z-index: 9998;
    user-select: none;
    will-change: transform, opacity;
    animation: popFade 1.5s forwards ease-out;
}

@keyframes popFade {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    20% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }

    40% {
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0;
    }
}