@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;700&family=Orbitron:wght@700&display=swap');

* { box-sizing: border-box; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(255,152,0,0.9); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

:root {
    --azul-ceu: #4eb3ff; 
    --laranja: #ff9800;
    --btn-vermelho: #ff7675;
    --btn-verde: #2ecc71;
    --btn-roxo: #a29bfe;
    --btn-azul: #3498db;
}

body {
    font-family: 'Fredoka', sans-serif;
    background-color: var(--azul-ceu);
    margin: 0;
    height: 100vh;
    min-height: 100vh;
    height: 100dvh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    touch-action: manipulation;
    overscroll-behavior: none;
}

@supports (height: 100dvh) {
    body { height: 100dvh; min-height: 100dvh; }
}

/* --- CENÁRIO PROFUNDO (DIA/NOITE) --- */
#camada-noite {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, #0f2027, #203a43, #2c5364);
    opacity: 0;
    transition: opacity 1.5s ease;
    pointer-events: none;
    z-index: 0;
}
body.noite #camada-noite { opacity: 0.95; }

.nuvens-container { position: absolute; width: 100%; height: 100%; overflow: hidden; z-index: 1; pointer-events: none; }
.nuvem {
    position: absolute; background: white; width: 120px; height: 40px;
    border-radius: 50px; opacity: 0.6; animation: moverNuvens linear infinite;
}
.nuvem::after { content: ''; position: absolute; background: white; width: 60px; height: 60px; top: -25px; left: 20px; border-radius: 50%; }
@keyframes moverNuvens { from { left: -250px; } to { left: 100%; } }

.estrela {
    position: absolute; background: white; border-radius: 50%;
    opacity: 0; transition: opacity 1s ease;
}
body.noite .estrela { opacity: 0.8; }
body.noite .nuvem { opacity: 0.2; filter: brightness(0.5); }

/* --- BARRA BRANCA (CORAÇÕES CENTRALIZADOS) --- */
header { 
    background: rgba(255, 255, 255, 0.95); 
    width: 100%; 
    padding: calc(10px + env(safe-area-inset-top)) 20px 10px 20px; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative; 
    z-index: 50; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.2); 
    box-sizing: border-box;
}
.grupo-botoes { display: flex; gap: 8px; flex-wrap: wrap; z-index: 2; }

#vidas-ui { 
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.4rem; 
    letter-spacing: 2px; 
    white-space: nowrap;
    z-index: 1;
}

#recorde-container {
    text-align: right;
    color: var(--laranja);
    font-family: 'Orbitron', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1;
    z-index: 2;
}
#recorde-container span.titulo-rec { font-size: 0.85rem; font-family: 'Fredoka', sans-serif; color: #666; margin-bottom: 2px; font-weight: bold;}
#rec { font-size: 2.2rem; font-weight: bold; }

/* --- BOTÕES CLICÁVEIS --- */
.btn-header, .btn-modo, .btn-circular { 
    transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.1s, filter 0.2s;
}
.btn-header { color: white; text-decoration: none; padding: 10px 16px; border-radius: 50px; font-weight: bold; box-shadow: 0 6px 0 rgba(0,0,0,0.2); border: none; cursor: pointer; font-family: 'Fredoka'; font-size: 0.85rem; }
.btn-vermelho { background: var(--btn-vermelho); }
.btn-laranja { background: var(--laranja); }
.btn-azul { background: var(--btn-azul); }

.btn-header:active, .btn-modo:active:not(:disabled), .btn-circular:active {
    transform: translateY(6px);
    box-shadow: 0 0px 0 rgba(0,0,0,0.2) !important;
}

/* --- GRADE MOBILE --- */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 12px;
        padding-top: calc(15px + env(safe-area-inset-top));
    }
    #vidas-ui { 
        position: static; 
        transform: none; 
        font-size: 1.2rem;
    }
    .grupo-botoes { justify-content: center; }
    #recorde-container { align-items: center; text-align: center; }
    .btn-header{ padding: 8px 12px; font-size: 0.75rem; }
    #rec { font-size: 1.8rem; }
}

#jogo-container { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 10; position: relative; }
.painel-central { background: white; padding: clamp(12px, 3vh, 25px); border-radius: clamp(25px, 5vh, 40px); box-shadow: 0 20px 0 rgba(0,0,0,0.15), 0 30px 30px rgba(0,0,0,0.2); display: flex; flex-direction: column; align-items: center; width: min(92vw, 360px); z-index: 15; }

/* --- ESTILOS DO NUVITO --- */
#nuvito-personagem { 
    height: clamp(40px, 10vh, 80px); 
    margin-bottom: clamp(2px, 1vh, 5px); 
    transition: 0.3s; 
    display: flex;
    align-items: center;
    justify-content: center;
}
#img-nuvito {
    height: 100%;
    width: auto;
    object-fit: contain;
}

.pulando { animation: pular 0.5s infinite alternate; }
@keyframes pular { from { transform: translateY(0); } to { transform: translateY(-15px); } }
#hora-alvo { font-family: 'Orbitron', sans-serif; font-size: clamp(1.4rem, 4vh, 2.2rem); color: #d32f2f; background: #fff9c4; padding: 5px 15px; border-radius: 10px; border: 2px dashed var(--laranja); display: block; margin-top: clamp(2px, 1vh, 5px); }

