* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    font-family: 'Varela Round', system-ui, -apple-system, sans-serif;
    background: #0a0a12;
    color: #fff;
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    font-weight: bold;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3vmin;
    background: #0a0a12;
    position: relative;
    overflow: hidden;
}

/* STELLE CSS ANIMATE */
.screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 30% 40%, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 50% 10%, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 70% 30%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 90% 50%, rgba(255,255,255,0.7), transparent),
        radial-gradient(2px 2px at 20% 70%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 40% 90%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 60% 60%, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 80% 80%, rgba(255,255,255,0.5), transparent),
        radial-gradient(2px 2px at 15% 50%, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 45% 25%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 75% 75%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 95% 15%, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 5% 85%, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 35% 55%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 65% 45%, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 85% 35%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 25% 95%, rgba(255,255,255,0.6), transparent);
    background-size: 100% 100%;
    animation: twinkle 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.9; }
}

.hidden {
    display: none !important;
}

/* MENU SCREEN */
.logo {
    font-size: 12vmin;
    font-weight: 900;
    background: linear-gradient(135deg, #ff00ff, #00ffff, #ff00ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1vmin;
    animation: glow 2s ease infinite;
    filter: drop-shadow(0 0 3vmin rgba(0, 255, 255, 0.8));
    position: relative;
    z-index: 1;
}

.subtitle {
    font-size: 8vmin;
    color: #fff;
    margin-bottom: 6vmin;
    letter-spacing: 0.5em;
    text-shadow: 0 0 2vmin rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 1;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 2vmin;
    width: 100%;
    max-width: 60vmin;
    position: relative;
    z-index: 1;
}

.menu-btn {
    padding: 2.5vmin 5vmin;
    font-size: 3.5vmin;
    font-weight: bold;
    border: none;
    border-radius: 2vmin;
    background: linear-gradient(135deg, #ff00ff, #00ffff);
    color: #fff;
    cursor: pointer;
    font-family: 'Varela Round', sans-serif;
    transition: all 0.2s;
    box-shadow: 0 0.5vmin 3vmin rgba(255, 0, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5vmin;
}

.menu-icon {
    width: 3.5vmin;
    height: 3.5vmin;
    color: #FFFFFF;
    filter: drop-shadow(0 0 0.5vmin rgba(255, 255, 255, 0.8));
}

.menu-btn:hover {
    transform: translateY(-0.5vmin);
    box-shadow: 0 1vmin 4vmin rgba(255, 0, 255, 0.8);
}

.menu-btn:active {
    transform: translateY(0);
}

.footer {
    position: absolute;
    bottom: 2vmin;
    font-size: 2vmin;
    color: #666;
    z-index: 1;
}

.mapi-games {
    color: #FF0000;
    font-weight: bold;
    text-shadow: 0 0 1vmin rgba(255, 0, 0, 0.8);
}

@keyframes glow {
    0%, 100% { filter: drop-shadow(0 0 3vmin rgba(0, 255, 255, 0.8)) brightness(1); }
    50% { filter: drop-shadow(0 0 5vmin rgba(255, 0, 255, 1)) brightness(1.2); }
}

/* GAME SCREEN - FLEX PROPORZIONALE */
#gameScreen {
    padding: 0;
    justify-content: flex-start;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* HUD */
#gameHUD {
    position: relative;
    width: 100%;
    height: 10vmin;
    min-height: 50px;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2vmin;
    border-bottom: 0.3vmin solid rgba(255, 0, 255, 0.5);
    flex-shrink: 0;
    z-index: 10;
}

.hud-left, .hud-center, .hud-right {
    display: flex;
    align-items: center;
    flex: 1;
}

.hud-left { justify-content: flex-start; }
.hud-center { justify-content: center; }
.hud-right { justify-content: flex-end; }

.gem-display, .best-display {
    background: rgba(255, 255, 255, 0.1);
    padding: 1vmin 2vmin;
    border-radius: 3vmin;
    font-size: 2.5vmin;
    white-space: nowrap;
    border: 0.2vmin solid rgba(0, 255, 255, 0.4);
}

.gem-display {
    background: linear-gradient(135deg, rgba(0, 191, 255, 0.2), rgba(0, 255, 255, 0.1));
    display: flex;
    align-items: center;
    gap: 0.8vmin;
}

.gem-icon {
    width: 3vmin;
    height: 3vmin;
    filter: drop-shadow(0 0 0.5vmin rgba(0, 255, 255, 0.8));
    animation: gemGlow 2s ease-in-out infinite;
}

.crown-icon {
    width: 3vmin;
    height: 3vmin;
    filter: drop-shadow(0 0 0.5vmin rgba(255, 215, 0, 0.8));
    animation: crownGlow 2s ease-in-out infinite;
}

@keyframes gemGlow {
    0%, 100% { filter: drop-shadow(0 0 0.5vmin rgba(0, 255, 255, 0.8)); }
    50% { filter: drop-shadow(0 0 1.2vmin rgba(0, 255, 255, 1)); }
}

@keyframes crownGlow {
    0%, 100% { filter: drop-shadow(0 0 0.5vmin rgba(255, 215, 0, 0.8)); }
    50% { filter: drop-shadow(0 0 1.2vmin rgba(255, 215, 0, 1)); }
}

.best-display {
    display: flex;
    align-items: center;
    gap: 0.8vmin;
}

.best-display {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 165, 0, 0.1));
    border-color: rgba(255, 215, 0, 0.4);
}

