/*
2048 Game Stylesheet
Developed by: RSK World
Website: https://rskworld.in
Founder: Molla Samser
Designer & Tester: Rima Khatun
Contact: info@rskworld.com, support@rskworld.com, help@rskworld.in
Phone: +91 93305 39277
Address: Nutanhat, Mongolkote, Purba Burdwan, West Bengal, India, 713147

License: Educational use only. © 2025-2026 RSK World. All rights reserved.
For more games and resources: https://rskworld.in/games
Terms: https://rskworld.in/terms.php | Privacy: https://rskworld.in/privacy.php

Description: Complete CSS styling for the 2048 HTML5 puzzle game with responsive design,
animations, and modern UI/UX features.
*/

:root {
    --primary-bg: #faf8ef;
    --game-bg: #bbada0;
    --tile-bg: #cdc1b4;
    --text-color: #776e65;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: var(--primary-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    color: var(--text-color);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    padding-bottom: 0; /* Remove bottom padding */
    position: static; /* Reset positioning */
}

.container {
    text-align: center;
    max-width: 600px;
    width: 100%;
    padding: 15px;
}

.game-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

h1 {
    color: var(--text-color);
    font-size: 2.5em;
    margin: 0 0 15px 0;
    animation: bounceIn 1s;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.score-container, 
.level-container, 
.timer-container {
    background-color: var(--game-bg);
    color: white;
    padding: 10px;
    border-radius: 5px;
    min-width: 80px;
    text-align: center;
}

#game-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    background-color: var(--game-bg);
    padding: 15px;
    border-radius: 10px;
    touch-action: none;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    min-height: 300px; /* Ensure minimum height */
    perspective: 1000px;
    transition: all 0.5s ease;
}

#game-container:hover {
    transform: rotateX(2deg);
}

.tile {
    background-color: var(--tile-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5em;
    font-weight: bold;
    color: var(--text-color);
    aspect-ratio: 1;
    border-radius: 8px;
    transition: all 0.2s ease;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    animation: zoomIn 0.4s ease-out;
    opacity: 1;
    visibility: visible;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.tile:hover {
    animation: pulse 0.5s infinite;
    box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
}

.tile-merged {
    animation: shake 0.5s;
    background-color: #ffd700;
}

.game-controls {
    display: flex;
    align-items: center;
    gap: 15px; /* Space between new game button and ad */
}

.ad-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: 10px;
}

.ad-container iframe {
    max-width: 300px;
    width: 100%;
    height: 250px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

#new-game-btn {
    background-color: #8f7a66;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1em;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#new-game-btn:hover {
    background-color: #9f8a76;
}

.footer {
    margin-top: 20px;
    font-size: 0.8em;
}

.footer a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s;
}

.footer a:hover {
    color: #8f7a66;
}

.game-over-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.game-over-modal .modal-content {
    background-color: var(--primary-bg);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-over-modal h2 {
    color: var(--text-color);
    margin-bottom: 15px;
}

.game-over-modal p {
    font-size: 1.2em;
    margin-bottom: 20px;
}

.game-over-modal #restart-game-btn {
    background-color: #8f7a66;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1em;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.game-over-modal #restart-game-btn:hover {
    background-color: #9f8a76;
}

/* Game Over Modal Customization */
.game-over-modal .modal-content {
    background-color: var(--primary-bg);
    color: var(--text-color);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-over-modal .modal-header {
    border-bottom: 2px solid var(--game-bg);
    padding: 1rem;
}

.game-over-modal .modal-title {
    color: var(--text-color);
    font-weight: bold;
}

.game-over-modal .modal-body {
    padding: 1.5rem;
    text-align: center;
}

.game-over-modal .modal-body p {
    font-size: 1.2em;
    margin: 0;
}

.game-over-modal .modal-footer {
    border-top: 2px solid var(--game-bg);
    justify-content: center;
}

.game-over-modal #restart-game-btn {
    background-color: #8f7a66;
    border-color: #8f7a66;
    transition: all 0.3s ease;
}

.game-over-modal #restart-game-btn:hover {
    background-color: #9f8a76;
    border-color: #9f8a76;
}

/* Power-ups Container */
.power-ups-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
    width: 100%;
}

.power-up-btn {
    padding: 10px 20px;
    font-size: 1em;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    min-width: 120px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    background-color: #4a4a4a;
    color: white;
    border: none;
}

.power-up-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: all 0.5s;
}

.power-up-btn:hover::before {
    left: 100%;
}

.power-up-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.power-up-btn:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.power-up-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Achievements Container */
#achievements {
    background-color: var(--tile-bg);
    color: var(--text-color);
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    text-align: center;
    animation: slideIn 0.5s ease-out;
}

#achievements h3 {
    margin-bottom: 10px;
    color: var(--text-color);
}

#achievements p {
    margin: 5px 0;
    font-size: 0.9em;
}

/* Game Message Styles */
.game-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    z-index: 1000;
    max-width: 300px;
    width: 90%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-message p {
    margin: 0 0 10px 0;
    font-size: 1em;
}

.game-message small {
    color: #ddd;
    font-size: 0.8em;
}

.undo-limit-message {
    background-color: rgba(255, 0, 0, 0.8);
}

.undo-cooldown-message {
    background-color: rgba(255, 165, 0, 0.8);
}

