/* ==========================================================================
   FALCTEC - RESPONSIVIDADE (mobile-first overrides, carregado por último)
   Alvos de toque >= 44px, sem rolagem horizontal da página, navegação ao alcance do polegar.
   ========================================================================== */

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
img, canvas, svg { max-width: 100%; }
.rotulo-curto { display: none; }
.tech-table-container, .rankings-tab-container { max-width: 100%; }
.tech-table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tech-table-container .tech-table { min-width: 640px; }
@media (min-width: 701px) { .exec-card, .titan-card { min-width: 0; } }

/* Tablet e abaixo */
@media (max-width: 900px) {
  .container { padding-left: 16px; padding-right: 16px; }
  .table-switcher-bar, .rankings-tab-bar, .rank-subview-toggle, .glossary-filter-bar {
    overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .table-switcher-bar > *, .rankings-tab-bar > *, .rank-subview-toggle > *, .glossary-filter-bar > * { flex: 0 0 auto; white-space: nowrap; }
  .ranking-intro-header { flex-direction: column; align-items: stretch; }
  .ranking-champion-badge { max-width: 100%; white-space: normal; }
  .tech-meta-badges { flex-wrap: wrap; }
}

/* Celular */
@media (max-width: 700px) {
  body { padding-bottom: calc(92px + env(safe-area-inset-bottom)); font-size: 16px; }
  .rotulo-longo { display: none; }
  .rotulo-curto { display: inline; }

  /* Cabeçalho compacto e não fixo: libera a tela para o conteúdo */
  .site-header { position: static; padding: 10px 0; }
  .header-inner { gap: 10px; }
  .logo-sub { display: none; }
  .header-actions { display: grid; grid-template-columns: 44px 1fr 1fr 1fr; gap: 8px; width: 100%; }
  .btn-cv-trigger, .btn-theme-toggle { min-height: 44px; font-size: .68rem; padding: 6px 2px; gap: 4px; white-space: nowrap; justify-content: center; overflow: hidden; }
  .btn-cv-trigger .pulse-dot { display: none; }
  .btn-theme-toggle { width: 44px; height: 44px; }

  /* Navegação dos 3 modos: Floating Cyber Dock na base (alcance do polegar) */
  .control-bar-wrapper { position: static; padding: 12px 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .mode-switcher {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 140;
    width: calc(100% - 24px);
    max-width: 440px;
    margin: 0 auto;
    border-radius: 20px;
    border: 1px solid rgba(0, 240, 255, 0.22);
    padding: 5px;
    background: rgba(7, 10, 16, 0.86);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65), 0 0 24px rgba(0, 240, 255, 0.1), inset 0 1px 1px rgba(255, 255, 255, 0.14);
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: visible;
    transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, box-shadow 0.3s ease;
    will-change: transform, opacity;
  }
  .mode-switcher.dock-recolhido {
    transform: translateY(calc(100% + 28px));
    opacity: 0;
    pointer-events: none;
  }
  body.light-theme .mode-switcher {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(14, 116, 144, 0.25);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.16), 0 0 20px rgba(14, 116, 144, 0.1), inset 0 1px 1px #fff;
  }
  .mode-btn {
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-height: 52px;
    padding: 6px 4px 5px;
    font-size: .74rem;
    font-weight: 700;
    border-radius: 15px;
    position: relative;
    border: 1px solid transparent;
    color: var(--text-muted);
    transition: transform 0.18s ease, background 0.22s ease, border-color 0.22s ease, color 0.22s ease, box-shadow 0.22s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .mode-btn:active {
    transform: scale(0.92);
  }
  .mode-btn .mode-icon, .mode-btn > span:first-child {
    font-size: 1.25rem;
    line-height: 1;
    display: inline-block;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .mode-btn.active .mode-icon, .mode-btn.active > span:first-child {
    transform: translateY(-2px) scale(1.14);
  }
  /* Led superior indicador da aba ativa */
  .mode-btn.active::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 3px;
    border-radius: 99px;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
  }
  /* Estilos específicos de cada modo no mobile */
  .mode-btn.active[data-mode="executive"] {
    background: linear-gradient(145deg, rgba(0, 255, 136, 0.16), rgba(0, 208, 255, 0.06));
    border-color: rgba(0, 255, 136, 0.45);
    color: var(--accent-green);
    box-shadow: 0 4px 14px rgba(0, 255, 136, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }
  .mode-btn.active[data-mode="battle"] {
    background: linear-gradient(145deg, rgba(255, 170, 0, 0.22), rgba(255, 51, 85, 0.12));
    border-color: rgba(255, 170, 0, 0.55);
    color: var(--accent-amber);
    box-shadow: 0 4px 16px rgba(255, 170, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  }
  .mode-btn.active[data-mode="technical"] {
    background: linear-gradient(145deg, rgba(0, 240, 255, 0.18), rgba(80, 110, 255, 0.08));
    border-color: rgba(0, 240, 255, 0.48);
    color: var(--accent-cyan);
    box-shadow: 0 4px 16px rgba(0, 240, 255, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }
  /* Chip chamativo de RPG no modo batalha */
  .mode-rpg-chip {
    position: absolute;
    top: -4px;
    right: 4px;
    font-size: 0.55rem;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 99px;
    background: linear-gradient(90deg, #ff3355, #ffaa00);
    color: #fff;
    letter-spacing: 0.5px;
    box-shadow: 0 0 8px rgba(255, 51, 85, 0.6);
    animation: rpgChipPulse 2s infinite ease-in-out;
  }
  @keyframes rpgChipPulse {
    0%, 100% { transform: scale(1); opacity: 0.95; }
    50% { transform: scale(1.12); opacity: 1; filter: brightness(1.2); }
  }
  .search-input { min-height: 44px; font-size: 16px; } /* 16px evita zoom automático no iOS */

  /* Hero */
  .hero-section { padding-top: 24px; }
  .hero-profile-avatar-frame { width: 120px; height: 120px; }
  .hero-profile-card button { display: none; }
  #hero-sociais { justify-content: center; }
  .rodape-social { width: 44px; height: 44px; }
  .hero-stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-val { font-size: 1.5rem; }
  .stat-label { font-size: .78rem; }
  .stat-sub { font-size: .7rem; }

  /* Executivo */
  .roi-banner { flex-direction: column; text-align: center; gap: 16px; padding: 24px 18px; }
  .exec-kpi-strip { grid-template-columns: 1fr 1fr; gap: 10px; }
  .exec-kpi { padding: 16px 12px; }
  .exec-kpi-sub { display: none; }
  .exec-grid, .titans-grid { grid-template-columns: 1fr; }
  .exec-bloco { margin-top: 40px; }

  /* Batalha */
  .arena-hero-heading { font-size: 1.35rem; letter-spacing: 1px; }
  .arena-hero-sub { font-size: .75rem; }
  .arena-banner-overlay { padding: 24px 16px 16px; }
  .arena-cinematic-banner { max-height: 260px; }
  .roster-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .battle-card { padding: 22px 14px 18px; }
  .battle-matchup { gap: 10px; }
  .vs-badge { margin: 0 auto; }
  .fighter-detail-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .fighter-metrics-grid, .fighter-pros-cons { grid-template-columns: 1fr; }
  #arena-fx { opacity: .7; }

  /* Técnico */
  .tech-header-panel { padding: 18px 14px; }
  .tech-header-panel h2 { font-size: 1.25rem !important; }
  .glossary-grid, .arch-comparison-grid, .tech-formula-grid, .tech-reco-grid, .tech-limit-grid { grid-template-columns: 1fr; }
  .t-switch-btn, .rank-tab-btn, .rank-sub-btn, .gloss-filter-btn { min-height: 44px; }
  .tech-table { font-size: .78rem; }
  .tech-table th, .tech-table td { padding: 10px 10px; }
  .table-scroll-hint { display: block; }
  .section-title { font-size: 1.15rem; }

  /* Contatos e rodapé */
  .contatos-topo { flex-direction: column; text-align: center; }
  .contato-card { min-height: 64px; }
  .contatos-cta { width: 100%; justify-content: center; }
  .site-footer { padding-bottom: 24px; }
  #rodape-sociais { justify-content: center; }

  /* Dossiê (bottom sheet) */
  .cv-close-btn, .cv-tab-btn { min-height: 44px; }
}

/* Telas muito pequenas */
@media (max-width: 380px) {
  .roster-grid { grid-template-columns: 1fr 1fr; }
  .hero-title { font-size: 1.5rem; }
  .exec-rank-linha { grid-template-columns: 26px 78px 1fr 58px; font-size: .78rem; }
}

/* Paisagem curta */
@media (max-height: 480px) and (orientation: landscape) {
  .mode-switcher { position: static; }
  body { padding-bottom: 0; }
}

@media (max-width: 700px) {
  .fighter-stats-bars { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .cv-modal-header > div:first-child { flex-wrap: wrap; min-width: 0; }
  .cv-avatar-box { flex: 0 0 64px; width: 64px; height: 64px; }
  .cv-avatar-img { width: 64px; height: 64px; object-fit: cover; border-radius: 50%; }
  .cv-header-info { flex: 1 1 160px; min-width: 0; }
  .cv-header-info h2 { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
  .cv-status-pill { font-size: .6rem; }
  .cv-header-title { font-size: .78rem; line-height: 1.4; }
}

.timeline-atual { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 4px; font-family: var(--font-mono); font-size: .62rem; letter-spacing: 1px; vertical-align: middle; color: #000; background: var(--accent-green); }

/* Duelo mantém duas colunas no celular (sobrescreve regras antigas de pilha vertical) */
@media (max-width: 900px) { .duelo { grid-template-columns: 1fr 1fr; } }

/* O dock fixo precisa ficar acima do conteúdo: o contêiner da barra não pode criar um contexto de empilhamento menor que o do conteúdo */
@media (max-width: 700px) {
  .control-bar-wrapper, .control-bar { position: static; z-index: auto; }
  main#view-root { z-index: 1; }
  .mode-switcher { z-index: 200; }
}
.exec-bloco + .section-title, .exec-bloco + .exec-grid, .exec-bloco ~ .section-title { margin-top: 56px; }
