/* ==========================================================================
   GK TANK · TOPBAR CRISTAL SAFIRA, BOTÃO DE TEMA & MENU MOBILE
   100% compatível com a moldura azul/dourada do jogo (25173) e UI-SEM-PISCAR.md
   ========================================================================== */

.portal-masthead {
  position: sticky;
  top: 0;
  z-index: 120;
  background: linear-gradient(180deg, #163d77 0%, #0d2752 60%, #091b3b 100%) !important;
  border-bottom: 2px solid #d8a43c !important;
  box-shadow: inset 0 1px 0 rgba(175, 226, 255, 0.35), 0 10px 28px rgba(3, 10, 24, 0.58) !important;
}

/* Faixa superior de cupom / anúncio */
.portal-announcement {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 38px;
  padding: 6px 18px;
  background: linear-gradient(90deg, #0d254e 0%, #194487 30%, #2157a8 50%, #194487 70%, #0d254e 100%) !important;
  border-bottom: 1px solid rgba(242, 190, 84, 0.42) !important;
  color: #f5f9ff !important;
  font-size: 12.5px;
}

.portal-announcement[hidden] { display: none !important; }

.portal-announcement > span[aria-hidden="true"] {
  color: #ffd666;
  font-size: 14px;
}

.portal-announcement p {
  margin: 0;
  color: #eaf3ff !important;
  font-weight: 600;
}

.portal-announcement p span {
  color: #ffe28a !important;
  font-weight: 800;
}

.portal-announcement #copy-discount {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 3px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe388 0%, #f2b232 100%) !important;
  border: 1px solid #965f0e !important;
  box-shadow: inset 0 1px 0 rgba(255, 250, 220, 0.9) !important;
  color: #281602 !important;
  font-family: var(--cr-font-ui);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.portal-announcement #copy-discount:hover {
  background: linear-gradient(180deg, #ffecaa 0%, #f7c14b 100%) !important;
}

.portal-announcement > small {
  color: #b7d4fa !important;
  font-size: 11.5px;
  font-weight: 600;
}

/* Barra Principal (#topbar) */
#topbar {
  position: relative;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

#topbar .topbar-inner {
  width: min(1260px, calc(100% - 40px)) !important;
  max-width: 1260px !important;
  min-height: 70px !important;
  padding-inline: 0 !important;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 12px !important;
}

#topbar .brand {
  display: inline-flex;
  align-items: center;
  flex: none;
}

#topbar .brand-logo {
  width: 158px !important;
  height: auto !important;
  display: block;
}

#topbar .portal-navigation {
  display: flex;
  align-items: center;
  gap: 6px !important;
  margin-left: 12px;
}

#topbar .portal-navigation a {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px !important;
  padding: 7px 13px !important;
  border-radius: 10px !important;
  color: #dcebff !important;
  font-family: var(--cr-font-display);
  font-size: 13.5px !important;
  font-weight: 700 !important;
  text-decoration: none;
  border: 1px solid transparent !important;
  background: transparent !important;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

#topbar .portal-navigation a[hidden] {
  display: none !important;
}

#topbar .portal-navigation a:hover {
  background: rgba(36, 94, 178, 0.45) !important;
  border-color: rgba(242, 190, 84, 0.45) !important;
  color: #ffffff !important;
}

#topbar .portal-navigation a[aria-current="page"]:not(.nav-recharge) {
  background: linear-gradient(180deg, rgba(32, 84, 162, 0.85) 0%, rgba(16, 48, 98, 0.9) 100%) !important;
  border-color: #e2b24c !important;
  box-shadow: inset 0 1px 0 rgba(255, 240, 190, 0.35) !important;
  color: #ffe28a !important;
}

#topbar .portal-navigation a[aria-current="page"]::after {
  display: none !important;
}

