/* Balões de Pensamento: cartão de situação social e quadro verde com os balões (lógica em scripts/features/thought-bubbles.js).
   Mesmo desenho da Interpretação de Situações (social-situations.css). */
body[data-design] .choices.thought-workspace {
  --thought-height: clamp(380px, calc(100dvh - 250px), 780px);
  --thought-teal: #17a7a0;
  --thought-ink: #0f7a75;
  display: block;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

body.training-fullscreen .choices.thought-workspace {
  --thought-height: calc(100dvh - 90px);
}

/* Deitado: o cartão (com a pergunta em cima) à esquerda; o quadro verde com os balões à direita. */
body[data-design] .thought-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(10px, 1.6vw, 20px);
  height: var(--thought-height);
}

body[data-design] .thought-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.2vh, 12px);
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  padding: clamp(10px, 1.4vw, 16px);
  border: 0;
  border-radius: clamp(20px, 2.6vw, 30px);
  background: #fff;
  box-shadow: 0 10px 26px rgba(24, 32, 42, 0.12);
}

body[data-design] .thought-question {
  margin: 0;
  color: var(--thought-ink);
  font-size: clamp(1.15rem, 2.5vw, 2.1rem);
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
}

/* O cartão mantém o formato da figura (em pé) e cabe na altura que sobra. */
body[data-design] .thought-scene {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  max-width: 100%;
  aspect-ratio: 998 / 1448;
  container-type: inline-size;
  cursor: pointer;
}

body[data-design] .thought-scene > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

/* Acerto: o cartão fica coberto de um verde bem sutil (12%). */
body[data-design] .thought-scene.is-correct::after {
  content: "";
  position: absolute;
  inset: 1.5%;
  border-radius: 5%;
  background: rgba(34, 197, 94, 0.12);
  pointer-events: none;
}

/* Área do balão vazio do cartão: onde o pensamento entra. O texto fica na parte de dentro da nuvem,
   abaixo do "Os pensamentos de…", e diminui sozinho até caber (fitText em thought-bubbles.js). */
body[data-design] .thought-drop {
  position: absolute;
  box-sizing: border-box;
  border-radius: 50%;
  z-index: 2;
}

body[data-design] .thought-drop-text {
  position: absolute;
  inset: 31% 15% 15% 16%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #0f3d3a;
  font-weight: 800;
  line-height: 1.12;
  text-align: center;
  overflow-wrap: normal;
}

body[data-design] .thought-drop.is-filled .thought-drop-text {
  animation: thoughtIn 0.45s ease;
}

@keyframes thoughtIn {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Quadro verde de escola (lousa) com moldura de madeira, igual à Interpretação de Situações. */
body[data-design] .thought-board {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  padding: clamp(10px, 1.5vw, 18px);
  border: clamp(8px, 1.1vw, 13px) solid #b07a45;
  border-radius: clamp(14px, 1.8vw, 20px);
  background:
    radial-gradient(ellipse at 20% 15%, rgba(255, 255, 255, 0.07), transparent 55%),
    radial-gradient(ellipse at 85% 90%, rgba(255, 255, 255, 0.05), transparent 50%),
    #2f6b4a;
  box-shadow: inset 0 0 0 3px #8a5a2e, inset 0 0 28px rgba(0, 0, 0, 0.35), 0 10px 26px rgba(24, 32, 42, 0.18);
}

body[data-design] .thought-lead {
  margin: 0 0 clamp(8px, 1.2vh, 12px);
  color: #f7f5ea;
  font-size: clamp(1.05rem, 2.1vw, 1.7rem);
  font-weight: 900;
  text-align: center;
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.6), 0 2px 3px rgba(0, 0, 0, 0.25);
}

body[data-design] .thought-options {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-auto-rows: minmax(0, 1fr);
  gap: clamp(8px, 1.4vh, 14px);
}

/* Balão de pensamento: a nuvem mantém o formato (não estica) e cabe no espaço da linha;
   o texto fica na parte de dentro da nuvem e diminui sozinho até caber. */
