:root {
  --bg-color: #03001e;
  --bg-gradient: linear-gradient(135deg, #03001e 0%, #7303c0 50%, #ec38bc 100%);
  --space-dark: #0a0612;
  --primary: #00f2fe;
  --primary-glow: rgba(0, 242, 254, 0.4);
  --secondary: #fe00a5;
  --secondary-glow: rgba(254, 0, 165, 0.4);
  --success: #39ff14;
  --success-glow: rgba(57, 255, 20, 0.4);
  --warning: #ffb703;
  --white: #ffffff;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --font-interface: 'Arial', sans-serif;
  --font-game: 'Arial Black', 'Arial', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  font-family: var(--font-interface);
  background-color: var(--space-dark);
  color: var(--white);
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* Fundo espacial dinâmico */
#stars-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
  background: radial-gradient(circle at center, #180d30 0%, #05020c 100%);
}

.star {
  position: absolute;
  background-color: #fff;
  border-radius: 50%;
  animation: float-star linear infinite;
}

@keyframes float-star {
  from {
    transform: translateY(-10px);
  }
  to {
    transform: translateY(100vh);
  }
}

/* Container Principal */
.app-container {
  position: relative;
  z-index: 10;
  width: 95vw;
  max-width: 900px;
  height: 90vh;
  background: rgba(10, 5, 25, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 
              0 0 40px rgba(115, 3, 192, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Telas do Jogo */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.5s ease, transform 0.5s ease;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* TELA INICIAL */
#menu-screen h1 {
  font-family: var(--font-game);
  font-size: 3.5rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
  text-shadow: 0 0 30px rgba(0, 242, 254, 0.2);
  text-align: center;
  animation: glow-text 3s ease-in-out infinite alternate;
}

@keyframes glow-text {
  0% {
    filter: drop-shadow(0 0 2px var(--primary-glow));
  }
  100% {
    filter: drop-shadow(0 0 15px var(--secondary-glow));
  }
}

.subtitle {
  font-size: 1.2rem;
  color: #a5a1c0;
  margin-bottom: 40px;
  font-weight: 300;
  letter-spacing: 1px;
}

.menu-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 30px;
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.3);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #d1cde8;
}

.btn-group {
  display: flex;
  gap: 10px;
}

.difficulty-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.btn-option {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  color: #fff;
  padding: 10px 4px;
  font-size: 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font-interface);
  font-weight: 600;
  transition: all 0.3s ease;
  outline: none;
  text-align: center;
}

.btn-option:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-option.selected[data-level="ano1"] {
  background: var(--success);
  border-color: var(--success);
  box-shadow: 0 0 15px var(--success-glow);
  color: #000;
}

.btn-option.selected[data-level="ano2"] {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
  color: #000;
}

.btn-option.selected[data-level="ano3"] {
  background: var(--warning);
  border-color: var(--warning);
  box-shadow: 0 0 15px rgba(255, 183, 3, 0.4);
  color: #000;
}

.btn-option.selected[data-level="ano4"] {
  background: #b5179e;
  border-color: #b5179e;
  box-shadow: 0 0 15px rgba(181, 23, 158, 0.4);
  color: #fff;
}

.btn-option.selected[data-level="ano5"] {
  background: var(--secondary);
  border-color: var(--secondary);
  box-shadow: 0 0 15px var(--secondary-glow);
  color: #fff;
}

/* Botão de Ação */
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border: none;
  color: white;
  padding: 16px 32px;
  font-size: 1.2rem;
  font-family: var(--font-game);
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.5), 
              0 0 30px rgba(254, 0, 165, 0.3);
}

.btn-primary:active {
  transform: translateY(1px);
}

/* TELA DE JOGO */
#game-screen {
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Header do Jogo */
.game-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(10, 5, 25, 0.4);
  z-index: 15;
}

.stat-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-label {
  font-size: 0.85rem;
  color: #a5a1c0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  font-family: var(--font-game);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-shadow: 0 0 10px var(--primary-glow);
}

/* Painel de Pausa Rápida */
.btn-pause {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--white);
  padding: 8px 15px;
  cursor: pointer;
  font-family: var(--font-interface);
  font-weight: 600;
  transition: all 0.3s;
}

.btn-pause:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Arena do Jogo */
.game-arena {
  flex: 1;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: radial-gradient(circle at center, rgba(115, 3, 192, 0.1) 0%, transparent 70%);
}