/* Botão de destaque Recargas no menu */
#topbar .portal-navigation .nav-recharge {
  background: linear-gradient(180deg, #ffe07d 0%, #f4b335 54%, #df9518 100%) !important;
  border: 1.5px solid #965f10 !important;
  border-radius: 999px !important;
  padding: 7px 18px !important;
  color: #291702 !important;
  font-weight: 800 !important;
  box-shadow: inset 0 1px 0 rgba(255, 250, 218, 0.9), 0 2px 0 #6b4208 !important;
  text-shadow: 0 1px 0 rgba(255, 245, 200, 0.5) !important;
}

#topbar .portal-navigation .nav-recharge:hover {
  background: linear-gradient(180deg, #ffeb9e 0%, #f8c24c 54%, #e9a120 100%) !important;
  border-color: #b47718 !important;
  color: #1f1000 !important;
}

#topbar .topbar-space {
  display: block !important;
  flex: 1 1 auto !important;
}

/* Controles à direita (Mensagens, Tema, Minha Conta) — Unificados em Safira & Ouro */
#topbar .tb-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 15px !important;
  border-radius: 12px !important;
  background: linear-gradient(180deg, #1b4b91 0%, #0f2c5c 100%) !important;
  border: 1.5px solid rgba(232, 182, 78, 0.78) !important;
  box-shadow: inset 0 1px 0 rgba(190, 232, 255, 0.35), 0 2px 6px rgba(3, 10, 24, 0.45) !important;
  color: #fff8e4 !important;
  font-family: var(--cr-font-display);
  font-size: 13.5px !important;
  font-weight: 800 !important;
  text-decoration: none;
  cursor: pointer;
  flex: none;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

#topbar .tb-btn[hidden] {
  display: none !important;
}

#topbar .tb-btn:hover {
  background: linear-gradient(180deg, #2560b5 0%, #153c78 100%) !important;
  border-color: #ffe28a !important;
  box-shadow: inset 0 1px 0 rgba(255, 245, 205, 0.55), 0 4px 12px rgba(3, 10, 24, 0.55) !important;
  color: #ffffff !important;
}

/* Botão Mensagens na Topbar */
#topbar .portal-message-link svg {
  width: 18px !important;
  height: 18px !important;
  stroke: #ffe28a !important;
  flex: none;
}

#topbar .portal-message-link b {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe07d 0%, #f1ad32 100%) !important;
  border: 1px solid #965f10 !important;
  color: #291702 !important;
  font-size: 11px;
  font-weight: 800;
}

/* Botão Minha Conta / Usuário Logado */
#topbar .account-chip {
  border-radius: 999px !important;
  padding: 0 16px !important;
  background: linear-gradient(180deg, #ffe07d 0%, #f4b335 54%, #df9518 100%) !important;
  border: 1.5px solid #965f10 !important;
  box-shadow: inset 0 1px 0 rgba(255, 250, 218, 0.9), 0 2px 0 #6b4208 !important;
  color: #291702 !important;
}

#topbar .account-chip svg {
  width: 17px !important;
  height: 17px !important;
  stroke: #291702 !important;
  flex: none;
}

#topbar .account-chip .account-chevron {
  width: 14px !important;
  height: 14px !important;
  margin-left: -2px;
}

#topbar .account-chip:hover {
  background: linear-gradient(180deg, #ffeb9e 0%, #f8c24c 54%, #e9a120 100%) !important;
  border-color: #b47718 !important;
  color: #1f1000 !important;
}

/* ==========================================================================
   BOTÃO DE MODO DIA / NOITE (#theme-toggle) — ÍCONE VETORIAL DOURADO LIMPO
   Sem box-shadow torto nem borda azul estranha
   ========================================================================== */
#topbar #theme-toggle.theme-toggle {
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 !important;
  border-radius: 12px !important;
  background: linear-gradient(180deg, #194586 0%, #0d2650 100%) !important;
  border: 1.5px solid rgba(232, 182, 78, 0.78) !important;
  box-shadow: inset 0 1px 0 rgba(190, 232, 255, 0.32), 0 2px 6px rgba(3, 10, 24, 0.45) !important;
  overflow: hidden;
}

