@charset "UTF-8";

/* ── PALCO 3D · AIMED BIO EP02 — TEMA ESCURO DE ALTO CONTRASTE (WCAG AA/AAA) ── */
:root {
  --palco: #04070C;
  --palco-2: #0B1220;
  --painel-bg: #080E1A;
  --card-bg: #0D1628;
  --card-bg-2: #111D33;
  --borda: #22324D;
  --borda-forte: #354E76;
  --tinta: #EEF2F7;
  --tinta-2: #C8D4E3;
  --tinta-3: #9BB0C9;
  --ouro: #FFD60A;
  --ciano: #38BDF8;
  --verde: #2EE585;
  --vermelho: #FF6B72;
  --vermelho-vivo: #E8343A;
  --laranja: #FF9F43;
  --mel: #FFB703;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --texto: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}

/* Modo de alto contraste extra (Tecla G ou botão na barra superior) */
html.contraste {
  --palco: #000000;
  --palco-2: #050912;
  --painel-bg: #03060C;
  --card-bg: #080F1E;
  --card-bg-2: #0D172B;
  --borda: #5A76A3;
  --borda-forte: #8FB0E0;
  --tinta: #FFFFFF;
  --tinta-2: #F1F5F9;
  --tinta-3: #D8E2EE;
  --ouro: #FFE838;
  --ciano: #67E8F9;
  --verde: #4ADE80;
  --vermelho: #FF8A90;
  --laranja: #FFB86C;
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  height: 100%;
  overflow: hidden;
  overflow-x: hidden;
  background-color: var(--palco);
  background-image: radial-gradient(110% 85% at 38% 42%, var(--palco-2) 0%, var(--palco) 70%);
  color: var(--tinta);
  font-family: var(--texto);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#app {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100vw;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

/* ── BARRA SUPERIOR (IDENTIDADE + 5 PASSOS + PT|EN + ACESSIBILIDADE) ── */
#topo {
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.9rem;
  background: rgba(4, 7, 12, 0.94);
  border-bottom: 1px solid var(--borda);
  min-width: 0;
  max-width: 100vw;
}

html.contraste #topo {
  background: #000000;
  border-bottom-width: 2px;
}

.topo-esq {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.marca-pilula {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.22rem 0.52rem;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.55);
  color: var(--ciano);
  white-space: nowrap;
  flex-shrink: 0;
}

.marca-ep {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--tinta);
  white-space: nowrap;
}

.badge-esq {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 214, 10, 0.55);
  background: rgba(255, 214, 10, 0.1);
  color: var(--ouro);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Navegação dos 5 passos */
#passos-bar {
  display: flex;
  gap: 0.38rem;
  min-width: 0;
  max-width: 48rem;
  width: 100%;
  justify-self: center;
}

.passo-btn {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.38rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--borda);
  background: var(--card-bg);
  color: var(--tinta-2);
  font-family: var(--texto);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.18s, background-color 0.18s, color 0.18s, transform 0.1s;
  touch-action: manipulation;
}

.passo-btn:hover {
  border-color: var(--ciano);
  color: var(--tinta);
}

.passo-btn:focus-visible,
.ctrl-btn:focus-visible,
#lang-switch button:focus-visible,
.nav-btn:focus-visible,
.sub-btn:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--ouro);
  outline-offset: 2px;
}

.passo-btn .num {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.72rem;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--tinta);
  flex-shrink: 0;
}

.passo-btn .rot {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.passo-btn.ativo {
  background: var(--ouro);
  border-color: var(--ouro);
  color: #04070C;
  font-weight: 700;
}

.passo-btn.ativo .num {
  background: #04070C;
  color: var(--ouro);
}

/* Controles à direita: PT | EN + Contraste + Som + Reset 3D */
.topo-dir {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

#lang-switch {
  display: inline-flex;
  border-radius: 8px;
  border: 1px solid var(--borda-forte);
  background: var(--card-bg);
  padding: 2px;
}

#lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--tinta-2);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  padding: 0.26rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  touch-action: manipulation;
}

#lang-switch button[aria-pressed="true"] {
  background: var(--ciano);
  color: #04070C;
  font-weight: 700;
}

