/* Games B: Find the Chirp + Get Low and Go. Builds on site.css (tokens, .btn, .backlink). */

.page-game main {
  background-color: var(--cream);
  background-image: url("/assets/img/spot-wall.svg");
  background-size: 420px 420px;
  background-blend-mode: multiply;
}
.page-game main { position: relative; }
.page-game main::before {
  /* calm the spots down behind a busy game */
  content: ""; position: absolute; inset: 0; background: rgb(252 245 227 / 0.86); pointer-events: none;
}

.gb { scroll-margin-top: 84px; position: relative; padding: 10px var(--gutter) clamp(32px, 5vw, 64px); }
.gb-head {
  max-width: var(--maxw); margin: 0 auto 10px;
  display: flex; flex-wrap: wrap; align-items: center; column-gap: 20px;
}
.gb-head h1 { font-size: clamp(2rem, 1.6vw + 1.3rem, 3rem); margin: 0; }
.gb-head .backlink { min-height: 48px; }
.gb-stage { max-width: var(--maxw); margin: 0 auto; }
.gb [tabindex="-1"]:focus { outline: none; }

.gb-big { min-height: 68px; font-size: clamp(1.2rem, 0.5vw + 1.05rem, 1.45rem); padding-inline: 1.3em; border-radius: 20px; }
.gb-big .icon { width: 1.15em; height: 1.15em; }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }

.gb-bubble {
  position: relative; margin: 0;
  background: #fff; border: 3px solid var(--spot); border-radius: 22px;
  padding: 0.6em 0.95em 0.7em;
  font-family: var(--font-display); font-weight: 600; font-size: clamp(1.1rem, 0.4vw + 1rem, 1.35rem); line-height: 1.25;
  color: var(--spot);
  box-shadow: var(--shadow-1);
}
.gb-bubble.is-new { animation: gb-pop 0.45s var(--ease-bounce); }
@keyframes gb-pop { from { transform: scale(0.94); } to { transform: none; } }

.gb kbd {
  font-family: var(--font-body); font-weight: 800; font-size: 0.85em;
  padding: 1px 7px 2px; border: 2px solid var(--ink-soft); border-bottom-width: 3px; border-radius: 7px; background: #fff;
}

/* ================= Find the Chirp ================= */

.ftc-stage [hidden] { display: none !important; }
.ftc-stage > section { animation: ftc-in 0.5s var(--ease-out); }
@keyframes ftc-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.ftc-photo {
  position: relative; margin: 0;
  border: 10px solid #fff; border-radius: 24px; overflow: hidden;
  box-shadow: var(--shadow-2); background: #fff;
}
.ftc-photo img { width: 100%; height: 100%; object-fit: cover; }

/* --- start --- */
.ftc-intro {
  display: grid; gap: clamp(20px, 3vw, 48px); align-items: center;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  padding-block: clamp(8px, 2vw, 28px);
}
.ftc-photo--intro { transform: rotate(-1.5deg); }
.ftc-intro__text h2 { font-size: clamp(2.2rem, 2.6vw + 1.2rem, 3.8rem); color: var(--red-deep); }
.ftc-intro__text p { font-size: 1.25em; max-width: 26ch; color: var(--ink); }
@media (max-width: 760px) {
  .ftc-intro { grid-template-columns: 1fr; }
  .ftc-photo--intro { transform: none; }
  .ftc-intro__text .btn { width: 100%; }
}

/* --- the house --- */
.ftc-play {
  display: grid; gap: clamp(16px, 2vw, 28px); align-items: center;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
}
.ftc-guide { grid-column: 1; grid-row: 1; display: grid; gap: 14px; justify-items: center; }
.ftc-yard { grid-column: 2; grid-row: 1; }