/* --- PLACAR INFERIOR --- */
.placar-inferior {
    margin-top: clamp(10px, 3vh, 25px);
    background: rgba(255,255,255,0.95);
    padding: clamp(8px, 2vh, 12px) clamp(15px, 4vw, 30px);
    border-radius: 40px;
    font-size: clamp(0.9rem, 2vh, 1.1rem);
    font-weight: bold;
    color: #2d3436;
    box-shadow: 0 8px 0 rgba(0,0,0,0.1);
    display: flex;
    gap: clamp(10px, 3vw, 25px);
    z-index: 10;
}
.placar-inferior span { font-size: clamp(1.1rem, 2.5vh, 1.4rem); font-family: 'Orbitron', sans-serif; }

/* --- DESIGN DO RELÓGIO --- */
#relogio {
    width: min(70vw, 38vh, 260px);
    height: min(70vw, 38vh, 260px);
    border: clamp(8px, 2vh, 16px) solid #8D6E63; 
    border-radius: 50%; position: relative; background: #fffaf0; 
    margin: clamp(10px, 2.5vh, 20px) 0; user-select: none; 
    box-shadow: inset 0 0 25px rgba(0,0,0,0.15), 0 10px 20px rgba(0,0,0,0.1);
}
#relogio::after { content: ''; width: 16px; height: 16px; background: #4b4b4b; border-radius: 50%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 10; border: 3px solid #ccc; }

.ponteiro { position: absolute; bottom: 50%; left: 50%; transform-origin: bottom center; border-radius: 10px; cursor: grab; touch-action: none; will-change: transform, filter; transition: filter 0.2s; }

.ponteiro::before { content: ''; position: absolute; } 
#ponteiro-hora::before { top: -15px; bottom: -15px; left: -25px; right: -25px; }
#ponteiro-minuto::before { top: -30px; bottom: -15px; left: -30px; right: -30px; }

.ponteiro.arrastando { filter: drop-shadow(0 0 15px rgba(255, 255, 255, 1)) drop-shadow(0 0 5px var(--laranja)); z-index: 20 !important; }

#ponteiro-hora { width: clamp(8px, 1.5vh, 12px); height: 24%; background: #f44336; z-index: 6; border-radius: 15px; border: 2px solid #b71c1c; }
#ponteiro-minuto { width: clamp(6px, 1vh, 8px); height: 38%; background: #2196f3; z-index: 5; border-radius: 15px; border: 2px solid #0d47a1; }

.numero { position: absolute; width: 100%; height: 100%; text-align: center; font-weight: bold; font-size: clamp(0.9rem, 2.5vh, 1.15rem); padding: clamp(4px, 1.5vh, 10px); box-sizing: border-box; color: #444; }
.marca-minuto { position: absolute; width: 100%; height: 100%; text-align: center; padding: 2px; box-sizing: border-box; }
.marca-minuto::after { content: ''; display: inline-block; width: 2px; height: 6px; background: #bdc3c7; }

.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(10px); display: flex; justify-content: center; align-items: center; z-index: 100; }
.menu-caixa { background: white; padding: 30px; border-radius: 40px; border: 8px solid var(--laranja); width: 340px; text-align: center; max-height: 90vh; overflow-y: auto; }



.grid-modos { display: grid; gap: 10px; margin-top: 20px; }
.btn-modo { padding: 15px; border: none; border-radius: 15px; color: white; font-family: 'Fredoka'; font-weight: bold; cursor: pointer; box-shadow: 0 6px 0 rgba(0,0,0,0.15); font-size: 1.1rem; line-height: 1.2; }
.btn-modo small { display: block; font-weight: normal; font-size: 0.8rem; opacity: 0.9; margin-top: 5px; }
.btn-modo:disabled { opacity: 0.6; cursor: not-allowed; filter: grayscale(0.15); box-shadow: none !important; transform: translateY(6px); }

.instrucoes-texto { text-align: left; background: #f0f7ff; padding: 15px; border-radius: 20px; font-size: 0.9rem; color: #333; margin: 15px 0; border: 2px solid var(--btn-azul); }

.controles-fixos { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); right: calc(20px + env(safe-area-inset-right)); display: flex; flex-direction: column; gap: 15px; z-index: 110; }
.btn-circular { width: 60px; height: 60px; border-radius: 50%; border: 4px solid white; background: white; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 15px rgba(0,0,0,0.2); font-size: 1.5rem; }
.btn-circular.ativo { background: var(--btn-verde) !important; color: white; }

#btn-conferir {
    background: #4caf50;
    width: 100%;
    font-size: clamp(1.2rem, 3vh, 1.5rem);
    padding: clamp(10px, 2vh, 15px);
}

@media (max-height: 768px) {
    .painel-central { padding: 12px; border-radius: 25px; }
    #relogio { margin: 10px 0; width: min(60vw, 210px); height: min(60vw, 210px); }
    .btn-circular { width: 50px; height: 50px; border: 3px solid white; }
    .placar-inferior { margin-top: 10px; padding: 8px 20px; font-size: 0.95rem; }
}