body[data-design] .thought-option {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border: 0;
  background: transparent;
  color: #111827;
  font: inherit;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  container-type: size;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

body[data-design] .thought-shape {
  position: relative;
  display: block;
  width: min(100cqw, 100cqh * 222 / 124);
  aspect-ratio: 222 / 124;
}

body[data-design] .thought-cloud {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

body[data-design] .thought-cloud path,
body[data-design] .thought-cloud circle {
  fill: #fff;
  stroke: #1f2937;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

body[data-design] .thought-text {
  position: absolute;
  inset: 27% 15% 22% 23%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-weight: 800;
  line-height: 1.12;
  text-align: center;
  overflow-wrap: normal;
}

body[data-design] .thought-option.is-selected {
  transform: scale(1.04);
}

body[data-design] .thought-option.is-selected .thought-cloud path,
body[data-design] .thought-option.is-selected .thought-cloud circle {
  stroke: #f2b705;
  stroke-width: 5;
}

body[data-design] .thought-option.is-dragging {
  opacity: 0.35;
}

body[data-design] .thought-option.is-used {
  visibility: hidden;
}

body[data-design] .thought-option.is-wrong {
  animation: thoughtShake 0.5s ease;
}

body[data-design] .thought-option.is-wrong .thought-cloud path,
body[data-design] .thought-option.is-wrong .thought-cloud circle {
  fill: #fff1f1;
  stroke: #e05050;
  stroke-width: 5;
}

body[data-design] .thought-option.is-wrong .thought-text {
  color: #b42318;
}

/* A ajuda visual pulsa o balão sem moldura quadrada. */
body[data-design] .thought-workspace .thought-option.visual-hint-pulse,
body[data-design] .thought-workspace .thought-drop.visual-hint-pulse {
  border-radius: 40%;
}

@keyframes thoughtShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* Balão que acompanha o dedo. */
body[data-design] .thought-option.thought-drag-preview,
.thought-drag-preview {
  position: fixed;
  z-index: 10000;
  margin: 0;
  pointer-events: none;
  filter: drop-shadow(0 14px 22px rgba(24, 32, 42, 0.3));
  transition: none !important;
  animation: none !important;
}

/* Deitado, na tela cheia: o título do quadro desce para não ficar sob os botões do canto. */
@media (orientation: landscape) {
  body.training-fullscreen .thought-board {
    padding-top: 56px;
  }
}

/* Em pé fora da tela cheia: a barra de ajustes fica embaixo; cartão e quadro continuam lado a lado. */
@media (orientation: portrait) {
  body[data-design]:not(.training-fullscreen) .choices.thought-workspace {
    --thought-height: clamp(380px, calc(100dvh - 640px), 760px);
  }


}

/* Em pé, na tela cheia: o cartão em cima e o quadro verde com os balões embaixo, lado a lado. */
@media (orientation: portrait) {
  body.training-fullscreen .choices.thought-workspace {
    --thought-height: calc(100dvh - 130px);
    margin-top: 40px;
  }

  body.training-fullscreen .thought-card {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }

  body.training-fullscreen .thought-options {
    grid-template-columns: repeat(var(--thought-columns, 3), minmax(0, 1fr));
    grid-auto-rows: clamp(120px, 15vh, 170px);
  }

  body.training-fullscreen .thought-workspace[data-count="2"] .thought-options { --thought-columns: 2; }
  body.training-fullscreen .thought-workspace[data-count="4"] .thought-options { --thought-columns: 2; }
}

/* Balão voando até o cartão ao acertar. */
.thought-flying {
  position: fixed;
  z-index: 10000;
  margin: 0;
  pointer-events: none;
}

/* Escolha ao concluir: só os botões Refazer e Prosseguir no quadro verde. */
body[data-design] .thought-board.is-choice {
  justify-content: center;
}

body[data-design] .thought-board-actions {
  display: grid;
  gap: clamp(12px, 2vh, 20px);
  width: min(100%, 360px);
  margin: 0 auto;
}

body[data-design] .thought-board-actions .block-choice-button {
  width: 100%;
  min-height: clamp(60px, 9vh, 84px);
}

@media (orientation: portrait) {
  body.training-fullscreen .thought-board.is-choice .thought-board-actions {
    grid-template-columns: 1fr 1fr;
    width: min(100%, 560px);
  }
}
