
/* =============================================================
   PLAYPEN KIT — tokens
   Shared across the little-games series. Change values here,
   not in the game layer at the bottom of this file.
   ============================================================= */
:root{
  --paper:#f1edff;
  --dot:#d7ccf7;
  --card:#fffdf7;
  --ink:#241c3b;
  --ink-soft:#6a5f8c;

  --berry:#ff4d7d;
  --sun:#ffc436;
  --leaf:#16b07a;
  --sky:#2f7bff;
  --grape:#7a4dff;

  --berry-dark:#d3315c;
  --leaf-dark:#0d8a5e;
  --sky-dark:#1d5bc9;
  --sun-dark:#d99c12;

  --r-lg:28px;
  --r-md:20px;
  --r-sm:14px;
  --gap:clamp(8px,1.5vmin,16px);
  --pad:clamp(12px,2.2vmin,22px);
  --lift:0 5px 0;
  --press:0 2px 0;
}

*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{height:100%}
body{
  margin:0;
  overflow:hidden;
  color:var(--ink);
  font-family:ui-rounded,"SF Pro Rounded","Trebuchet MS",Verdana,system-ui,sans-serif;
  background-color:var(--paper);
  background-image:radial-gradient(var(--dot) 1.6px,transparent 1.7px);
  background-size:24px 24px;
  padding:clamp(8px,1.4vmin,18px);
  padding-bottom:max(clamp(8px,1.4vmin,18px),env(safe-area-inset-bottom));
}
button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation;border:0;background:none}
button:focus-visible,input:focus-visible+.switch,select:focus-visible,input[type=text]:focus-visible{outline:4px solid var(--ink);outline-offset:3px}

/* ---- shell: three bands, never scrolls as a page ---- */
.shell{
  height:100%;
  width:min(100%,1120px);
  margin-inline:auto;
  display:grid;
  grid-template-rows:auto minmax(0,1fr);
  gap:var(--gap);
}
.board{display:grid;gap:var(--gap);grid-template-rows:minmax(0,1fr) auto;min-height:0}
@media (min-width:820px){
  .board{grid-template-columns:minmax(0,1.35fr) minmax(290px,.65fr);grid-template-rows:minmax(0,1fr)}
}
@media (orientation:landscape) and (max-height:620px){
  .board{grid-template-columns:minmax(0,1.3fr) minmax(230px,.7fr);grid-template-rows:minmax(0,1fr)}
}

/* ---- paper surfaces: flat fill, hard offset, inked edge ---- */
.sheet{
  background:var(--card);
  border:3px solid var(--ink);
  border-radius:var(--r-lg);
  box-shadow:6px 7px 0 rgba(36,28,59,.14);
}

/* ---- top band ---- */
.topbar{display:flex;align-items:center;gap:clamp(6px,1.2vmin,14px);flex-wrap:wrap}
.mark{display:flex;align-items:center;gap:9px;font-weight:900;font-size:clamp(13px,2.2vmin,18px);margin-right:auto}
.mark b{
  width:clamp(30px,4.4vmin,42px);height:clamp(30px,4.4vmin,42px);
  display:grid;place-items:center;border-radius:12px;
  background:var(--sun);border:3px solid var(--ink);font-size:clamp(15px,2.5vmin,22px);
  transform:rotate(-6deg);flex:none;
}
.mark span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:38vw}
.tally{
  display:flex;align-items:center;gap:clamp(7px,1.4vmin,14px);white-space:nowrap;margin:0;
  background:var(--card);border:3px solid var(--ink);border-radius:999px;
  padding:5px 14px;font-weight:900;font-size:clamp(12px,1.9vmin,15px);
}
.tally i{font-style:normal;display:flex;align-items:baseline;gap:4px}
.tally small{font-weight:800;color:var(--ink-soft);font-size:.82em}
.badge{
  display:flex;align-items:center;gap:7px;white-space:nowrap;margin:0;
  background:var(--grape);color:var(--card);border:3px solid var(--ink);border-radius:999px;
  padding:5px 14px;font-weight:900;font-size:clamp(12px,1.9vmin,15px);
}
@media (max-width:700px){.badge span{display:none}}
.gear{
  width:clamp(36px,5vmin,46px);height:clamp(36px,5vmin,46px);border-radius:14px;flex:none;
  background:var(--card);border:3px solid var(--ink);font-size:clamp(15px,2.4vmin,19px);
}

