/* Whack-a-Mole — Tema terra/marrone con neon magenta */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: #1a0f2e;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

#gameContainer {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Schermate overlay */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(26, 15, 46, 0.95);
    z-index: 10;
    padding: 20px;
    text-align: center;
}

.screen h1 {
    color: #ff00ff;
    font-size: 2.5rem;
    text-shadow: 0 0 20px #ff00ff;
    margin-bottom: 10px;
}

.screen h2 {
    color: #fff;
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.screen p {
    color: rgba(255,255,255,0.7);
    font-size: 1rem;
    margin-bottom: 24px;
}

.final-score {
    color: #ff00ff !important;
    font-size: 1.4rem !important;
    font-weight: 700;
}

.stats {
    color: rgba(255,255,255,0.5) !important;
    font-size: 0.9rem !important;
}

.game-btn {
    padding: 14px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    border: 2px solid #ff00ff;
    background: transparent;
    color: #ff00ff;
    border-radius: 30px;
    cursor: pointer;
    margin: 6px;
    transition: all 0.3s;
    min-width: 180px;
}

.game-btn:hover, .game-btn:active {
    background: #ff00ff;
    color: #1a0f2e;
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.5);
}

.game-btn.secondary {
    border-color: rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.6);
}

.game-btn.secondary:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    border-color: white;
    box-shadow: none;
}

.controls-hint {
    margin-top: 20px;
    color: rgba(255,255,255,0.4);
    font-size: 0.8rem;
}

/* Area di gioco */
#gameArea {
    width: 100%;
    max-width: 400px;
    padding: 0 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* HUD */
#hud {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px;
    margin-bottom: 12px;
}

.hud-left, .hud-center {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud-label {
    color: rgba(255,255,255,0.5);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hud-left #scoreDisplay {
    color: #ff00ff;
    font-size: 1.6rem;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
}

.hud-center #timerDisplay {
    color: #ffffff;
    font-size: 1.6rem;
    font-weight: 700;
}

.hud-center #timerDisplay.warning {
    color: #ff3366;
    animation: timerPulse 0.5s ease infinite alternate;
}

@keyframes timerPulse {
    to { transform: scale(1.15); }
}

.hud-btn {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Griglia talpe */
#moleGrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 380px;
}

/* Singola buca */
.mole-hole {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    cursor: pointer;
    overflow: hidden;
    border-radius: 50%;
}

.hole-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, #2a1a0a 30%, #1a0f06 70%, #0d0805 100%);
    border-radius: 50%;
    border: 3px solid rgba(255, 0, 255, 0.15);
    box-shadow: inset 0 8px 20px rgba(0,0,0,0.8),
                0 0 15px rgba(255,0,255,0.05);
}

/* Talpa */
.mole {
    position: absolute;
    bottom: -100%;
    left: 10%;
    right: 10%;
    height: 80%;
    transition: bottom 0.15s ease-out;
    pointer-events: none;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    font-size: 3rem;
    padding-top: 5%;
}

.mole::before {
    content: '';
    display: block;
    width: 70%;
    height: 65%;
    background: radial-gradient(ellipse at 50% 40%, #8B6914 0%, #6B4F0E 50%, #4a3508 100%);
    border-radius: 50% 50% 40% 40%;
    position: relative;
    box-shadow: 0 0 15px rgba(139, 105, 20, 0.3);
}

.mole::after {
    content: '👀';
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.4rem;
    line-height: 1;
}

.mole-hole.active .mole {
    bottom: 5%;
}

/* Effetto colpito */
.mole-hole.hit .mole::before {
    background: radial-gradient(ellipse at 50% 40%, #ff00ff 0%, #aa00aa 50%, #660066 100%);
}

.mole-hole.hit .mole::after {
    content: '😵';
}

/* Effetto mancato (click sulla buca vuota) */
.mole-hole.miss .hole-bg {
    border-color: rgba(255, 51, 102, 0.6);
    box-shadow: inset 0 8px 20px rgba(0,0,0,0.8),
                0 0 15px rgba(255,51,102,0.3);
}

/* Talpa speciale (dorata, vale di più) */
.mole-hole.golden .mole::before {
    background: radial-gradient(ellipse at 50% 40%, #FFD700 0%, #FFA500 50%, #CC8400 100%);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.mole-hole.golden .mole::after {
    content: '🤩';
}

/* Combo display */
#comboDisplay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    pointer-events: none;
}

#comboText {
    color: #ff00ff;
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 0 0 20px rgba(255, 0, 255, 0.8);
    animation: comboPopup 0.6s ease-out forwards;
}

@keyframes comboPopup {
    0% { opacity: 1; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0; transform: scale(1) translateY(-30px); }
}

/* Score popup */
.score-popup {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    color: #ff00ff;
    font-size: 1.2rem;
    font-weight: 700;
    pointer-events: none;
    animation: scoreFloat 0.8s ease-out forwards;
    text-shadow: 0 0 10px rgba(255,0,255,0.5);
    z-index: 5;
}

.score-popup.golden {
    color: #FFD700;
    font-size: 1.5rem;
    text-shadow: 0 0 10px rgba(255,215,0,0.5);
}

@keyframes scoreFloat {
    0% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-40px); }
}

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 360px) {
    #moleGrid { gap: 8px; }
    .mole::after { font-size: 1.1rem; }
    .screen h1 { font-size: 2rem; }
}
