:root {
  --color-a: #ff477e;
  --color-e: #ff9100;
  --color-i: #00b4d8;
  --color-o: #70e000;
  --color-u: #9d4edd;
  --color-bg: #f0f7ff;
  --color-card-bg: #ffffff;
  --color-text: #2d3748;
  --font-kids: 'Fredoka', cursive, sans-serif;
  --radius-lg: 24px;
  --radius-md: 16px;
  --shadow-main: 0 10px 25px rgba(0, 0, 0, 0.08);
  --shadow-btn: 0 6px 0 rgba(0, 0, 0, 0.15);
}

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

body {
  font-family: var(--font-kids);
  background: linear-gradient(135deg, #e0f2fe 0%, #ede9fe 50%, #fef3c7 100%);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}

#app {
  width: 100%;
  max-width: 900px;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  min-height: 100vh;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-main);
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo h1 {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(45deg, #ff477e, #70e000, #00b4d8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.star-icon {
  font-size: 1.6rem;
  animation: spinSlow 8s linear infinite;
}

@keyframes spinSlow {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.15); }
  100% { transform: rotate(360deg) scale(1); }
}

.stats-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-size: 1.1rem;
  font-weight: 600;
}

.stat-val {
  color: #ff477e;
  font-size: 1.3rem;
}

.icon-btn {
  background: #f1f5f9;
  border: none;
  font-size: 1.4rem;
  padding: 0.5rem;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 3px 0 #cbd5e1;
  transition: all 0.15s ease;
}

.icon-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #cbd5e1;
}

/* Tabs */
.mode-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
}

.tab-btn {
  background: white;
  border: 3px solid #e2e8f0;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-kids);
  font-size: 1.05rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 0 #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.tab-btn:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
  color: #1e293b;
}

.tab-btn.active {
  background: #3b82f6;
  color: white;
  border-color: #1d4ed8;
  box-shadow: 0 4px 0 #1e40af;
  transform: translateY(-2px);
}

/* Main Container */
.game-container {
  flex: 1;
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  box-shadow: var(--shadow-main);
  min-height: 480px;
  display: flex;
  flex-direction: column;
}

.game-view {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  animation: fadeIn 0.3s ease;
}

.game-view.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.instruction-box {
  background: #f0fdf4;
  border: 2px dashed #86efac;
  border-radius: var(--radius-md);
  padding: 0.9rem 1.4rem;
  text-align: center;
  width: 100%;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.instruction-box h2 {
  font-size: 1.3rem;
  color: #166534;
  font-weight: 600;
}

.btn-voice-repeat {
  background: #dcfce7;
  color: #15803d;
  border: 2px solid #86efac;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-family: var(--font-kids);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: transform 0.15s ease;
}

.btn-voice-repeat:active {
  transform: scale(0.95);
}

/* Modo 1: Conhecer as Vogais */
.vowel-cards-grid {
  display: flex;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.vowel-tile {
  width: 85px;
  height: 95px;
  border-radius: var(--radius-md);
  font-size: 3.2rem;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
  position: relative;
}

.vowel-tile:hover {
  transform: translateY(-6px) scale(1.05);
}

.vowel-tile.active-vowel {
  transform: translateY(-8px) scale(1.1);
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.25), 0 0 20px rgba(255, 255, 255, 0.8);
}

.vowel-a { background: var(--color-a); }
.vowel-e { background: var(--color-e); }
.vowel-i { background: var(--color-i); }
.vowel-o { background: var(--color-o); }
.vowel-u { background: var(--color-u); }

.vowel-detail-card {
  width: 100%;
  max-width: 650px;
  background: #fdf4ff;
  border: 3px solid #f0abfc;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.vowel-big-display {
  font-size: 4.5rem;
  font-weight: 700;
  line-height: 1;
}

.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  width: 100%;
}

.example-item {
  background: white;
  border-radius: var(--radius-md);
  padding: 0.8rem;
  border: 2px solid #e9d5ff;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.example-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
}

