/* =========================================================
   JoKenPô: estilos e animações
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

:root {
    color-scheme: dark;

    --fundo-1: #0b0720;
    --fundo-2: #170e3d;
    --fundo-3: #0a1a33;

    --texto: #f5f3ff;
    --suave: #a5a1c8;
    --superficie: rgba(255, 255, 255, 0.055);
    --superficie-2: rgba(255, 255, 255, 0.1);
    --borda: rgba(255, 255, 255, 0.11);

    --jogador: #22d3ee;
    --cpu: #f472b6;
    --roxo: #a78bfa;
    --vitoria: #4ade80;
    --derrota: #f87171;
    --empate: #fbbf24;

    --raio: 22px;
    --fonte: "Fredoka", "Segoe UI", system-ui, -apple-system, sans-serif;
    --mola: cubic-bezier(0.34, 1.56, 0.64, 1);
    --suave-saida: cubic-bezier(0.2, 0.8, 0.2, 1);

    /* duração de cada batida do "Jo… Ken… Pô!" (o JS sobrescreve) */
    --batida: 360ms;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--fonte);
    color: var(--texto);
    background: linear-gradient(160deg, var(--fundo-1) 0%, var(--fundo-2) 50%, var(--fundo-3) 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

button {
    font-family: inherit;
}

:focus-visible {
    outline: 2px solid var(--roxo);
    outline-offset: 3px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Fundo animado ---------- */

.fundo {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    width: 46vmax;
    height: 46vmax;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.35;
    animation: blob 22s ease-in-out infinite alternate;
}

.blob-1 {
    background: #7c3aed;
    top: -18vmax;
    left: -12vmax;
}

.blob-2 {
    background: #0891b2;
    bottom: -20vmax;
    right: -14vmax;
    animation-delay: -8s;
}

.blob-3 {
    background: #db2777;
    top: 35%;
    left: 55%;
    width: 30vmax;
    height: 30vmax;
    opacity: 0.2;
    animation-delay: -14s;
}

@keyframes blob {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(6vmax, 4vmax) scale(1.12); }
    100% { transform: translate(-4vmax, 7vmax) scale(0.95); }
}

.maos-flutuantes span {
    position: absolute;
    bottom: -12vh;
    left: var(--x);
    font-size: var(--t);
    opacity: var(--o);
    animation: subir var(--dur) linear infinite;
    animation-delay: var(--atraso);
}

@keyframes subir {
    from { transform: translateY(0) rotate(0deg); }
    to { transform: translateY(-135vh) rotate(var(--giro, 360deg)); }
}

/* Clarão colorido no fim da rodada */
.flash {
    position: fixed;
    inset: 0;
    z-index: 40;
    pointer-events: none;
    opacity: 0;
}

.flash.vitoria {
    background: radial-gradient(circle at 50% 45%, rgba(74, 222, 128, 0.28), transparent 65%);
    animation: flash 0.8s ease-out;
}

.flash.derrota {
    background: radial-gradient(circle at 50% 45%, rgba(248, 113, 113, 0.3), transparent 65%);
    animation: flash 0.8s ease-out;
}

.flash.empate {
    background: radial-gradient(circle at 50% 45%, rgba(251, 191, 36, 0.2), transparent 65%);
    animation: flash 0.8s ease-out;
}

@keyframes flash {
    0% { opacity: 0; }
    15% { opacity: 1; }
    100% { opacity: 0; }
}

/* Canvas dos confetes e faíscas */
#fx {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 70;
    pointer-events: none;
}

/* ---------- Estrutura ---------- */

.app {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.app.tremer {
    animation: tremer 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes tremer {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-8px); }
    40%, 60% { transform: translateX(8px); }
}

.entrar {
    animation: entrar 0.7s var(--suave-saida) backwards;
    animation-delay: calc(var(--d, 0) * 90ms);
}

@keyframes entrar {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.98);
    }
}

.card {
    background: var(--superficie);
    border: 1px solid var(--borda);
    border-radius: var(--raio);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 40px -20px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ---------- Topo ---------- */

.topo {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
}

.logo {
    margin: 0;
    display: flex;
    font-size: clamp(2.2rem, 7vw, 3.1rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.01em;
    cursor: default;
    user-select: none;
}

.logo span {
    display: inline-block;
    animation:
        letra 0.8s var(--mola) backwards,
        onda-letra 4.5s ease-in-out infinite;
    animation-delay:
        calc(var(--i) * 70ms),
        calc(1.2s + var(--i) * 110ms);
}

.logo .l-jo {
    color: var(--jogador);
    text-shadow: 0 0 22px rgba(34, 211, 238, 0.55);
}

.logo .l-ken {
    color: var(--roxo);
    text-shadow: 0 0 22px rgba(167, 139, 250, 0.55);
}

.logo .l-po {
    color: var(--cpu);
    text-shadow: 0 0 22px rgba(244, 114, 182, 0.55);
}

.logo:hover span {
    animation: letra 0.8s var(--mola) backwards, pulo-letra 0.5s var(--mola);
    animation-delay: 0s, calc(var(--i) * 45ms);
}

@keyframes letra {
    from {
        opacity: 0;
        transform: translateY(-40px) scale(0.4) rotate(-20deg);
    }
}

@keyframes onda-letra {
    0%, 14%, 100% { transform: translateY(0) rotate(0); }
    7% { transform: translateY(-7px) rotate(-5deg); }
}

@keyframes pulo-letra {
    50% { transform: translateY(-10px) scale(1.15) rotate(-6deg); }
}

/* Seletor de modo com indicador deslizante */
.modos {
    position: relative;
    justify-self: center;
    width: min(100%, 390px);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 5px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--borda);
}

.modo-indicador {
    position: absolute;
    top: 5px;
    bottom: 5px;
    left: 5px;
    width: calc((100% - 10px) / 3);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.28), rgba(167, 139, 250, 0.32));
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 6px 20px -8px rgba(167, 139, 250, 0.8);
    transform: translateX(calc(var(--idx, 0) * 100%));
    transition: transform 0.45s var(--mola);
}

.modo {
    position: relative;
    z-index: 1;
    padding: 10px 4px;
    border: 0;
    border-radius: 12px;
    background: none;
    color: var(--suave);
    font-size: clamp(0.82rem, 2.6vw, 0.95rem);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.25s;
}

.modo:hover,
.modo.ativo {
    color: var(--texto);
}

.acoes {
    display: flex;
    gap: 8px;
}

