/* --- THEME COLOR VARIABLES --- */
:root {
    /* Light Mode (Default) */
    --bg-color: #F5F7FA;
    --card-bg: rgba(255, 255, 255, 0.7);
    --text-color: #2d3748;
    --text-secondary-color: #718096;
    --border-color: #e2e8f0;
    --accent-color: #6B46C1;
    --accent-glow: rgba(107, 70, 193, 0.2);
    --primary-glow: rgba(107, 70, 193, 0.4);
    --secondary-glow: rgba(70, 126, 193, 0.4);
    --modal-backdrop: rgba(245, 247, 250, 0.5);
}

body.dark-mode {
    /* Dark Mode */
    --bg-color: #0D1117;
    --card-bg: rgba(22, 27, 34, 0.6);
    --text-color: #E6EDF3;
    --text-secondary-color: #8B949E;
    --border-color: rgba(139, 148, 158, 0.3);
    --accent-color: #9370DB;
    --accent-glow: rgba(147, 112, 219, 0.2);
    --primary-glow: rgba(147, 112, 219, 0.3);
    --secondary-glow: rgba(112, 169, 219, 0.3);
    --modal-backdrop: rgba(13, 17, 23, 0.5);
}


/* --- BASE & FONT STYLES --- */
body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
    position: relative;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- BACKGROUND EFFECTS --- */
.background-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(150px);
    pointer-events: none;
    z-index: -1;
    transition: background-color 0.5s ease;
}
.circle1 {
    width: 400px; height: 400px;
    background: var(--primary-glow);
    top: 10%; left: 10%;
    animation: move-glow 15s infinite alternate;
}
.circle2 {
    width: 500px; height: 500px;
    background: var(--secondary-glow);
    bottom: 5%; right: 5%;
    animation: move-glow 20s infinite alternate-reverse;
}
#floating-items-container {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    overflow: hidden; z-index: -2;
}
.floating-item {
    position: absolute;
    opacity: 0.05;
    will-change: transform;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}
body.dark-mode .floating-item { opacity: 0.04; }

/* --- MAIN LAYOUT --- */
.container { width: 100%; max-width: 1200px; z-index: 1; }
.web3-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
body.dark-mode .web3-container { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); }

.main-header {
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
}
.header-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    background: linear-gradient(90deg, #4A5568, var(--accent-color), #4A5568);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
}
body.dark-mode .header-title { background: linear-gradient(90deg, #FFFFFF, var(--accent-color), #FFFFFF); -webkit-background-clip: text; background-size: 200% auto; }

.header-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary-color);
    margin: 0;
    font-family: 'Share Tech Mono', monospace;
}

