body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    overflow: hidden;
    background: linear-gradient(135deg, #87CEEB 0%, #4682B4 100%);
}

#gameCanvas {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
}

#gameCanvas.active {
    display: block;
    z-index: 0;
}

#ui {
    display: none;
}

#ui.active {
    display: block;
}

#ui > * {
    pointer-events: auto;
}

.top-bar {
    display: none;
}

.level-info, .score {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}

.boxes {
    display: none;
}

.color-box {
    width: 140px;
    height: 100px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 240, 240, 0.85) 100%);
    border: 4px solid;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.6);
    transform: perspective(1000px) rotateX(10deg) rotateY(-5deg);
    transition: all 0.3s ease;
}

.color-box:hover {
    transform: perspective(1000px) rotateX(15deg) rotateY(-10deg) scale(1.05);
    box-shadow: 0 15px 40px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.6);
}

.box-content {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.mini-screw {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
    transform: perspective(500px) rotateX(30deg);
}

.screw-slots {
    display: none;
}

.slot {
    width: 70px;
    height: 70px;
    border: 4px solid #ccc;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f8f8 0%, #e8e8e8 100%);
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.1);
    transform: perspective(500px) rotateX(20deg);
    transition: all 0.2s ease;
}

.slot.filled {
    border-color: #666;
    background: linear-gradient(135deg, #f0f0f0 0%, #d0d0d0 100%);
    transform: perspective(500px) rotateX(20deg) scale(0.95);
}

.screw-icon {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
    transform: perspective(500px) rotateX(30deg);
}

.level-selector {
    display: none;
}

.control-btn, button {
    padding: 15px 30px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
    transform: perspective(1000px) rotateX(10deg);
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.control-btn:hover, button:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: perspective(1000px) rotateX(15deg) translateY(-3px);
    box-shadow: 0 12px 25px rgba(76, 175, 80, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

.control-btn:active, button:active {
    transform: perspective(1000px) rotateX(5deg) translateY(1px);
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(240, 240, 240, 0.95) 100%);
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.6);
    border: 2px solid rgba(255,255,255,0.3);
    transform: perspective(1000px) rotateX(5deg);
}

.modal-content h2 {
    color: #333;
    margin-bottom: 30px;
    text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}

#levelButtons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 30px 0;
}

.level-btn {
    padding: 20px;
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 8px 20px rgba(33, 150, 243, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
    transform: perspective(1000px) rotateX(10deg);
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.level-btn:hover {
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    transform: perspective(1000px) rotateX(15deg) translateY(-3px);
    box-shadow: 0 12px 25px rgba(33, 150, 243, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) perspective(1000px) rotateX(5deg);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(240, 240, 240, 0.95) 100%);
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.6);
    border: 2px solid rgba(255,255,255,0.3);
    display: none;
}

.win { 
    color: #4CAF50; 
    text-shadow: 0 1px 2px rgba(76, 175, 80, 0.3);
}

.lose { 
    color: #f44336; 
    text-shadow: 0 1px 2px rgba(244, 67, 54, 0.3);
}

#instructions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) perspective(1000px) rotateX(5deg);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(240, 240, 240, 0.95) 100%);
    padding: 40px;
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.6);
    border: 2px solid rgba(255,255,255,0.3);
    max-width: 500px;
}

#instructions h2 {
    margin-top: 0;
    color: #333;
    text-shadow: 0 1px 2px rgba(255,255,255,0.8);
    text-align: center;
}

#instructions ul {
    text-align: left;
    line-height: 2;
    color: #555;
}

.home-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

.home-buttons button {
    flex: 1;
    max-width: 200px;
}

.music-control {
    display: flex;
    align-items: center;
}

.music-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF6B6B 0%, #EE5A52 100%);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(255, 107, 107, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
    transform: perspective(500px) rotateX(15deg);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.music-btn:hover {
    background: linear-gradient(135deg, #EE5A52 0%, #DC4D3A 100%);
    transform: perspective(500px) rotateX(20deg) translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

.music-btn:active {
    transform: perspective(500px) rotateX(10deg) translateY(1px);
    box-shadow: 0 3px 8px rgba(255, 107, 107, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}

.music-btn.muted {
    background: linear-gradient(135deg, #95A5A6 0%, #7F8C8D 100%);
    box-shadow: 0 6px 15px rgba(149, 165, 166, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}

.music-btn.muted:hover {
    background: linear-gradient(135deg, #7F8C8D 0%, #6C7B7D 100%);
    box-shadow: 0 8px 20px rgba(149, 165, 166, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
} 