/* Entendendo Meus Sentimentos: quadro com o personagem no meio e os quadros coloridos ligados ao corpo
   (lógica em scripts/features/my-feelings.js). Cada peça tem posição deitado (--l*) e em pé (--p*), em % do quadro. */
body[data-design] .choices.myf-workspace {
  --myf-height: clamp(400px, calc(100dvh - 150px), 900px);
  display: block;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

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

/* O quadro mantém o formato (deitado 842×595, em pé 595×842) e fica o maior possível. */
body[data-design] .myf-area {
  display: grid;
  place-items: center;
  height: var(--myf-height);
  container-type: size;
}

body[data-design] .myf-board {
  --ratio: 1.4151;
  position: relative;
  width: min(100cqw, 100cqh * var(--ratio));
  aspect-ratio: 842 / 595;
  container-type: inline-size;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(24, 32, 42, 0.12);
  --x: var(--lx);
  --y: var(--ly);
  --w: var(--lw);
  --h: var(--lh);
}

body[data-design] .myf-board > * {
  --x: var(--lx);
  --y: var(--ly);
  --w: var(--lw);
  --h: var(--lh);
}

body[data-design] .myf-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}


body[data-design] .myf-line {
  stroke-linecap: round;
  stroke-width: 5px;
}

body[data-design] .myf-line.is-green, body[data-design] .myf-dot.is-green { stroke: #7cc242; fill: #7cc242; }
body[data-design] .myf-line.is-red, body[data-design] .myf-dot.is-red { stroke: #c8102e; fill: #c8102e; }
body[data-design] .myf-line.is-yellow, body[data-design] .myf-dot.is-yellow { stroke: #f1d33a; fill: #f1d33a; }
body[data-design] .myf-line.is-lilac, body[data-design] .myf-dot.is-lilac { stroke: #5b3f8c; fill: #5b3f8c; }

/* Peças posicionadas no quadro. */
body[data-design] .myf-figure,
body[data-design] .myf-feel,
body[data-design] .myf-box {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
  box-sizing: border-box;
}

body[data-design] .myf-figure {
  z-index: 0;
  object-fit: contain;
  object-position: center bottom;
  pointer-events: none;
  user-select: none;
}

body[data-design] .myf-feel {
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 3%;
}

body[data-design] .myf-feel-label {
  flex: 1;
  color: #292627;
  font-size: 2.6cqw;
  font-weight: 900;
  line-height: 1.15;
}

body[data-design] .myf-box {
  z-index: 2;
  display: flex;
  align-items: stretch;
  gap: 4%;
  padding: 1.2cqw;
  border: 0.45cqw solid var(--box-border);
  border-radius: 1.8cqw;
  background: var(--box-bg);
}

body[data-design] .myf-box.is-green { --box-bg: #dcebc1; --box-border: #7cc242; }
body[data-design] .myf-box.is-red { --box-bg: #f4c0c0; --box-border: #c8102e; }
body[data-design] .myf-box.is-teal { --box-bg: #9fd4c2; --box-border: #2aa198; }
body[data-design] .myf-box.is-lilac { --box-bg: #e1e0ee; --box-border: #5b3f8c; }
body[data-design] .myf-box.is-yellow { --box-bg: #fff2c4; --box-border: #f1d33a; }

/* Quadros da direita (largos): texto à esquerda e o espaço à direita. Da esquerda (altos): em coluna. */
body[data-design] .myf-box.is-lilac,
body[data-design] .myf-box.is-yellow {
  flex-direction: column;
}

body[data-design] .myf-box-text {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.6cqw;
}

body[data-design] .myf-icon {
  display: block;
  flex: 0 1 auto;
  min-height: 0;
  max-width: 100%;
  max-height: 58%;
  object-fit: contain;
  object-position: left center;
  align-self: flex-start;
  padding: 0.4cqw;
  border: 0.3cqw solid var(--box-border);
  border-radius: 1cqw;
  background: #fff;
  box-sizing: border-box;
}

body[data-design] .myf-box-label {
  color: #292627;
  font-size: 1.9cqw;
  font-weight: 900;
  line-height: 1.15;
}

/* Espaço tracejado para escolher. */
body[data-design] .myf-slot {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  aspect-ratio: 1;
  height: 100%;
  max-height: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0.4cqw;
  overflow: hidden;
  box-sizing: border-box;
  border: 0.25cqw dashed #9aa0a6;
  border-radius: 1.4cqw;
  background: #fff;
  cursor: pointer;
}

body[data-design] .myf-box.is-lilac .myf-slot,
body[data-design] .myf-box.is-yellow .myf-slot {
  height: auto;
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  aspect-ratio: auto;
}

body[data-design] .myf-feel .myf-slot {
  height: 100%;
}

body[data-design] .myf-slot.is-filled {
  border-style: solid;
  border-color: #cfd5db;
}

body[data-design] .myf-slot.is-emotion.is-filled {
  border: 0;
  background: transparent;
}

body[data-design] .myf-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

body[data-design] .myf-plus {
  color: #9aa0a6;
  font-size: 4cqw;
  font-weight: 300;
  line-height: 1;
}

body[data-design] .myf-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4cqw;
  width: 100%;
  height: 100%;
  animation: myfIn 0.3s ease;
}

body[data-design] .myf-chip .myf-emoji {
  font-size: 4.6cqw;
  line-height: 1;
}

body[data-design] .myf-chip-label {
  color: #292627;
  font-size: 1.55cqw;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
}

@keyframes myfIn {
  from { transform: scale(0.6); opacity: 0.3; }
  to { transform: scale(1); opacity: 1; }
}

/* Tela de opções (usa a mesma janela do Como Estou Me Sentindo). */
.myf-chooser-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.myf-chooser-grid {
  grid-template-columns: repeat(auto-fill, minmax(clamp(120px, 17vw, 160px), 1fr)) !important;
}

.myf-option {
  display: grid;
  place-items: center;
  gap: 6px;
  aspect-ratio: 1;
  padding: 10px;
  border: 4px solid #cfd5db;
  border-radius: 18px;
  background: #fff;
  color: #292627;
  font: inherit;
  font-size: clamp(0.95rem, 1.8vw, 1.2rem);
  font-weight: 900;
  text-align: center;
  cursor: pointer;
}

.myf-option .myf-emoji {
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  line-height: 1;
}

.myf-option.is-green { border-color: #7cc242; background: #f3f9ea; }
.myf-option.is-red { border-color: #c8102e; background: #fdf0f0; }
.myf-option.is-teal { border-color: #2aa198; background: #ecf8f4; }
.myf-option.is-lilac { border-color: #5b3f8c; background: #f4f3fa; }
.myf-option.is-yellow { border-color: #f1d33a; background: #fffbea; }

/* Em pé: o quadro fica em pé (595×842) e as peças usam as posições --p*. */
@media (orientation: portrait) {
  body[data-design]:not(.training-fullscreen) .choices.myf-workspace {
    --myf-height: clamp(440px, calc(100dvh - 330px), 900px);
  }

  body[data-design] .myf-board {
    --ratio: 0.7067;
    aspect-ratio: 595 / 842;
  }

  body[data-design] .myf-board > * {
    --x: var(--px);
    --y: var(--py);
    --w: var(--pw);
    --h: var(--ph);
  }


  body[data-design] .myf-feel-label { font-size: 4.4cqw; text-align: right; }
  body[data-design] .myf-box-label { font-size: 2.9cqw; }
  body[data-design] .myf-chip .myf-emoji { font-size: 6.5cqw; }
  body[data-design] .myf-chip-label { font-size: 2.4cqw; }
  body[data-design] .myf-plus { font-size: 6cqw; }

  /* Em pé os quadros da direita também ficam em coluna (são estreitos). */
  body[data-design] .myf-box.is-green,
  body[data-design] .myf-box.is-red,
  body[data-design] .myf-box.is-teal {
    flex-direction: column;
  }

  body[data-design] .myf-box .myf-slot {
    height: auto;
    width: 100%;
    flex: 1 1 0;
    min-height: 0;
    aspect-ratio: auto;
  }

  body[data-design] .myf-box-text {
    flex: 0 0 auto;
  }

  body[data-design] .myf-icon {
    max-height: 9cqw;
  }
}

/* Opções com figura (pensamentos). */
body[data-design] .myf-chip .myf-art {
  flex: 1 1 0;
  width: 100%;
  min-height: 0;
  object-fit: contain;
}

.myf-option.has-image {
  grid-template-rows: minmax(0, 1fr) auto;
  padding: 8px;
}

.myf-option .myf-art {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

/* Cartões prontos (Twinkl): só a figura, com os cantos arredondados dela. */
.myf-option .myf-card,
.myf-card-option .myf-card {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

body[data-design] .myf-slot:has(.myf-card) {
  border: 0;
  background: transparent;
}

.myf-card-option {
  background: transparent !important;
}

/* Figura inteira dentro do espaço (sem cortar nem passar da borda). */
body[data-design] .myf-slot > img,
body[data-design] .myf-slot > img.myf-card {
  position: absolute;
  inset: 0.4cqw;
  width: calc(100% - 0.8cqw);
  height: calc(100% - 0.8cqw);
  object-fit: contain;
}

/* Barra lateral: escolha do personagem em destaque, no mesmo estilo do botão "Som ligado". */
body[data-design] #myFeelingsCharacterPanel select {
  min-height: 46px;
  padding: 8px 36px 8px 14px;
  font-size: 0.9rem;
  border: 1px solid var(--app-blue-dark);
  border-radius: 12px;
  background: var(--app-blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 7l5 6 5-6' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 18px 18px;
  color: #fff;
  font-weight: 900;
  box-shadow: inset 0 -5px 0 var(--app-blue-dark), var(--app-shadow-soft);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

body[data-design] #myFeelingsCharacterPanel select:active {
  box-shadow: inset 0 -2px 0 var(--app-blue-dark);
}

body[data-design] #myFeelingsCharacterPanel select option {
  background: #fff;
  color: #292627;
}
