/* Navegacao flutuante e pagina inicial em formato de cenario. */

.topbar,
body[data-design="light"] .topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 70;
  width: 100%;
  height: 0;
  min-height: 0;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
  transition: height 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.app-home-button,
.navigation-menu-button {
  width: 66px;
  height: 66px;
  min-height: 66px;
  position: fixed;
  top: clamp(18px, 3.5vh, 30px);
  z-index: 73;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 0;
  border: 2px solid rgba(150, 211, 246, 0.72);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 0 rgba(190, 220, 237, 0.9), 0 12px 26px rgba(24, 91, 130, 0.2);
  pointer-events: auto;
  transition: top 180ms ease, width 180ms ease, height 180ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.app-home-button {
  left: clamp(18px, 2.6vw, 34px);
}

.navigation-menu-button {
  right: clamp(18px, 2.6vw, 34px);
  color: var(--app-blue);
}

.app-home-button:focus-visible,
.navigation-menu-button:focus-visible {
  border-color: #56bdf3;
  background: #ffffff;
  transform: translateY(-2px);
}
@media (hover: hover) and (pointer: fine) {
.app-home-button:hover,.navigation-menu-button:hover {
  border-color: #56bdf3;
  background: #ffffff;
  transform: translateY(-2px);
}
}

.app-home-button:active,
.navigation-menu-button:active {
  transform: translateY(3px) scale(0.98);
  box-shadow: 0 2px 0 rgba(190, 220, 237, 0.9), 0 6px 14px rgba(24, 91, 130, 0.16);
}

.navigation-menu-button .app-control-image,
.app-home-button .app-control-image {
  width: 43px;
  height: 43px;
}

.top-controls {
  width: max-content;
  max-width: calc(100vw - 138px);
  position: fixed;
  top: clamp(20px, 3.5vh, 32px);
  right: clamp(96px, 9vw, 112px);
  z-index: 72;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 6px;
  border: 1px solid rgba(205, 222, 234, 0.95);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 34px rgba(32, 71, 98, 0.2);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(24px) scale(0.97);
  transform-origin: right center;
  transition: opacity 150ms ease, transform 180ms ease, visibility 0s linear 180ms;
  scrollbar-width: none;
}

.top-controls::-webkit-scrollbar {
  display: none;
}

.navigation-menu-open .top-controls {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0) scale(1);
  transition: opacity 150ms ease, transform 180ms ease, visibility 0s;
}

