@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P:wght@400&display=swap');

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

body {
    font-family: 'Press Start 2P', cursive;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
}

.game-title {
    font-size: clamp(14px, 3vw, 24px);
    margin: 15px 10px;
    text-align: center;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    word-break: break-word;
}

/* When embedded fullscreen, the parent adds a top offset */
.game-title.fullscreen-mode {
    margin-top: 80px;
}

.game-container {
    position: relative;
    margin: 20px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    overflow: hidden;
}

#gameArea {
    width: 960px;
    height: 540px;
    background-image: url('../fond.jpg');
    background-size: cover;
    background-position: center;
    background-color: #98FB98;
    position: relative;
    overflow: hidden;
    border: 4px solid #333;
}

.cloud {
    position: absolute;
    background: white;
    border-radius: 50px;
    opacity: 0.8;
    animation: float 20s infinite linear;
}

.cloud::before, .cloud::after {
    content: '';
    position: absolute;
    background: white;
    border-radius: 50px;
}

.cloud1 { width: 60px; height: 20px; top: 50px; left: -100px; }
.cloud1::before { width: 30px; height: 30px; top: -15px; left: 10px; }
.cloud1::after { width: 40px; height: 40px; top: -20px; right: 10px; }

.cloud2 { width: 80px; height: 25px; top: 100px; left: -120px; animation-delay: -10s; }
.cloud2::before { width: 35px; height: 35px; top: -18px; left: 15px; }
.cloud2::after { width: 45px; height: 45px; top: -25px; right: 15px; }

@keyframes float {
    from { transform: translateX(0); }
    to { transform: translateX(1080px); }
}

#pikachu {
    position: absolute;
    width: 60px;
    height: 60px;
    top: 240px;
    left: 70px;
    z-index: 100;
}

#pikachu img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 5px 15px rgba(255, 215, 0, 0.6));
    transition: filter 0.3s ease;
}

#pikachu.invincible img {
    filter: drop-shadow(0 0 20px rgba(255, 255, 0, 1)) brightness(1.3);
    animation: invincible-glow 0.5s infinite;
}

#pikachu.speed-boost img {
    filter: drop-shadow(0 0 15px rgba(0, 200, 255, 0.8));
}

@keyframes invincible-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.trail {
    position: absolute;
    width: 60px;
    height: 60px;
    pointer-events: none;
    z-index: 50;
    opacity: 0.4;
}

.trail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: blur(2px);
}

.game-element {
    position: absolute;
    transition: all 0.3s ease;
    cursor: pointer;
}

.game-element img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.3));
}

.pokeball { width: 40px; height: 40px; animation: bounce 2s infinite ease-in-out; }
.mewtwo { width: 50px; height: 60px; animation: pulse 1.5s infinite ease-in-out; }
.powerup { width: 45px; height: 45px; animation: bounce 1.5s infinite ease-in-out, rotate 3s infinite linear; }
.powerup.speed { filter: drop-shadow(0 0 10px rgba(0, 200, 255, 0.8)); }
.powerup.invincible { filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8)); }
.powerup.magnet { filter: drop-shadow(0 0 10px rgba(255, 0, 255, 0.8)); }

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

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

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

.ui-panel {
    background: rgba(0,0,0,0.8);
    border-radius: 15px;
    padding: 15px;
    margin: 10px 20px;
    max-width: 960px;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    align-items: center;
}

.stat-item { text-align: center; color: white; font-size: clamp(7px, 1.2vw, 10px); }
.stat-value { font-size: clamp(12px, 2vw, 18px); margin-top: 5px; color: #FFD700; }

.toolbar-cell {
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: wrap;
}

.controls {
    background: rgba(0,0,0,0.8);
    border-radius: 15px;
    padding: 15px;
    margin-top: 10px;
    text-align: center;
    font-size: 8px;
    color: #ccc;
}

.modern-button {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    border: 3px solid #FFD700;
    margin: 20px;
}

.modern-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.combo-meter {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0,0,0,0.8);
    border-radius: 10px;
    padding: 10px;
    color: white;
    font-size: 8px;
    text-align: center;
    min-width: 100px;
}

.combo-bar {
    width: 100%;
    height: 8px;
    background: #333;
    border-radius: 4px;
    margin-top: 5px;
    overflow: hidden;
}

.combo-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcf7f);
    width: 0%;
    transition: width 0.3s ease;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #FFD700;
    border-radius: 50%;
    pointer-events: none;
    animation: particle-float 1s ease-out forwards;
    box-shadow: 0 0 10px currentColor;
}

@keyframes particle-float {
    0% { opacity: 1; transform: scale(1) translateY(0) rotate(0deg); }
    100% { opacity: 0; transform: scale(0) translateY(-60px) rotate(360deg); }
}

.star-particle {
    width: 8px;
    height: 8px;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.score-popup {
    position: absolute;
    font-size: 14px;
    font-weight: bold;
    pointer-events: none;
    z-index: 200;
    animation: score-popup 1s ease-out forwards;
}

.score-popup.positive { color: #00ff00; }
.score-popup.negative { color: #ff0000; }

@keyframes score-popup {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-30px) scale(1.5); }
}

.shake { animation: shake 0.5s ease-in-out; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.toolbar-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(6px, 1vw, 8px);
    background: rgba(255,255,255,0.1);
    color: #FFD700;
    border: 1px solid #FFD700;
    border-radius: 6px;
    padding: 5px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.toolbar-btn:hover { background: rgba(255,215,0,0.2); transform: scale(1.05); }
.toolbar-btn:active { transform: scale(0.95); }
.toolbar-btn.active { background: rgba(255,215,0,0.3); border-color: #00ff00; color: #00ff00; }
.toolbar-btn.muted { border-color: #ff4444; color: #ff4444; }

.pause-overlay, .gameover-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 500;
    font-family: 'Press Start 2P', cursive;
    font-size: 24px;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.gameover-overlay .go-title { font-size: clamp(18px, 4vw, 28px); color: #ff4444; margin-bottom: 15px; }
.gameover-overlay .go-score { font-size: clamp(10px, 2vw, 14px); margin-bottom: 20px; }
.gameover-overlay .go-replay {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(10px, 2vw, 14px);
    background: rgba(255,215,0,0.2);
    color: #FFD700;
    border: 2px solid #FFD700;
    border-radius: 10px;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: pulse 1.5s infinite ease-in-out;
}
.gameover-overlay .go-replay:hover { background: rgba(255,215,0,0.4); transform: scale(1.1); }

@media (max-width: 1000px) {
    #gameArea { width: 90vw; max-width: 960px; height: auto; aspect-ratio: 16/9; }
    .ui-panel { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
    .ui-panel { grid-template-columns: repeat(2, 1fr); }
}