/* --- THEME TOGGLE (Corrected Position) --- */
.top-center-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem; /* Space between switch and title */
}
.theme-switch-wrapper { display: flex; align-items: center; }
.theme-switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.theme-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: var(--accent-color); }
input:checked + .slider:before { transform: translateX(22px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

/* --- CLAIM CONTROLS --- */
.claimed-items-section {
    text-align: center;
    border: 1px solid var(--accent-color);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    background: var(--accent-glow);
    animation: fade-in 0.4s ease;
}
.claimed-items-title {
    font-size: 1.5rem; font-weight: 600;
    color: var(--accent-color);
    margin: 0 0 1rem 0;
}
.claimed-items-container {
    display: flex; flex-wrap: wrap;
    justify-content: center; gap: 1rem; margin-bottom: 1.5rem;
}
.claimed-item-icon {
    width: 60px; height: 60px;
    border-radius: 12px;
    border: 1px solid var(--accent-color);
    background: var(--card-bg);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 15px var(--accent-glow);
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.claimed-item-icon:hover {
    transform: scale(1.05);
}
.claimed-item-icon img { width: 45px; height: 45px; object-fit: contain; pointer-events: none; }
.claimed-item-icon::after {
    content: '✓'; position: absolute; top: -8px; right: -8px;
    width: 20px; height: 20px;
    background: var(--accent-color);
    color: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: bold;
    border: 2px solid var(--bg-color);
}

/* --- ITEMS GRID --- */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
}
.item-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
    display: flex; flex-direction: column; align-items: center;
    gap: 0.75rem; cursor: pointer;
    transition: all 0.3s ease;
    position: relative; overflow: hidden;
}
.item-card:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--accent-color);
    box-shadow: 0 0 25px var(--accent-glow);
}
.item-img-bg {
    width: 100px; height: 100px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background-color: rgba(139, 148, 158, 0.1);
}
.item-img { width: 80px; height: 80px; object-fit: contain; }
.item-title { font-size: 0.9rem; font-weight: 600; text-align: center; }
.item-tag {
    position: absolute; top: 10px; left: 10px;
    font-size: 0.7rem; font-weight: 700;
    padding: 2px 8px; border-radius: 6px;
    color: #fff; text-transform: uppercase;
}
.tag-pet { background: linear-gradient(45deg, #4CAF50, #8BC34A); }
.tag-seed { background: linear-gradient(45deg, #FF9800, #FFC107); }

/* --- SELECTION STYLES --- */
.selection-indicator {
    position: absolute; top: 10px; right: 10px;
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid var(--border-color);
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}
body.dark-mode .selection-indicator { background: rgba(13, 17, 23, 0.5); }

.item-card.selected {
    border-color: var(--accent-color);
    box-shadow: 0 0 25px var(--accent-glow);
}
.item-card.selected .selection-indicator {
    background: var(--accent-color);
    border-color: #fff;
}
.item-card.selected .selection-indicator::after {
    content: '✓'; color: #fff;
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px; font-weight: bold;
}

/* --- BUTTONS --- */
.web3-button {
    font-family: 'Poppins', sans-serif;
    font-size: 1rem; font-weight: 600;
    color: var(--accent-color);
    background: transparent;
    border: 1px solid var(--accent-color);
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.web3-button:hover {
    background: var(--accent-color);
    color: #fff;
    box-shadow: 0 0 20px var(--accent-glow);
}
.web3-button.gradient-animated {
    border: none;
    background: linear-gradient(90deg, #8A2BE2, #4169E1, #8A2BE2);
    background-size: 200% auto;
    color: #fff;
    animation: gradient-anim 3s linear infinite;
}
.web3-button.gradient-animated:hover { animation-duration: 1s; }


/* --- MODALS --- */
.modal-backdrop {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--modal-backdrop);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    animation: fade-in 0.3s ease;
}
.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    width: 90%; max-width: 500px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: slide-up 0.4s ease;
}
body.dark-mode .modal-content { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4); }

.modal-close {
    position: absolute; top: 1rem; right: 1rem;
    background: none; border: none; font-size: 1.5rem;
    color: var(--text-secondary-color);
    cursor: pointer; transition: color 0.3s ease;
}
.modal-close:hover { color: var(--text-color); }
.modal-title { font-size: 1.8rem; margin: 0 0 0.5rem 0; }
.modal-sub { color: var(--text-secondary-color); margin: 0 0 1.5rem 0; }
.modal-input {
    width: 100%;
    padding: 0.8rem 1rem; border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem; margin-bottom: 1rem;
    box-sizing: border-box; transition: all 0.3s ease;
}
.modal-input:focus {
    outline: none; border-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-glow);
}
.modal-error { color: #ff6b6b; min-height: 1.2em; margin-bottom: 0.5rem; }

/* --- GENERATOR --- */
#generator-modal .loading-item-img {
    margin: 1.5rem auto; width: 100px; height: 100px;
    object-fit: contain; border-radius: 12px;
    background: rgba(139, 148, 158, 0.1);
    border: 1px solid var(--border-color);
}
.progress-bar {
    width: 100%; height: 1.5rem;
    background: var(--bg-color);
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    margin: 1.5rem 0; overflow: hidden;
}
.progress-fill {
    height: 100%; border-radius: 1rem;
    font-family: 'Share Tech Mono', monospace;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold;
    background: linear-gradient(90deg, #8A2BE2, #4169E1);
    box-shadow: 0 0 15px var(--accent-glow);
    transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
.generator-urgent { color: #ff6b6b !important; }
.pulse-title { animation: pulse-text 2s ease-in-out infinite; }
.generator-claimed-images {
    margin: 1.5rem auto; padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-color);
}
.generator-claimed-title { font-size: 1rem; color: var(--text-secondary-color); margin-bottom: 1rem; }
.generator-claimed-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; }
.generator-claimed-item {
    width: 50px; height: 50px;
    border-radius: 8px; border: 1px solid var(--border-color);
    background: var(--card-bg);
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.generator-claimed-img { width: 35px; height: 35px; object-fit: contain; }
.generator-claimed-item::after {
    content: '✓'; position: absolute; top: -6px; right: -6px;
    width: 16px; height: 16px; background: var(--accent-color);
    color: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 10px;
    border: 2px solid var(--bg-color);
}

/* --- WINNER POPUP --- */
.winner-popup {
    display: none; position: fixed;
    left: 50%; bottom: 2rem; transform: translateX(-50%);
    z-index: 1001;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px; padding: 0.75rem 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex; align-items: center; gap: 1rem;
    opacity: 0; transition: opacity 0.4s ease, background-color 0.3s ease, border-color 0.3s ease;
}
#winner-popup-icon img { width: 38px; height: 38px; vertical-align: middle; border-radius: 8px; }
#winner-popup-content b { color: var(--accent-color); }

/* --- IOS POPUP --- */
#ios-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#ios-popup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://i.ibb.co/bRr4FxYt/gom6com.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
}

.popup-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://i.ibb.co/bRr4FxYt/gom6com.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
}

.popup {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 24px; 
    padding: 2rem; 
    width: 350px;
    max-width: calc(100vw - 40px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 1000; 
    font-size: 16px; 
    line-height: 1.5;
    text-align: center;
    font-family: 'Poppins', sans-serif;
}
.highlight { color: var(--accent-color); }

/* --- GIF CONTAINER --- */
.gif-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}

.instruction-gif {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.instruction-text {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.5;
    color: var(--text-color);
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    text-align: center;
}

/* --- ANIMATIONS --- */
@keyframes move-glow {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(100px, 50px) scale(1.2); }
}
@keyframes gradient-text { to { background-position: 200% center; } }
@keyframes gradient-anim {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-text { 0%, 100% { opacity: 1; } 50% { opacity: 0.8; } }
@keyframes float1 { 0% { transform: translate(-100px, 110vh) rotate(0deg); } 100% { transform: translate(110vw, -100px) rotate(720deg); } }
@keyframes float2 { 0% { transform: translate(110vw, 110vh) rotate(0deg); } 100% { transform: translate(-100px, -100px) rotate(-720deg); } }
@keyframes float3 { 0% { transform: translate(50vw, 110vh) rotate(0deg); } 100% { transform: translate(50vw, -100px) rotate(360deg); } }

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 768px) {
    body { padding: 1rem 0.5rem; }
    .web3-container { padding: 1.5rem; }
    .header-title { font-size: 2rem; }
    .items-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 1rem; }
    .item-img-bg { width: 80px; height: 80px; }
    .item-img { width: 65px; height: 65px; }
}
@media (max-width: 480px) {
    .web3-container { padding: 1rem; border-radius: 16px; }
    .items-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
    .header-title { font-size: 1.8rem; }
    .modal-content { padding: 1.5rem; }
    .modal-title { font-size: 1.5rem; }
    .main-header { margin-bottom: 1.5rem; }
    
    /* Mobile popup adjustments - Phone Optimized */
    #ios-popup {
        padding: 8px;
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.1);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        min-height: 100vh;
        min-height: 100dvh; /* Dynamic viewport height for mobile */
    }
    
    #ios-popup::before {
        background-image: url('https://i.ibb.co/bRr4FxYt/gom6com.png');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        background-attachment: fixed; /* Better mobile performance */
    }
    
    .popup {
        width: 350px;
        max-width: calc(100vw - 16px);
        padding: 1.2rem;
        background: var(--card-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid var(--border-color);
        border-radius: 20px;
        margin: 0 auto;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    }
    
    .instruction-gif {
        max-width: 100%;
        max-height: 280px;
        width: auto;
        height: auto;
        border-radius: 8px;
        object-fit: contain;
        min-height: 200px;
    }
    
    .instruction-text {
        font-size: 0.95rem;
        color: var(--text-color);
        font-weight: 700;
        font-family: 'Poppins', sans-serif;
        line-height: 1.4;
        margin-top: 0.5rem;
        text-align: center;
    }
    
    .gif-container {
        margin-bottom: 1rem;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0.5rem;
    }
}

