.overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.overlay.show {
  display: flex;
}

.overlay-content {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  max-width: 90%;
  max-height: 90%;
  overflow-y: auto;
  position: relative;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  cursor: pointer;
}



/* ===== Reset e Estilos Globais ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  background: #f5f5f5;
  color: #333;
}

@media screen and (max-width: 768px) {
  aside {
    position: fixed;
    left: -100%;  /* fora da tela */
    top: 0;
    width: 250px;
    height: 100%;
    background: #fff;
    transition: left 0.3s;
    z-index: 1000;
  }
  aside.show {
    left: 0;
  }
}

/* ===== Header ===== */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background: #fff;
  border-bottom: 2px solid #4CAF50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
}

header h1 {
  font-size: 1.5em;
  color: #4CAF50;
}

header .login {
  font-size: 0.9em;
  cursor: pointer;
  padding: 6px 12px;
  border: 1px solid #4CAF50;
  border-radius: 5px;
  background: #fff;
  color: #4CAF50;
  transition: 0.3s;
}

header .login:hover {
  background: #4CAF50;
  color: #fff;
}

/* ===== Sidebar ===== */
aside {
  position: fixed;
  top: 60px;
  left: 0;
  width: 220px;
  height: calc(100% - 60px);
  background: #388E3C;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 0;
}

aside nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  text-decoration: none;
  color: white;
  font-size: 1em;
  transition: background 0.3s;
}

aside nav a:hover {
  background: #2e7d32;
}

.mascote {
  text-align: center;
  padding: 20px;
  font-size: 2em;
}

/* ===== Main Content ===== */
main {
  margin-left: 220px;
  margin-top: 60px;
  padding: 20px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-5px);
}

.card h3 {
  margin-bottom: 10px;
  color: #4CAF50;
}

/* ===== Mascote Dimitri ===== */
#dimitri {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 120px;
  height: 180px;
  z-index: 1000;
}

#dimitri .head {
  width: 80px;
  height: 80px;
  background: #ffcc99;
  border-radius: 50%;
  position: relative;
  margin: 0 auto;
  border: 2px solid #333;
}

.ushanka {
  width: 100%;
  height: 30px;
  background: #800000;
  position: absolute;
  top: -10px;
  border-radius: 50% 50% 0 0;
}

.ushanka .ear {
  width: 20px;
  height: 20px;
  background: #800000;
  position: absolute;
  top: 10px;
  border-radius: 50%;
}

.ushanka .ear.left { left: -10px; }
.ushanka .ear.right { right: -10px; }

#dimitri .eye {
  width: 15px;
  height: 15px;
  background: #000;
  border-radius: 50%;
  position: absolute;
  top: 25px;
  animation: blink 4s infinite;
}

#dimitri .eye.left { left: 18px; }
#dimitri .eye.right { right: 18px; }

#dimitri .eyebrow {
  width: 18px;
  height: 3px;
  background: #333;
  position: absolute;
  top: 18px;
}

#dimitri .eyebrow.left { left: 15px; transform: rotate(-10deg); }
#dimitri .eyebrow.right { right: 15px; transform: rotate(10deg); }

#dimitri .mouth {
  width: 40px;
  height: 10px;
  border-bottom: 3px solid #000;
  border-radius: 0 0 20px 20px;
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  transition: all 0.3s;
}

#dimitri .body {
  width: 70px;
  height: 80px;
  background: #0055aa;
  position: relative;
  margin: 0 auto;
  top: 10px;
  border-radius: 10px;
}

#dimitri .arm {
  width: 15px;
  height: 50px;
  background: #0055aa;
  position: absolute;
  top: 10px;
  border-radius: 10px;
  transform-origin: top center;
  transition: transform 0.3s;
}

#dimitri .arm.left { left: -15px; }
#dimitri .arm.right { right: -15px; }

/* ===== Animações Mascote ===== */
@keyframes blink {
  0%, 90%, 100% { height: 15px; }
  95% { height: 2px; }
}

.acenando .arm.left { transform: rotate(-30deg); }
.acenando .arm.right { transform: rotate(30deg); }
.acenando .body { animation: pulse 0.3s infinite alternate; }

.triste .mouth {
  border-bottom: none;
  border-top:3px solid #000;
  border-radius: 20px 20px 0 0;
}

@keyframes pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); }
}

/* Neon no chapéu e corpo */
.neon .body { animation: neonPulse 0.5s infinite alternate; }
.neon .ushanka { animation: neonPulse 0.5s infinite alternate; }

