/* Controles de navegação ficam à mão enquanto o conteúdo rola entre eles. */
@media screen and (max-width: 750px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  .mast { padding-top: max(6px, env(safe-area-inset-top)); }
  .mast .topic-switch { justify-self: stretch; margin-left: auto; width: min(100%, 245px); min-width: 0; }
  .mast .topic-switch select { min-width: 0; font-size: 16px; line-height: 1.2; }
  #periods button, .rs-tabs button, .cb-switch button, .fo-switch button { min-height: 44px; }
  #periods { width: 100%; }
  .dock { margin-bottom: max(4px, env(safe-area-inset-bottom)); }
  .dock a { min-width: 0; min-height: 46px; }
  body .reading-viewport main { padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right)); }
  .reading-viewport main .pagehead h1 { overflow-wrap: break-word; text-wrap: balance; line-height: 1.08; }
  .reading-viewport .page, .reading-viewport footer, .cm-scroll { min-width: 0; }
  .reading-viewport footer { flex-wrap: wrap; gap: 8px 12px; }
  .reading-viewport footer a, .reading-viewport footer summary { overflow-wrap: anywhere; }
  .scroll { max-width: 100%; overscroll-behavior-x: contain; }
  body :is(input[type=search], .field input, .field select, .bp-tools select, .tb-tools select, .hist-fields select) { font-size: 16px; min-height: 44px; max-width: 100%; }
  .rs-topline button, #tb-compare, .cb-lookup, .fo-tools button, .fo-links button, .cm-filters select { min-height: 44px; }
  .fo-tools, #tb-compare { position: static; margin: 0 0 6px; }
  .fo-tools { text-align: right; }
  #tb-compare { margin-left: auto; }
  .rs-topline { gap: 4px 8px; }
  .rs-kpi-title { min-height: 1.2em; }
  .rs-values, .rs-insight, .cb-kpi-hint, .fo-split, .bp-list .bp-results { font-size: 12px; line-height: 1.25; }
  .rs-bar-line { padding-block: 5px; }
  .cb-legend-row, .fo-rank, .tb-sdr-row { min-height: 38px; }
  .bp-person-btn, .bp-value { min-height: 40px; }
  .bp-list, #tb-ranking { height: clamp(148px, 25dvh, 240px); }
  #cb-insight-list, #team-board #tb-insights { grid-template-columns: 1fr; gap: 8px; }
  .cb-insight { min-height: 44px; justify-content: center; padding-left: 9px; }
  .cb-insight b { font-size: 14px; }
  .cb-insight span { font-size: 12px; line-height: 1.3; }
  .cm-filters { gap: 10px; }
  .cm-filters .field:first-child { grid-column: 1/-1; }
  :is(#resumo-modal,#credit-modal,#team-modal,#fontes-modal) {
    position: fixed; inset: auto 0 var(--keyboard-inset, 0px); margin: 0 auto;
    width: 100%; max-width: 100%; max-height: calc(var(--visible-height, 100dvh) - max(12px, env(safe-area-inset-top)));
    border-radius: 20px 20px 0 0; overflow: hidden;
  }
  .cm-head { flex: none; padding: 12px max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left)); }
  .cm-head h2 { font-size: clamp(19px, 5vw, 25px); overflow-wrap: anywhere; }
  .cm-head :is(#cm-close,#tm-close,#fo-close,#rs-close) { width: 44px; height: 44px; }
  .cm-scroll { padding: 12px max(14px, env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left)); scroll-padding-block: 12px; }
  .cm-group tbody td[data-label] { text-align: left; overflow-wrap: anywhere; }
  .cb-other { padding: 6px 2px; }
}
@media screen and (min-width: 376px) and (max-width: 740px) {
  #team-board { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 6px; align-items: center; }
  #tb-kpis { grid-area: 1 / 1 / 2 / -1; }
  #tb-switch { grid-area: 2 / 1; margin: 6px 0 0; }
  #tb-compare { grid-area: 2 / 2; margin: 6px 0 0; padding-inline: 8px; font-size: 12px; }
  #team-board :is(.tb-charts,.cb-insights) { grid-column: 1 / -1; }
  #team-board #tb-insights { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #tb-ranking { height: clamp(110px, 15dvh, 150px); }
}
@media screen and (max-width: 650px) {
  .mast { grid-template-columns: minmax(96px, .75fr) minmax(0, 1.45fr); }
  .mast .wordmark { max-width: 100%; }
  .mast .topic-switch { justify-content: center; min-height: 44px; }
  body:not([data-subject=abertura]) .fabric { width: 26vw; opacity: .68; }
}
@media screen and (max-width: 375px) {
  .cm-filters, .tb-tools, .bp-tools { grid-template-columns: minmax(0, 1fr); }
  .rs-topline, .fo-strip { flex-wrap: wrap; }
}
@media screen and (orientation: landscape) and (max-height: 520px) and (pointer: coarse) {
  .mast { padding-inline: max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-right)); }
  .mast #periods { width: min(42%, 360px); }
  .dock { margin-bottom: env(safe-area-inset-bottom); }
  .reading-viewport main { padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right)); }
  :is(#resumo-modal,#credit-modal,#team-modal,#fontes-modal) { max-height: calc(var(--visible-height,100dvh) - 8px); }
}
.fabric.mobile-float { animation: moreja-flutuar 7s ease-in-out infinite alternate; will-change: translate; }
.fabric.mobile-float.paused { animation-play-state: paused; }
@keyframes moreja-flutuar { to { translate: 0 -7px; } }