.botao-icone {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 14px;
    color: var(--texto);
    background: var(--superficie);
    border: 1px solid var(--borda);
    cursor: pointer;
    transition: transform 0.25s var(--mola), background 0.2s, border-color 0.2s, color 0.2s;
}

.botao-icone svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.botao-icone:hover {
    transform: translateY(-2px) scale(1.06);
    background: var(--superficie-2);
    border-color: rgba(255, 255, 255, 0.2);
}

.botao-icone:active {
    transform: scale(0.9);
}

#btn-som[aria-pressed="false"] {
    color: var(--suave);
}

#btn-som[aria-pressed="true"] .ic-som-off,
#btn-som[aria-pressed="false"] .ic-som-on {
    display: none;
}

#btn-som.tocar .ic-som-on {
    animation: tocar 0.5s var(--mola);
}

@keyframes tocar {
    40% { transform: scale(1.3) rotate(-8deg); }
}

#btn-reiniciar.girando svg {
    animation: girar-uma 0.7s var(--mola);
}

@keyframes girar-uma {
    to { transform: rotate(360deg); }
}

/* ---------- Placar ---------- */

.placar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: stretch;
}

.pontuacao {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 12px 12px;
    text-align: center;
    transition: border-color 0.4s, box-shadow 0.4s;
}

.pontuacao.jogador { --cor: var(--jogador); }
.pontuacao.cpu { --cor: var(--cpu); }

.pontuacao::before {
    content: "";
    position: absolute;
    top: 0;
    left: 24%;
    right: 24%;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: var(--cor);
    box-shadow: 0 0 16px var(--cor);
}

.pontuacao.lider {
    border-color: color-mix(in srgb, var(--cor) 50%, transparent);
    box-shadow: 0 0 40px -12px var(--cor), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.rotulo {
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--suave);
}

.pontos {
    display: block;
    font-size: clamp(2.3rem, 8vw, 3rem);
    font-weight: 700;
    line-height: 1;
    color: var(--cor);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 24px color-mix(in srgb, var(--cor) 60%, transparent);
}

.pop {
    animation: pop 0.55s var(--mola);
}

@keyframes pop {
    40% { transform: scale(1.5); }
}

.mais-um {
    position: absolute;
    top: 38%;
    left: 68%;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--cor);
    text-shadow: 0 0 12px var(--cor);
    pointer-events: none;
    animation: mais-um 1s ease-out forwards;
}

@keyframes mais-um {
    0% { opacity: 0; transform: translateY(0) scale(0.6); }
    20% { opacity: 1; transform: translateY(-8px) scale(1.2); }
    100% { opacity: 0; transform: translateY(-46px) scale(1); }
}

.coroa {
    position: absolute;
    top: -17px;
    left: 50%;
    font-size: 1.5rem;
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.3) rotate(-25deg);
    transition: opacity 0.4s, transform 0.6s var(--mola);
    filter: drop-shadow(0 4px 10px rgba(250, 204, 21, 0.6));
    pointer-events: none;
}

.pontuacao.lider .coroa {
    opacity: 1;
    transform: translate(-50%, 0) scale(1) rotate(-8deg);
}

.pips {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.pip {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid var(--cor);
    opacity: 0.45;
    transition: opacity 0.3s, background 0.3s, box-shadow 0.3s;
}

.pip.cheio {
    opacity: 1;
    background: var(--cor);
    box-shadow: 0 0 10px var(--cor);
    animation: pop 0.5s var(--mola);
}

.placar-meio {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 2px;
}

.placar-meio .x {
    font-size: 1.7rem;
    line-height: 1;
    color: var(--suave);
}

.meta {
    font-size: 0.78rem;
    color: var(--suave);
    white-space: nowrap;
}

.meta b {
    display: inline-block;
    color: var(--texto);
    font-variant-numeric: tabular-nums;
}

/* ---------- Arena ---------- */

.arena {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: clamp(18px, 3.5vw, 28px) 12px 18px;
    overflow: hidden;
}

.arena::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 45% 70% at 18% 110%, rgba(34, 211, 238, 0.16), transparent 70%),
        radial-gradient(ellipse 45% 70% at 82% 110%, rgba(244, 114, 182, 0.16), transparent 70%);
    pointer-events: none;
}

.lutador {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.lutador.jogador { --cor: var(--jogador); --dir: 1; }
.lutador.cpu { --cor: var(--cpu); --dir: -1; }

.palco {
    position: relative;
    width: clamp(108px, 24vw, 160px);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
}

/* anel de luz */
.palco::before {
    content: "";
    position: absolute;
    inset: 8%;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--cor) 20%, transparent), transparent 70%);
    border: 2px solid color-mix(in srgb, var(--cor) 45%, transparent);
    box-shadow: 0 0 30px -6px var(--cor), inset 0 0 30px -10px var(--cor);
    transition: transform 0.5s var(--mola), box-shadow 0.5s, opacity 0.5s, border-color 0.5s;
}

/* sombra no chão */
.palco::after {
    content: "";
    position: absolute;
    bottom: -2%;
    left: 22%;
    right: 22%;
    height: 11%;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    filter: blur(6px);
}

.arena.jogando .palco::before {
    animation: pulsar var(--batida) ease-in-out infinite;
}

@keyframes pulsar {
    50% {
        transform: scale(1.07);
        box-shadow: 0 0 46px -4px var(--cor), inset 0 0 36px -8px var(--cor);
    }
}

.lutador.venceu .palco::before {
    transform: scale(1.08);
    border-color: var(--cor);
    box-shadow: 0 0 60px 0 var(--cor), inset 0 0 40px -6px var(--cor);
}

.lutador.perdeu .palco::before {
    transform: scale(0.9);
    opacity: 0.3;
}

.lutador.empatou .palco::before {
    border-color: color-mix(in srgb, var(--empate) 70%, transparent);
    box-shadow: 0 0 36px -6px var(--empate), inset 0 0 30px -10px var(--empate);
}

/* onda de choque */
.onda {
    position: absolute;
    inset: 10%;
    border-radius: 50%;
    border: 3px solid var(--cor);
    opacity: 0;
    pointer-events: none;
}

.palco.impacto .onda {
    animation: onda-choque 0.75s ease-out;
}

@keyframes onda-choque {
    0% { opacity: 0.9; transform: scale(0.7); }
    100% { opacity: 0; transform: scale(1.75); }
}

.mao-wrap {
    position: relative;
    z-index: 1;
    font-size: clamp(3.4rem, 11vw, 5.6rem);
    line-height: 1;
    transform-origin: 50% 85%;
}

