/* =========================
   RESET & FUNDAMENTOS
   ========================= */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

html {
  background:
  linear-gradient(rgba(15, 23, 42, 0.7), rgba(184, 225, 5, 0.7)), /* overlay */
  url('fundo_de_cerebros.jpg') center/cover no-repeat fixed;
  background-size: cover; 
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: rgba(15, 23, 42, 0.231);
  color: #e5e7eb;
}

.center {
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 3vw;
}

/* =========================
   CARTÃO BASE (containers)
   ========================= */
.card {
  width: min(960px, 94vw);
  background:
  linear-gradient(rgba(255, 255, 255, 0.8), rgba(184, 225, 5, 0.9)), /* overlay */
  url('fundo_de_cerebros.jpg') center/cover no-repeat fixed;
  background-size: cover;  
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  border-radius: 16px;
  padding: 3vw;
  display: grid;
  gap: clamp(16px, 2.5vw, 32px);
  align-items: center;
  grid-template-columns: 1fr; /* padrão (mobile) */
}


/* =========================
   FORM / AÇÕES (página login)
   ========================= */
.actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  align-items: stretch;
  order: 2;
}

.form {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 520px;
  margin-inline: auto;
  gap: 14px;
  order: 1;
}

.logo {
  height: min(10vw, 90px);      /* altura total da imagem renderizada */
  width: auto;
  display: block;
  --crop: 0%;        /* ajuste: quanto “entrar” do topo e base */
  clip-path: inset(var(--crop) 0 var(--crop) 0 round 0);
  margin: 0 auto; /* centraliza */
}

.field { width: 100%; display: flex; flex-direction: column; margin-top: 10px;}
.label { font-size: 14px; color: rgba(15, 23, 42, 1); font-weight: 700;}

input {
  width: 100%;
  padding: 14px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(2,6,23,.6);
  color: #e5e7eb;
  font-size: 16px;
  outline: none;
}
input::placeholder { color: #94a3b8; }

/* Botões genéricos */
.btn {
  display: inline-block;
  width: 100%;
  padding: 14px 12px;
  border-radius: 12px;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .06s ease, filter .15s ease;
}
.btn:active { transform: scale(.98); }

.entrar     { background: #048c5fc7; color: #fff; }
.entrar:hover { filter: brightness(1.1); }

.registrar     { background: #08cd8bc6; color: #fff; }
.registrar:hover { filter: brightness(1.1); }



/* =========================
   MENU (pagina_jogar.html)
   ========================= */
/* Cabeçalho: Perfil | LOGO | Config */
.menu-page .menu-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center; /* mobile centralizado */
  gap: 20px;
  margin-bottom: 20px;
}

.menu-page .menu-header .logo { margin: 0 48px; }

/* Botões redondos para ícones */
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.15);
  background: #dcf40872;
  color: #e5e7eb;
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: transform .06s ease, filter .15s ease;
  position: relative; 
}
.icon-btn:hover { filter: brightness(1.1); }
.icon-btn:active { transform: scale(.95); }

.msg-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: red;
  color: white;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
  font-weight: bold;
}

.hidden {
  display: none;
}

/* Menu vertical (trilhos) */
.menu-vertical {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  align-items: center;
}

/* Botões do menu (sem sublinhado) */
.menu-btn {
  text-decoration: none;
  text-align: center;
  height: 64px;
  display: grid;
  place-items: center;
  letter-spacing: .5px;
  border-radius: 14px;
  width: 100%;
  font-size: 16px;
  font-weight: 700;
  transition: transform .06s ease, filter .15s ease;
}
.menu-btn:hover  { filter: brightness(1.1); }
.menu-btn:active { transform: scale(.98); }