/* Medium mobile devices (481px to 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .instruction-gif {
        max-height: 320px;
        min-height: 220px;
    }
    
    .gif-container {
        padding: 1rem;
    }
}

/* Extra small phones (320px and below) */
@media (max-width: 320px) {
    #ios-popup {
        padding: 4px;
    }
    
    .popup {
        width: 350px;
        max-width: calc(100vw - 8px);
        padding: 1rem;
        border-radius: 16px;
    }
    
    .instruction-gif {
        max-height: 250px;
        min-height: 180px;
    }
    
    .instruction-text {
        font-size: 0.9rem;
        font-weight: 700;
        text-align: center;
    }
}

/* --- 320x50 BANNER AD CONTAINER --- */
.banner-ad-container {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    height: 50px;
    z-index: 1000; /* Keeps it on top of most content */
}

/* Optional: Styles for a placeholder so you can see the banner area */
.banner-ad-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary-color);
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    box-sizing: border-box;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 8px 8px 0 0; /* Rounded top corners */
}

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

/* Pets/Seeds Switch Styles */
.pets-seeds-switch {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 10px;
}

.switch-tab {
    padding: 12px 24px;
    border: 2px solid var(--accent-color);
    background: transparent;
    color: var(--accent-color);
    border-radius: 25px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.switch-tab:hover {
    background: var(--accent-glow);
    transform: translateY(-2px);
}

.switch-tab.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.switch-tab.active:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}