/* Atividades principais (v4). Cada atividade ocupa toda a .activity-shell e cabe sem rolagem.
   O .act-root é um container de tamanho: as medidas internas usam cqw/cqh, e o arranjo
   muda quando a área é larga (celular deitado, tablet deitado). */
.act-root {
  --act-ink: #294639; --act-green: #3f6a43; --act-green-dark: #2c4b30; --act-gold: #f0b740;
  --act-gold-soft: #fff1c9; --act-paper: #fffdf4; --act-card: #fbf8ea; --act-line: #e0e6d2; --act-warn: #e2732f;
  container: act / size;
  position: relative; display: flex; flex-direction: column;
  flex: 1; width: 100%; max-width: 980px; min-height: 0; height: 100%; margin: 0 auto;
  padding: 8px; overflow: hidden; color: var(--act-ink);
  font-family: var(--font, "Avenir Next", "Trebuchet MS", system-ui, sans-serif);
  -webkit-user-select: none; user-select: none;
}
.act-root *, .act-root *::before, .act-root *::after { box-sizing: border-box; }
.act-root [hidden] { display: none !important; }
.act-root button {
  font: inherit; color: inherit; margin: 0; cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent; min-width: 64px; min-height: 64px;
}
.act-root button:focus-visible, .act-root [tabindex]:focus-visible { outline: 4px solid #d68d22; outline-offset: 3px; }
.act-root img, .act-root svg { display: block; }
.act-root .sprite-art, .act-root img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }

/* Emoji em círculo quando a arte avulsa ainda não existe. */
.act-emoji { container-type: size; display: grid; place-items: center; width: 100%; height: 100%; }
.act-emoji > span {
  display: grid; place-items: center; width: 92cqmin; height: 92cqmin; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff 0 45%, #f6efd6 75%); border: 3px solid #fff;
  box-shadow: 0 4px 10px rgb(52 80 40 / 22%); font-size: 54cqmin; line-height: 1;
}

/* Comum: tremidinha no erro e pulso no próximo passo. */
.act-shake { animation: act-shake .42s ease; }
@keyframes act-shake { 0%, 100% { translate: 0 0; } 20% { translate: -9px 0; } 45% { translate: 8px 0; } 70% { translate: -5px 0; } }
.act-pulse { animation: act-pulse 1.5s ease-in-out infinite; }
@keyframes act-pulse {
  0%, 100% { scale: 1; box-shadow: 0 5px 0 rgb(0 0 0 / 10%), 0 0 0 0 rgb(240 183 64 / 0%); }
  50% { scale: 1.035; box-shadow: 0 5px 0 rgb(0 0 0 / 10%), 0 0 0 8px rgb(240 183 64 / 60%); }
}

