/* styles.css */

/* General Styles */
body {
    margin: 0;
    overflow: hidden;
    font-family: 'Press Start 2P', sans-serif;
    background: linear-gradient(45deg, #ff0066, #ffcc00, #33cc33, #0066ff, #cc00ff);
    background-size: 400% 400%;
    animation: HyperGradient 10s linear infinite;
    color: white;
}

/* Hyper Gradient Animation */
@keyframes HyperGradient {
    0% { background-position: 0% 50%; }
    25% { background-position: 50% 50%; }
    50% { background-position: 100% 50%; }
    75% { background-position: 50% 50%; }
    100% { background-position: 0% 50%; }
}

/* Game Container */
#gameContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* Header */
#header {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90%;
    max-width: 800px;
    margin-top: 10px;
}

/* Social Buttons */
#socialButtons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

#socialButtons a {
    color: #fff;
    text-decoration: none;
    font-size: 3.5vw; /* Adjusted font size for mobile */
    padding: 5px 10px;
    border: 2px solid #fff;
    border-radius: 5px;
    transition: all 0.3s ease;
    animation: neonGlow 2s infinite alternate;
}

@keyframes neonGlow {
    from { text-shadow: 0 0 5px #fff, 0 0 10px #ff00ff; }
    to { text-shadow: 0 0 20px #00ffff, 0 0 30px #ff00ff; }
}

#socialButtons a:hover {
    background: #fff;
    color: #000;
    box-shadow: 0 0 10px #fff, 0 0 20px #fff;
}

/* Score Display */
.score-display {
    font-size: 5vw; /* Adjusted font size for mobile */
    color: #fff;
    text-shadow: 0 0 5px #fff;
    animation: scoreFlash 2s infinite alternate;
    margin-top: 10px; /* Space between social buttons and score */
    text-align: center;
}

@keyframes scoreFlash {
    from { color: #ff00ff; text-shadow: 0 0 10px #ff00ff; }
    to { color: #00ffff; text-shadow: 0 0 20px #00ffff; }
}

/* Game Area */
#gameArea {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 90%;
    max-width: 600px;
    flex-grow: 1;
}

#gameGrid {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* Maintain square aspect ratio */
    margin: 10px 0;
    border: 5px solid;
    border-image: linear-gradient(45deg, red, orange, yellow, green, blue, indigo, violet) 1;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    overflow: hidden;
}

/* Tiles */
.tile {
    position: absolute;
    width: 12.5%; /* 100% / 8 columns */
    height: 12.5%; /* 100% / 8 rows */
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    border: 0px solid transparent;
    box-sizing: border-box;
    overflow: hidden;
    line-height: 0;
    font-size: 0;
}

/* Power Meter */
#meterContainer {
    position: relative;
    width: 90%;
    max-width: 600px;
    height: 20px;
    border: 2px solid #fff;
    background: rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
    overflow: hidden; /* Ensure overflow is hidden */
}

#meterFill {
    position: absolute;
    left: 0;
    top: 0;
    width: 0%; /* Start with 0% width */
    height: 100%;
    background: linear-gradient(90deg, #ff0, #f00);
    transition: width 0.3s ease-in-out;
}

/* Buttons Container */
#buttonsContainer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: 90%;
    max-width: 600px;
    margin-bottom: 20px;
}

#buttonsContainer button {
    font-size: 4vw; /* Adjusted font size for mobile */
    padding: 10px 20px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    border: 2px solid #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1 1 calc(50% - 20px);
    max-width: calc(50% - 20px);
}

#buttonsContainer button:hover {
    background: #fff;
    color: #000;
}

/* Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 1s forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.overlay h1, .overlay h2 {
    font-size: 8vw;
    color: #fff;
    animation: neonFlash 2s infinite;
    text-align: center;
    margin: 20px;
}

@keyframes neonFlash {
    0% { text-shadow: 0 0 10px #fff; color: #fff; }
    50% { text-shadow: 0 0 20px #ff00ff; color: #ff00ff; }
    100% { text-shadow: 0 0 10px #fff; color: #fff; }
}

.overlay button {
    font-size: 5vw;
    margin: 10px;
    padding: 15px 30px;
    background: transparent;
    border: 2px solid #fff;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    animation: buttonGlow 3s infinite;
    max-width: 80%;
}

@keyframes buttonGlow {
    0% { box-shadow: 0 0 5px #fff; border-color: #fff; }
    50% { box-shadow: 0 0 15px #ff00ff; border-color: #ff00ff; }
    100% { box-shadow: 0 0 5px #fff; border-color: #fff; }
}

.overlay button:hover {
    background: #fff;
    color: #000;
    box-shadow: 0 0 15px #fff, 0 0 25px #fff;
}

.overlay p {
    font-size: 4vw;
    color: #fff;
    margin: 10px 0;
    text-align: center;
}

/* Selected Tile */
.tile.selected {
    border: 2px solid #fff;
    animation: selectedGlow 1s infinite;
}

@keyframes selectedGlow {
    0% { box-shadow: 0 0 10px #fff; }
    50% { box-shadow: 0 0 20px #ff0; }
    100% { box-shadow: 0 0 10px #fff; }
}

/* Matched Tile */
.tile.matched {
    opacity: 0;
    transition: opacity 200ms;
}

/* Invalid Swap Animation */
.tile.invalid-swap {
    animation: shake 0.5s;
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

/* Special Tiles */
.special-tile {
    animation: specialTileGlow 0.5s infinite alternate;
    position: relative;
}

@keyframes specialTileGlow {
    0% {
        box-shadow: 0 0 20px #fff, 0 0 30px #ff0, 0 0 40px #f00;
        transform: scale(1);
        filter: hue-rotate(0deg);
    }
    50% {
        box-shadow: 0 0 30px #fff, 0 0 40px #ff0, 0 0 50px #f00;
        transform: scale(1.1);
        filter: hue-rotate(180deg);
    }
    100% {
        box-shadow: 0 0 20px #fff, 0 0 30px #ff0, 0 0 40px #f00;
        transform: scale(1);
        filter: hue-rotate(360deg);
    }
}

/* Rotating Dashed Border */
.special-tile::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    width: calc(100% + 10px);
    height: calc(100% + 10px);
    border: 2px dashed #fff;
    border-radius: 50%;
    animation: rotateSpecial 2s linear infinite;
}

@keyframes rotateSpecial {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Joker Tile */
.tile[data-type="joker"] {
    border: 2px solid #0f0;
    animation: jokerTileGlow 1s infinite alternate;
}

@keyframes jokerTileGlow {
    0% { box-shadow: 0 0 10px #0f0; }
    50% { box-shadow: 0 0 20px #0ff; }
    100% { box-shadow: 0 0 10px #0f0; }
}

/* Floating Points */
.floating-points {
    position: absolute;
    color: #fff;
    font-size: 1.5em;
    pointer-events: none;
    animation: floatingPointsFade 1s forwards;
    text-shadow: 0 0 5px #fff;
}

@keyframes floatingPointsFade {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Combo Indicator */
.combo-indicator {
    position: absolute;
    color: #ff0;
    font-size: 2em;
    pointer-events: none;
    text-shadow: 0 0 10px #ff0, 0 0 20px #f00;
    animation: comboPop 0.5s forwards;
    z-index: 1000;
}

@keyframes comboPop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.combo-indicator.fade-out {
    animation: comboFadeOut 0.5s forwards;
}

@keyframes comboFadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Particle Effect */
.particle {
    position: absolute;
    width: 5px;
    height: 5px;
    background: radial-gradient(circle, #fff, transparent);
    border-radius: 50%;
    pointer-events: none;
}

/* Responsive Styles */
@media (min-width: 768px) {
    /* Adjust styles for larger screens */
    #header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 80%;
        max-width: 800px;
    }

    #socialButtons a {
        font-size: 1em; /* Increase font size on larger screens */
    }

    .score-display {
        font-size: 1.5em; /* Increase font size on larger screens */
        margin-top: 0;
    }

    #buttonsContainer button {
        font-size: 1em; /* Increase font size on larger screens */
    }

    .overlay h1, .overlay h2 {
        font-size: 4vw;
    }

    .overlay button {
        font-size: 1.5vw;
    }

    .overlay p {
        font-size: 2vw;
    }
}
