/* Entrega das chaves (construtoras e incorporadoras).
 *
 * Cores de MARCA como var(--jg-<hex>, #<hex>): o veludo do estojo; cetim, prata,
 * dourado, parede e madeira 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 tampa é JS (polígonos SVG em projeção oblíqua); aqui a luz, a chave
 *    subindo, o chaveiro grande e a plaquinha.
 *  - Posições em % do palco: viewBox 160×110 no mesmo 16:11 do palco. A chave
 *    fica em torno de (72,54) → 45% / 49%.
 */

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

.ch__rotulo {
    position: absolute;
    left: 3%; top: 4%;
    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;
}
.ch__rotulo img { width: 12px; height: 12px; }

/* ---------------- luz e chave ---------------- */

.ch__luz { opacity: 0; transform-box: fill-box; transform-origin: 50% 50%; }
.ch--aberto .ch__luz { animation: ch-reflexo 2.4s ease-in-out infinite; }            /* espera: igual nas duas */
@keyframes ch-reflexo { 0%, 100% { opacity: .18; } 50% { opacity: .32; } }
.ch--premiou .ch__luz { animation: ch-luz 1s ease-out forwards; }
@keyframes ch-luz { from { opacity: .3; transform: scale(.6); } to { opacity: 1; transform: scale(1.15); } }

