/* ==========================================================================
   css/pais.css
   Tela interna de país - Enciclopédia Infantil IK Educa
   ========================================================================== */

/* ==========================================================================
   1. Neutralização da tela do país
   ========================================================================== */

.game-card-pais {
  width: 100% !important;
  max-width: none !important;
  min-height: 100vh;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.screen-pais {
  width: 100%;
  min-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: transparent !important;
}

/* ==========================================================================
   2. Estrutura principal
   ========================================================================== */

.tela-pais {
  width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 14px 20px;
  box-sizing: border-box;

  background-image:
    url('../img/fundos/fundo-continentes.webp'),
    linear-gradient(to bottom, #fbf7ec 0%, #ebe0be 100%);
  background-size: cover;
  background-position: center center;
  background-repeat: repeat-y;

  display: flex;
  flex-direction: column;
  align-items: center;
  color: #17356f;
}

/* ==========================================================================
   3. Cabeçalho
   ========================================================================== */

.pais-header {
  position: relative;
  width: min(100%, 760px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pais-top-btn {
  border: 1px solid rgba(163, 130, 72, 0.22);
  border-radius: 999px;
  background: rgba(255, 250, 236, 0.76);
  color: #17356f;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  min-height: 36px;
  padding: 7px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 5px 12px rgba(55, 35, 10, 0.06);
}

.pais-banner {
  display: block;
  width: min(68vw, 300px);
  max-width: 300px;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
  filter: drop-shadow(0 6px 10px rgba(48, 34, 12, 0.16));
}

.pais-voltar-btn {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  justify-self: start;
}

.pais-passaporte-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.pais-passaporte-btn img {
  width: 58px;
  height: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 5px 10px rgba(48, 34, 12, 0.16));
}

/* ==========================================================================
   4. Guia / tutor
   ========================================================================== */

.pais-guia-area {
  width: min(100%, 760px);
  margin: 8px auto 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.pais-tutor {
  width: clamp(78px, 18vw, 130px);
  height: auto;
  object-fit: contain;
  justify-self: center;
  filter: drop-shadow(0 8px 10px rgba(41, 28, 10, 0.16));
}

.pais-balao {
  position: relative;
  padding: 12px 14px;
  border-radius: 20px;
  background: rgba(255, 250, 236, 0.92);
  border: 1px solid rgba(163, 130, 72, 0.18);
  box-shadow: 0 8px 18px rgba(55, 35, 10, 0.08);
  color: #17356f;
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.35;
}

.pais-balao::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 18px;
  height: 18px;
  background: rgba(255, 250, 236, 0.92);
  border-left: 1px solid rgba(163, 130, 72, 0.18);
  border-bottom: 1px solid rgba(163, 130, 72, 0.18);
}

/* ==========================================================================
   4a. Bandeira do país
   ========================================================================== */

.pais-pilula {
  display: flex;
  justify-content: center;
  margin: 6px auto 2px;
  width: min(100%, 760px);
}

.pais-pilula__bandeira {
  width: 66px;
  height: auto;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
}

/* ==========================================================================
   5. Grid de tópicos
   ========================================================================== */

.pais-topicos {
  width: min(100%, 760px);
  margin-inline: auto;
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px 12px;
  justify-content: center;
  justify-items: center;
  align-items: center;
}

.botao-descoberta {
  width: 100%;
  max-width: 170px;
  aspect-ratio: 210 / 74;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  transition: transform 0.18s ease, filter 0.18s ease;
}

.botao-descoberta img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 5px 9px rgba(41, 28, 10, 0.13));
}

.botao-descoberta:hover,
.botao-descoberta:focus-visible {
  transform: scale(1.04);
  filter: brightness(1.04);
  outline: none;
}

.botao-descoberta:active {
  transform: scale(0.98);
}

/* ==========================================================================
   6. Rodapé
   ========================================================================== */

.pais-rodape {
  width: min(94vw, 320px);
  margin: 14px auto 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   7. Modal de tópico
   ========================================================================== */

.modal-topico-pais {
  position: fixed;
  inset: 0;
  background: rgba(23, 53, 111, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}

.modal-topico-pais.hidden {
  display: none;
}

.modal-topico-card {
  width: min(100%, 420px);
  border-radius: 18px;
  background: rgba(255, 250, 236, 0.95);
  border: 1px solid rgba(163, 130, 72, 0.2);
  box-shadow: 0 14px 22px rgba(29, 17, 5, 0.2);
  padding: 16px;
  text-align: center;
}

.modal-topico-titulo {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #14336f;
}

.modal-topico-texto {
  margin: 0;
  font-size: 0.82rem;
  color: #17356f;
  line-height: 1.38;
}

.modal-topico-fechar {
  margin-top: 12px;
  border: none;
  border-radius: 999px;
  background: #2f6fd6;
  color: #fff;
  font-weight: 900;
  font-family: inherit;
  padding: 8px 14px;
  cursor: pointer;
}

/* ==========================================================================
   8. Responsividade
   ========================================================================== */

@media (max-width: 620px) {
  .pais-header {
    width: 100%;
    min-height: 76px;
    padding: 0 52px;
    box-sizing: border-box;
  }

  .pais-banner {
    width: min(64vw, 220px);
    max-width: 220px;
  }

  .pais-voltar-btn {
    left: 4px;
    font-size: 0.62rem;
    min-height: 30px;
    padding: 5px 8px;
  }

  .pais-passaporte-btn {
    right: 4px;
  }

  .pais-passaporte-btn img {
    width: 46px;
  }

  .pais-guia-area {
    grid-template-columns: auto 1fr;
    gap: 8px;
  }

  .pais-tutor {
    width: 76px;
  }

  .pais-balao {
    font-size: 0.72rem;
    padding: 10px 12px;
    border-radius: 16px;
  }

  .pais-pilula__bandeira {
    width: 52px;
  }

  .pais-topicos {
    width: min(100%, 360px);
    margin: 8px auto 12px;
    grid-template-columns: repeat(2, minmax(135px, 1fr));
    gap: 9px 10px;
    justify-items: center;
  }

  .botao-descoberta {
    max-width: 165px;
    aspect-ratio: 210 / 74;
  }
}

@media (max-width: 420px) {
  .pais-header {
    position: relative;
    width: 100%;
    min-height: 112px;
    padding: 8px 10px 0;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "voltar passaporte"
      "banner banner";
    align-items: center;
    row-gap: 4px;
  }

  .pais-voltar-btn {
    position: static;
    transform: none;
    grid-area: voltar;
    justify-self: start;
    z-index: 2;
    min-height: 28px;
    padding: 5px 9px;
    font-size: 0.62rem;
  }

  .pais-passaporte-btn {
    position: static;
    transform: none;
    grid-area: passaporte;
    justify-self: end;
    z-index: 2;
  }

  .pais-passaporte-btn img {
    width: 44px;
  }

  .pais-banner {
    grid-area: banner;
    justify-self: center;
    width: min(82vw, 230px);
    max-width: 230px;
    margin: -2px auto 0;
  }
}

@media (orientation: landscape) and (max-width: 767px) {
  .tela-pais {
    padding: 10px 12px 12px;
  }

  .pais-header {
    width: min(100%, 620px);
    min-height: auto;
    padding: 0 48px;
  }

  .pais-banner {
    width: min(40vw, 220px);
    max-width: 220px;
  }

  .pais-voltar-btn {
    left: 0;
    font-size: 0.58rem;
    min-height: 28px;
    padding: 4px 7px;
  }

  .pais-passaporte-btn {
    right: 0;
  }

  .pais-passaporte-btn img {
    width: 42px;
  }

  .pais-guia-area {
    margin: 4px auto 8px;
  }

  .pais-tutor {
    width: 64px;
  }

  .pais-balao {
    font-size: 0.68rem;
    padding: 8px 10px;
  }

  .pais-pilula__bandeira {
    width: 46px;
  }

  .pais-topicos {
    width: min(100%, 620px);
    grid-template-columns: repeat(4, minmax(95px, 1fr));
    gap: 7px 8px;
  }

  .botao-descoberta {
    max-width: 135px;
  }
}

@media (orientation: landscape) and (min-width: 768px) {
  .tela-pais {
    padding: 22px 30px;
  }

  .pais-header {
    width: min(100%, 860px);
    padding: 0 72px;
  }

  .pais-banner {
    width: min(44vw, 430px);
    max-width: 430px;
  }

  .pais-passaporte-btn img {
    width: 62px;
  }

  .pais-guia-area {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 16px;
  }

  .pais-tutor {
    width: 108px;
    max-height: 118px;
  }

  .pais-balao {
    font-size: 0.95rem;
  }

  .pais-topicos {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 12px 14px;
  }

  .botao-descoberta {
    max-width: 180px;
  }
}

@media (max-width: 360px) {
  .pais-header {
    padding: 0 44px;
  }

  .pais-banner {
    width: min(62vw, 200px);
  }

  .pais-passaporte-btn img {
    width: 40px;
  }

  .pais-voltar-btn {
    font-size: 0.56rem;
    padding: 4px 7px;
  }
}

@media (max-width: 340px) {
  .pais-header {
    min-height: 104px;
    padding-inline: 8px;
  }

  .pais-passaporte-btn img {
    width: 38px;
  }

  .pais-banner {
    width: min(80vw, 205px);
    max-width: 205px;
  }

  .pais-topicos {
    grid-template-columns: 1fr;
  }

  .botao-descoberta {
    max-width: 220px;
  }
}