@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700;800&display=swap');

:root {
  --azul-ceu: #87CEEB;
  --laranja: #e67e22;
  --laranja-escuro: #d35400;
  --btn-vermelho: #ff7675;
  --btn-vermelho-sombra: #d63031;
  --btn-verde: #2ecc71;
  --btn-verde-sombra: #27ae60;
  --btn-roxo: #a29bfe;
  --btn-roxo-sombra: #7b72e9;
  --cor-recheio: #e74c3c;
  --cor-queijo: #f1c40f;
  --borda-pizza: #e08e36;
  --texto: #2d3436;
  --sombra: rgba(0,0,0,0.15);
}

* { box-sizing: border-box; }

body {
  font-family: 'Fredoka', sans-serif;
  background-color: var(--azul-ceu);
  margin: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: var(--texto);
}

/* Flash de Alerta (Verde/Vermelho) */
.flash-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 999;
  opacity: 0; transition: opacity 0.3s;
}
.flash-verde { background: radial-gradient(circle, rgba(46,204,113,0.3) 0%, transparent 80%); opacity: 1; }
.flash-vermelho { background: radial-gradient(circle, rgba(231,76,60,0.3) 0%, transparent 80%); opacity: 1; }

/* Partículas Flutuantes */
.floating-text {
  position: fixed; color: var(--btn-verde); font-size: 2.5rem; font-weight: 900;
  pointer-events: none; z-index: 1000;
  animation: floatUp 1s ease-out forwards;
  text-shadow: 3px 3px 0 white, -3px -3px 0 white, 3px -3px 0 white, -3px 3px 0 white;
}
@keyframes floatUp {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-60px) scale(1.5); opacity: 0; }
}

.nuvens-container { position: absolute; inset: 0; overflow: hidden; z-index: 1; pointer-events: none; }
.nuvem {
  position: absolute; background: white; width: 120px; height: 40px;
  border-radius: 50px; opacity: .8; animation: moverNuvens linear infinite;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.06));
}
.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%; } }

/* Header Centralizado */
header {
  background: rgba(255,255,255,.95);
  width: 100%;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 50;
  box-shadow: 0 4px 15px rgba(0,0,0,.10);
  border-bottom: 4px solid #dfe6e9;
  position: relative;
}

.botoes-topo { display: flex; gap: 10px; align-items: center; z-index: 10; }
.botoes-direita { display: flex; gap: 10px; align-items: center; z-index: 10; }

.centro-hud {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 5;
}

.btn-3d {
  color: white; border: none; padding: 10px 16px; border-radius: 50px;
  font-weight: 800; cursor: pointer; font-family: 'Fredoka'; font-size: 0.9rem;
  text-decoration: none; transition: transform 0.1s; user-select: none;
}
.btn-3d:active { transform: translateY(4px); box-shadow: 0 0 0 transparent !important; }

.btn-sair { background: var(--btn-vermelho); box-shadow: 0 5px 0 var(--btn-vermelho-sombra); }
.btn-modo-topo { background: var(--btn-roxo); box-shadow: 0 5px 0 var(--btn-roxo-sombra); }

#vidas-ui { font-size: 1.4rem; letter-spacing: 2px; }
#timer-ui { font-size: 1.8rem; font-weight: 800; color: var(--btn-vermelho); display: none; animation: pulseTimer 1s infinite alternate; }
@keyframes pulseTimer { from { transform: scale(1); } to { transform: scale(1.1); } }

/* Recorde Reposicionado na Header */
.recorde-destaque { text-align: right; font-weight: 800; font-size: 0.9rem; color: #7f8c8d; }
#rec-label { display: block; font-size: 2rem; color: var(--laranja-escuro); line-height: 1; text-shadow: 1px 1px 0px rgba(0,0,0,0.1); }

#jogo-container {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 10; padding: 10px 14px clamp(80px, 12vh, 120px); gap: clamp(5px, 2vh, 15px);
  overflow-y: auto;
}

#pedido-display {
  background: white; padding: clamp(8px, 2vh, 15px) clamp(15px, 4vw, 35px); border-radius: 30px;
  border: 6px solid var(--laranja); text-align: center;
  box-shadow: 0 8px 0 var(--sombra); transform: rotate(-1deg);
}
#fracao-alvo { font-size: clamp(2rem, min(6.5vw, 7vh), 3.8rem); margin: 0; color: var(--laranja-escuro); letter-spacing: 2px; }

#opcoes-container { width: min(900px, 100%); display: grid; gap: 20px; align-items: stretch; justify-items: stretch; }
#opcoes-container.modo-facil { grid-template-columns: repeat(2, minmax(0,1fr)); }
#opcoes-container.modo-chef { grid-template-columns: 1fr; justify-items: center; }

@media (min-width: 640px) { #opcoes-container.modo-facil { grid-template-columns: repeat(4, minmax(0,1fr)); } }

.pizza-wrapper {
  width: clamp(120px, 24vw, 160px); height: clamp(120px, 24vw, 160px);
  position: relative; filter: drop-shadow(0 6px 8px rgba(0,0,0,0.2));
}
.fatia-svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }

.card-pizza {
  background: white; padding: 15px; border-radius: 35px; cursor: pointer;
  transition: all 0.15s ease; border: 5px solid transparent;
  box-shadow: 0 8px 0 #bdc3c7, 0 15px 20px var(--sombra);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  user-select: none;
}
.card-pizza:hover { transform: translateY(-5px) scale(1.03); border-color: var(--laranja); box-shadow: 0 8px 0 var(--laranja-escuro), 0 20px 25px var(--sombra); }
.card-pizza:active { transform: translateY(3px) scale(0.98); box-shadow: 0 0 0 transparent, 0 5px 10px var(--sombra); }
.card-label { font-weight: 800; font-size: 1.1rem; color: #7f8c8d; text-transform: uppercase; }

#hud-inferior {
  position: fixed; bottom: clamp(10px, 3vh, 25px); left: 50%; transform: translateX(-50%);
  background: white; padding: clamp(8px, 1.5vh, 12px) clamp(15px, 3vw, 30px); border-radius: 40px;
  border: clamp(3px, 0.8vh, 6px) solid var(--texto); box-shadow: 0 clamp(4px, 1vh, 8px) 0 var(--texto), 0 15px 30px rgba(0,0,0,0.3);
  display: flex; gap: clamp(20px, 4vw, 40px); font-size: clamp(1rem, 2vh, 1.2rem); font-weight: 800; z-index: 100;
  color: #555;
}
.hud-valor { font-size: clamp(1.4rem, 3vh, 2rem); color: var(--btn-verde); display: block; line-height: 1.1; }

@media (max-height: 700px) {
  #jogo-container { justify-content: flex-start; }
}

.pizza-interativa-box {
  background: white; padding: clamp(10px, 2.5vh, 25px); border-radius: clamp(20px, 4vh, 40px); display: flex; flex-direction: column;
  align-items: center; gap: clamp(10px, 2vh, 18px); box-shadow: 0 15px 30px rgba(0,0,0,.15); width: min(550px, 100%);
}
.pizza-interativa-box .pizza-wrapper { width: clamp(150px, min(62vw, 33vh), 350px); height: clamp(150px, min(62vw, 33vh), 350px); }

.controles-dificil { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.btn-grande {
  background: var(--btn-verde); color: white; border: none; padding: clamp(10px, 2vh, 16px); border-radius: 25px;
  font-size: clamp(1.1rem, 2.5vh, 1.3rem); font-weight: 800; cursor: pointer; box-shadow: 0 8px 0 var(--btn-verde-sombra);
  width: min(400px, 100%); font-family: 'Fredoka'; text-transform: uppercase; transition: transform 0.1s;
}
.btn-grande:active { transform: translateY(5px); box-shadow: 0 3px 0 var(--btn-verde-sombra); }

.overlay {
  position: fixed; inset: 0; background: rgba(44,62,80,.6); backdrop-filter: blur(5px);
  display: flex; justify-content: center; align-items: center; z-index: 1000; padding: 18px;
}
.menu-caixa {
  background: white; padding: 30px; border-radius: 45px; border: 8px solid var(--laranja);
  width: min(480px, 100%); text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.40);
  max-height: 95vh; overflow-y: auto;
}

.tutorial-box {
  text-align: left; background: #fdfaf6; padding: 18px; border-radius: 25px;
  margin: 20px 0; font-size: 0.95rem; border: 3px dashed #eccc68; line-height: 1.5; color: #57606f;
}

.controles-fixos { position: fixed; bottom: 25px; right: 20px; display: flex; flex-direction: column; gap: 12px; z-index: 110; }
.btn-circular {
  width: 55px; height: 55px; border-radius: 50%; border: 4px solid white; background: white;
  cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
  box-shadow: 0 8px 15px rgba(0,0,0,.20); transition: transform 0.2s;
}
.btn-circular:active { transform: scale(0.9); }
.btn-circular.ativo { background: var(--btn-verde); border-color: var(--btn-verde-sombra); color: white; }

#mensagem { min-height: 35px; font-size: 1.3rem; font-weight: 800; text-align: center; text-transform: uppercase; }
.chef-fatia { cursor: pointer; transition: opacity 0.1s; }
.chef-fatia:hover { opacity: 0.8; }

@media (max-width: 600px) {
  header { padding: 10px; flex-wrap: wrap; }
  .botoes-topo { flex-wrap: wrap; justify-content: center; margin-bottom: 10px; }
  .centro-hud { position: static; transform: none; width: 100%; margin-top: 5px; order: 3; }
  .botoes-direita { position: absolute; right: 10px; top: 10px; }
  
  #hud-inferior { bottom: 15px; padding: 10px 20px; gap: 20px; font-size: 1rem; }
  .hud-valor { font-size: 1.5rem; }
  .controles-fixos { bottom: 15px; right: 10px; transform: scale(0.85); }
}
/* Efeito para opção errada no Modo Fácil */
.card-pizza.erro {
  opacity: 0.4;
  filter: grayscale(80%);
  pointer-events: none; /* Impede que a criança clique novamente */
  box-shadow: none;
  transform: scale(0.95);
  border-color: transparent;
}