/* Core Game Styles: Modals, Leaderboards, Name Input, Particles, Badges, Sound */
#core-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    opacity: 1; transition: opacity 0.3s;
}
#core-overlay.hidden { opacity: 0; pointer-events: none; }

.core-modal {
    background: #fff; padding: 25px; border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3); text-align: center;
    max-width: 90%; width: 450px; position: relative;
    font-family: 'Nunito', sans-serif; max-height: 90vh; overflow-y: auto;
}
.core-modal h2 { font-family: 'Baloo 2', cursive; color: #ff5722; font-size: 2.2rem; margin-bottom: 5px; text-shadow: 1px 1px 0 #fff;}
.core-modal p { font-size: 1.1rem; color: #555; margin-bottom: 15px; }

.core-input {
    width: 100%; padding: 12px; font-size: 1.2rem; font-family: 'Baloo 2', cursive; color: #333;
    border: 3px solid #e0e0e0; border-radius: 12px; margin-bottom: 20px; box-sizing: border-box;
    text-align: center; outline: none; transition: border-color 0.2s;
}
.core-input:focus { border-color: #ff5722; }

.core-level-group { display: flex; gap: 8px; margin-bottom: 20px; justify-content: center; flex-wrap: wrap;}
.core-level-btn {
    padding: 8px 15px; border: 2px solid #ccc; background: white; border-radius: 20px;
    cursor: pointer; font-weight: bold; font-family: 'Nunito', sans-serif; transition: all 0.2s;
    font-size: 1rem; color: #555;
}
.core-level-btn:hover { background: #f5f5f5; }
.core-level-btn.active { background: #ff5722; color: white; border-color: #ff5722; box-shadow: 0 4px 0 #d84315; transform: translateY(-2px);}

.core-btn-start {
    background: #4CAF50; color: white; border: none; padding: 12px 40px; border-radius: 99px;
    font-size: 1.5rem; font-family: 'Baloo 2', cursive; cursor: pointer; box-shadow: 0 6px 0 #2E7D32;
    transition: transform 0.1s, box-shadow 0.1s; display: inline-block; text-decoration: none; margin: 10px 5px;
}
.core-btn-start:active { transform: translateY(6px); box-shadow: 0 0px 0 #2E7D32; }

/* ===== Sound Toggle Button ===== */
.core-sound-toggle {
    position: fixed; top: 12px; right: 12px; z-index: 10000;
    background: rgba(255,255,255,0.9); border: 2px solid #e0e0e0;
    width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
    font-size: 1.4rem; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12); transition: transform 0.2s, background 0.2s;
}
.core-sound-toggle:hover { transform: scale(1.1); background: #fff; }
.core-sound-toggle.muted { background: #fee; border-color: #f44336; }

/* ===== Leaderboard ===== */
.core-leaderboard { text-align: left; margin-top: 20px; border-top: 2px dashed #ddd; padding-top: 15px;}
.core-leaderboard h3 { font-family: 'Baloo 2', cursive; color: #fbc02d; text-align: center; margin-bottom: 15px; text-shadow: 1px 1px 1px rgba(0,0,0,0.1); font-size: 1.5rem;}
.core-lb-list { max-height: 200px; overflow-y: auto; padding-right: 5px; }
.core-lb-list::-webkit-scrollbar { width: 6px; }
.core-lb-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.core-lb-item {
    display: flex; justify-content: space-between; padding: 10px 15px; border-radius: 10px; margin-bottom: 8px;
    background: #f1f5f9; font-weight: bold; align-items: center; border: 1px solid #e2e8f0;
}
.core-lb-item.top1 { background: #fffde7; border-color: #fff59d; color: #f57f17; transform: scale(1.02); box-shadow: 0 2px 5px rgba(0,0,0,0.05);}
.core-lb-item.top2 { background: #f5f5f5; border-color: #e0e0e0; color: #616161; }
.core-lb-item.top3 { background: #efebe9; border-color: #d7ccc8; color: #5d4037; }

.core-lb-rank { width: 35px; font-size: 1.2rem; text-align: center;}
.core-lb-name { flex: 1; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-family: 'Nunito', sans-serif;}
.core-lb-level { font-size: 0.8rem; background: rgba(0,0,0,0.05); padding: 2px 6px; border-radius: 5px; margin-left: 5px; color: #7f8c8d; font-weight: 600;}
.core-lb-score { color: #d32f2f; font-family: 'Baloo 2', cursive; font-size: 1.2rem;}

/* ===== Badge ===== */
.core-lb-badge {
    font-size: 0.75rem; margin-left: 4px;
    animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}
.core-badges-bar {
    display: flex; gap: 6px; justify-content: center; margin-top: 10px; flex-wrap: wrap;
}
.core-badge-chip {
    display: inline-flex; align-items: center; gap: 4px;
    background: linear-gradient(135deg, #fff8e1, #ffe082); padding: 4px 10px;
    border-radius: 20px; font-size: 0.8rem; font-weight: 700;
    color: #f57f17; border: 1px solid #ffca28;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ===== Particle Canvas ===== */
#core-particles-canvas {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 10001;
}

/* ===== New Record ===== */
.core-new-record {
    display: inline-block; background: linear-gradient(135deg, #ffd54f, #ff6f00);
    color: white; padding: 4px 14px; border-radius: 20px; font-size: 0.9rem;
    font-weight: 800; margin-bottom: 8px; animation: recordBounce 0.6s ease;
    box-shadow: 0 2px 8px rgba(255,111,0,0.3);
}
@keyframes recordBounce {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 600px) {
    .core-modal { padding: 20px; }
    .core-input { font-size: 1rem; }
    .core-btn-start { font-size: 1.2rem; padding: 10px 30px;}
    .core-level-btn { font-size: 0.9rem; padding: 6px 12px;}
    .core-sound-toggle { width: 38px; height: 38px; font-size: 1.2rem; }
}