#score {
    font-size: 6vmin;
    text-shadow: 0 0 2vmin rgba(255, 255, 255, 0.5);
}

/* CANVAS - FLEX GROW */
#gameCanvas {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
    display: block;
    background: #0a0a12;
}

/* SHOOTER */
#shooter {
    position: relative;
    width: 100%;
    height: 18vmin;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 15;
    background: rgba(0, 0, 0, 0.5);
}

.shooter-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2vmin;
    position: relative;
    margin-left: 10.5vmin;
}

#currentBlock {
    width: 12vmin;
    height: 12vmin;
    min-width: 50px;
    min-height: 50px;
    border: 0.5vmin solid #fff;
    border-radius: 2vmin;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5vmin;
    background: #9932CC;
    box-shadow: 0 0 3vmin currentColor;
    z-index: 16;
    animation: currentPulse 1.2s ease infinite;
    position: relative;
}

#currentBlock::after {
    content: '↑';
    position: absolute;
    bottom: -5vmin;
    left: 50%;
    transform: translateX(-50%);
    font-size: 4vmin;
    color: rgba(255, 255, 255, 0.8);
    animation: arrowBounce 1s ease infinite;
}

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

@keyframes arrowBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.6; }
    50% { transform: translateX(-50%) translateY(-1vmin); opacity: 1; }
}

/* TIMER */
#dropTimer {
    position: absolute;
    top: -3vmin;
    left: 50%;
    transform: translateX(-50%);
    width: 6vmin;
    height: 6vmin;
    min-width: 30px;
    min-height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5vmin;
    font-weight: bold;
    color: #fff;
    background: rgba(255, 0, 0, 0.8);
    border: 0.3vmin solid #fff;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 20;
}

#dropTimer.active {
    opacity: 1;
    animation: timerPulse 0.5s ease infinite;
}

#dropTimer.fadeout {
    opacity: 0 !important;
    animation: none;
}

#dropTimer.urgent {
    background: #ff0000;
    animation: timerUrgent 0.3s ease infinite;
}

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

