:root {
    --primary-gradient: linear-gradient(180deg, #4A90E2 0%, #764BA2 100%);
    --card-bg: rgba(255, 255, 255, 0.15);
    --card-border: rgba(255, 255, 255, 0.2);
    --text-white: #ffffff;
    --accent-purple: #8E2DE2;
    --accent-blue: #4A00E0;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-white);
    display: flex;
    justify-content: center;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
}

/* Main App Container */
.container {
    max-width: 480px;
    /* Tight, premium feel */
    margin: 80px auto;
    /* More breathing room from top */
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    position: relative;
}

/* Glassmorphic Nav Bar */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.nav-content {
    width: 100%;
    max-width: 1000px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-text {
    font-weight: 800;
    font-size: 18px;
    background: linear-gradient(90deg, #FFD700 0%, #FFA500 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    width: 100%;
    /* Ensure header takes full width within container */
}

.header-controls {
    position: absolute;
    top: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    /* Blog left, Lang right */
    align-items: center;
    padding: 0 4px;
}

/* Blog Button in Header (Unified) */
.btn-premium {
    background: #FFD700;
    color: #333 !important;
    padding: 8px 16px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
}

.btn-premium:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5);
    background: #FFC400;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    padding: 6px 12px;
    color: white;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: all 0.2s;
}

.lang-btn.active,
.lang-btn:hover {
    background: white;
    color: #4A00E0;
    border-color: white;
}

header h1 {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 5px;
    letter-spacing: -1px;
    color: white;
    /* Solid white to keep emojis visible */
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
}

/* Input Group (Country Select) */
.input-group {
    margin-bottom: 30px;
    width: 80%;
    /* Smaller, more elegant */
    margin-left: auto;
    margin-right: auto;
}

select {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    font-size: 16px;
    font-weight: 500;
    appearance: none;
    text-align: center;
    outline: none;
    cursor: pointer;
}

select option {
    background: #764ba2;
    color: white;
}

/* Main Poop Area */
.main-poop-area {
    position: relative;
    width: 280px;
    height: 280px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 50px 0 20px 0;
    /* More space on top for the text */
}

.glow-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #FF9966 0%, #FF5E62 100%);
    border-radius: 50%;
    opacity: 0.9;
    box-shadow: 0 0 60px rgba(255, 94, 98, 0.4);
    z-index: 1;
}

.instruction-text {
    position: absolute;
    top: 0;
    /* Align to top of container */
    width: 100%;
    /* Full width to center text */
    text-align: center;
    z-index: 10;
    color: white;
    font-size: 14px;
    /* Slightly smaller */
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    transform: translateY(-100%);
    /* Move it completely above the container */
}

.poop-emoji-btn {
    z-index: 2;
    font-size: 120px;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
    outline: none;
    text-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.poop-emoji-btn:active {
    transform: scale(0.9);
}

.poop-emoji-btn.animate-bounce {
    animation: bounce 0.4s;
}

@keyframes bounce {

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

    50% {
        transform: scale(1.15);
    }
}

/* Animation items falling */
.falling-item {
    position: fixed;
    top: -100px;
    font-size: 80px;
    /* Much bigger! */
    pointer-events: none;
    z-index: 100;
    animation: fall linear forwards;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.falling-item.diamond-mode {
    font-size: 100px;
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.8));
    /* Gold glow */
}

@keyframes fall {
    to {
        transform: translateY(110vh) rotate(360deg);
    }
}