.ch__chave { transform-box: fill-box; transform-origin: 50% 50%; }
.ch--premiou .ch__chave { animation: ch-sobe .6s cubic-bezier(.3, 1.2, .5, 1) forwards; }
@keyframes ch-sobe {
    to { transform: translate(0, -9px) scale(1.25) rotate(-8deg);
         filter: drop-shadow(0 0 1.5px #FFF6C8) drop-shadow(0 0 4px rgba(244, 196, 48, .95)); }
}

/* ---------------- chaveiro grande (só no prêmio) ---------------- */

.ch__chaveiro {
    position: absolute;
    left: 45%; top: 49%;
    width: 46%;
    box-sizing: border-box;
    padding: 4.2% 4% 3.6%;
    border-radius: 12px 12px 14px 14px;
    display: flex; align-items: center; gap: 5%;
    background: linear-gradient(135deg, #FFF3B0, #F4C430 45%, #C9961A);
    border: 2px solid #FFF6D8;
    box-shadow: 0 0 0 1.5px #9A7414, 0 14px 24px -10px rgba(0, 0, 0, .55), 0 0 20px 4px rgba(255, 214, 90, .55);
    transform: translate(-50%, -50%) scale(.12) rotate(-10deg);
    opacity: 0;
    z-index: 7;
}
/* argola por cima, como num chaveiro */
.ch__argola {
    position: absolute;
    left: 50%; top: -15%;
    width: 13%; aspect-ratio: 1;
    transform: translateX(-50%);
    border-radius: 50%;
    border: 3px solid #C9D0CC;
    box-shadow: inset 0 0 0 1px #8E9993, 0 0 0 1px #8E9993;
}
.ch__chaveiro img { width: 36%; aspect-ratio: 1; object-fit: cover; border-radius: 50%; border: 2px solid #FFFFFF; background: #fff; flex: none; }
.ch__chaveiro div { min-width: 0; font: 700 clamp(11px, 3vw, 15px)/1.2 Georgia, 'Times New Roman', serif; color: var(--jg-14532d, #14532d); }
.ch__chaveiro small { display: block; font: 700 clamp(8px, 2vw, 10px)/1.2 Arial, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #6B4E0E; margin-bottom: 3px; }
.ch__chaveiro span { display: block; overflow-wrap: anywhere; }
.ch--chaveiro .ch__chaveiro { animation: ch-chaveiro var(--ch-chaveiro, .65s) cubic-bezier(.3, 1.25, .5, 1) forwards; }
@keyframes ch-chaveiro {
    0%   { left: 45%; top: 49%; opacity: 0; transform: translate(-50%, -50%) scale(.12) rotate(-10deg); }
    30%  { opacity: 1; }
    100% { left: 50%; top: 24%; opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-2deg); }
}

.ch__raios {
    position: absolute; left: 50%; top: 24%; width: 0; height: 0;
    pointer-events: none; z-index: 6;
}
.ch__raios i {
    position: absolute; left: 0; top: 0;
    width: 3px; height: 0;
    transform-origin: 50% 100%;
    background: linear-gradient(0deg, rgba(255, 236, 150, .9), rgba(255, 236, 150, 0));
    border-radius: 2px;
}
.ch--chaveiro .ch__raios i { animation: ch-raio .8s ease-out forwards; }
@keyframes ch-raio { from { height: 0; opacity: 1; } to { height: 120px; opacity: .55; } }

.ch__brilhos { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.ch__brilhos i {
    position: absolute;
    width: 4.5%; aspect-ratio: 1;
    background: #FFF6C9;
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    filter: drop-shadow(0 0 3px rgba(255, 214, 90, .95));
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
}
.ch--chaveiro .ch__brilhos i { animation: ch-estrela 1s ease-out forwards; }
@keyframes ch-estrela {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0) rotate(0deg); }
    45%  { opacity: 1; transform: translate(-50%, -50%) scale(1.25) rotate(30deg); }
    100% { opacity: .95; transform: translate(-50%, -50%) scale(.9) rotate(45deg); }
}

/* ---------------- plaquinha de boas-vindas (só sem prêmio) ---------------- */

.ch__plaquinha {
    position: absolute;
    left: 50%; top: 27%;
    max-width: 70%;
    padding: 2.2% 5%;
    border-radius: 6px;
    background: linear-gradient(180deg, #FFF3B0, #E0B43A 60%, #C9961A);
    border: 1.5px solid #9A7414;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 10px 16px -8px rgba(0, 0, 0, .5);
    font: 700 clamp(12px, 3.4vw, 17px)/1.2 Georgia, 'Times New Roman', serif;
    color: #4A3608;
    text-shadow: 0 1px 0 rgba(255, 246, 200, .7);
    text-align: center;
    white-space: nowrap;
    transform: translate(-50%, -30%) scale(.8);
    opacity: 0;
    z-index: 7;
}
.ch--plaquinha .ch__plaquinha { animation: ch-plaq .45s cubic-bezier(.3, 1.3, .5, 1) forwards; }
@keyframes ch-plaq { to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }

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

.ch__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);
}
.ch__botao:hover:not(:disabled) { filter: brightness(1.06); }
.ch__botao:disabled { opacity: .55; cursor: default; }

.ch__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);
}
.ch__msg--premiado { background: var(--jg-e3f5e6, #E3F5E6); border-color: var(--jg-9fd8ab, #9FD8AB); color: var(--jg-14532d, #14532d); }
.ch__msg--consolo  { background: #F1F3F1; border-color: #CDD5CE; color: #4F5A52; }
.ch__msg b { color: var(--jg-0a7a00, #0A7A00); }
.ch__msg--consolo b { color: #5C6B60; }

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

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

/* ---------------- movimento reduzido ---------------- */
@media (prefers-reduced-motion: reduce) {
    .ch--aberto .ch__luz { animation: none; opacity: .25; }
    .ch--premiou .ch__luz { animation: none; opacity: 1; transform: scale(1.15); }
    .ch--premiou .ch__chave { animation: none; transform: translate(0, -9px) scale(1.25) rotate(-8deg);
        filter: drop-shadow(0 0 1.5px #FFF6C8) drop-shadow(0 0 4px rgba(244, 196, 48, .95)); }
    .ch--chaveiro .ch__chaveiro { animation: none; left: 50%; top: 24%; opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-2deg); }
    .ch--chaveiro .ch__raios i { animation: none; height: 120px; opacity: .55; }
    .ch--chaveiro .ch__brilhos i { animation: none; opacity: .95; transform: translate(-50%, -50%) scale(.9) rotate(45deg); }
    .ch--plaquinha .ch__plaquinha { animation: none; transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