.top-controls .tabs {
  width: auto;
  min-width: max-content;
  grid-column: auto;
  display: flex;
  flex-wrap: nowrap;
  justify-self: auto;
  gap: 3px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.top-controls .tabs .tab {
  min-width: 0;
  min-height: 48px;
  display: flex;
  flex: 0 0 auto;
  flex-direction: row;
  gap: 6px;
  padding: 0 12px;
  border-radius: 11px;
  color: #171c24;
  font-size: 0.77rem;
}

.top-controls .tabs .tab-icon {
  color: #171c24;
  font-size: 0.95rem;
}

/* Voz de leitura no menu da engrenagem: rótulo pequeno em cima, lista e botão de ouvir lado a lado. */
.voice-settings {
  height: 48px;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding-left: 10px;
  border-left: 1px solid #e0eaf1;
}

.voice-settings-field {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 32px;
  gap: 3px;
}

.voice-settings-field > span {
  padding-left: 2px;
  color: #6a8190;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.voice-settings select {
  width: clamp(150px, 17vw, 196px);
  height: 32px;
  min-height: 32px;
  padding: 0 34px 0 12px;
  border: 1.5px solid #cfe2ee;
  border-radius: 10px;
  background-color: #f4faff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231ca7f2' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 14px;
  color: #17232d;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.voice-preview-button {
  width: 40px;
  height: 40px;
  min-height: 40px;
  display: grid;
  flex: 0 0 auto;
  align-self: flex-end;
  place-items: center;
  margin-bottom: -4px;
  padding: 0 0 0 3px;
  border: 0;
  border-radius: 50%;
  background: var(--app-blue, #1ca7f2);
  box-shadow: 0 3px 0 #0f78b5;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform 120ms ease, background-color 140ms ease;
}

.voice-preview-button:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #0f78b5;
}

@media (hover: hover) and (pointer: fine) {
.voice-settings select:hover:not(:disabled) {
  border-color: #8fcdee;
  background-color: #eaf6ff;
}

.voice-preview-button:hover:not(:disabled) {
  background: #149ae2;
}
}

.voice-preview-button:focus-visible,
.voice-settings select:focus-visible {
  outline: 3px solid rgba(39, 169, 229, 0.3);
  outline-offset: 2px;
}

.voice-preview-button:disabled,
.voice-settings select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.top-controls .utility-actions {
  grid-column: auto;
  justify-self: auto;
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
  padding-left: 5px;
  border-left: 1px solid #e0eaf1;
}

.top-controls .utility-actions .screen-control-button {
  width: 48px;
  height: 48px;
  min-height: 48px;
  display: grid;
  border-radius: 11px;
  box-shadow: none;
}

.top-controls .utility-actions .app-control-image {
  width: 31px;
  height: 31px;
}

/* Tela cheia e cadeado só aparecem dentro dos módulos; no menu da engrenagem não fazem sentido. */
body:not([data-app-view="treino"]):not(.training-fullscreen) .top-controls .utility-actions {
  display: none;
}

body[data-design="dark"] .top-controls {
  border-color: #344b5c;
  background: rgba(23, 35, 45, 0.97);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
}

body[data-design="dark"] .top-controls .utility-actions {
  border-left-color: #354b5c;
}

body[data-design="dark"] .voice-settings {
  border-left-color: #354b5c;
}

body[data-design="dark"] .voice-settings-field > span {
  color: #c0d0da;
}

body[data-design="dark"] .voice-settings select {
  border-color: #486275;
  background-color: #172a37;
  color: #f5f8fc;
}

body[data-design="dark"] .voice-preview-button {
  border-color: #42677b;
  background: #203b4b;
  color: #77d2ff;
}

body[data-design="dark"] .top-controls .tabs .tab,
body[data-design="dark"] .top-controls .tabs .tab-icon {
  color: #f5f8fc;
}

body[data-app-view]:not([data-app-view="inicio"]) .topbar {
  height: 76px;
  border-bottom: 1px solid #e5edf3;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 3px 16px rgba(45, 78, 101, 0.1);
}

body[data-design="dark"][data-app-view]:not([data-app-view="inicio"]) .topbar {
  border-bottom-color: #263947;
  background: rgba(17, 27, 35, 0.98);
}

body[data-app-view]:not([data-app-view="inicio"]) .app-home-button,
body[data-app-view]:not([data-app-view="inicio"]) .navigation-menu-button {
  width: 54px;
  height: 54px;
  min-height: 54px;
  top: 9px;
  border-radius: 14px;
}

body[data-app-view]:not([data-app-view="inicio"]) .app-home-button {
  left: 14px;
}

body[data-app-view]:not([data-app-view="inicio"]) .navigation-menu-button {
  right: 14px;
}

body[data-app-view]:not([data-app-view="inicio"]) .app-home-button .app-control-image,
body[data-app-view]:not([data-app-view="inicio"]) .navigation-menu-button .app-control-image {
  width: 36px;
  height: 36px;
}

body[data-app-view]:not([data-app-view="inicio"]) .top-controls {
  top: 9px;
  right: 78px;
}

/* Dentro dos modulos ficam somente Home, Voltar, Tela cheia e Cadeado. */
body[data-app-view="treino"]:not(.training-fullscreen) .navigation-menu-button {
  display: none;
}

body[data-app-view="treino"]:not(.training-fullscreen) .topbar {
  border: 0;
  background: transparent;
  box-shadow: none;
}

body[data-app-view="treino"]:not(.training-fullscreen) .top-controls,
body[data-app-view="treino"]:not(.training-fullscreen).navigation-menu-open .top-controls {
  width: auto;
  max-width: none;
  top: 9px;
  right: 14px;
  left: auto;
  justify-content: flex-end;
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

body[data-app-view="treino"]:not(.training-fullscreen) .top-controls .tabs {
  display: none;
}

body[data-app-view="treino"]:not(.training-fullscreen) .voice-settings,
body.training-fullscreen .voice-settings {
  display: none;
}

body[data-app-view="treino"]:not(.training-fullscreen) .top-controls .utility-actions {
  height: 54px;
  align-items: stretch;
  gap: 8px;
  padding: 0;
  border: 0;
}

body[data-app-view="treino"]:not(.training-fullscreen) .top-controls .utility-actions .screen-control-button {
  width: 54px;
  height: 54px;
  min-height: 54px;
}

body[data-app-view="treino"]:not(.training-fullscreen) #view-treino.is-active > .training-back-button {
  width: 54px;
  height: 54px;
  min-height: 54px;
  position: fixed;
  top: 9px;
  left: 76px;
  z-index: 73;
  border-radius: 14px;
}

body[data-app-view]:not([data-app-view="inicio"]) main {
  padding-top: 76px;
}

/* Cena inicial: o fundo e as casas se deslocam juntos. */
body.home-scene-active {
  overflow: hidden;
}

body.home-scene-active main,
body.home-scene-active #view-inicio.is-active,
body.home-scene-active #view-inicio .home-layout {
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body.home-scene-active .home-heading-row {
  display: none;
}

.home-scene-viewport {
  width: 100%;
  height: 100dvh;
  overflow-x: auto;
  overflow-y: hidden;
  background: #29aaf0;
  overscroll-behavior-x: none;
  overscroll-behavior-y: none;
  scroll-behavior: smooth;
  scrollbar-color: rgba(255, 255, 255, 0.72) rgba(19, 55, 85, 0.38);
  scrollbar-width: thin;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}

.home-scene-viewport::-webkit-scrollbar {
  height: 10px;
}

.home-scene-viewport::-webkit-scrollbar-track {
  background: rgba(19, 55, 85, 0.34);
}

.home-scene-viewport::-webkit-scrollbar-thumb {
  border: 2px solid rgba(19, 55, 85, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  background-clip: padding-box;
}

.home-scene-canvas {
  width: max(100%, calc(100dvh * 5.56788));
  min-width: 3380px;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.home-scene-background {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  display: block;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}

.scene-category {
  height: 100%;
  position: absolute;
  top: 0;
  z-index: 2;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #ffffff;
  box-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Fundo com 13 postes (background-13-hd.webp, 8285x1488; a 12ª e a 13ª faixas são cópias da 11ª): cada casa ocupa 1/13
   da largura, entre dois postes. */
.scene-category-1 { left: 0.0000%; width: 7.6923%; }
.scene-category-2 { left: 7.6923%; width: 7.6923%; }
.scene-category-3 { left: 15.3846%; width: 7.6923%; }
.scene-category-4 { left: 23.0769%; width: 7.6923%; }
.scene-category-5 { left: 30.7692%; width: 7.6923%; }
.scene-category-6 { left: 38.4615%; width: 7.6923%; }
.scene-category-7 { left: 46.1538%; width: 7.6923%; }
.scene-category-8 { left: 53.8462%; width: 7.6923%; }
.scene-category-9 { left: 61.5385%; width: 7.6923%; }
.scene-category-10 { left: 69.2308%; width: 7.6923%; }
.scene-category-11 { left: 76.9231%; width: 7.6923%; }
.scene-category-12 { left: 84.6154%; width: 7.6923%; }
.scene-category-13 { left: 92.3077%; width: 7.6923%; }

.scene-category img {
  max-width: 98%;
  height: 58%;
  position: absolute;
  left: 50%;
  bottom: 16.4%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 12px 10px rgba(24, 58, 82, 0.22));
  pointer-events: none;
  user-select: none;
  transform: translateX(-50%);
  transform-origin: center bottom;
  transition: transform 150ms ease, filter 150ms ease;
}

.scene-category[data-home-category="matching"] img { height: 58%; }
.scene-category[data-home-category="discrimination"] img { height: 52%; }
.scene-category[data-home-category="verbal-operants"] img { height: 50%; }
.scene-category[data-home-category="classification"] img {
  height: 50%;
  bottom: 15.4%;
}
.scene-category[data-home-category="logical-sequence"] img { height: 50%; bottom: 15.4%; }
.scene-category[data-home-category="relational-frames"] img { height: 59%; }
.scene-category[data-home-category="screen-interaction"] img { height: 49%; bottom: 15.6%; }
.scene-category[data-home-category="academic"] img {
  height: 53%;
  bottom: 16.4%;
}

.scene-category strong {
  width: 92%;
  position: absolute;
  top: 84.7%;
  left: 50%;
  display: block;
  color: #ffffff;
  font-size: clamp(1.5rem, 2vw, 2.15rem);
  font-weight: 950;
  line-height: 0.96;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
  text-wrap: balance;
  text-shadow: 0 3px 5px rgba(5, 22, 38, 0.9);
  transform: translateX(-50%);
  pointer-events: none;
}

.scene-category strong span {
  display: block;
}

.scene-category:focus-visible img {
  filter: drop-shadow(0 17px 13px rgba(18, 54, 80, 0.3));
  transform: translateX(-50%) translateY(-8px) scale(1.025);
}
@media (hover: hover) and (pointer: fine) {
.scene-category:hover img {
  filter: drop-shadow(0 17px 13px rgba(18, 54, 80, 0.3));
  transform: translateX(-50%) translateY(-8px) scale(1.025);
}
}

.scene-category:focus-visible {
  outline: 4px solid rgba(255, 255, 255, 0.95);
  outline-offset: -7px;
}

.scene-category:active img {
  transform: translateX(-50%) translateY(3px) scale(0.985);
}

/* Pagina interna da categoria: mantem apenas Home e Engrenagem flutuantes.
   A tela fica parada (sem rolagem): o fundo de madeira ocupa exatamente a tela.
   Só se os módulos não couberem (tela pequena) a área dos módulos rola por dentro. */
body.home-category-open {
  overflow: hidden;
  overscroll-behavior: none;
}

body.home-category-open main {
  height: 100dvh;
  min-height: 0;
  padding-bottom: 0;
  overflow: hidden;
}

body.home-category-open #view-inicio.is-active .home-layout {
  height: 100dvh;
  min-height: 0;
  max-width: 1240px;
  align-content: start;
  gap: 24px;
  padding: 116px clamp(18px, 4vw, 48px) 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

body.home-category-open[data-home-category="matching"] {
  --home-category-background: url("../assets/home-scene/matching-category-background.webp");
}

body.home-category-open[data-home-category="discrimination"] {
  --home-category-background: url("../assets/home-scene/matching-category-background.webp");
}

body.home-category-open[data-home-category="verbal-operants"] {
  --home-category-background: url("../assets/home-scene/matching-category-background.webp");
}

body.home-category-open[data-home-category="classification"] {
  --home-category-background: url("../assets/home-scene/matching-category-background.webp");
}

body.home-category-open[data-home-category="screen-interaction"] {
  --home-category-background: url("../assets/home-scene/matching-category-background.webp");
}

body.home-category-open[data-home-category="relational-frames"] {
  --home-category-background: url("../assets/home-scene/matching-category-background.webp");
}

body.home-category-open[data-home-category="academic"] {
  --home-category-background: url("../assets/home-scene/matching-category-background.webp");
}

body.home-category-open[data-home-category] #view-inicio.is-active {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background: var(--home-category-background) center / cover no-repeat;
}

body.home-category-open[data-home-category] #view-inicio.is-active .home-layout {
  max-width: none;
}

body.home-category-open:is(
  [data-home-category="matching"],
  [data-home-category="discrimination"],
  [data-home-category="screen-interaction"],
  [data-home-category="relational-frames"]
) .home-heading h2,
body.home-category-open:is(
  [data-home-category="matching"],
  [data-home-category="discrimination"],
  [data-home-category="screen-interaction"],
  [data-home-category="relational-frames"]
) .home-heading p {
  color: #ffffff;
  text-shadow: 0 3px 7px rgba(43, 19, 4, 0.78);
}

body.home-category-open:is(
  [data-home-category="verbal-operants"],
  [data-home-category="logical-sequence"],
  [data-home-category="classification"],
  [data-home-category="academic"],
  [data-home-category="cognition"],
  [data-home-category="social-skills"],
  [data-home-category="emotional-regulation"],
  [data-home-category="speech-therapy"],
  [data-home-category="psychotherapy"]
) .home-heading h2,
body.home-category-open:is(
  [data-home-category="verbal-operants"],
  [data-home-category="logical-sequence"],
  [data-home-category="classification"],
  [data-home-category="academic"],
  [data-home-category="cognition"],
  [data-home-category="social-skills"],
  [data-home-category="emotional-regulation"],
  [data-home-category="speech-therapy"],
  [data-home-category="psychotherapy"]
) .home-heading p {
  color: #ffffff;
  text-shadow: 0 3px 7px rgba(43, 19, 4, 0.78);
}

body.home-category-open .home-back-button {
  display: none;
}

/* Dentro de uma pasta (ex.: Acadêmico → Leitura), a seta volta para a categoria. */
body.home-category-open.home-folder-open .home-heading-row {
  position: relative;
}

body.home-category-open.home-folder-open .home-back-button {
  position: absolute;
  top: 50%;
  left: 0;
  z-index: 2;
  display: grid;
  translate: 0 -50%;
}

body.home-category-open .home-heading-row {
  grid-template-columns: 1fr;
}

body.home-category-open .home-heading {
  grid-column: 1;
  text-align: center;
}

body.home-category-open #homeModuleGrid {
  width: 100%;
  margin-inline: auto;
}

