/* ========================================
   PAC-MAN CANVAS - ESTILO DO JOGO
   Interface e Controles do Jogo
   ======================================== */

/* === WRAPPER DO JOGO === */
.game.wrapper {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(180deg, #000000 0%, #0a0a0a 100%);
    border: 4px solid var(--border-blue);
    border-radius: 12px;
    box-shadow: var(--shadow-arcade), 
                inset 0 0 20px rgba(33, 33, 222, 0.3),
                var(--glow-blue);
}

/* === PLACAR E INFORMAÇÕES === */
.score, .level, .lives {
    display: inline-block;
    font-size: clamp(1rem, 2vw, 1.3rem);
    font-weight: bold;
    color: var(--text-white);
    padding: 10px 20px;
    margin: 5px;
    background: linear-gradient(90deg, var(--maze-blue-dark), var(--maze-blue));
    border: 2px solid var(--text-yellow);
    border-radius: 8px;
    text-shadow: var(--glow-yellow);
    min-width: 150px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.score {
    background: linear-gradient(90deg, #1B1B9A, #2121DE);
}

.level {
    background: linear-gradient(90deg, #9A1B1B, #DE2121);
}

.lives {
    background: linear-gradient(90deg, #1B9A1B, #21DE21);
}

/* === CONTROLE DE SOM === */
.controlSound {
    position: absolute;
    top: 20px;
    right: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.controlSound img {
    width: 40px;
    height: 40px;
    margin: 0;
    filter: drop-shadow(0 0 8px rgba(255, 255, 0, 0.6));
    transition: all 0.3s ease;
}

.controlSound:hover img {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 0 15px rgba(255, 255, 0, 1));
}

/* === CONTAINER DO CANVAS === */
#canvas-container {
    position: relative;
    width: 100%;
    max-width: 540px;
    margin: 20px auto;
    border: 4px solid var(--text-yellow);
    border-radius: 8px;
    background-color: #000000;
    box-shadow: inset 0 0 30px rgba(33, 33, 222, 0.4),
                0 8px 25px rgba(0, 0, 0, 0.8),
                0 0 40px rgba(255, 255, 0, 0.3);
}

/* === OVERLAY DO CANVAS === */
#canvas-overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 10;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
}

#canvas-overlay-container:hover {
    background-color: rgba(0, 0, 0, 0.75);
}

#canvas-overlay-content {
    text-align: center;
    padding: 30px;
}

#title {
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--text-yellow);
    font-weight: bold;
    text-shadow: var(--glow-yellow);
    margin-bottom: 20px;
    animation: pulse 2s infinite, titleBounce 1s ease-in-out infinite;
    letter-spacing: 3px;
}

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

#text {
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    color: var(--ghost-cyan);
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
    animation: blink 1.5s infinite;
}

/* === CANVAS === */
#myCanvas {
    display: block;
    width: 100%;
    height: auto;
    background-color: #000000;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

/* === CONTROLES DO JOGO === */
.controls {
    text-align: center;
    margin: 20px auto;
    padding: 15px;
}

/* === BOTÕES DE CONTROLE DIRECIONAIS === */
#game-buttons {
    display: block;
    margin-top: 20px;
}

.controlButton {
    display: inline-block;
    width: 60px;
    height: 60px;
    margin: 5px;
    background: linear-gradient(145deg, var(--maze-blue), var(--maze-blue-dark));
    color: var(--text-yellow);
    font-size: 2rem;
    line-height: 60px;
    text-align: center;
    border: 3px solid var(--text-yellow);
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 4px 0 var(--maze-blue-dark),
                0 6px 15px rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
    font-weight: bold;
}

.controlButton:hover {
    background: linear-gradient(145deg, var(--text-yellow), var(--powerpill-yellow));
    color: var(--bg-black);
    border-color: var(--bg-black);
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--maze-blue-dark),
                0 10px 20px rgba(255, 255, 0, 0.5);
}

.controlButton:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--maze-blue-dark),
                0 4px 10px rgba(0, 0, 0, 0.5);
}