.mao {
    display: inline-block;
    filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.45));
    transition: filter 0.5s;
}

.cpu .mao {
    transform: scaleX(-1);
}

.mao-wrap.ocioso {
    animation: respirar 3.2s ease-in-out infinite;
}

.cpu .mao-wrap.ocioso {
    animation-delay: -1.6s;
}

@keyframes respirar {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-8px) rotate(calc(var(--dir) * -4deg)); }
}

/* O "Jo… Ken… Pô!": as mãos sobem e descem três vezes */
.mao-wrap.chacoalhar {
    animation: chacoalhar var(--batida) 3;
}

@keyframes chacoalhar {
    0% {
        transform: translateY(0) rotate(0) scale(1);
        animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1);
    }
    45% {
        transform: translateY(-36%) rotate(calc(var(--dir) * -18deg)) scale(1.03);
        animation-timing-function: cubic-bezier(0.6, 0, 0.9, 0.4);
    }
    88% {
        transform: translateY(4%) rotate(calc(var(--dir) * 4deg)) scale(1.1, 0.88);
    }
    100% {
        transform: translateY(0) rotate(0) scale(1);
    }
}

.mao-wrap.revelar {
    animation: revelar 0.5s var(--mola);
}

.lutador.venceu .mao-wrap.revelar {
    animation:
        revelar 0.5s var(--mola),
        comemorar 0.65s 0.5s ease-in-out 2;
}

.lutador.perdeu .mao-wrap.revelar {
    animation:
        revelar 0.5s var(--mola),
        murchar 0.6s 0.45s var(--suave-saida) forwards;
}

.lutador.perdeu .mao {
    filter: grayscale(0.75) brightness(0.7) drop-shadow(0 10px 14px rgba(0, 0, 0, 0.45));
}

@keyframes revelar {
    0% { transform: scale(0.35) rotate(calc(var(--dir) * -30deg)); opacity: 0.2; }
    60% { transform: scale(1.28); opacity: 1; }
    100% { transform: scale(1); }
}

@keyframes comemorar {
    0%, 100% { transform: translateY(0) rotate(0); }
    40% { transform: translateY(-20%) rotate(calc(var(--dir) * -8deg)) scale(1.08); }
}

@keyframes murchar {
    to { transform: translateY(8%) rotate(calc(var(--dir) * 14deg)) scale(0.88); }
}

.nome-lutador {
    padding: 5px 12px;
    border-radius: 999px;
    font-size: clamp(0.78rem, 2.5vw, 0.92rem);
    font-weight: 600;
    white-space: nowrap;
    color: var(--cor);
    background: color-mix(in srgb, var(--cor) 13%, transparent);
    border: 1px solid color-mix(in srgb, var(--cor) 38%, transparent);
}

/* VS central com anel girando */
.versus {
    position: relative;
    width: clamp(62px, 13vw, 92px);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    margin-bottom: 34px;
}

.versus::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--jogador), var(--roxo), var(--cpu), var(--jogador));
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
    animation: girar 5s linear infinite;
}

.versus::after {
    content: "";
    position: absolute;
    inset: 12%;
    border-radius: 50%;
    background: rgba(10, 6, 30, 0.55);
    box-shadow: 0 0 30px -4px rgba(167, 139, 250, 0.6);
}

.arena.jogando .versus::before {
    animation-duration: 0.7s;
}

@keyframes girar {
    to { transform: rotate(360deg); }
}

.contagem {
    position: relative;
    z-index: 1;
    font-size: clamp(1rem, 3.6vw, 1.5rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
    text-shadow: 0 0 14px rgba(167, 139, 250, 0.9);
}

.contagem.batida {
    animation: batida var(--batida) var(--mola);
}

@keyframes batida {
    0% { transform: scale(0.3); opacity: 0; }
    55% { transform: scale(1.4); opacity: 1; }
    100% { transform: scale(1); }
}

/* ---------- Resultado ---------- */

.resultado {
    min-height: 78px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    text-align: center;
}

.resultado-titulo {
    margin: 0;
    font-size: clamp(1.5rem, 5.2vw, 2.15rem);
    font-weight: 700;
    line-height: 1.15;
    transition: color 0.3s;
}

.resultado-sub {
    margin: 0;
    min-height: 1.4em;
    font-size: clamp(0.9rem, 2.8vw, 1rem);
    color: var(--suave);
}

.resultado.aguardando .resultado-titulo {
    color: var(--suave);
}

.resultado.vitoria .resultado-titulo {
    color: var(--vitoria);
    text-shadow: 0 0 26px rgba(74, 222, 128, 0.5);
}

.resultado.derrota .resultado-titulo {
    color: var(--derrota);
    text-shadow: 0 0 26px rgba(248, 113, 113, 0.5);
}

.resultado.empate .resultado-titulo {
    color: var(--empate);
    text-shadow: 0 0 26px rgba(251, 191, 36, 0.45);
}

.resultado.animar .resultado-titulo {
    animation: titulo-entra 0.6s var(--mola);
}

.resultado.animar .resultado-sub {
    animation: sub-entra 0.5s 0.12s var(--suave-saida) backwards;
}

@keyframes titulo-entra {
    from {
        opacity: 0;
        transform: scale(0.5) translateY(10px);
        letter-spacing: 0.25em;
    }
}

@keyframes sub-entra {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

/* ---------- Opções ---------- */

.escolhas {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(10px, 2.5vw, 16px);
}

.escolha {
    --acento: #ffffff;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: clamp(16px, 3.5vw, 22px) 8px clamp(12px, 3vw, 16px);
    border-radius: 22px;
    border: 1px solid var(--borda);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
    color: var(--texto);
    cursor: pointer;
    transform:
        perspective(700px)
        rotateX(var(--rx, 0deg))
        rotateY(var(--ry, 0deg))
        translateY(var(--ty, 0px))
        scale(var(--s, 1));
    transition: transform 0.2s ease-out, border-color 0.3s, box-shadow 0.3s, opacity 0.3s, filter 0.3s;
    will-change: transform;
}

.escolha[data-escolha="pedra"] { --acento: #fb923c; }
.escolha[data-escolha="papel"] { --acento: #60a5fa; }
.escolha[data-escolha="tesoura"] { --acento: #e879f9; }

/* brilho que segue o cursor */
.escolha::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%),
            color-mix(in srgb, var(--acento) 35%, transparent), transparent 65%);
    opacity: 0;
    transition: opacity 0.3s;
}

.escolha:not([aria-disabled="true"]):hover,
.escolha:not([aria-disabled="true"]):focus-visible {
    --ty: -6px;
    border-color: color-mix(in srgb, var(--acento) 70%, transparent);
    box-shadow:
        0 20px 40px -18px var(--acento),
        inset 0 0 0 1px color-mix(in srgb, var(--acento) 30%, transparent);
}

.escolha:not([aria-disabled="true"]):hover::before,
.escolha:not([aria-disabled="true"]):focus-visible::before {
    opacity: 1;
}

.escolha:not([aria-disabled="true"]):active,
.escolha.apertada {
    --s: 0.94;
}

.escolha .emoji {
    font-size: clamp(2.4rem, 8.5vw, 3.4rem);
    line-height: 1.1;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4));
    transition: transform 0.4s var(--mola);
}