.ftc-yard {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg);
  padding: clamp(16px, 2.4vw, 30px) clamp(12px, 3vw, 44px) 0;
  background:
    radial-gradient(60px 26px at 12% 16%, #fff 60%, transparent 62%),
    radial-gradient(44px 22px at 17% 12%, #fff 60%, transparent 62%),
    radial-gradient(70px 24px at 86% 22%, #fff 60%, transparent 62%),
    radial-gradient(46px 22px at 91% 17%, #fff 60%, transparent 62%),
    linear-gradient(to bottom, #8cc4ea, #b9dcf2 70%);
  box-shadow: var(--shadow-2);
}
.ftc-yard { --lawn: 64px; --sink: 30px; padding-bottom: var(--sink); }
.ftc-yard::after {
  /* the lawn: the house and Pepper stand on it */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--lawn);
  background: linear-gradient(to bottom, #6aa95a 0 6px, #5c9c4c 6px, var(--green) 60%);
}
.ftc-house::after {
  /* the house's shadow on the grass */
  content: ""; position: absolute; z-index: -1; left: -2%; right: -2%; bottom: -10px; height: 20px; pointer-events: none;
  background: radial-gradient(closest-side, rgb(25 45 15 / 0.42), rgb(25 45 15 / 0.14) 65%, transparent);
}
.ftc-walls { border-bottom: 8px solid #d8b864; }
.ftc-path {
  /* stepping stones from the front door down the lawn */
  position: absolute; z-index: 1; left: 50%; bottom: 4px; translate: -50% 0; width: 54px; height: calc(var(--sink) - 6px);
  background: radial-gradient(ellipse 15px 4.5px at 50% 50%, #d9d2c3 94%, transparent) 50% 4px / 100% 18px repeat-y;
  pointer-events: none;
}
.ftc-yard__shadow {
  position: absolute; z-index: 1; left: 2.5%; bottom: calc(var(--sink) - 26px); width: clamp(90px, 8vw, 120px); height: 16px; pointer-events: none;
  background: radial-gradient(closest-side, rgb(25 45 15 / 0.45), rgb(25 45 15 / 0.15) 60%, transparent);
}
.ftc-yard__pepper {
  position: absolute; z-index: 2; left: 2.5%; bottom: calc(var(--sink) - 18px); width: clamp(90px, 8vw, 120px);
  translate: 0 5.4%; pointer-events: none;
  filter: drop-shadow(0 2px 2px rgb(30 40 20 / 0.2));
}

.ftc-house {
  --siding: #f6dc8c;
  position: relative; z-index: 1;
  width: min(100%, 660px, calc((100svh - 300px) * 1.02));
  margin: 0 auto;
}

.ftc-roof { position: relative; aspect-ratio: 1 / 0.25; margin: 0 -4.5%; }
.ftc-roof::before,
.ftc-roof::after {
  content: ""; position: absolute; inset: 0;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.ftc-roof::before { background: #fff; }
.ftc-roof::after {
  inset: 9px 7px 0;
  background: repeating-linear-gradient(to bottom, #56627e 0 15px, #47526c 15px 17px);
}
.ftc-chimney {
  position: absolute; z-index: -1; right: 20%; bottom: 30%; width: 7%; height: 75%;
  background: repeating-linear-gradient(to bottom, #b8503f 0 9px, #9c3f31 9px 11px);
  border-radius: 3px 3px 0 0;
  box-shadow: 0 -6px 0 -1px #7c3227;
}
.ftc-attic {
  position: absolute; z-index: 1; left: 50%; bottom: 18%; width: 11%; aspect-ratio: 1;
  transform: translateX(-50%);
  border-radius: 50%; border: 5px solid #fff;
  background:
    linear-gradient(#fff, #fff) center / 3px 100% no-repeat,
    linear-gradient(#fff, #fff) center / 100% 3px no-repeat,
    #ffe7a3;
}

.ftc-walls {
  position: relative;
  padding: clamp(10px, 1.6vw, 20px) clamp(12px, 2vw, 26px) 0;
  background:
    repeating-linear-gradient(to bottom, var(--siding) 0 17px, #e7c56e 17px 19px);
  box-shadow: inset 12px 0 0 #fff, inset -12px 0 0 #fff;
}
.ftc-storey {
  display: grid; grid-template-columns: 1fr 1fr; align-items: end;
  gap: clamp(14px, 3vw, 40px);
  padding: 0 clamp(4px, 1.4vw, 18px) clamp(10px, 1.4vw, 16px);
}
.ftc-storey--down {
  grid-template-columns: 1fr auto 1fr;
  gap: clamp(8px, 1.8vw, 24px);
  padding-top: clamp(12px, 1.6vw, 18px);
  padding-bottom: 0;
  border-top: 8px solid #fff;
  margin-inline: -26px; padding-inline: calc(26px + clamp(4px, 1.4vw, 18px));
}

/* a window you can tap */
.win {
  position: relative; display: grid; justify-items: center;
  padding: 0; border: 0; background: none; color: var(--spot); cursor: pointer;
  font: inherit; -webkit-tap-highlight-color: transparent;
}
.win__glass {
  order: -1; /* the room name comes first in the markup (it leads the button name); the picture still sits on top */
  position: relative; display: block; width: 100%;
  aspect-ratio: 5 / 4; overflow: hidden;
  border: clamp(5px, 0.8vw, 9px) solid #fff; border-radius: 8px;
  background: #ffe7a3;
  box-shadow: 0 3px 6px rgb(80 50 10 / 0.2), 0 10px 22px rgb(80 50 10 / 0.18);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}
.win__glass::after {
  /* warm lamp light at the edges of the glass */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 3px rgb(255 214 120 / 0.85), inset 0 0 26px rgb(255 205 100 / 0.55);
}
.win__glass img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s var(--ease-out); }
.win__label {
  /* the label is the window sill */
  display: block; width: calc(100% + 14px); margin-top: -2px;
  padding: 4px 6px 6px;
  background: #fff; border-radius: 0 0 8px 8px;
  font-family: var(--font-display); font-weight: 700; font-size: clamp(0.95rem, 0.5vw + 0.8rem, 1.2rem); line-height: 1.15;
  box-shadow: 0 4px 8px rgb(80 50 10 / 0.18);
}
.win:hover .win__glass, .win:focus-visible .win__glass { transform: translateY(-4px); box-shadow: 0 8px 14px rgb(80 50 10 / 0.24), 0 18px 32px rgb(80 50 10 / 0.2); }
.win:hover .win__glass img { transform: scale(1.04); }
.win:focus-visible { outline-offset: 6px; }
.win:active .win__glass { transform: translateY(1px); }

.win__tag {
  position: absolute; top: -10px; right: -8px; z-index: 2;
  padding: 2px 12px 5px; border-radius: 999px;
  background: var(--yellow); border: 3px solid var(--spot);
  font-family: var(--font-display); font-weight: 700; font-size: clamp(0.9rem, 0.4vw + 0.8rem, 1.1rem);
  transform: scale(0) rotate(-8deg); transition: transform 0.35s var(--ease-bounce);
}
.win.is-tried .win__tag, .win.is-found .win__tag { transform: scale(1) rotate(-6deg); }
.win.is-found .win__tag { background: var(--red); color: #fff; }
.win.is-found .win__glass { box-shadow: 0 0 0 6px var(--yellow), 0 12px 28px rgb(80 50 10 / 0.3); }
.win.is-wiggle .win__glass { animation: win-wiggle 0.6s var(--ease-out); }
@keyframes win-wiggle { 20% { transform: rotate(-2.5deg); } 45% { transform: rotate(2deg); } 70% { transform: rotate(-1deg); } }

.ftc-door {
  position: relative; align-self: end;
  width: clamp(40px, 8vw, 88px); aspect-ratio: 1 / 1.9;
  background:
    linear-gradient(#ffe7a3, #ffe7a3) 50% 12% / 52% 18% no-repeat,
    linear-gradient(rgb(0 0 0 / 0.14), rgb(0 0 0 / 0.14)) 50% 72% / 60% 34% no-repeat,
    var(--red);
  border: 5px solid #fff; border-bottom: 0; border-radius: 8px 8px 0 0;
}
.ftc-door__knob { position: absolute; right: 14%; top: 52%; width: 12%; aspect-ratio: 1; border-radius: 50%; background: var(--yellow); }

/* Pepper's speech bubble (she stands in the yard) and the Listen button */
.ftc-guide .gb-bubble { width: 100%; text-align: center; min-height: 4.2em; display: grid; place-items: center; }
.ftc-guide .gb-bubble::after {
  /* the tail points at Pepper, down in the yard to the right */
  content: ""; position: absolute; right: -13px; bottom: 26px; width: 20px; height: 20px;
  background: #fff; border: solid var(--spot); border-width: 3px 3px 0 0;
  transform: rotate(45deg);
}
.ftc-guide { align-self: end; padding-bottom: 40px; }
.ftc-listen { width: 100%; }
.ftc-listen .icon { width: 1.35em; height: 1.35em; }
.ftc-listen::before,
.spk::before {
  /* sound rings while a sound plays */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  border: 4px solid var(--yellow-deep); opacity: 0;
}
.ftc-listen.is-sounding::before, .spk.is-sounding::before { animation: ring-out 0.55s var(--ease-out) 2; }
@keyframes ring-out { from { opacity: 0.9; transform: scale(1); } to { opacity: 0; transform: scale(1.18, 1.35); } }
.ftc-listen { overflow: visible; }

@media (max-width: 860px) {
  .ftc-play { grid-template-columns: 1fr; }
  .ftc-yard, .ftc-guide { grid-column: 1; grid-row: auto; }
  .ftc-guide { grid-template-columns: 1fr; justify-items: stretch; gap: 12px; padding-bottom: 0; }
  .ftc-guide .gb-bubble { text-align: left; min-height: 0; place-items: center start; }
  .ftc-guide .gb-bubble::after { left: 34px; right: auto; top: -13px; bottom: auto; border-width: 3px 0 0 3px; }
  .ftc-house { width: min(100%, 620px); }
  /* a deeper front lawn: Pepper stands on it, beside the path */
  .ftc-yard { --lawn: 112px; --sink: 84px; }
  .ftc-yard__pepper { left: 6%; bottom: 6px; width: 92px; }
  .ftc-yard__shadow { left: 6%; bottom: -2px; width: 92px; }
}
@media (max-width: 480px) {
  .ftc-storey { gap: 12px; padding-inline: 2px; }
  .ftc-storey--down { gap: 6px; margin-inline: -14px; padding-inline: 16px; }
  .ftc-walls { padding-inline: 10px; box-shadow: inset 7px 0 0 #fff, inset -7px 0 0 #fff; }
  .ftc-yard { padding-inline: 10px; }
  .win__tag { right: -4px; padding-inline: 8px; }
  /* a shallower lawn so Listen sits in the first phone view; Pepper sits smaller beside the path */
  .ftc-yard { --lawn: 76px; --sink: 48px; }
  .ftc-yard__pepper { left: 3%; bottom: 4px; width: 58px; }
  .ftc-yard__shadow { left: 3%; bottom: -2px; width: 58px; }
  .ftc-house { width: min(100%, calc((100svh - 300px) * 0.6)); } /* short phones: a slightly smaller house keeps Listen in view */
}

/* --- found it --- */
.ftc-lesson {
  display: grid; gap: clamp(20px, 3vw, 44px); align-items: center;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
}
.ftc-ring {
  position: absolute; left: 60%; top: 9.5%; width: 17%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 5px solid var(--yellow); border-radius: 50%;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.25);
  animation: ring-pulse 1.4s var(--ease-out) infinite;
}
@keyframes ring-pulse { 0% { transform: translate(-50%, -50%) scale(0.85); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.25); opacity: 0.2; } }

.ftc-card {
  background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  padding: clamp(20px, 2.6vw, 36px);
}
.ftc-card h2 { font-size: clamp(2rem, 1.8vw + 1.2rem, 3rem); color: var(--red-deep); }
.ftc-card > p { font-size: 1.1em; }
.ftc-rules { margin: 0 0 22px; display: grid; gap: 10px; }
.ftc-rule {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: center; gap: 12px;
  padding: 10px 16px; border-radius: 18px; background: #fff; border: 3px solid var(--spot);
}
.ftc-rule dt { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.25em; line-height: 1.1; }
.ftc-rule dd { margin: 0; font-weight: 800; font-size: 1.1em; line-height: 1.2; }
.ftc-rule--loud { background: var(--red); color: #fff; border-color: var(--red-dark); }
.ftc-alarm-ico { width: 46px; height: 46px; flex: none; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.ftc-lesson .btn { width: 100%; }
@media (max-width: 860px) {
  .ftc-lesson { grid-template-columns: 1fr; }
  .ftc-photo--found { max-width: 560px; margin-inline: auto; width: 100%; }
}
@media (max-width: 420px) {
  .ftc-rule { grid-template-columns: 1fr; gap: 2px; }
}

/* --- round 2 --- */
.ftc-quiz {
  display: grid; justify-items: center; gap: clamp(16px, 2.4vw, 28px); text-align: center;
  background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  padding: clamp(24px, 4vw, 56px) clamp(16px, 3vw, 40px);
}
.ftc-quiz h2 { font-size: clamp(2rem, 2.2vw + 1.2rem, 3.4rem); margin: 0; }
.ftc-speakers { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(20px, 5vw, 72px); }
.spk {
  position: relative; display: grid; justify-items: center; gap: 10px;
  padding: 0; border: 0; background: none; cursor: pointer; color: var(--spot); font: inherit;
  border-radius: 50%;
}
.spk__cone {
  position: relative; display: grid; place-items: center;
  width: clamp(140px, 16vw, 200px); aspect-ratio: 1; border-radius: 50%;
  background: #fff; border: 5px solid var(--spot);
  box-shadow: inset 0 0 0 10px var(--cream), var(--shadow-2);
  transition: transform 0.3s var(--ease-out), background-color 0.3s;
}
.spk__cone .icon { width: 44%; height: 44%; stroke-width: 2.2; }
.spk__name { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.3rem, 0.6vw + 1.1rem, 1.7rem); }
.spk::before { inset: 0 0 auto; aspect-ratio: 1; width: clamp(140px, 16vw, 200px); border-radius: 50%; }
.spk:hover .spk__cone, .spk:focus-visible .spk__cone { transform: translateY(-4px); background: #fffbe9; }
.spk:focus-visible { outline: none; }
.spk:focus-visible .spk__cone { outline: 4px solid var(--sky-deep); outline-offset: 5px; }
.spk.is-sounding .spk__cone { background: var(--yellow); }
.spk.is-tried .spk__cone { border-color: var(--ink-soft); }
.spk.is-right .spk__cone { background: var(--yellow); box-shadow: inset 0 0 0 10px #fff, 0 0 0 6px var(--red), var(--shadow-2); }
.gb-bubble--center { max-width: 34ch; text-align: center; }
/* what each sound sounds like, written down: lights up while it plays */
.spk__rhythm {
  display: flex; align-items: baseline; justify-content: center; gap: 0.35em;
  padding: 0.2em 0.7em; border-radius: 999px; background: #fff; border: 3px solid var(--spot);
  font-family: var(--font-display); font-weight: 700; line-height: 1.1;
}
.spk__rhythm--chirp { font-size: 1.05rem; gap: 0.25em; }
.spk__rhythm--chirp .spk__gap { letter-spacing: 0.15em; color: var(--ink-soft); }
.spk__rhythm--beep { font-size: 1.15rem; background: var(--red); color: #fff; border-color: var(--red-dark); }
.spk__rhythm.is-playing > span { animation: rhythm-hit 0.3s var(--ease-out) both; }
.spk__rhythm--chirp.is-playing > span:nth-child(3) { animation-delay: 0.52s; }
.spk__rhythm--beep.is-playing > span:nth-child(2) { animation-delay: 0.5s; }
.spk__rhythm--beep.is-playing > span:nth-child(3) { animation-delay: 1s; }
.spk__rhythm--beep.is-playing > span { animation-name: rhythm-hit-loud; }
@keyframes rhythm-hit { 0% { transform: scale(1); } 40% { transform: scale(1.3); color: var(--red-deep); } 100% { transform: scale(1); } }
@keyframes rhythm-hit-loud { 0% { transform: scale(1); } 40% { transform: scale(1.3); color: var(--yellow); } 100% { transform: scale(1); } }

/* --- the end --- */
.ftc-end {
  display: grid; gap: clamp(20px, 3vw, 44px); align-items: end;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
}
.ftc-photo--end { align-self: center; transform: rotate(1.2deg); }
.ftc-end__side { display: grid; justify-items: center; }
/* Pepper stands on top of the card */
.ftc-end__pepper { position: relative; z-index: 1; margin-bottom: -3px; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 30px; }
.ftc-end__pepper img { display: block; width: clamp(170px, 16vw, 250px); translate: 0 4%; filter: drop-shadow(0 2px 2px rgb(40 30 10 / 0.18)); }
.ftc-end__pepper::after {
  content: ""; position: absolute; z-index: -1; left: 22%; right: 22%; bottom: -8px; height: 16px; pointer-events: none;
  background: radial-gradient(closest-side, rgb(60 35 20 / 0.34), rgb(60 35 20 / 0.12) 60%, transparent);
}
.ftc-end__pepper.is-hopping { animation: gb-hop 0.6s var(--ease-out); }
@keyframes gb-hop { 0%, 100% { transform: none; } 40% { transform: translateY(-12%) rotate(-4deg); } }
.ftc-card--end { width: 100%; }
.ftc-card--end .btn { width: 100%; }
.ftc-end__rule { font-weight: 800; }
@media (max-width: 860px) {
  .ftc-end { grid-template-columns: 1fr; }
  .ftc-photo--end { transform: none; max-width: 560px; margin-inline: auto; width: 100%; }
  .ftc-end__pepper img { width: 160px; }
}

/* ================= Get Low and Go ================= */

.glg {
  /* tuned to glg-hallway (2172x724) / glg-outside art */
  --ar: 3 / 1;
  --ar-n: 3;
  --floor: 9%;
  --stand-h: 42%;
  --crawl-h: 61.8%; /* current alpha crops: 290px crawl / 469px walk webp (same scale); shared anatomical scale */
  --smoke-l: 15%;
  --smoke-h: 62%;
  --door-l: 86.2%; --door-t: 19.4%; --door-w: 10.6%; --door-h: 61.4%;
}
.glg [hidden] { display: none !important; }

.glg-view { position: relative; }
.glg-scene {
  position: relative; overflow: hidden;
  aspect-ratio: var(--ar);
  width: min(100%, calc((100svh - 330px) * var(--ar-n)));
  min-width: min(100%, 560px);
  margin: 0 auto;
  border-radius: var(--r-lg);
  background: #eadfc7;
  box-shadow: var(--shadow-2);
  user-select: none; -webkit-user-select: none;
}
.glg-out { position: absolute; inset: 0; }
.glg-hall {
  /* the hallway is wider than the window on small screens: it pans with Frieda */
  position: absolute; left: 0; top: 0; height: 100%; aspect-ratio: 3 / 1;
  will-change: transform;
}
.glg-bg { width: 100%; height: 100%; object-fit: cover; }

/* the pretend smoke: soft grey clouds along the ceiling */
.glg-smoke {
  position: absolute; top: 0; left: var(--smoke-l); width: calc(100% - var(--smoke-l)); height: var(--smoke-h);
  overflow: visible; pointer-events: none;
  /* thickens slowly during the drill (set from the game), always leaving clear air by the floor */
  transform: scaleY(var(--thick, 0.55)); transform-origin: 50% 0;
  opacity: calc(0.7 + 0.3 * var(--thick, 0.55));
  -webkit-mask-image: linear-gradient(to right, transparent, #000 24%);
  mask-image: linear-gradient(to right, transparent, #000 24%);
}
.puff { transform-box: fill-box; }
.puff--back { animation: drift 9s ease-in-out infinite alternate; }
.puff--mid { animation: drift 7s ease-in-out -2s infinite alternate-reverse; }
.puff--front { animation: drift 11s ease-in-out -4s infinite alternate; }
@keyframes drift { from { transform: translateX(-14px); } to { transform: translateX(14px); } }

.glg-doorway {
  /* daylight behind the front door; the door leaf swings open on its left hinges */
  position: absolute; left: var(--door-l); top: var(--door-t); width: var(--door-w); height: var(--door-h);
  background:
    radial-gradient(circle at 70% 22%, #fff3c4 0 9%, transparent 10%),
    linear-gradient(to bottom, #a9d8f5 0 58%, #7cc062 58% 100%);
  opacity: 0; perspective: 700px;
}
.glg-doorway::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(rgb(0 0 0 / 0.12), rgb(0 0 0 / 0.12)) 50% 66% / 60% 40% no-repeat,
    linear-gradient(#bfe0f2, #bfe0f2) 50% 14% / 64% 24% no-repeat,
    #c9532a;
  transform-origin: 0 50%;
  transition: transform 1s var(--ease-out) 0.1s;
}
.glg-scene.is-door-open .glg-doorway { opacity: 1; }
.glg-scene.is-door-open .glg-doorway::after { transform: rotateY(-78deg); }

.glg-frieda {
  position: absolute; left: 3%; bottom: var(--floor); height: var(--stand-h);
  display: flex; align-items: flex-end;
  transition: opacity 0.6s var(--ease-out), transform 0.9s var(--ease-out);
  pointer-events: none;
}
.glg-frieda img { position: relative; z-index: 1; height: 100%; width: auto; max-width: none; transform-origin: 50% 100%; }
.glg-frieda::after {
  /* her shadow on the floor */
  content: ""; position: absolute; left: 6%; right: 6%; bottom: -7px; height: 16px; pointer-events: none;
  background: radial-gradient(closest-side, rgb(70 40 15 / 0.38), rgb(70 40 15 / 0.14) 60%, transparent);
}
.glg-frieda.is-low::after { left: 2%; right: 2%; bottom: -6px; }
.glg-frieda__crawl { display: none; }
.glg-frieda.is-low .glg-frieda__walk { display: none; }
.glg-frieda.is-low .glg-frieda__crawl { display: block; height: var(--crawl-h); }
.glg-frieda.is-moving img { animation: bob 0.42s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(0) rotate(-1.5deg); } to { transform: translateY(-3%) rotate(1.5deg); } }
.glg-frieda.is-gone { opacity: 0; transform: translateX(40%); }

.glg-out { animation: ftc-in 0.8s var(--ease-out); }
.glg-scene.is-outside { aspect-ratio: 3 / 2; width: min(100%, calc((100svh - 330px) * 1.5)); min-width: min(100%, 560px); }
.glg-out .glg-bg { object-position: 50% 30%; }

/* cards over the scene */
.glg-card {
  position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(92%, 540px);
  background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  padding: clamp(20px, 2.6vw, 34px); text-align: center;
  animation: card-in 0.5s var(--ease-out);
}
@keyframes card-in { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }
.glg-card h2 { font-size: clamp(2rem, 1.8vw + 1.2rem, 3rem); color: var(--red-deep); }
.glg-card p { font-size: 1.12em; }
.glg-card .btn { width: 100%; }
.glg-rules { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 8px; text-align: left; }
.glg-rules li {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; border-radius: 16px; background: #fff; border: 3px solid var(--spot);
  font-family: var(--font-display); font-weight: 700; font-size: clamp(1.15rem, 0.5vw + 1rem, 1.4rem); line-height: 1.15;
}
.glg-rules svg { width: 40px; height: 40px; flex: none; fill: none; stroke: var(--red); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.glg-pretend { margin: -8px 0 18px; font-weight: 800; font-size: 0.95rem; color: var(--ink); background: #fff5d6; border-radius: 12px; padding: 8px 14px; }

/* talk + controls */
.glg-bar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px 24px;
  width: min(100%, 1100px); margin: 16px auto 0;
}
.glg-talk { display: flex; align-items: center; gap: 12px; min-width: 0; }
.glg-talk__who {
  width: 72px; height: 72px; flex: none; object-fit: cover; object-position: 50% 4%;
  border-radius: 50%; background: #fff; border: 3px solid var(--spot);
}
.glg-talk .gb-bubble { flex: 1; min-width: 0; }
.glg-talk .gb-bubble::before {
  content: ""; position: absolute; left: -12px; top: 50%; width: 18px; height: 18px;
  background: #fff; border: solid var(--spot); border-width: 0 0 3px 3px;
  transform: translateY(-50%) rotate(45deg);
}
.glg-controls { display: flex; gap: 14px; }
.glg-controls .btn {
  min-width: 170px; min-height: 76px;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.glg-go .icon { width: 1.3em; height: 1.3em; }
.glg-low.is-held, .glg-go.is-held { transform: translateY(2px); background: var(--spot); color: #fff; }
.glg-low.is-held::after, .glg-go.is-held::after {
  background: linear-gradient(to bottom, var(--trim-lime) 0 3px, var(--trim-lit) 3px 7px, var(--trim-lime) 7px 10px);
}
.glg-call { min-width: 0 !important; }
/* Get low is a switch: Frieda's pose on the button shows standing or crawling, and the word under it says so */
.glg-low { gap: 10px; padding-inline: 12px 18px; }
.glg-low__pose {
  position: relative; display: grid; place-items: end center; width: 68px; height: 56px; flex: none; padding-bottom: 4px;
  border-radius: 14px; background: linear-gradient(to bottom, var(--cream) 0 82%, #d9b98a 82%);
}
.glg-low__pose img { grid-area: 1 / 1; width: auto; max-width: 64px; object-fit: contain; }
.glg-low__up { height: 50px; }
.glg-low__down { height: 34px; display: none; }
.glg-low.is-held .glg-low__up { display: none; }
.glg-low.is-held .glg-low__down { display: block; }
.glg-low__text { display: grid; justify-items: start; line-height: 1.05; }
.glg-low__state {
  margin-top: 4px; padding: 0.15em 0.55em; border-radius: 999px;
  font-family: var(--font-body); font-size: 0.82rem; font-weight: 800; letter-spacing: 0.01em; white-space: nowrap;
  background: var(--cream); color: var(--ink);
}
.glg-low.is-held .glg-low__state { background: var(--yellow); color: var(--spot); }
.glg-how {
  grid-column: 1 / -1; margin: 0; text-align: center;
  font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; color: var(--ink);
}
.glg-keys { font-family: var(--font-body); font-weight: 400; font-size: 0.92rem; color: var(--ink-soft); }
@media (hover: none) { .glg-keys { display: none; } }
/* while the menu is open the drill holds still */
.glg.is-paused .puff, .glg.is-paused .glg-frieda img { animation-play-state: paused; }

.glg[data-state="intro"] .glg-controls,
.glg[data-state="intro"] .glg-talk,
.glg[data-state="win"] .glg-controls,
.glg[data-state="win"] .glg-talk { display: none; }

@media (max-width: 860px) {
  .glg-bar { grid-template-columns: 1fr; }
  .glg-controls { display: grid; grid-template-columns: 1fr 1fr; }
  .glg-controls .btn { min-width: 0; }
  .glg-call { grid-column: 1 / -1; }
}
@media (max-width: 1099px) {
  .glg-scene { aspect-ratio: 2 / 1; width: 100%; min-width: 0; }
}
@media (max-width: 700px) {
  .glg-scene { aspect-ratio: 4 / 3; border-radius: 18px; }
  /* phone: the cards sit under the picture instead of on it */
  .glg-card { position: relative; left: auto; top: auto; transform: none; width: 100%; margin-top: 14px; animation: none; }
  .glg-talk__who { width: 60px; height: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  .puff, .glg-frieda.is-moving img, .ftc-ring, .spk__rhythm > span { animation: none !important; }
}
.glg:not([data-state="play"]) .glg-how { visibility: hidden; }
@media (max-width: 440px) {
  /* keep both speakers side by side on small phones */
  .ftc-speakers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
  .spk__cone, .spk::before { width: min(120px, 100%); }
  .spk__rhythm--chirp { font-size: 0.9rem; }
  .spk__rhythm--beep { font-size: 0.9rem; gap: 0.25em; padding-inline: 0.5em; }
}

/* every game ends with a big way back to the game shelf */
.game-foot { display: flex; justify-content: center; max-width: var(--maxw); margin: 0 auto; padding-top: clamp(24px, 3vw, 40px); }
.game-foot__back { min-height: 60px; font-size: 1.15rem; padding-inline: 1.4em; }
.game-foot__back .icon { width: 1.1em; height: 1.1em; }
