.bb {
    --bb-gold: #ffc94d;
    --bb-gold-2: #ffe29a;
    --bb-cyan: #7fe6ff;
    --bb-pink: #ff9bd2;
    --bx: 30%; --by: 60%; --bs: 48px;
    min-height: 420px; display: block; isolation: isolate;

    container-type: inline-size;
    background: #0a0f24;
    box-shadow: inset 0 0 0 1px rgba(127,230,255,.14), 0 24px 60px -30px rgba(0,0,0,.95);
}
[data-bubbles] .bubble-field.bb { min-height: 420px; }

.bb-sky {
    position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; border-radius: inherit;
    background:
        linear-gradient(180deg, rgba(8,12,30,.25) 0%, rgba(8,12,30,.05) 45%, rgba(8,12,30,.55) 100%),
        url(../assets/art/bubbles/sky.webp) center 70% / cover no-repeat;
}
.bb-bokeh {
    position: absolute; width: 38%; aspect-ratio: 1; border-radius: 50%; mix-blend-mode: screen;
    animation: bbGlow 7s ease-in-out infinite;
}
.bb-bokeh.k1 { left: -10%; top: -14%; background: radial-gradient(circle, rgba(127,230,255,.22), transparent 66%); }
.bb-bokeh.k2 { right: -8%; top: 8%; width: 44%; animation-delay: -2.4s; animation-duration: 9s;
               background: radial-gradient(circle, rgba(178,120,255,.22), transparent 66%); }
.bb-bokeh.k3 { left: 30%; bottom: -30%; width: 50%; animation-delay: -4s; animation-duration: 8s;
               background: radial-gradient(circle, rgba(255,201,77,.12), transparent 66%); }
