* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    overflow-x: hidden;
    color: #2d3748;
}

.floating-games {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.game-icon {
    position: absolute;
    font-size: 28px;
    animation: gameFloat 12s ease-in-out infinite;
    opacity: 0.4;
}

.game-icon:nth-child(1) {
    color: #ff6b6b;
    top: 8%;
    left: 12%;
    animation-delay: 0s;
}

.game-icon:nth-child(2) {
    color: #4ecdc4;
    top: 15%;
    right: 18%;
    animation-delay: 2s;
}

.game-icon:nth-child(3) {
    color: #45b7d1;
    bottom: 20%;
    left: 8%;
    animation-delay: 4s;
}

.game-icon:nth-child(4) {
    color: #f9ca24;
    bottom: 30%;
    right: 12%;
    animation-delay: 1s;
}

.game-icon:nth-child(5) {
    color: #6c5ce7;
    top: 45%;
    left: 45%;
    animation-delay: 3s;
}

.game-icon:nth-child(6) {
    color: #a29bfe;
    top: 25%;
    left: 75%;
    animation-delay: 5s;
}

.game-icon:nth-child(7) {
    color: #050044;
    top: 40%;
    left: 30%;
    animation-delay: 2s;
}

.game-icon:nth-child(8) {
    color: #a29bfe;
    top: 75%;
    left: 35%;
    animation-delay: 2s;
}

@keyframes gameFloat {

    0%,
    100% {
        transform: translateY(0px) translateX(0px) rotate(0deg);
        opacity: 0.3;
    }

    25% {
        transform: translateY(-30px) translateX(25px) rotate(90deg);
        opacity: 0.6;
    }

    50% {
        transform: translateY(-20px) translateX(-20px) rotate(180deg);
        opacity: 0.8;
    }

    75% {
        transform: translateY(-40px) translateX(15px) rotate(270deg);
        opacity: 0.4;
    }
}

@keyframes avatarZoom {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1); /* Zoom in slightly */
    }
}

.game-main-icon-thum {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.container {
    max-width: 410px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 0 0 30px 30px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    border: 3px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.game-icon-thum {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover; /* Fills the container, cropping if needed */
    border-radius: 0;
}

.header {
    /*background: linear-gradient(135deg, #667eea, #764ba2);*/
    /*padding: 25px;*/
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(45deg,
    transparent,
    transparent 25px,
    rgba(255, 255, 255, 0.1) 25px,
    rgba(255, 255, 255, 0.1) 50px);
    animation: gamePattern 25s linear infinite;
}

@keyframes gamePattern {
    0% {
        transform: translateX(-50px) translateY(-50px);
    }

    100% {
        transform: translateX(50px) translateY(50px);
    }
}

.logo {
    font-size: 32px;
    font-weight: bold;
    color: white;
    position: relative;
    z-index: 1;
    animation: gamePulse 3s ease-in-out infinite;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

@keyframes gamePulse {

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

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

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    margin-top: 8px;
    position: relative;
    z-index: 1;
}

.content {
    padding: 25px;
    flex: 1;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.95);
}

.page {
    display: none;
    animation: fadeInGame 0.6s ease-in-out;
}

.page.active {
    display: block;
}

@keyframes fadeInGame {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ad-banner {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 25px;
    text-align: center;
    color: white;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.ad-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
}

.ad-banner:hover::before {
    left: 100%;
}

.ad-banner:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 30px rgba(255, 107, 107, 0.4);
}

.games-section {
    margin-bottom: 25px;
}

.section-title {
    font-size: 22px;
    font-weight: bold;
    color: #2d3748;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInLeft 0.6s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.games-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.game-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 25px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(102, 126, 234, 0.2);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.game-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 50%;
    transition: all 0.5s ease;
    transform: translate(-50%, -50%);
}

.game-card:hover::before {
    width: 250px;
    height: 250px;
}

.game-card:hover {
    transform: translateY(-8px) rotate(1deg);
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}

.card-icon {
    font-size: 45px;
    margin-bottom: 15px;
    display: block;
    position: relative;
    z-index: 1;
    animation: gameBounce 2s ease-in-out infinite;
}

@keyframes gameBounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    40% {
        transform: translateY(-12px) rotate(5deg);
    }

    60% {
        transform: translateY(-6px) rotate(-3deg);
    }
}

.game-title {


    font-weight: bold;
    color: #2d3748;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.game-desc {
    font-size: 13px;
    color: #64748b;
    position: relative;
    z-index: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.difficulty {
    font-size: 11px;
    color: #667eea;
    font-weight: bold;
    margin-top: 5px;
}

.featured-game {
    margin-top: 30px;
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    border-radius: 25px;
    padding: 25px;
    color: white;
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: featuredGlow 4s ease-in-out infinite;
}

@keyframes featuredGlow {

    0%,
    100% {
        box-shadow: 0 0 30px rgba(78, 205, 196, 0.4);
    }

    50% {
        box-shadow: 0 0 50px rgba(78, 205, 196, 0.7);
    }
}

.featured-game::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: conic-gradient(from 0deg, #4ecdc4, #667eea, #764ba2, #ff6b6b, #f9ca24, #4ecdc4);
    border-radius: 25px;
    z-index: -1;
    animation: rotateRainbow 8s linear infinite;
}

@keyframes rotateRainbow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.featured-content {
    position: relative;
    z-index: 1;
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    border-radius: 20px;
    padding: 5px;
}

.play-btn {
    /*background: linear-gradient(135deg, #667eea, #764ba2);*/
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 30px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    position: relative;
    overflow: hidden;
}

.play-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transition: all 0.4s ease;
    transform: translate(-50%, -50%);
}

.play-btn:hover::before {
    width: 120px;
    height: 120px;
}

.play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.bottom-nav {
    display: flex;
    justify-content: space-around;
    padding: 20px;
    background: rgba(248, 250, 252, 0.95);
    border-top: 2px solid rgba(102, 126, 234, 0.2);
    backdrop-filter: blur(10px);
}

.nav-item {
    text-align: center;
    cursor: pointer;
    padding: 12px;
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 3px;
    background: #667eea;
    border-radius: 2px;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-item.active::before {
    width: 80%;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    transform: translateY(-3px);
}

.nav-icon {
    font-size: 22px;
    display: block;
    margin-bottom: 8px;
    transition: transform 0.3s ease;
}

.nav-item:hover .nav-icon {
    transform: scale(1.2);
}

.nav-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}

.nav-item.active .nav-label {
    color: #667eea;
}

/* Game Modal */
.game-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 35px;
    max-width: 350px;
    width: 90%;
    text-align: center;
    border: 3px solid #667eea;
    animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-content h2 {
    color: #2d3748;
    margin-bottom: 15px;
}

.modal-content p {
    color: #64748b;
    margin-bottom: 10px;
}

.close-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s ease;
}

