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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(45deg, #1e3c72, #2a5298, #ff6b6b, #4ecdc4, #45b7d1);
    background-size: 400% 400%;
    animation: gradientFlow 10s ease infinite;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.screen {
    display: none;
    text-align: center;
    width: 90vmin;
    max-width: 600px;
    max-height: 98vh;
    padding: 0.5vmin;
    overflow: hidden;
}

.screen.active {
    display: block;
}

/* Mapi Games Logo */
.mapi-logo {
    position: fixed;
    bottom: 1vmin;
    left: 50%;
    transform: translateX(-50%);
    color: #ff0000;
    font-size: 2vmin;
    font-weight: bold;
    text-shadow: 0.3vmin 0.3vmin 0.5vmin rgba(0,0,0,0.5);
    z-index: 1000;
    background: rgba(255,255,255,0.2);
    padding: 0.8vmin 1.5vmin;
    border-radius: 3vmin;
    backdrop-filter: blur(10px);
    border: 0.3vmin solid rgba(255,0,0,0.4);
    pointer-events: none;
}

/* Home Screen Styles */
.home-screen h1 {
    font-size: 4.5vmin;
    color: #fff;
    text-shadow: 0.5vmin 0.5vmin 1vmin rgba(0,0,0,0.4);
    margin-bottom: 0.5vmin;
    animation: bounce 2.5s ease-in-out infinite;
}

.home-screen .subtitle {
    font-size: 2.5vmin;
    color: #ffffff;
    text-shadow: 0.3vmin 0.3vmin 0.5vmin rgba(0,0,0,0.3);
    margin-bottom: 2vmin;
    opacity: 0.9;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-15px); }
    60% { transform: translateY(-8px); }
}

.play-btn {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    border: none;
    padding: 2vmin 4vmin;
    font-size: 3.2vmin;
    color: white;
    border-radius: 6vmin;
    cursor: pointer;
    box-shadow: 0 0.8vmin 2vmin rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    font-family: inherit;
    font-weight: bold;
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 30px rgba(0,0,0,0.4);
}

/* Game Screen Styles */
.game-screen h2 {
    color: white;
    font-size: 3.5vmin;
    margin-bottom: 0.5vmin;
    text-shadow: 0.3vmin 0.3vmin 0.5vmin rgba(0,0,0,0.3);
}

.scoreboard {
    background: rgba(255,255,255,0.2);
    padding: 1vmin;
    border-radius: 1.5vmin;
    margin-bottom: 0.8vmin;
    color: white;
    font-size: 1.8vmin;
    backdrop-filter: blur(10px);
    font-weight: bold;
}

.difficulty-display {
    background: rgba(255,255,255,0.25);
    padding: 0.8vmin 1.5vmin;
    border-radius: 1.5vmin;
    margin-bottom: 0.8vmin;
    color: white;
    font-weight: bold;
    backdrop-filter: blur(10px);
    font-size: 1.6vmin;
}

.current-player {
    background: rgba(255,255,255,0.3);
    padding: 1vmin 2vmin;
    border-radius: 1.5vmin;
    margin-bottom: 1vmin;
    color: white;
    font-weight: bold;
    font-size: 1.8vmin;
    backdrop-filter: blur(10px);
    animation: pulse 2s ease-in-out infinite;
}

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

.game-board-container {
    background: rgba(255,255,255,0.15);
    padding: 1.2vmin;
    border-radius: 2vmin;
    backdrop-filter: blur(10px);
    box-shadow: 0 0.8vmin 2vmin rgba(0,0,0,0.2);
}

.column-buttons {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5vmin;
    margin-bottom: 0.8vmin;
}

