/* Gutenberg Online — experiência compacta para celulares (22/11/2026).
 * Somente apresentação; não altera comandos, API, documentos ou sincronização.
 * Carregar DEPOIS de responsive-online.css e dos estilos das telas.
 */
@media (max-width: 767px) {
  :root { --mobile-tap: 44px; }
  html { scroll-padding-top: 64px; }
  .pagina-shell { width: calc(100% - 20px) !important; margin-top: 14px !important; }
  .pagina-editor-app .pagina-shell,
  .pagina-leitor-app .pagina-shell { width: calc(100% - 16px) !important; margin-top: 10px !important; }
  .conteudo-real, .conteudo-real > section, .conteudo-real > div { min-width: 0; }

  /* A primeira linha do cabeçalho recolhe ao rolar; as abas continuam visíveis. */
  .app-shell-header {
    top: -53px; min-height: 103px !important; padding: 8px 10px 9px !important;
    row-gap: 7px; column-gap: 8px;
    box-shadow: 0 7px 22px rgba(0,0,0,.14);
  }
  .app-shell-header .app-brand-mark { width: 35px; height: 35px; }
  .app-shell-header .app-brand-copy { display: flex !important; }
  .app-shell-header .app-brand-copy strong { font-size: .94rem; }
  .app-shell-header .online-logout .botao-secundario { min-height: 38px !important; }
  .app-shell-header .app-shell-nav {
    gap: 5px !important; padding: 3px !important;
    border-radius: 13px !important;
  }
  .app-shell-header .app-nav-item {
    min-height: var(--mobile-tap) !important; padding: 6px 3px !important;
    font-size: clamp(.69rem, 2.75vw, .8rem) !important;
    letter-spacing: -.01em; gap: 4px !important;
    border-radius: 10px;
  }
  .app-shell-header .app-nav-item .icone-svg { display: none; }

  /* Heróis: opções em duas colunas, ação principal com ênfase e largura total. */
  .hero { border-radius: 18px !important; padding: 17px 15px !important; margin-bottom: 14px !important; }
  .hero-linha-topo { display: flex !important; flex-direction: column !important; align-items: stretch !important; gap: 16px !important; min-height: 0 !important; }
  .hero-title-group { gap: 5px; }
  .hero-title-group h1 { font-size: clamp(1.65rem, 6.7vw, 2.1rem) !important; line-height: 1.14; }
  .hero-title-group p { font-size: .9rem !important; line-height: 1.45; }
  .hero-acoes {
    display: grid !important; grid-template-columns: repeat(2, minmax(0,1fr));
    align-items: stretch !important; gap: 8px !important; width: 100%;
  }
  .hero-acoes > * { min-width: 0 !important; width: 100% !important; max-width: 100% !important; margin: 0 !important; }
  .hero-acoes > :is(.botao-secundario,.botao-primario,.botao-destaque-navegacao) {
    min-width: 0 !important; min-height: 45px !important; padding: 9px 8px !important;
    font-size: .83rem !important; line-height: 1.2 !important;
    white-space: normal; text-align: center; gap: 6px;
    justify-content: center;
  }
  .hero-acoes .botao-com-icone .icone-img { flex: 0 0 16px; }
  .hero-acoes > .alternador-visualizacao { grid-column: 1/-1; min-height: 44px; }
  .hero-acoes > .botao-primario { grid-column: 1/-1; order: 20; min-height: 48px !important; }
  .hero-acoes .botao-visualizacao { min-height: 42px; }

  /* Cards e controles de biblioteca/projetos com densidade apropriada. */
  .grade-projetos { gap: 12px !important; }
  .card-projeto { border-radius: 16px !important; padding: 14px !important; gap: 12px; }
  .card-projeto .meta-grid { gap: 7px !important; }
  .card-projeto .acoes-card-compactas { display: grid !important; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .card-projeto .acoes-card-compactas > * { min-width: 0; width: 100%; justify-content: center; padding: 7px !important; min-height: var(--mobile-tap); }
  .painel-biblioteca-controles { padding: 10px !important; gap: 10px !important; margin-top: 14px !important; }
  .form-busca-biblioteca { min-width: 0; }
  .form-busca-biblioteca input { min-height: 46px !important; }
  .toggle-filtros, .toggle-filtros-centralizado { border-radius: 13px !important; padding: 4px !important; gap: 4px !important; }
  .toggle-filtro { min-width: 0; min-height: var(--mobile-tap); padding: 9px 6px !important; font-size: .82rem !important; border-radius: 9px !important; }
  .grade-biblioteca { gap: 12px !important; margin-top: 16px !important; }
  .grade-biblioteca .thumb-livro { border-radius: 14px; }
  .grade-biblioteca .botao-lixeira-livro,
  .grade-biblioteca .botao-status-lido { min-width: 42px; min-height: 42px; width: 42px; height: 42px; }
  .grade-biblioteca .card-livro > .botao-lixeira-livro { top: 6px; right: 6px; }
  .grade-biblioteca .card-livro > .botao-status-lido { top: 6px; left: 6px; }

  /* Projetos e roteiros: barra de ações curta e sem botões enormes em coluna. */
  .topo-projeto { border-radius: 17px !important; padding: 14px !important; gap: 15px !important; }
  .topo-projeto .coluna-capa-projeto { justify-content: center; }
  .topo-projeto .capa-projeto { width: min(128px, 42vw) !important; border-radius: 12px; }
  .topo-info-projeto { display: grid !important; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px !important; }
  .topo-info-projeto > * { min-width: 0; width: 100%; }
  .topo-info-projeto > :first-child { grid-column: 1/-1; }
  .topo-info-projeto > :is(button,a) { min-height: var(--mobile-tap); padding: 8px 6px !important; font-size: .78rem !important; justify-content: center; text-align:center; white-space:normal; }
  .grupo-acoes-topo,.grupo-acoes-topo-maior {
    display: grid !important; grid-template-columns: repeat(2,minmax(0,1fr));
    align-items: stretch; gap: 8px !important; min-width: 0 !important;
  }
  .grupo-acoes-topo > *, .grupo-acoes-topo-maior > * {
    width: 100%; min-width: 0; flex: none !important; min-height: 46px !important;
    padding: 9px 6px !important; font-size: .82rem !important;
    white-space: normal; text-align: center; justify-content: center;
  }
  .grupo-acoes-topo > :first-child { grid-column: 1/-1; }
  .item-capitulo { padding: 13px !important; border-radius: 14px !important; }
  .acoes-capitulo-inline { gap: 7px !important; }
  .acoes-capitulo-inline > * { min-height: var(--mobile-tap) !important; }

  /* Editor: cabeçalho compacto, ferramentas expandidas em grupos ordenados. */
  .pagina-editor-app .editor-topo { border-radius: 16px !important; padding: 12px !important; margin-bottom: 8px !important; }
  .pagina-editor-app .cabecalho-editor-grid { display: grid !important; grid-template-columns: minmax(0,1fr); gap: 9px; }
  .pagina-editor-app .cabecalho-editor-grid > * { min-width: 0; max-width: 100%; grid-column: 1/-1 !important; }
  .pagina-editor-app .cabecalho-editor-grid > .botao-voltar-estilizado { width: auto; justify-self: start; min-height: 40px; }
  .pagina-editor-app .cabecalho-editor-grid > .titulo-editor { width:100%; min-height: 45px !important; height: auto !important; text-align:left; font-size: 1.18rem !important; padding: 7px 10px !important; }
  .pagina-editor-app .status-salvamento { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-start; gap:7px !important; width:100%; }
  .pagina-editor-app .status-salvamento > :is(button,a) {
    flex: 1 1 120px; width: auto !important; min-width: 0 !important;
    min-height: 42px !important; padding: 8px 9px !important; justify-content:center;
    line-height: 1.2; text-align:center;
  }
  .pagina-editor-app .status-salvamento > .status-chip { flex:0 0 auto; }
  .pagina-editor-app .cabecalho-editor-meta-direita { min-width:0; width:100%; justify-content:flex-start; }
  .pagina-editor-app .barra-word-sticky, .pagina-editor-app .barra-roteiro-sticky { position: relative !important; top:auto !important; z-index:30; }
  .pagina-editor-app .barra-ferramentas {
    border-radius: 15px !important; padding: 9px !important; margin-bottom: 10px !important;
  }
  .pagina-editor-app .barra-word { display:flex !important; flex-direction:column; align-items:stretch; gap:8px !important; }
  .pagina-editor-app .barra-word > .grupo-ferramenta {
    box-sizing:border-box; display:flex !important; flex:0 0 auto !important;
    width:100% !important; max-width:100% !important; min-width:0 !important;
    flex-wrap:wrap !important; justify-content:flex-start !important;
    gap:5px !important; padding:7px !important; margin:0 !important;
    border:1px solid rgba(154,171,194,.13) !important; border-radius:11px;
    background:rgba(10,17,26,.36);
  }
  .pagina-editor-app .barra-word .botao-branco,
  .pagina-editor-app .barra-word .controle-menu-insercao-botao { min-width:42px !important; min-height:42px !important; height:42px !important; border-radius:9px !important; }
  .pagina-editor-app .barra-word select { max-width: min(100%,185px); }
  .pagina-editor-app .painel-editor { border-radius: 15px !important; padding: 9px !important; }
  .pagina-editor-app .pagina-editor:not(.pagina-roteiro) { padding: 16px 13px !important; border-radius: 10px !important; }
  .pagina-editor-app .editor-texto:not(.editor-roteiro) { min-height:50vh; padding: 8px 4px !important; }

  /* Alternância mobile: se JavaScript não carregar, as ferramentas seguem visíveis. */
  .mobile-tools-toggle {
    display: flex; justify-content: space-between; align-items:center;
    gap:10px; width:100%; min-height:46px; margin:0 0 8px;
    padding:10px 14px; border-radius:12px; border:1px solid rgba(135,158,212,.35);
    background:linear-gradient(90deg,#273854,#1c293c); color:#edf3ff;
    font:700 .87rem/1.25 system-ui,-apple-system,Segoe UI,sans-serif;
    cursor:pointer; text-align:left;
  }
  .mobile-tools-toggle::after { content:'⌄'; font-size:1.25rem; line-height:1; transition:transform .15s ease; }
  .mobile-tools-toggle[aria-expanded="true"]::after { transform: rotate(180deg); }
  .mobile-tools-toggle:focus-visible { outline:3px solid #9badff; outline-offset:2px; }
  .pagina-editor-app .barra-ferramentas.mobile-tools-collapsed { display: none !important; }
  .pagina-editor-app .barra-roteiro { display:flex; flex-direction:column; align-items:stretch; overflow:visible; gap:9px; }
  .pagina-editor-app .barra-roteiro-esquerda {
    display:flex; flex-wrap:wrap; overflow:visible; width:100%; gap:6px;
    padding:7px; border:1px solid rgba(154,171,194,.13); border-radius:11px;
  }
  .pagina-editor-app .barra-roteiro-esquerda .btn-tipo-bloco { flex: 1 1 70px; min-width:0; min-height:42px; }
  .pagina-editor-app .barra-roteiro-direita { width:100%; max-width:none; margin:0; padding:4px 0; flex-wrap:wrap; justify-content:flex-start; white-space:normal; }
  .pagina-editor-app .barra-roteiro .theme-select-wrap { flex:1 1 190px; min-width:0; }
  .pagina-editor-app .roteiro-layout { min-width:0; }
  .pagina-editor-app .roteiro-sidebar .sidebar-card-acoes { display:flex; flex-wrap:wrap; justify-content:center; gap:8px; }
  .pagina-editor-app .roteiro-sidebar .sidebar-card-acoes > * { flex:1 1 44px; }

  /* Leitores: acessibilidade por toque sem reduzir a folha de leitura. */
  .topo-leitor { padding:12px !important; border-radius:15px !important; }
  .topo-leitor .topo-leitor-acoes { gap:7px !important; }
  .topo-leitor :is(a,button) { min-height:44px; }
  .pdf-reader { padding:8px 0 28px !important; }
  .pdf-head { border-radius:16px; padding:10px 12px; gap:10px; margin-bottom:10px; }
  .pdf-back { min-width:44px; min-height:44px; padding:8px; }
  .pdf-kicker { letter-spacing:.09em; }
  .pdf-toolbar { gap:7px; padding:9px; border-radius:15px; }
  .pdf-toolbar-group { gap:6px; }
  .pdf-toolbar :is(button,.pdf-tool) { min-width:44px; min-height:44px; }
  .pdf-page-control input { width:58px !important; padding-inline:4px !important; }
  .pdf-stage { border-radius:13px; padding:7px; }

  /* Recursos, configurações e janelas. */
  .recursos-tabs { scroll-snap-type:x proximity; scroll-padding-inline:7px; gap:5px; }
  .recursos-tab { scroll-snap-align:start; min-height:44px !important; padding:10px 12px !important; white-space:nowrap; }
  .recursos-hero { border-radius:15px; }
  .resource-page-add, .info-format-btn { min-width:42px !important; min-height:42px !important; }
  .painel-configuracoes { padding:14px !important; border-radius:17px !important; }
  .topo-configuracoes h1 { font-size:clamp(1.2rem,4.8vw,1.55rem); line-height:1.22; }
  .form-config-grid { gap:9px !important; }
  .form-config-grid > label { padding:12px !important; }
  .form-config-grid > label input[type="range"] { min-height:32px; }
  .modal .modal-conteudo, .modal-leitor .modal-leitor-conteudo { border-radius:15px !important; padding:15px !important; }
  .modal-topo { gap:10px !important; }
  .modal :is(.botao-fechar,.botao-fechar-sumario) { width:44px !important; height:44px !important; min-width:44px; min-height:44px; }
  .modal .rodape-formulario { gap:9px !important; }
  .modal .rodape-formulario > :is(button,a) { min-height:44px; }
  .app-footer { margin-top:24px; }
}
@media (max-width: 380px) {
  .app-shell-header .app-brand-copy strong { font-size:.87rem; }
  .hero { padding:14px 12px !important; }
  .hero-acoes > :is(.botao-secundario,.botao-primario,.botao-destaque-navegacao) { font-size:.79rem !important; padding:8px 5px !important; }
  .topo-info-projeto > :is(button,a) { font-size:.75rem !important; }
  .pagina-editor-app .status-salvamento > :is(button,a) { flex-basis:115px; }
}
@media (max-width: 340px) {
  .app-shell-header .app-nav-item { font-size:.69rem !important; }
  .hero-acoes .botao-com-icone .icone-img { display:none; }
  .grupo-acoes-topo > *, .topo-info-projeto > :is(button,a) { font-size:.74rem !important; }
  .pdf-page-control { gap:3px; }
}
@media (min-width:768px) {
  .mobile-tools-toggle { display:none !important; }
}
