/* ============================================================
   Rickyedit Games — Lives System v3
   ============================================================ */

/* ── Lives selector (start screen) ────────────────────────── */
.lives-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 0;
}
.lives-selector-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--muted, #b9bbbe);
    margin-right: 2px;
}
.lives-selector-count {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--pink, #ff33cc);
    min-width: 20px;
    text-align: center;
}
.lives-heart-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    padding: 4px;
    transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
    filter: grayscale(0.8) opacity(0.35);
}
.lives-heart-btn:hover {
    transform: scale(1.15);
    filter: grayscale(0.4) opacity(0.6);
    background: rgba(255, 255, 255, 0.08);
}
.lives-heart-btn.active {
    filter: none;
    transform: scale(1.1);
    border-color: var(--pink, #ff33cc);
    background: rgba(255, 51, 204, 0.12);
}
.lives-heart-btn.active:hover {
    transform: scale(1.2);
}
.lives-heart-btn img {
    width: 2em;
    height: 2em;
    object-fit: contain;
    pointer-events: none;
    display: block;
}

/* ── Lives display (in-game) ──────────────────────────────── */
#livesDisplay {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 282px;
    transition: opacity 0.3s ease;
    overflow: visible;
}
#livesDisplay .life-heart {
    width: 50px;
    height: 50px;
    object-fit: contain;
    display: block;
    animation: heart-wave 1.8s ease-in-out infinite;
    will-change: transform;
    backface-visibility: hidden;
}
#livesDisplay .life-logo {
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(255, 51, 204, 0.5));
    opacity: 0.8;
    max-height: 70px;
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes heart-wave {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(0, -12px, 0); }
}
@keyframes heart-death {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(0.85); opacity: 0.3; }
}
@keyframes heart-death-obs {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.4; }
    25% { transform: scale(0.9) rotate(-5deg); opacity: 0.3; }
    75% { transform: scale(0.9) rotate(5deg); opacity: 0.3; }
}

/* ── Game Over hearts display ────────────────────────────── */
.gameover-hearts {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 12px 0;
}
.gameover-hearts img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    animation: heart-death 1.8s ease-in-out infinite;
}
.gameover-hearts img:nth-child(2) { animation-delay: 0.15s; }
.gameover-hearts img:nth-child(3) { animation-delay: 0.3s; }
.gameover-hearts img:nth-child(4) { animation-delay: 0.45s; }
.gameover-hearts img:nth-child(5) { animation-delay: 0.6s; }

/* ── Game Over overlay ────────────────────────────────────── */
.gameover-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}
.gameover-overlay.show {
    opacity: 1;
    pointer-events: auto;
}
.gameover-card {
    background: var(--card-strong, #222329);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px 48px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    animation: gameover-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes gameover-pop {
    0%   { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.gameover-card .gameover-icon {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin-bottom: 16px;
    animation: gameover-icon-shake 0.6s ease 0.3s;
}
@keyframes gameover-icon-shake {
    0%, 100% { transform: rotate(0); }
    20%      { transform: rotate(-15deg); }
    40%      { transform: rotate(12deg); }
    60%      { transform: rotate(-8deg); }
    80%      { transform: rotate(5deg); }
}
.gameover-card h2 {
    font-size: 1.8rem;
    font-weight: 900;
    margin: 0 0 8px;
    background: linear-gradient(135deg, #ff33cc, #ff168c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.gameover-card p {
    color: var(--muted, #b9bbbe);
    font-size: 1rem;
    margin: 0 0 6px;
    line-height: 1.5;
}
.gameover-card .gameover-score {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--yellow, #f1c40f);
    margin: 12px 0 20px;
}
.gameover-card .gameover-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.gameover-card .gameover-actions button {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    padding: 12px 28px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.gameover-card .gameover-actions button:hover {
    transform: translateY(-2px);
}
.gameover-card .gameover-actions .btn-restart {
    background: linear-gradient(135deg, var(--yellow, #f1c40f), var(--pink, #ff33cc));
    color: #0d0d10;
    box-shadow: 0 8px 30px rgba(255, 51, 204, 0.35);
}
.gameover-card .gameover-actions .btn-home {
    background: rgba(255, 255, 255, 0.1);
    color: var(--muted, #b9bbbe);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ── +1 Vida button (topbar) ────────────────────────────── */
.extra-life-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 40px;
    border-radius: 999px;
    padding: 0 14px;
    border: 2px solid var(--green);
    background: rgba(54, 226, 138, 0.15);
    color: var(--green);
    font-family: inherit;
    font-size: inherit;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.extra-life-btn:hover {
    transform: translateY(-2px);
    background: rgba(54, 226, 138, 0.28);
    box-shadow: 0 4px 16px rgba(54, 226, 138, 0.25);
}
.extra-life-btn img {
    width: 1.3em;
    height: 1.3em;
    object-fit: contain;
    pointer-events: none;
}
.extra-life-btn.disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

/* ── Extra life confirmation modal ──────────────────────── */
.extralife-modal {
    position: fixed;
    inset: 0;
    z-index: 3600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(14px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.extralife-modal.show {
    opacity: 1;
    visibility: visible;
}
.extralife-modal-card {
    width: min(400px, 100%);
    background: linear-gradient(135deg, rgba(54,226,138,0.10), rgba(241,196,15,0.06)), #18191c;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
    overflow: hidden;
    text-align: center;
}
.extralife-modal.show .extralife-modal-card {
    transform: translateY(0) scale(1);
}
.extralife-modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 24px;
    background: linear-gradient(90deg, var(--green, #36e28a), var(--cyan, #38d4ff));
}
.extralife-modal-header h2 {
    font-size: 1.2rem;
    font-weight: 900;
    color: #0d0d10;
    margin: 0;
}
.extralife-modal-body {
    padding: 28px 24px;
}
.extralife-modal-body p {
    color: var(--muted, #b9bbbe);
    font-size: 0.95rem;
    margin: 0 0 10px;
    line-height: 1.5;
}
.extralife-modal-body .warning-text {
    color: var(--pink, #ff33cc);
    font-weight: 800;
    font-size: 0.88rem;
}
.extralife-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}
.extralife-modal-actions button {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    padding: 12px 28px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.extralife-modal-actions button:hover {
    transform: translateY(-2px);
}
.extralife-modal-actions .btn-confirm {
    background: linear-gradient(135deg, var(--green, #36e28a), var(--cyan, #38d4ff));
    color: #0d0d10;
    box-shadow: 0 8px 30px rgba(54, 226, 138, 0.35);
}
.extralife-modal-actions .btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: var(--muted, #b9bbbe);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ── Extra life toast ───────────────────────────────────── */
.extralife-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: linear-gradient(135deg, #18191c, #23242a);
    color: #fff;
    padding: 14px 28px;
    border-radius: 14px;
    border: 1px solid rgba(54, 226, 138, 0.4);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.extralife-toast.show {
    opacity: 1;
}