/* ---- switch ---- */
.toggle{display:inline-flex;align-items:center;gap:8px;font-weight:800;font-size:clamp(12px,1.9vmin,15px);cursor:pointer}
.toggle input{position:absolute;opacity:0;width:0;height:0}
.switch{
  position:relative;width:50px;height:29px;border-radius:999px;flex:none;
  background:#e3dcf6;border:3px solid var(--ink);transition:background .18s ease;
}
.switch::after{
  content:"";position:absolute;inset:2px auto 2px 2px;width:19px;border-radius:50%;
  background:var(--ink);transition:transform .18s ease;
}
input:checked+.switch{background:var(--leaf)}
input:checked+.switch::after{transform:translateX(21px);background:var(--card)}

/* ---- stage ---- */
.stage{
  container:stage/size;position:relative;overflow:hidden;min-height:0;padding:var(--pad);
  display:grid;grid-template-rows:minmax(0,1fr) auto;justify-items:center;align-content:center;
  gap:clamp(4px,1.2vmin,14px);
}
/* the pair is its own size container, so the letter is measured against
   the space actually left over, never against the whole stage */
.duo{
  container:box/size;overflow:hidden;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:clamp(5px,3cqh,26px);min-height:0;height:100%;width:100%;
}
.glyph{font-weight:1000;font-size:min(34vmin,46vh,330px);line-height:.82;letter-spacing:-.07em;color:var(--sky)}
.glyph{font-size:min(52cqh,62cqw,460px)}
.sticker{
  font-size:min(26vmin,36vh,250px);line-height:1;
  display:grid;place-items:center;padding:clamp(6px,1.6vmin,16px);
  background:var(--card);border:3px solid var(--ink);border-radius:var(--r-md);
  transform:rotate(4deg);
}
.sticker{font-size:min(27cqh,42cqw,270px)}
.sticker.off{display:none}
/* a wide, short stage reads better with the pair side by side */
@container stage (min-aspect-ratio: 6/5){
  .duo{flex-direction:row;gap:clamp(8px,4cqw,44px)}
  .glyph{font-size:min(100cqh,42cqw,460px)}
  .glyph.emoji{font-size:min(86cqh,40cqw,430px)}
  .glyph.shape{font-size:min(92cqh,40cqw,430px)}
  .sticker{font-size:min(68cqh,28cqw,270px)}
}
.under{display:grid;justify-items:center;gap:clamp(4px,1vmin,10px)}
.caption{font-weight:1000;font-size:clamp(20px,4vmin,40px);letter-spacing:-.4px;text-align:center;margin:0}
.say{
  padding:9px 18px;border-radius:999px;font-weight:900;font-size:clamp(14px,2.1vmin,17px);
  background:var(--sun);border:3px solid var(--ink);box-shadow:var(--lift) var(--sun-dark);
}
.say:active{transform:translateY(3px);box-shadow:var(--press) var(--sun-dark)}