.menu-btn.jogar    { background: #024730c4; color: #fff; }
.menu-btn.aprender { background: #036b48c7; color: #fff; }
.menu-btn.regras   { background: #069666cb; color: #fff; }
.menu-btn.menu   { background: #08cd8bc6; color: #fff; }

/* =========================
   REGRAS (regras.html)
   ========================= */
/* Força 1 coluna apenas nesta página */
.card.rules { grid-template-columns: 1fr !important; }

/* Barra superior (apenas o voltar) */
.rules-topbar {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 12px;
}

/* Botão Voltar (não estica) */
.voltar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #334155;
  color: #e5e7eb;
  text-decoration: none;
  font-weight: 700;
  padding: 12px 16px;
  border-radius: 12px;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: transform .06s ease, filter .15s ease;
}
.voltar:hover  { filter: brightness(1.1); }
.voltar:active { transform: scale(.98); }

/* Tipografia e coluna de leitura */
.rules-title {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
  letter-spacing: .5px;
  margin-bottom: 8px;
  color: green;
}
.rules-body {
  display: grid;
  gap: 16px;
  text-align: left;
  max-width: 860px;
  margin: 0 auto;
  line-height: 1.6;
  color: rgba(15, 23, 42, 1);
}
.rules-body h2 {
  font-size: clamp(18px, 2.5vw, 22px);
  color: rgb(1, 70, 1);
  margin-top: 8px;
  font-weight: 900;
}
.rules-body p { color: rgba(15, 23, 42, 1); font-size: 16px; }
.rules-body ol, .rules-body ul { padding-left: 1.25rem; display: grid; gap: 8px; }

.note {
  background: rgba(255, 255, 255, 0.162);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 10px;
  padding: 10px 12px;
  color: #ffffff;
  font-size: 14px;
}

/* === MODAL DE PERFIL === */
.profile-modal.hidden {
  display: none;
}  

.profile-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.profile-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px); 
}

.profile-dialog {
  position: relative;
  z-index: 1;
  width: min(600px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: rgba(224, 205, 54, 0.98);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  padding: 20px 24px 24px;
  border: 1px solid rgba(148,163,184,0.4);
  color: #e5e7eb;  
}

.profile-close {
  position: absolute;
  top: 10px;
  right: 14px;
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.profile-close:hover {
  color: #f9fafb;
}

.profile-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.profile-photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.profile-photo img {
  width: 96px;
  height: 96px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid #22c55e;
  background-color: white;
}

.btn-sm {
  padding: 4px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  background-color: #020617;
  color: white;
  border-radius: 7.5px;
}

.profile-main {
  flex: 1;
}

.profile-name-label span {
  display: block;
  font-size: 0.9rem;
  color: #9ca3af;
  margin-bottom: 4px;
}

#profile-name {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #020617;
  color: #e5e7eb;
  margin-top: 4px;
}
#profile-name:focus {
  outline: none;
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34,197,94,0.35);
}

.profile-stats {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  font-size: 0.8rem;
}

.profile-divider {
  border: none;
  border-top: 1px solid #1f2937;
  margin: 12px 0 16px;
}

.profile-search h2 {
  font-size: 1.1rem;
}

.profile-results {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background-color: #020617;  
  border-radius: 8px;
}

/* item de resultado */
.player-item,
.profile-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(15,23,42,0.8);
  border: 1px solid rgba(51,65,85,0.9);
}

.player-avatar,
.profile-result-avatar {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  object-fit: cover;
  border: 1px solid #4b5563;
}

.player-main,
.profile-result-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.player-name,
.profile-result-main strong {
  font-size: 0.95rem;
}

.player-stats,
.profile-result-main span {
  font-size: 0.8rem;
  color: #9ca3af;
}

.player-actions,
.profile-result-actions {
  display: flex;
  flex-direction: row;
  gap: 4px;
}

.player-actions button,
.profile-result-actions button {
  padding: 4px 8px;
  border-radius: 7.5px;
  border: 1px solid #334155;
  background:#020617;
  color:#e5e7eb;
  font-size: 0.75rem;
  cursor:pointer;
}

.player-actions button:hover,
.profile-result-actions button:hover {
  filter: brightness(1.1);
}