.escolha:not([aria-disabled="true"]):hover .emoji {
    transform: translateY(-4px) scale(1.18) rotate(-10deg);
}

.nome-escolha {
    font-size: clamp(0.92rem, 3vw, 1.08rem);
    font-weight: 600;
}

.escolha kbd {
    position: absolute;
    top: 8px;
    right: 10px;
    padding: 3px 6px;
    border-radius: 6px;
    font: 600 0.68rem/1 var(--fonte);
    color: var(--suave);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--borda);
}

.escolha[aria-disabled="true"] {
    cursor: default;
    opacity: 0.4;
    filter: saturate(0.4);
}

.escolha.selecionada {
    --ty: -6px;
    opacity: 1;
    filter: none;
    border-color: var(--acento);
    box-shadow: 0 0 0 2px var(--acento), 0 0 34px -4px var(--acento);
}

.escolha.selecionada .emoji {
    animation: chacoalhar-emoji var(--batida) 3;
}

@keyframes chacoalhar-emoji {
    45% { transform: translateY(-7px) rotate(-12deg) scale(1.1); }
}

.escolha.negada {
    animation: negar 0.35s ease-in-out;
}

@keyframes negar {
    25% { translate: -5px 0; }
    75% { translate: 5px 0; }
}

/* ondinha do clique */
.ondinha {
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    background: color-mix(in srgb, var(--acento) 45%, transparent);
    transform: scale(0);
    opacity: 0.8;
    pointer-events: none;
    animation: ondinha 0.65s ease-out forwards;
}

@keyframes ondinha {
    to {
        transform: scale(1);
        opacity: 0;
    }
}

/* ---------- Estatísticas e histórico ---------- */

.painel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: 16px;
}

.estatisticas,
.historico {
    padding: 18px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 4px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-icone {
    display: inline-block;
    font-size: 1.3rem;
}

.stat-valor {
    display: inline-block;
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stat-rotulo {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--suave);
}

.stat.quente {
    border-color: rgba(249, 115, 22, 0.45);
    background: rgba(249, 115, 22, 0.08);
}

.stat.quente .stat-icone {
    animation: chama 0.6s ease-in-out infinite alternate;
}

@keyframes chama {
    from {
        transform: scale(1) rotate(-6deg);
        filter: drop-shadow(0 0 4px #f97316);
    }
    to {
        transform: scale(1.25) rotate(6deg);
        filter: drop-shadow(0 0 12px #f97316);
    }
}

.stat.festa {
    animation: festa 0.9s var(--mola);
}

@keyframes festa {
    30% {
        transform: scale(1.12) rotate(-3deg);
        border-color: rgba(250, 204, 21, 0.7);
        box-shadow: 0 0 30px -6px rgba(250, 204, 21, 0.8);
    }
}

.barra {
    display: flex;
    height: 10px;
    margin: 16px 0 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.07);
}

.barra span {
    height: 100%;
    width: 0;
    transition: width 0.7s var(--suave-saida);
}

.barra-v { background: linear-gradient(90deg, #22c55e, var(--vitoria)); }
.barra-e { background: var(--empate); }
.barra-d { background: linear-gradient(90deg, #ef4444, var(--derrota)); }

.legenda {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 10px;
    font-size: 0.8rem;
    color: var(--suave);
}

.legenda i {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    vertical-align: 1px;
}

.legenda b {
    color: var(--texto);
    font-variant-numeric: tabular-nums;
}

.lg-v i { background: var(--vitoria); }
.lg-e i { background: var(--empate); }
.lg-d i { background: var(--derrota); }

.historico-topo {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px 10px;
    margin-bottom: 12px;
}

.historico h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.dica {
    font-size: 0.74rem;
    color: var(--suave);
}

.dica kbd {
    display: inline-block;
    min-width: 18px;
    margin: 0 1px;
    padding: 2px 4px;
    border-radius: 5px;
    font: 600 0.68rem/1.2 var(--fonte);
    text-align: center;
    color: var(--texto);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--borda);
}

.historico-lista {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px 5px 8px;
    border-radius: 12px;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 3px solid var(--cor-chip);
    animation: chip-entra 0.5s var(--mola);
}

.chip.vitoria { --cor-chip: var(--vitoria); }
.chip.derrota { --cor-chip: var(--derrota); }
.chip.empate { --cor-chip: var(--empate); }

.chip-n {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--cor-chip);
}

.chip small {
    margin: 0 3px;
    font-size: 0.7rem;
    color: var(--suave);
}

@keyframes chip-entra {
    from {
        opacity: 0;
        transform: translateX(-18px) scale(0.6);
    }
}

.historico-vazio {
    margin: 0;
    font-size: 0.9rem;
    color: var(--suave);
}

/* ---------- Modo online ---------- */

.botao-online {
    position: relative;
    height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px 0 13px;
    border-radius: 14px;
    border: 1px solid rgba(74, 222, 128, 0.45);
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.18), rgba(34, 211, 238, 0.16));
    color: var(--texto);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 24px -14px rgba(74, 222, 128, 0.9);
    transition: transform 0.25s var(--mola), box-shadow 0.25s, border-color 0.25s;
}

.botao-online::after {
    content: "";
    position: absolute;
    top: 7px;
    right: 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--vitoria);
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
    animation: ping-ponto 2s ease-out infinite;
}

.botao-online svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.6s var(--mola);
}

.botao-online:hover {
    transform: translateY(-2px) scale(1.04);
    border-color: var(--vitoria);
    box-shadow: 0 12px 28px -12px rgba(74, 222, 128, 1);
}

.botao-online:hover svg {
    transform: rotate(200deg);
}