/* Habilidades Sociais e Regulação Emocional (poucos módulos): cartões do tamanho normal, centralizados. */
body.home-category-open:is([data-home-category="social-skills"], [data-home-category="emotional-regulation"], [data-home-category="speech-therapy"], [data-home-category="psychotherapy"]) #homeModuleGrid {
  width: min(100%, 1100px);
  max-width: 1100px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 250px));
  justify-content: center;
}

/* Deitado: os módulos de Habilidades Sociais numa linha só (até 4). */
@media (orientation: landscape) {
  body.home-category-open[data-home-category="social-skills"] #homeModuleGrid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}

/* Quatro módulos de Pareamento: uma linha ampla e duas colunas no mobile. */
body.home-category-open[data-home-category="matching"] #homeModuleGrid {
  width: min(100%, 1280px);
  max-width: 1280px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(10px, 2vw, 18px);
}

@media (max-width: 720px) {
  body.home-category-open[data-home-category="matching"] #homeModuleGrid {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Tela cheia mostra somente os controles de tela normal e cadeado. */
body.training-fullscreen[data-app-view="treino"] .topbar,
body[data-design].training-fullscreen[data-app-view="treino"] .topbar {
  inset: 0 0 auto auto;
  width: 0;
  height: 0;
  min-height: 0;
  display: block;
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  transition: none;
  pointer-events: none;
}

body.training-fullscreen .app-home-button,
body.training-fullscreen .navigation-menu-button,
body.training-fullscreen #view-treino.is-active > .training-back-button {
  display: none !important;
}