.hint{font-size: 8px; color: red;}

#search-player{
  background-color: #020617;
  padding: 8px 10px;
  border-radius: 8px;
}

#friends-search{
  background-color: #020617;
  padding: 8px 10px;
  border-radius: 8px;
}

/* Botões discretos na barra do perfil */
.profile-toolbar {
  display:flex; gap:.5rem; margin:.5rem 0 1rem;
}
.pill{
  padding:4px 6px;
  border-radius:10px;
  border:1px solid var(--border);
  background:white;
  color: #14223a;
  cursor:pointer;
  font-size:.8em;
  font-weight: 700;
}
.pill:hover{ filter:brightness(1.08) }

/* Itens da lista (amigos/mensagens/busca) reaproveitam o mesmo estilo da busca */
/*.profile-result-item{
  display:flex; align-items:center; gap:12px;
  padding:10px; border:1px solid var(--border);
  border-radius:12px; background:rgba(255,255,255,.03); margin-bottom:10px;
}
.profile-result-avatar{
  width:44px; height:44px; border-radius:50%; object-fit:cover; border:1px solid var(--border);
}
.profile-result-main{
  display:flex; flex-direction:column; gap:2px; flex:1;
}
.profile-result-actions{
  display:flex; gap:8px; align-items:center;
}
.profile-result-actions button{
  padding:8px 10px; border-radius:10px; border:1px solid var(--border);
  background:#0f1b32; color:var(--text); cursor:pointer;
}
.profile-result-actions button:hover{ filter:brightness(1.08) } */

.badge-dot{
  position:absolute; top:-4px; right:-4px;
  width:10px; height:10px; background:#ef4444; border-radius:50%;
  box-shadow:0 0 0 2px #020617;
}

/* Para o botão principal de perfil (no topo do menu) receber o pontinho vermelho */
#btn-profile.has-unseen::after{
  content:"";
  position:absolute; top:-2px; right:-2px;
  width:10px; height:10px; background:#ef4444; border-radius:50%;
  box-shadow:0 0 0 2px #0f172a;
}

.pill.active-pill {
  background-color: green; /* ou a cor do seu tema */
  color: #f9fafb;
  font-weight: 600;
}

/* ===== MODAL DE EDIÇÃO DE AVATAR ===== */
.avatar-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.avatar-modal.hidden {
  display: none;
}

.avatar-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
}

.avatar-dialog {
  position: relative;
  z-index: 1;
  background: #f8fafc;
  border-radius: 16px;
  padding: 16px 18px 14px;
  width: 320px;
  max-width: 90vw;
  box-shadow: 0 10px 30px rgba(15,23,42,0.3);
  font-size: 14px;
}

.avatar-close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
}

/* área circular de preview */
.avatar-editor-frame {
  width: 200px;
  height: 200px;
  margin: 0 auto 12px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  background: #e2e8f0;
  cursor: grab;
}

.avatar-editor-frame.dragging {
  cursor: grabbing;
}

/* imagem que será movida/zoomeada */
#avatar-editor-image {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
}

/* texto sobreposto (some depois que carregar a imagem) */
.avatar-editor-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
  font-size: 12px;
  color: #0f172a;
  background: linear-gradient(to top, rgba(248,250,252,0.75), transparent);
  text-align: center;
  pointer-events: none;
}

/* highlight ao arrastar arquivo */
.avatar-editor-frame.dragover {
  outline: 2px dashed #22c55e;
  outline-offset: 4px;
}

/* controles */
.avatar-editor-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.avatar-editor-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.avatar-editor-actions {
  justify-content: flex-end;
}




/* responsivo */
@media (max-width: 600px) {
  .profile-header {
    flex-direction: column;
    align-items: stretch;
  }
  .profile-photo {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
  }
}

/* Container do ranking */
#ranking-list {
  margin-top: 8px;
}

/* "Tabela" de ranking */
.ranking-table {
  border: 1px solid #1e293b;
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
}