/* Console Principal */
.console-box {
  background: rgba(15, 10, 35, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 20px 30px;
  width: 100%;
  max-width: 550px;
  text-align: center;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(255, 255, 255, 0.02);
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

/* Barra de Progresso */
.phase-indicator {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

#phase-text {
  font-family: var(--font-game);
  font-size: 1.1rem;
  color: var(--primary);
  text-shadow: 0 0 8px var(--primary-glow);
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s ease;
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.1s linear;
}

/* Portal Redondo para Emojis */
.portal-screen {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(10, 5, 25, 0.9) 0%, rgba(2, 0, 10, 0.95) 100%);
  border: 2px solid var(--primary);
  box-shadow: 0 0 25px var(--primary-glow), inset 0 0 20px rgba(0, 242, 254, 0.1);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 10px 0;
  transition: border-color 0.5s ease, box-shadow 0.5s ease;
}

#items-display {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  width: 85%;
  height: 85%;
  transition: transform 0.8s ease, opacity 0.8s ease;
}

/* Emojis flutuando/animando */
.floating-item {
  font-size: 2.8rem;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
  animation: float-item 3s ease-in-out infinite alternate;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease;
}

@keyframes float-item {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  100% {
    transform: translateY(-8px) rotate(5deg);
  }
}

/* Buraco negro overlay animado */
#blackhole-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 30%, rgba(115, 3, 192, 0.8) 70%, #02000c 90%);
  opacity: 0;
  transform: scale(0) rotate(0deg);
  transition: transform 0.8s cubic-bezier(0.1, 0.8, 0.3, 1), opacity 0.8s ease;
  z-index: 5;
}

#blackhole-overlay.active {
  opacity: 1;
  transform: scale(1.2) rotate(720deg);
}

/* Caixa da Pergunta */
.question-box {
  display: none;
  width: 100%;
  font-family: var(--font-game);
  font-size: 1.4rem;
  color: var(--white);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
  animation: fade-in 0.5s ease forwards;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Histórico de Rodadas */
.history-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  min-height: 35px;
  width: 100%;
}

.history-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 0.9rem;
  color: #a5a1c0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-item.correct {
  border-color: rgba(57, 255, 20, 0.3);
  color: var(--success);
}

.history-item.incorrect {
  border-color: rgba(254, 0, 165, 0.3);
  color: var(--secondary);
}

/* Container de Opções de Resposta */
.options-container {
  display: flex;
  justify-content: center;
  gap: 15px;
  width: 100%;
  max-width: 500px;
  min-height: 80px;
}

.option-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--white);
  height: 70px;
  border-radius: 14px;
  font-family: var(--font-game);
  font-size: 2.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.option-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
  transform: translateY(-2px);
}

.option-btn:active {
  transform: translateY(1px);
}

/* Opções de texto nas dificuldades maiores */
.option-btn.text-option {
  font-size: 1.1rem;
  font-family: var(--font-interface);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Rodapé do jogo */
.game-footer {
  width: 100%;
  padding: 15px 30px;
  text-align: center;
  font-size: 0.85rem;
  color: #a5a1c0;
  background: rgba(5, 2, 12, 0.6);
  border-top: 1px solid var(--glass-border);
  z-index: 15;
}

.instruction-hint {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.mouse-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-game);
  font-size: 0.75rem;
  color: var(--primary);
}

/* TELA DE FIM DE JOGO */
#gameover-screen h2 {
  font-family: var(--font-game);
  font-size: 3rem;
  font-weight: 900;
  color: var(--secondary);
  text-shadow: 0 0 20px var(--secondary-glow);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 3px;
}

.score-summary {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 30px;
  border-radius: 20px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin-bottom: 40px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 1.1rem;
}

.summary-item .val {
  font-family: var(--font-game);
  font-weight: 700;
  color: var(--primary);
}

/* Overlay de Pausa */
#pause-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 2, 12, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 20;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

#pause-overlay.active {
  display: flex;
}

#pause-overlay h3 {
  font-family: var(--font-game);
  font-size: 2.5rem;
  color: var(--primary);
  text-shadow: 0 0 15px var(--primary-glow);
  text-transform: uppercase;
}

/* Partículas e Efeitos de Explosão */
.particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 100;
  animation: particle-burst 0.6s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes particle-burst {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx), var(--dy)) scale(0);
    opacity: 0;
  }
}
