@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    font-family: "Poppins", sans-serif;
    overflow: hidden;
    background: linear-gradient(135deg, #2b0a3d, #4a0e4e, #7a1d5e, #2b0a3d);
    background-size: 400% 400%;
    animation: bg-shift 16s ease infinite;
    cursor: url(assets/icon/love-pointer.cur), auto;
}

@keyframes bg-shift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Soft glowing blobs behind everything */
body::before,
body::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.5;
    z-index: 0;
    pointer-events: none;
}

body::before {
    width: 55vmax;
    height: 55vmax;
    left: -15vmax;
    top: -15vmax;
    background: radial-gradient(circle, #ff2d95, transparent 65%);
    animation: blob-float 14s ease-in-out infinite alternate;
}

body::after {
    width: 50vmax;
    height: 50vmax;
    right: -12vmax;
    bottom: -12vmax;
    background: radial-gradient(circle, #7c3aed, transparent 65%);
    animation: blob-float 12s ease-in-out infinite alternate-reverse;
}

@keyframes blob-float {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(6vmax, 4vmax) scale(1.2); }
}

/* Background heart particles canvas */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    opacity: 0.8;
}

/* ---------- Music toggle ---------- */
.music-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 20;
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: url(assets/icon/love-pointer.cur), auto;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    animation: fade-down 0.8s ease-out both;
}

.music-toggle:hover {
    transform: scale(1.12);
    box-shadow: 0 6px 26px rgba(255, 45, 149, 0.55);
}

.music-toggle:active {
    transform: scale(0.94);
}

@keyframes fade-down {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- HUD ---------- */
.container {
    position: relative;
    z-index: 10;
    text-align: center;
    width: min(560px, 92vw);
    pointer-events: none;
}

.hud {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.09);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 26px;
    padding: 22px 28px 26px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: drop-in 0.9s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}