/* Cada linha (cabeçalho + jogadores) */
.ranking-row {
  display: grid;
  grid-template-columns: 48px 1fr 70px 120px; /* posição | nome | nível | histórico */
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
}

/* Cabeçalho */
.ranking-row--header {
  background: #000000;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: white;
  border-bottom: 1px solid goldenrod;
}

/* Linhas alternadas 
.ranking-row:not(.ranking-row--header):nth-child(odd) {
  background: #020617;
}
.ranking-row:not(.ranking-row--header):nth-child(even) {
  background: #030712;
}*/

/* Colunas individuais (se quiser ajustar) */
.col-pos {
  text-align: center;
  font-weight: 700;
}
.col-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.col-level {
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.col-stats {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Destaque pros 3 primeiros */
.ranking-row.top1 {
  background: linear-gradient(to right, #fbbf24, #facc15);
  color: #111827;
}
.ranking-row.top1 .col-pos {
  font-size: 14px;
}

.ranking-row.top2 {
  background: linear-gradient(to right, #e5e7eb, #d4d4d8);
  color: #111827
}
.ranking-row.top3 {
  background: linear-gradient(to right, #f97316, #fb923c);
  color: #111827
}
.ranking-row.top1 .col-name,
.ranking-row.top2 .col-name,
.ranking-row.top3 .col-name {
  font-weight: 800;
}

/* ===== MODAL "OUTRO PERFIL" ===== */

.other-profile-dialog {
  position: relative;
  z-index: 1;
  width: 250px;
  min-width: 200px;
  max-width: 300px;
  max-height: 90vh;
  overflow: auto;
  box-sizing: border-box;
  margin: 0 auto;               /* centraliza horizontalmente dentro do modal */
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  padding: 12px ;
  border: 3px solid rgba(233, 55, 11, 0.922);
  background-color: white;
  color: orange;
  /* centralizar o CONTEÚDO interno */
  display: flex;
  flex-direction: column;
  align-items: center;          /* horizontal no eixo principal */
  text-align: center;           /* textos centralizados */
}


.other-profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.other-profile-main h2 {
  font-size: 1rem;
  margin-bottom: 2px;
}

.other-profile-main .profile-level {
  font-size: 0.85rem;
  opacity: 0.9;
}

.other-profile-stats {
  margin: 8px 0 12px;
  font-size: 0.85rem;
}

.other-profile-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.other-profile-actions button {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #020617;
  color: #e5e7eb;
  font-size: 0.8rem;
  cursor: pointer;
}

.other-profile-actions button:hover {
  filter: brightness(1.1);
}





/* RESPONSIVIDADE TABLET */

@media (max-width: 1150px) { 

.menu-page .menu-header .logo { margin: 0 3vw; }


}


/* =======================
   POPUP DE DESAFIO (TOAST)
   ======================= */

.challenge-toast {
  position: fixed;
  bottom: 8px;
  left: 8px;
  padding: 6px 8px;
  background: #1f2937;
  color: #f9fafb;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.35);
  z-index: 9999;
  max-width: 190px;
  font-size: 0.75rem;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.challenge-toast__timer {
  opacity: 0.8;
  font-size: 0.7rem;
}

.challenge-toast__buttons {
  display: flex;
  gap: 4px;
}

.challenge-toast__buttons button {
  flex: 1;
  padding: 4px 0;
  font-size: 0.75rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}

.challenge-toast__btn-yes {
  background: #10b981;
  color: #fff;
}

.challenge-toast__btn-no {
  background: #6b7280;
  color: #fff;
}

@media (min-width: 640px) {
  .challenge-toast {
    bottom: 10px;
    left: 10px;
    padding: 10px 12px;
    max-width: 260px;
    font-size: 0.9rem;
  }

  .challenge-toast__timer {
    font-size: 0.8rem;
  }

  .challenge-toast__buttons button {
    padding: 6px 0;
    font-size: 0.8rem;
  }
}