.close-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

/* Leaderboard Styles */
.leaderboard-item {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
    animation: slideInRight 0.6s ease-out;
    backdrop-filter: blur(10px);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.leaderboard-item:hover {
    transform: translateX(10px);
    border-color: #667eea;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.2);
}

.rank {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
}

.player-info {
    flex: 1;
}

.player-name {
    font-weight: bold;
    color: #2d3748;
    font-size: 16px;
}

.player-score {
    color: #64748b;
    font-size: 14px;
    margin-top: 5px;
}

/* Profile Styles */
.profile-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 25px;
    padding: 30px;
    text-align: center;
    color: white;
    margin-bottom: 25px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.avatar {
    width: 90px;
    height: 90px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 45px;
    margin: 0 auto 20px;
    border: 3px solid white;
    animation: avatarZoom 6s ease-in-out infinite;
}

@keyframes avatarFloat {

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

    50% {
        transform: translateY(-8px) rotate(180deg);
    }
}

.stat-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
    text-align: center;
    backdrop-filter: blur(10px);
}

.stat-card:hover {
    transform: scale(1.05);
    border-color: #667eea;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.2);
}

.stat-title {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 10px;
}

.stat-value {
    color: #2d3748;
    font-size: 28px;
    font-weight: bold;
}

/* Games Page Styles */
.category-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.category-tab {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(102, 126, 234, 0.2);
    color: #64748b;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 12px;
    backdrop-filter: blur(10px);
}

.category-tab.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
    transform: scale(1.05);
}

.category-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.game-list {
    display: grid;
    gap: 15px;
    margin-bottom: 150px;
}

.game-item {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    cursor: pointer;
    transition: all 0.4s ease;
    backdrop-filter: blur(10px);
}

.game-item:hover {
    transform: translateY(-5px);
    border-color: #667eea;
    box-shadow: 0 15px 30px rgba(102, 126, 234, 0.2);
}

.game-thumbnail {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
}

.game-info {
    flex: 1;
}

.game-info .game-title {
    color: #2d3748;
    font-size: 16px;
    margin-bottom: 5px;
}

.game-info .game-desc {
    color: #64748b;
    margin-bottom: 8px;
}

.game-rating {
    color: #4ecdc4;
    font-size: 14px;
}

.platform-tags {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

.platform-tag {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
}

/* Ad container styling for better viewability and CLS prevention */
/* Only reserve space once an ad is rendered inside */
.ad-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ad-container[data-ad-rendered="true"] {
    min-height: 100px;
    margin: 10px 0;
}

.ad-container-infeed {
    min-height: 80px;
    margin: 15px 0;
    padding: 5px 0;
}

/* Anchor/sticky ad at bottom - hidden by default, shown only when ad fills */
.anchor-ad-container {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 410px;
    width: 100%;
    z-index: 9998;
    text-align: center;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    padding: 5px;
    border-radius: 10px 10px 0 0;
    display: none;
}

.anchor-ad-close {
    position: absolute;
    top: -18px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-sidebar {
    background: linear-gradient(135deg, #f9ca24, #f0932b);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.ad-sidebar:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 25px rgba(249, 202, 36, 0.3);
}

.ad-sidebar::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 15px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: bold;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s ease-in-out infinite;
}

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