.ctrl-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.32rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--borda);
  background: var(--card-bg);
  color: var(--tinta);
  font-family: var(--mono);
  font-size: 0.72rem;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}

.ctrl-btn:hover {
  border-color: var(--ciano);
}

.ctrl-btn[aria-pressed="true"] {
  border-color: var(--ouro);
  color: var(--ouro);
  background: rgba(255, 214, 10, 0.12);
}

.ctrl-btn svg {
  width: 15px;
  height: 15px;
  display: block;
}

/* ── GRADE PRINCIPAL: PALCO 3D LIVRE + PAINEL DIDÁTICO SEM SOBREPOSIÇÃO ── */
#palco-grade {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, min(43vw, 620px));
  width: 100%;
  max-width: 100vw;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

#palco-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background: radial-gradient(95% 85% at 50% 48%, #0E192D 0%, #04070C 74%);
}

#palco-wrap.modo-rx {
  background: radial-gradient(90% 85% at 50% 48%, #091524 0%, #020509 80%);
}

html.contraste #palco-wrap {
  background: #02050B;
}

#cena, #cena-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Grade radiográfica sutil apenas no Passo 3 */
#grade-rx {
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(56, 189, 248, 0.28);
  border-radius: 10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  background-image:
    linear-gradient(to right, rgba(56, 189, 248, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(56, 189, 248, 0.045) 1px, transparent 1px);
  background-size: 32px 32px;
}

#palco-wrap.modo-rx #grade-rx {
  opacity: 1;
}

/* HUDs internos do palco 3D */
.hud-palco {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  pointer-events: none;
  z-index: 4;
}

.topo-palco {
  top: 0.65rem;
}

.base-palco {
  bottom: 0.6rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--tinta-3);
}

.hud-tag {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.24rem 0.58rem;
  border-radius: 6px;
  background: rgba(4, 7, 12, 0.86);
  border: 1px solid var(--borda-forte);
  color: var(--tinta-2);
  max-width: 100%;
}

.hud-tag.hud-alerta {
  border-color: var(--ouro);
  color: var(--ouro);
  background: rgba(20, 16, 4, 0.92);
}

#hud-aviso {
  color: var(--ouro);
  font-weight: 600;
  background: rgba(4, 7, 12, 0.88);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
}

#hud-aviso:empty {
  display: none;
}

/* Indicador temporal do Passo 4 (Janela crítica ~2 horas) */
#hud-cronometro {
  position: absolute;
  left: 0.75rem;
  bottom: 2.1rem;
  width: min(21rem, calc(100% - 1.5rem));
  background: rgba(8, 14, 26, 0.92);
  border: 1px solid rgba(255, 107, 114, 0.65);
  border-radius: 10px;
  padding: 0.48rem 0.7rem;
  z-index: 4;
  pointer-events: none;
}

.crono-cab {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--tinta-2);
  margin-bottom: 0.3rem;
}

.crono-cab strong {
  color: var(--vermelho);
  font-size: 0.8rem;
  white-space: nowrap;
}

.crono-trilha {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.crono-barra {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ouro) 0%, var(--laranja) 55%, var(--vermelho-vivo) 100%);
  transition: width 0.12s linear;
}

/* Rótulos 3D projetados (sempre contidos dentro de #palco-wrap) */
#pins-3d {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
}

/* Linhas-guia (SVG) do ponto 3D até o rótulo deslocado para a lateral livre */
#pins-guias {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

#pins-guias line {
  stroke-width: 1.25;
  stroke-linecap: round;
  opacity: 0.9;
}

#pins-guias circle {
  stroke: #04070C;
  stroke-width: 1;
}

html.contraste #pins-guias line {
  stroke-width: 1.8;
  opacity: 1;
}

/* A posição vem por transform (JS); nasce invisível até a 1ª projeção */
.pin-3d {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  will-change: transform;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.22;
  padding: 0.22rem 0.48rem;
  border-radius: 6px;
  background: rgba(4, 7, 12, 0.92);
  border: 1px solid var(--c, var(--ciano));
  color: var(--tinta);
  max-width: min(11.5rem, 40vw);
  text-align: left;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
  transition: opacity 0.2s ease;
}

