@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;700&display=swap');

:root {
    --azul-ceu: #87CEEB;
    --laranja: #ff9800;
    --btn-vermelho: #ff7675;
    --btn-verde: #2ecc71;
    --btn-azul: #3498db;
    --azul-tile: #6c5ce7;
}

body {
    font-family: 'Fredoka', sans-serif;
    background-color: var(--azul-ceu);
    margin: 0; overflow: hidden; height: 100vh;
    display: flex; flex-direction: column; align-items: center;
    user-select: none;
    -webkit-user-select: none;
}

.intro-blur { filter: blur(20px); transition: filter 0.8s ease; }

.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: mover linear infinite;
}
.nuvem::after { content: ''; position: absolute; background: white; width: 60px; height: 60px; top: -25px; left: 20px; border-radius: 50%; }
@keyframes mover { from { left: -200px; } to { left: 100%; } }

/* Header Reestruturado */
header {
    background: rgba(255, 255, 255, 0.95); width: 100%; padding: 8px 14px;
    display: flex; justify-content: space-between; align-items: center;
    z-index: 100; box-shadow: 0 3px 12px rgba(0,0,0,0.10); box-sizing: border-box;
}

.header-left { display: flex; flex: 1; gap: 10px; justify-content: flex-start; align-items: center; }
.header-center { display: flex; flex: 1; justify-content: center; align-items: center; text-align: center; }
.header-right { display: flex; flex: 1; flex-direction: column; align-items: flex-end; justify-content: center; text-align: right; gap: 4px; }

.btn-header {
    cursor: pointer; padding: 8px 18px; border-radius: 50px; border: none;
    color: white; font-weight: bold; font-family: 'Fredoka';
    font-size: 0.86rem; box-shadow: 0 4px 0 rgba(0,0,0,0.2); text-decoration: none;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.1s, box-shadow 0.1s;
}

.btn-vermelho { background: var(--btn-vermelho) !important; }
.btn-verde { background: var(--btn-verde) !important; }
.btn-azul { background: var(--btn-azul) !important; }
.btn-laranja { background: var(--laranja) !important; }

/* Adicionado para dar feedback de modo concluído */
.btn-concluido {
    background: var(--btn-verde) !important;
    color: white !important;
    border-color: #27ae60 !important;
}

#badge-seq {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; 
    border-radius: 999px; background: rgba(108,92,231,0.12); color: var(--azul-tile); 
    font-weight: bold; border: 2px solid rgba(108,92,231,0.25); transform-origin: center;
}

.overlay {
    position: fixed; inset: 0; background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px); display: flex; flex-direction: column;
    align-items: center; justify-content: center; z-index: 4000;
}

.menu-caixa {
    background: white; padding: 25px; border-radius: 35px;
    border: 8px solid var(--laranja); width: 90%; max-width: 800px; 
    text-align: center; max-height: 90vh; overflow-y: auto;
}

.grade-botoes {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px;
    padding: 15px;
}

.btn-nivel {
    padding: 15px; font-size: 1rem; cursor: pointer; border: none;
    border-radius: 15px; background: var(--azul-tile); color: white;
    font-family: 'Fredoka'; box-shadow: 0 5px 0 rgba(0,0,0,0.25);
    font-weight: bold; transition: 0.1s; text-decoration: none;
}

.btn-nivel:active, .btn-header:active, .btn-circular:active {
    transform: translateY(4px) !important;
    box-shadow: 0 1px 0 rgba(0,0,0,0.2) !important;
}

#area-jogo { position: relative; width: calc(100vw - 16px); max-width: 1920px; flex: 1; min-height: 0; margin: 8px; z-index: 10; overflow: hidden; border-radius: 22px; background: linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.06)); box-shadow: inset 0 0 0 2px rgba(255,255,255,0.18), 0 14px 34px rgba(0,0,0,0.10); }
#area-jogo::before{ content:''; position:absolute; inset:-40%; background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,0.28), transparent 48%),
    radial-gradient(circle at 75% 65%, rgba(255,255,255,0.18), transparent 52%);
    animation: brilhoArea 10s ease-in-out infinite; pointer-events:none; }
@keyframes brilhoArea{ 0%,100%{ transform: translate(0,0) rotate(0deg);} 50%{ transform: translate(6%, -4%) rotate(2deg);} }

.carta {
    position: absolute; z-index: 2;
    width: clamp(78px, 15.2vw, 138px); height: clamp(56px, 10.6vw, 92px);
    background: linear-gradient(180deg, #ffffff, #f7fbff); color: #2d3436; display: flex;
    justify-content: center; align-items: center; border-radius: 18px;
    cursor: grab; font-size: clamp(0.95rem, 2.6vw, 1.1rem); font-weight: bold;
    box-shadow: 0 6px 0 rgba(0,0,0,0.10); user-select: none;
    border: 3px solid var(--azul-tile); text-transform: uppercase;
    text-align: center; padding: 6px; touch-action: none;
    transform: rotate(var(--rot, 0deg));
    will-change: transform, left, top;
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease, background 0.2s ease, color 0.2s ease;
}
.carta::after{
    content:'';
    position:absolute; inset:0; border-radius: 18px;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.85), transparent 58%);
    opacity: 0.55; pointer-events:none;
}
.carta:hover{ transform: rotate(var(--rot, 0deg)) translateY(-1px); }