@keyframes timerUrgent {
    0%, 100% { transform: translateX(-50%) scale(1); background: #ff0000; }
    50% { transform: translateX(-50%) scale(1.2); background: #ff4444; }
}

/* NEXT BLOCK - accanto al principale */
.next-block {
    position: relative;
    width: 8vmin;
    height: 8vmin;
    min-width: 40px;
    min-height: 40px;
    border: 0.4vmin solid rgba(255, 255, 255, 0.6);
    border-radius: 1.5vmin;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5vmin;
    background: rgba(0, 255, 255, 0.15);
    z-index: 16;
}

.next-block::before {
    content: 'NEXT';
    position: absolute;
    top: -2.5vmin;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.8vmin;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.1vmin;
}

/* BANNER */
#banner {
    position: relative;
    width: 100%;
    height: 12vmin;
    min-height: 60px;
    background: linear-gradient(135deg, #7B1FA2, #9C27B0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 12;
    flex-shrink: 0;
    overflow: hidden;
    border-top: 2px solid #FF00FF;
    box-shadow: 0 -5px 20px rgba(255, 0, 255, 0.5);
}

#banner::before {
    content: '';
    position: absolute;
    top: -2vmin;
    left: 0;
    width: 200%;
    height: 4vmin;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: waveMove 8s linear infinite;
}

@keyframes waveMove {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

#banner p {
    font-size: 4vmin;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 0 20px rgba(255, 0, 255, 0.5);
    padding: 0 2vmin;
    text-align: center;
    z-index: 1;
    transition: opacity 0.3s;
    animation: bannerPulse 2s ease-in-out infinite;
}

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

/* ICON BUTTONS */
.icon-btn {
    position: fixed;
    top: 12vmin;
    width: 7vmin;
    height: 7vmin;
    min-width: 40px;
    min-height: 40px;
    border: 0.3vmin solid #00FFFF;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-svg {
    width: 3.5vmin;
    height: 3.5vmin;
    min-width: 18px;
    min-height: 18px;
    color: #00FFFF;
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    transform: scale(1.1);
}

.icon-btn:hover .icon-svg {
    color: #FF00FF;
}

.icon-btn:active {
    transform: scale(0.95);
}

#pauseBtn { right: 2vmin; }
#backBtn { left: 2vmin; }

/* SCREENS */
#leaderboardScreen h1, #settingsScreen h1, #achievementsScreen h1 {
    font-size: 6vmin;
    margin-bottom: 3vmin;
    text-shadow: 0 0 3vmin rgba(0, 255, 255, 0.8);
    position: relative;
    z-index: 1;
}

.list-container {
    width: 100%;
    max-width: 70vmin;
    max-height: 50vh;
    overflow-y: auto;
    margin-bottom: 3vmin;
    position: relative;
    z-index: 1;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    padding: 2vmin 3vmin;
    margin: 1.5vmin 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1.5vmin;
    font-size: 2.8vmin;
}

.settings-container {
    width: 100%;
    max-width: 70vmin;
    margin-bottom: 3vmin;
    position: relative;
    z-index: 1;
}

.setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2.5vmin;
    margin: 2vmin 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1.5vmin;
    font-size: 3vmin;
}

.toggle-btn {
    padding: 1.5vmin 4vmin;
    border: none;
    border-radius: 3vmin;
    background: #00ff00;
    color: #000;
    font-weight: bold;
    font-size: 2.5vmin;
    cursor: pointer;
    font-family: 'Varela Round', sans-serif;
    transition: all 0.2s;
}

.toggle-btn.off {
    background: #ff0000;
    color: #fff;
}

#volumeSlider {
    flex: 1;
    margin: 0 2vmin;
    height: 1vmin;
    border-radius: 0.5vmin;
}

/* OVERLAY */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.panel {
    background: rgba(20, 20, 30, 0.98);
    border: 0.4vmin solid rgba(255, 0, 255, 0.6);
    border-radius: 3vmin;
    padding: 5vmin 4vmin;
    max-width: 60vmin;
    width: 90%;
    text-align: center;
    box-shadow: 0 1vmin 6vmin rgba(255, 0, 255, 0.6);
}

.panel h2 {
    font-size: 5vmin;
    margin-bottom: 3vmin;
    color: #00ffff;
    text-shadow: 0 0 3vmin #00ffff;
}

.stats {
    margin: 3vmin 0;
    font-size: 3vmin;
}

.stats p {
    margin: 1.5vmin 0;
}

#playerName {
    width: 100%;
    padding: 2vmin;
    margin: 2.5vmin 0;
    border: 0.3vmin solid rgba(255, 255, 255, 0.3);
    border-radius: 1.5vmin;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 2.8vmin;
    text-align: center;
    font-family: 'Varela Round', sans-serif;
    font-weight: bold;
}

#playerName::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.panel .menu-btn {
    width: 100%;
    margin: 1.5vmin 0;
}

/* 2048 POPUP */
.popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 99999;
    width: 90vmin;
    max-width: 500px;
    height: auto;
    padding: 4vmin;
    background: linear-gradient(135deg, #1a0033 0%, #330066 50%, #1a0033 100%);
    border: 0.8vmin solid #FFD700;
    border-radius: 3vmin;
    box-shadow: 0 0 50px #FFD700, 0 0 100px rgba(255, 215, 0, 0.5), inset 0 0 30px rgba(255, 215, 0, 0.2);
}