/* ---- panel ---- */
.panel{
  display:flex;flex-direction:column;gap:var(--gap);min-height:0;overflow-y:auto;
  padding:var(--pad);-webkit-overflow-scrolling:touch;scrollbar-width:thin;
}
.ask{margin:0;font-weight:900;font-size:clamp(15px,2.3vmin,19px);line-height:1.25}
.choices{display:grid;gap:clamp(8px,1.4vmin,14px);flex:1 1 auto;min-height:0;grid-template-rows:1.15fr 1fr}
@media (max-width:819px) and (orientation:portrait){.choices{grid-template-columns:1fr 1fr;grid-template-rows:1fr}}
.choice{
  min-height:clamp(52px,9vh,74px);border-radius:var(--r-md);padding:10px 14px;
  font-weight:1000;font-size:clamp(16px,2.5vmin,22px);border:3px solid var(--ink);
  transition:transform .12s ease,box-shadow .12s ease;
}
.choice.yes{background:var(--leaf);color:var(--card);box-shadow:var(--lift) var(--leaf-dark)}
.choice.not{background:var(--sun);box-shadow:var(--lift) var(--sun-dark)}
.choice:active{transform:translateY(3px)}
.choice.yes:active{box-shadow:var(--press) var(--leaf-dark)}
.choice.not:active{box-shadow:var(--press) var(--sun-dark)}
.choice:disabled{opacity:.45;cursor:default;transform:none}
.result{flex:0 0 auto;display:flex;flex-direction:column;gap:var(--gap)}
.note{
  margin:0;padding:12px 14px;border-radius:var(--r-sm);border:3px solid var(--ink);
  font-weight:800;font-size:clamp(14px,2.1vmin,16px);line-height:1.35;
}
.note.good{background:#d8f8e9}
.note.soft{background:#fff1cf}
.next{
  flex:0 0 auto;min-height:clamp(52px,8vh,76px);border-radius:var(--r-md);
  background:var(--sky);color:var(--card);border:3px solid var(--ink);
  font-weight:1000;font-size:clamp(16px,2.4vmin,20px);box-shadow:var(--lift) var(--sky-dark);
}
.next:active{transform:translateY(3px);box-shadow:var(--press) var(--sky-dark)}
.aside{margin:0;color:var(--ink-soft);font-size:clamp(11px,1.7vmin,13px);line-height:1.4;font-weight:700}


/* ---- confetti ---- */
.confetti{position:absolute;inset:0;pointer-events:none;overflow:hidden}
.confetti i{position:absolute;top:-24px;width:11px;height:16px;border-radius:3px;animation:fall 1.3s ease-in forwards}
@keyframes fall{to{transform:translateY(105vh) rotate(540deg);opacity:.1}}
@keyframes pop{from{transform:scale(.86);opacity:0}to{transform:scale(1);opacity:1}}

/* ---- front screens: setup + welcome ---- */
.gate{
  position:fixed;inset:0;z-index:5;display:grid;align-content:center;justify-items:center;
  padding:clamp(8px,1.4vmin,18px);overflow:auto;
  background-color:var(--paper);
  background-image:radial-gradient(var(--dot) 1.6px,transparent 1.7px);background-size:24px 24px;
}
.gate-card{
  width:min(100%,1120px);max-height:100%;overflow:auto;margin-inline:auto;padding:clamp(20px,3.6vmin,44px);
  display:grid;gap:clamp(12px,2.2vmin,24px);align-content:center;justify-items:center;text-align:center;
}
@media (min-width:780px) and (min-height:430px){
  .gate-card{
    grid-template-columns:1.05fr .95fr;align-items:center;align-content:center;
    text-align:left;justify-items:stretch;column-gap:clamp(26px,5vmin,64px);
  }
  .gate-card>.lead{grid-column:1}
  .gate-card>.side{grid-column:2;grid-row:1/span 2;align-self:center;min-height:0;max-height:100%;overflow:auto;padding:2px}
}
.lead,.side{display:grid;justify-items:center;width:100%}
.lead{gap:clamp(10px,1.8vmin,18px)}
.side{gap:clamp(18px,3vmin,30px)}
.side>*{width:100%}
@media (min-width:780px) and (min-height:430px){.lead{justify-items:start}}
.gate h1{margin:0;font-size:clamp(30px,7vmin,66px);line-height:.96;letter-spacing:-2px;max-width:13ch}
.gate p{margin:0;color:var(--ink-soft);font-size:clamp(14px,2.3vmin,18px);line-height:1.45;max-width:36ch;font-weight:700}
.gate .next{width:100%}
.lead .next{max-width:460px}
.row{display:flex;gap:clamp(8px,1.6vmin,14px)}
.row b{
  font-size:clamp(26px,5.6vmin,52px);width:clamp(52px,10vmin,94px);height:clamp(52px,10vmin,94px);
  display:grid;place-items:center;background:var(--card);border:3px solid var(--ink);border-radius:var(--r-md);
}
.row b:nth-child(1){transform:rotate(-7deg)}
.row b:nth-child(2){transform:rotate(3deg)}
.row b:nth-child(3){transform:rotate(8deg)}
.gate .cake{background:var(--berry);color:var(--card);border:3px solid var(--ink);border-radius:999px;padding:7px 16px;font-weight:900;font-size:clamp(13px,2vmin,16px)}

.panelbox{
  display:grid;gap:clamp(11px,1.8vmin,17px);width:100%;padding:clamp(16px,2.6vmin,26px);
  border-radius:var(--r-md);background:#efe9ff;border:3px solid var(--ink);
  font-weight:800;font-size:clamp(13px,2vmin,16px);text-align:left;
}
.panelbox h2{margin:0;font-size:clamp(15px,2.3vmin,19px);letter-spacing:-.3px}
.panelbox dl{display:flex;justify-content:space-between;gap:10px;margin:0}
.panelbox dt{color:var(--ink-soft);font-weight:800}
.panelbox dd{margin:0;font-weight:900}
.bar{height:14px;border-radius:999px;background:var(--card);border:2px solid var(--ink);overflow:hidden}
.bar span{display:block;height:100%;background:var(--leaf);width:0;transition:width .4s ease}

.field{display:grid;gap:7px;width:100%;text-align:left}
.field>span{font-weight:900;font-size:clamp(13px,2vmin,16px)}
.field input[type=text]{
  font:inherit;font-weight:900;font-size:clamp(16px,2.6vmin,21px);padding:12px 15px;
  border:3px solid var(--ink);border-radius:var(--r-sm);background:var(--card);color:var(--ink);width:100%;
}
.ages{display:flex;flex-wrap:wrap;gap:8px}
.age{
  min-width:clamp(44px,7vmin,58px);padding:10px 12px;border-radius:var(--r-sm);
  border:3px solid var(--ink);background:var(--card);font-weight:900;font-size:clamp(14px,2.2vmin,18px);
}
.age[aria-pressed="true"]{background:var(--sky);color:var(--card)}
.voice{
  font:inherit;font-weight:800;font-size:clamp(13px,2vmin,16px);padding:10px 12px;width:100%;
  border:3px solid var(--ink);border-radius:var(--r-sm);background:var(--card);color:var(--ink);
}
.more{width:100%;display:grid;gap:clamp(14px,2.4vmin,24px)}
.more summary{
  list-style:none;cursor:pointer;font-weight:900;font-size:clamp(13px,2vmin,16px);text-align:center;
  padding:11px 16px;border:3px solid var(--ink);border-radius:999px;background:var(--card);
}
.more summary::-webkit-details-marker{display:none}
.more summary::marker{content:""}
.more[open] summary{background:#efe9ff}
.btnrow{display:flex;flex-wrap:wrap;gap:8px}
.mini{
  padding:9px 14px;border-radius:999px;border:3px solid var(--ink);background:var(--sun);
  font-weight:900;font-size:clamp(12px,1.9vmin,15px);box-shadow:var(--press) var(--sun-dark);
}
.quiet{color:var(--ink-soft);font-size:clamp(11px,1.8vmin,13px);font-weight:800;text-decoration:underline;padding:4px;justify-self:center}

/* short phones: the answer panel gives its padding back to the letter */
@media (orientation:portrait) and (max-height:720px){
  .panel{gap:9px;padding:12px}
  .ask{font-size:15px}
  .choice{min-height:46px;font-size:16px}
  .next{min-height:46px;font-size:17px}
}
/* short screens: the word and hint button give space back to the letter */
@media (max-height:720px){
  .caption{font-size:clamp(15px,3vmin,22px)}
  .say{padding:6px 13px;font-size:13px;box-shadow:var(--press) var(--sun-dark)}
  .under{gap:5px}
  .stage{padding:10px}
}
/* a phone top bar keeps the icons and the numbers, drops the words */
@media (max-width:560px){
  .mark span{display:none}
  .toggle{gap:0;font-size:0}
  .tally{padding:5px 11px;gap:9px}
  .tally .run{display:none}
}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}


/* =============================================================
   PLAYPEN KIT — hero variants used by the different games
   ============================================================= */

/* an emoji or a colour block is sized by the same rules as a letter */
.glyph.emoji{letter-spacing:0;line-height:1;font-size:min(64cqh,86cqw,430px)}
.glyph.shape{display:block;width:.92em;height:.92em;font-size:min(68cqh,78cqw,430px)}
.glyph.shape svg{width:100%;height:100%;fill:currentColor;stroke:var(--ink);stroke-width:4;stroke-linejoin:round}
.glyph.swatch{
  display:block;width:.86em;height:.86em;border-radius:.16em;
  border:3px solid var(--ink);background:currentColor;text-indent:-9999px;overflow:hidden;
}

/* a photograph keeps its own shape — no cropping, so nothing of the animal is
   lost — and is bounded by whatever room the stage has left. */
.glyph.photo{
  display:flex;align-items:center;justify-content:center;
  min-width:0;min-height:0;max-width:100%;font-size:0;line-height:0;
}
.glyph.photo img{
  display:block;width:auto;height:auto;
  max-width:min(88cqw,560px);max-height:min(66cqh,560px);
  border:4px solid var(--ink);border-radius:var(--r-md);
  background:var(--card);box-shadow:0 6px 0 rgba(36,28,59,.18);
  animation:photoin .22s ease both;
}
/* the fade rides on the element, not on a load event, so a photo already in
   cache can never be left sitting at nought opacity */
@keyframes photoin{from{opacity:0}to{opacity:1}}
/* a wide, short stage leaves room beside the clue rather than under it */
@container stage (min-aspect-ratio: 6/5){
  .glyph.photo img{max-width:min(58cqw,620px);max-height:min(94cqh,620px)}
}

/* a counted clue: that many little things in the sticker frame */
.sticker.count{
  display:flex;flex-wrap:wrap;align-content:center;justify-content:center;
  gap:.12em;max-width:min(52cqw,440px);line-height:1;
  font-size:min(11cqh,13cqw,56px);
}
@container stage (min-aspect-ratio: 6/5){
  .sticker.count{font-size:min(22cqh,11cqw,56px);max-width:min(34cqw,380px)}
}

/* a spoken clue: a short line of words rather than a picture */
.cluepill{
  padding:9px 17px;border-radius:999px;border:3px solid var(--ink);background:#efe9ff;
  font-weight:900;font-size:clamp(13px,2.4vmin,19px);text-align:center;
}
.cluepill.off{display:none}

a.mark{text-decoration:none;color:inherit}

/* =============================================================
   PLAYPEN KIT — the hub that lists the games
   ============================================================= */
.hubshell{
  min-height:100%;width:min(100%,1120px);margin-inline:auto;
  display:grid;grid-template-rows:auto auto 1fr;gap:clamp(14px,2.6vmin,28px);
  padding-block:clamp(10px,2vmin,22px);
}
body.hub{overflow:auto}
.hubhead{display:grid;gap:10px;justify-items:center;text-align:center}
.hubhead h1{margin:0;font-size:clamp(30px,6vmin,54px);line-height:.98;letter-spacing:-1.6px}
.hubhead p{margin:0;color:var(--ink-soft);font-weight:700;font-size:clamp(14px,2.2vmin,17px);max-width:40ch}
.hubgrid{
  display:grid;gap:clamp(12px,2.2vmin,22px);align-content:start;
  grid-template-columns:repeat(auto-fit,minmax(250px,1fr));
}
.gamecard{
  display:grid;gap:11px;padding:clamp(16px,2.6vmin,26px);text-align:left;text-decoration:none;color:inherit;
  background:var(--card);border:3px solid var(--ink);border-radius:var(--r-lg);
  box-shadow:6px 7px 0 rgba(36,28,59,.14);transition:transform .12s ease,box-shadow .12s ease;
}
.gamecard:hover{transform:translate(-2px,-2px);box-shadow:8px 9px 0 rgba(36,28,59,.18)}
.gamecard:active{transform:translate(2px,3px);box-shadow:3px 3px 0 rgba(36,28,59,.14)}
.gamecard .top{display:flex;align-items:center;gap:12px}
.gamecard .ico{
  width:clamp(44px,6vmin,58px);height:clamp(44px,6vmin,58px);flex:none;display:grid;place-items:center;
  font-size:clamp(22px,3.4vmin,30px);background:var(--sun);border:3px solid var(--ink);border-radius:16px;
  transform:rotate(-5deg);
}
.gamecard h2{margin:0;font-size:clamp(17px,2.6vmin,22px);letter-spacing:-.4px}
.gamecard .line{display:flex;justify-content:space-between;gap:10px;font-weight:800;font-size:clamp(12px,1.9vmin,15px);color:var(--ink-soft)}
.gamecard .line b{color:var(--ink)}
.hubfoot{display:flex;flex-wrap:wrap;gap:10px;align-items:center;justify-content:center}

/* the rank pill, after `.gate p` so it keeps its own colour everywhere */
p.rank{
  display:flex;align-items:center;gap:10px;margin:0;padding:10px 14px;border-radius:var(--r-sm);
  background:var(--grape);color:var(--card);border:3px solid var(--ink);font-weight:900;
  font-size:clamp(14px,2.2vmin,18px);
}
p.rank b{font-size:1.4em;line-height:1}
.gamecard p.rank{font-size:clamp(13px,2vmin,16px);padding:8px 12px}
