/* =========================================================
   MISSÃO GUARDIÕES DO CONHECIMENTO — style.css
   Tema visual moderno para plataforma educacional.
   Apenas CSS3 puro (sem frameworks).
   ========================================================= */

/* ---------- Variáveis de tema ---------- */
:root {
  --azul: #3b6ef5;
  --azul-escuro: #2748b8;
  --verde: #2bb673;
  --verde-claro: #6fd3a0;
  --roxo: #7b5bf0;
  --laranja: #ff9f43;
  --amarelo: #ffd25e;
  --rosa: #ff6b9d;

  --texto: #1f2740;
  --texto-suave: #5b6480;
  --fundo: #f3f6fc;
  --branco: #ffffff;
  --borda: #e4e9f4;

  --sombra-sm: 0 4px 14px rgba(40, 60, 120, .08);
  --sombra-md: 0 14px 40px rgba(40, 60, 120, .14);
  --sombra-lg: 0 24px 60px rgba(40, 60, 120, .20);

  --raio: 18px;
  --raio-lg: 28px;
  --transicao: .35s cubic-bezier(.22, 1, .36, 1);

  --grad-azul: linear-gradient(135deg, #4f7ffb 0%, #6a5cf2 100%);
  --grad-verde: linear-gradient(135deg, #2bb673 0%, #6fd3a0 100%);
}

/* ---------- Reset básico ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  color: var(--texto);
  background:
    radial-gradient(1200px 600px at 80% -10%, #e7eeff 0%, transparent 60%),
    radial-gradient(1000px 500px at -10% 110%, #e6fbf1 0%, transparent 60%),
    var(--fundo);
  min-height: 100vh;
  line-height: 1.55;
  overflow-x: hidden;
}

h1, h2, h3, .hero-title, .mission-title, .final-title { font-family: 'Baloo 2', cursive; }

/* ---------- Sistema de telas ---------- */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; animation: screenIn .5s ease; }
.screen--centered.active,
.screen--hero.active { display: flex; }

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

.screen--centered {
  align-items: center;
  justify-content: center;
  padding: 40px 20px 90px;
}

/* ---------- Botões ---------- */
.btn {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  border: none;
  border-radius: 999px;
  padding: 14px 28px;
  cursor: pointer;
  transition: var(--transicao);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}
.btn:focus-visible { outline: 3px solid rgba(75, 110, 245, .5); outline-offset: 2px; }

.btn--primary {
  background: var(--grad-azul);
  color: #fff;
  box-shadow: 0 10px 24px rgba(75, 110, 245, .35);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(75, 110, 245, .45); }
.btn--primary:active { transform: translateY(0); }
.btn--primary:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn--lg { font-size: 1.15rem; padding: 18px 38px; }
.btn--small { padding: 9px 18px; font-size: .9rem; }

.btn--ghost {
  background: transparent;
  color: var(--azul);
  border: 2px solid var(--borda);
}
.btn--ghost:hover { background: #eef3ff; border-color: #c9d6f7; }

.btn--danger { background: #fff0f1; color: #d64550; box-shadow: none; }
.btn--danger:hover { background: #ffe0e2; }

.btn-arrow { transition: transform .3s; }
.btn--primary:hover .btn-arrow { transform: translateX(4px); }

/* =========================================================
   TELA 1 — BOAS-VINDAS
   ========================================================= */
.screen--hero {
  position: relative;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  overflow: hidden;
}
.hero-bg { position: absolute; inset: 0; z-index: 0; }
.hero-school { position: absolute; bottom: 0; left: 0; width: 100%; height: 60%; opacity: .9; }
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(243,246,252,.2) 0%, rgba(243,246,252,.85) 70%, var(--fundo) 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 720px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .8);
  padding: 50px 44px;
  border-radius: var(--raio-lg);
  box-shadow: var(--sombra-lg);
  animation: floatUp .7s ease;
}
@keyframes floatUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }

.badge {
  display: inline-block;
  background: #eaf0ff;
  color: var(--azul-escuro);
  font-weight: 800;
  font-size: .8rem;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 7px 16px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.hero-title { font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.05; color: var(--texto); }
.hero-title span {
  background: var(--grad-azul);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-text { font-size: clamp(1.05rem, 2.4vw, 1.3rem); color: var(--texto-suave); margin: 18px auto 32px; max-width: 520px; }

/* =========================================================
   Cartões genéricos
   ========================================================= */
.card {
  background: var(--branco);
  border-radius: var(--raio-lg);
  box-shadow: var(--sombra-md);
  padding: 44px 40px;
  text-align: center;
  width: 100%;
  border: 1px solid var(--borda);
}
.card--narrow { max-width: 460px; }
.card--wide { max-width: 920px; }
.card--final { max-width: 760px; }
.card h2 { font-size: 1.8rem; margin-bottom: 8px; }
.card-icon {
  width: 70px; height: 70px; margin: 0 auto 16px;
  display: grid; place-items: center;
  font-size: 2rem;
  background: #eef3ff;
  border-radius: 20px;
}
.muted { color: var(--texto-suave); }
.muted.small { font-size: .9rem; }

.fade-in { animation: floatUp .5s ease; }

/* Campos de texto */
.field {
  width: 100%;
  font-family: 'Nunito', sans-serif;
  font-size: 1.05rem;
  padding: 15px 18px;
  border: 2px solid var(--borda);
  border-radius: 14px;
  margin: 22px 0;
  transition: border-color .25s, box-shadow .25s;
  background: #fafbff;
}
.field:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 4px rgba(75, 110, 245, .15); background: #fff; }

.error-msg { color: #d64550; font-weight: 700; font-size: .9rem; margin-top: -8px; margin-bottom: 12px; }

/* =========================================================
   TELA 3 — AVATARES
   ========================================================= */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin: 28px 0;
}
.avatar-card {
  background: #fafbff;
  border: 2px solid var(--borda);
  border-radius: 22px;
  padding: 18px 14px;
  cursor: pointer;
  transition: var(--transicao);
  text-align: center;
}
.avatar-card:hover { transform: translateY(-6px); box-shadow: var(--sombra-md); border-color: #c9d6f7; }
.avatar-card.selected {
  border-color: var(--azul);
  background: #eef3ff;
  box-shadow: 0 12px 30px rgba(75, 110, 245, .25);
}
.avatar-card.selected::after {
  content: "✓"; display: grid; place-items: center;
  width: 26px; height: 26px; margin: 10px auto 0;
  background: var(--azul); color: #fff; border-radius: 50%; font-weight: 800; font-size: .9rem;
}
.avatar-figure { width: 96px; height: 96px; margin: 0 auto 10px; border-radius: 50%; overflow: hidden; box-shadow: var(--sombra-sm); }
.avatar-figure svg { width: 100%; height: 100%; display: block; }
.avatar-name { font-family: 'Baloo 2'; font-size: 1.15rem; font-weight: 700; }
.avatar-role { display: inline-block; font-size: .78rem; font-weight: 800; color: var(--azul-escuro); background: #e7eeff; padding: 3px 10px; border-radius: 999px; margin: 4px 0 8px; }
.avatar-desc { font-size: .82rem; color: var(--texto-suave); line-height: 1.4; }

/* =========================================================
   TELA 4 — JOGO
   ========================================================= */
.screen--game.active { display: flex; flex-direction: column; min-height: 100vh; }
.game-header {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 20px clamp(20px, 5vw, 56px);
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--borda);
  position: sticky; top: 0; z-index: 5;
}
.player-chip { display: flex; align-items: center; gap: 12px; }
.player-avatar { width: 48px; height: 48px; border-radius: 50%; overflow: hidden; box-shadow: var(--sombra-sm); flex-shrink: 0; }
.player-avatar svg { width: 100%; height: 100%; }
.player-chip strong { display: block; font-family: 'Baloo 2'; font-size: 1.05rem; line-height: 1.1; }
.player-chip small { color: var(--texto-suave); font-weight: 700; }

.progress-wrap { flex: 1; min-width: 220px; }
.progress-info { display: flex; justify-content: space-between; font-weight: 800; font-size: .85rem; color: var(--texto-suave); margin-bottom: 6px; }
.progress-bar { height: 12px; background: #e7ecf7; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: 999px; background: var(--grad-verde); transition: width .6s cubic-bezier(.22,1,.36,1); }

.game-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 28px;
  padding: 28px clamp(20px, 5vw, 56px) 60px;
  max-width: 1280px; width: 100%; margin: 0 auto;
}

/* Painel da escola */
.school-panel {
  background: var(--branco);
  border: 1px solid var(--borda);
  border-radius: var(--raio-lg);
  padding: 22px;
  box-shadow: var(--sombra-sm);
  align-self: start;
  position: sticky; top: 110px;
}
.panel-title { font-size: 1.2rem; margin-bottom: 14px; }
.school-scene { width: 100%; border-radius: 16px; overflow: hidden; background: linear-gradient(#cfe9ff, #eaf7ff); }
.school-scene svg { width: 100%; height: auto; display: block; }

/* Itens da escola que "acendem" conforme as missões */
.zone { opacity: .18; transition: opacity .8s ease, transform .8s ease; transform: translateY(6px); }
.zone.active { opacity: 1; transform: translateY(0); }

.improvement-list { list-style: none; margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.improvement-list li {
  display: flex; align-items: center; gap: 10px;
  font-size: .88rem; font-weight: 700; color: var(--texto-suave);
  padding: 8px 12px; border-radius: 12px; background: #f6f8fd;
  opacity: .5; transition: var(--transicao);
}
.improvement-list li.done { opacity: 1; color: var(--texto); background: #eafaf2; }
.improvement-list li .chk { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #dfe6f3; color: #fff; font-size: .7rem; flex-shrink: 0; }
.improvement-list li.done .chk { background: var(--verde); }

/* Área da missão */
.mission-area { display: flex; flex-direction: column; gap: 18px; }
.mission-card {
  background: var(--branco);
  border: 1px solid var(--borda);
  border-radius: var(--raio-lg);
  padding: 34px;
  box-shadow: var(--sombra-md);
  animation: floatUp .45s ease;
}
.mission-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.mission-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mission-tag {
  background: var(--grad-azul); color: #fff;
  font-weight: 800; font-size: .78rem; letter-spacing: .5px; text-transform: uppercase;
  padding: 6px 14px; border-radius: 999px;
}
.mission-diff {
  font-weight: 800; font-size: .72rem; padding: 5px 12px; border-radius: 999px;
  background: #eef1f7; color: #5b6480;
}
.mission-diff[data-nivel="Fácil"] { background: #eafaf2; color: #2bb673; }
.mission-diff[data-nivel="Média"] { background: #fff3e6; color: #e08a2b; }
.mission-diff[data-nivel="Alta"]  { background: #ffeaec; color: #d64550; }
.mission-step { font-weight: 800; color: var(--texto-suave); font-size: .85rem; }
.mission-title { font-size: 1.7rem; margin-bottom: 12px; }
.mission-situation { font-size: 1.1rem; color: var(--texto-suave); margin-bottom: 26px; }

.options { display: flex; flex-direction: column; gap: 14px; }
.option {
  display: flex; align-items: center; gap: 16px;
  text-align: left; width: 100%;
  background: #fafbff;
  border: 2px solid var(--borda);
  border-radius: 16px;
  padding: 18px 20px;
  cursor: pointer;
  font-family: 'Nunito'; font-size: 1.02rem; font-weight: 600; color: var(--texto);
  transition: var(--transicao);
}
.option:hover { border-color: var(--azul); background: #eef3ff; transform: translateX(4px); }
.option .letter {
  width: 38px; height: 38px; flex-shrink: 0;
  display: grid; place-items: center;
  background: #e7eeff; color: var(--azul-escuro);
  font-family: 'Baloo 2'; font-weight: 800; font-size: 1.1rem;
  border-radius: 12px; transition: var(--transicao);
}
.option:hover .letter { background: var(--azul); color: #fff; }
.option:disabled { cursor: default; opacity: .6; }

/* Feedback neutro */
.feedback {
  background: var(--branco);
  border: 1px solid var(--borda);
  border-radius: var(--raio-lg);
  padding: 34px;
  text-align: center;
  box-shadow: var(--sombra-md);
  animation: floatUp .4s ease;
}
.feedback-icon { font-size: 2.6rem; animation: pop .5s ease; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
.feedback-msg { font-family: 'Baloo 2'; font-size: 1.5rem; margin: 8px 0 6px; color: var(--verde); }
.feedback-transform { color: var(--texto-suave); margin-bottom: 16px; font-weight: 600; }
.feedback-next { color: #9aa3bd; font-weight: 700; font-size: .9rem; animation: pulseNext 1.2s ease-in-out infinite; }
@keyframes pulseNext { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

/* =========================================================
   TELA FINAL
   ========================================================= */
.card--final { padding-top: 60px; }
.medal { position: relative; width: 110px; margin: 0 auto 10px; }
.medal-circle {
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe79a, #ffb43d);
  display: grid; place-items: center; font-size: 3rem;
  box-shadow: 0 14px 30px rgba(255, 160, 40, .45);
  animation: medalPulse 1.6s ease-in-out infinite;
}
@keyframes medalPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.final-title { font-size: 2.2rem; margin: 18px 0 8px; }
.final-title span { color: var(--azul); }
.final-text { color: var(--texto-suave); font-size: 1.1rem; max-width: 480px; margin: 0 auto 24px; }
.school-scene--final { max-width: 480px; margin: 0 auto 26px; border-radius: 18px; }

/* Certificado */
.certificate { margin: 10px auto 26px; max-width: 620px; }
.cert-border {
  border: 3px double #c8a24a;
  border-radius: 14px;
  padding: 30px 28px;
  background: linear-gradient(180deg, #fffdf6, #fff8e8);
  box-shadow: var(--sombra-sm);
  position: relative;
}
.cert-kicker { letter-spacing: 3px; text-transform: uppercase; font-size: .75rem; font-weight: 800; color: #b8902f; }
.cert-title { font-size: 1.45rem; color: #8a6a1f; margin: 6px 0 16px; }
.cert-line { color: var(--texto-suave); font-size: .95rem; }
.cert-name { font-family: 'Baloo 2'; font-size: 1.9rem; color: var(--texto); margin: 6px 0; border-bottom: 2px dotted #d6bd7a; display: inline-block; padding: 0 20px 4px; }
.cert-body { color: var(--texto-suave); font-size: .95rem; margin: 14px auto 20px; max-width: 460px; }
.cert-foot { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; font-weight: 700; color: #8a6a1f; flex-wrap: wrap; gap: 8px; }
.cert-seal { color: #b8902f; }

.final-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* Confetes */
#confetti-canvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 999; display: none;
}
#confetti-canvas.active { display: block; }

/* =========================================================
   RODAPÉ + Área do Professor
   ========================================================= */
.site-footer {
  position: relative; z-index: 2;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px clamp(20px, 5vw, 56px);
  font-size: .85rem; color: var(--texto-suave);
  border-top: 1px solid var(--borda);
  background: rgba(255, 255, 255, .6);
  flex-wrap: wrap; gap: 10px;
}
.footer-secret {
  background: none; border: none; cursor: pointer;
  font-family: 'Nunito'; font-size: .85rem; font-weight: 700;
  color: #9aa3bd; opacity: .55; transition: opacity .3s, color .3s;
}
.footer-secret:hover { opacity: 1; color: var(--azul); }

/* Modal */
/* Escondido por padrão; só aparece quando recebe a classe .open.
   (Não usamos o atributo [hidden] aqui porque o display: flex o anularia.) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(25, 35, 70, .55);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  padding: 20px; animation: floatUp .3s ease;
}
.modal-overlay.open { display: flex; }
.prof-access { margin-top: 18px; opacity: .8; }
.modal {
  background: var(--branco);
  border-radius: var(--raio-lg);
  padding: 40px;
  width: 100%; max-width: 880px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--sombra-lg);
  position: relative;
  text-align: center;
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 38px; height: 38px; border-radius: 50%;
  border: none; background: #f0f3fa; color: var(--texto-suave);
  font-size: 1rem; cursor: pointer; transition: var(--transicao);
}
.modal-close:hover { background: #ffe0e2; color: #d64550; }

#prof-login { max-width: 380px; margin: 0 auto; }

.prof-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; text-align: left; margin-bottom: 22px; }
.prof-tools { display: flex; gap: 10px; flex-wrap: wrap; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat-card { background: #f6f8fd; border: 1px solid var(--borda); border-radius: 16px; padding: 18px; text-align: left; }
.stat-card .num { font-family: 'Baloo 2'; font-size: 2rem; color: var(--azul); line-height: 1; }
.stat-card .lbl { font-size: .82rem; color: var(--texto-suave); font-weight: 700; margin-top: 4px; }

.section-label { text-align: left; font-size: 1.1rem; margin-bottom: 12px; }

.report-filters { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.report-filters label { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 200px; text-align: left; }
.report-filters label span { font-size: .78rem; font-weight: 800; color: var(--texto-suave); }
.report-filters select {
  font-family: 'Nunito', sans-serif; font-size: .95rem; font-weight: 600;
  padding: 11px 14px; border: 2px solid var(--borda); border-radius: 12px;
  background: #fafbff; color: var(--texto); cursor: pointer; transition: border-color .25s;
}
.report-filters select:focus { outline: none; border-color: var(--azul); background: #fff; }

.filtro-resumo {
  text-align: left; background: #f6f8fd; border: 1px solid var(--borda);
  border-radius: 16px; padding: 18px 20px; margin-bottom: 18px;
}
.filtro-resumo h4 { font-size: 1rem; margin-bottom: 14px; color: var(--texto); }
.filtro-resumo .resumo-total { font-weight: 700; color: var(--texto-suave); }
.resumo-item { margin-bottom: 12px; }
.resumo-item:last-child { margin-bottom: 0; }
.resumo-top { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; margin-bottom: 6px; }
.resumo-top strong { color: var(--azul-escuro); }
.resumo-num { font-weight: 800; color: var(--texto-suave); white-space: nowrap; }
.resumo-bar { height: 10px; background: #e7ecf7; border-radius: 999px; overflow: hidden; }
.resumo-fill { height: 100%; border-radius: 999px; background: var(--azul); transition: width .5s ease; min-width: 2px; }
.resumo-fill.rec { background: var(--grad-verde); }
.table-scroll { overflow-x: auto; border: 1px solid var(--borda); border-radius: 16px; }
.report-table { width: 100%; border-collapse: collapse; font-size: .88rem; text-align: left; min-width: 720px; }
.report-table th { background: #f2f5fc; padding: 12px 14px; font-weight: 800; color: var(--texto-suave); position: sticky; top: 0; }
.report-table td { padding: 11px 14px; border-top: 1px solid var(--borda); }
.report-table tr:hover td { background: #fafbff; }
.tag-rec { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 800; font-size: .78rem; }
.tag-rec.yes { background: #eafaf2; color: var(--verde); }
.tag-rec.no { background: #fff3e6; color: var(--laranja); }

/* =========================================================
   RESPONSIVIDADE
   ========================================================= */
@media (max-width: 900px) {
  .game-layout { grid-template-columns: 1fr; }
  .school-panel { position: static; order: 2; }
  .mission-area { order: 1; }
  .avatar-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .card { padding: 32px 22px; }
  .mission-card, .feedback { padding: 24px 20px; }
  .hero-content { padding: 36px 24px; }
  .avatar-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .mission-title { font-size: 1.4rem; }
  .modal { padding: 28px 20px; }
  .prof-header { flex-direction: column; align-items: flex-start; }
}

/* Impressão do certificado (alternativa ao PDF) */
@media print {
  body * { visibility: hidden; }
  #certificate, #certificate * { visibility: visible; }
  #certificate { position: absolute; inset: 0; margin: auto; }
}