#topbar #theme-toggle.theme-toggle:hover {
  background: linear-gradient(180deg, #245cb0 0%, #143972 100%) !important;
  border-color: #ffe28a !important;
}

#topbar #theme-toggle .sun,
#topbar #theme-toggle .moon {
  position: absolute !important;
  inset: 0 !important;
  margin: auto !important;
  width: 20px !important;
  height: 20px !important;
  border-radius: 0 !important;
  background-color: transparent !important;
  box-shadow: none !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 20px 20px !important;
  transition: opacity 0.18s ease !important;
}

/* Ícone Sol Dourado (Modo Dia) */
#topbar #theme-toggle .sun {
  opacity: 1 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffe28a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4.5' fill='%23f5b942'/%3E%3Cpath d='M12 2.5v2.2M12 19.3v2.2M4.9 4.9l1.6 1.6M17.5 17.5l1.6 1.6M2.5 12h2.2M19.3 12h2.2M4.9 19.1l1.6-1.6M17.5 6.5l1.6-1.6'/%3E%3C/svg%3E") !important;
}

/* Ícone Lua Crescente Dourada com Estrela (Modo Noite) */
#topbar #theme-toggle .moon {
  opacity: 0 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M20.2 14.4A8.2 8.2 0 0 1 9.6 3.8a8.2 8.2 0 1 0 10.6 10.6Z' fill='%23ffe28a' stroke='%23f5b942' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M17.5 4.5l.6 1.4 1.4.6-1.4.6-.6 1.4-.6-1.4-1.4-.6 1.4-.6z' fill='%238be2ff'/%3E%3C/svg%3E") !important;
}

html[data-theme="night"] #topbar #theme-toggle .sun {
  opacity: 0 !important;
}

html[data-theme="night"] #topbar #theme-toggle .moon {
  opacity: 1 !important;
}

/* No desktop (> 960px), o botão hambúrguer fica sempre oculto */
@media (min-width: 961px) {
  #topbar .menu-toggle {
    display: none !important;
  }
}

/* ==========================================================================
   MENU DROPDOWN DA CONTA AUTENTICADA (#account-actions)
   ========================================================================== */
#topbar .account-slot {
  position: relative;
  flex: none;
}

#topbar .account-actions {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 232px !important;
  padding: 8px !important;
  border-radius: 16px !important;
  background: linear-gradient(180deg, #17407c 0%, #0b2146 100%) !important;
  border: 2px solid #d8a43c !important;
  box-shadow: inset 0 1px 0 rgba(185, 232, 255, 0.35), 0 18px 40px rgba(2, 8, 20, 0.76) !important;
  display: grid;
  gap: 4px;
  z-index: 140;
}

#topbar .account-actions[hidden] { display: none !important; }

#topbar .account-actions a,
#topbar .account-actions button {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  min-height: 40px !important;
  padding: 9px 14px !important;
  border-radius: 10px !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: #eef6ff !important;
  font-family: var(--cr-font-display) !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  text-align: left !important;
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#topbar .account-actions a::after {
  content: '›';
  color: #ffd666;
  font-size: 16px;
  font-weight: 800;
}

#topbar .account-actions a:hover,
#topbar .account-actions button:hover {
  background: rgba(38, 100, 188, 0.5) !important;
  border-color: rgba(242, 190, 84, 0.45) !important;
  color: #ffe28a !important;
}

#topbar .account-actions #account-logout {
  margin-top: 4px;
  padding-top: 10px !important;
  border-top: 1px solid rgba(135, 196, 255, 0.22) !important;
  border-radius: 0 0 10px 10px !important;
  color: #ffb8b8 !important;
}

#topbar .account-actions #account-logout:hover {
  background: rgba(180, 42, 56, 0.35) !important;
  border-color: rgba(255, 140, 140, 0.4) !important;
  color: #ffe0e0 !important;
}

/* ==========================================================================
   MODO CELULAR / TABLET (<= 960px) — BOTÃO HAMBÚRGUER & GAVETA DE MENU
   ========================================================================== */