@keyframes wiggle {
    0%, 100% { transform: rotate(var(--rot, 0deg)) scale(1.06); }
    50% { transform: rotate(calc(var(--rot, 0deg) + 3deg)) scale(1.06); }
}
.carta.dragging { 
    cursor: grabbing; 
    filter: brightness(1.02); 
    box-shadow: 0 18px 0 rgba(0,0,0,0.12);
    animation: wiggle 0.4s infinite ease-in-out; 
}

.emoji-grande { font-size: 3rem; }
.letra-grande { font-size: 3.2rem; color: var(--azul-tile); }

.acertou { 
    pointer-events: none; 
    background: var(--btn-verde) !important;
    color: white !important;
    border-color: var(--btn-verde) !important; 
    filter: drop-shadow(0 0 18px rgba(46,204,113,0.8)); 
    animation: sumir .65s ease forwards; 
}
.acertou.letra-grande { color: white !important; }
.acertou::after { display: none; } 

@keyframes sumir { 0%{transform:scale(1);opacity:1;} 35%{transform:scale(1.14);opacity:1;} 100%{transform:scale(0.08);opacity:0;} }

.mao-tutorial { font-size: 3rem; position: absolute; animation: arrastarSimulado 2.5s infinite; pointer-events: none; }
@keyframes arrastarSimulado {
    0% { transform: translate(0, 0); opacity: 0; }
    20% { opacity: 1; }
    80% { transform: translate(150px, 0); opacity: 1; }
    100% { transform: translate(150px, 0); opacity: 0; }
}

.controles-fixos { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 2500; }
.btn-circular { width: 60px; height: 60px; border-radius: 50%; border: none; background: white; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; box-shadow: 0 4px 15px rgba(0,0,0,0.2); transition: 0.1s; }
.btn-circular.ativo { background: var(--btn-verde); color: white; }

.errado { animation: shake .32s ease; border-color: var(--btn-vermelho); }
@keyframes shake { 0%{transform:rotate(var(--rot,0deg)) translateX(0);} 25%{transform:rotate(var(--rot,0deg)) translateX(-7px);} 50%{transform:rotate(var(--rot,0deg)) translateX(7px);} 75%{transform:rotate(var(--rot,0deg)) translateX(-5px);} 100%{transform:rotate(var(--rot,0deg)) translateX(0);} }

#badge-seq.pulso { animation: pulso .35s ease; }
@keyframes pulso { 0%{transform:scale(1);} 45%{transform:scale(1.08);} 100%{transform:scale(1);} }

#badge-seq.combo{
    background: rgba(255,152,0,0.14);
    border-color: rgba(255,152,0,0.38);
    box-shadow: 0 0 0 6px rgba(255,152,0,0.10);
}

.particula { position:absolute; width:10px; height:10px; border-radius:50%; pointer-events:none; background: rgba(255,255,255,0.95); box-shadow:0 10px 18px rgba(0,0,0,0.12); animation: explodir .62s ease-out forwards; z-index: 50; }

.confete{ position:absolute; width:10px; height:14px; border-radius:4px; pointer-events:none; background: rgba(255,152,0,0.95); box-shadow:0 10px 18px rgba(0,0,0,0.12); transform: translate(-50%,-50%); animation: confete 1.25s ease-out forwards; z-index: 55; }
@keyframes confete{ 0%{ opacity:0; transform: translate(-50%,-50%) rotate(0deg) scale(0.7);} 12%{opacity:1;} 100%{ opacity:0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(560deg) scale(1);} }

@keyframes explodir { 0%{ transform: translate(0,0) scale(1); opacity:1;} 100%{ transform: translate(var(--dx), var(--dy)) scale(0.2); opacity:0;} }

.pop-texto { position:absolute; font-weight:900; font-size:1.05rem; color: var(--btn-verde); text-shadow:0 8px 16px rgba(0,0,0,0.15); pointer-events:none; transform: translate(-50%, -50%); animation: subir .72s ease-out forwards; z-index: 60; white-space:nowrap; }

.faisca{ position:absolute; left:0; top:0; font-size:1.1rem; pointer-events:none; transform: translate(-50%,-50%); animation: faisca 0.85s ease-out forwards; z-index: 65; filter: drop-shadow(0 10px 16px rgba(0,0,0,0.16)); }
@keyframes faisca{ 0%{opacity:0; transform:translate(-50%,-50%) scale(0.6);} 16%{opacity:1;} 100%{opacity:0; transform:translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.25);} }

@keyframes subir { 0%{ opacity:0; transform:translate(-50%, -35%) scale(0.98);} 18%{opacity:1;} 100%{ opacity:0; transform:translate(-50%, -110%) scale(1.05);} }

.acoes-vitoria{
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 14px;
}
.acoes-vitoria .btn-nivel{ width: 100%; }

@media (max-width: 800px){
    header { flex-direction: column; gap: 10px; }
    .header-left, .header-center, .header-right { width: 100%; justify-content: center; align-items: center; text-align: center; }
    .header-right { flex-direction: row; }
}