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

body {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    font-family: 'Courier New', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.handheld-device {
    background: linear-gradient(145deg, #e8e8e8, #d0d0d0);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 
        0 20px 40px rgba(0,0,0,0.3),
        inset 0 2px 4px rgba(255,255,255,0.5),
        inset 0 -2px 4px rgba(0,0,0,0.2);
    max-width: 400px;
    width: 100%;
}

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 10px;
}

.brand-logo {
    font-weight: bold;
    font-size: 14px;
    color: #2c3e50;
    letter-spacing: 2px;
}

.power-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #27ae60;
    box-shadow: 0 0 8px #27ae60;
}

.screen-container {
    position: relative;
    background: #1a1a1a;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 20px;
    box-shadow: 
        inset 0 2px 8px rgba(0,0,0,0.8),
        0 2px 4px rgba(255,255,255,0.2);
}

#gameCanvas {
    width: 100%;
    height: auto;
    border-radius: 4px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.screen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0,255,0,0.02) 50%,
        transparent 100%
    );
    pointer-events: none;
    border-radius: 8px;
}

.screen-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 1px,
        rgba(0,255,0,0.03) 1px,
        rgba(0,255,0,0.03) 2px
    );
    pointer-events: none;
}

.controls-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.dpad {
    position: relative;
    width: 80px;
    height: 80px;
}

.dpad-btn {
    position: absolute;
    background: linear-gradient(145deg, #f0f0f0, #c0c0c0);
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 
        0 2px 4px rgba(0,0,0,0.2),
        inset 0 1px 2px rgba(255,255,255,0.3);
}

.dpad-btn:active, .dpad-btn.pressed {
    background: linear-gradient(145deg, #c0c0c0, #a0a0a0);
    transform: translateY(1px);
    box-shadow: 
        0 1px 2px rgba(0,0,0,0.3),
        inset 0 2px 4px rgba(0,0,0,0.2);
}

.dpad-btn.up {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
}

.dpad-btn.down {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
}

.dpad-btn.left {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
}

.dpad-btn.right {
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
}

.right-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-btn {
    background: linear-gradient(145deg, #f0f0f0, #c0c0c0);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 10px;
    font-weight: bold;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 
        0 3px 6px rgba(0,0,0,0.3),
        inset 0 1px 2px rgba(255,255,255,0.3);
}

.action-btn:active, .action-btn.pressed {
    background: linear-gradient(145deg, #c0c0c0, #a0a0a0);
    transform: translateY(2px);
    box-shadow: 
        0 1px 3px rgba(0,0,0,0.4),
        inset 0 2px 4px rgba(0,0,0,0.2);
}

.action-btn.fire {
    background: linear-gradient(145deg, #ff6b6b, #e55555);
    color: white;
}

.action-btn.start {
    background: linear-gradient(145deg, #4ecdc4, #45b7aa);
    color: white;
}

.device-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.speaker-grill {
    width: 40px;
    height: 20px;
    background: repeating-linear-gradient(
        90deg,
        #999 0px,
        #999 2px,
        transparent 2px,
        transparent 4px
    );
    border-radius: 10px;
}

.berrry-link a {
    color: #666;
    text-decoration: none;
    font-size: 10px;
    transition: color 0.3s;
}

.berrry-link a:hover {
    color: #ff6b6b;
}

.mobile-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

.sound-btn, .pause-btn {
    background: rgba(0,0,0,0.7);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.sound-btn:hover, .pause-btn:hover {
    background: rgba(0,0,0,0.9);
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .handheld-device {
        padding: 15px;
    }
    
    .controls-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .dpad {
        width: 100px;
        height: 100px;
    }
    
    .dpad-btn.up, .dpad-btn.down, .dpad-btn.left, .dpad-btn.right {
        width: 30px;
        height: 30px;
    }
    
    .right-controls {
        flex-direction: row;
        gap: 20px;
    }
}

@media (max-width: 320px) {
    .handheld-device {
        padding: 10px;
    }
    
    .brand-logo {
        font-size: 12px;
    }
    
    .dpad {
        width: 80px;
        height: 80px;
    }
    
    .action-btn {
        width: 40px;
        height: 40px;
        font-size: 8px;
    }
}