@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
  --bg-dark: #0d0d1a;
  --bg-card: #13132a;
  --bg-card2: #1a1a35;
  --accent: #f59e0b;
  --accent2: #06b6d4;
  --accent3: #a855f7;
  --green: #10b981;
  --red: #ef4444;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #2d2d5e;
  --shadow: 0 8px 32px rgba(0,0,0,0.5);
  --radius: 16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(168,85,247,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(6,182,212,0.10) 0%, transparent 60%),
    radial-gradient(ellipse 40% 60% at 50% 50%, rgba(245,158,11,0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

#app { position: relative; z-index: 1; }

/* ===== TELA INICIAL ===== */
#screen-home {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  text-align: center;
}

.home-logo {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2.4rem, 8vw, 4.5rem);
  line-height: 1;
  margin-bottom: 0.3rem;
}
.home-logo span.hl { color: var(--accent); }
.home-logo span.hl2 { color: var(--accent2); }

.home-tagline {
  color: var(--text-muted);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 2.5rem;
  letter-spacing: 0.05em;
}

.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  width: 100%;
  max-width: 700px;
  margin-bottom: 2rem;
}

.level-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 0.8rem;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.level-card:hover:not(.locked) {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(245,158,11,0.25);
}

.level-card.unlocked { border-color: rgba(168,85,247,0.5); }
.level-card.completed { border-color: var(--green); background: rgba(16,185,129,0.08); }
.level-card.locked { opacity: 0.4; cursor: not-allowed; filter: grayscale(0.6); }

.level-card .lc-emoji { font-size: 2rem; }
.level-card .lc-num {
  font-family: 'Fredoka One', cursive;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.level-card .lc-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
}

.lock-icon { position: absolute; top: 8px; right: 10px; font-size: 0.85rem; }
.star-icon { position: absolute; top: 6px; right: 8px; font-size: 1rem; color: var(--accent); }

.progress-bar-container {
  width: 100%;
  max-width: 700px;
  margin-bottom: 2rem;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.progress-bar-track {
  height: 12px;
  background: var(--bg-card2);
  border-radius: 100px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent3), var(--accent2));
  border-radius: 100px;
  transition: width 0.6s cubic-bezier(.4,0,.2,1);
}

/* ===== TELA DO NÍVEL ===== */
#screen-level {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1rem;
}

.level-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0.5rem 1.5rem;
  max-width: 780px;
  margin: 0 auto;
  width: 100%;
}

.btn-back {
  background: var(--bg-card);
  border: 2px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 0.5rem 1rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}
.btn-back:hover { border-color: var(--accent2); color: var(--accent2); }

.level-header-info { flex: 1; }
.level-header-info h1 {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  line-height: 1.2;
}
.level-header-info p { color: var(--text-muted); font-size: 0.85rem; font-weight: 600; }

.level-content {
  max-width: 780px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}

/* FASE TABS */
.fase-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background: var(--bg-card);
  border-radius: 14px;
  padding: 0.4rem;
  border: 1px solid var(--border);
}

.fase-tab {
  flex: 1;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.fase-tab.active {
  background: linear-gradient(135deg, var(--accent3), var(--accent2));
  color: white;
  box-shadow: 0 4px 16px rgba(168,85,247,0.4);
}

/* TEORIA */
.teoria-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  animation: fadeInUp 0.4s ease;
}

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

.btn-start-quiz {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--accent), #d97706);
  border: none;
  border-radius: 14px;
  color: white;
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.25s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 6px 24px rgba(245,158,11,0.35);
  margin-bottom: 1rem;
}
.btn-start-quiz:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(245,158,11,0.5); }

/* QUIZ */
.quiz-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  padding: 0.8rem 1rem;
  background: var(--bg-card);
  border-radius: 14px;
  border: 1px solid var(--border);
  gap: 1rem;
}
.hud-item { text-align: center; }
.hud-label { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.hud-value { font-family: 'Fredoka One', cursive; font-size: 1.4rem; line-height: 1.2; }
.hud-value.score-val { color: var(--accent); }
.hud-value.q-val { color: var(--accent2); }

.quiz-progress-track {
  height: 6px;
  background: var(--bg-card2);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent3), var(--accent));
  border-radius: 100px;
  transition: width 0.4s ease;
}

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  animation: fadeInUp 0.3s ease;
}

.question-num {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.8rem;
}

.question-text {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 1.2rem;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.option-btn {
  width: 100%;
  padding: 0.85rem 1.2rem;
  background: var(--bg-card2);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  line-height: 1.4;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--accent2);
  background: rgba(6,182,212,0.08);
  transform: translateX(4px);
}

