/* ==========================================================================
   AXIONMESK — MOBILE APP LAYER v1
   Camada final de otimização mobile. Carregada por último.
   Objetivo: experiência de app nativo no celular.
   ========================================================================== */

/* ==========================================================================
   0) BASE — comportamento de app
   ========================================================================== */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
  touch-action: manipulation;
  min-height: 100dvh;
  min-height: 100svh;
}

/* Nunca deixa um elemento estourar a largura */
html, body { max-width: 100%; overflow-x: clip; }
img, svg, video, canvas { max-width: 100%; height: auto; }

/* Rolagem horizontal apenas onde é intencional */
.no-scroll-x { overflow-x: hidden !important; }

/* ==========================================================================
   1) TAP TARGETS — mínimo 44x44 (Apple/Google)
   ========================================================================== */
@media (max-width: 900px) {
  button,
  .btn,
  [role="button"],
  a.btn,
  .nav__link,
  .wallet-tab,
  .sort-tab,
  .fchip,
  .chip,
  .tab,
  .menu-item,
  input[type="submit"],
  input[type="button"] {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    cursor: pointer;
  }

  /* Botões pequenos continuam compactos visualmente, mas com área de toque 44px */
  .btn--sm,
  .btn--link {
    min-height: 44px !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    position: relative;
  }

  /* Botões que abrem menu/ícone: área quadrada de 44px */
  .icon-btn,
  .btn--icon,
  .avatar,
  .header__actions .btn--link {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Links de texto: área de toque vertical garantida sem quebrar layout */
  .btn--link {
    padding-left: 10px;
    padding-right: 10px;
  }

  /* Feedback tátil imediato (substitui hover, que não existe no celular) */
  .btn:active,
  button:active,
  .nav__link:active,
  .wallet-tab:active,
  .sort-tab:active,
  .chip:active,
  .fchip:active,
  a:active {
    transform: scale(0.97);
    transition: transform 0.08s ease;
  }

  /* Inputs: 16px evita zoom automático do iOS */
  input, select, textarea {
    font-size: 16px !important;
    min-height: 48px;
  }
  textarea { min-height: 100px; }

  /* Botões de formulário em largura total */
  form .btn--primary,
  .auth-field + .btn,
  .form-actions .btn {
    width: 100%;
  }
}

/* ==========================================================================
   2) HEADER — fixo, compacto, seguro contra notch
   ========================================================================== */
@media (max-width: 900px) {
  .app-header,
  .site-header,
  .header {
    position: sticky;
    top: 0;
    z-index: 900;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: rgba(11, 13, 18, 0.88) !important;
    padding-top: calc(env(safe-area-inset-top, 0px) + 8px) !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .app-header__right {
    gap: 6px !important;
    display: flex;
    align-items: center;
  }

  .logo { gap: 8px !important; }
  .logo__text { font-size: 18px !important; }
  .logo__mark { width: 28px !important; height: 28px !important; flex: 0 0 auto; }
}

/* ==========================================================================
   3) BOTTOM NAV — respeita safe area e não cobre conteúdo
   ========================================================================== */
@media (max-width: 900px) {
  .bottom-nav,
  .bottom-bar,
  nav.bottom {
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 6px) !important;
    min-height: calc(60px + env(safe-area-inset-bottom, 0px));
  }

  .bottom-nav__item,
  .bottom-nav a,
  .bottom-nav button {
    min-height: 52px !important;
    min-width: 52px !important;
  }

  /* Reserva espaço para a bottom nav em TODAS as páginas internas */
  body:not(.auth-page) .page,
  body:not(.auth-page) .page-body,
  body:not(.auth-page) main {
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }

  /* E também para a barra de instalar PWA, quando visível */
  body.has-install-bar .page,
  body.has-install-bar .page-body,
  body.has-install-bar main {
    padding-bottom: calc(190px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ==========================================================================
   4) LISTAS E TABELAS — viram cards nativos
   ========================================================================== */
@media (max-width: 900px) {
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Tabelas viram cartões */
  .table-wrap table:not(.no-cards) {
    display: block;
    width: 100%;
  }
  .table-wrap table:not(.no-cards) thead { display: none; }
  .table-wrap table:not(.no-cards) tbody,
  .table-wrap table:not(.no-cards) tr,
  .table-wrap table:not(.no-cards) td {
    display: block;
    width: 100%;
  }
  .table-wrap table:not(.no-cards) tr {
    margin-bottom: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
  }
  .table-wrap table:not(.no-cards) td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border: 0;
    text-align: right;
  }
  .table-wrap table:not(.no-cards) td::before {
    content: attr(data-label);
    font-size: 12.5px;
    font-weight: 600;
    opacity: 0.6;
    text-align: left;
    flex: 0 0 auto;
  }
  .table-wrap table:not(.no-cards) td:first-child {
    padding-bottom: 10px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-weight: 700;
    font-size: 15px;
  }
  .table-wrap table:not(.no-cards) td:first-child::before { display: none; }
}

/* ==========================================================================
   5) STICKY ACTION BAR — ações principais sempre alcançáveis
   ========================================================================== */
@media (max-width: 900px) {
  .sticky-actions {
    position: sticky;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    z-index: 850;
    background: rgba(11, 13, 18, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 12px;
    margin: 0 -12px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
  }
}

/* ==========================================================================
   6) MODAIS — full screen no celular, com botão fechar grande
   ========================================================================== */
@media (max-width: 900px) {
  .modal__box,
  .modal-content,
  .dialog,
  .sheet {
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 92dvh;
    margin: auto 0 0 !important;
    border-radius: 20px 20px 0 0 !important;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px) !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal__close,
  .modal .close,
  .sheet__close {
    min-width: 44px; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
  }
}

/* ==========================================================================
   7) FORMULÁRIOS — campos grandes e confortáveis
   ========================================================================== */
@media (max-width: 900px) {
  .auth-field {
    height: 52px !important;
    padding: 0 14px !important;
    border-radius: 14px !important;
  }

  label, .field-label {
    font-size: 13.5px !important;
    margin-bottom: 6px;
    display: block;
  }

  /* Espaçamento entre campos */
  .auth-field + .auth-field,
  .field + .field {
    margin-top: 12px;
  }

  /* Mensagens de erro/sucesso legíveis */
  .auth-msg, .msg, .alert {
    font-size: 13.5px;
    line-height: 1.5;
  }
}

/* ==========================================================================
   8) CARDS E GRIDS
   ========================================================================== */
@media (max-width: 900px) {
  .stat-box {
    padding: 14px 14px !important;
    border-radius: 14px !important;
  }
  .stat-box__value { font-size: 18px !important; }
  .stat-box__label { font-size: 12px !important; }

  .section-title { font-size: 18px !important; margin-bottom: 12px; }

  .wallet-tab, .sort-tab {
    white-space: nowrap;
    padding: 10px 14px !important;
    min-height: 44px;
  }
}

/* ==========================================================================
   9) PERFORMANCE — evita atraso de 300ms no toque
   ========================================================================== */
@media (hover: none) and (pointer: coarse) {
  * { touch-action: manipulation; }

  /* Otimiza áreas que rolam */
  .table-wrap, .scroll-x {
    will-change: scroll-position;
  }

  /* Remove hover "grudado" no mobile */
  .btn:hover, button:hover, a:hover {
    transform: none;
  }
}

/* ==========================================================================
   10) TOASTS / ALERTAS — acima de tudo e da bottom nav
   ========================================================================== */
@media (max-width: 900px) {
  .toast, .alert-floating, .notification {
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    bottom: calc(86px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 10000;
  }
}

/* ==========================================================================
   11) UTILITÁRIOS
   ========================================================================== */
@media (max-width: 900px) {
  .hide-mobile { display: none !important; }
  .full-mobile { width: 100% !important; }
  .text-center-mobile { text-align: center !important; }
}
@media (min-width: 901px) {
  .hide-desktop { display: none !important; }
}

/* ==========================================================================
   12) ACESSIBILIDADE
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .btn:active { transform: none !important; }
}

:focus-visible {
  outline: 2px solid #386BFF;
  outline-offset: 2px;
  border-radius: 8px;
}

/* ==========================================================================
   13) TAP TARGETS v2 — links de texto e cards clicaveis
   ========================================================================== */
@media (max-width: 900px) {
  /* Links de acao tipo "Ver todos", "Saiba mais" */
  .see-all,
  .link-strong,
  .link-arrow,
  .text-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 4px;
    font-size: 14px !important;
  }

  /* Links dentro de paragrafos (Conta Google / Conta Apple) */
  .login-foot a,
  .auth-foot a,
  p a[href="#"] {
    display: inline-block;
    min-height: 38px;
    padding: 8px 2px;
    line-height: 1.5;
  }

  /* Cards de moeda em Descubra: area inteira clicavel */
  .coin-card,
  .asset-card,
  .market-card,
  .trend-row,
  .discover-card {
    min-height: 64px;
    padding: 12px !important;
    display: flex;
    align-items: center;
  }

  /* Linha de mercado (BTC/ETH...) */
  .coin-card__price,
  .asset-card__price {
    font-size: 13px !important;
  }

  /* Botão "Esqueci minha senha" — área maior */
  .auth-forgot,
  .forgot-link {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 8px 2px;
    font-size: 13.5px !important;
  }

  /* Botões de conta social (login) */
  .social-btn,
  .btn-google,
  .btn-apple {
    min-height: 52px !important;
    font-size: 15px !important;
  }
}

/* ==========================================================================
   14) HEADER NAV — barra rolavel horizontal (padrao de app)
   ========================================================================== */
@media (max-width: 900px) {
  .app-header {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    padding-left: 12px !important;
    padding-right: 0 !important;
    overflow: hidden;
  }

  .app-header > .logo {
    flex: 0 0 auto;
    order: 1;
  }

  .app-header__right {
    order: 3;
    flex: 0 0 100% !important;
    width: 100% !important;
    margin-top: 6px;
    display: flex !important;
    align-items: center;
    gap: 2px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-right: 12px;
    /* fade na borda direita indicando que ha mais itens */
    -webkit-mask-image: linear-gradient(to right, #000 92%, transparent 100%);
    mask-image: linear-gradient(to right, #000 92%, transparent 100%);
  }

  .app-header__right::-webkit-scrollbar { display: none; }

  .app-header__right .btn,
  .app-header__right .btn--link,
  .app-header__right .btn--sm {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    min-height: 40px;
    border-radius: 10px;
    color: rgba(232, 234, 237, 0.82);
  }

  .app-header__right .btn[style*="--yellow"],
  .app-header__right .btn.is-active {
    color: #386BFF !important;
    font-weight: 700;
  }

  /* Se houver botao Entrar/Cadastrar dentro, mantem a direita e fixo */
  .app-header__actions {
    order: 2;
    margin-left: auto;
    flex: 0 0 auto;
    display: flex;
    gap: 6px;
  }
}

/* ==========================================================================
   15) TICKER DE PRECOS — contido, sem corte visual
   ========================================================================== */
@media (max-width: 900px) {
  .ticker,
  .ticker-bar,
  .price-ticker {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .ticker__track,
  .ticker__inner,
  .ticker-bar__track {
    display: flex;
    align-items: center;
    white-space: nowrap;
    width: max-content;
    max-width: none !important;
    padding-left: 12px;
  }
  .ticker__item,
  .ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px !important;
    flex: 0 0 auto;
  }
}

/* ==========================================================================
   16) DESCUBRA — titulo e espacamentos no mobile
   ========================================================================== */
@media (max-width: 900px) {
  .news-hero__title,
  .discover__title,
  .page-title {
    font-size: clamp(24px, 8vw, 34px) !important;
    line-height: 1.08 !important;
    letter-spacing: -0.02em !important;
    font-weight: 800 !important;
    margin: 8px 0 10px !important;
  }

  .news-hero,
  .discover-hero {
    padding-top: 12px !important;
    padding-bottom: 8px !important;
  }

  /* Linha "Ao vivo / data" */
  .live-badge, .news-meta {
    font-size: 13px !important;
    flex-wrap: wrap;
    gap: 8px !important;
    margin-bottom: 8px !important;
  }

  /* Cards de noticia: imagem proporcional, sem espaco gigante */
  .news-card__media,
  .news-card img,
  .news-img {
    aspect-ratio: 16 / 9;
    max-height: 220px;
    object-fit: cover;
    border-radius: 14px 14px 0 0;
  }

  .news-card {
    margin-bottom: 14px;
    border-radius: 16px;
    overflow: hidden;
  }
  .news-card__body { padding: 14px 14px 18px !important; }
  .news-card__title {
    font-size: 19px !important;
    line-height: 1.28 !important;
    font-weight: 700 !important;
  }
  .news-card__meta { font-size: 12.5px !important; margin-bottom: 6px !important; }

  /* Espaco final para a barra de instalar nunca cobrir conteudo */
  body.has-install-bar .news-list,
  body.has-install-bar .discover-list {
    padding-bottom: 110px !important;
  }
}

/* ==========================================================================
   17) DESCUBRA/NEWS — masthead, ticker e espacamentos (correcao final)
   ========================================================================== */
@media (max-width: 900px) {

  /* ---------- MASTHEAD "AXIONMESK NEWS" compacto ---------- */
  .news-masthead { padding: 14px 0 12px !important; }
  .news-masthead__inner {
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px !important;
    padding: 0 14px !important;
  }
  .news-brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: nowrap;
  }
  .news-brand__pri,
  .news-brand__sec {
    font-size: 26px !important;
    line-height: 1.05 !important;
    letter-spacing: -0.02em !important;
    font-weight: 900 !important;
  }
  .news-clock {
    font-size: 13px !important;
    line-height: 1.45 !important;
    opacity: 0.85;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }
  .news-clock > * { white-space: nowrap; }

  /* ---------- TICKER: rolagem horizontal real, sem corte visual ---------- */
  .news-tickerbar {
    padding: 0 !important;
    border-top: 1px solid rgba(255,255,255,.06);
    border-bottom: 1px solid rgba(255,255,255,.06);
  }
  .news-tickerbar .container {
    padding: 0 !important;
    max-width: 100% !important;
    overflow: hidden;
  }
  .news-ticker {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    width: 100%;
    max-width: 100%;
    padding: 0 !important;
    /* fade na borda direita */
    -webkit-mask-image: linear-gradient(to right, #000 90%, transparent 100%);
    mask-image: linear-gradient(to right, #000 90%, transparent 100%);
  }
  .news-ticker::-webkit-scrollbar { display: none; }

  /* Cada item do ticker */
  .news-ticker .ntick,
  .news-ticker > * {
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center;
    gap: 7px;
    white-space: nowrap !important;
    padding: 11px 14px !important;
    font-size: 13.5px !important;
    min-height: 44px;
  }

  /* ---------- CORPO: evita espaco vazio enorme ---------- */
  .news-page { padding-top: 0 !important; }
  .news-body { padding: 16px 14px 0 !important; }
  .news-top { margin-top: 0 !important; gap: 16px !important; }

  /* ---------- BARRA DE INSTALAR: nao sobrepoe o titulo ---------- */
  body.has-install-bar .news-body { padding-bottom: 120px !important; }

  /* ---------- CARD DE NOTICIA: titulo com respiro ---------- */
  .news-card__title,
  .news-hero__title,
  .news-top__main h2 {
    font-size: 18px !important;
    line-height: 1.32 !important;
    margin-bottom: 8px !important;
  }
  .news-card__desc,
  .news-card p {
    font-size: 14px !important;
    line-height: 1.55 !important;
  }
}

@media (max-width: 400px) {
  .news-brand__pri, .news-brand__sec { font-size: 23px !important; }
  .news-ticker .ntick, .news-ticker > * { font-size: 12.5px !important; padding: 10px 12px !important; }
}

/* ==========================================================================
   18) DESCUBRA — remove espacos vazios e reserva area da barra de instalar
   ========================================================================== */
@media (max-width: 900px) {
  /* Container do corpo encosta no ticker */
  .container.news-body {
    padding: 14px 14px 0 !important;
    margin-top: 0 !important;
  }

  /* .news-top sem margem/padding sobrando */
  .news-top {
    margin: 0 0 14px !important;
    padding: 0 !important;
    display: block !important;
  }
  .news-top__main {
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Remove qualquer min-height que crie area preta */
  .news-top__main [class*="hero"],
  #newsHero {
    min-height: 0 !important;
    margin-top: 0 !important;
  }

  /* Espaco real para a barra de instalar (nao cobre o card) */
  body.has-install-bar .container.news-body {
    padding-bottom: 132px !important;
  }
  body.has-install-bar .news-grid,
  body.has-install-bar .news-facts {
    padding-bottom: 8px !important;
  }

  /* Cards de noticia sem margem extra */
  .news-card { margin: 0 0 12px !important; }
  #newsHero .news-card,
  #newsHero > * { margin-bottom: 12px !important; }
}

/* ==========================================================================
   19) HOME — ticker sem corte, hero compacto, areas seguras
   ========================================================================== */
@media (max-width: 900px) {

  /* ---------- TICKER DO TOPO: rolagem horizontal correta ---------- */
  .ticker {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    padding: 0 !important;
    border-bottom: 1px solid rgba(255,255,255,.06);
  }
  .ticker__track {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center;
    width: max-content !important;
    max-width: none !important;
    animation: ticker-scroll 30s linear infinite;
  }
  .ticker__item {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    padding: 10px 16px !important;
    font-size: 13px !important;
    min-height: 42px;
  }
  /* pausa a animacao ao tocar (permite ler) */
  .ticker:active .ticker__track {
    animation-play-state: paused;
  }

  /* ---------- HERO: menos espaco vertical ---------- */
  .hero {
    padding: 22px 0 18px !important;
  }
  .hero__inner {
    display: flex !important;
    flex-direction: column;
    gap: 20px !important;
  }
  .hero__title {
    font-size: clamp(26px, 7.6vw, 36px) !important;
    line-height: 1.1 !important;
    margin: 0 0 20px !important;
    letter-spacing: -0.02em;
  }
  .hero__form { gap: 12px !important; }
  .hero__terms {
    margin-top: 14px !important;
    font-size: 13.5px !important;
    line-height: 1.6 !important;
  }
  .hero__terms a {
    display: inline-block;
    min-height: 36px;
    line-height: 36px;
    padding: 0 2px;
  }

  /* Card do grafico encosta no formulario */
  .hero__right { margin-top: 4px !important; }
  .hero__card { padding: 16px !important; }
  .hero__card-head { margin-bottom: 10px !important; }
  .hero__card-price { font-size: 22px !important; }
  .hero__card-chart { margin: 10px 0 14px !important; }

  /* ---------- ULTIMO BLOCO: nunca coberto pela barra de instalar ---------- */
  body.has-install-bar .hero__inner,
  body.has-install-bar .markets,
  body.has-install-bar .markets-grid,
  body.has-install-bar .section {
    padding-bottom: 0 !important;
  }
  /* [FIX] Nao usar .container:last-of-type: esta classe tambem existe em
     .header__inner e criava 124px de vazio abaixo do header.
     O espaco da barra de instalar e aplicado em main/section, nunca no header. */
  body.has-install-bar main,
  body.has-install-bar .page-body {
    padding-bottom: 124px !important;
  }
  body.has-install-bar .header,
  body.has-install-bar .app-header,
  body.has-install-bar .header__inner {
    margin-bottom: 0 !important;
  }

  /* "Mercados em alta" com respiro */
  .section-head { margin-bottom: 12px !important; }
  .section-head a { min-height: 40px; display: inline-flex; align-items: center; }
}

@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .ticker__track { animation: none !important; }
}

/* ==========================================================================
   20) TAP TARGETS v3 — links de auth e rodape (correcao definitiva)
   ========================================================================== */
@media (max-width: 900px) {
  /* "Esqueci minha senha" e links de autenticacao */
  .auth-link {
    display: inline-flex !important;
    align-items: center;
    min-height: 44px;
    padding: 10px 4px !important;
    font-size: 14px !important;
    line-height: 1.4;
  }

  /* Links do rodape */
  .footer a,
  .footer__links a,
  footer a,
  .site-footer a {
    display: inline-flex !important;
    align-items: center;
    min-height: 44px !important;
    padding: 8px 0 !important;
    font-size: 14px !important;
  }
  .footer__links,
  .footer__col {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
  }

  /* Links "Ver todas / Ver todos" em cabecalhos de secao */
  .section-head a,
  .see-all,
  .link-strong {
    display: inline-flex !important;
    align-items: center;
    min-height: 44px !important;
    padding: 10px 4px !important;
  }
}

/* ==========================================================================
   21) HEADER NAV — garante rolagem real (nao vaza para fora)
   ========================================================================== */
@media (max-width: 900px) {
  .app-header {
    overflow: hidden !important;
    max-width: 100vw !important;
  }

  .app-header__right {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    max-width: 100% !important;
    width: 100% !important;
    flex-wrap: nowrap !important;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .app-header__right > * {
    flex: 0 0 auto !important;
    scroll-snap-align: start;
  }

  /* Hamburguer / acoes ficam fixos a direita */
  .app-header > .logo { margin-right: 4px; }
}

/* ==========================================================================
   22) AJUSTES FINAIS — logo clicavel e links sociais
   ========================================================================== */
@media (max-width: 900px) {
  /* Logo e um link: area de toque 44px sem mudar o visual */
  a.logo,
  .logo {
    display: inline-flex !important;
    align-items: center;
    min-height: 44px !important;
    padding: 4px 2px;
  }

  /* Links sociais "Conta Google / Conta Apple" */
  a[href="#"]:not([class]),
  .hero__social,
  .social-link {
    display: inline-flex !important;
    align-items: center;
    min-height: 44px !important;
    padding: 10px 4px !important;
  }

  /* Termos e Política no hero */
  .hero__terms a,
  .auth-terms a {
    display: inline !important;
    min-height: 0 !important;
    padding: 0 1px !important;
    text-decoration: underline;
  }
}

/* ==========================================================================
   23) HOME — correcao definitiva de espacos, ticker e glow
   ========================================================================== */
@media (max-width: 900px) {

  /* ---------- 1. Remove o vazio gigante entre header e titulo ---------- */
  .hero {
    padding: 24px 0 28px !important;
    background: transparent !important;
    border-top: 0 !important;
  }
  section.hero:first-of-type { padding-top: 20px !important; }

  /* Header sticky encosta no conteudo */
  .header { margin-bottom: 0 !important; }
  .header + .hero,
  .header + section { margin-top: 0 !important; }

  /* Remove linhas divisórias estranhas */
  .hero::before, .hero::after,
  .header::after { display: none !important; }

  /* ---------- 2. Ticker: animacao fluida, sem corte visual ---------- */
  .ticker {
    overflow: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
    height: 46px !important;
    min-height: 46px;
    background: var(--bg, #131F33);
    border-bottom: 1px solid rgba(255,255,255,.06);
  }
  .ticker__track {
    display: flex !important;
    align-items: center;
    height: 46px !important;
    width: max-content !important;
    animation: cm-ticker 40s linear infinite !important;
  }
  .ticker__item {
    flex: 0 0 auto !important;
    white-space: nowrap;
    padding: 0 18px !important;
    font-size: 13px !important;
    height: 46px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  /* ---------- 3. Titulo em tamanho equilibrado ---------- */
  .hero__title {
    font-size: clamp(24px, 6.8vw, 32px) !important;
    line-height: 1.18 !important;
    font-weight: 800 !important;
    letter-spacing: -0.025em !important;
    margin: 0 0 18px !important;
  }

  /* ---------- 4. Botao sem glow exagerado ---------- */
  .hero__form .btn,
  .hero__form .btn--primary {
    box-shadow: 0 4px 16px rgba(56,107,255, 0.18) !important;
    border-radius: 14px !important;
    min-height: 54px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
  }
  .hero__form .btn:active {
    box-shadow: 0 2px 8px rgba(56,107,255,.14) !important;
  }

  /* ---------- 5. Campo de entrada ---------- */
  .hero .field {
    height: 54px !important;
    border-radius: 14px !important;
    font-size: 15px !important;
  }

  /* ---------- 6. Card de grafico visivel (barra nao sobrepoe) ---------- */
  .hero__right { margin-bottom: 0 !important; }
  .hero__card {
    margin-bottom: 0 !important;
    position: relative;
    z-index: 1;
  }

  /* Espaco real no fim do conteudo para a barra de instalar */
  body.has-install-bar .hero__right {
    padding-bottom: 4px;
  }
  body.has-install-bar .hero__card {
    margin-bottom: 120px !important;
  }

  /* Quando a barra de instalar estiver visivel, sobe o conteudo */
  body.has-install-bar .page,
  body.has-install-bar main { padding-bottom: 130px !important; }
}

@keyframes cm-ticker {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .ticker__track { animation: none !important; }
}


/* ==========================================================================
   24) GARANTIA FINAL — header nunca tem margem grande no mobile
   ========================================================================== */
@media (max-width: 900px) {
  .header__inner,
  .app-header__inner {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }
  .header, .app-header, .site-header {
    margin-bottom: 0 !important;
  }
}

/* ==========================================================================
   25) POLIMENTO FINAL MOBILE — ticker, glow, espacos, icone PWA
   ========================================================================== */
@media (max-width: 900px) {

  /* ---------- 1. TICKER: altura fixa, animacao continua, sem corte ---------- */
  #ticker,
  .ticker {
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    overflow: hidden !important;
    display: block !important;
  }
  #tickerTrack,
  .ticker__track {
    display: flex !important;
    align-items: center;
    height: 42px !important;
    flex-wrap: nowrap !important;
    width: max-content !important;
    will-change: transform;
  }
  .ticker__item {
    height: 42px !important;
    display: inline-flex !important;
    align-items: center;
    gap: 7px;
    padding: 0 16px !important;
    font-size: 13px !important;
    line-height: 1;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
  }
  .ticker__item b, .ticker__item strong { font-weight: 700; }

  /* ---------- 2. SEM GLOW nos botoes (visual limpo) ---------- */
  .btn,
  .btn--primary,
  .hero__form .btn,
  .hero__card .btn,
  button[type="submit"],
  .pwa-install-btn {
    box-shadow: none !important;
    filter: none !important;
    text-shadow: none !important;
  }
  /* Mantem apenas um leve relevo ao pressionar */
  .btn:active,
  .btn--primary:active {
    box-shadow: none !important;
    transform: scale(0.975) !important;
  }

  /* ---------- 3. Espacos verticais equilibrados ---------- */
  .hero__inner { gap: 18px !important; }

  /* Bloco "Ou entre com Conta Google / Apple" mais proximo do card */
  .hero__social,
  .hero__terms {
    margin: 16px 0 4px !important;
  }
  .hero__right {
    margin-top: 8px !important;
    gap: 0 !important;
  }
  .hero__card {
    margin-top: 8px !important;
  }

  /* ---------- 4. Header compacto ---------- */
  .header__inner {
    min-height: 56px !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
  }
  .header .logo__text { font-size: 17px !important; }
  .header .logo__mark { width: 26px !important; height: 26px !important; }
  .header__actions .btn {
    min-height: 40px !important;
    padding: 9px 14px !important;
    font-size: 13.5px !important;
    border-radius: 10px !important;
  }

  /* ---------- 5. Barra de instalar: icone alinhado ---------- */
  .pwa-install-icon {
    width: 44px !important;
    height: 44px !important;
    border-radius: 11px !important;
    object-fit: cover !important;
    flex: 0 0 44px !important;
    display: block !important;
    background: #0B1220;
  }
  .pwa-install-bar {
    padding: 10px 12px !important;
    gap: 10px !important;
  }
  .pwa-install-text strong { font-size: 14.5px !important; }
  .pwa-install-text span { font-size: 12.5px !important; opacity: .75; }
  .pwa-install-btn {
    min-height: 42px !important;
    padding: 0 18px !important;
    font-size: 14px !important;
    border-radius: 11px !important;
  }
}

/* Fora do media query: glow nunca */
.btn--primary, .hero__form .btn, .hero__card .btn {
  box-shadow: none;
}

/* ==========================================================================
   26) TICKER ANIMADO + ESPACOS + BARRA PWA (ajuste final)
   ========================================================================== */

/* --- Ticker: animacao garantida (loop infinito real) --- */
#tickerTrack,
.ticker__track {
  animation: cm-ticker-loop 32s linear infinite !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  width: max-content !important;
  will-change: transform;
}

@keyframes cm-ticker-loop {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

/* Pausa ao tocar para o usuario conseguir ler */
#ticker:hover #tickerTrack,
#ticker:active #tickerTrack,
.ticker:hover .ticker__track {
  animation-play-state: paused !important;
}

@media (prefers-reduced-motion: reduce) {
  #tickerTrack, .ticker__track { animation: none !important; }
}

@media (max-width: 900px) {
  /* --- Remove o vazio entre "Conta Apple" e o card do grafico --- */
  .hero__social,
  .hero__terms,
  .hero__alt {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }
  .hero__right,
  .hero__card-wrap {
    margin-top: 14px !important;
    padding-top: 0 !important;
  }
  .hero__inner > *:last-child { margin-bottom: 0 !important; }
  .hero__card { margin-top: 0 !important; }

  /* --- Barra de instalar: nao cobre o card --- */
  body.has-install-bar main,
  body.has-install-bar .page-body {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
  }
  body.has-install-bar .hero,
  body.has-install-bar .hero__right,
  body.has-install-bar .hero__card {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }

  /* --- Espacamento interno do card do grafico --- */
  .hero__card > *:last-child,
  .hero__card .btn { margin-bottom: 0 !important; }
  .hero__card { padding-bottom: 16px !important; }
}

/* ==========================================================================
   27) CORRECAO FINAL v2 — glow, espacos e barra PWA
   ========================================================================== */
@media (max-width: 900px) {

  /* ---------- A. REMOVE todos os glows amarelos (visual limpo de app) ---------- */
  .btn--primary,
  .hero__form .btn,
  .hero__card .btn,
  .btn--block,
  button[type="submit"],
  .pwa-install-btn,
  .fchip.active,
  .chip.active,
  .wallet-tab.active {
    box-shadow: none !important;
    filter: none !important;
    -webkit-box-shadow: none !important;
  }

  /* Mantem apenas leve profundidade em elementos de destaque, sem "mancha" */
  .hero__card {
    box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 4px 16px rgba(0,0,0,.28) !important;
  }

  /* ---------- B. Espaco entre "Conta Apple" e o card ---------- */
  .hero {
    padding-bottom: 20px !important;
  }
  .hero__inner {
    gap: 16px !important;
    align-items: stretch;
  }
  .hero__left,
  .hero__right {
    margin: 0 !important;
    padding: 0 !important;
  }
  .hero__right {
    margin-top: 6px !important;
  }

  /* ---------- C. Barra de instalar: espaco real (sem cobrir card) ---------- */
  body.has-install-bar .hero__right,
  body.has-install-bar .hero__card {
    padding-bottom: 0 !important;
  }
  /* O <main> recebe o padding final, nao o card */
  body.has-install-bar main {
    padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)) !important;
  }
  /* Se nao houver <main>, aplica no ultimo bloco de conteudo */
  body.has-install-bar > .hero:last-of-type,
  body.has-install-bar > section:last-of-type {
    margin-bottom: 0 !important;
    padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ---------- D. Aplicar em TODAS as larguras mobile ---------- */
@media (hover: none) and (pointer: coarse) {
  .btn--primary, .hero__form .btn, button[type="submit"] {
    box-shadow: none !important;
    filter: none !important;
  }
}

/* ==========================================================================
   28) CORRECAO FINAL v3 — respiro do ticker e espaco da barra PWA
   ========================================================================== */
@media (max-width: 900px) {

  /* ---------- A. Ticker: respiro inicial e fade nas duas bordas ---------- */
  #ticker,
  .ticker {
    padding: 0 !important;
    /* fade suave nas bordas: nada parece "cortado", parece intencional */
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
  }
  #tickerTrack,
  .ticker__track {
    padding-left: 0 !important;
  }
  .ticker__item:first-child {
    padding-left: 16px !important;
  }

  /* ---------- B. Espaco REAL no fim: nada fica sob a barra de instalar ---------- */
  body.has-install-bar {
    /* reserva fixa no rodape do documento (funciona em qualquer estrutura) */
    padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Garante que o ultimo elemento visivel nao seja coberto */
  body.has-install-bar main,
  body.has-install-bar .page,
  body.has-install-bar .page-body,
  body.has-install-bar .container:last-of-type {
    padding-bottom: 24px !important;
  }

  /* O link "Ver todos os mercados" ganha respiro proprio */
  .section-head,
  .markets-head,
  .see-all-row {
    margin-bottom: 8px !important;
    padding-bottom: 8px !important;
  }

  /* ---------- C. Barra de instalar: altura e posicao estaveis ---------- */
  .pwa-install-bar {
    bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    padding: 10px 12px !important;
    min-height: 68px;
    max-height: 84px;
  }
  .pwa-install-icon {
    width: 44px !important;
    height: 44px !important;
    flex: 0 0 44px !important;
    border-radius: 12px !important;
    object-fit: cover !important;
  }
  .pwa-install-text {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center;
    line-height: 1.25 !important;
    gap: 1px;
  }
  .pwa-install-text strong { font-size: 14px !important; font-weight: 700 !important; }
  .pwa-install-text span { font-size: 12px !important; color: #9aa0aa !important; }
  .pwa-install-btn {
    flex: 0 0 auto !important;
    min-width: 82px !important;
    height: 42px !important;
    padding: 0 16px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    border-radius: 11px !important;
  }
  .pwa-install-close {
    flex: 0 0 32px !important;
    width: 32px !important;
    height: 32px !important;
    font-size: 20px !important;
  }
}

@media (max-width: 380px) {
  .pwa-install-text span { display: none !important; }
  .pwa-install-bar { min-height: 60px; }
  body.has-install-bar { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* ==========================================================================
   29) ULTIMO TAP TARGET — "Ver todas" (mercados)
   ========================================================================== */
@media (max-width: 900px) {
  .btn--link,
  .btn--sm.btn--link,
  .section-head .btn,
  .markets-head .btn,
  a.btn--link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 44px !important;
    min-width: 44px;
    padding: 10px 12px !important;
    line-height: 1 !important;
  }

  /* Nao deixa o texto quebrar em botoes pequenos */
  .btn--link, .btn--sm { white-space: nowrap; }
}

/* ==========================================================================
   30) Links gerados via JS (mercados, destaques)
   ========================================================================== */
@media (max-width: 900px) {
  .mk-highlight__link,
  #hlVerTodas,
  .mk-highlight a,
  [id^="hlVer"] {
    display: inline-flex !important;
    align-items: center !important;
    min-height: 44px !important;
    padding: 10px 12px !important;
    line-height: 1.2 !important;
    font-size: 14px !important;
  }
}