.botao-online:active {
    transform: scale(0.94);
}

@keyframes ping-ponto {
    0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); }
    70%, 100% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); }
}

/* Barra da sala */
.barra-online {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 10px 12px 10px 16px;
    border-color: rgba(74, 222, 128, 0.3);
}

.online-ponto {
    --cor-ponto: var(--empate);
    flex: none;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--cor-ponto);
    box-shadow: 0 0 10px var(--cor-ponto);
    animation: pulso-ponto 1.6s ease-in-out infinite;
}

.online-ponto.conectado { --cor-ponto: var(--vitoria); }
.online-ponto.instavel { --cor-ponto: var(--derrota); }

@keyframes pulso-ponto {
    50% { transform: scale(0.7); opacity: 0.6; }
}

.online-info {
    flex: 1 1 160px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.online-sala {
    font-weight: 600;
}

.online-sala b {
    letter-spacing: 0.12em;
    color: var(--vitoria);
}

.online-status {
    overflow: hidden;
    font-size: 0.85rem;
    color: var(--suave);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.online-acoes {
    display: flex;
    gap: 8px;
}

.botao-mini {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 11px;
    border: 1px solid var(--borda);
    background: var(--superficie-2);
    color: var(--texto);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s var(--mola), background 0.2s, border-color 0.2s;
}

.botao-mini svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.botao-mini:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.16);
}

.botao-mini:active {
    transform: scale(0.94);
}

.botao-mini.perigo:hover {
    border-color: rgba(248, 113, 113, 0.6);
    background: rgba(248, 113, 113, 0.16);
}

/* Modo bloqueado para o convidado (só o dono da sala escolhe) */
.modo[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.55;
}

/* Selos "pensando…" / "pronto!" em cima das mãos */
.selo {
    position: absolute;
    top: -4px;
    left: 50%;
    z-index: 2;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
    white-space: nowrap;
    transform: translateX(-50%);
    background: rgba(15, 10, 40, 0.85);
    border: 1px solid var(--borda);
    color: var(--suave);
    animation: selo-entra 0.45s var(--mola);
}

.selo.pronto {
    color: #052e16;
    background: var(--vitoria);
    border-color: transparent;
    box-shadow: 0 0 18px -2px rgba(74, 222, 128, 0.9);
}

@keyframes selo-entra {
    from {
        opacity: 0;
        transform: translate(-50%, 8px) scale(0.6);
    }
}

/* Reações */
.reacoes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: -4px;
}

.reacoes-rotulo {
    margin-right: 2px;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--suave);
}

.reacao {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--borda);
    background: var(--superficie);
    font-size: 1.3rem;
    cursor: pointer;
    transition: transform 0.25s var(--mola), background 0.2s, border-color 0.2s;
}

.reacao:hover {
    transform: translateY(-3px) scale(1.15) rotate(-8deg);
    background: var(--superficie-2);
    border-color: rgba(255, 255, 255, 0.22);
}

.reacao:active {
    transform: scale(0.88);
}

/* fixa na tela (o JS posiciona no centro da mão), abaixo das janelas (60) e dos avisos (80) */
.reacao-voando {
    position: fixed;
    z-index: 50;
    font-size: 2.4rem;
    pointer-events: none;
    animation: reacao-voa 1.6s ease-out forwards;
}

@keyframes reacao-voa {
    0% { opacity: 0; transform: translate(-50%, -30%) scale(0.3); }
    15% { opacity: 1; transform: translate(-50%, -60%) scale(1.25); }
    100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), -150px) scale(0.9) rotate(var(--rot, 0deg)); }
}

/* Avisos rápidos */
.toasts {
    position: fixed;
    top: 14px;
    left: 50%;
    z-index: 80;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: min(92vw, 420px);
    transform: translateX(-50%);
    pointer-events: none;
}

.toast {
    max-width: 100%;
    padding: 11px 18px;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    color: var(--texto);
    background: rgba(24, 17, 58, 0.92);
    border: 1px solid var(--borda);
    box-shadow: 0 14px 40px -12px rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    animation: toast-entra 0.5s var(--mola);
}

.toast.sucesso { border-color: rgba(74, 222, 128, 0.55); }
.toast.erro { border-color: rgba(248, 113, 113, 0.6); }

.toast.saindo {
    animation: toast-sai 0.35s ease-in forwards;
}

@keyframes toast-entra {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.85);
    }
}

@keyframes toast-sai {
    to {
        opacity: 0;
        transform: translateY(-14px) scale(0.92);
    }
}

/* Painel online */
.modal-card.online-card {
    width: min(440px, 100%);
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
}

.fechar {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--suave);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.25s var(--mola);
}

.fechar svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.fechar:hover {
    color: var(--texto);
    background: var(--superficie-2);
    transform: rotate(90deg);
}

.etapa {
    position: relative;
    animation: etapa-entra 0.45s var(--suave-saida);
}

@keyframes etapa-entra {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

.modal-icone.online-icone {
    animation: girar-globo 6s linear infinite;
}

@keyframes girar-globo {
    0%, 100% { transform: rotate(-12deg) scale(1); }
    50% { transform: rotate(12deg) scale(1.08); }
}

.convite {
    margin: 0 0 10px;
    padding: 10px 14px;
    border-radius: 12px;
    color: var(--texto);
    background: rgba(74, 222, 128, 0.12);
    border: 1px solid rgba(74, 222, 128, 0.4);
}

.convite b {
    letter-spacing: 0.12em;
    color: var(--vitoria);
}

.campo {
    display: grid;
    gap: 6px;
    margin: 4px 0 16px;
    text-align: left;
}

.campo span {
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--suave);
}

.campo input,
.entrar-sala input,
.link-sala input {
    width: 100%;
    min-width: 0;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--borda);
    background: rgba(0, 0, 0, 0.25);
    color: var(--texto);
    font: 500 1rem/1.2 var(--fonte);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.campo input:focus,
.entrar-sala input:focus,
.link-sala input:focus {
    outline: none;
    border-color: var(--roxo);
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.3);
}

.entrar-sala input {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    font-weight: 700;
}

.entrar-sala input::placeholder {
    letter-spacing: 0.15em;
    font-weight: 500;
}

.entrar-sala,
.link-sala {
    display: flex;
    gap: 8px;
}

.link-sala input {
    font-size: 0.85rem;
    color: var(--suave);
}

.link-sala + .botao-primario {
    margin-top: 12px;
}

.botao-primario.largo {
    width: 100%;
}