body.training-fullscreen .top-controls {
  width: auto;
  max-width: none;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  right: calc(env(safe-area-inset-right, 0px) + 8px);
  display: flex !important;
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

body.training-fullscreen .top-controls .tabs {
  display: none !important;
}

body.training-fullscreen .top-controls .utility-actions {
  display: flex !important;
  gap: 8px;
  padding: 0;
  border-left: 0;
  pointer-events: auto;
}

body.training-fullscreen .top-controls .utility-actions .screen-control-button {
  width: 54px;
  height: 54px;
  min-height: 54px;
}

body.training-fullscreen[data-app-view="treino"] main {
  padding-top: 0;
}

/* Em tela cheia, grades com varias linhas usam somente a altura disponivel. */
body.training-fullscreen .selection-workspace {
  height: 100%;
  min-height: 0;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  align-content: stretch;
}

body.training-fullscreen .trainer:has(.equivalence-workspace) {
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
}

body.training-fullscreen .equivalence-workspace {
  height: 100%;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  align-content: stretch;
  gap: clamp(10px, 1.6vh, 16px);
  padding-bottom: 0;
}

body.training-fullscreen .equivalence-workspace.is-waiting {
  grid-template-rows: minmax(0, 1fr);
}

body.training-fullscreen .equivalence-model-panel,
body.training-fullscreen .equivalence-comparisons,
body.training-fullscreen .equivalence-model-card,
body.training-fullscreen .equivalence-comparison-card {
  height: 100%;
  min-height: 0;
}

body.training-fullscreen .equivalence-model-card {
  width: min(420px, 48vw);
}

body.training-fullscreen .choices[data-module="colors"][data-count="1"] {
  width: min(100%, 440px);
}

/* Treino normal: toda a atividade cabe no viewport, sem rolagem da pagina. */
body[data-app-view="treino"]:not(.training-fullscreen) {
  height: 100dvh;
  overflow: hidden;
}

body[data-app-view="treino"]:not(.training-fullscreen) .app-shell,
body[data-app-view="treino"]:not(.training-fullscreen) main {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body[data-app-view="treino"]:not(.training-fullscreen) main {
  padding-bottom: 0;
}

body[data-app-view="treino"]:not(.training-fullscreen) #view-treino.is-active {
  height: calc(100dvh - 76px);
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}

body[data-app-view="treino"]:not(.training-fullscreen) #view-treino.is-active > .session-panel,
body[data-app-view="treino"]:not(.training-fullscreen) #view-treino.is-active > .trainer {
  height: 100%;
  min-height: 0;
  max-height: none;
  overflow: hidden;
}

