.game-nav { display: flex; justify-content: space-between; align-items: center; padding: 16px 32px; margin: 20px auto; max-width: 800px; width: 95%; }
.nav-back { color: var(--text-secondary); text-decoration: none; font-weight: 600; transition: color 0.3s; }
.nav-back:hover { color: var(--text-primary); }
.nav-title { font-size: 1.25rem; font-weight: 800; }

.game-container { display: flex; flex-direction: column; align-items: center; margin: 20px auto; padding: 0 20px; width: 100%; }
.game-header { display: flex; justify-content: space-between; align-items: center; width: 100%; max-width: 450px; padding: 16px 24px; margin-bottom: 24px; gap: 8px;}
.stat-box { display: flex; align-items: center; gap: 8px; background: var(--surface-color); padding: 8px 16px; border-radius: 8px; border: 1px solid var(--glass-border); }
.stat-value { font-family: monospace; font-size: 1.5rem; color: var(--text-primary); font-weight: 800; }

.board-wrapper {
    position: relative;
    padding: 24px;
    background: var(--surface-color);
    border-radius: 16px;
    max-width: 100%;
    margin-bottom: 40px;
    display: flex;
    justify-content: center;
}

.play-area {
    position: relative;
    width: 350px;
    height: 500px;
    flex-shrink: 0;
    min-width: 350px;
    background: #0f172a; /* Slate 900 */
    border-radius: 12px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform-origin: top center;
}

@media (max-width: 450px) {
    .board-wrapper { padding: 12px; min-height: 480px; }
    .play-area { transform: scale(0.9); }
}

@media (max-width: 380px) {
    .board-wrapper { min-height: 430px; }
    .play-area { transform: scale(0.8); }
}

@media (max-width: 340px) {
    .board-wrapper { min-height: 380px; }
    .play-area { transform: scale(0.7); }
}

.dragger-instructions {
    position: absolute;
    top: 50%; left: 0; right: 0;
    text-align: center;
    color: rgba(255,255,255,0.15);
    font-size: 1.1rem;
    font-weight: bold;
    pointer-events: none;
    z-index: 0;
}

.balls-grid {
    flex-grow: 1;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 80px; /* Leave space for tray */
    z-index: 1;
}

/* Individual Ball */
.ball {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ball-color) 0%, rgba(255,255,255,0.2) 100%);
    box-shadow: 0 4px 10px rgba(0,0,0,0.4), inset 0 2px 10px rgba(255,255,255,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    /* Bouncy glass physics transition */
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
    z-index: 5;
    pointer-events: none;
}

/* The Floor/Tray */
.tray-container {
    height: 80px;
    background: rgba(30, 41, 59, 0.95);
    border-top: 2px solid var(--glass-border);
    position: absolute;
    bottom: 0; left: 0; right: 0;
    overflow: visible; 
    touch-action: none;
    cursor: grab;
    z-index: 10;
}

.tray-container:active { cursor: grabbing; }

.hole-tray {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 20px; /* Important for alignment */
    transition: left 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.hole-tray.dragging {
    transition: none; /* Instant follow when dragging */
}

/* A Hole is an empty circle ring with colored border */
.hole {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 4px solid var(--hole-color);
    background: rgba(0,0,0,0.4); 
    box-shadow: inset 0 8px 15px rgba(0,0,0,0.8), 0 0 10px var(--hole-color);
    flex-shrink: 0;
    position: relative;
    pointer-events: none;
}
/* Deep hole effect */
.hole::after {
    content: '';
    position: absolute;
    top: 10px; left: 10px; right: 10px; bottom: 10px;
    border-radius: 50%;
    background: #000;
    box-shadow: inset 0 2px 5px rgba(255,255,255,0.1);
}

.overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.90);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    border-radius: 14px;
}
.overlay.hidden { display: none !important; }