@media (max-width: 960px) {
  #topbar .topbar-inner {
    width: calc(100% - 28px) !important;
    gap: 8px !important;
  }

  #topbar .brand {
    min-width: 0 !important;
    margin-right: auto !important;
  }

  #topbar .topbar-space {
    display: none !important;
  }

  #topbar .menu-toggle {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    border-radius: 12px !important;
    background: linear-gradient(180deg, #194586 0%, #0d2650 100%) !important;
    border: 1.5px solid rgba(232, 182, 78, 0.78) !important;
    box-shadow: inset 0 1px 0 rgba(190, 232, 255, 0.32), 0 2px 6px rgba(3, 10, 24, 0.45) !important;
    flex: none;
  }

  #topbar .menu-toggle:hover,
  #topbar .menu-toggle[aria-expanded="true"] {
    background: linear-gradient(180deg, #245cb0 0%, #143972 100%) !important;
    border-color: #ffe28a !important;
  }

  #topbar .menu-toggle span {
    position: relative !important;
    display: block !important;
    width: 18px !important;
    height: 2px !important;
    border-radius: 2px !important;
    background: #ffe28a !important;
    box-shadow: none !important;
    transition: background-color 0.15s ease !important;
  }

  #topbar .menu-toggle span::before,
  #topbar .menu-toggle span::after {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    width: 18px !important;
    height: 2px !important;
    border-radius: 2px !important;
    background: #ffe28a !important;
  }

  #topbar .menu-toggle span::before { top: -6px !important; }
  #topbar .menu-toggle span::after { top: 6px !important; }

  #topbar .menu-toggle[aria-expanded="true"] span {
    background: transparent !important;
  }
  #topbar .menu-toggle[aria-expanded="true"] span::before {
    top: 0 !important;
    transform: rotate(45deg);
  }
  #topbar .menu-toggle[aria-expanded="true"] span::after {
    top: 0 !important;
    transform: rotate(-45deg);
  }

  body #topbar .portal-navigation,
  body #topbar .portal-navigation.open {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    left: 14px !important;
    right: 14px !important;
    margin: 0 !important;
    padding: 12px !important;
    border-radius: 18px !important;
    background: linear-gradient(180deg, #17407c 0%, #0a1f42 100%) !important;
    border: 2px solid #d8a43c !important;
    box-shadow: inset 0 1px 0 rgba(185, 232, 255, 0.35), 0 22px 48px rgba(2, 8, 20, 0.82) !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    z-index: 150 !important;
  }

  body #topbar .portal-navigation:not(.open) {
    display: none !important;
  }

  body #topbar .portal-navigation.open {
    display: flex !important;
  }

  body #topbar .portal-navigation a {
    width: 100% !important;
    min-height: 44px !important;
    padding: 10px 16px !important;
    justify-content: space-between !important;
    font-size: 14.5px !important;
    border-radius: 11px !important;
    background: rgba(9, 27, 58, 0.55) !important;
    border: 1px solid rgba(122, 188, 255, 0.22) !important;
  }

  body #topbar .portal-navigation a::after {
    content: '›';
    display: inline-block !important;
    color: #ffd666;
    font-size: 17px;
    font-weight: 800;
  }

  body #topbar .portal-navigation .nav-recharge {
    justify-content: center !important;
    border-radius: 12px !important;
    margin-bottom: 4px;
  }
  body #topbar .portal-navigation .nav-recharge::after {
    display: none !important;
  }
}

@media (max-width: 680px) {
  #topbar .topbar-inner {
    width: calc(100% - 20px) !important;
    min-height: 60px !important;
    gap: 6px !important;
  }

  #topbar .brand-logo {
    width: 102px !important;
  }

  #topbar .tb-btn {
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 10px !important;
    font-size: 12px !important;
    gap: 5px !important;
  }

  #topbar .account-chip {
    max-width: 108px !important;
    padding: 0 10px !important;
  }

  #topbar .portal-message-link,
  #topbar #theme-toggle.theme-toggle,
  #topbar .menu-toggle {
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    border-radius: 10px !important;
  }
}