body[data-app-view="treino"]:not(.training-fullscreen) #view-treino.is-active > .session-panel {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 10px calc(20px + env(safe-area-inset-bottom, 0px));
  scrollbar-color: #86cdec transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

body[data-app-view="treino"]:not(.training-fullscreen) #view-treino.is-active > .session-panel::-webkit-scrollbar {
  width: 8px;
}

body[data-app-view="treino"]:not(.training-fullscreen) #view-treino.is-active > .session-panel::-webkit-scrollbar-track {
  background: transparent;
}

body[data-app-view="treino"]:not(.training-fullscreen) #view-treino.is-active > .session-panel::-webkit-scrollbar-thumb {
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #86cdec;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .panel-section {
  gap: 6px;
  margin-bottom: 12px;
}

body[data-app-view="treino"][data-active-module="sentenceCompletion"]:not(.training-fullscreen) .session-panel .panel-section {
  margin-bottom: 10px;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .panel-heading {
  margin: 14px 0 8px;
  font-size: 0.76rem;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel label {
  font-size: 0.68rem;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel select,
body[data-app-view="treino"]:not(.training-fullscreen) .session-panel input {
  min-height: 40px;
  padding-block: 5px;
  font-size: 0.82rem;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .target-picker-open {
  min-height: 54px;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 9px;
  padding: 6px 8px;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .target-picker-thumb {
  width: 40px;
  height: 40px;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .target-picker-open strong {
  font-size: 0.82rem;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .target-picker-open small {
  font-size: 0.68rem;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .stimulus-picker {
  padding: 8px;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .stimulus-picker-open {
  min-height: 42px;
  font-size: 0.8rem;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .mode-switch {
  min-height: 52px;
  gap: 9px;
  padding: 7px 8px;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .mode-switch-track {
  width: 46px;
  height: 26px;
  padding: 2px;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .mode-switch-thumb {
  width: 22px;
  height: 22px;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .mode-switch.is-on .mode-switch-thumb {
  transform: translateX(20px);
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .mode-switch-text strong {
  font-size: 0.82rem;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .mode-switch-text small {
  font-size: 0.68rem;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .sound-toggle {
  min-height: 46px;
  margin-bottom: 12px;
  font-size: 0.84rem;
}

body[data-app-view="treino"]:not(.training-fullscreen) .trainer {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  align-content: stretch;
  gap: clamp(8px, 1.4vh, 14px);
  padding: clamp(10px, 1.5vw, 18px);
}

body[data-app-view="treino"]:not(.training-fullscreen) .trainer > .choices {
  min-height: 0 !important;
  max-height: 100%;
}

/* Discriminacao Complexa: divide as tres linhas sem invadir o enunciado. */
body[data-app-view="treino"]:not(.training-fullscreen) .selection-workspace {
  height: 100%;
  min-height: 0;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  align-content: stretch;
}

/* Coordenacao: modelo e alternativas ocupam metades proporcionais da area. */
body[data-app-view="treino"]:not(.training-fullscreen) .equivalence-workspace {
  height: 100%;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  align-content: stretch;
  gap: clamp(8px, 1.3vh, 12px);
}

body[data-app-view="treino"]:not(.training-fullscreen) .equivalence-workspace.is-waiting {
  grid-template-rows: minmax(0, 1fr);
}

body[data-app-view="treino"]:not(.training-fullscreen) .equivalence-model-panel,
body[data-app-view="treino"]:not(.training-fullscreen) .equivalence-comparisons,
body[data-app-view="treino"]:not(.training-fullscreen) .equivalence-model-card,
body[data-app-view="treino"]:not(.training-fullscreen) .equivalence-comparison-card {
  height: 100%;
  min-height: 0;
}

body[data-app-view="treino"]:not(.training-fullscreen) .equivalence-model-card {
  width: min(320px, 48vw);
}

/* Cores: uma unica resposta permanece compacta e centralizada. */
body[data-app-view="treino"]:not(.training-fullscreen) .trainer:has(.choices[data-module="colors"]) .image-target.color-target.visual-target {
  width: min(170px, 24vh);
}

body[data-app-view="treino"]:not(.training-fullscreen) .choices[data-module="colors"] {
  height: min(100%, 180px);
  min-height: 0;
  grid-auto-rows: minmax(0, 1fr);
  align-self: center;
  align-content: stretch;
}

body[data-app-view="treino"]:not(.training-fullscreen) .choices[data-module="colors"][data-count="1"] {
  width: min(100%, 360px);
}

body[data-app-view="treino"]:not(.training-fullscreen) .choices[data-module="colors"] .choice {
  height: 100%;
  min-height: 0;
}

body[data-app-view="treino"]:not(.training-fullscreen) .trainer:has(.shadow-workspace) {
  align-content: stretch;
}

body[data-app-view="treino"]:not(.training-fullscreen) .shadow-workspace {
  --shadow-card-size: clamp(108px, min(15vw, 17vh), 164px);
  min-height: 0;
}

body[data-app-view="treino"]:not(.training-fullscreen) .trainer:has(.opposition-workspace) .opposition-workspace {
  height: 100%;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  align-content: stretch;
  gap: clamp(8px, 1.4vh, 14px);
}

body[data-app-view="treino"]:not(.training-fullscreen) .opposition-model-panel,
body[data-app-view="treino"]:not(.training-fullscreen) .opposition-comparisons,
body[data-app-view="treino"]:not(.training-fullscreen) .opposition-model-card,
body[data-app-view="treino"]:not(.training-fullscreen) .opposition-comparison-card {
  height: 100%;
  min-height: 0;
}

/* Faixa da grade com altura definida: a imagem cabe inteira no cartão, sem cortar o pé. */
body[data-app-view="treino"]:not(.training-fullscreen) .opposition-card {
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
}

body[data-app-view="treino"]:not(.training-fullscreen) .opposition-card img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  object-fit: contain;
}

body[data-app-view="treino"]:not(.training-fullscreen) .trainer:has(.causality-workspace) {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

body[data-app-view="treino"]:not(.training-fullscreen) .causality-host {
  height: 100%;
  min-height: 0;
}

body[data-app-view="treino"]:not(.training-fullscreen) .causality-workspace {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 1.4vh, 14px);
}

body[data-app-view="treino"]:not(.training-fullscreen) .causality-question-band {
  min-height: 62px;
  padding: 8px 12px;
  font-size: clamp(1.05rem, 2vw, 1.55rem);
}

body[data-app-view="treino"]:not(.training-fullscreen) .causality-scene,
body[data-app-view="treino"]:not(.training-fullscreen) .causality-scene-image {
  width: min(100%, 620px);
  height: auto;
  min-height: 0;
  flex: 3 1 0;
  aspect-ratio: auto;
  padding: 8px;
}

body[data-app-view="treino"]:not(.training-fullscreen) .causality-scene-image > img {
  position: absolute;
  inset: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  max-height: 100%;
}

body[data-app-view="treino"]:not(.training-fullscreen) .causality-options {
  height: auto;
  min-height: 0;
  flex: 2 1 0;
  grid-auto-rows: minmax(0, 1fr);
  align-content: stretch;
  gap: 10px;
}

body[data-app-view="treino"]:not(.training-fullscreen) .causality-option {
  height: 100%;
  min-height: 0;
  padding: 7px;
}

body[data-app-view="treino"]:not(.training-fullscreen) .causality-option img {
  width: min(84%, 220px);
  height: min(17vh, 148px);
  max-width: 84%;
  max-height: none;
  object-fit: contain;
}

body[data-app-view="treino"]:not(.training-fullscreen) .trainer:has(.attention-workspace) .attention-sheet {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

body[data-app-view="treino"]:not(.training-fullscreen) .attention-header {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 8px 18px;
  text-align: left;
}

body[data-app-view="treino"]:not(.training-fullscreen) .attention-header h2 {
  justify-self: center;
}

body[data-app-view="treino"]:not(.training-fullscreen) .attention-model {
  width: clamp(68px, 8vh, 86px);
}

body[data-app-view="treino"]:not(.training-fullscreen) .attention-grid,
body[data-app-view="treino"]:not(.training-fullscreen) .attention-workspace[data-density="medium"] .attention-grid,
body[data-app-view="treino"]:not(.training-fullscreen) .attention-workspace[data-density="dense"] .attention-grid {
  height: 100%;
  min-height: 0;
  grid-auto-rows: minmax(0, 1fr);
  gap: 2px 5px;
  padding: 7px 10px;
}

body[data-app-view="treino"]:not(.training-fullscreen) .attention-item,
body[data-app-view="treino"]:not(.training-fullscreen) .attention-workspace[data-density="medium"] .attention-item,
body[data-app-view="treino"]:not(.training-fullscreen) .attention-workspace[data-density="dense"] .attention-item {
  width: auto;
  height: 100%;
  max-width: 44px;
  max-height: 44px;
}

body[data-app-view="treino"]:not(.training-fullscreen) .attention-workspace[data-density="dense"] .attention-item {
  max-width: 34px;
  max-height: 34px;
}

body[data-app-view="treino"][data-active-module="syllables"]:not(.training-fullscreen) .syllable-workspace {
  gap: 12px;
}

body[data-app-view="treino"][data-active-module="syllables"]:not(.training-fullscreen) .syllable-reference {
  width: min(210px, 24vw);
  height: min(138px, 20vh);
  margin-bottom: 0;
}

body[data-app-view="treino"][data-active-module="syllables"]:not(.training-fullscreen) .syllable-slot,
body[data-app-view="treino"][data-active-module="syllables"]:not(.training-fullscreen) .syllable-card,
body[data-app-view="treino"][data-active-module="syllables"]:not(.training-fullscreen) .syllable-source-placeholder {
  height: clamp(76px, 12vh, 92px);
  min-height: 0;
}

body[data-app-view="treino"][data-active-module="sequences"]:not(.training-fullscreen) .sequence-workspace {
  height: 100%;
  min-height: 0;
  gap: 12px;
  padding: 10px;
}

body[data-app-view="treino"][data-active-module="sequences"]:not(.training-fullscreen) .sequence-source,
body[data-app-view="treino"][data-active-module="sequences"]:not(.training-fullscreen) .sequence-slots,
body[data-app-view="treino"][data-active-module="sequences"]:not(.training-fullscreen) .sequence-card,
body[data-app-view="treino"][data-active-module="sequences"]:not(.training-fullscreen) .sequence-source-placeholder,
body[data-app-view="treino"][data-active-module="sequences"]:not(.training-fullscreen) .sequence-slot {
  height: 100%;
  min-height: 0;
}

body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .trainer:has(.mand-workspace) {
  height: 100%;
  overflow: hidden;
  padding: 10px;
}

body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .trainer:has(.mand-workspace) > .feedback {
  display: none;
}

body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .choices.mand-host,
body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .mand-workspace,
body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .mand-content,
body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .mand-board-surface,
body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .mand-board {
  min-height: 0;
}

body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .mand-workspace {
  height: calc(100dvh - 96px);
  max-height: calc(100dvh - 96px);
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
  overflow: hidden;
}

/* No app instalado, reserva a faixa do sistema e dos controles antes da regua do Mando. */
@media (display-mode: fullscreen), (display-mode: standalone) {
  body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .top-controls {
    top: calc(env(safe-area-inset-top, 0px) + 9px);
  }

  body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .mand-page-meta {
    min-height: calc(env(safe-area-inset-top, 0px) + 64px);
    padding-top: env(safe-area-inset-top, 0px);
    padding-right: 128px;
  }
}

body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .mand-content,
body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .mand-board-surface,
body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .mand-board {
  height: 100%;
}

body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .mand-content {
  height: auto;
  align-self: stretch;
  overflow: hidden;
}

body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .mand-board-surface {
  overflow: hidden;
}

body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .mand-board {
  grid-template-rows: repeat(var(--mand-rows, 3), minmax(0, 1fr));
}

body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .mand-cell-slot,
body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .mand-tile,
body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) .mand-empty-cell {
  height: 100%;
  min-height: 0;
}

.module-picker-section {
  margin-bottom: 8px;
}

.module-picker-open {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 2px solid #078bc9;
  border-radius: 8px;
  color: #ffffff;
  background: #18a9ea;
  box-shadow: 0 5px 0 #087db8, 0 9px 18px rgba(8, 125, 184, 0.2);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

@media (hover: hover) and (pointer: fine) {
.module-picker-open:hover {
  background: #0f9fdf;
  transform: translateY(-1px);
  box-shadow: 0 6px 0 #087db8, 0 11px 20px rgba(8, 125, 184, 0.24);
}
}

.module-picker-open:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #087db8, 0 5px 12px rgba(8, 125, 184, 0.18);
}

.module-picker-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #078bc9;
  background: #ffffff;
  font-size: 1.28rem;
  font-weight: 900;
}

.module-picker-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.module-picker-copy strong,
.module-picker-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-picker-copy strong {
  color: #ffffff;
  font-size: 0.9rem;
}

.module-picker-copy small {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.69rem;
  font-weight: 750;
}

.module-picker-chevron {
  color: #ffffff;
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1;
}

.module-picker-modal {
  width: min(720px, calc(100vw - 28px));
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  border: 2px solid #b9e6fa;
  border-radius: 12px;
  box-shadow: 0 26px 70px rgba(8, 51, 79, 0.28);
}

.module-picker-close {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: 2px solid #b9e6fa;
  border-radius: 8px;
  color: #087db8;
  background: #edf9ff;
  font-size: 1.75rem;
  line-height: 1;
}

.module-picker-list {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  overflow-y: auto;
  padding: 2px 6px 8px 2px;
}

.module-picker-option {
  min-height: 54px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 2px solid #d8ebf5;
  border-radius: 8px;
  color: #18233a;
  background: #ffffff;
  box-shadow: 0 3px 0 #d8ebf5;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

@media (hover: hover) and (pointer: fine) {
.module-picker-option:hover {
  border-color: #72caef;
  background: #f2fbff;
  transform: translateY(-1px);
}
}

.module-picker-option.is-active {
  border-color: #18a9ea;
  color: #075f8e;
  background: #e9f8ff;
  box-shadow: 0 3px 0 #8ad5f4;
}

.module-picker-option-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #078bc9;
  background: #dff5ff;
  font-size: 1.08rem;
}

.module-picker-option-check {
  color: #18a957;
  font-size: 1.15rem;
  font-weight: 950;
  text-align: center;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .module-picker-open {
  min-height: 62px;
  grid-template-columns: 38px minmax(0, 1fr) 16px;
  gap: 9px;
  padding: 8px 9px;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .module-picker-icon {
  width: 36px;
  height: 36px;
  font-size: 1.08rem;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .module-picker-copy strong {
  font-size: 0.86rem;
}

body[data-app-view="treino"]:not(.training-fullscreen) .session-panel .module-picker-copy small {
  font-size: 0.67rem;
}

@media (orientation: landscape) and (min-width: 760px) and (max-width: 1024px) {
  body[data-app-view="treino"]:not(.training-fullscreen) #view-treino.is-active {
    grid-template-columns: clamp(220px, 24vw, 250px) minmax(0, 1fr);
  }

  body[data-app-view="treino"]:not(.training-fullscreen) #view-treino.is-active > .session-panel {
    display: block;
    order: 1;
    border-top: 0;
    border-right: 1px solid var(--line);
  }

  body[data-app-view="treino"]:not(.training-fullscreen) #view-treino.is-active > .trainer {
    order: 2;
  }

  body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) #view-treino.is-active {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-app-view="treino"][data-active-module="mando"]:not(.training-fullscreen) #view-treino.is-active > .session-panel {
    display: none;
  }
}

@media (max-width: 700px) {
  .app-home-button,
  .navigation-menu-button {
    width: 56px;
    height: 56px;
    min-height: 56px;
    top: 14px;
    border-radius: 14px;
  }

  .app-home-button {
    left: 12px;
  }

  .navigation-menu-button {
    right: 12px;
  }

  .app-home-button .app-control-image,
  .navigation-menu-button .app-control-image {
    width: 37px;
    height: 37px;
  }

  .top-controls,
  body[data-app-view]:not([data-app-view="inicio"]) .top-controls {
    width: calc(100vw - 24px);
    max-width: none;
    top: 82px;
    right: 12px;
  }

  .top-controls .tabs .tab {
    min-height: 44px;
    padding-inline: 9px;
    font-size: 0.7rem;
  }

  .top-controls .utility-actions .screen-control-button {
    width: 44px;
    height: 44px;
    min-height: 44px;
    display: grid !important;
  }

  body[data-app-view]:not([data-app-view="inicio"]) .topbar {
    height: 66px;
  }

  body[data-app-view]:not([data-app-view="inicio"]) main {
    padding-top: 66px;
  }

  body.home-category-open #view-inicio.is-active .home-layout {
    padding-top: 96px;
  }

  body[data-app-view="treino"]:not(.training-fullscreen) .top-controls,
  body[data-app-view="treino"]:not(.training-fullscreen).navigation-menu-open .top-controls {
    width: auto;
    max-width: none;
    top: 14px;
    right: 12px;
    left: auto;
  }

  body[data-app-view="treino"]:not(.training-fullscreen) .top-controls .utility-actions,
  body[data-app-view="treino"]:not(.training-fullscreen) .top-controls .utility-actions .screen-control-button {
    height: 56px;
    min-height: 56px;
  }

  body[data-app-view="treino"]:not(.training-fullscreen) .top-controls .utility-actions .screen-control-button {
    width: 56px;
  }

  body[data-app-view="treino"]:not(.training-fullscreen) #view-treino.is-active > .training-back-button {
    width: 56px;
    height: 56px;
    min-height: 56px;
    top: 14px;
    left: 76px;
  }
}

@media (max-width: 620px) {
  .module-picker-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .top-controls,
  .app-home-button,
  .navigation-menu-button,
  .scene-category img {
    transition: none;
  }
}

.scene-category[data-home-category="cognition"] img { height: 47%; bottom: 15.8%; }
.scene-category[data-home-category="social-skills"] img { height: 51%; bottom: 17%; }
.scene-category[data-home-category="psychotherapy"] img { height: 52%; bottom: 16.4%; }
.scene-category[data-home-category="speech-therapy"] img { height: 38%; bottom: 17.3%; }
.scene-category[data-home-category="emotional-regulation"] img { height: 50%; bottom: 16.6%; }
body.home-category-open[data-home-category="logical-sequence"],
body.home-category-open[data-home-category="cognition"],
body.home-category-open[data-home-category="social-skills"],
body.home-category-open[data-home-category="emotional-regulation"],
body.home-category-open[data-home-category="speech-therapy"],
body.home-category-open[data-home-category="psychotherapy"] {
  --home-category-background: url("../assets/home-scene/matching-category-background.webp");
}

/* Sequência Lógica em telas estreitas (tablet em pé, celular): as cenas ficam numa
   fileira e os encaixes na outra, cada cartão com altura mínima para a imagem aparecer. */
body[data-app-view="treino"][data-active-module="sequences"]:not(.training-fullscreen) .sequence-workspace {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(clamp(64px, 11vh, 120px), 1fr) minmax(clamp(64px, 11vh, 120px), 1fr);
}

@media (max-width: 820px) {
  /* O painel de ajustes rola sozinho e deixa a maior parte da tela para a atividade. */
  body[data-app-view="treino"][data-active-module="sequences"]:not(.training-fullscreen) #view-treino.is-active > .session-panel {
    max-height: 34vh;
    max-height: 34dvh;
  }

  body[data-app-view="treino"][data-active-module="sequences"]:not(.training-fullscreen) .prompt-zone {
    min-height: 0;
    padding-block: 10px;
  }
}

@media (max-height: 520px) {
  /* Celular deitado: enunciado mais baixo para sobrar altura para as cenas. */
  body[data-app-view="treino"][data-active-module="sequences"]:not(.training-fullscreen) .prompt-zone {
    min-height: 0;
    padding-block: 6px;
  }

  body[data-app-view="treino"][data-active-module="sequences"]:not(.training-fullscreen) .trainer:has(.sequence-workspace) .stage-strip,
  body[data-app-view="treino"][data-active-module="sequences"]:not(.training-fullscreen) .trainer:has(.sequence-workspace) > .feedback:empty {
    display: none;
  }

  body[data-app-view="treino"][data-active-module="sequences"]:not(.training-fullscreen) .sequence-source {
    padding: 2px;
  }
}