/* ================= 1. Ligue os pares ================= */
.act-pair-board {
  position: relative; flex: 1; min-height: 0; width: 100%; max-width: 640px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: clamp(44px, 15cqw, 120px);
}
.act-pair-group { position: relative; z-index: 1; min-height: 0; display: grid; grid-template-rows: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 2.2cqh, 18px); }
.act-pair-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 2; }
.act-pair-line { fill: none; stroke-width: 6; stroke-linecap: round; }
.act-pair-dot { stroke: #fff; stroke-width: 3; }
.act-line-new { stroke-dasharray: 1; stroke-dashoffset: 1; animation: act-draw .5s ease-out forwards; }
@keyframes act-draw { to { stroke-dashoffset: 0; } }
.act-pair-card {
  position: relative; display: grid; place-items: center; width: 100%; height: 100%; min-height: 64px; padding: 4px;
  border: 3px solid #e3e7d5; border-bottom-width: 6px; border-radius: 20px; background: var(--act-card);
  transition: background .15s, border-color .15s, transform .15s;
}
.act-pair-art { display: block; width: 100%; height: 100%; min-height: 0; }
.act-pair-card:hover:not(.act-matched) { border-color: #e2c27a; }
.act-pair-card.act-selected { background: var(--act-gold-soft); border-color: var(--act-gold); transform: scale(1.03); box-shadow: 0 0 0 5px rgb(240 183 64 / 40%); }
.act-pair-card.act-selected .act-pair-art { animation: act-bob 1s ease-in-out infinite; }
@keyframes act-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }
.act-pair-card.act-matched { cursor: default; border-color: var(--pair); background: color-mix(in srgb, var(--pair) 14%, #fffdf4); }
.act-pair-check {
  position: absolute; top: -8px; right: -8px; z-index: 3; display: none; width: 30px; height: 30px; padding: 5px;
  border-radius: 50%; background: var(--pair); color: #fff; border: 3px solid #fff; box-shadow: 0 2px 6px rgb(0 0 0 / 18%);
}
.act-pair-check svg { width: 100%; height: 100%; stroke-width: 3; }
.act-matched .act-pair-check { display: block; animation: act-pop .35s ease-out; }
@keyframes act-pop { 0% { scale: .3; opacity: 0; } 70% { scale: 1.15; opacity: 1; } 100% { scale: 1; } }
/* Área larga: um grupo em cima, outro embaixo. */
@container act (min-aspect-ratio: 6 / 5) {
  .act-pair-board { max-width: 900px; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); column-gap: 0; row-gap: clamp(30px, 13cqh, 90px); }
  .act-pair-group { grid-template-rows: minmax(0, 1fr); grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 2.4cqw, 22px); }
}

/* ================= 2. Encontre a ovelhinha ================= */
.act-hide-scene { position: relative; flex: 1; min-height: 0; border-radius: 22px; overflow: hidden; background: #d6e7b2; isolation: isolate; }
.act-hide-bg { position: absolute; inset: 0; z-index: -2; object-fit: cover !important; object-position: 50% 62%; filter: saturate(.6) blur(1.2px); scale: 1.03; }
.act-hide-scene::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(rgb(255 252 235 / 22%), rgb(255 252 235 / 40%)); pointer-events: none; }
.act-bush::after { content: ""; position: absolute; z-index: 0; left: 6%; right: 6%; bottom: -4%; height: 22%; border-radius: 50%; background: radial-gradient(closest-side, rgb(48 74 30 / 38%), transparent); pointer-events: none; }
.act-hide-bushes { position: absolute; inset: 0; }
.act-bush {
  --w: clamp(72px, min(38cqw, 28cqh), 230px);
  position: absolute; left: var(--x); top: var(--y); width: var(--w); height: calc(var(--w) * .8);
  translate: -50% -50%; padding: 0; border: 0; border-radius: 24px; background: none;
}
.act-bush[data-bush="0"] { --x: 26%; --y: 30%; }
.act-bush[data-bush="1"] { --x: 74%; --y: 30%; }
.act-bush[data-bush="2"] { --x: 50%; --y: 55%; }
.act-bush[data-bush="3"] { --x: 26%; --y: 80%; }
.act-bush[data-bush="4"] { --x: 74%; --y: 80%; }
@container act (min-aspect-ratio: 6 / 5) {
  .act-bush { --w: clamp(72px, min(25cqw, 58cqh), 260px); }
  .act-bush[data-bush="0"] { --x: 17%; --y: 30%; }
  .act-bush[data-bush="1"] { --x: 50%; --y: 30%; }
  .act-bush[data-bush="2"] { --x: 83%; --y: 30%; }
  .act-bush[data-bush="3"] { --x: 33%; --y: 75%; }
  .act-bush[data-bush="4"] { --x: 67%; --y: 75%; }
}
.act-bush-art { position: absolute; inset: 0; z-index: 2; transform-origin: 50% 90%; filter: drop-shadow(0 0 5px rgb(255 253 225 / 95%)) drop-shadow(0 6px 4px rgb(40 66 26 / 40%)); transition: transform .4s ease, opacity .4s ease; }
.act-bush-art img { object-position: 50% 100%; }
.act-bush-ask {
  position: absolute; z-index: 3; top: -4%; right: 2%; display: grid; place-items: center;
  width: clamp(30px, calc(var(--w) * .3), 46px); aspect-ratio: 1; border-radius: 50%;
  background: var(--act-gold); color: #4b3b16; border: 3px solid #fffaf0; font-size: clamp(18px, calc(var(--w) * .18), 28px); font-weight: 900; line-height: 1;
  box-shadow: 0 3px 6px rgb(53 81 38 / 30%); animation: act-ask 2.4s ease-in-out infinite;
}
@keyframes act-ask { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }
.act-bush-who {
  position: absolute; z-index: 1; left: 2%; right: 2%; bottom: 24%; height: 112%;
  opacity: 0; transform: translateY(35%) scale(.5); transform-origin: 50% 100%;
  transition: opacity .3s ease, transform .5s cubic-bezier(.3, 1.5, .5, 1);
}
.act-bush:hover:not(.act-revealed) .act-bush-art { transform: scale(1.03); }
.act-rustling .act-bush-art { animation: act-rustle .32s ease-in-out infinite; }
.act-rustling .act-bush-ask { display: none; }
@keyframes act-rustle { 0%, 100% { rotate: 0deg; translate: 0 0; } 25% { rotate: -5deg; translate: -3px 0; } 75% { rotate: 5deg; translate: 3px 0; } }
.act-revealed { cursor: default; }
.act-revealed .act-bush-ask { display: none; }
.act-revealed .act-bush-art { transform: translateY(26%) scale(.82); }
.act-revealed .act-bush-who { opacity: 1; transform: none; }
.act-hide-busy .act-bush:not(.act-rustling) { cursor: default; }
.act-found::before {
  content: ""; position: absolute; z-index: 0; inset: -30% -25% -5%; border-radius: 50%;
  background: radial-gradient(circle, rgb(255 244 180 / 95%) 0 35%, rgb(255 236 150 / 45%) 55%, transparent 72%);
  animation: act-glow 1.6s ease-in-out infinite alternate;
}
.act-found .act-bush-who { transform: scale(1.18); }
@keyframes act-glow { from { opacity: .75; scale: .95; } to { opacity: 1; scale: 1.05; } }
.act-hide-done .act-bush:not(.act-found) { opacity: .55; }
.act-hide-done .act-bush-ask { display: none; }

/* ================= 3. Encha a cesta ================= */
.act-bread-stage {
  flex: 1; min-height: 0; display: grid; gap: clamp(8px, 2cqh, 16px);
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) auto;
  grid-template-areas: "basket" "food" "actions";
}
.act-bread-stage[data-phase="share"] { grid-template-rows: minmax(0, .9fr) minmax(0, 1.6fr); grid-template-areas: "basket" "families"; }
@container act (min-aspect-ratio: 6 / 5) {
  .act-bread-stage { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, .85fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "food basket actions"; }
  .act-bread-stage[data-phase="share"] { grid-template-columns: minmax(0, .8fr) minmax(0, 1.7fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "basket families"; }
}
.act-basket-zone { grid-area: basket; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.act-basket { position: relative; flex: 1; min-height: 0; width: 100%; max-width: 360px; }
.act-basket-box { position: absolute; left: 50%; top: 0; translate: -50% 0; height: 100%; max-width: 100%; aspect-ratio: 4 / 3; }
.act-basket-box > span { position: absolute; pointer-events: none; }
.act-basket-back, .act-basket-front { inset: 0; }
.act-basket-back svg, .act-basket-front svg { width: 100%; height: 100%; }
.act-basket-shine { z-index: 0; inset: -12% -8% 0; } .act-basket-back { z-index: 1; } .act-basket-food { z-index: 2; } .act-basket-front { z-index: 3; }
.act-basket-food { left: 13%; right: 13%; top: 4%; bottom: 47%; display: flex; flex-wrap: wrap-reverse; justify-content: center; align-content: flex-start; }
.act-pile-item { display: block; width: 25%; aspect-ratio: 1.25; margin: 0 -1.5% -4%; }
.act-pile-new { animation: act-drop .35s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes act-drop { from { translate: 0 -60%; scale: .6; opacity: 0; } to { translate: 0 0; scale: 1; opacity: 1; } }
.act-pile-over { filter: drop-shadow(0 0 4px var(--act-warn)) drop-shadow(0 0 2px var(--act-warn)); }
.act-basket-shine { border-radius: 50%; opacity: 0; background: radial-gradient(circle at 50% 45%, rgb(255 246 190 / 95%) 0 18%, rgb(255 230 140 / 45%) 40%, transparent 65%); }
.act-basket-ready .act-basket-shine, .act-basket-full .act-basket-shine { opacity: .55; }
.act-basket-ready .act-basket-shine { animation: act-shine 1.6s ease-in-out infinite alternate; }
.act-refill .act-basket-shine { animation: act-refill-shine .9s ease-out; }
.act-refill .act-basket-food { animation: act-refill .7s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes act-shine { from { opacity: .25; } to { opacity: .7; } }
@keyframes act-refill-shine { 0% { opacity: 1; scale: .6; } 60% { opacity: 1; scale: 1.25; } 100% { opacity: .55; scale: 1; } }
@keyframes act-refill { 0% { scale: .75; translate: 0 18%; opacity: .3; } 100% { scale: 1; translate: 0 0; opacity: 1; } }
.act-basket-caption { margin: 0; padding: 4px 12px; border-radius: 999px; background: var(--act-gold-soft); color: #6a4c12; font-size: clamp(16px, 3.6cqw, 21px); font-weight: 800; line-height: 1.25; text-align: center; }

.act-food-pad { grid-area: food; min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(10px, 3cqw, 22px); }
@container act (min-aspect-ratio: 6 / 5) { .act-food-pad { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); } }
/* Celular deitado: pouca altura, então os pontinhos ficam ao lado da figura. */
@container act (min-aspect-ratio: 6 / 5) and (max-height: 300px) {
  .act-food { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr); padding: 4px 8px 6px; }
  .act-slots { flex-direction: column; flex-wrap: wrap; max-height: 100%; align-content: center; gap: 3px; }
  .act-slots i { width: 13px; border-width: 2px; }
  .act-basket-caption { font-size: 16px; padding: 2px 10px; }
  .act-pair-board { row-gap: clamp(10px, 12cqh, 40px); }
}
.act-food {
  position: relative; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; place-items: center; gap: 4px; padding: 8px 6px 10px;
  border: 3px solid #e3d9b5; border-bottom-width: 7px; border-radius: 22px; background: var(--act-card);
}
.act-food:hover { border-color: #e2c27a; }
.act-food:active { translate: 0 3px; border-bottom-width: 4px; }
.act-food-art { width: 100%; height: 100%; min-height: 0; max-width: 170px; }
.act-food-full { border-color: #9cc27b; background: #eef6e2; }
.act-food-over { border-color: var(--act-warn); }
.act-slots { display: flex; justify-content: center; flex-wrap: wrap; gap: 5px; min-height: 18px; }
.act-slots i { width: clamp(14px, 3.2cqmin, 20px); aspect-ratio: 1; border-radius: 50%; background: #fff; border: 3px solid #d8c99d; }
.act-slots i.on { background: var(--act-gold); border-color: #c58f1d; animation: act-pop .3s ease-out; }
[data-add="fish"] .act-slots i.on { background: #69a6dd; border-color: #3f7cb3; }
.act-slots i.over { border-color: var(--act-warn); }
.act-slots i.over.on { background: var(--act-warn); border-color: #b4521b; }

.act-bread-actions { grid-area: actions; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(10px, 3cqw, 22px); align-content: center; }
@container act (min-aspect-ratio: 6 / 5) { .act-bread-actions { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); align-content: stretch; } }
.act-tool {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 72px; padding: 6px 12px;
  border-radius: 22px; border: 3px solid; border-bottom-width: 7px; font-size: clamp(16px, 2.4cqw + 6px, 22px) !important; font-weight: 800; line-height: 1.1;
}
@container act (min-aspect-ratio: 6 / 5) { .act-tool { flex-direction: column; gap: 4px; } }
.act-tool-icon { flex: none; width: clamp(36px, 9cqmin, 54px); aspect-ratio: 1; }
.act-tool-icon svg { width: 100%; height: 100%; }
.act-undo { background: #fff; border-color: #f0b98f; color: #b4521b; }
.act-undo:disabled { opacity: .35; cursor: default; }
.act-share { background: var(--act-green); border-color: var(--act-green-dark); color: #fff !important; }
.act-share[aria-disabled="true"] { background: #b9c6ad; border-color: #a2b294; color: #f4f7ef !important; }
.act-tool:active:not(:disabled):not([aria-disabled="true"]) { translate: 0 3px; border-bottom-width: 4px; }

.act-families { grid-area: families; min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: clamp(8px, 2.4cqmin, 18px); }
.act-family {
  position: relative; min-height: 0; padding: 6px; border: 3px solid #e3d9b5; border-bottom-width: 7px; border-radius: 22px;
  background: radial-gradient(ellipse at 50% 100%, #f3ead0 0 45%, var(--act-card) 70%);
}
.act-family:hover:not(.act-fed) { border-color: #e2c27a; }
.act-family-art { display: block; width: 100%; height: 100%; }
.act-families:not(:has(.act-fed)) .act-family { animation: act-ring 1.8s ease-in-out infinite; }
@keyframes act-ring { 0%, 100% { box-shadow: 0 0 0 0 rgb(240 183 64 / 0%); } 50% { box-shadow: 0 0 0 6px rgb(240 183 64 / 60%); } }
.act-fed { cursor: default; border-color: #9cc27b; background: radial-gradient(ellipse at 50% 100%, #dcedc5 0 45%, #f1f8e6 70%); }
.act-fed .act-family-art { animation: act-hop .5s ease-out .55s; }
@keyframes act-hop { 0%, 100% { translate: 0 0; } 40% { translate: 0 -8%; } }
.act-family-got {
  position: absolute; right: -6px; top: -8px; display: none; align-items: center; gap: 2px; height: clamp(28px, 8cqmin, 44px); padding: 3px 6px;
  border-radius: 999px; background: #fffef6; border: 2px solid #9cc27b; box-shadow: 0 2px 6px rgb(0 0 0 / 14%);
}
.act-family-got > span { display: block; height: 100%; aspect-ratio: 1.1; }
.act-family-check { color: #3f7a36; padding: 2px; }
.act-family-check svg { width: 100%; height: 100%; stroke-width: 3; }
.act-fed .act-family-got { display: flex; animation: act-pop .35s ease-out .5s backwards; }
.act-flyer { position: absolute; left: 0; top: 0; z-index: 20; display: flex; gap: 2px; width: 92px; height: 44px; pointer-events: none; filter: drop-shadow(0 6px 6px rgb(0 0 0 / 20%)); }
.act-flyer > span { display: block; flex: 1; }

/* ================= 4. O que ele fez? (samaritano) ================= */
.act-sam { flex: 1; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: clamp(8px, 2.4cqh, 18px); width: 100%; max-width: 820px; margin: 0 auto; }
.act-sam-prompt { margin: 0; padding: 0 4px; text-align: center; font-size: clamp(17px, min(5cqw, 7.5cqh), 28px); font-weight: 800; line-height: 1.25; text-wrap: balance; }
.act-sam-prompt:focus { outline: none; }
.act-sam-choices { min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(10px, 3cqw, 26px); }
.act-sam-enter .act-choice { animation: act-enter .4s ease-out backwards; }
.act-sam-enter .act-choice + .act-choice { animation-delay: .08s; }
@keyframes act-enter { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }
.act-choice {
  position: relative; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; place-items: center; gap: 6px; padding: 10px 8px 12px;
  border: 3px solid #e3d9b5; border-bottom-width: 7px; border-radius: 24px; background: var(--act-card);
  transition: opacity .3s, border-color .2s, background .2s;
}
.act-choice:hover:not([aria-disabled="true"]) { border-color: #e2c27a; }
.act-choice-art { display: block; width: 100%; height: 100%; min-height: 0; max-width: 300px; }
.act-choice-label { font-size: clamp(16px, min(4.2cqw, 6cqh), 22px); font-weight: 800; line-height: 1.2; text-align: center; text-wrap: balance; }
.act-choice-check {
  position: absolute; top: -8px; right: -8px; display: none; width: 40px; height: 40px; padding: 7px;
  border-radius: 50%; background: #3f7a36; color: #fff; border: 3px solid #fff; box-shadow: 0 2px 6px rgb(0 0 0 / 18%);
}
.act-choice-check svg { width: 100%; height: 100%; stroke-width: 3; }
.act-choice-correct { border-color: #8dbb6c; background: #eaf5dc; }
.act-choice-correct .act-choice-check { display: block; animation: act-pop .35s ease-out; }
.act-choice-faded { opacity: .35; }
.act-choice[aria-disabled="true"] { cursor: default; }

/* Menos movimento: sem animações, mas os destaques continuam visíveis. */
@media (prefers-reduced-motion: reduce) {
  .act-root *, .act-root *::before, .act-root *::after { animation: none !important; transition: none !important; }
  .act-pulse { box-shadow: 0 0 0 6px rgb(240 183 64 / 70%) !important; }
  .act-rustling .act-bush-art { outline: 4px dashed var(--act-gold); outline-offset: -6px; border-radius: 30%; }
  .act-line-new { stroke-dashoffset: 0; }
  .act-families:not(:has(.act-fed)) .act-family { box-shadow: 0 0 0 4px rgb(240 183 64 / 55%); }
}

/* Correção de layout do app (v2.css, @media ≤ 900px: ".progress-track { flex: 1 }") que fazia a barra de
   progresso da brincadeira crescer e roubar metade da altura da atividade. Pode ir para v2.css. */
.game-stage > .progress-track { flex: none; }