.popup-epic {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: popIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.decorations {
    position: absolute;
    top: 5%;
    width: 100%;
    display: flex;
    justify-content: space-around;
    z-index: 5;
}

.ornament {
    font-size: 8vmin;
    animation: swing 2s ease-in-out infinite;
}

@keyframes swing {
    0%, 100% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
}

.rays {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vmin;
    height: 60vmin;
    background: 
        linear-gradient(0deg, transparent 40%, rgba(255, 215, 0, 0.3) 50%, transparent 60%),
        linear-gradient(45deg, transparent 40%, rgba(255, 165, 0, 0.3) 50%, transparent 60%),
        linear-gradient(90deg, transparent 40%, rgba(255, 215, 0, 0.3) 50%, transparent 60%),
        linear-gradient(135deg, transparent 40%, rgba(255, 165, 0, 0.3) 50%, transparent 60%);
    border-radius: 50%;
    animation: rotateRays 4s linear infinite;
    z-index: 1;
}

@keyframes rotateRays {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.milestone-title {
    font-size: 8vmin;
    font-weight: 900;
    color: #FFD700;
    text-shadow: 0 0 20px #FFD700, 0 0 40px #FFA500, 0 0 60px #FF8C00;
    margin-bottom: 2vmin;
    z-index: 10;
    animation: titlePulse 0.5s ease infinite;
    text-align: center;
}

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

.milestone-block {
    font-size: 14vmin;
    font-weight: 900;
    color: #FFFFFF;
    background: linear-gradient(135deg, #00BFFF, #0080FF);
    border: 0.6vmin solid #FFFFFF;
    border-radius: 3vmin;
    padding: 3vmin 6vmin;
    box-shadow: 0 0 6vmin #00BFFF;
    margin-bottom: 2vmin;
    z-index: 10;
    animation: blockFloat 2s ease-in-out infinite;
}

.trophy-svg {
    width: 15vmin;
    height: 15vmin;
    filter: drop-shadow(0 0 2vmin #FFD700);
    animation: trophyBounce 1s ease infinite;
    z-index: 10;
}

@keyframes trophyBounce {
    0%, 100% { transform: scale(1) rotate(-5deg); }
    50% { transform: scale(1.1) rotate(5deg); }
}

.milestone-subtitle {
    font-size: 4vmin;
    font-weight: bold;
    color: #FFFFFF;
    text-shadow: 0 0 2vmin #FFD700;
    margin-top: 2vmin;
    z-index: 10;
    animation: subtitlePulse 0.5s ease infinite;
}

@keyframes subtitlePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

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

.trophy-container {
    position: relative;
    z-index: 10;
    margin-bottom: 4vmin;
}

.trophy-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 35vmin;
    height: 35vmin;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, transparent 70%);
    animation: glowPulse 1.5s ease infinite;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}

.trophy-cup {
    font-size: 18vmin;
    animation: trophyBounce 1s ease infinite;
}

@keyframes trophyBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-2vmin) scale(1.03); }
}

