/* =============================================
   BIBLIOTECA.CSS — Tela Mapa / Biblioteca
   ============================================= */

/* ---- Tela base ---- */
.tela-mapa {
  background-image: url('../assets/img/telas/tela-mapa/fundo.webp');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-attachment: local;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---- Botões topo (absolutos) ---- */
.mapa-btn-topo {
  position: absolute;
  top: 16px;
  width: clamp(52px, 13vw, 68px);
  height: clamp(52px, 13vw, 68px);
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  z-index: 10;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
}

.mapa-btn-topo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.mapa-btn-topo:active { transform: scale(0.88); }

.mapa-btn-retornar { left: 12px; }
.mapa-btn-config   { right: 12px; }

/* ---- Banner ---- */
.mapa-banner-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 80px 24px 10px;
  flex-shrink: 0;
}

.mapa-banner-img {
  width: 76%;
  max-width: 320px;
  height: auto;
  object-fit: contain;
  display: block;
}

/* ---- Abas Velho / Novo Testamento ---- */
.mapa-tabs {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
  flex-shrink: 0;
}

.mapa-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  opacity: 0.45;
  filter: grayscale(50%) brightness(0.85);
  transition: opacity 0.2s ease, filter 0.2s ease, transform 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  border-radius: 12px;
}

.mapa-tab img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.mapa-tab.ativo {
  opacity: 1;
  filter: none;
}

.mapa-tab:active { transform: scale(0.94); }

.mapa-tab-fallback {
  display: block;
  font-weight: 900;
  font-size: 0.9rem;
  color: #fff;
  text-align: center;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
}

/* ---- Conteúdo (painéis) ---- */
.mapa-conteudo {
  padding: 0 16px;
  flex: 1;
}

.mapa-painel { display: none; }
.mapa-painel.ativo { display: block; }

/* ---- Grade de cards ---- */
.mapa-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding-bottom: 16px;
}

/* ---- Card de história — botão invisível, só a imagem ---- */
.mapa-card {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  cursor: pointer;
  line-height: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
}

.mapa-card:active { transform: scale(0.94); }

.mapa-card-img {
  width: 100%;
  height: auto;
  display: block;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

/* Fallback — só aparece quando a imagem quebra */
.mapa-card-fallback {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 120px;
  background: linear-gradient(160deg, #1a3a6a, #0f2340);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  padding: 12px;
  line-height: 1.4;
}

.mapa-card-fallback span:first-child { font-size: 2rem; opacity: 0.4; }

/* Badge de status — absoluto sobre a imagem */
.mapa-card-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 900;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.mapa-card-badge--concluido { background: #39B87F; color: #fff; }
.mapa-card-badge--selo      { background: #F6C65B; color: #4a2a0a; }
.mapa-card-badge--andamento { background: rgba(0,0,0,0.55); backdrop-filter: blur(4px); }

/* ---- Área do jogador (bottom) ---- */
.mapa-jogador-area {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px 12px;
  margin: 8px 0 0;
  background: rgba(10, 24, 40, 0.55);
  border-top: 1px solid rgba(246, 198, 91, 0.22);
  flex-shrink: 0;
}

.mapa-jogador-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mapa-avatar-circulo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2.5px solid #f0b331;
  overflow: hidden;
  background: #1a3a6a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mapa-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mapa-avatar-fallback {
  font-size: 1.6rem;
  line-height: 1;
  opacity: 0.6;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.mapa-jogador-nome {
  font-size: 1rem;
  font-weight: 900;
  color: #fff8ea;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* ---- Botão Álbum ---- */
.mapa-btn-album {
  position: relative;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.mapa-btn-album:active { transform: scale(0.88); }

.mapa-album-img {
  height: 64px;
  width: auto;
  object-fit: contain;
  display: block;
}

.mapa-album-fallback {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 900;
  color: #f0b331;
  border: 2px solid #f0b331;
  border-radius: 12px;
  padding: 10px 14px;
}

.mapa-album-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #f0b331;
  color: #4a2a0a;
  font-size: 0.68rem;
  font-weight: 900;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

/* ---- Landscape: manter scroll vertical ---- */
@media (orientation: landscape) and (max-height: 520px) {
  .tela-mapa { min-height: 100svh; overflow-y: auto; }
  .mapa-banner-wrap { padding-top: 70px; padding-bottom: 6px; }
  .mapa-banner-img  { max-width: 240px; }
  .mapa-tabs        { padding-bottom: 8px; }
  .mapa-cards-grid  { gap: 8px; }
}
