@media (max-width: 600px) {
    .game-layout {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .left-panel, .right-panel, .game-board, .panel-card, .game-info {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
    }
    .panel-card h2 {
        font-size: 18px !important;
    }
    .panel-card h3 {
        font-size: 14px !important;
    }
    .game-board {
        width: 220px !important;
        height: 220px !important;
        gap: 2px !important;
        padding: 4px !important;
    }
    .game-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 40px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin: 0;
    margin-bottom: 20px;
    gap: 30px;
    width: 100%;
    flex-wrap: wrap;
    }
    .control-group, .stats {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
}
/* Ball Sort Puzzle Game Styles */

/* Game Layout */
.game-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* Left Panel */
.left-panel {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.panel-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.panel-card h2 {
    color: #667eea;
    font-size: 24px;
    margin: 0 0 10px 0;
    text-align: center;
}

.panel-card h3 {
    color: #667eea;
    font-size: 18px;
    margin: 0 0 15px 0;
}

.game-description {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin: 0;
}

.instructions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.instructions-list li {
    padding: 10px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    font-size: 14px;
    border-left: 4px solid #667eea;
}

/* Middle Panel - Canvas */
.middle-panel {
    flex: 1;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 600px;
}

/* Right Panel - Ads */
.right-panel {
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ad-container {
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    height: 150px;
}

.ad-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.tubes-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
    gap: 18px;
    padding: 20px 15px;
    width: 100%;
    max-width: 850px;
}

.tube {
    position: relative;
    width: 70px;
    height: 240px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 50%, rgba(0, 0, 0, 0.1) 100%);
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px 15px 25px 25px;
    box-shadow: 
        inset 0 2px 8px rgba(255, 255, 255, 0.4),
        inset 0 -2px 8px rgba(0, 0, 0, 0.2),
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(255, 255, 255, 0.1);
    overflow: hidden;
    background-clip: padding-box;
    cursor: grab;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column-reverse;
    padding: 8px 5px 5px 5px;
    backdrop-filter: blur(10px);
}

.tube::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    height: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.1) 100%);
    border-radius: 50% 50% 0 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-bottom: none;
    box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.3);
}

.tube::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.3) 100%);
    border-radius: 0 0 22px 22px;
}

.tube:hover {
    transform: translateY(-8px);
    box-shadow: 
        inset 0 2px 8px rgba(255, 255, 255, 0.4),
        inset 0 -2px 8px rgba(0, 0, 0, 0.2),
        0 16px 40px rgba(0, 0, 0, 0.4),
        0 0 25px rgba(255, 255, 255, 0.2);
}

.tube.dragging {
    transform: scale(1.05);
    opacity: 0.8;
}

.tube.empty {
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.5);
}

.tube.complete {
    animation: completeGlow 0.6s ease-out forwards;
    border-color: #FFD700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.08) 50%, rgba(255, 215, 0, 0.1) 100%);
    box-shadow: 
        inset 0 2px 8px rgba(255, 255, 255, 0.5),
        inset 0 -2px 8px rgba(0, 0, 0, 0.2),
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(255, 215, 0, 0.8);
}

@keyframes completeGlow {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.1);
        filter: brightness(1.3);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

.ball {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    margin-bottom: 5px;
    margin-left: auto;
    margin-right: auto;
    cursor: grab;
    transition: all 0.2s ease;
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.35),
        inset -3px -3px 8px rgba(0, 0, 0, 0.25),
        inset 3px 3px 8px rgba(255, 255, 255, 0.4);
    position: relative;
    z-index: 1;
}

.ball:active {
    cursor: grabbing;
}

.ball::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.2));
    filter: blur(2px);
    z-index: 2;
}

/* Ball color styles */
.ball.color-1 { background: linear-gradient(135deg, #FF6B6B 0%, #FF8E8E 100%); }
.ball.color-2 { background: linear-gradient(135deg, #4ECDC4 0%, #6FE7DD 100%); }
.ball.color-3 { background: linear-gradient(135deg, #FFD93D 0%, #FFE66D 100%); }
.ball.color-4 { background: linear-gradient(135deg, #95E1D3 0%, #B8F3E7 100%); }
.ball.color-5 { background: linear-gradient(135deg, #F38181 0%, #F7A5A5 100%); }
.ball.color-6 { background: linear-gradient(135deg, #AA96DA 0%, #C7B5E0 100%); }
.ball.color-7 { background: linear-gradient(135deg, #FCBAD3 0%, #FDD2E3 100%); }
.ball.color-8 { background: linear-gradient(135deg, #A8EDEA 0%, #C8F7DC 100%); }

.ball.dragging {
    transform: scale(1.15) translateY(-12px);
    box-shadow: 
        0 12px 32px rgba(0, 0, 0, 0.45),
        inset -3px -3px 8px rgba(0, 0, 0, 0.25),
        inset 3px 3px 8px rgba(255, 255, 255, 0.4),
        0 0 25px rgba(255, 255, 255, 0.4);
    z-index: 100;
}

.ball.placed {
    animation: ballPlace 0.3s ease-out;
}

@keyframes ballPlace {
    0% {
        transform: scale(1.1) rotateZ(0deg);
        opacity: 0.7;
    }
    100% {
        transform: scale(1) rotateZ(5deg);
        opacity: 1;
    }
}

/* Tubes complete animation */
.tube.complete-bounce {
    animation: tubeBounce 0.4s ease-out;
}

@keyframes tubeBounce {
    0% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(1.1);
    }
    100% {
        transform: scaleY(1);
    }
}

/* Game info panel styling */
#timer, #moves, #best-time {
    color: #4ECDC4;
    font-weight: bold;
    font-size: 1.3em;
}

.canvas-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    height: auto;
    background: white;
    border-radius: 8px;
    overflow: visible;
}

/* Responsive design */
@media (max-width: 1024px) {
    .tubes-container {
        gap: 14px;
        padding: 20px;
    }
    
    .tube {
        width: 65px;
        height: 220px;
    }
    
    .ball {
        width: 52px;
        height: 52px;
        margin-bottom: 4px;
    }
}

@media (max-width: 768px) {
    .tubes-container {
        gap: 12px;
        padding: 15px;
        min-height: 400px;
    }
    
    .tube {
        width: 60px;
        height: 200px;
    }
    
    .ball {
        width: 48px;
        height: 48px;
        margin-bottom: 3px;
    }
}

/* Celebration modal styling adjustments for ball sort */
#celebrationMessage {
    font-size: 1.1em;
    color: #fff;
    margin: 15px 0;
}

.celebration-stats {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

.celebration-stats p {
    margin: 8px 0;
    font-size: 1.05em;
    color: #fff;
}

.celebration-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
    flex-wrap: wrap;
}

.play-again-btn {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: bold;
    background: white;
    color: #667eea;
    border: 2px solid white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.play-again-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.4);
    background: #f0f4ff;
}