#game-buttons > div {
    margin: 5px 0;
}

#game-buttons > div:first-child {
    text-align: center;
}

#game-buttons > div:last-child {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* === MENU DE BOTÕES === */
#menu-buttons ul {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

#menu-buttons li {
    margin: 0;
}

#menu-buttons .button {
    min-width: 180px;
}

/* === DESCRIÇÃO === */
.description {
    max-width: 800px;
    margin: 30px auto;
    padding: 25px;
    background-color: rgba(10, 10, 10, 0.8);
    border: 2px solid var(--border-blue);
    border-radius: 10px;
    box-shadow: var(--shadow-arcade);
}

.description p {
    margin-bottom: 15px;
    text-align: justify;
}

/* === ÁUDIO (ESCONDIDO) === */
#audio {
    display: none;
}

/* === HIGHSCORE === */
#highscore-content {
    display: none;
}

#highscore-content.active {
    display: block;
}

#highscore-list {
    background-color: rgba(33, 33, 222, 0.1);
    border: 2px solid var(--border-blue);
    border-radius: 8px;
    padding: 20px;
    max-width: 500px;
    margin: 20px auto;
}

#highscore-list li {
    padding: 10px;
    margin: 8px 0;
    background: linear-gradient(90deg, var(--maze-blue-dark), transparent);
    border-left: 4px solid var(--text-yellow);
    color: var(--text-white);
    font-size: 1.1rem;
}

/* === INSTRUÇÕES === */
#instructions-content,
#info-content {
    display: none;
}

#instructions-content.active,
#info-content.active {
    display: block;
}

#instructions-content img {
    max-width: 100%;
    border: 3px solid var(--border-blue);
    border-radius: 8px;
    margin: 15px auto;
    box-shadow: var(--shadow-arcade);
}

/* === RESPONSIVIDADE === */
@media screen and (max-width: 768px) {
    .game.wrapper {
        padding: 15px;
        border-width: 3px;
    }
    
    .score, .level, .lives {
        font-size: 0.9rem;
        padding: 8px 15px;
        min-width: 120px;
        margin: 3px;
    }
    
    .controlSound {
        top: 10px;
        right: 10px;
    }
    
    .controlSound img {
        width: 32px;
        height: 32px;
    }
    
    .controlButton {
        width: 50px;
        height: 50px;
        line-height: 50px;
        font-size: 1.5rem;
    }
    
    #menu-buttons .button {
        min-width: 150px;
        padding: 10px 20px;
    }
    
    #canvas-container {
        max-width: 100%;
        border-width: 3px;
    }
}

@media screen and (max-width: 480px) {
    .game.wrapper {
        padding: 10px;
        border-width: 2px;
    }
    
    .score, .level, .lives {
        font-size: 0.8rem;
        padding: 6px 10px;
        min-width: 100px;
        display: block;
        margin: 5px auto;
    }
    
    .controlButton {
        width: 45px;
        height: 45px;
        line-height: 45px;
        font-size: 1.3rem;
        margin: 3px;
    }
    
    #menu-buttons ul {
        flex-direction: column;
        align-items: center;
    }
    
    #menu-buttons .button {
        width: 100%;
        max-width: 250px;
    }
    
    #title {
        font-size: 1.8rem;
        letter-spacing: 2px;
    }
    
    .description {
        padding: 15px;
    }
}

/* === EFEITOS ESPECIAIS === */
@keyframes ghostFlash {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
    }
    25% {
        box-shadow: 0 0 20px rgba(255, 184, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    }
    75% {
        box-shadow: 0 0 20px rgba(255, 184, 82, 0.5);
    }
}

.game.wrapper.chase-mode {
    border-color: var(--ghost-red);
    animation: ghostFlash 2s infinite;
}

/* === LOADING / TRANSIÇÕES === */
.fade-in {
    animation: fadeIn 0.5s ease;
}

.fade-out {
    animation: fadeOut 0.5s ease;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}
