/* ==========================================================================
   Estrutura: header fixo, subnav, área principal, chat lateral, nav inferior
   Medidas conferidas com o layout de referência (1920px).
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--layout-px);
}

.app { min-height: 100dvh; display: flex; flex-direction: column; }
.app-body { flex: 1; display: flex; padding-top: calc(var(--header-h) + var(--subnav-h)); }
.view { flex: 1; min-width: 0; outline: none; transition: margin-right var(--t-slow) var(--ease); }
.view.is-loading { opacity: 0.6; pointer-events: none; transition: opacity 120ms; }
.page { padding-top: 20px; padding-bottom: 20px; }
.page > * + * { margin-top: 24px; }
@media (max-width: 767px) { .page { padding-top: 10px; } }

/* ---------------- Header (56px, body-level-1) ---------------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 200;
  background: var(--bg);
  transition: right var(--t-slow) var(--ease);
}
.header-top-wrap { background: var(--bg-elev); }
.header-top { height: var(--header-h); display: flex; align-items: center; gap: 0; }
.logo { display: inline-flex; align-items: center; flex-shrink: 0; height: 36px; }
.logo-word {
  display: inline-block; font-weight: 700; font-size: 29px; line-height: 36px; letter-spacing: -1.2px;
  color: var(--brand); transform: skewX(-9deg); transform-origin: left center; padding-right: 4px;
}
@media (max-width: 479px) { .logo-word { font-size: 24px; } }

.htabs { display: flex; gap: 12px; margin-left: 20px; }
.htab {
  height: 40px; min-width: 85px; padding: 0 16px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted-2); font-size: 16px; font-weight: 500; line-height: 20.8px;
  border: 1px solid var(--surface);
  transition: color var(--t), background var(--t);
}
.htab:hover { color: var(--text); }
.htab.is-active { color: var(--brand); background: var(--surface-2); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.hbtn {
  height: 40px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 500; line-height: 20px; color: #fff; background: var(--surface-2);
  transition: background var(--t), filter var(--t);
}
.hbtn:hover { filter: brightness(1.15); }
.hbtn-login { width: 100px; }
.hbtn-register { padding: 0 16px; min-width: 114px; background: var(--brand); }
.hbtn-icon { width: 40px; color: var(--muted-2); }
.hbtn-icon.white { color: #fff; }
.hbtn-icon.is-active { color: var(--brand); }

/* ---------------- Subnav (48px + borda) ---------------- */
.subnav { height: var(--subnav-h); background: var(--bg); border-bottom: 1px solid var(--surface); }
.subnav-inner { height: 48px; display: flex; align-items: center; gap: 40px; }
.subnav-link {
  position: relative; height: 48px; display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted-2); font-size: 14px; line-height: 19.6px; white-space: nowrap;
  transition: color var(--t);
}
.subnav-link .ic { width: 24px; height: 24px; color: currentColor; }
.subnav-link:hover { color: var(--text); }
.subnav-link.is-active { color: var(--brand); }
.subnav-promo { margin-left: auto; }
.subnav-promo .subnav-link .ic { width: 16px; height: 16px; }

@media (max-width: 1439px) { .subnav-inner { gap: 24px; } }
@media (max-width: 1239px) {
  .subnav-inner { overflow-x: auto; scrollbar-width: none; }
  .subnav-inner::-webkit-scrollbar { display: none; }
}

/* Dropdown de promoções */
.dropdown { position: relative; height: 100%; display: flex; align-items: center; }
.dropdown-menu {
  position: absolute; top: calc(100% + 4px); right: 0; min-width: 240px; z-index: 50;
  background: var(--bg-elev); border: 1px solid var(--surface); border-radius: 8px;
  padding: 6px; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity var(--t), transform var(--t), visibility var(--t);
}
.dropdown.is-open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 6px;
  color: var(--muted-2); font-size: 14px; text-align: left;
}
.dropdown-item:hover, .dropdown-item.is-active { background: var(--surface); color: var(--text); }
.dropdown-sep { height: 1px; background: var(--surface); margin: 6px 4px; }

