#projector {
  --assembly-pond:linear-gradient(#fff4db55,#e1f6e61a 29%,#2c74602b),
    url('assets/patitos-acuarela/estanque-asistencia.webp') center / cover no-repeat,#b6dcd1;
  --assembly-classroom:linear-gradient(#fff9e123,#f6e5c336),
    url('assets/patitos-acuarela/aula-recuento.webp') center / cover no-repeat,#f5e5cc;
  --assembly-nest:linear-gradient(#fff4dd17,#fff4dd00 68%,#f3dbac38),
    url('assets/patitos-acuarela/nido-en-casa.webp') center 62% / cover no-repeat,#f6e7cf;
}

#projector:has(.projection-main .hatch-attendance) .projection-main {
  width:100%; max-width:none; padding:0; margin:0; display:flex; overflow:auto;
  scrollbar-color:#619487 #c8e1d5;
}

.hatch-attendance {
  display:flex; flex-direction:column; justify-content:center; gap:clamp(4px,1.4dvh,16px);
  width:100%; min-height:100%; flex:1 0 auto; margin:0;
  padding:clamp(8px,1.5dvh,20px) clamp(10px,3.1vw,60px);
  color:#3c2e48; box-sizing:border-box;
  background:var(--assembly-pond);
}
.hatch-attendance header { text-align:center; flex:0 0 auto; }
.hatch-attendance header h2 {
  display:inline-block; max-width:100%; margin:0; padding:.2em .65em .25em; box-sizing:border-box;
  color:#44324d; background:#fff9e7f2; border:1px solid #fffefa; border-radius:.65em;
  font-size:clamp(1.35rem,min(3.25vw,5.1dvh),3.7rem); font-weight:900; line-height:1.07;
  box-shadow:0 4px 16px #405d5033; text-shadow:0 1px #fff;
}
.hatch-grid {
  display:grid; grid-template-columns:repeat(6,minmax(0,1fr));
  align-items:center; justify-items:center; gap:clamp(4px,1dvh,14px) clamp(4px,1.1vw,20px);
  width:min(100%,1800px); margin:0 auto;
}
.hatch-egg {
  display:grid; grid-template-rows:auto minmax(2.2em,auto); justify-items:center; align-items:center;
  width:100%; min-width:0; min-height:0; padding:0 3px 3px;
  border:1.5px solid transparent; border-radius:21px; background:transparent;
  box-shadow:none; color:#3e2d48; cursor:pointer; touch-action:manipulation;
}
.hatch-egg:hover { background:#ffffe731; border-color:#ffffe7a6; box-shadow:none; }
.hatch-egg:focus-visible { outline:3px solid #5c365e; outline-offset:-2px; background:#fff8e766; }
.hatch-egg strong {
  display:grid; place-items:center; min-height:2em; max-width:100%; box-sizing:border-box;
  padding:.32em .65em; border:1px solid #fffdf2; border-radius:1em;
  font-size:clamp(.82rem,1.65vw,1.6rem); font-weight:900; line-height:1.06;
  overflow-wrap:anywhere; background:#fff9e8f7; box-shadow:0 3px 8px #254d4540;
}
.hatch-egg.is-present strong { background:#e9f4cc; color:#2d542f; border-color:#fbffe9; }
.hatch-egg small { display:none; }
.hatch-art {
  display:block; width:auto; max-width:100%; height:clamp(82px,28dvh,270px); overflow:visible;
  filter:drop-shadow(0 3px 3px #2c594644);
}
.hatch-crack,.hatch-top,.hatch-bottom,.hatch-hero,.hatch-fragment,.hatch-sparks { opacity:0; }
.hatch-hero,.hatch-cape,.hatch-shell,.hatch-top,.hatch-water,.hatch-sparks,.hatch-fragment {
  transform-box:fill-box; transform-origin:center;
}
.is-present .hatch-closed,.is-present .hatch-dots,.is-present .hatch-shell-shine { opacity:0; }
.is-present .hatch-hero { opacity:1; transform:translateY(-8px); }
.is-present .hatch-bottom { opacity:1; transform:translateY(1px) scale(.92); transform-origin:66px 110px; }
.is-hatching .hatch-shell { animation:pond-wobble .34s ease-in-out; }
.is-hatching .hatch-closed,.is-hatching .hatch-dots,.is-hatching .hatch-shell-shine { animation:pond-closed .36s step-end both; }
.is-hatching .hatch-crack { animation:pond-crack .26s .1s ease-out both; }
.is-hatching .hatch-top { animation:pond-shell-fly .48s .34s ease-out forwards; }
.is-hatching .hatch-bottom { animation:pond-shell-land .48s .34s ease-out both; }
.is-hatching .hatch-fragment { animation:pond-fragment .57s .36s ease-out forwards; }
.is-hatching .hatch-hero { animation:pond-hero-rise .56s .34s cubic-bezier(.24,.68,.33,1) both; }
.is-hatching .hatch-cape { animation:pond-cape .54s .39s ease-out both; }
.is-hatching .hatch-water { animation:pond-ripple .72s .35s ease-out both; }
.is-hatching .hatch-sparks { animation:pond-stars .64s .43s ease-out both; }

@keyframes pond-wobble {
  0%,100% { transform:none; }
  20%,65% { transform:rotate(-9deg) translateX(-2px); }
  42%,84% { transform:rotate(9deg) translateX(2px); }
}
@keyframes pond-closed { from { opacity:1; } to { opacity:0; } }
@keyframes pond-crack {
  from { opacity:1; stroke-dasharray:1; stroke-dashoffset:1; }
  87% { opacity:1; stroke-dasharray:1; stroke-dashoffset:0; }
  to { opacity:0; stroke-dashoffset:0; }
}
@keyframes pond-shell-fly {
  0% { opacity:1; transform:none; }
  55% { opacity:1; transform:translate(-22px,-27px) rotate(-44deg); }
  100% { opacity:0; transform:translate(-43px,19px) rotate(-95deg) scale(.6); }
}
@keyframes pond-shell-land {
  0% { opacity:0; transform:none; }
  12% { opacity:1; transform:none; }
  62% { opacity:1; transform:translateY(4px) scale(.88); }
  100% { opacity:1; transform:translateY(1px) scale(.92); }
}
@keyframes pond-fragment {
  0% { opacity:1; transform:none; }
  53% { opacity:1; transform:translate(var(--scatter-x),var(--scatter-y)) rotate(var(--spin)); }
  100% { opacity:0; transform:translate(var(--scatter-x),23px) rotate(var(--spin)) scale(.72); }
}
@keyframes pond-hero-rise {
  0% { opacity:0; transform:translateY(24px) scale(.57); }
  25% { opacity:1; }
  58% { opacity:1; transform:translateY(-20px) scale(1.09) rotate(-5deg); }
  78% { opacity:1; transform:translateY(-5px) scale(.97) rotate(3deg); }
  100% { opacity:1; transform:translateY(-8px); }
}
@keyframes pond-cape {
  0%,100% { transform:none; }
  40% { transform:scaleX(1.07) rotate(-8deg); }
  75% { transform:scaleX(.96) rotate(4deg); }
}
@keyframes pond-ripple {
  0%,100% { transform:none; opacity:1; }
  68% { transform:scale(1.22,1.16); opacity:.48; }
}
@keyframes pond-stars {
  0% { opacity:0; transform:scale(.53); }
  40% { opacity:1; transform:scale(1.05) rotate(5deg); }
  100% { opacity:0; transform:scale(1.22) translateY(-12px); }
}

@media(max-height:740px) and (min-width:900px) {
  .hatch-art { height:clamp(75px,25dvh,182px); }
}
@media(max-width:899px) {
  .hatch-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .hatch-art { height:clamp(70px,20vw,148px); }
  .hatch-attendance { justify-content:flex-start; }
}
@media(max-width:520px) {
  .hatch-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .hatch-art { height:clamp(70px,24vw,124px); }
  .hatch-attendance { background-position:center; padding-inline:6px; }
}
@media(prefers-reduced-motion:reduce) {
  .is-hatching .hatch-art * { animation:none; }
}


/* Two boards for writing with the classroom pen. */
.pond-writing {
  justify-content:flex-start; gap:clamp(8px,1.5dvh,18px);
  padding-inline:clamp(10px,2.6vw,42px);
}
.pond-school {
  background:var(--assembly-classroom);
}
.pond-school { align-items:center; justify-content:center; }
.pond-classroom-grid {
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:stretch;
  gap:clamp(8px,2.5vw,40px); width:min(100%,1240px);
}
.pond-count-group { min-width:0; text-align:center; }
.pond-school .pond-count-group {
  display:flex; flex-direction:column; justify-content:flex-start;
  min-height:clamp(126px,23dvh,240px); padding:clamp(7px,1.1dvh,14px) 5px 16px;
  border:2px solid #fff8eb; border-radius:20px; background:#fff7e5ed;
  box-shadow:inset 0 -9px 0 #bd815b,inset 0 -13px 0 #e0af78,0 7px 14px #71533d2e;
}
.pond-equation {
  display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr) auto minmax(0,1fr);
  align-items:center; justify-items:center; gap:clamp(5px,1.4vw,24px);
  width:min(100%,850px); padding:clamp(5px,1dvh,12px) 0;
}
.pond-count-group h3 {
  width:fit-content; margin:0 auto 4px; padding:.25em .65em;
  border-radius:.65em; background:#fffaf0; color:#44324d;
  font-size:clamp(.95rem,2vw,1.8rem); font-weight:900;
}
.pond-school .pond-count-group > h3 { flex:none; }
.pond-school .pond-count-group > :is(.pond-tokens,.pond-empty) { margin-block:auto; }
.pond-count-girls h3 { background:#ffe7eb; }
.pond-count-boys h3 { background:#e3f2dc; }
.pond-count-group h3,.pond-writing-label {
  display:inline-flex; align-items:center; justify-content:center; gap:clamp(3px,1vw,12px);
}
.pond-count-icon { display:block; flex:none; width:clamp(28px,4.5vmin,58px); height:auto; }
.pond-writing-label { min-height:clamp(24px,3.3vmin,42px); box-sizing:content-box; }
.pond-writing-label .pond-count-icon { width:clamp(24px,3.3vmin,42px); }
.pond-tokens { display:flex; flex-wrap:wrap; justify-content:center; align-items:end; gap:4px; }
.pond-token {
  position:relative; display:grid; grid-template-rows:auto minmax(1.8em,auto);
  align-items:center; justify-items:center; min-width:0; min-height:0; width:clamp(55px,8vw,112px);
  padding:2px; border:2px solid transparent; border-radius:12px; box-shadow:none;
  background:transparent; color:#44324d; cursor:pointer; touch-action:manipulation;
}
.pond-token .hatch-art { height:clamp(49px,11dvh,126px); filter:drop-shadow(0 2px 2px #50432e30); }
.pond-token span {
  max-width:100%; padding:.22em .35em; border-radius:.55em; background:#fffaf0f5;
  font-size:clamp(.61rem,.91vw,.94rem); font-weight:900; line-height:1.12; overflow-wrap:break-word;
}
.pond-token:hover { background:#fffdf780; box-shadow:none; }
.pond-token:focus-visible,.pond-erase:focus-visible { outline:3px solid #6c476b; outline-offset:2px; }
.pond-token.is-counted { background:#f0f9d4d9; border-color:#49754a; }
.pond-token i {
  position:absolute; top:0; right:0; display:none; place-items:center; width:1.4em; height:1.4em;
  border-radius:50%; background:#436d45; color:#fff; font-style:normal; font-weight:900;
}
.pond-token.is-counted i { display:grid; }
.pond-empty {
  width:fit-content; margin:10px auto 18px; padding:6px 10px; border-radius:10px;
  background:#fff9e8f5; color:#44324d; font-size:clamp(.74rem,1.5vw,1.1rem); font-weight:900;
}
.pond-writing-field {
  display:grid; justify-items:center; gap:4px; align-content:start;
  width:min(100%,235px); margin-inline:auto;
}
.pond-writing-label {
  padding:3px 8px; border-radius:9px; background:#fffaf0f5; color:#44324d;
  font-size:clamp(.68rem,1.38vw,1.2rem); font-weight:900; text-align:center;
}
.pond-writing-pad {
  display:block; width:min(100%,clamp(100px,17vw,225px)); height:clamp(76px,17dvh,170px);
  border:2px dashed #8b6f83; border-radius:12px; box-sizing:border-box; overflow:hidden;
  background:#fffef9; color:#392841; box-shadow:0 4px 10px #59414830;
  touch-action:none; user-select:none; cursor:crosshair;
}
.pond-erase {
  min-height:36px; padding:4px 10px; border:1px solid #e5cdbc; border-radius:10px;
  box-shadow:none; background:#fff9edf2; color:#65445b; font-size:.73rem; font-weight:800;
}
.pond-plus,.pond-equals {
  display:grid; place-items:center; align-self:center;
  width:clamp(33px,6.3vw,105px); aspect-ratio:1; border-radius:.42em;
  background:#fff9e7f5; color:#44324d; box-shadow:0 3px 8px #59414824;
  font:900 clamp(2rem,6vw,5.8rem)/1 system-ui,sans-serif;
}
.pond-school .pond-group-many .pond-tokens { width:min(100%,490px); margin-inline:auto; }
.pond-school .pond-group-many .pond-token { width:clamp(55px,7vw,112px); }
.pond-absent {
  display:flex; flex-direction:column; align-items:center; justify-content:flex-start;
  align-self:stretch; width:100%; margin-inline:auto; min-width:0;
  padding-block:clamp(10px,2.2dvh,28px);
  background:var(--assembly-nest);
}
.pond-absent > header { flex:none; width:100%; text-align:center; }
.pond-home-nest {
  display:flex; flex:1 0 auto; align-items:center; justify-content:center; align-self:center;
  width:min(100%,1400px); min-width:0; min-height:clamp(150px,28dvh,290px);
  padding:clamp(16px,6dvh,75px) 0 0; box-sizing:border-box;
}
.pond-home-nest .pond-count-group { width:100%; min-width:0; }
.pond-absent .pond-tokens {
  display:flex; flex-wrap:wrap; justify-content:center; align-items:flex-end;
  width:100%; margin:0 auto; gap:clamp(6px,1.6vw,30px);
}
.pond-absent .hatch-leaf,.pond-absent .hatch-water { display:none; }
.pond-absent .pond-token { width:clamp(82px,12vw,184px); }
.pond-absent .pond-token .hatch-art { width:100%; height:clamp(102px,24dvh,225px); }
.pond-absent .pond-group-many .pond-token { width:clamp(73px,10vw,147px); }
.pond-absent .pond-group-many .hatch-art { height:clamp(81px,16dvh,155px); }
.pond-absent .pond-token span { font-size:clamp(.76rem,1.25vw,1.2rem); }
.pond-absent .pond-writing-field { flex:none; width:min(100%,285px); margin-inline:auto; }
.pond-absent .pond-writing-pad { width:min(100%,240px); }
@media(max-width:720px) {
  .pond-writing { justify-content:flex-start; }
  .pond-token,.pond-school .pond-group-many .pond-token { width:clamp(55px,13vw,79px); }
  .pond-token .hatch-art { height:clamp(46px,10vw,72px); }
  .pond-absent { background-position:center 58%; }
  .pond-absent .pond-token,.pond-absent .pond-group-many .pond-token { width:clamp(66px,20vw,106px); }
  .pond-absent .pond-token .hatch-art { height:clamp(78px,23vw,125px); }
}




.pond-token-static,.pond-token-static:hover { cursor:default; background:transparent; }

/* Extend the scene behind the controls in native and fallback fullscreen. */
:is(#projector:fullscreen,#projector:-webkit-full-screen,.story-fullscreen-fallback #projector)
#projection-content:is(:has(.projection-main:is(
  [data-game="encargado"],[data-game="dia-semana"],[data-game="calendario"],
  [data-game="estacion"],[data-game="emociones"],
  [data-game="numero"],[data-game="letra"]
),.hatch-attendance),:has(.count-story):not(:has(.count-extra))) {
  background:var(--assembly-scene,radial-gradient(ellipse at top,#fffbec,#f6e1c5));
}
#projection-content:has(.hatch-attendance:not(.pond-writing)) { --assembly-scene:var(--assembly-pond); }
#projection-content:has(.pond-school) { --assembly-scene:var(--assembly-classroom); }
#projection-content:has(.pond-absent) { --assembly-scene:var(--assembly-nest); }
#projection-content:has(.count-story):not(:has(.count-extra)) {
  --assembly-scene:radial-gradient(ellipse at center,#fff7e0,#dfede1);
}
#projection-content:has(.projection-main[data-game="estacion"]) {
  --assembly-scene:linear-gradient(#f9edd7,#e4eedc);
}

:is(#projector:fullscreen,#projector:-webkit-full-screen,.story-fullscreen-fallback #projector)
.projection-main:is(
  [data-game="encargado"],[data-game="dia-semana"],[data-game="calendario"],
  [data-game="estacion"],[data-game="emociones"],
  [data-game="numero"],[data-game="letra"],
  :has(.hatch-attendance),:has(.count-story):not(:has(.count-extra))
) { width:100%; max-width:none; }

:is(#projector:fullscreen,#projector:-webkit-full-screen,.story-fullscreen-fallback #projector)
#projection-content:is(:has(.projection-main:is(
  [data-game="encargado"],[data-game="dia-semana"],[data-game="calendario"],
  [data-game="estacion"],[data-game="emociones"],
  [data-game="numero"],[data-game="letra"]
),.hatch-attendance),:has(.count-story):not(:has(.count-extra)))
> :is(.projection-toolbar,.aula-projection-controls,.projection-footer) {
  background:#fffaf0e6;
}

:is(#projector:fullscreen,#projector:-webkit-full-screen,.story-fullscreen-fallback #projector)
.projection-main:is(:has(.hatch-attendance),:has(.count-story):not(:has(.count-extra))),
:is(#projector:fullscreen,#projector:-webkit-full-screen,.story-fullscreen-fallback #projector)
.hatch-attendance { background:transparent; }

/* Reserve the toolbar and footer first; the activity uses the remaining height. */
:is(#projector:fullscreen,#projector:-webkit-full-screen,.story-fullscreen-fallback #projector)
#projection-content:has(.pond-absent) > .projection-main {
  flex:1 1 0;
  min-height:0;
  width:100%;
  max-width:none;
  align-self:stretch;
  margin:0;
}

:is(#projector:fullscreen,#projector:-webkit-full-screen,.story-fullscreen-fallback #projector)
#projection-content > .projection-main:has(.pond-absent) {
  container-type:size;
  overflow:auto;
  padding:0;
}

/* Size the eggs and writing pad against the space available inside the visor. */
@container (min-height:0px) {
  .pond-absent {
    display:grid;
    grid-template-rows:auto minmax(min-content,1fr) auto;
    justify-items:center;
    align-items:center;
    min-height:max(100%,380px);
    padding-block:clamp(5px,1.3cqh,16px);
    gap:clamp(5px,1.1cqh,14px);
  }
  .pond-absent .pond-home-nest { min-height:0; padding:0; }
  .pond-absent .pond-token .hatch-art { height:clamp(58px,23cqh,190px); }
  .pond-absent .pond-group-many .pond-token .hatch-art { height:clamp(42px,14cqh,135px); }
  .pond-absent .pond-writing-pad { height:clamp(68px,15cqh,145px); }
}

@media (max-width:720px) {
  @container (min-height:0px) {
    .pond-absent .pond-group-many .pond-token { width:clamp(36px,12.4vw,88px); }
    .pond-absent .pond-group-many .pond-token span { font-size:clamp(.64rem,1.8vw,.76rem); }
    .pond-absent .pond-group-many .pond-token .hatch-art { height:clamp(35px,11cqh,90px); }
  }
}

#projector:has(.pond-absent) .projection-main {
  flex-direction: column;
  align-items: stretch;
}
#projection-content .pond-absent {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-items: center;
  margin-inline: auto;
}
#projection-content .pond-absent > header {
  width: 100%;
  text-align: center;
}
#projection-content .pond-absent > header h2 {
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
}
#projection-content .pond-absent .pond-home-nest {
  width: 100%;
  justify-self: center;
}
#projection-content .pond-absent .pond-tokens {
  justify-content: center;
}
#projection-content .pond-absent > .pond-writing-field {
  justify-self: center;
  align-self: center;
  margin-inline: auto;
}
