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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #87CEEB 0%, #E0F6FF 50%, #FFF5E6 100%);
    min-height: 100vh;
    overflow: hidden;
    touch-action: none;
    user-select: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 450px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#ui-panel {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    background: rgba(40, 40, 40, 0.9);
    border-radius: 0 0 14px 14px;
    padding: 4px 16px 6px 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 10;
    display: flex;
    flex-direction: row;
    gap: 14px;
    align-items: center;
}

.ui-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 40px;
}

.ui-label {
    font-size: 7px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 1px;
}

.ui-value {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

#gameCanvas {
    display: block;
    background: linear-gradient(180deg, #F0F8FF 0%, #FFF8F0 100%);
    border-radius: 0 0 20px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

#pauseBtn {
    position: absolute;
    left: 10px;
    bottom: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 10;
}

#pauseBtn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

#pauseBtn:active {
    transform: scale(0.95);
}

#next-bubble {
    position: absolute;
    right: 20px;
    bottom: 25px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

#overlay.hidden {
    display: none;
}

#overlay-content {
    background: white;
    padding: 40px 50px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: popIn 0.3s ease-out;
}

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

#overlay-title {
    font-size: 28px;
    color: #333;
    margin-bottom: 15px;
}

#overlay-message {
    font-size: 18px;
    color: #666;
    margin-bottom: 25px;
}

#overlay-btn {
    padding: 14px 40px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#overlay-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

#overlay-btn:active {
    transform: translateY(0);
}

/* User Info */
#user-info {
    position: absolute;
    right: 10px;
    top: 10px;
    background: rgba(40, 40, 40, 0.9);
    border-radius: 20px;
    padding: 6px 14px;
    z-index: 10;
    cursor: pointer;
    transition: transform 0.2s;
}

#user-info:hover {
    transform: scale(1.05);
}

#username {
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

.clickable {
    cursor: pointer;
    transition: transform 0.2s;
}

.clickable:hover {
    transform: scale(1.1);
}

/* Leaderboard Modal */
#leaderboard-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(5px);
}

#leaderboard-modal.hidden {
    display: none;
}

#leaderboard-content {
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 350px;
    max-height: 70vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#leaderboard-content h2 {
    color: #fff;
    text-align: center;
    margin-bottom: 20px;
    font-size: 22px;
}

#leaderboard-list {
    max-height: 300px;
    overflow-y: auto;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    transition: transform 0.2s;
}

.leaderboard-item:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.1);
}

.leaderboard-item.current-user {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3), rgba(118, 75, 162, 0.3));
    border: 1px solid rgba(102, 126, 234, 0.5);
}

.rank {
    width: 30px;
    font-size: 16px;
    font-weight: 700;
    color: #ffd700;
}

.rank.silver {
    color: #c0c0c0;
}

.rank.bronze {
    color: #cd7f32;
}

.rank.normal {
    color: #888;
}

.player-name {
    flex: 1;
    color: #fff;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-score {
    color: #4ecdc4;
    font-weight: 700;
    font-size: 14px;
}

#close-leaderboard {
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

#close-leaderboard:hover {
    transform: scale(1.02);
}

@media (max-height: 700px) {
    #ui-panel {
        padding: 3px 12px 5px 12px;
        gap: 10px;
    }
    
    .ui-label {
        font-size: 6px;
    }
    
    .ui-value {
        font-size: 10px;
    }
    
    .ui-item {
        min-width: 35px;
    }
}