.option-btn.correct {
  border-color: var(--green);
  background: rgba(16,185,129,0.15);
  color: #6ee7b7;
  animation: correctPulse 0.4s ease;
}

.option-btn.wrong {
  border-color: var(--red);
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
  animation: wrongShake 0.4s ease;
}

.option-btn.reveal-correct {
  border-color: var(--green);
  background: rgba(16,185,129,0.1);
  color: #6ee7b7;
  opacity: 0.75;
}

.option-btn:disabled { cursor: not-allowed; }

.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 900;
  flex-shrink: 0;
}

@keyframes correctPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

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

.feedback-msg {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.9rem;
  margin-top: 0.8rem;
  display: none;
}
.feedback-msg.correct { background: rgba(16,185,129,0.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.4); display: flex; align-items: center; gap: 0.5rem; }
.feedback-msg.wrong { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.4); display: flex; align-items: center; gap: 0.5rem; }

.btn-next {
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, var(--accent2), #0284c7);
  border: none;
  border-radius: 12px;
  color: white;
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  display: none;
  margin-top: 1rem;
  box-shadow: 0 4px 16px rgba(6,182,212,0.35);
}
.btn-next:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(6,182,212,0.5); }
.btn-next.visible { display: block; }

/* RESULTADO */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  animation: fadeInUp 0.5s ease;
}

.result-emoji { font-size: 4rem; margin-bottom: 0.8rem; display: block; }
.result-title { font-family: 'Fredoka One', cursive; font-size: 2rem; margin-bottom: 0.5rem; }
.result-score { font-size: 1.1rem; color: var(--text-muted); font-weight: 700; margin-bottom: 1.5rem; }
.result-score strong { color: var(--accent); font-size: 1.5rem; }

.result-stars { font-size: 2rem; margin-bottom: 1.5rem; letter-spacing: 0.3rem; }

.result-msg { color: var(--text-muted); font-weight: 600; margin-bottom: 1.5rem; line-height: 1.6; }

.result-btns { display: flex; flex-direction: column; gap: 0.8rem; }

.btn-retry {
  padding: 0.9rem;
  background: transparent;
  border: 2px solid var(--red);
  border-radius: 12px;
  color: var(--red);
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-retry:hover { background: rgba(239,68,68,0.15); }

.btn-next-level {
  padding: 0.9rem;
  background: linear-gradient(135deg, var(--green), #059669);
  border: none;
  border-radius: 12px;
  color: white;
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(16,185,129,0.4);
}
.btn-next-level:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16,185,129,0.5); }
.btn-home { padding: 0.9rem; background: transparent; border: 2px solid var(--border); border-radius: 12px; color: var(--text-muted); font-family: 'Fredoka One', cursive; font-size: 1.1rem; cursor: pointer; transition: all 0.2s; }
.btn-home:hover { border-color: var(--accent2); color: var(--accent2); }

/* TEORIA ESTILOS INTERNOS */
.teoria-section h2 { font-family: 'Fredoka One', cursive; font-size: 1.5rem; margin-bottom: 1rem; }
.teoria-desc { color: var(--text-muted); font-weight: 600; margin-bottom: 1.2rem; line-height: 1.6; }

.formula-box {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  background: var(--bg-card2);
  border-radius: 14px;
  padding: 1.2rem;
  margin-bottom: 1.2rem;
  border: 1px solid var(--border);
}
.formula { background: var(--accent3); color: white; padding: 0.5rem 1.2rem; border-radius: 8px; font-weight: 800; font-size: 0.95rem; }
.formula.resultado { background: linear-gradient(135deg, var(--accent2), var(--accent3)); font-size: 1rem; }
.plus { font-family: 'Fredoka One', cursive; font-size: 1.5rem; color: var(--accent); }

.exemplos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.8rem; margin-bottom: 1rem; }
.exemplo-card { background: var(--bg-card2); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; }
.ev { font-family: 'Fredoka One', cursive; font-size: 1.1rem; color: var(--accent2); }
.ep { font-weight: 700; color: var(--accent3); font-size: 0.9rem; }
.em { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; margin-top: 0.4rem; }

.dica-box { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); border-radius: 12px; padding: 0.9rem 1rem; font-size: 0.9rem; font-weight: 600; margin-top: 1rem; color: #fbbf24; }