/* Cards */
.card {
    width: 100%;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

/* Progress Card Styling */
.card-header-vertical {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.global-stat {
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
}

.stat-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
    margin-bottom: 4px;
}

.stat-value-gold {
    display: block;
    font-size: 32px;
    font-weight: 800;
    color: #FFD700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
    font-family: monospace;
}

.stat-value-sm {
    font-size: 14px;
    font-weight: 600;
    opacity: 0.9;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

/* Revert old global card styles if they exist or overwrite */
.global-card {
    display: none;
    /* Hide if old elements persist */
}

/* Progress Section */
.progress-bar-container {
    width: 100%;
    height: 24px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8E2DE2 0%, #4A00E0 100%);
    border-radius: 12px;
    transition: width 0.5s ease;
}

.progress-text {
    text-align: center;
    font-size: 14px;
    opacity: 0.9;
}

.progress-text span {
    display: block;
    font-weight: 700;
    margin-bottom: 4px;
}

/* Action/Donation Button */
.donation-container {
    width: 100%;
    margin-top: 20px;
    text-align: center;
}

.donation-text-small {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 8px;
    font-weight: 600;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.action-btn {
    width: 100%;
    padding: 18px;
    border-radius: 20px;
    border: none;
    background: #FFD700;
    color: #333;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: lowercase;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.action-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 30px rgba(255, 215, 0, 0.5);
    background: #FFC400;
}

.donation-btn {
    background: linear-gradient(90deg, #FFDD00 0%, #FBB03B 100%);
    /* BMC Yellow/Orange */
    color: #333;
    /* Dark text for contrast on yellow */
    text-shadow: none;
    font-style: normal;
    box-shadow: 0 4px 15px rgba(255, 221, 0, 0.3);
}

.donation-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(255, 221, 0, 0.3);
}

/* Leaderboard */
.leaderboard-header {
    text-align: center;
    margin-bottom: 16px;
}

.leaderboard-header h3 {
    color: #FFD700;
    /* Gold */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.tabs {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 4px;
    display: flex;
    margin-bottom: 16px;
}

.tab {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s;
}

.tab.active {
    background: #8E2DE2;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.leaderboard-list {
    min-height: 100px;
    max-height: 300px;
    overflow-y: auto;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-rank {
    width: 24px;
    font-weight: 700;
    color: #FFD700;
}

.leaderboard-country {
    flex: 1;
    text-align: left;
    padding-left: 10px;
    font-weight: 500;
}

.leaderboard-score {
    font-weight: 700;
}

.empty-state {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    line-height: 1.5;
}

/* Footer Deco */
.footer-deco {
    margin-top: 20px;
    font-size: 40px;
    opacity: 0.8;
    align-self: center;
}

/* SEO Info Section */
.info-section {
    width: 100%;
    margin-top: 40px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 24px;
    padding: 24px;
    text-align: left;
}

.info-section h2 {
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
    color: #FFD700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.fact-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.fact-card h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: #fff;
}

.fact-card p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
}

/* Ad Placeholders (Strategic) */
.ad-slot {
    width: 100%;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    margin: 20px 0;
    min-height: 100px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 11px;
    padding: 10px;
    transition: all 0.3s;
    display: none !important;
    /* Hidden until AdSense is approved & traffic is ready */
}

.ad-slot.top-banner {
    min-height: 120px;
    background: rgba(255, 215, 0, 0.05);
    border-color: rgba(255, 215, 0, 0.2);
}

.ad-label {
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 5px;
    font-weight: 800;
    color: rgba(255, 215, 0, 0.5);
}

/* Ad Placeholders */
.ad-placeholder {
    display: none;
    /* Hide old simple placeholder */
}

/* Footer Legal */
.app-footer {
    margin-top: 40px;
    text-align: center;
    width: 100%;
    padding-bottom: 20px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
}

.highlight-link {
    color: #FFD700 !important;
    font-weight: 700 !important;
}

.footer-links a:hover {
    color: white;
    text-decoration: underline;
}

.separator {
    color: rgba(255, 255, 255, 0.3);
}

.copyright {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
}

/* Responsive adjustments */
@media (max-height: 700px) {
    .app-container {
        gap: 16px;
    }

    .main-poop-area {
        width: 220px;
        height: 220px;
    }

    .poop-emoji-btn {
        font-size: 90px;
    }
}