@keyframes bbGlow { 0%, 100% { opacity: .7; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08) translateY(-6px); } }
.bb-stars {
    position: absolute; inset: 0;
    background-image:
        radial-gradient(1.5px 1.5px at 14% 18%, #fff, transparent),
        radial-gradient(1px 1px at 36% 8%, #cfefff, transparent),
        radial-gradient(1.5px 1.5px at 58% 22%, #ffe8b0, transparent),
        radial-gradient(1px 1px at 82% 12%, #fff, transparent),
        radial-gradient(1px 1px at 92% 34%, #cfefff, transparent),
        radial-gradient(1px 1px at 46% 36%, #fff, transparent);
    animation: bbTwinkle 3.6s ease-in-out infinite alternate;
}
@keyframes bbTwinkle { from { opacity: .35; } to { opacity: .9; } }

.bb .drift { z-index: 1; }
.bb .drift i {
    background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.85) 0 12%, transparent 22%),
                radial-gradient(circle, transparent 58%, rgba(127,230,255,.5) 70%, rgba(255,155,210,.35) 82%, transparent 86%);
    box-shadow: inset 0 0 4px rgba(255,255,255,.25);
}

.bb-goal {
    position: absolute; z-index: 2; left: 71%; top: 50%;
    width: min(244px, 46cqw); aspect-ratio: 1; transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(127,230,255,.06) 55%, rgba(127,230,255,.14) 70%, transparent 71%);
}
.bb .bb-goal .goal-ring {
    position: absolute; inset: 0; width: auto; height: auto; border-radius: 50%;
    border: 2px dashed rgba(127,230,255,.45);
    box-shadow: 0 0 0 6px rgba(127,230,255,.05), 0 0 30px -6px rgba(127,230,255,.5);
    animation: ringSpin 26s linear infinite;
}
.bb .bb-goal .goal-tag {
    top: -14px; transform: translateX(-50%);
    color: #eafcff; background: rgba(10,16,38,.78);
    box-shadow: inset 0 0 0 1px rgba(127,230,255,.4), 0 6px 18px -8px rgba(0,0,0,.9);
}
.bb .bb-goal .goal-tag b { color: var(--bb-gold-2); }
.bb.hot .bb-goal .goal-ring { border-color: rgba(255,226,154,.85); animation-duration: 6s;
    box-shadow: 0 0 0 6px rgba(255,201,77,.08), 0 0 40px -4px rgba(255,201,77,.7); }
.bb.won .bb-goal .goal-ring { border-style: solid; border-color: var(--bb-gold); animation: bbRingWin .9s ease-out; }
@keyframes bbRingWin {
    0% { box-shadow: 0 0 0 0 rgba(255,201,77,.8), 0 0 60px rgba(255,201,77,.9); transform: scale(1); }
    100% { box-shadow: 0 0 0 40px rgba(255,201,77,0), 0 0 30px -6px rgba(255,201,77,.4); transform: scale(1.06); }
}

.bb-lion {
    position: absolute; z-index: 3; left: 0; bottom: 0; height: min(270px, 46cqw); aspect-ratio: 443 / 440;
    filter: drop-shadow(0 16px 22px rgba(0,0,0,.55));
    pointer-events: none;
}
.bb-lion img {
    position: absolute; left: 0; bottom: 0; height: 100%; width: auto; max-width: none;
    opacity: 0; transform: scale(.94); transform-origin: 40% 100%;
    transition: opacity .28s, transform .4s cubic-bezier(.34,1.56,.64,1);
}
.bb-lion .p-win { height: 106%; left: 6%; }
.bb-lion .p-pop { height: 112%; left: 2%; }
.bb-lion[data-pose="blow"] .p-blow,
.bb-lion[data-pose="win"] .p-win,
.bb-lion[data-pose="pop"] .p-pop { opacity: 1; transform: none; }
.bb-lion[data-pose="blow"] .p-blow { animation: bbBreath 3.6s ease-in-out infinite; }
.bb-lion.blowing .p-blow { animation: bbPuff .7s ease-in-out infinite; }
.bb-lion[data-pose="win"] .p-win { animation: bbCheer .9s cubic-bezier(.34,1.56,.64,1) 2; }
.bb-lion[data-pose="pop"] .p-pop { animation: bbShake .5s cubic-bezier(.36,.07,.19,.97); }
@keyframes bbBreath { 50% { transform: scale(1.012, .99) translateY(1px); } }
@keyframes bbPuff { 50% { transform: scale(1.025, 1.01) rotate(-.6deg); } }
@keyframes bbCheer { 0%, 100% { transform: none; } 40% { transform: translateY(-14px) rotate(-2deg); } 70% { transform: translateY(2px); } }
@keyframes bbShake {
    20%, 80% { transform: translateX(3px) rotate(1deg); }
    40%, 60% { transform: translateX(-4px) rotate(-1deg); }
}

.bb-say {
    position: absolute; z-index: 4; left: 12px; top: 12px; max-width: min(42%, 260px);
    padding: 9px 13px 10px; border-radius: 16px 16px 16px 4px;
    background: linear-gradient(160deg, rgba(30,40,78,.9), rgba(14,20,44,.9));
    border: 1px solid rgba(127,230,255,.24);
    box-shadow: 0 12px 30px -14px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,255,255,.07);
    backdrop-filter: blur(8px);
}
.bb-say b { display: block; font-family: var(--f-display); font-size: 14px; font-weight: 700; letter-spacing: -.02em; color: #eafcff; }
.bb-say span { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 600; color: var(--muted, #9aa6c4); }
.bb-say.pop { animation: bbSay .42s cubic-bezier(.34,1.56,.64,1); }
@keyframes bbSay { 0% { transform: scale(.92) translateY(4px); opacity: .4; } 100% { transform: none; opacity: 1; } }
.bb.won .bb-say { border-color: rgba(255,201,77,.55); box-shadow: 0 0 0 4px rgba(255,201,77,.08), 0 12px 30px -14px rgba(0,0,0,.9); }
.bb.won .bb-say b { color: var(--bb-gold-2); }
.bb.popped .bb-say { border-color: rgba(255,155,210,.4); }
.bb.popped .bb-say b { color: #ffc2e2; }

.bb .b { position: absolute; inset: 0; z-index: 5; display: block; pointer-events: none; }
.bb .cur {
    position: absolute; left: calc(var(--bx) - var(--bs) / 2); top: calc(var(--by) - var(--bs) / 2);
    width: var(--bs); height: var(--bs);
    font-size: max(10px, calc(var(--bs) * .21)); color: #fff;
    text-shadow: 0 2px 10px rgba(6,20,50,.85), 0 0 18px rgba(127,230,255,.6);
    background:
        radial-gradient(circle at 50% 50%, rgba(10,30,60,.05) 55%, rgba(127,230,255,.22) 68%, rgba(255,155,210,.28) 80%, rgba(255,255,255,.55) 92%, transparent 94%),
        radial-gradient(circle at 70% 78%, rgba(255,226,154,.28), transparent 42%);
    box-shadow: inset 0 0 calc(var(--bs) * .1) rgba(255,255,255,.35), 0 0 calc(var(--bs) * .35) -6px rgba(127,230,255,.65);
    transition: none; transform: none;
    animation: bubWobble 3.4s ease-in-out infinite;
}

.bb .cur::before {
    inset: 0; opacity: .55; mix-blend-mode: screen;
    background: conic-gradient(from 0deg, rgba(127,230,255,.0), rgba(127,230,255,.55) 12%, rgba(178,120,255,.45) 26%,
                rgba(255,155,210,.5) 40%, rgba(255,226,154,.45) 54%, rgba(127,255,200,.4) 68%, rgba(127,230,255,.0) 80%);
    -webkit-mask: radial-gradient(circle, transparent 60%, #000 76%, #000 92%, transparent 94%);
            mask: radial-gradient(circle, transparent 60%, #000 76%, #000 92%, transparent 94%);
    animation: filmSpin 5s linear infinite;
}

.bb .cur::after {
    left: 18%; top: 13%; width: 30%; height: 16%; background: rgba(255,255,255,.9); filter: blur(1.2px);
    border-radius: 50%; transform: rotate(-32deg);
    box-shadow: calc(var(--bs) * .44) calc(var(--bs) * .5) 0 -2px rgba(255,255,255,.35);
}

.bb:not(.flying):not(.won):not(.popped) .cur { color: transparent; text-shadow: none; }
.bb .cur.spawn { animation: bbSpawn .5s cubic-bezier(.34,1.56,.64,1), bubWobble 3.4s ease-in-out .5s infinite; }
@keyframes bbSpawn { 0% { transform: scale(0); opacity: 0; } 100% { transform: none; opacity: 1; } }

.bb.flying .cur { animation: bubWobble 1.4s ease-in-out infinite; }
.bb.hot .cur { animation: bubWobble .6s ease-in-out infinite, bbJitter .18s linear infinite;
    box-shadow: inset 0 0 calc(var(--bs) * .1) rgba(255,255,255,.4), 0 0 calc(var(--bs) * .5) -4px rgba(255,201,77,.6); }
.bb.hot .cur::before { animation-duration: 1.6s; opacity: .8; }
@keyframes bbJitter { 25% { translate: 1px -1px; } 50% { translate: -1px 1px; } 75% { translate: 1px 1px; } }

.bb.won .cur {
    top: calc(-1 * var(--bs) - 20px); opacity: 0;
    transition: top 1.5s cubic-bezier(.45,0,.55,1) .35s, opacity .5s ease 1.3s;
    animation: bbGold .5s ease-out forwards, bubWobble 1.2s ease-in-out infinite;
    color: #2a1c02; text-shadow: 0 1px 0 rgba(255,255,255,.6), 0 0 16px rgba(255,226,154,.9);
}
@keyframes bbGold {
    to { background:
        radial-gradient(circle at 50% 50%, rgba(255,226,154,.5) 50%, rgba(255,201,77,.65) 72%, rgba(255,255,255,.8) 92%, transparent 94%);
        box-shadow: 0 0 calc(var(--bs) * .6) 0 rgba(255,201,77,.75); }
}

.bb .cur.burst { animation: bbBurst .36s cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes bbBurst {
    0% { transform: scale(1); opacity: 1; filter: none; }
    40% { transform: scale(1.18); opacity: .9; filter: brightness(1.6); }
    100% { transform: scale(1.35); opacity: 0; }
}
.bb .splash { inset: auto; left: var(--bx); top: var(--by); width: 0; height: 0; z-index: 6; overflow: visible; }
.bb .splash i {
    left: 0; top: 0; width: 8px; height: 8px; margin: -4px 0 0 -4px;
    background: radial-gradient(circle at 35% 30%, #fff, rgba(127,230,255,.8) 60%, rgba(255,155,210,.5));
    box-shadow: 0 0 8px rgba(127,230,255,.8);
    animation: bbDrop .7s cubic-bezier(.2,.7,.3,1) forwards;
}
.bb .splash i:nth-child(3n) { width: 5px; height: 5px; background: #fff; }
@keyframes bbDrop {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--dx), calc(var(--dy) + 30px)) scale(.3); opacity: 0; }
}

.bb-fx { position: absolute; inset: 0; z-index: 7; pointer-events: none; overflow: hidden; border-radius: inherit; }
.bb-coin {
    position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff6d8, var(--bb-gold) 45%, #c9861a);
    box-shadow: 0 0 10px rgba(255,201,77,.8), inset 0 -2px 0 rgba(120,70,0,.35);
    animation: bbCoin 1.2s cubic-bezier(.2,.7,.3,1) forwards;
}
.bb-coin.s { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: #fff; box-shadow: 0 0 10px #fff, 0 0 18px var(--bb-gold); }
@keyframes bbCoin {
    0% { transform: translate(0, 0) scale(.4) rotateY(0); opacity: 0; }
    15% { opacity: 1; transform: translate(calc(var(--x) * .3), calc(var(--y) * .3)) scale(1) rotateY(180deg); }
    100% { transform: translate(var(--x), calc(var(--y) + 70px)) scale(.8) rotateY(720deg); opacity: 0; }
}
.bb-ring {
    position: absolute; border-radius: 50%; border: 2px solid rgba(255,255,255,.85);
    box-shadow: 0 0 16px rgba(127,230,255,.8);
    animation: bbRing .5s ease-out forwards;
}
.bb-ring.gold { border-color: var(--bb-gold-2); box-shadow: 0 0 20px rgba(255,201,77,.9); animation-duration: .8s; }
@keyframes bbRing { 0% { transform: scale(.9); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
.bb-float {
    position: absolute; transform: translate(-50%, 0); white-space: nowrap;
    font-family: var(--f-display); font-size: 22px; font-weight: 800; letter-spacing: -.03em;
    color: var(--bb-gold-2); text-shadow: 0 2px 10px rgba(0,0,0,.9), 0 0 16px rgba(255,190,60,.7);
    animation: bbFloat 1.4s cubic-bezier(.2,.7,.3,1) forwards;
}
.bb-float.lose { color: #ffc2e2; font-size: 18px; text-shadow: 0 2px 10px rgba(0,0,0,.9), 0 0 14px rgba(255,155,210,.6); }
@keyframes bbFloat {
    0% { transform: translate(-50%, 8px) scale(.6); opacity: 0; }
    20% { transform: translate(-50%, -8px) scale(1.12); opacity: 1; }
    100% { transform: translate(-50%, -46px) scale(1); opacity: 0; }
}

.bb.popped::after {
    content: ''; position: absolute; inset: 0; z-index: 6; pointer-events: none; border-radius: inherit;
    background: radial-gradient(circle at var(--bx) var(--by), rgba(255,255,255,.35), rgba(127,230,255,.12) 18%, transparent 40%);
    animation: bbFlash .6s ease-out forwards;
}
@keyframes bbFlash { from { opacity: 1; } to { opacity: 0; } }

[data-bubbles] .bubble-hist span { background: rgba(127,230,255,.1); color: var(--bb-cyan, #7fe6ff); box-shadow: inset 0 0 0 1px rgba(127,230,255,.28); }
[data-bubbles] .bubble-hist span:first-child:not(.lose) { background: linear-gradient(180deg, #ffe29a, #ffc94d); color: #2a1c02; box-shadow: 0 6px 14px -8px rgba(255,190,60,.9); }
[data-bubbles] .bubble-hist span.lose { color: #ffb3d9; background: rgba(255,155,210,.1); box-shadow: inset 0 0 0 1px rgba(255,155,210,.28); }

@media (max-width: 720px) {
    .bb, [data-bubbles] .bubble-field.bb { min-height: 330px; }
    .bb-lion { height: min(196px, 48cqw); left: -2%; }
    .bb-goal { top: 54%; width: min(186px, 44cqw); }
    .bb-say { left: 10px; top: 10px; max-width: 58%; padding: 7px 10px 8px; }
    .bb-say b { font-size: 12.5px; }
    .bb-say span { font-size: 10.5px; }
    .bb-float { font-size: 18px; }
}

html.is-lite .bb-bokeh, html.is-lite .bb-stars, html.is-lite .bb .drift, html.is-lite .bb-fx, html.is-lite .bb .splash,
html.is-lite .bb.popped::after { display: none; }
html.is-lite .bb *, html.is-lite .bb *::before, html.is-lite .bb *::after { animation: none !important; }
html.is-lite .bb.won .cur { transition: opacity .3s; }
@media (prefers-reduced-motion: reduce) {
    .bb *, .bb *::before, .bb *::after { animation: none !important; }
}
