/* Fórmula premiada (farmácias e drogarias).
 *
 * Cores de MARCA como var(--jg-<hex>, #<hex>); dourado, rosa, roxo, cinzas e o
 * vidro em hex direto. Nunca azul.
 *
 * Contrato:
 *  - Estado FINAL por classe estática ou @keyframes … forwards.
 *  - Movimento reduzido: cada coisa para num estado VISÍVEL.
 *  - A fase A (tubos, canos, nível, estante, bolhas) é JS; aqui só a fase B.
 *  - As camadas dourada e cinza existem nas duas jogadas, transparentes: é a
 *    classe do desfecho que acende uma delas.
 *  - Posições em % do palco: viewBox 160×110 no mesmo 16:11 do palco.
 *    Boca do frasco em (80,48) → 50% / 43.6%; centro do frasco (80,72) → 65.5%.
 */

.fm__palco {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    aspect-ratio: 16 / 11;
    border-radius: 14px;
    overflow: hidden;
    background: var(--jg-f3faf5, #F3FAF5);
    box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .45);
    user-select: none;
    font-family: Arial, sans-serif;
}
.fm__cena { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.fm__rotulo {
    position: absolute;
    left: 50%; top: 2.5%;
    transform: translateX(-50%);
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--jg-14532d, #14532d);
    border: 1px solid #C9A227;
    font: 700 10px/1 Arial, sans-serif;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #FFF3C4;
    white-space: nowrap;
    z-index: 8;
}
.fm__rotulo img { width: 12px; height: 12px; }

/* ---------------- o frasco ---------------- */

.fm__frasco { transform-box: fill-box; transform-origin: 50% 100%; }
.fm__ouro, .fm__cinza { opacity: 0; }
.fm__halo { opacity: 0; transform-box: fill-box; transform-origin: 50% 50%; }
.fm__trinca { stroke-dasharray: 40; stroke-dashoffset: 40; stroke-width: 1.2; }
.fm__gota { opacity: 0; }

/* prêmio: a mistura doura, o frasco brilha, o halo acende */
.fm--premiou .fm__ouro   { animation: fm-acende var(--fm-tinge, .7s) ease-out forwards; }
.fm--premiou .fm__halo   { animation: fm-halo 1.4s ease-out forwards; }
.fm--premiou .fm__frasco { animation: fm-brilho var(--fm-tinge, .7s) ease-out forwards; }
@keyframes fm-acende { to { opacity: 1; } }
@keyframes fm-halo {
    0%   { opacity: 0; transform: scale(.4); }
    60%  { opacity: .9; transform: scale(1.1); }
    100% { opacity: .75; transform: scale(1); }
}
@keyframes fm-brilho {
    to { filter: drop-shadow(0 0 3px rgba(255, 220, 90, .95)) drop-shadow(0 0 1px #D4AF37); }
}

/* sem prêmio: a mistura acinzenta */
.fm--consolo .fm__cinza { animation: fm-acende var(--fm-tinge, .7s) ease-out forwards; }

/* variante: o frasco trinca (cômico) */
.fm--trinca .fm__trinca { animation: fm-risca .35s ease-out forwards; }
.fm--trinca .fm__frasco { animation: fm-treme .5s ease-in-out; }
.fm--trinca .fm__gota   { animation: fm-pinga 1.2s .3s ease-in forwards; }
@keyframes fm-risca { to { stroke-dashoffset: 0; } }
@keyframes fm-treme {
    0%, 100% { transform: rotate(0deg); }
    20% { transform: rotate(-3deg); } 45% { transform: rotate(2.5deg); } 70% { transform: rotate(-1.2deg); }
}
@keyframes fm-pinga {
    0%   { opacity: 0; transform: translateY(-3px); }
    30%  { opacity: 1; }
    100% { opacity: 1; transform: translateY(0); }
}

/* ---------------- fumaça (sem prêmio) ---------------- */

.fm__fumaca { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.fm__fumaca i {
    position: absolute;
    left: 50%; top: 42%;
    width: 9%; aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 45% 40%, #E3E7E5, #B3BAB7 55%, rgba(179, 186, 183, 0) 72%);
    filter: blur(1.2px);
    transform: translate(-50%, -50%) scale(.2);
    opacity: 0;
}
/* uma coluna de fumaça saindo da boca, cada nuvem com destino fixo */
.fm__fumaca i:nth-child(1) { --fx: -1%;  --fy: 35%; --fs: 1.1; }
.fm__fumaca i:nth-child(2) { --fx: 3%;   --fy: 28%; --fs: 1.35; width: 10%; }
.fm__fumaca i:nth-child(3) { --fx: -3%;  --fy: 21%; --fs: 1.55; width: 11%; }
.fm__fumaca i:nth-child(4) { --fx: 4%;   --fy: 14%; --fs: 1.7; width: 11%; }
.fm__fumaca i:nth-child(5) { --fx: -5%;  --fy: 30%; --fs: 1.1; width: 8%; }
.fm--fumaca .fm__fumaca i { animation: fm-fuma 1.4s ease-out forwards; }
.fm--fumaca .fm__fumaca i:nth-child(2) { animation-delay: .12s; }
.fm--fumaca .fm__fumaca i:nth-child(3) { animation-delay: .24s; }
.fm--fumaca .fm__fumaca i:nth-child(4) { animation-delay: .36s; }
.fm--fumaca .fm__fumaca i:nth-child(5) { animation-delay: .18s; }
@keyframes fm-fuma {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(.2); }
    30%  { opacity: .85; }
    100% { opacity: .62; left: calc(50% + var(--fx)); top: var(--fy); transform: translate(-50%, -50%) scale(var(--fs)); }
}

/* ---------------- confetes e prêmio ---------------- */

.fm__confetes { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.fm__confetes i {
    position: absolute;
    left: 50%; top: 44%;
    width: 1.8%; height: 2.8%;
    border-radius: 1px;
    opacity: 0;
}
.fm--festa .fm__confetes i { animation: fm-confete 1.3s cubic-bezier(.2, .7, .4, 1) forwards; }
@keyframes fm-confete {
    0%   { opacity: 0; transform: rotate(0deg); }
    15%  { opacity: 1; }
    100% { opacity: 1; left: calc(50% + var(--dx)); top: calc(44% + var(--dy)); transform: rotate(var(--r)); }
}

.fm__bolha {
    position: absolute;
    left: 50%; top: 44%;
    width: 24%;
    aspect-ratio: 1;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    border: 3px solid #D4AF37;
    box-shadow: 0 0 0 3px rgba(255, 243, 196, .9), 0 10px 22px -8px rgba(0, 0, 0, .5);
    transform: translate(-50%, -50%) scale(.1);
    opacity: 0;
    z-index: 7;
}
.fm__bolha img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fm--festa .fm__bolha { animation: fm-sobe var(--fm-revela, .7s) cubic-bezier(.3, 1.3, .5, 1) forwards; }
@keyframes fm-sobe {
    0%   { top: 44%; transform: translate(-50%, -50%) scale(.1); opacity: 0; }
    30%  { opacity: 1; }
    100% { top: 27%; transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ---------------- placa do prêmio ---------------- */

.fm__placa {
    position: absolute;
    left: 50%; bottom: 3%;
    width: 58%;
    transform: translate(-50%, 16px);
    opacity: 0;
    display: flex; align-items: center; justify-content: center;
    padding: 6px 9px;
    box-sizing: border-box;
    border-radius: 8px;
    background: linear-gradient(180deg, #FFF8DC, #F5E3A1);
    border: 1.5px solid #C9A227;
    box-shadow: 0 8px 16px -8px rgba(0, 0, 0, .6);
    text-align: center;
    z-index: 9;
}
.fm__placa div { font: 700 clamp(11px, 2.8vw, 13px)/1.25 Arial, sans-serif; color: var(--jg-14532d, #14532d); min-width: 0; }
.fm__placa small { display: block; font: 700 9px/1.2 Arial, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #8A6D1F; margin-bottom: 2px; }
.fm--placa .fm__placa { animation: fm-placa .5s cubic-bezier(.3, 1.3, .5, 1) forwards; }
@keyframes fm-placa { to { transform: translate(-50%, 0); opacity: 1; } }

/* ---------------- botão e mensagem ---------------- */

.fm__botao {
    display: block;
    width: 100%;
    max-width: 480px;
    margin: 10px auto 0;
    padding: 12px 10px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(180deg, var(--jg-2aa152, #2AA152), var(--jg-0a7a00, #0A7A00));
    color: #fff;
    font: 700 15px/1.2 Arial, sans-serif;
    letter-spacing: .02em;
    cursor: pointer;
    touch-action: manipulation;
    box-shadow: 0 6px 14px -6px rgba(var(--jg-rgb-0a7a00, 10,122,0), .8), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.fm__botao:hover:not(:disabled) { filter: brightness(1.06); }
.fm__botao:disabled { opacity: .55; cursor: default; }

.fm__msg {
    max-width: 480px;
    min-height: 56px;
    margin: 10px auto 0;
    padding: 8px 12px;
    box-sizing: border-box;
    display: flex; align-items: center; justify-content: center;
    border-radius: 9px;
    text-align: center;
    font: 700 clamp(11px, 3vw, 14px)/1.35 Arial, sans-serif;
    color: #46564c;
    background: var(--jg-eef4ef, #EEF4EF);
    border: 1px solid var(--jg-dce6de, #DCE6DE);
}
.fm__msg--premiado { background: var(--jg-e3f5e6, #E3F5E6); border-color: var(--jg-9fd8ab, #9FD8AB); color: var(--jg-14532d, #14532d); }
.fm__msg--consolo  { background: #F1F3F1; border-color: #CDD5CE; color: #4F5A52; }
.fm__msg b { color: var(--jg-0a7a00, #0A7A00); }
.fm__msg--consolo b { color: #5C6B60; }

/* ---------------- vitrine ---------------- */

.fm__premios {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
    margin: 14px auto 0; max-width: 640px;
}
.fm__titulo {
    width: 100%; text-align: center;
    font: 700 13px/1.3 Arial, sans-serif; color: var(--jg-14532d, #14532d); margin-bottom: 2px;
}
.fm__premio { width: 74px; text-align: center; font: 600 10px/1.2 Arial, sans-serif; color: #46564c; }
.fm__premio img { width: 100%; border-radius: 6px; display: block; margin-bottom: 3px; }

/* ---------------- movimento reduzido ---------------- */
@media (prefers-reduced-motion: reduce) {
    .fm--premiou .fm__ouro, .fm--consolo .fm__cinza { animation: none; opacity: 1; }
    .fm--premiou .fm__halo { animation: none; opacity: .75; transform: scale(1); }
    .fm--premiou .fm__frasco { animation: none; filter: drop-shadow(0 0 3px rgba(255, 220, 90, .95)) drop-shadow(0 0 1px #D4AF37); }
    .fm--trinca .fm__trinca { animation: none; stroke-dashoffset: 0; }
    .fm--trinca .fm__frasco { animation: none; }
    .fm--trinca .fm__gota { animation: none; opacity: 1; }
    .fm--fumaca .fm__fumaca i { animation: none; opacity: .62; left: calc(50% + var(--fx)); top: var(--fy); transform: translate(-50%, -50%) scale(var(--fs)); }
    .fm--festa .fm__confetes i { animation: none; opacity: 1; left: calc(50% + var(--dx)); top: calc(44% + var(--dy)); transform: rotate(var(--r)); }
    .fm--festa .fm__bolha { animation: none; top: 27%; transform: translate(-50%, -50%) scale(1); opacity: 1; }
    .fm--placa .fm__placa { animation: none; transform: translate(-50%, 0); opacity: 1; }
}