.example-item .emoji {
  font-size: 2.8rem;
  margin-bottom: 0.2rem;
}

.example-item .word {
  font-size: 1.2rem;
  font-weight: 700;
  color: #4b5563;
}

.example-item .word span {
  color: #ff477e;
  font-size: 1.4rem;
}

/* Modo 2: Adivinhe o Desenho (Quiz) */
.quiz-card {
  width: 100%;
  max-width: 580px;
  background: #f8fafc;
  border: 3px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.8rem;
}

.quiz-visual-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.quiz-emoji {
  font-size: 6.5rem;
  line-height: 1;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,0.15));
}

.quiz-word {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.35rem;
  color: #334155;
}

.quiz-options {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.quiz-btn {
  width: 75px;
  height: 80px;
  border-radius: var(--radius-md);
  font-family: var(--font-kids);
  font-size: 2.8rem;
  font-weight: 700;
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.quiz-btn:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}

/* Modo 3: Puzzle / Complete a Palavra */
.puzzle-card {
  width: 100%;
  max-width: 600px;
  background: #fffbeb;
  border: 3px solid #fde68a;
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.8rem;
}

.puzzle-emoji {
  font-size: 6rem;
}

.puzzle-word-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 2.5rem;
  font-weight: 700;
  color: #1e293b;
}

.puzzle-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 65px;
  height: 70px;
  border: 3px dashed #d97706;
  border-radius: var(--radius-md);
  background: white;
  color: #d97706;
  font-size: 3rem;
  animation: pulseSlot 1.5s infinite;
}

@keyframes pulseSlot {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); border-color: #f59e0b; }
  100% { transform: scale(1); }
}

.puzzle-slot.filled {
  border-style: solid;
  border-color: #10b981;
  background: #d1fae5;
  color: #047857;
  animation: none;
}

.vowel-selection-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* Modo 4: Estourar Balões */
.bubble-game-arena {
  width: 100%;
  height: 420px;
  background: linear-gradient(180deg, #cffafe 0%, #e0f2fe 100%);
  border: 3px solid #7dd3fc;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.05);
}

.highlight-target {
  display: inline-block;
  background: #ff477e;
  color: white;
  padding: 0.2rem 0.8rem;
  border-radius: 12px;
  font-size: 1.6rem;
  font-weight: 700;
  transform: rotate(-3deg);
}

.balloon {
  position: absolute;
  width: 75px;
  height: 95px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 700;
  color: white;
  cursor: pointer;
  box-shadow: inset -5px -5px 12px rgba(0,0,0,0.18), 0 4px 8px rgba(0,0,0,0.15);
  animation: floatUp linear infinite;
  bottom: -110px;
  user-select: none;
}

.balloon::after {
  content: "";
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 14px;
  background: rgba(0, 0, 0, 0.2);
}

@keyframes floatUp {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-240px) rotate(4deg); }
  100% { transform: translateY(-560px) rotate(-4deg); }
}

.balloon.pop {
  animation: popAnim 0.25s forwards !important;
}

@keyframes popAnim {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.8; }
  100% { transform: scale(0); opacity: 0; }
}

/* Feedback Banner */
.feedback-banner {
  min-height: 48px;
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.feedback-success {
  color: #15803d;
  animation: bounce 0.5s ease;
}

.feedback-error {
  color: #dc2626;
  animation: shake 0.4s ease;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* Footer */
.footer {
  text-align: center;
  font-size: 1.05rem;
  color: #64748b;
  padding: 0.5rem;
}

/* Responsividade */
@media (max-width: 600px) {
  .logo h1 { font-size: 1.4rem; }
  .vowel-tile { width: 60px; height: 70px; font-size: 2.3rem; }
  .quiz-emoji { font-size: 4.8rem; }
  .quiz-btn { width: 60px; height: 65px; font-size: 2.2rem; }
  .tab-btn { font-size: 0.95rem; padding: 0.6rem; }
  .bubble-game-arena { height: 350px; }
}