.botao-primario:disabled {
    cursor: wait;
    opacity: 0.7;
    transform: none;
}

.botao-secundario {
    flex: none;
    padding: 12px 18px;
    border-radius: 12px;
    border: 1px solid rgba(167, 139, 250, 0.5);
    background: rgba(167, 139, 250, 0.16);
    color: var(--texto);
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s var(--mola), background 0.2s;
}

.botao-secundario:not(:disabled):hover {
    transform: translateY(-1px);
    background: rgba(167, 139, 250, 0.3);
}

.botao-secundario:not(:disabled):active {
    transform: scale(0.95);
}

.botao-secundario:disabled {
    cursor: wait;
    opacity: 0.6;
}

.botao-texto {
    display: block;
    margin: 14px auto 0;
    padding: 6px 10px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--suave);
    font-size: 0.92rem;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.botao-texto:hover {
    color: var(--texto);
}

.divisor {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 14px;
    font-size: 0.8rem;
    color: var(--suave);
}

.divisor::before,
.divisor::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--borda);
}

.erro-online {
    min-height: 1.3em;
    margin: 12px 0 0;
    font-size: 0.9rem;
    color: var(--derrota);
}

.erro-online:empty {
    margin: 0;
    min-height: 0;
}

.erro-online:not(:empty) {
    animation: negar 0.35s ease-in-out;
}

/* Radar de espera */
.radar {
    position: relative;
    width: 92px;
    height: 92px;
    margin: 0 auto 6px;
    display: grid;
    place-items: center;
}

.radar span {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--vitoria);
    opacity: 0;
    animation: radar 2.2s ease-out infinite;
}

.radar span + span {
    animation-delay: 1.1s;
}

.radar b {
    font-size: 2.6rem;
    font-weight: 400;
    animation: trofeu 2.4s ease-in-out infinite;
}

@keyframes radar {
    0% { opacity: 0.9; transform: scale(0.4); }
    100% { opacity: 0; transform: scale(1.15); }
}

.codigo-sala {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 6px 0 16px;
}

.codigo-sala span {
    width: 48px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--vitoria);
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.45);
    text-shadow: 0 0 16px rgba(74, 222, 128, 0.6);
    animation: letra 0.7s var(--mola) backwards;
    animation-delay: calc(var(--i) * 80ms);
}

.aguardando-texto {
    margin: 18px 0 0;
    color: var(--suave);
}

.pontinhos i {
    display: inline-block;
    font-style: normal;
    animation: pontinho 1.2s ease-in-out infinite;
}

.pontinhos i:nth-child(2) { animation-delay: 0.15s; }
.pontinhos i:nth-child(3) { animation-delay: 0.3s; }

@keyframes pontinho {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

.spinner {
    width: 64px;
    height: 64px;
    margin: 8px auto 4px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--jogador);
    border-right-color: var(--cpu);
    animation: girar 0.9s linear infinite;
}

.modal-revanche {
    position: relative;
    margin: -10px 0 18px;
    font-weight: 600;
    color: var(--empate);
    animation: pop 0.5s var(--mola);
}

/* vazia, a região continua no DOM (para leitores de tela) mas sem ocupar espaço */
.modal-revanche:empty {
    margin: 0;
    animation: none;
}

/* ---------- Salas abertas (saguão) e sala pública/privada ---------- */

.modal-icone.online-icone {
    font-size: 3.4rem;
}

.saguao {
    margin: 2px 0 4px;
    padding: 14px;
    border-radius: 16px;
    text-align: left;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--borda);
}

.saguao-topo {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.saguao-topo h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.saguao-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--suave);
    white-space: nowrap;
}

.saguao-status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--empate);
    animation: pulso-ponto 1.6s ease-in-out infinite;
}

.saguao-status.ok::before {
    background: var(--vitoria);
    box-shadow: 0 0 8px var(--vitoria);
}

.saguao-status.erro::before {
    background: var(--derrota);
    animation: none;
}

.saguao-lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 196px;
    margin: 0 0 10px;
    padding: 0 2px 0 0;
    overflow-y: auto;
    list-style: none;
}

.saguao-lista:empty {
    display: none;
}

.sala-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 8px 10px;
    border-radius: 12px;
    background: var(--superficie);
    border: 1px solid var(--borda);
    animation: sala-entra 0.45s var(--mola);
    transition: border-color 0.2s, background 0.2s;
}

.sala-item:hover {
    border-color: rgba(74, 222, 128, 0.45);
    background: rgba(74, 222, 128, 0.06);
}

@keyframes sala-entra {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.96);
    }
}

.sala-avatar {
    flex: none;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 1.1rem;
    background: rgba(244, 114, 182, 0.15);
    border: 1px solid rgba(244, 114, 182, 0.4);
}

.sala-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.sala-nome {
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sala-detalhe {
    overflow: hidden;
    font-size: 0.78rem;
    color: var(--suave);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sala-entrar {
    flex: none;
    border-color: rgba(74, 222, 128, 0.5);
    background: rgba(74, 222, 128, 0.16);
}

.sala-entrar:hover {
    background: rgba(74, 222, 128, 0.3);
}

.saguao-vazio {
    margin: 0 0 10px;
    font-size: 0.88rem;
    color: var(--suave);
}

.botao-secundario.largo {
    width: 100%;
}

.visibilidade {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.vis-opcao {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 8px;
    border-radius: 12px;
    border: 1px solid var(--borda);
    background: var(--superficie);
    color: var(--suave);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.25s, background 0.25s, color 0.25s, transform 0.25s var(--mola);
}

.vis-opcao small {
    font-size: 0.72rem;
    font-weight: 500;
}

.vis-opcao:hover {
    color: var(--texto);
    transform: translateY(-1px);
}

.vis-opcao[aria-pressed="true"] {
    color: var(--texto);
    border-color: var(--roxo);
    background: rgba(167, 139, 250, 0.18);
    box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.35) inset, 0 8px 20px -12px var(--roxo);
}

.aviso-visibilidade {
    display: inline-block;
    margin: 0 0 8px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
}

.aviso-visibilidade.publica {
    color: var(--vitoria);
    background: rgba(74, 222, 128, 0.12);
    border: 1px solid rgba(74, 222, 128, 0.35);
}

.aviso-visibilidade.privada {
    color: var(--roxo);
    background: rgba(167, 139, 250, 0.14);
    border: 1px solid rgba(167, 139, 250, 0.4);
}

.online-tipo {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--suave);
}

/* ---------- Chat da sala ---------- */

/* espaço no fim da página para nada ficar preso embaixo do botão do chat */
body.modo-online .app {
    padding-bottom: 96px;
}

/* acima das janelas (60) para dar para escrever "GG" no fim da partida; abaixo dos avisos (80) */
.botao-chat {
    position: fixed;
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    z-index: 65;
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, var(--cpu), var(--roxo));
    box-shadow: 0 14px 30px -10px rgba(244, 114, 182, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    cursor: pointer;
    animation: chat-botao-entra 0.5s var(--mola);
    transition: transform 0.25s var(--mola), box-shadow 0.25s;
}

.botao-chat svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.botao-chat:hover {
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 18px 36px -10px rgba(244, 114, 182, 1);
}

.botao-chat:active {
    transform: scale(0.92);
}

.botao-chat.pulo {
    animation: chat-pulo 0.6s var(--mola);
}

@keyframes chat-botao-entra {
    from {
        opacity: 0;
        transform: scale(0.3) rotate(-30deg);
    }
}

@keyframes chat-pulo {
    30% { transform: translateY(-10px) scale(1.12) rotate(-8deg); }
    60% { transform: translateY(0) scale(0.96) rotate(4deg); }
}

.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    background: var(--derrota);
    border: 2px solid var(--fundo-1);
    animation: pop 0.45s var(--mola);
}