@keyframes drop-in {
    from { opacity: 0; transform: translateY(-40px) scale(0.92); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.hud h1 {
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-weight: 900;
    background: linear-gradient(90deg, #ff9ad5, #ff4fa3, #ff9ad5);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 4s linear infinite;
}

@keyframes shimmer {
    to { background-position: 200% 0; }
}

.hud .subtitle {
    font-family: "Great Vibes", cursive;
    font-size: clamp(1.2rem, 3.5vw, 1.6rem);
    color: #ffd9ec;
    margin: 4px 0 16px;
    text-shadow: 0 2px 12px rgba(255, 45, 149, 0.5);
}

.progress-bar {
    width: 100%;
    height: 18px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 20px;
    overflow: hidden;
    margin: 10px auto 12px;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.progress {
    height: 100%;
    width: 0%;
    border-radius: 20px;
    background: linear-gradient(90deg, #ff2d95, #ff7eb3, #c084fc, #ff2d95);
    background-size: 300% 100%;
    animation: shimmer 2.5s linear infinite;
    transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 0 18px rgba(255, 45, 149, 0.8);
    position: relative;
}

/* moving candy stripes on the progress bar */
.progress::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(45deg,
        rgba(255, 255, 255, 0.22) 0 8px,
        transparent 8px 16px);
    border-radius: inherit;
}

.counter {
    font-size: 1rem;
    font-weight: 600;
    color: #ffe3f1;
    letter-spacing: 0.04em;
}

.counter #score {
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 12px rgba(255, 45, 149, 0.9);
}

/* ---------- Game area & hearts ---------- */
#game-area {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

.heart {
    position: absolute;
    font-size: 2rem;
    cursor: url(assets/icon/love-pointer.cur), auto;
    pointer-events: auto;
    user-select: none;
    filter: drop-shadow(0 6px 14px rgba(255, 45, 149, 0.55));
    animation: fall var(--dur, 4s) linear forwards;
    will-change: transform;
}

@keyframes fall {
    from { transform: translateY(0) translateX(0) rotate(-6deg) scale(var(--s, 1)); opacity: 1; }
    to   { transform: translateY(112vh) translateX(var(--drift, 0px)) rotate(8deg) scale(var(--s, 1)); opacity: 0.9; }
}

.heart.caught {
    animation: pop 0.35s ease-out forwards !important;
}

@keyframes pop {
    0%   { transform: scale(1.25); opacity: 1; }
    40%  { transform: scale(1.6); opacity: 1; }
    100% { transform: scale(0.1); opacity: 0; }
}

/* floating "+1" label */
.plus-one {
    position: fixed;
    font-family: "Poppins", sans-serif;
    font-weight: 900;
    font-size: 1.6rem;
    color: #fff;
    text-shadow: 0 0 14px rgba(255, 45, 149, 1);
    pointer-events: none;
    z-index: 15;
    animation: float-up 0.9s ease-out forwards;
}

@keyframes float-up {
    0%   { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
    20%  { transform: translate(-50%, -70%) scale(1.15); opacity: 1; }
    100% { transform: translate(-50%, -160%) scale(0.9); opacity: 0; }
}

/* tiny burst particles on catch */
.burst-p {
    position: fixed;
    pointer-events: none;
    z-index: 14;
    animation: burst-fly var(--bt, 0.7s) ease-out forwards;
}

@keyframes burst-fly {
    0%   { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--bx, 0px), var(--by, -60px)) scale(0.3); opacity: 0; }
}

/* confetti hearts raining during the win screen */
.burst-p.win-fall {
    z-index: 32;
    filter: drop-shadow(0 4px 12px rgba(255, 45, 149, 0.6));
    animation-name: win-fall;
}

@keyframes win-fall {
    0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
    10%  { opacity: 1; }
    80%  { opacity: 1; }
    100% { transform: translateY(calc(var(--by, 60vh) * 1)) rotate(320deg); opacity: 0; }
}

/* ---------- Win overlay ---------- */
.win-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 4, 34, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.win-overlay.hidden {
    display: none;
}

.win-card {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 30px;
    padding: 40px 46px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), 0 0 80px rgba(255, 45, 149, 0.35);
    animation: win-pop 0.7s cubic-bezier(0.22, 1.4, 0.36, 1) both;
    max-width: 92vw;
}

@keyframes win-pop {
    from { opacity: 0; transform: scale(0.5) translateY(40px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.win-title {
    font-size: clamp(1.7rem, 6vw, 2.8rem);
    font-weight: 900;
    background: linear-gradient(90deg, #ffd166, #ff4fa3, #c084fc, #ffd166);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3s linear infinite;
}

.win-sub {
    font-family: "Great Vibes", cursive;
    font-size: clamp(1.3rem, 4.5vw, 1.9rem);
    color: #ffe3f1;
    margin: 8px 0 18px;
}

.win-hearts {
    display: flex;
    justify-content: center;
    gap: 6px;
    font-size: 1.6rem;
    margin-bottom: 18px;
}

.win-hearts span {
    animation: heart-bounce 0.9s ease-in-out infinite;
    animation-delay: calc(var(--i, 0) * 0.08s);
}

@keyframes heart-bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    40%      { transform: translateY(-8px) scale(1.25); }
}

.win-countdown {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.9);
}

/* ---------- arcade edition: lives, combo, specials, states ---------- */
.meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 2px 2px 6px;
}

.lives {
    display: flex;
    gap: 5px;
    font-size: 1.15rem;
    line-height: 1;
}

.lives span {
    transition: transform 0.35s ease, filter 0.35s ease;
    animation: life-in 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) backwards;
}

.lives span:nth-child(2) { animation-delay: 0.1s; }
.lives span:nth-child(3) { animation-delay: 0.2s; }

@keyframes life-in {
    from { transform: scale(0) rotate(-30deg); }
    to   { transform: scale(1) rotate(0deg); }
}

.lives span.lost {
    filter: grayscale(1);
    transform: scale(0.7);
    animation: life-lost 0.45s cubic-bezier(0.3, 1.6, 0.4, 1);
}

@keyframes life-lost {
    0%   { transform: scale(1.4); }
    40%  { transform: scale(0.6) rotate(-20deg); }
    100% { transform: scale(0.7) rotate(0deg); }
}

.counter {
    text-align: right;
}

/* combo badge */
.combo-badge {
    display: inline-block;
    margin-top: 2px;
    font-weight: 900;
    letter-spacing: 0.06em;
    font-size: 0.95rem;
    color: #fff;
    padding: 5px 16px;
    border-radius: 40px;
    background: linear-gradient(120deg, #ff7a18, #ff2d95);
    box-shadow: 0 0 22px rgba(255, 90, 60, 0.8);
    opacity: 0;
    transform: scale(0.5) translateY(6px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.2, 1.5, 0.4, 1);
}

.combo-badge.show {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.combo-badge.bump {
    animation: combo-bump 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes combo-bump {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.25) rotate(-3deg); }
    100% { transform: scale(1); }
}

/* special hearts */
.heart--gold {
    filter: drop-shadow(0 0 10px rgba(255, 224, 130, 0.95))
            drop-shadow(0 0 22px rgba(255, 190, 60, 0.7));
    animation: fall var(--dur, 4s) linear forwards,
               gold-pulse 0.7s ease-in-out infinite alternate;
}

@keyframes gold-pulse {
    from { filter: drop-shadow(0 0 6px rgba(255, 224, 130, 0.8)) drop-shadow(0 0 14px rgba(255, 190, 60, 0.5)); }
    to   { filter: drop-shadow(0 0 14px rgba(255, 240, 170, 1)) drop-shadow(0 0 30px rgba(255, 200, 70, 0.95)); }
}

.heart--bomb {
    filter: drop-shadow(0 4px 10px rgba(255, 70, 70, 0.5)) saturate(1.15);
    animation: fall var(--dur, 4s) linear forwards,
               bomb-warn 0.5s ease-in-out infinite alternate;
}

@keyframes bomb-warn {
    from { filter: drop-shadow(0 4px 8px rgba(255, 70, 70, 0.35)) saturate(1); }
    to   { filter: drop-shadow(0 0 16px rgba(255, 60, 60, 0.95)) saturate(1.5); }
}

.heart.boom {
    animation: pop 0.4s ease-out forwards !important;
    filter: drop-shadow(0 0 24px rgba(255, 90, 60, 1));
}

.heart.fade-out {
    opacity: 0;
    transform: translateY(6vh) scale(0.5);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* floating label variants */
.plus-one.gold {
    color: #ffd166;
    text-shadow: 0 0 18px rgba(255, 200, 80, 1);
}

.plus-one.bad {
    color: #ff6b6b;
    text-shadow: 0 0 16px rgba(255, 60, 60, 1);
}

/* warm-up hint before the first catch */
.boot-hint {
    position: fixed;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 18;
    pointer-events: none;
    font-family: "Poppins", sans-serif;
    font-weight: 600;
    font-size: clamp(0.9rem, 2.6vw, 1.15rem);
    letter-spacing: 0.03em;
    color: #fff;
    background: rgba(255, 45, 149, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px 22px;
    border-radius: 40px;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35), 0 0 24px rgba(255, 45, 149, 0.4);
    animation: hint-bob 2.2s ease-in-out infinite;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

@keyframes hint-bob {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%      { transform: translateX(-50%) translateY(-6px); }
}

/* screen shake + red edge flash when you lose a life */
body.shake {
    animation: screen-shake 0.4s ease;
}

@keyframes screen-shake {
    0%, 100% { transform: translate(0, 0); }
    15% { transform: translate(-10px, 4px); }
    30% { transform: translate(9px, -5px); }
    45% { transform: translate(-7px, -3px); }
    60% { transform: translate(6px, 4px); }
    75% { transform: translate(-3px, -2px); }
    90% { transform: translate(2px, 1px); }
}

.miss-flash {
    position: fixed;
    inset: 0;
    z-index: 26;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 42%, rgba(255, 40, 70, 0.35) 100%);
    animation: miss-fade 0.5s ease-out forwards;
}

@keyframes miss-fade {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* stats line under win/game-over cards */
.win-stats {
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: rgba(255, 226, 244, 0.95);
    margin: -6px 0 14px;
    text-shadow: 0 0 10px rgba(255, 45, 149, 0.5);
}

.over-title {
    background: linear-gradient(90deg, #ffd166, #ff6b6b, #ff9ec8, #ffd166);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.over-card {
    border-color: rgba(255, 120, 140, 0.35);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), 0 0 80px rgba(255, 90, 90, 0.3);
}

.btn-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 6px;
}

.pill-btn {
    font-family: "Courier New", monospace;
    font-weight: bold;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 13px;
    color: #fff;
    text-decoration: none;
    padding: 13px 26px;
    border-radius: 50px;
    border: none;
    cursor: url(assets/icon/love-pointer.cur), auto;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.pill-btn.main {
    background: linear-gradient(120deg, #ff2d95, #c084fc 60%, #22d3ee);
    background-size: 200% 100%;
    box-shadow: 0 10px 30px -6px rgba(255, 45, 149, 0.7);
}

.pill-btn.ghost {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.35);
    display: inline-block;
}

.pill-btn:hover {
    transform: translateY(-3px) scale(1.05);
    background-position: 100% 0;
    box-shadow: 0 0 34px rgba(255, 45, 149, 0.8);
}

/* ---------- Responsive ---------- */
@media (max-width: 574px) {
    .hud { padding: 16px 18px 20px; border-radius: 20px; }
    .music-toggle { width: 44px; height: 44px; font-size: 20px; top: 14px; right: 14px; }
    .win-card { padding: 28px 20px; }
    .meta { flex-wrap: wrap; }
}