/* Overlays */
.overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
}
#leaderboard-modal, #theme-modal {
    z-index: 20;
}
.overlay > * { pointer-events: auto; }
.hidden { display: none !important; }

/* Title Screen */
.title-content {
    text-align: center;
    color: #fff;
}
.game-title {
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-shadow: 0 4px 20px rgba(233, 69, 96, 0.5);
    margin-bottom: 0.5rem;
    animation: pulse-title 2s ease-in-out infinite;
}
.subtitle {
    font-size: 1.1rem;
    opacity: 0.7;
    animation: blink 1.5s ease-in-out infinite;
}
.title-footer {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}
.icon-btn {
    width: 48px; height: 48px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    background: rgba(255,255,255,0.08);
    font-size: 1.3rem;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}
.icon-btn:active { transform: scale(0.9); background: rgba(255,255,255,0.15); }

/* HUD */
#hud {
    pointer-events: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 1.5rem;
}
#hud-score {
    font-size: 3rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    text-align: center;
}
#hud-combo {
    font-size: 1.2rem;
    font-weight: 700;
    color: #FFD93D;
    text-align: center;
    margin-top: 0.2rem;
    animation: pop 0.3s ease-out;
}
#hud-challenge {
    position: absolute;
    top: 1.5rem;
    right: 1rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: #e94560;
    background: rgba(233, 69, 96, 0.15);
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
}

/* Game Over */
.gameover-content {
    text-align: center;
    color: #fff;
    animation: slide-up 0.4s ease-out;
}
#gameover-new-best {
    font-size: 1.1rem;
    color: #FFD93D;
    margin-bottom: 0.3rem;
    animation: pop 0.5s ease-out;
}
#gameover-score {
    font-size: 4rem;
    font-weight: 900;
    text-shadow: 0 4px 20px rgba(233, 69, 96, 0.4);
}
#gameover-message {
    font-size: 1.1rem;
    opacity: 0.8;
    margin: 0.3rem 0 0.2rem;
}
#gameover-best {
    font-size: 0.9rem;
    opacity: 0.5;
    margin-bottom: 1.5rem;
}

/* Retry Button */
.retry-button {
    display: block;
    width: 100%;
    max-width: 280px;
    margin: 0 auto 1.2rem;
    padding: 1rem 2rem;
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #e94560, #c23152);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 6px 25px rgba(233, 69, 96, 0.4);
    animation: pulse-btn 1.5s ease-in-out infinite;
    transition: transform 0.1s;
}
.retry-button:active { transform: scale(0.95); }

/* Share Buttons */
.share-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}
.share-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.1s;
}
.share-btn:active { transform: scale(0.92); }
.share-whatsapp { background: #25D366; }
.share-twitter { background: #1DA1F2; }
.share-clipboard { background: rgba(255,255,255,0.15); }
.share-icon { font-size: 1rem; }

/* Text Button */
.text-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    transition: color 0.15s;
}
.text-btn:hover { color: #fff; }

/* Modals */
.modal-content {
    background: #16213e;
    border-radius: 20px;
    padding: 1.5rem;
    width: 90%;
    max-width: 340px;
    max-height: 80vh;
    overflow-y: auto;
    color: #fff;
    text-align: center;
    animation: slide-up 0.3s ease-out;
}
.modal-content h2 { margin-bottom: 1rem; }

/* Leaderboard */
#leaderboard-tabs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}
.tab-btn {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.tab-btn.active {
    color: #fff;
    background: rgba(233, 69, 96, 0.3);
    border-color: #e94560;
}
#leaderboard-list {
    list-style: none;
    padding: 0;
    text-align: left;
}
#leaderboard-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.3rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 0.95rem;
}
#leaderboard-list li .rank { width: 2rem; opacity: 0.5; }
#leaderboard-list li .lb-score { font-weight: 700; color: #e94560; }

/* Theme Picker */
#theme-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.theme-card {
    padding: 0.8rem;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s, transform 0.1s;
}
.theme-card.active { border-color: #e94560; }
.theme-card:active { transform: scale(0.95); }
.theme-card .theme-preview {
    width: 40px; height: 40px;
    border-radius: 50%;
    margin: 0 auto 0.3rem;
}
.theme-card .theme-name { font-size: 0.8rem; color: rgba(255,255,255,0.8); }

/* Toast */
#toast {
    position: absolute;
    bottom: 2rem;
    left: 50%; transform: translateX(-50%);
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    color: #fff;
    padding: 0.5rem 1.2rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 100;
    animation: fade-in-up 0.3s ease-out;
}

/* Animations */
@keyframes pulse-title {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}
@keyframes pulse-btn {
    0%, 100% { transform: scale(1); box-shadow: 0 6px 25px rgba(233, 69, 96, 0.4); }
    50% { transform: scale(1.04); box-shadow: 0 8px 35px rgba(233, 69, 96, 0.6); }
}
@keyframes blink {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.3; }
}
@keyframes pop {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes slide-up {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes fade-in-up {
    from { transform: translate(-50%, 10px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}