/* prévia da mensagem ao lado do botão, com o chat fechado */
.chat-previa {
    position: fixed;
    right: 86px;
    bottom: calc(26px + env(safe-area-inset-bottom, 0px));
    z-index: 65;
    max-width: min(280px, calc(100vw - 110px));
    padding: 9px 14px;
    border-radius: 16px 16px 4px 16px;
    font-size: 0.9rem;
    color: var(--texto);
    background: rgba(24, 17, 58, 0.95);
    border: 1px solid rgba(244, 114, 182, 0.55);
    box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
    animation: previa-entra 0.4s var(--mola);
}

.chat-previa b {
    color: var(--cpu);
}

@keyframes previa-entra {
    from {
        opacity: 0;
        transform: translateX(16px) scale(0.85);
    }
}

.chat {
    position: fixed;
    right: 18px;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    z-index: 66;
    width: min(360px, calc(100vw - 32px));
    height: min(480px, calc(100vh - 120px));
    height: min(480px, calc(100dvh - 120px));
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    background: rgba(20, 14, 48, 0.94);
    border: 1px solid var(--borda);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transform-origin: bottom right;
    animation: chat-abre 0.35s var(--mola);
}

/* no celular o foco vai para o painel (sem abrir o teclado); não precisa de contorno */
.chat:focus {
    outline: none;
}

@keyframes chat-abre {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.85);
    }
}

.chat-topo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 10px 10px 16px;
    border-bottom: 1px solid var(--borda);
}

.chat-titulos {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-topo h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.chat-com {
    overflow: hidden;
    font-size: 0.8rem;
    color: var(--suave);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat .fechar {
    position: static;
}

.chat-mensagens {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 14px 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
}

.msg {
    max-width: 82%;
    padding: 8px 12px 6px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
    animation: msg-entra 0.35s var(--mola);
}

.msg .hora {
    display: block;
    margin-top: 2px;
    font-size: 0.66rem;
    text-align: right;
    color: var(--suave);
}

.msg.eu {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.28), rgba(167, 139, 250, 0.24));
    border: 1px solid rgba(34, 211, 238, 0.35);
    border-bottom-right-radius: 5px;
}

.msg.ele {
    align-self: flex-start;
    background: rgba(244, 114, 182, 0.16);
    border: 1px solid rgba(244, 114, 182, 0.35);
    border-bottom-left-radius: 5px;
}

.msg.sistema {
    align-self: center;
    max-width: 92%;
    padding: 4px 10px;
    font-size: 0.78rem;
    text-align: center;
    color: var(--suave);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
}

@keyframes msg-entra {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
    }
}

.chat-rapidas {
    display: flex;
    gap: 6px;
    padding: 0 12px 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.chat-rapida {
    flex: none;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid var(--borda);
    background: var(--superficie);
    color: var(--texto);
    font-size: 0.82rem;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.2s var(--mola);
}

.chat-rapida:hover {
    background: var(--superficie-2);
    border-color: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

.chat-form {
    display: flex;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--borda);
}

.chat-form.negada {
    animation: negar 0.35s ease-in-out;
}

.chat-form input {
    flex: 1;
    min-width: 0;
    padding: 11px 14px;
    border-radius: 14px;
    border: 1px solid var(--borda);
    background: rgba(0, 0, 0, 0.3);
    color: var(--texto);
    font: 500 1rem/1.2 var(--fonte); /* 16px: abaixo disso o iPhone dá zoom ao focar */
}

.chat-form input:focus {
    outline: none;
    border-color: var(--roxo);
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.3);
}

.chat-enviar {
    flex: none;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 14px;
    color: #0b0720;
    background: linear-gradient(135deg, var(--jogador), var(--roxo));
    cursor: pointer;
    transition: transform 0.2s var(--mola), opacity 0.2s;
}

.chat-enviar svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-enviar:hover {
    transform: scale(1.07) rotate(-8deg);
}

.chat-enviar:active {
    transform: scale(0.92);
}

/* balão de fala em cima da mão de quem escreveu (posicionado na página, acompanha a rolagem) */
.balao-chat {
    position: absolute;
    z-index: 55;
    width: max-content;
    max-width: min(230px, 42vw);
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.3;
    color: #12082e;
    background: #fdf2f8;
    box-shadow: 0 12px 28px -10px rgba(0, 0, 0, 0.7);
    overflow-wrap: anywhere;
    pointer-events: none;
    transform: translate(-50%, -100%);
    animation: balao 4.5s var(--suave-saida) forwards;
}

.balao-chat.eu {
    background: #ecfeff;
}

.balao-chat::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -7px;
    width: 14px;
    height: 14px;
    background: inherit;
    transform: translateX(-50%) rotate(45deg);
    border-radius: 3px;
}

@keyframes balao {
    0% { opacity: 0; transform: translate(-50%, -80%) scale(0.6); }
    8% { opacity: 1; transform: translate(-50%, -100%) scale(1.05); }
    12% { transform: translate(-50%, -100%) scale(1); }
    85% { opacity: 1; transform: translate(-50%, -100%); }
    100% { opacity: 0; transform: translate(-50%, -120%); }
}