/* Error Container Styles */
#error-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: #ff6b6b;
    color: white;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    animation: slideDown 0.5s ease;
}

#error-container h2 {
    margin: 0 0 10px 0;
    font-size: 1.5em;
    color: white;
}

#error-container p {
    margin: 0 0 15px 0;
    font-size: 1em;
    line-height: 1.4;
}

.error-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.error-actions .btn {
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.error-actions .btn-danger {
    background-color: #ff4757;
    border: none;
    color: white;
}

.error-actions .btn-secondary {
    background-color: #747d8c;
    border: none;
    color: white;
}

.error-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Audio Controls Styling */
.audio-controls {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 25px;
    padding: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sound-toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sound-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.sound-toggle i {
    font-size: 1.2em;
}

.volume-slider {
    margin-left: 10px;
    display: flex;
    align-items: center;
}

#volume-control {
    width: 100px;
    height: 6px;
    background: var(--text-color);
    outline: none;
    opacity: 0.7;
    transition: opacity 0.2s;
    border-radius: 5px;
    appearance: none;
}

#volume-control:hover {
    opacity: 1;
}

#volume-control::-webkit-slider-thumb {
    appearance: none;
    width: 15px;
    height: 15px;
    background: var(--game-bg);
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

#volume-control::-webkit-slider-thumb:hover {
    background: var(--text-color);
}

.sound-control {
    display: flex;
    align-items: center;
}

#sound-toggle-btn {
    background-color: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.5em;
    cursor: pointer;
    transition: color 0.3s ease;
}

#sound-toggle-btn:hover {
    color: #555;
}

#sound-toggle-btn.muted {
    color: #999;
    opacity: 0.7;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .audio-controls {
        top: 10px;
        right: 10px;
        padding: 5px;
        gap: 5px;
    }

    .sound-toggle {
        width: 40px;
        height: 40px;
    }

    .sound-toggle i {
        font-size: 1em;
    }

    .volume-slider {
        width: 80px;
    }
}

/* Keyframe animations */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Custom Animations */
@keyframes bounceIn {
    from, 20%, 40%, 60%, 80%, to {
        animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
    }
    0% {
        opacity: 0;
        transform: scale3d(0.3, 0.3, 0.3);
    }
    20% {
        transform: scale3d(1.1, 1.1, 1.1);
    }
    40% {
        transform: scale3d(0.9, 0.9, 0.9);
    }
    60% {
        opacity: 1;
        transform: scale3d(1.03, 1.03, 1.03);
    }
    80% {
        transform: scale3d(0.97, 0.97, 0.97);
    }
    to {
        opacity: 1;
        transform: scale3d(1, 1, 1);
    }
}

/* Responsive design enhancements */
@media (max-width: 768px) {
    .container {
        max-width: 95%;
        padding: 10px;
    }
    
    .tile {
        font-size: 2em;
    }

    .power-ups-container {
        flex-direction: column;
        align-items: center;
    }

    .power-up-btn {
        width: 80%;
        margin: 5px 0;
    }
}

@media (max-width: 600px) {
    .power-ups-container {
        flex-direction: column;
        align-items: center;
    }

    .power-up-btn {
        width: 80%;
        margin: 5px 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .tile {
        font-size: 1.5em;
    }
}

/* AdSense Ad Styling */
.adsbygoogle {
    margin: 10px 0;
    border-radius: 8px;
    overflow: hidden;
}

/* Ad Container Styling */
.ad-container-top,
.ad-container-bottom,
.ad-container-side,
.ad-container-modal {
    background-color: var(--tile-bg);
    border-radius: 10px;
    padding: 10px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 90px;
}

.ad-container-side,
.ad-container-modal {
    min-height: 250px;
    max-width: 300px;
}

/* Responsive Ad Styling */
@media (max-width: 768px) {
    .adsbygoogle {
        margin: 5px 0;
    }
    
    .ad-container-top,
    .ad-container-bottom {
        min-height: 90px;
        padding: 5px;
    }
    
    .ad-container-side {
        display: none; /* Hide side ads on mobile */
    }
    
    .ad-container-modal {
        min-height: 250px;
        max-width: 100%;
        padding: 5px;
    }
}

@media (max-width: 480px) {
    .ad-container-top,
    .ad-container-bottom {
        min-height: 70px;
        padding: 3px;
    }
    
    .ad-container-modal {
        min-height: 200px;
    }
}

/* Game Over Modal Ad Styling */
#gameOverModal .adsbygoogle {
    max-width: 300px;
    margin: 15px auto;
}

/* Top Banner Ad Styling */
.game-header + .ad-container-top .adsbygoogle {
    background-color: transparent;
}

/* Bottom Banner Ad Styling */
.game-controls + .ad-container-bottom .adsbygoogle {
    background-color: transparent;
}

/* Side Banner Ad Styling (Desktop) */
.d-none.d-lg-block .ad-container-side .adsbygoogle {
    background-color: transparent;
}

/* Footer Styles */
.full-width-footer {
    display: none; /* Hide the previous footer */
}

#game-container-wrapper {
    margin-bottom: 0; /* Remove bottom margin */
    padding-bottom: 0; /* Remove bottom padding */
}

/* Game Over Ad Container */
#game-over-ad-container {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

#game-over-ad-container iframe {
    max-width: 100%;
    width: 300px;
    height: 250px;
    border: 1px solid #ddd;
    border-radius: 8px;
}