.column-btn {
    background: linear-gradient(45deg, #4ecdc4, #45b7d1);
    border: none;
    padding: 0.6vmin;
    border-radius: 1vmin;
    color: white;
    font-size: 2.5vmin;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0.4vmin 0.8vmin rgba(0,0,0,0.2);
}

.column-btn:hover:not(:disabled) {
    background: linear-gradient(45deg, #45b7d1, #4ecdc4);
    transform: translateY(-0.2vmin);
    box-shadow: 0 0.6vmin 1.2vmin rgba(0,0,0,0.3);
}

.column-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    opacity: 0.5;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 0.5vmin;
    width: 55vmin;
    max-width: 100%;
    margin: 0 auto;
    background: #1a237e;
    padding: 1.5vmin;
    border-radius: 2vmin;
    box-shadow: inset 0 0.4vmin 1.5vmin rgba(0,0,0,0.3);
    aspect-ratio: 7 / 6;
}

.cell {
    width: 100%;
    height: 100%;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: inset 0 0.2vmin 0.5vmin rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.cell.empty {
    background: #e8eaf6;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.2);
}

.cell.player {
    background: radial-gradient(circle, #ff4444, #cc0000);
    animation: dropIn 0.5s ease-out;
    box-shadow: 0 3px 10px rgba(255,68,68,0.4);
}

.cell.computer {
    background: radial-gradient(circle, #ffeb3b, #ffa000);
    animation: dropIn 0.5s ease-out;
    box-shadow: 0 3px 10px rgba(255,235,59,0.4);
}

.cell.winning {
    animation: winningGlow 1.5s ease-in-out infinite alternate;
    z-index: 10;
}

@keyframes dropIn {
    0% { 
        transform: translateY(-300px) scale(0.8);
        opacity: 0;
    }
    50% { 
        transform: translateY(10px) scale(1.1);
    }
    100% { 
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes winningGlow {
    0% { 
        box-shadow: 0 0 15px #00ff00, 0 0 25px #00ff00, 0 0 35px #00ff00;
        transform: scale(1);
    }
    100% { 
        box-shadow: 0 0 25px #00ff00, 0 0 35px #00ff00, 0 0 50px #00ff00;
        transform: scale(1.1);
    }
}

/* Game Over Screen Styles */
.game-over-screen h2 {
    font-size: 5.5vmin;
    color: white;
    text-shadow: 0.5vmin 0.5vmin 1vmin rgba(0,0,0,0.4);
    margin-bottom: 2vmin;
}

.win-message {
    color: #4ecdc4;
    animation: celebrate 2s ease-in-out infinite;
}

.lose-message {
    color: #ff6b6b;
}

.draw-message {
    color: #feca57;
}

@keyframes celebrate {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.05) rotate(-2deg); }
    75% { transform: scale(1.05) rotate(2deg); }
}

.result-animation {
    width: 12vmin;
    height: 12vmin;
    margin: 0 auto 2vmin;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5vmin;
}

.result-animation.win {
    background: radial-gradient(circle, #4ecdc4, #45b7d1);
    animation: winSpin 2s ease-in-out infinite;
}

.result-animation.lose {
    background: radial-gradient(circle, #ff6b6b, #cc0000);
    animation: losePulse 1s ease-in-out infinite;
}

.result-animation.draw {
    background: radial-gradient(circle, #feca57, #ff9500);
    animation: drawShake 0.5s ease-in-out infinite;
}

@keyframes winSpin {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
}

@keyframes losePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.9); }
}

@keyframes drawShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-0.8vmin); }
    75% { transform: translateX(0.8vmin); }
}

.restart-btn {
    background: linear-gradient(45deg, #4ecdc4, #45b7d1);
    border: none;
    padding: 2vmin 4.5vmin;
    font-size: 3.2vmin;
    color: white;
    border-radius: 5vmin;
    cursor: pointer;
    box-shadow: 0 1vmin 2.5vmin rgba(0,0,0,0.25);
    transition: all 0.3s ease;
    font-family: inherit;
    font-weight: bold;
    animation: softBounce 3s ease-in-out infinite;
}

.restart-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 1.2vmin 3vmin rgba(0,0,0,0.35);
}

@keyframes softBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-0.5vmin); }
}

/* Particle Effects */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ff6b6b;
    border-radius: 50%;
    animation: particleFall 3s linear infinite;
}

.particle:nth-child(2n) { background: #4ecdc4; }
.particle:nth-child(3n) { background: #feca57; }
.particle:nth-child(4n) { background: #45b7d1; }
.particle:nth-child(5n) { background: #96ceb4; }

@keyframes particleFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 600px), (max-height: 600px) {
    .game-board {
        width: 85vmin;
    }
}

@media (max-width: 400px), (max-height: 450px) {
    .game-board {
        width: 90vmin;
    }
    
    .screen {
        width: 95vmin;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .screen {
        width: 85vmin;
    }
    
    .game-board {
        width: 75vmin;
    }
}