html.contraste .pin-3d {
  background: #000000;
  border-width: 2px;
}

.pin-3d b {
  color: var(--c, var(--ciano));
  font-weight: 700;
}

/* ── PAINEL DIDÁTICO LATERAL / INFERIOR ── */
#painel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  min-width: 0;
  min-height: 0;
  background: var(--painel-bg);
  border-left: 1px solid var(--borda);
  overflow: hidden;
}

html.contraste #painel {
  border-left-width: 2px;
}

#painel-corpo {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.15rem 1.25rem calc(2rem + env(safe-area-inset-bottom, 0px));
  scroll-padding-bottom: 2rem;
  min-width: 0;
  touch-action: pan-y;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.passo-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ciano);
  margin-bottom: 0.35rem;
}

.passo-kicker .tag-esq {
  display: none; /* selo repetido: o #hud-esquematico do palco fica sempre visível */
  color: var(--ouro);
  border: 1px solid rgba(255, 214, 10, 0.45);
  padding: 0.1rem 0.42rem;
  border-radius: 4px;
  font-size: 0.64rem;
  letter-spacing: 0.08em;
}

.passo-titulo {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.32rem, 2.1vw, 1.85rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--tinta);
  margin: 0 0 0.55rem;
}

.passo-lead {
  font-size: 0.98rem;
  line-height: 1.52;
  color: var(--tinta-2);
  margin: 0 0 0.85rem;
}

.passo-lead strong {
  color: var(--tinta);
  font-weight: 600;
}

/* Barra de sub-modos interativos dentro do passo */
.sub-controles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
  margin: 0 0 0.85rem;
}

.sub-btn {
  appearance: none;
  border: 1px solid var(--borda-forte);
  background: var(--card-bg);
  color: var(--tinta-2);
  font-family: var(--mono);
  font-size: 0.73rem;
  font-weight: 600;
  padding: 0.36rem 0.62rem;
  border-radius: 7px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.sub-btn:hover {
  border-color: var(--ciano);
  color: var(--tinta);
}

.sub-btn.ativo {
  background: var(--ciano);
  border-color: var(--ciano);
  color: #04070C;
  font-weight: 700;
}

.sub-btn.acao {
  border-color: rgba(255, 214, 10, 0.6);
  color: var(--ouro);
}

/* Cartões didáticos e comparativos */
.grade-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.58rem;
  margin-bottom: 0.85rem;
}

.grade-cards.dupla {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-clinico {
  background: var(--card-bg);
  border: 1px solid var(--borda);
  border-left: 3px solid var(--c, var(--ciano));
  border-radius: 9px;
  padding: 0.68rem 0.8rem;
  min-width: 0;
}

.card-clinico .cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c, var(--ciano));
  margin-bottom: 0.25rem;
}

.card-clinico h3 {
  font-family: var(--display);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--tinta);
  margin: 0 0 0.25rem;
  line-height: 1.25;
}

.card-clinico p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--tinta-2);
}

.card-clinico p strong {
  color: var(--tinta);
}

/* Diagrama SVG esquemático complementar (Passo 3: Halo & Step-off) */
.esquema-svg-box {
  background: var(--card-bg-2);
  border: 1px solid var(--borda);
  border-radius: 9px;
  padding: 0.6rem;
  margin-bottom: 0.85rem;
}

.esquema-svg-box svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Destaque de protocolo (Passo 5: Regra do Mel NCPC) */
.alerta-emergencia {
  background: rgba(232, 52, 58, 0.11);
  border: 1px solid var(--vermelho);
  border-radius: 10px;
  padding: 0.72rem 0.85rem;
  margin-bottom: 0.75rem;
}

.alerta-emergencia h3 {
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 800;
  color: var(--vermelho);
  margin: 0 0 0.25rem;
}

.alerta-emergencia p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--tinta);
}

.protocolo-mel {
  background: rgba(255, 183, 3, 0.09);
  border: 1px solid var(--ouro);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.75rem;
}

.protocolo-mel h3 {
  font-family: var(--display);
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ouro);
  margin: 0 0 0.38rem;
}