.ribbon {
    position: absolute;
    bottom: 10%;
    width: 55vmin;
    height: 15vmin;
    background: linear-gradient(135deg, #DC143C 0%, #8B0000 50%, #DC143C 100%);
    clip-path: polygon(0 30%, 15% 0, 85% 0, 100% 30%, 95% 50%, 100% 70%, 85% 100%, 15% 100%, 0 70%, 5% 50%);
    z-index: 5;
}

.fireworks {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 3;
}

.firework {
    position: absolute;
    width: 1vmin;
    height: 1vmin;
    border-radius: 50%;
    animation: explode 1.5s ease-out infinite;
}

.fw-1 { top: 20%; left: 10%; background: #FF1493; }
.fw-2 { top: 30%; right: 10%; background: #00FFFF; animation-delay: 0.3s; }
.fw-3 { bottom: 30%; left: 15%; background: #FFD700; animation-delay: 0.6s; }
.fw-4 { bottom: 25%; right: 15%; background: #7FFF00; animation-delay: 0.9s; }

@keyframes explode {
    0% { transform: scale(0); opacity: 1; box-shadow: 0 0 0 0 currentColor; }
    50% { opacity: 1; }
    100% { transform: scale(1); opacity: 0; box-shadow: 0 -8vmin 0 3vmin currentColor, 8vmin 0 0 3vmin currentColor, 0 8vmin 0 3vmin currentColor, -8vmin 0 0 3vmin currentColor; }
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

/* ACHIEVEMENTS */
.achievements-container {
    max-height: 45vh;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(35vmin, 1fr));
    gap: 1.5vmin;
    padding: 2vmin;
    width: 100%;
    max-width: 90vmin;
    position: relative;
    z-index: 1;
}

.achievements-section-title {
    font-size: 3.5vmin;
    font-weight: 900;
    color: #FF00FF;
    text-shadow: 0 0 10px #FF00FF;
    text-align: center;
    margin-bottom: 2vmin;
    letter-spacing: 0.3vmin;
    border-bottom: 2px solid rgba(255, 0, 255, 0.3);
    padding-bottom: 1vmin;
}

.achievement-item {
    background: rgba(0, 0, 0, 0.6);
    border: 0.3vmin solid rgba(255, 255, 255, 0.2);
    border-radius: 1.5vmin;
    padding: 1.5vmin;
    display: flex;
    align-items: center;
    gap: 1.5vmin;
}

.achievement-item.unlocked {
    border-color: #FFD700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 0, 255, 0.15));
}

.achievement-item.locked {
    opacity: 0.5;
    filter: grayscale(1);
}

.achievement-icon-big {
    font-size: 5vmin;
    min-width: 5vmin;
    text-align: center;
    color: #00FFFF;
    text-shadow: 0 0 1.5vmin #00FFFF;
}

.achievement-item.unlocked .achievement-icon-big {
    color: #FFD700;
    text-shadow: 0 0 1.5vmin #FFD700;
}

.achievement-details {
    flex: 1;
    text-align: left;
}

.achievement-details h4 {
    margin: 0 0 0.5vmin 0;
    font-size: 2.2vmin;
    color: #FFD700;
}

.achievement-details p {
    margin: 0;
    font-size: 1.8vmin;
    color: #AAA;
}

.stats-summary {
    background: rgba(0, 0, 0, 0.6);
    border: 0.3vmin solid rgba(0, 255, 255, 0.4);
    border-radius: 1.5vmin;
    padding: 2.5vmin;
    margin: 2vmin auto;
    max-width: 50vmin;
    text-align: left;
    position: relative;
    z-index: 1;
}

.stats-summary h3 {
    display: flex;
    align-items: center;
    color: #00FFFF;
    margin-bottom: 1.5vmin;
    font-size: 2.8vmin;
}

.stat-line {
    display: flex;
    align-items: center;
    gap: 1.5vmin;
    margin: 1.2vmin 0;
    font-size: 2.2vmin;
    color: #FFF;
}

.stat-icon, .stat-icon-title {
    width: 3vmin;
    height: 3vmin;
    min-width: 18px;
    min-height: 18px;
    color: #00FFFF;
}

.stats-summary span {
    color: #FFD700;
    font-weight: bold;
}

/* ACHIEVEMENT NOTIFICATION */
.achievement-notif {
    position: fixed;
    top: -30vmin;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #FFD700, #FF6600);
    border: 0.4vmin solid #FFF;
    border-radius: 2.5vmin;
    padding: 2.5vmin 3.5vmin;
    display: flex;
    align-items: center;
    gap: 2.5vmin;
    box-shadow: 0 1vmin 4vmin rgba(255, 215, 0, 0.7);
    z-index: 10000;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 90%;
}

.achievement-notif.show {
    top: 3vmin;
}

.achievement-icon {
    font-size: 8vmin;
    animation: bounce 1s ease infinite;
}

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

.achievement-info {
    text-align: left;
}

.achievement-title {
    font-size: 1.8vmin;
    font-weight: bold;
    color: #000;
    margin-bottom: 0.5vmin;
}

.achievement-name {
    font-size: 3vmin;
    font-weight: bold;
    color: #FFF;
    text-shadow: 0.2vmin 0.2vmin 0.4vmin rgba(0, 0, 0, 0.5);
    margin-bottom: 0.5vmin;
}

.achievement-desc {
    font-size: 1.8vmin;
    color: rgba(255, 255, 255, 0.9);
}

/* SCROLLBAR */
::-webkit-scrollbar {
    width: 1vmin;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1vmin;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 0, 255, 0.5);
    border-radius: 1vmin;
}

/* NOTIFICA IN-GAME */
.game-notification {
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    font-size: 8vmin;
    font-weight: 900;
    color: #FFFFFF;
    text-shadow: 0 0 20px currentColor, 0 0 40px currentColor, 0 0 60px currentColor;
    z-index: 99999;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    text-align: center;
    white-space: nowrap;
}

.game-notification.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    animation: notifPop 0.5s ease;
}

@keyframes notifPop {
    0% { transform: translate(-50%, -50%) scale(0.5); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* MILESTONE OVERLAY ANIMATIONS */
@keyframes overlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes blockBounce {
    0%, 100% { transform: scale(1) rotate(-3deg); }
    50% { transform: scale(1.15) rotate(3deg); }
}

@keyframes subtitlePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}

@keyframes iconSpin {
    0% { transform: scale(1) rotate(-5deg); }
    25% { transform: scale(1.1) rotate(5deg); }
    50% { transform: scale(1) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
    100% { transform: scale(1) rotate(-5deg); }
}

/* CUSTOM DIALOG FUTURISTICO */
.custom-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-dialog.hidden {
    display: none;
}

.dialog-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.dialog-content {
    position: relative;
    background: linear-gradient(135deg, #1a0033 0%, #330066 50%, #1a0033 100%);
    border: 3px solid #FF00FF;
    border-radius: 2vmin;
    padding: 4vmin;
    max-width: 85vmin;
    text-align: center;
    box-shadow: 0 0 30px #FF00FF, 0 0 60px rgba(255, 0, 255, 0.5), inset 0 0 20px rgba(255, 0, 255, 0.1);
    animation: dialogPop 0.3s ease;
}

@keyframes dialogPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.dialog-icon {
    font-size: 10vmin;
    margin-bottom: 2vmin;
    animation: iconPulse 1s ease infinite;
}

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

.dialog-title {
    font-size: 5vmin;
    font-weight: 900;
    color: #FF4444;
    text-shadow: 0 0 15px #FF4444;
    margin-bottom: 2vmin;
}

.dialog-body {
    font-size: 2.8vmin;
    color: #fff;
    margin-bottom: 3vmin;
}

.dialog-body ul {
    list-style: none;
    padding: 0;
    margin: 1.5vmin 0;
}

.dialog-body li {
    padding: 0.8vmin 0;
    color: #ccc;
}

.dialog-body li::before {
    content: "✗ ";
    color: #FF4444;
}

.dialog-warning {
    color: #FFD700;
    font-weight: bold;
    font-size: 3vmin;
    text-shadow: 0 0 10px #FFD700;
    margin-top: 2vmin;
}

.dialog-buttons {
    display: flex;
    gap: 3vmin;
    justify-content: center;
    margin-top: 3vmin;
}

.dialog-btn {
    padding: 2vmin 4vmin;
    font-size: 3vmin;
    font-weight: bold;
    border: none;
    border-radius: 1.5vmin;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dialog-cancel {
    background: linear-gradient(135deg, #333 0%, #555 100%);
    color: #fff;
    border: 2px solid #666;
}

.dialog-cancel:hover {
    background: linear-gradient(135deg, #444 0%, #666 100%);
    transform: scale(1.05);
}

.dialog-confirm {
    background: linear-gradient(135deg, #FF0000 0%, #CC0000 100%);
    color: #fff;
    border: 2px solid #FF4444;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.5);
}

.dialog-confirm:hover {
    background: linear-gradient(135deg, #FF3333 0%, #FF0000 100%);
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(255, 0, 0, 0.8);
}

/* HOW TO PLAY */
#howtoScreen h1 {
    font-size: 6vmin;
    margin-bottom: 3vmin;
    color: #00FFFF;
    text-shadow: 0 0 3vmin #00FFFF;
    position: relative;
    z-index: 1;
}

.howto-container {
    width: 100%;
    max-width: 80vmin;
    max-height: 60vh;
    overflow-y: auto;
    padding: 3vmin;
    background: rgba(0, 0, 0, 0.6);
    border: 0.3vmin solid rgba(0, 255, 255, 0.4);
    border-radius: 2vmin;
    margin-bottom: 3vmin;
    position: relative;
    z-index: 1;
}

.howto-section {
    margin-bottom: 3vmin;
    text-align: left;
}

.howto-section h3 {
    color: #FF00FF;
    font-size: 3vmin;
    margin-bottom: 1.5vmin;
    display: flex;
    align-items: center;
    gap: 1.5vmin;
}

.howto-svg {
    width: 4vmin;
    height: 4vmin;
    flex-shrink: 0;
}

.howto-section p {
    color: #DDD;
    font-size: 2.5vmin;
    line-height: 1.6;
    margin-bottom: 1vmin;
}

.howto-icon {
    font-size: 4vmin;
}

.howto-blocks {
    display: flex;
    gap: 1vmin;
    margin: 2vmin 0;
    justify-content: center;
    flex-wrap: wrap;
}

.howto-block {
    width: 8vmin;
    height: 8vmin;
    border-radius: 1vmin;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3vmin;
    font-weight: bold;
    color: #fff;
    border: 0.3vmin solid #fff;
}

.howto-arrow {
    font-size: 4vmin;
    color: #FFD700;
}


/* ============================================
   XMAS MODE STYLES - Active in December
   ============================================ */

.xmas-mode {
    background: linear-gradient(180deg, 
        #0d1b2a 0%, 
        #1b263b 30%, 
        #2d1b3d 60%, 
        #1a1a2e 100%) !important;
}

.xmas-mode .screen {
    background: linear-gradient(180deg, 
        #0d1b2a 0%, 
        #1b263b 30%, 
        #2d1b3d 60%, 
        #1a1a2e 100%) !important;
}

.xmas-mode #gameScreen {
    background: linear-gradient(180deg, 
        #0a1525 0%, 
        #152035 40%, 
        #251530 70%, 
        #151525 100%) !important;
}

.xmas-mode .logo {
    animation: xmasGlow 2s ease-in-out infinite;
    font-size: 10vmin !important;
}

.xmas-mode .subtitle {
    font-size: 6vmin !important;
    margin-bottom: 4vmin !important;
    letter-spacing: 0.8vmin !important;
}

.xmas-mode .footer {
    bottom: 3vmin !important;
    font-size: 2.2vmin !important;
}

@keyframes xmasGlow {
    0%, 100% { 
        text-shadow: 0 0 20px #00FF00, 0 0 40px #FF0000; 
    }
    50% { 
        text-shadow: 0 0 30px #FF0000, 0 0 60px #00FF00; 
    }
}

.xmas-mode .menu-btn {
    background: linear-gradient(135deg, #FF0000, #228B22) !important;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.5);
}

.xmas-mode .menu-btn:hover {
    box-shadow: 0 0 25px rgba(255, 0, 0, 0.8), 0 0 35px rgba(34, 139, 34, 0.6);
}

.xmas-mode #banner {
    border-top-color: #228B22;
    box-shadow: 0 -5px 20px rgba(34, 139, 34, 0.5);
}

.xmas-mode .game-notification {
    text-shadow: 0 0 20px #FF0000, 0 0 40px #00FF00, 0 0 60px #FFD700 !important;
}

/* XMAS Blocchi Current e Next - gestiti da JavaScript */
.xmas-mode #currentBlock,
.xmas-mode #nextBlock {
    position: relative;
    overflow: hidden;
}



/* MORE GAMES button (under MAPI GAMES) */
.more-games-wrap{
    margin-top: .6vmin;
    text-align: center;
}

.more-games-btn{
    display: inline-block;
    background: #ff0000;
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.6vmin;
    padding: .5vmin 1.2vmin;
    border-radius: .9vmin;
    box-shadow: 0 0 1vmin rgba(255, 0, 0, 0.5);
    transition: transform .12s ease, filter .12s ease;
}

.more-games-btn:hover{
    transform: translateY(-0.2vmin);
    filter: brightness(1.05);
}

.more-games-btn:active{
    transform: translateY(0);
}