@keyframes neonPulse {
  0% { background-color: #0055aa; box-shadow: none; }
  50% { background-color: #0f0; box-shadow: 0 0 10px #0f0, 0 0 20px #0f0; }
  100% { background-color: #0055aa; box-shadow: none; }
}

/* ===== Cards de lição bloqueados ===== */
.lesson-card.locked {
  pointer-events: none;
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Overlay ===== */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  z-index: 3000;
  overflow-y: auto;
}

.overlay-content {
  background: #fff;
  margin: 50px auto;
  padding: 20px;
  border-radius: 10px;
  width: 90%;
  max-width: 900px;
  position: relative;
}

.overlay .close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  color: #333;
  cursor: pointer;
  transition: color 0.3s;
}

.overlay .close-btn:hover {
  color: #000;
}

/* ===== Exercícios ===== */
#backBtn {
  padding: 5px 12px;
  font-size: 0.95em;
  cursor: pointer;
  background-color: #f0f0f0;
  border: 2px solid #333;
  border-radius: 6px;
  transition: all 0.3s;
}

#backBtn:hover {
  background-color: #ddd;
  transform: scale(1.05);
}

.correct { background-color: #c8e6c9; }
.wrong { background-color: #ffcdd2; }

.container {
  display: flex;
  justify-content: space-around;
  margin-top: 15px;
}

.column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.word, .placeholder {
  padding: 5px;
  border: 1px solid #999;
  border-radius: 4px;
  cursor: pointer;
  min-width: 120px;
  text-align: center;
}

#progressBarContainer {
  height: 15px;
  background: #eee;
  border-radius: 6px;
  margin: 10px 0;
}

#progressBar {
  height: 100%;
  background: #4CAF50;
  width: 0%;
  border-radius: 6px;
}

#progressText {
  font-size: 0.9em;
  margin-bottom: 5px;
}

#backButtonContainer {
  text-align: center;
  margin-top: 15px;
}

/* ===== Menu topo em 2 colunas para celular + rodapé ===== */
@media (max-width: 768px) {
  aside {
    position: static;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    background: #388E3C;
  }

  aside nav {
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    overflow-y: auto;
    padding: 10px;
  }

  aside nav a {
    margin-bottom: 10px;
    text-decoration: none;
    display: block;
    font-size: 1.2em;
  }

  .mascote {
    display: none;
  }

  main {
    margin-left: 0;
    margin-top: 10px;
    padding: 15px;
  }

  aside .footer-mobile {
    display: block;
    text-align: center;
    color: #fff;
    padding: 10px;
    font-size: 0.85em;
    border-top: 1px solid rgba(255,255,255,0.3);
    margin-top: 10px;
  }
}

@media (max-width: 768px) {
  #startButtonContainer {
    text-align: center;
    margin-top: 30px;
    z-index: 10;
  }

  #startBtn {
    display: inline-block;
    padding: 12px 20px;
    font-size: 1.1em;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
  }

  #startBtn:hover {
    background-color: #45A049;
  }
}

/* ===== Esconder Dimitri no mobile ===== */
@media screen and (max-width: 768px) {
  #dimitri {
    display: none !important;
  }
}

.overlay-content .word.selected {
  background-color: #4CAF50 !important;
  color: white !important;
}

/* ===== Itens selecionáveis maiores para fácil leitura ===== */
#cruzadoContainer .word,
#cruzadoContainer .placeholder {
  font-size: 1.2em;
  padding: 10px 15px;
  min-width: 150px;
  border-width: 2px;
}

@media (max-width: 768px) {
  #cruzadoContainer .word,
  #cruzadoContainer .placeholder {
    font-size: 1.4em;
    padding: 12px 18px;
    min-width: 140px;
  }
}

/* ===== Pré-visualização em 2x2 ===== */
.preview {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2 colunas */
  grid-template-rows: repeat(2, 1fr);    /* 2 linhas */
  gap: 15px;
  justify-items: center;
  align-items: center;
  margin: 20px 0;
}

.preview .square,
.preview .numSquare {
  width: 120px;
  height: 120px;
  font-size: 1.6em;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: transform 0.3s, background 0.3s;
}

.preview .square span {
  color: white;
  font-size: 1.2em;
  text-shadow: 1px 1px 2px #000;
}

@media (max-width: 768px) {
  .preview {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
  }

  .preview .square,
  .preview .numSquare {
    width: 90px;
    height: 90px;
    font-size: 1.3em;
  }

  .preview .square span {
    font-size: 1.1em;
  }
}