.lista-criterios {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.36rem;
}

.lista-criterios li {
  position: relative;
  padding-left: 1.15rem;
  font-size: 0.87rem;
  line-height: 1.42;
  color: var(--tinta-2);
}

.lista-criterios li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.44rem;
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 2px;
  background: var(--c, var(--ouro));
}

.lista-criterios li strong {
  color: var(--tinta);
}

/* Referências científicas recolhíveis/visíveis */
details.refs-box {
  background: var(--card-bg);
  border: 1px solid var(--borda);
  border-radius: 9px;
  padding: 0.58rem 0.78rem;
  margin-top: 0.75rem;
}

details.refs-box summary {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ciano);
  cursor: pointer;
  user-select: none;
}

.refs-lista {
  margin: 0.55rem 0 0;
  padding-left: 1.15rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--tinta-2);
  display: grid;
  gap: 0.42rem;
}

.refs-lista a {
  color: var(--ciano);
  text-decoration: underline;
}

/* Assinatura médica obrigatória (CFM 2.336/2023) */
.assinatura-medica {
  margin-top: 0.85rem;
  padding-top: 0.68rem;
  border-top: 1px solid var(--borda);
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.48;
  color: var(--tinta-3);
}

.assinatura-medica.destaque {
  background: var(--card-bg-2);
  border: 1px solid var(--borda-forte);
  border-radius: 8px;
  padding: 0.65rem 0.78rem;
  color: var(--tinta-2);
}

/* Rodapé de navegação Anterior / Próximo */
#nav-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.58rem 1rem calc(0.58rem + env(safe-area-inset-bottom, 0px));
  background: rgba(4, 7, 12, 0.96);
  border-top: 1px solid var(--borda);
  min-width: 0;
}

.nav-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.46rem 0.88rem;
  border-radius: 8px;
  border: 1px solid var(--borda-forte);
  background: var(--card-bg);
  color: var(--tinta);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}

.nav-btn:hover:not(:disabled) {
  border-color: var(--ciano);
}

.nav-btn.nav-primario {
  background: var(--ouro);
  border-color: var(--ouro);
  color: #04070C;
  font-weight: 700;
}

.nav-btn:disabled {
  opacity: 0.38;
  cursor: default;
}

.nav-centro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.24rem;
  min-width: 0;
}

#passo-indicador {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--tinta-2);
}

.pontos-progresso {
  display: flex;
  gap: 5px;
}

.pontos-progresso i {
  width: 14px;
  height: 4px;
  border-radius: 999px;
  background: var(--borda);
  transition: background-color 0.25s, width 0.25s;
}

.pontos-progresso i.on {
  background: var(--ouro);
  width: 22px;
}

#barra-tempo {
  position: fixed;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 20%;
  background: var(--ciano);
  z-index: 20;
  pointer-events: none;
  transition: width 0.35s ease;
}

/* Critérios do mel em 2 colunas quando o painel tem ~600 px ou mais
   (empilhado: painel = largura da tela; lado a lado: painel chega a 600 px perto de 1400 px) */
@media (min-width: 600px) and (max-width: 960px), (min-width: 1400px) {
  .lista-criterios {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1rem;
  }

  .lista-criterios li:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

/* Barra superior: libera largura para as abas antes de qualquer rótulo cortar */
@media (max-width: 1480px) {
  .ctrl-txt {
    display: none;
  }

  .ctrl-btn {
    padding: 0.3rem 0.45rem;
  }
}

@media (max-width: 1320px) {
  #ui-badge-modelo {
    display: none; /* selo repetido: o #hud-esquematico do palco continua visível */
  }
}

@media (max-width: 1140px) {
  .marca-ep {
    display: none;
  }
}

