@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Roboto+Mono:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Impact:wght@400&display=swap');
.glitch {
    text-shadow: 0.05em 0 0 #00ff41, -0.05em -0.025em 0 #ff003c;
    animation: glitch 500ms infinite;
}
@keyframes glitch {
    0% { text-shadow: 0.05em 0 0 #00ff41, -0.05em -0.025em 0 #ff003c; }
    14% { text-shadow: 0.05em 0 0 #00ff41, -0.05em -0.025em 0 #ff003c; }
    15% { text-shadow: -0.05em -0.025em 0 #00ff41, 0.025em 0.025em 0 #ff003c; }
    49% { text-shadow: -0.05em -0.025em 0 #00ff41, 0.025em 0.025em 0 #ff003c; }
    50% { text-shadow: 0.025em 0.05em 0 #00ff41, 0.05em 0 0 #ff003c; }
    99% { text-shadow: 0.025em 0.05em 0 #00ff41, 0.05em 0 0 #ff003c; }
    100% { text-shadow: -0.025em 0 0 #00ff41, -0.025em -0.025em 0 #ff003c; }
}
.ark-bg {
    background: radial-gradient(ellipse at bottom, #0d1b2a 0%, #000000 100%);
}
.vector-green {
    background-color: #00ff41;
}
.pixel-border {
    border: 4px solid #00ffff;
    box-shadow: 0 0 10px #00ffff, inset 0 0 10px #00ffff;
}
.scan-effect {
    position: relative;
    overflow: hidden;
}
.scan-effect::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, transparent, #00ff41, transparent);
    animation: scan 3s linear infinite;
}
@keyframes scan {
    0% { transform: translateY(0); }
    100% { transform: translateY(100vh); }
}
.star {
    position: absolute;
    background-color: white;
    border-radius: 50%;
    animation: twinkle var(--duration) infinite ease-in-out;
}
@keyframes twinkle {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

/* Game Section Styles */
.game-container {
    background: linear-gradient(135deg, #001122 0%, #000033 50%, #001122 100%);
    border: 3px solid #00ff41;
    border-radius: 15px;
    box-shadow: 0 0 30px #00ff41, inset 0 0 20px rgba(0, 255, 65, 0.1);
    position: relative;
    overflow: hidden;
}

.game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 65, 0.1), transparent);
    animation: game-scan 4s linear infinite;
}

@keyframes game-scan {
    0% { left: -100%; }
    100% { left: 100%; }
}

.game-iframe {
    border: none;
    border-radius: 10px;
    background: #000;
    position: relative;
    z-index: 2;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.5s ease;
}

.game-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.game-start-btn {
    background: linear-gradient(45deg, #00ff41, #00ffff);
    color: #000;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.5);
}

.game-start-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.8);
}

/* Leaderboard Styles */
.leaderboard {
    background: linear-gradient(135deg, #001122 0%, #000033 100%);
    border: 2px solid #00ffff;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.3);
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin: 8px 0;
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid #00ff41;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.leaderboard-item:hover {
    background: rgba(0, 255, 65, 0.2);
    transform: translateX(5px);
}

.leaderboard-rank {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 15px;
}

.rank-1 { background: linear-gradient(45deg, #ffd700, #ffed4e); color: #000; }
.rank-2 { background: linear-gradient(45deg, #c0c0c0, #e8e8e8); color: #000; }
.rank-3 { background: linear-gradient(45deg, #cd7f32, #daa520); color: #fff; }
.rank-other { background: linear-gradient(45deg, #00ff41, #00ffff); color: #000; }

.player-name {
    flex: 1;
    font-weight: bold;
    color: #00ff41;
}

.player-score {
    font-size: 18px;
    font-weight: bold;
    color: #00ffff;
}

/* Achievement Styles */
.achievement {
    background: linear-gradient(135deg, #001122 0%, #000033 100%);
    border: 2px solid #ff003c;
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.achievement.unlocked {
    border-color: #00ff41;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.3);
}

.achievement::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 0, 60, 0.1), transparent);
    animation: achievement-glow 3s linear infinite;
}

.achievement.unlocked::before {
    background: linear-gradient(90deg, transparent, rgba(0, 255, 65, 0.1), transparent);
}

@keyframes achievement-glow {
    0% { left: -100%; }
    100% { left: 100%; }
}

.achievement-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    background: linear-gradient(45deg, #ff003c, #ff6b6b);
    color: white;
    font-size: 24px;
}

.achievement.unlocked .achievement-icon {
    background: linear-gradient(45deg, #00ff41, #00ffff);
    color: #000;
}

.achievement-title {
    font-weight: bold;
    color: #ff003c;
    margin-bottom: 5px;
}

.achievement.unlocked .achievement-title {
    color: #00ff41;
}

.achievement-desc {
    color: #ccc;
    font-size: 14px;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #00ff41;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff41, #00ffff);
    transition: width 0.5s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progress-shine 2s linear infinite;
}

@keyframes progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Game Stats */
.game-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stat-card {
    background: linear-gradient(135deg, #001122 0%, #000033 100%);
    border: 2px solid #00ffff;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 255, 255, 0.3);
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #00ff41;
    margin-bottom: 10px;
}

.stat-label {
    color: #00ffff;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 14px;
}

/* Meme Generator Styles */
.meme-generator-container {
    background: linear-gradient(135deg, #001122 0%, #000033 100%);
    border: 3px solid #00ff41;
    border-radius: 20px;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.3);
    position: relative;
    overflow: hidden;
}

@keyframes memeScan {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Template Buttons */
.meme-template-btn {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #00ff41;
    border-radius: 12px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.meme-template-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 255, 65, 0.4);
    border-color: #00ffff;
}

.meme-template-btn.selected {
    background: linear-gradient(45deg, #00ff41, #00ffff);
    border-color: #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.6);
    transform: translateY(-2px);
}

.template-preview {
    width: 100%;
    height: clamp(50px, 15vw, 80px);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
    position: relative;
    aspect-ratio: 1 / 1; /* Ensure square for better crocodile image scaling without distortion */
}

.template-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Changed to contain to avoid cropping the crocodile, keeps full image visible */
    transition: transform 0.3s ease;
}

.meme-template-btn:hover .template-preview img {
    transform: scale(1.1);
}

.template-name {
    display: block;
    font-size: 12px;
    font-weight: bold;
    color: #00ff41;
    text-align: center;
}

.meme-template-btn.selected .template-name {
    color: #000;
}

/* Preset Buttons */
.preset-btn {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #00ffff;
    border-radius: 8px;
    padding: 12px;
    color: #00ffff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.preset-btn:hover {
    background: rgba(0, 255, 255, 0.1);
    transform: translateX(5px);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

/* Generate Button */
.generate-btn {
    background: linear-gradient(45deg, #00ff41, #00ffff);
    color: #000;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.5);
}

.generate-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.8);
}

/* Meme Preview */
.meme-preview {
    width: 100%;
    height: clamp(250px, 80vw, 400px); /* Fluid height for better adaptation */
    background: #000;
    border: 3px solid #00ff41;
    border-radius: 15px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-placeholder {
    text-align: center;
    color: #666;
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.meme-canvas {
    width: 100%;
    height: 100%;
    position: relative;
    background-size: contain; /* Changed to contain for full image visibility without crop */
    background-position: center;
    background-repeat: no-repeat;
}

.meme-text {
    position: absolute;
    font-family: 'Impact', 'Arial Black', sans-serif;
    font-weight: bold;
    color: white;
    text-shadow: 3px 3px 0px #000, -3px -3px 0px #000, 3px -3px 0px #000, -3px 3px 0px #000;
    text-align: center;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: clamp(16px, 5vw, 24px); /* Fluid font size for text on all devices */
    line-height: 1.2;
    max-width: 90%;
    word-wrap: break-word;
}

.meme-text.top {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.meme-text.bottom {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

/* Download Button */
.download-btn {
    background: linear-gradient(45deg, #00ff41, #00ffff);
    color: #000;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.download-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.6);
}

.download-btn:disabled {
    background: #666;
    color: #999;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Meme Gallery */
.meme-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.meme-gallery-item {
    position: relative;
    border: 2px solid #00ffff;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    height: 120px;
    aspect-ratio: 1 / 1; /* Square for consistent look */
}

.meme-gallery-item:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    border-color: #00ff41;
}

.meme-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Contain to show full meme without crop */
}

.meme-gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.meme-gallery-item:hover .meme-gallery-overlay {
    opacity: 1;
}

.meme-gallery-overlay button {
    background: #00ff41;
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.meme-gallery-overlay button:hover {
    background: #00ffff;
    transform: scale(1.1);
}

/* Clear Button */
.clear-btn {
    background: linear-gradient(45deg, #ff003c, #ff6b6b);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.clear-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 0, 60, 0.6);
}

/* Vector Shout Styles */
.vector-shout {
    animation: vectorShout 0.5s ease-in-out;
}

@keyframes vectorShout {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Computer Room Finder Styles */
.search-animation {
    animation: searchPulse 2s ease-in-out infinite;
}

@keyframes searchPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.computer-room-found {
    animation: foundGlow 1s ease-in-out;
}

@keyframes foundGlow {
    0% { box-shadow: 0 0 10px #ff003c; }
    50% { box-shadow: 0 0 30px #00ff41; }
    100% { box-shadow: 0 0 10px #00ff41; }
}

/* Enhanced Game Section */
.game-section-enhanced {
    background: linear-gradient(135deg, #001122 0%, #000033 50%, #001122 100%);
    border: 3px solid #00ff41;
    border-radius: 20px;
    box-shadow: 0 0 40px rgba(0, 255, 65, 0.3);
    position: relative;
    overflow: hidden;
}

.game-section-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 65, 0.1), transparent);
    animation: gameSectionScan 6s linear infinite;
}

@keyframes gameSectionScan {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Vector Character Animations */
.vector-character {
    animation: vectorFloat 3s ease-in-out infinite;
}

@keyframes vectorFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Meme Text Effects */
.meme-text-glow {
    text-shadow: 0 0 10px currentColor, 0 0 20px currentColor, 0 0 30px currentColor;
}

.meme-text-glitch {
    animation: memeGlitch 0.3s ease-in-out infinite;
}

@keyframes memeGlitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

/* Download Button Animation */
.download-ready {
    animation: downloadPulse 1s ease-in-out infinite;
}

@keyframes downloadPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 255, 65, 0.5); }
    50% { box-shadow: 0 0 30px rgba(0, 255, 65, 0.8); }
}

/* Template Image Styles */
.template-image {
    transition: transform 0.3s ease;
}

.template-image:hover {
    transform: scale(1.05);
}

.template-image img {
    transition: filter 0.3s ease;
}

.meme-template-btn:hover .template-image img {
    filter: brightness(1.1) contrast(1.1);
}

/* Hero Section Fluid Typography and Layout */
.hero h1 {
    font-size: clamp(2.5rem, 10vw, 6rem);
}

.hero p {
    font-size: clamp(1rem, 4vw, 1.25rem);
    max-width: clamp(300px, 80%, 800px);
}

/* Responsive Design - Consolidated with clamp for fluid adaptation */
@media (max-width: 768px) {
    #templateGrid {
        grid-template-columns: repeat(2, 1fr); /* Keep 2 cols, but fluid sizes handle scaling */
    }

    .game-container {
        margin: 10px;
        border-radius: 10px;
    }
    
    .game-iframe {
        width: 100%;
        height: 300px;
    }
    
    .leaderboard-item {
        flex-direction: column;
        text-align: center;
    }
    
    .leaderboard-rank {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .game-stats {
        grid-template-columns: 1fr;
    }
    
    /* Meme Generator Mobile */
    .meme-generator-container {
        padding: 16px;
    }
    
    .meme-gallery {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .meme-gallery-item {
        height: 100px;
    }
    
    .generate-btn {
        padding: 12px 24px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    #templateGrid {
        grid-template-columns: 1fr; /* Single column for tiny screens to avoid squishing crocodile */
    }

    .meme-gallery {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .meme-gallery-item {
        height: 80px;
    }
    
    .generate-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .download-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}