.comparacao-grid { display: flex; flex-direction: column; gap: 1rem; }
.comp-grupo { background: var(--bg-card2); border-radius: 14px; padding: 1rem; border: 1px solid var(--border); }
.comp-titulo { font-family: 'Fredoka One', cursive; font-size: 1.1rem; margin-bottom: 0.8rem; color: var(--accent); }
.comp-item { padding: 0.7rem; border-radius: 10px; margin-bottom: 0.5rem; background: rgba(255,255,255,0.03); }
.comp-item p { font-size: 0.9rem; margin: 0.3rem 0; line-height: 1.5; }
.badge-tipo { display: inline-block; font-size: 0.7rem; font-weight: 900; letter-spacing: 0.08em; background: var(--accent2); color: var(--bg-dark); padding: 0.2rem 0.6rem; border-radius: 6px; text-transform: uppercase; margin-bottom: 0.4rem; }
.comp-item.idiomatico .badge-tipo { background: var(--accent3); color: white; }
.traducao { color: var(--green); font-weight: 700; font-size: 0.85rem; }

.lista-verbos { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.verbo-item { display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 0.8rem; background: var(--bg-card2); border-radius: 10px; }
.vb-frase { font-family: 'Fredoka One', cursive; font-size: 1rem; color: var(--accent2); min-width: 100px; }
.vb-seta { color: var(--text-muted); font-size: 1rem; }
.vb-sig { font-size: 0.9rem; font-weight: 700; }

.grammar-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
@media (max-width: 560px) { .grammar-grid { grid-template-columns: 1fr; } }
.grammar-card { border-radius: 14px; padding: 1.1rem; border: 1px solid var(--border); }
.grammar-card.will { background: rgba(245,158,11,0.07); border-color: rgba(245,158,11,0.3); }
.grammar-card.going { background: rgba(6,182,212,0.07); border-color: rgba(6,182,212,0.3); }
.grammar-titulo { font-family: 'Fredoka One', cursive; font-size: 1rem; margin-bottom: 0.5rem; }
.grammar-formula { font-family: monospace; font-size: 0.85rem; background: rgba(255,255,255,0.05); padding: 0.4rem 0.7rem; border-radius: 6px; margin-bottom: 0.7rem; }
.grammar-uso { font-size: 0.82rem; color: var(--text-muted); font-weight: 600; margin-bottom: 0.7rem; }
.grammar-uso ul { padding-left: 1.2rem; margin-top: 0.3rem; }
.grammar-uso li { margin-bottom: 0.2rem; }
.grammar-exemplos { display: flex; flex-direction: column; gap: 0.3rem; }
.ex { font-size: 0.82rem; font-style: italic; color: var(--text-muted); padding: 0.3rem 0.5rem; background: rgba(255,255,255,0.04); border-radius: 6px; }

.revisao-tabela { border-radius: 12px; overflow: hidden; border: 1px solid var(--border); margin-bottom: 1rem; }
.tabela-header { display: grid; grid-template-columns: 1.2fr 1fr 1fr; background: var(--accent3); padding: 0.6rem 0.8rem; font-size: 0.8rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.05em; gap: 0.5rem; }
.tabela-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr; padding: 0.6rem 0.8rem; gap: 0.5rem; border-top: 1px solid var(--border); align-items: center; }
.tabela-row:nth-child(even) { background: rgba(255,255,255,0.02); }
.tb-vb { font-family: 'Fredoka One', cursive; color: var(--accent2); font-size: 0.9rem; }
.tb-lit { font-size: 0.8rem; font-weight: 600; color: var(--accent); }
.tb-id { font-size: 0.8rem; font-weight: 600; color: var(--accent3); }

/* LOADING */
#loading {
  position: fixed;
  inset: 0;
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  z-index: 100;
  transition: opacity 0.5s;
}
#loading.hidden { opacity: 0; pointer-events: none; }
.loader-ring {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading p { font-family: 'Fredoka One', cursive; color: var(--text-muted); }

/* TOAST */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.8rem 1.5rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  z-index: 200;
  transition: transform 0.3s ease;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* TROPHY SCREEN */
.trophy-screen {
  text-align: center;
  padding: 3rem 1.5rem;
  animation: fadeInUp 0.6s ease;
}
.trophy-emoji { font-size: 5rem; display: block; margin-bottom: 1rem; animation: bounce 1s ease infinite; }
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-12px)} }
.trophy-screen h2 { font-family: 'Fredoka One', cursive; font-size: 2.5rem; margin-bottom: 0.5rem; }
.trophy-screen p { color: var(--text-muted); font-weight: 600; max-width: 400px; margin: 0 auto 2rem; line-height: 1.6; }

.hidden { display: none !important; }

/* Responsivo */
@media (max-width: 480px) {
  .levels-grid { grid-template-columns: repeat(2, 1fr); }
  .quiz-hud { flex-wrap: wrap; gap: 0.5rem; }
}
@media (min-width: 768px) {
  .levels-grid { grid-template-columns: repeat(5, 1fr); }
  .options-grid { display: grid; grid-template-columns: 1fr 1fr; }
}