/* ── RESPONSIVIDADE ESTRITA: TABLET E MOBILE ATÉ 375×667 (ZERO OVERFLOW) ── */
@media (max-width: 960px) {
  #topo {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 0.38rem 0.4rem;
    padding: 0.38rem 0.55rem;
  }

  .topo-esq {
    grid-column: 1;
    grid-row: 1;
  }

  .topo-dir {
    grid-column: 2;
    grid-row: 1;
    gap: 0.25rem;
  }

  #passos-bar {
    grid-column: 1 / -1;
    grid-row: 2;
    max-width: none;
    gap: 0.25rem;
  }

  .marca-ep {
    display: none;
  }

  .ctrl-txt {
    display: none;
  }

  .ctrl-btn {
    padding: 0.3rem 0.45rem;
  }

  #palco-grade {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(230px, 46vh) minmax(0, 1fr);
  }

  #painel {
    border-left: 0;
    border-top: 1px solid var(--borda);
  }

  #painel-corpo {
    padding: 0.75rem 0.82rem calc(1.6rem + env(safe-area-inset-bottom, 0px));
  }

  /* Passo 5: cards de conduta mais compactos */
  .alerta-emergencia,
  .protocolo-mel {
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.55rem;
  }

  .alerta-emergencia h3,
  .protocolo-mel h3 {
    font-size: 0.92rem;
    line-height: 1.25;
  }

  .alerta-emergencia p {
    font-size: 0.86rem;
    line-height: 1.42;
  }

  .lista-criterios {
    gap: 0.28rem 1rem;
  }

  .lista-criterios li {
    font-size: 0.84rem;
    line-height: 1.38;
  }
}

/* Celular deitado: palco e painel lado a lado para o painel não sumir */
@media (max-width: 960px) and (orientation: landscape) and (max-height: 520px) {
  #palco-grade {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 46vw);
    grid-template-rows: minmax(0, 1fr);
  }

  #painel {
    border-top: 0;
    border-left: 1px solid var(--borda);
  }

  .lista-criterios {
    grid-template-columns: 1fr;
  }
}

/* Abas compactas: inativas mostram só o número; a ativa cresce com o rótulo inteiro */
@media (max-width: 760px) {
  #passos-bar {
    gap: 0.25rem;
  }

  .passo-btn {
    flex: 0 1 2.9rem;
    min-width: 2rem;
    min-height: 2.15rem;
    padding: 0.28rem 0.3rem;
  }

  /* Rótulo das inativas fica só para leitores de tela */
  .passo-btn:not(.ativo) .rot {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .passo-btn.ativo {
    flex: 1 0 auto;
    padding: 0.28rem 0.6rem;
  }

  .passo-btn.ativo .rot {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
  }
}

@media (max-width: 560px) {
  .marca-pilula {
    font-size: 0.64rem;
    padding: 0.16rem 0.38rem;
  }

  .badge-esq {
    font-size: 0.6rem;
    padding: 0.14rem 0.38rem;
  }

  #lang-switch button {
    font-size: 0.68rem;
    padding: 0.22rem 0.38rem;
  }

  .passo-btn {
    border-radius: 7px;
    font-size: 0.76rem;
    line-height: 1.1;
  }

  .passo-btn .num {
    width: 1.2rem;
    height: 1.2rem;
    font-size: 0.68rem;
  }

  .topo-palco {
    top: 0.4rem;
    left: 0.45rem;
    right: 0.45rem;
  }

  .base-palco {
    bottom: 0.35rem;
    left: 0.45rem;
    right: 0.45rem;
    font-size: 0.58rem;
  }

  .hud-tag {
    font-size: 0.58rem;
    padding: 0.16rem 0.4rem;
  }

  #hud-cronometro {
    left: 0.45rem;
    bottom: 1.65rem;
    padding: 0.32rem 0.5rem;
  }

  .pin-3d {
    font-size: 0.6rem;
    padding: 0.14rem 0.34rem;
    max-width: 34vw;
  }

  .passo-titulo {
    font-size: 1.16rem;
    margin-bottom: 0.38rem;
  }

  .passo-lead {
    font-size: 0.88rem;
    margin-bottom: 0.65rem;
  }

  .grade-cards.dupla {
    grid-template-columns: 1fr;
  }

  #nav-bar {
    padding: 0.42rem 0.6rem calc(0.42rem + env(safe-area-inset-bottom, 0px));
    gap: 0.4rem;
  }

  .nav-btn {
    padding: 0.38rem 0.62rem;
    font-size: 0.72rem;
  }
}