/* ---------------- Chat lateral ---------------- */
.chat-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--chat-w); z-index: 250;
  background: var(--bg-elev); border-left: 1px solid var(--surface-2);
  transform: translateX(100%); visibility: hidden;
  transition: transform var(--t-slow) var(--ease), visibility 0s linear var(--t-slow);
  display: flex; flex-direction: column;
}
/* Fechado fica fora da tela e fora do foco do teclado/leitores de tela. */
body.chat-open .chat-panel { transform: none; visibility: visible; transition: transform var(--t-slow) var(--ease), visibility 0s; }
@media (min-width: 1440px) {
  body.chat-open .view { margin-right: var(--chat-w); }
  body.chat-open .site-header { right: var(--chat-w); }
}
@media (max-width: 1023px) {
  /* Vai até o rodapé da tela: a barra inferior (translúcida) flutua sobre o painel, sem mostrar a página por trás. */
  .chat-panel { width: 100%; bottom: 0; padding-bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom)); border-left: 0; z-index: 190; top: var(--header-h); }
}

/* ---------------- Navegação inferior (mobile) ---------------- */
.mobile-nav { display: none; }
@media (max-width: 1023px) {
  .htabs, .subnav-desktop-only, .header-actions .hide-mobile { display: none !important; }
  .app-body { padding-bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom)); }
  .mobile-nav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; inset: auto 0 0 0; z-index: 210; height: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg-elev); border-top: 1px solid var(--surface);
  }
  .mnav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    color: var(--muted-2); font-size: 11px; font-weight: 500;
  }
  .mnav-item.is-active { color: var(--brand); }
}

/* ---------------- Drawer (menu mobile) ---------------- */
.drawer-backdrop { position: fixed; inset: 0; z-index: 300; background: var(--overlay); animation: fadeOpacity var(--t) var(--ease); }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; width: min(88vw, 340px); z-index: 301;
  background: var(--bg-elev); border-right: 1px solid var(--surface);
  display: flex; flex-direction: column; animation: drawerIn var(--t-slow) var(--ease);
}
.drawer.is-leaving { animation: drawerOut var(--t) var(--ease) forwards; }
.drawer-backdrop.is-leaving { animation: fadeOpacity var(--t) reverse forwards; }
.drawer-head { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--surface); }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px; }
.drawer-group + .drawer-group { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--surface); }
.drawer-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted-2); padding: 0 10px 6px; }
.drawer-link { display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-radius: 6px; color: var(--muted-2); font-size: 14px; }
.drawer-link:hover, .drawer-link.is-active { background: var(--surface); color: var(--text); }
.drawer-link.is-active .ic { color: var(--brand); }
.drawer-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }

/* ---------------- Rodapé (body-level-1) ---------------- */
.site-footer { background: var(--bg-elev); border-top: 1px solid var(--surface); padding: 40px 0; margin-top: 28px; }
.footer-top {
  display: flex; justify-content: space-between; gap: 16px; margin: 24px 0; padding-bottom: 24px;
  border-bottom: 1px solid var(--surface);
}
.footer-brand { max-width: 290px; }
.footer-brand .logo { height: 40px; margin-bottom: 16px; }
.footer-brand .logo-word { font-size: 32px; line-height: 40px; }
.footer-brand p { font-size: 10px; line-height: 14px; color: var(--muted-2); }
.footer-brand p a { text-decoration: underline; }
.footer-col h5 { font-size: 16px; font-weight: 400; line-height: 20.8px; color: #fff; margin-bottom: 12px; }
.footer-col ul { display: grid; gap: 4px; }
.footer-col li { height: 16px; display: flex; align-items: center; }
.footer-col a, .footer-col button { font-size: 12px; line-height: 15.6px; color: var(--muted-2); white-space: nowrap; transition: color var(--t); text-align: left; }
.footer-col a:hover, .footer-col button:hover { color: var(--brand); }
.footer-community { display: flex; flex-direction: column; gap: 24px; align-items: flex-start; }
.footer-social { display: flex; gap: 4px; }
.footer-social a { width: 40px; height: 40px; display: grid; place-items: center; background: var(--surface-2); border-radius: 8px; color: #fff; transition: filter var(--t); }
.footer-social a:hover { filter: brightness(1.2); }
.lang-btn {
  width: 172px; height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 12px 0 16px; border-radius: 8px; background: var(--surface); color: #fff; font-size: 14px;
}
.lang-btn > span { display: flex; align-items: center; gap: 12px; }
.footer-coins { height: 38px; margin-bottom: 24px; overflow: hidden; }
.coins-track { display: inline-flex; width: 100%; flex-wrap: nowrap; overflow: hidden; }
.coins-list { display: flex; justify-content: space-between; flex-shrink: 0; animation: coinsLeft 30s linear infinite; }
.coins-list li { display: flex; justify-content: center; padding: 0 12px; }
.coin-logo { display: inline-grid; height: 31px; }
.coin-logo > span { grid-area: 1 / 1; display: flex; align-items: center; transition: opacity 200ms; }
.coin-logo svg { display: block; height: 31px; width: auto; }
.coin-color { opacity: 0; }
.coin-logo:hover .coin-grey { opacity: 0; }
.coin-logo:hover .coin-color { opacity: 1; }
@keyframes coinsLeft { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .coins-list { animation: none; } }
.lang-flag { display: flex; width: 24px; height: 24px; border-radius: 50%; overflow: hidden; }
.footer-badges { display: flex; gap: 16px; margin-bottom: 40px; }
.footer-badge { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 24px; height: 56px; background: var(--surface); border-radius: 8px; font-size: 13px; line-height: 16.9px; color: #fff; white-space: nowrap; }
.footer-badge:hover span:first-child { color: var(--brand); }
.footer-badge .ic { color: #fff; }
.footer-copy { text-align: center; font-size: 11px; line-height: 14.3px; color: var(--muted-2); }
.footer-copy a { text-decoration: underline; }

@media (max-width: 1023px) {
  .footer-top { flex-wrap: wrap; border-bottom: 0; }
  .footer-brand { flex: 1 1 100%; max-width: none; }
  .footer-col { flex: 1 1 40%; }
  .footer-badges { flex-wrap: wrap; }
  .footer-badge { flex: 1 1 40%; }
}
@media (max-width: 479px) {
  .footer-badge { flex: 1 1 100%; }
  .site-footer { padding-top: 24px; }
}

/* Seletor de idioma do rodapé */
.lang-dd { position: relative; }
.lang-menu { position: absolute; left: 0; bottom: calc(100% + 8px); width: 172px; z-index: 20; border-radius: 8px; background: #0c1d25; overflow: hidden; display: none; box-shadow: 0 -8px 24px rgba(0,0,0,.35); }
.lang-dd.is-open .lang-menu { display: block; animation: fadeIn 150ms var(--ease); }
.lang-menu button { width: 100%; height: 40px; padding: 0 16px; display: flex; align-items: center; gap: 12px; font-size: 14px; color: #fff; text-align: left; transition: background var(--t); }
.lang-menu button span:nth-child(2) { flex: 1; }
.lang-menu button:hover, .lang-menu button.is-active { background: var(--surface-2); }
.lang-dd.is-open .lang-btn svg { transform: rotate(180deg); }
.lang-btn svg { transition: transform var(--t); }
/* ---------- Mobile (referência: sem subnav, header 64px, barra inferior flutuante) ---------- */
@media (max-width: 1023px) {
  :root { --header-h: 64px; --subnav-h: 0px; --mobile-nav-h: 72px; }
  .subnav { display: none; }
  .header-top { height: 64px; }
  .mobile-nav {
    left: 8px; right: 8px; bottom: calc(4px + env(safe-area-inset-bottom)); height: 64px; padding: 0 16px;
    border: 0; border-radius: 24px 24px 16px 16px; background: rgba(7, 42, 54, .8);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 -4px 24px rgba(0, 0, 0, .35);
  }
  .mnav-item { gap: 2px; font-size: 12px; font-weight: 400; line-height: 16px; color: #567484; }
  .mnav-item svg { width: 32px; height: 32px; }
  .mnav-item.is-active { color: var(--brand); }
}
/* ---------- Menu mobile (referência) ---------- */
.dw { position: fixed; inset: 0; z-index: 205; overflow-y: auto; padding: 20px 20px calc(96px + env(safe-area-inset-bottom)); background: var(--bg-elev); animation: fadeIn 180ms var(--ease); }
.dw.is-leaving { animation: fadeOpacity 180ms reverse forwards; }
body.drawer-open .mobile-nav { z-index: 260; }
body.drawer-open .mnav-item[data-action="menu"] { color: var(--brand); }
.dw-top { height: 48px; display: flex; align-items: center; justify-content: space-between; }
.dw-icon { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; color: #567484; }
.dw-logo .logo-word { font-size: 26px; }
.dw-search { margin-top: 12px; width: 100%; height: 44px; padding: 0 16px; display: flex; align-items: center; gap: 12px; border: 1px solid #0c1d25; border-radius: 16px; color: #567484; font-size: 14px; }
.dw-seg { margin-top: 12px; height: 56px; padding: 4px; display: grid; grid-template-columns: 1fr 1fr; border-radius: 9999px; background: #0c1d25; }
.dw-seg button { display: flex; align-items: center; justify-content: center; gap: 10px; border-radius: 9999px; font-size: 16px; font-weight: 500; color: #567484; }
.dw-seg button.is-active { background: rgba(114, 199, 240, .1); color: var(--brand); }
.dw-list { margin-top: 16px; display: flex; flex-direction: column; gap: 4px; }
.dw-link { width: 100%; height: 40px; padding: 0 8px 0 16px; display: flex; align-items: center; gap: 12px; border-radius: 8px; font-size: 14px; color: #fff; text-align: left; }
.dw-link svg { color: #567484; flex-shrink: 0; }
.dw-link > span:first-of-type { flex: 1; }
.dw-link.is-active, .dw-link.is-active svg { color: var(--brand); }
.dw-link:hover { background: #0c1d25; }
.dw-sep { height: 1px; margin: 8px 0 4px; background: #0c1d25; }
.dw-promos { border-radius: 8px; }
.dw-promo-head { width: 100%; height: 52px; padding: 0 12px 0 16px; display: flex; align-items: center; gap: 12px; border-radius: 8px; background: rgba(16, 171, 225, .1); color: var(--brand); font-size: 14px; }
.dw-promo-head span { flex: 1; text-align: left; }
.dw-promo-head svg:last-child { transition: transform var(--t); transform: rotate(180deg); }
.dw-promos.is-closed .dw-promo-head svg:last-child { transform: none; }
.dw-promos.is-closed .dw-promo-list { display: none; }
.dw-promo-list { padding: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.dw-pill { flex: none !important; height: 22px; padding: 0 10px; display: inline-flex; align-items: center; gap: 4px; border-radius: 9999px; background: rgba(114, 199, 240, .1); font-size: 11px; font-weight: 500; color: var(--brand); }
.dw-pill b { padding: 0 6px; border-radius: 16px; background: rgba(16, 171, 225, .05); font-weight: 500; }
.dw-vip { border-radius: 16px; }
.dw-support { margin-top: 12px; width: 100%; height: 40px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 8px; background: var(--brand); color: #fff; font-size: 14px; font-weight: 500; box-shadow: 0 6px 18px rgba(16, 171, 225, .25); }
/* Faixa de anúncio controlada pelo painel */
.site-announce { position: fixed; left: 0; right: 0; top: calc(var(--header-h) + var(--subnav-h)); z-index: 190; min-height: 36px; padding: 8px 16px; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 13px; font-weight: 500; line-height: 18px; color: #fff; background: #0b5f86; }
.site-announce.tone-success { background: #1f7a3c; }
.site-announce.tone-warn { background: #8a6410; }
body.has-announce .app-body { padding-top: calc(var(--header-h) + var(--subnav-h) + 36px); }
@media (min-width: 1440px) { body.chat-open .site-announce { right: var(--chat-w); } }
/* Recursos desligados pelo painel */
body.chat-disabled .chat-panel, body.chat-disabled [data-action="chat"] { display: none !important; }
body.challenges-disabled .pm-card[href="#/desafios"], body.challenges-disabled .dw-link[href="#/desafios"] { display: none !important; }
body.rain-disabled .rain { display: none !important; }