@media (max-width: 640px) {
    /* no celular o chat vira uma gaveta que sobe de baixo */
    .chat {
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: min(72vh, 560px);
        height: min(72dvh, 560px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        border-radius: 22px 22px 0 0;
        border-bottom: 0;
        transform-origin: bottom center;
    }

    body.chat-aberto .botao-chat,
    body.chat-aberto .chat-previa {
        display: none;
    }
}

/* ---------- Rodapé ---------- */

.rodape {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 14px;
    padding-top: 6px;
    font-size: 0.92rem;
    color: var(--suave);
    text-align: center;
}

/* nome do autor: link para o LinkedIn, com sublinhado em degradê que cresce no hover */
.rodape .autor {
    position: relative;
    font-weight: 600;
    text-decoration: none;
    background: linear-gradient(90deg, var(--jogador), var(--roxo), var(--cpu));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.rodape .autor::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--jogador), var(--roxo), var(--cpu));
    transform: scaleX(0.25);
    transform-origin: left;
    opacity: 0.6;
    transition: transform 0.35s var(--suave-saida), opacity 0.35s;
}

.rodape .autor:hover::after,
.rodape .autor:focus-visible::after {
    transform: scaleX(1);
    opacity: 1;
}

/* ---------- Modal de fim de partida ---------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(5, 3, 20, 0.6);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s;
}

.modal.aberto {
    opacity: 1;
}

.modal-card {
    position: relative;
    overflow: hidden auto;
    width: min(420px, 100%);
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    padding: 34px 24px 28px;
    text-align: center;
    border-radius: 28px;
    background: linear-gradient(160deg, #261b57, #141032);
    border: 1px solid var(--borda);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transform: scale(0.7) translateY(30px);
    transition: transform 0.55s var(--mola);
}

.modal.aberto .modal-card {
    transform: none;
}

.modal-raios {
    position: absolute;
    top: -70px;
    left: 50%;
    width: 300px;
    height: 300px;
    margin-left: -150px;
    background: repeating-conic-gradient(from 0deg, rgba(250, 204, 21, 0.16) 0deg 10deg, transparent 10deg 20deg);
    -webkit-mask: radial-gradient(circle, #000 15%, transparent 68%);
    mask: radial-gradient(circle, #000 15%, transparent 68%);
    animation: girar 14s linear infinite;
    pointer-events: none;
}

.modal.derrota .modal-raios {
    background: repeating-conic-gradient(from 0deg, rgba(244, 114, 182, 0.14) 0deg 10deg, transparent 10deg 20deg);
}

.modal-icone {
    position: relative;
    display: inline-block;
    font-size: 4.6rem;
    line-height: 1;
    animation: trofeu 1.8s ease-in-out infinite;
}

@keyframes trofeu {
    0%, 100% { transform: translateY(0) rotate(-6deg); }
    50% { transform: translateY(-10px) rotate(6deg) scale(1.08); }
}

.modal-titulo {
    position: relative;
    margin: 14px 0 4px;
    font-size: 1.55rem;
    font-weight: 700;
}

.modal-placar {
    position: relative;
    margin: 4px 0;
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--suave);
}

.modal-placar .mj { color: var(--jogador); text-shadow: 0 0 20px rgba(34, 211, 238, 0.6); }
.modal-placar .mc { color: var(--cpu); text-shadow: 0 0 20px rgba(244, 114, 182, 0.6); }

.modal-texto {
    position: relative;
    margin: 0 0 22px;
    color: var(--suave);
}

.botao-primario {
    position: relative;
    overflow: hidden;
    padding: 14px 30px;
    border: 0;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #0b0720;
    background: linear-gradient(135deg, var(--jogador), var(--roxo) 55%, var(--cpu));
    box-shadow: 0 12px 30px -10px rgba(167, 139, 250, 0.85);
    cursor: pointer;
    transition: transform 0.25s var(--mola), box-shadow 0.25s;
}

.botao-primario::after {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.65), transparent);
    transform: skewX(-20deg);
    animation: reflexo 2.8s ease-in-out infinite;
}

@keyframes reflexo {
    0%, 55% { left: -60%; }
    100% { left: 130%; }
}

.botao-primario:not(:disabled):hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 18px 36px -10px rgba(167, 139, 250, 0.95);
}

.botao-primario:not(:disabled):active {
    transform: scale(0.96);
}

/* ---------- Responsivo ---------- */

/* com o botão Online, logo + modos + ações não cabem numa linha só abaixo disso */
@media (max-width: 780px) {
    .topo {
        grid-template-columns: 1fr auto;
        row-gap: 12px;
    }

    .modos {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
    }
}

@media (max-width: 720px) {
    .painel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .app {
        gap: 14px;
        padding-top: 16px;
    }

    .placar {
        gap: 8px;
    }

    .pontuacao {
        padding: 12px 6px 10px;
    }

    .rotulo {
        font-size: 0.7rem;
        letter-spacing: 0.06em;
    }

    .arena {
        padding-left: 6px;
        padding-right: 6px;
    }

    .nome-lutador {
        padding: 4px 9px;
    }

    .botao-online {
        width: 44px;
        padding: 0;
        justify-content: center;
    }

    .botao-online-texto {
        display: none;
    }

    .barra-online {
        padding: 10px 10px 10px 14px;
    }

    .online-acoes {
        width: 100%;
    }

    .online-acoes .botao-mini {
        flex: 1;
        justify-content: center;
    }

    .codigo-sala span {
        width: 44px;
        height: 54px;
        font-size: 1.7rem;
    }
}

@media (max-width: 380px) {
    .codigo-sala {
        gap: 6px;
    }

    .codigo-sala span {
        width: 40px;
    }
}

@media (hover: none) {
    .escolha kbd,
    .dica {
        display: none;
    }
}

/* Quem prefere menos movimento: corta o que é decorativo e contínuo */
@media (prefers-reduced-motion: reduce) {
    .blob,
    .logo span,
    .mao-wrap.ocioso,
    .versus::before,
    .modal-raios,
    .modal-icone,
    .botao-primario::after,
    .stat.quente .stat-icone,
    .arena.jogando .palco::before,
    .botao-online::after,
    .online-ponto,
    .online-icone,
    .radar b,
    .radar span,
    .saguao-status::before,
    .sala-item,
    .botao-chat,
    .msg,
    .pontinhos i {
        animation: none !important;
    }

    .radar span:first-child {
        opacity: 0.5;
        transform: scale(1);
    }

    .app.tremer {
        animation: none;
    }

    .maos-flutuantes {
        display: none;
    }
}