@media (max-height: 650px) {
    .painel-central { padding: 8px; border-radius: 20px; }
    #relogio { margin: 5px 0; width: min(55vw, 180px); height: min(55vw, 180px); border-width: clamp(6px, 1.5vh, 10px); }
    .btn-circular { width: 45px; height: 45px; border: 2px solid white; font-size: 1.2rem; }
    .placar-inferior { margin-top: 8px; padding: 6px 15px; font-size: 0.85rem; gap: 10px; }
    #nuvito-personagem { margin-bottom: 2px; }
}

/* Efeitos Visuais */
#fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 120; overflow: hidden; }
.ring{ position:absolute; left:50%; top:50%; width: 88%; height: 88%; border-radius: 999px; transform: translate(-50%,-50%) scale(0.7); opacity: 0; border: 6px solid rgba(46,204,113,0.0); filter: drop-shadow(0 10px 15px rgba(0,0,0,0.1)); z-index: 2; pointer-events:none; }
.ring.ok{ animation: ringPop 520ms ease-out; border-color: rgba(46,204,113,0.95); }
.ring.erro{ animation: ringPop 520ms ease-out; border-color: rgba(255,118,117,0.95); }
@keyframes ringPop{ 0%{ opacity:0; transform: translate(-50%,-50%) scale(0.6); } 25%{ opacity:1; } 100%{ opacity:0; transform: translate(-50%,-50%) scale(1.15); } }
.popup-pontos{ position:absolute; left:50%; top:50%; transform: translate(-50%,-50%) scale(0.95); font-family: 'Orbitron', sans-serif; font-size: clamp(1.1rem, 3.8vw, 1.45rem); font-weight: 700; color: #2ecc71; background: rgba(255,255,255,0.92); padding: 6px 10px; border-radius: 14px; border: 2px solid rgba(0,0,0,0.06); opacity: 0; z-index: 9; pointer-events:none; white-space: nowrap; }
.popup-pontos.show{ animation: popPoints 780ms ease-out forwards; }
@keyframes popPoints{ 0%{ opacity:0; transform: translate(-50%,-50%) scale(0.85); } 20%{ opacity:1; transform: translate(-50%,-62%) scale(1.02); } 100%{ opacity:0; transform: translate(-50%,-92%) scale(1.02); } }

/* CSS PARA O POPUP DO BÔNUS */
.popup-bonus {
    position: absolute;
    transform: translate(-50%, -50%) scale(0.8);
    font-family: 'Fredoka', sans-serif;
    font-size: clamp(1.2rem, 4vw, 1.6rem);
    font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, #f1c40f, #e67e22);
    padding: 8px 15px;
    border-radius: 20px;
    border: 3px solid #fff;
    box-shadow: 0 8px 15px rgba(0,0,0,0.3);
    opacity: 0;
    z-index: 10;
    pointer-events: none;
    white-space: nowrap;
    animation: popBonus 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popBonus {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -70%) scale(1.1); }
    80% { opacity: 1; transform: translate(-50%, -80%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -100%) scale(0.9); }
}

#relogio.flash-ok{ animation: flashOk 450ms ease-out; }
@keyframes flashOk{ 0%{ box-shadow: inset 0 0 25px rgba(0,0,0,0.15), 0 0 0 rgba(46,204,113,0); } 30%{ box-shadow: inset 0 0 25px rgba(0,0,0,0.15), 0 0 0 15px rgba(46,204,113,0.25); } 100%{ box-shadow: inset 0 0 25px rgba(0,0,0,0.15), 0 0 0 rgba(46,204,113,0); } }
#relogio.flash-erro{ animation: shake 420ms ease-in-out; }
@keyframes shake{ 0%{ transform: translateX(0); } 20%{ transform: translateX(-6px); } 40%{ transform: translateX(6px); } 60%{ transform: translateX(-4px); } 80%{ transform: translateX(4px); } 100%{ transform: translateX(0); } }
.seq-pulse{ display:inline-block; animation: seqPulse 520ms ease-out; }
@keyframes seqPulse{ 0%{ transform: scale(1); filter: none; } 40%{ transform: scale(1.25); filter: drop-shadow(0 6px 10px rgba(162,155,254,0.8)); color: var(--laranja); } 100%{ transform: scale(1); filter: none; } }
.confetti{ position:absolute; width: var(--s, 8px); height: calc(var(--s, 8px) * 1.4); left: var(--x, 50%); top: var(--y, 50%); background: var(--c, #ffd54f); border-radius: 3px; opacity: 0; transform: translate(-50%, -50%) rotate(0deg); animation: confettiFly var(--d, 900ms) ease-out forwards; }
@keyframes confettiFly{ 0%{ opacity:0; transform: translate(-50%,-50%) translate(0,0) rotate(0deg); } 12%{ opacity:1; } 100%{ opacity:0; transform: translate(-50%,-50%) translate(var(--dx, 0px), var(--dy, 180px)) rotate(var(--r, 360deg)); } }