:root {
  --ink: #29392f;
  --muted: #778078;
  --paper: #f7f6f2;
  --green: #365d46;
  --line: #e0e3da;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-rounded, "Trebuchet MS", Arial, sans-serif;
}
button,
select,
input {
  font: inherit;
}
button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid #526cf3;
  outline-offset: 4px;
}
button {
  color: inherit;
}
header {
  height: 100px;
  max-width: 1440px;
  margin: auto;
  padding: 0 5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -1px;
}
.brandmark {
  width: 39px;
  height: 39px;
  border-radius: 13px;
  background: #365d46;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 24px;
  transform: rotate(-8deg);
}
.brand small {
  display: block;
  letter-spacing: 2px;
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 4px;
}
.actions {
  display: flex;
  gap: 10px;
}
.iconbtn {
  border: 1px solid var(--line);
  background: transparent;
  min-width: 46px;
  min-height: 46px;
  border-radius: 50%;
  font-size: 20px;
}
.iconbtn.active {
  background: #dce9dc;
}
.schooltag {
  font-size: 12px;
  letter-spacing: 1px;
  margin-right: 20px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.schooltag:before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7b9c72;
}
main {
  max-width: 1320px;
  margin: auto;
  padding: 0 38px;
}
.hero {
  position: relative;
  text-align: center;
  padding: 55px 0 31px;
  min-height: 260px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 700;
  color: #71806d;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.eyebrow:before {
  content: "";
  width: 22px;
  height: 1px;
  background: #98ab93;
}
h1 {
  font-size: clamp(40px, 4.7vw, 67px);
  line-height: 1.13;
  letter-spacing: -3px;
  font-weight: 800;
  margin: 20px 0 14px;
}
h1 em {
  font-style: normal;
  color: #77946e;
  position: relative;
}
h1 em:after {
  content: "";
  position: absolute;
  bottom: -7px;
  left: 0;
  width: 100%;
  height: 8px;
  border-top: 3px solid #c6d4a7;
  border-radius: 50%;
  transform: rotate(-2deg);
}
.hero p {
  font-size: 16px;
  color: #7a8078;
  line-height: 1.6;
  margin: 0;
}
.float {
  position: absolute;
  pointer-events: none;
}
.sun {
  width: 56px;
  height: 56px;
  top: 73px;
  left: 9%;
  color: #d5a64e;
  animation: turn 40s linear infinite;
}
.spark {
  right: 12%;
  top: 86px;
  color: #b2a8c6;
  font-size: 47px;
  animation: bob 5s ease-in-out infinite;
}
.squiggle {
  left: 18%;
  bottom: 26px;
  color: #c4cbb5;
  font-size: 45px;
  transform: rotate(-15deg);
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 17px 0 27px;
  gap: 15px;
}
.tabs {
  display: flex;
  gap: 6px;
  background: #edeee7;
  padding: 5px;
  border-radius: 30px;
}
.tabs button {
  border: 0;
  background: none;
  padding: 12px 21px;
  border-radius: 25px;
  font-size: 13px;
  font-weight: 700;
  min-height: 44px;
}
.tabs button.active {
  background: var(--green);
  color: white;
  box-shadow: 0 3px 7px #294c3420;
}
.age {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #747d70;
}
.age select {
  background: transparent;
  border: 1px solid #d8ddcf;
  border-radius: 24px;
  padding: 12px 33px 12px 17px;
  color: #3e4d3c;
  min-height: 46px;
}
.sectiontitle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.sectiontitle h2 {
  font-size: 15px;
  margin: 0;
  font-weight: 700;
}
.sectiontitle span {
  font-size: 11px;
  color: #8a9085;
}
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.gamecard {
  border: 1px solid #e2e4dc;
  background: #fdfdf9;
  border-radius: 23px;
  padding: 10px;
  text-align: left;
  transition:
    transform 0.25s,
    box-shadow 0.25s;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.gamecard:hover {
  transform: translateY(-6px);
  box-shadow: 0 15px 25px #364a3010;
}
.gamecard:active {
  transform: scale(0.98);
}
.art {
  height: 177px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  perspective: 600px;
  background: var(--bg);
}
.art:after {
  content: "";
  position: absolute;
  width: 125px;
  height: 23px;
  background: #33432e12;
  filter: blur(9px);
  bottom: 20px;
  border-radius: 50%;
}
.art svg {
  width: 148px;
  height: 148px;
  filter: drop-shadow(0 9px 4px #38403214);
  transition: transform 0.4s;
  z-index: 1;
}
.gamecard:hover svg {
  transform: translateY(-7px) rotate(-4deg);
}
.cardcopy {
  padding: 18px 11px 12px;
}
.cardtop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}
.cardtop h3 {
  font-size: 18px;
  letter-spacing: -0.5px;
  margin: 0;
}
.arrow {
  width: 29px;
  height: 29px;
  border: 1px solid #e3e6dc;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 17px;
  flex-shrink: 0;
}
.desc {
  font-size: 12px;
  color: #82867e;
  margin: 9px 0 17px;
  line-height: 1.5;
}
.meta {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.dot {
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
}
.tag {
  position: absolute;
  top: 22px;
  left: 22px;
  z-index: 2;
  font-size: 9px;
  background: #ffffff9c;
  padding: 5px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}
.bottomnote {
  margin: 30px 0 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #8b9286;
  font-size: 11px;
}
.bottomnote b {
  font-size: 16px;
  color: #8da080;
}
footer {
  max-width: 1244px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 22px 0 26px;
  display: flex;
  justify-content: space-between;
  color: #969b90;
  font-size: 11px;
}
footer a {
  color: inherit;
  text-decoration: none;
}
footer .footbrand {
  font-weight: 700;
  color: #6d7b66;
}
.screen {
  display: none;
}
.screen.show {
  display: block;
}
.playhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 28px 0;
}
.back {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 13px 20px;
  background: white;
  min-height: 48px;
}
.playhead h2 {
  font-size: 25px;
  margin: 0;
}
.controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  margin: 15px auto;
}
.controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.controls select,
.controls button {
  border: 1px solid #d7dece;
  background: white;
  padding: 12px 18px;
  border-radius: 17px;
  min-height: 48px;
}
.controls .primary {
  background: #365d46;
  color: white;
  border-color: #365d46;
}
.status {
  text-align: center;
  min-height: 45px;
  font-size: 20px;
  font-weight: 700;
  margin: 22px 0 10px;
}
.board {
  display: grid;
  gap: 10px;
  margin: 20px auto;
  max-width: 650px;
}
.cell {
  border: 0;
  border-radius: 18px;
  min-height: 70px;
  background: #e8ebdf;
  font-size: 40px;
  aspect-ratio: 1;
  box-shadow: 0 5px 0 #d4d9c9;
  transition:
    transform 0.15s,
    background 0.2s;
}
.cell:active {
  transform: translateY(4px);
  box-shadow: none;
}
.cell.x {
  color: #6b8d6c;
  background: #dce9db;
}
.cell.o {
  color: #b68777;
  background: #f1dfd5;
}
.cell.win {
  background: #c7df9b;
  animation: pop 0.6s;
}
.connect {
  background: #c7d8d1;
  padding: 15px;
  border-radius: 25px;
  gap: 8px;
  max-width: 640px;
}
.connect .cell {
  min-height: 0;
  border-radius: 50%;
  font-size: 0;
  background: #f7f6f2;
  box-shadow: inset 0 4px 4px #3c554c22;
}
.connect .cell.x {
  background: #e9b991;
}
.connect .cell.o {
  background: #8caaa0;
}
.memory .cell {
  position: relative;
  font-size: 40px;
  background: #b9cbb4;
  color: #fff;
  transition: transform 0.4s;
  min-height: 65px;
}
.memory .cell.open {
  background: #fff;
  transform: rotateY(0);
  box-shadow: 0 4px 0 #e2dfd4;
}
.memory .cell.matched {
  background: #e0eccd;
  box-shadow: 0 4px 0 #b9cd9a;
  cursor: default;
}
.puzzle .cell {
  font-size: clamp(24px, 3vw, 42px);
  background: #decfe9;
  box-shadow: 0 5px 0 #c8b6d5;
}
.puzzle .cell.empty {
  background: #eeece6;
  box-shadow: inset 0 3px 4px #00000008;
}
.words {
  max-width: 560px;
  touch-action: none;
  user-select: none;
  gap: 5px;
}
.words .cell {
  font-size: 23px;
  border-radius: 12px;
  min-height: 0;
  background: #e6e3f0;
  box-shadow: none;
}
.words .selected {
  background: #cbb5e2;
}
.words .found {
  background: #c4dcb0;
}
.wordlist {
  display: flex;
  justify-content: center;
  gap: 13px;
  flex-wrap: wrap;
}
.wordlist span {
  background: white;
  padding: 10px 16px;
  border-radius: 20px;
}
.wordlist .done {
  text-decoration: line-through;
  background: #dbe9ce;
}
.mathbox {
  max-width: 700px;
  margin: 20px auto;
  background: #f0e6d5;
  border-radius: 30px;
  padding: 35px;
  text-align: center;
}
.equation {
  font-size: clamp(40px, 7vw, 75px);
  font-weight: 800;
  letter-spacing: 4px;
  margin: 10px 0 25px;
}
.answers {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}
.answers button {
  border: 0;
  border-radius: 20px;
  min-height: 90px;
  background: #fffaf2;
  font-size: 34px;
  box-shadow: 0 6px 0 #daceb7;
}
.answers button.good {
  background: #caddb4;
}
.answers button.bad {
  background: #efcdc5;
}
.quantity {
  font-size: 25px;
  line-height: 1.5;
  letter-spacing: 5px;
  margin: 0 0 20px;
}
.canvaswrap {
  border: 1px solid #e1e4db;
  border-radius: 24px;
  overflow: hidden;
  background: white;
  margin: 20px 0;
  box-shadow: 0 6px 0 #e7e9df;
}
canvas#paint {
  display: block;
  width: 100%;
  height: 52vh;
  min-height: 300px;
  touch-action: none;
}
.swatch {
  width: 46px;
  min-width: 46px;
  height: 46px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #ddd;
}
.swatch.active {
  outline: 3px solid #526147;
  outline-offset: 2px;
}
.paintcontrols {
  gap: 12px;
}
.paintcontrols input[type="range"] {
  width: 100px;
}
.notice {
  max-width: 700px;
  padding: 30px;
  margin: 30px auto;
  border: 1px solid var(--line);
  border-radius: 25px;
  line-height: 1.8;
  background: white;
}
.modalcover {
  position: fixed;
  inset: 0;
  background: #25372b50;
  backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  z-index: 10;
  padding: 25px;
}
.modalcover[hidden] {
  display: none;
}
.modal {
  background: #fbfaf5;
  max-width: 500px;
  width: 100%;
  padding: 32px;
  border-radius: 27px;
  box-shadow: 0 20px 100px #26392b33;
}
.modal h2 {
  margin-top: 0;
}
.modal p {
  color: #707a6c;
  line-height: 1.8;
}
.modal button {
  padding: 14px 22px;
  background: #365d46;
  color: white;
  border: 0;
  border-radius: 18px;
}
.confetti {
  position: fixed;
  pointer-events: none;
  inset: 0;
  z-index: 20;
  overflow: hidden;
}
.confetti i {
  position: absolute;
  top: -30px;
  width: 12px;
  height: 19px;
  animation: fall 1.8s ease-in forwards;
}
.motionoff * {
  animation: none !important;
  transition: none !important;
}
@keyframes fall {
  to {
    transform: translateY(110vh) rotate(700deg);
  }
}
@keyframes bob {
  50% {
    transform: translateY(-9px) rotate(7deg);
  }
}
@keyframes turn {
  to {
    transform: rotate(360deg);
  }
}
@keyframes pop {
  50% {
    transform: scale(1.07);
  }
}
@media (min-width: 1700px) {
  main {
    max-width: 1550px;
  }
  .art {
    height: 215px;
  }
  .cardtop h3 {
    font-size: 22px;
  }
  .desc {
    font-size: 15px;
  }
  .meta {
    font-size: 11px;
  }
  header {
    max-width: 1700px;
  }
  footer {
    max-width: 1474px;
  }
}
@media (max-width: 1000px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .schooltag {
    display: none;
  }
  .hero {
    padding-top: 40px;
  }
  .sun {
    left: 2%;
  }
  .spark {
    right: 3%;
  }
  .tabs button {
    padding: 12px 16px;
  }
}
@media (max-width: 720px) {
  header {
    height: 82px;
    padding: 0 20px;
  }
  main {
    padding: 0 19px;
  }
  .brand {
    font-size: 23px;
  }
  .brand small {
    font-size: 8px;
  }
  .actions {
    gap: 6px;
  }
  .iconbtn {
    min-width: 42px;
    min-height: 42px;
  }
  .hero {
    padding: 35px 0 25px;
    min-height: 220px;
  }
  h1 {
    letter-spacing: -2px;
    font-size: 41px;
  }
  .hero p {
    font-size: 14px;
  }
  .sun {
    width: 30px;
    top: 23px;
  }
  .spark {
    font-size: 30px;
    top: 35px;
  }
  .squiggle {
    display: none;
  }
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .tabs {
    width: 100%;
    justify-content: space-between;
  }
  .tabs button {
    padding: 11px 12px;
    font-size: 12px;
  }
  .age {
    align-self: flex-end;
  }
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .art {
    height: 145px;
  }
  .art svg {
    width: 128px;
    height: 128px;
  }
  .gamecard {
    border-radius: 20px;
    padding: 8px;
  }
  .cardcopy {
    padding: 14px 6px 9px;
  }
  .cardtop h3 {
    font-size: 16px;
  }
  .arrow {
    display: none;
  }
  .desc {
    font-size: 11px;
    min-height: 32px;
  }
  .meta {
    font-size: 8px;
    letter-spacing: 0.6px;
  }
  .tag {
    left: 17px;
    top: 17px;
    font-size: 8px;
  }
  footer {
    margin: 0 19px;
    gap: 15px;
    line-height: 1.5;
    flex-wrap: wrap;
  }
  .playhead {
    gap: 10px;
  }
  .playhead h2 {
    font-size: 21px;
  }
  .back {
    padding: 12px;
  }
  .board {
    gap: 7px;
  }
  .status {
    font-size: 18px;
  }
  .mathbox {
    padding: 25px 17px;
  }
  .controls {
    gap: 8px;
  }
  .controls label {
    font-size: 12px;
  }
  .controls select,
  .controls button {
    padding: 12px;
  }
  .words .cell {
    font-size: 19px;
  }
  .memory .cell {
    font-size: 30px;
    min-height: 50px;
  }
  .sectiontitle span {
    font-size: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
}
h1 em {
  display: inline-block;
  animation: wordfloat 7s ease-in-out infinite;
}
.memory .cell.open {
  animation: flipcard 0.35s ease-out;
}
.connect .cell.x,
.connect .cell.o {
  animation: dropcoin 0.3s ease-out;
}
.cell.x,
.cell.o {
  background-image: linear-gradient(145deg, #ffffff33, #00000008);
}
@keyframes wordfloat {
  50% {
    transform: translateY(-3px);
  }
}
@keyframes flipcard {
  from {
    transform: perspective(600px) rotateY(80deg);
  }
  to {
    transform: perspective(600px) rotateY(0);
  }
}
@keyframes dropcoin {
  from {
    transform: translateY(-45px);
    opacity: 0.4;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  h1 em,
  .memory .cell.open,
  .connect .cell.x,
  .connect .cell.o {
    animation: none;
  }
}
/* Every screen owns the viewport; boards are sized from the remaining space. */
html {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  display: flex;
  flex-direction: column;
}
header {
  height: 64px;
  min-height: 64px;
  width: 100%;
  padding: 0 3%;
  flex: none;
}
main {
  width: 100%;
  max-width: 1600px;
  padding: 0 3%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.screen {
  min-height: 0;
}
.screen.show {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.hero {
  flex: none;
  min-height: 0;
  padding: 16px 0 10px;
}
.hero h1 {
  font-size: clamp(30px, 4vw, 52px);
  margin: 10px 0 9px;
  letter-spacing: -2px;
}
.hero p {
  font-size: 14px;
  line-height: 1.4;
}
.hero p br {
  display: none;
}
.eyebrow {
  font-size: 10px;
}
.sun {
  top: 26px;
  width: 40px;
  height: 40px;
}
.spark {
  top: 32px;
  font-size: 38px;
}
.squiggle {
  display: none;
}
.toolbar {
  margin: 8px 0 12px;
  flex: none;
  min-height: 46px;
}
.tabs {
  padding: 3px;
}
.tabs button {
  padding: 10px 20px;
  min-height: 40px;
}
.age select {
  padding-top: 10px;
  padding-bottom: 10px;
  min-height: 42px;
}
.sectiontitle {
  flex: none;
  margin-bottom: 10px;
}
.grid {
  flex: 1;
  min-height: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-bottom: 5px;
}
.gamecard {
  min-width: 0;
  min-height: 0;
  padding: 8px;
  border-radius: 20px;
}
.art {
  height: auto;
  min-height: 0;
  flex: 1;
  border-radius: 13px;
}
.art svg {
  height: 100%;
  max-height: 160px;
  width: auto;
  max-width: 85%;
}
.cardcopy {
  flex: none;
  padding: 10px 10px 7px;
}
.cardtop h3 {
  font-size: clamp(15px, 1.5vw, 22px);
  white-space: nowrap;
}
.desc {
  font-size: 12px;
  margin: 6px 0 9px;
  min-height: 0;
}
.meta {
  font-size: 9px;
}
.tag {
  top: 16px;
  left: 16px;
}
.arrow {
  width: 25px;
  height: 25px;
}
.bottomnote {
  flex: none;
  margin: 10px 0;
  font-size: 10px;
}
footer {
  height: 30px;
  min-height: 30px;
  padding: 8px 0;
  max-width: none;
  width: 94%;
  flex: none;
  font-size: 10px;
  align-items: center;
}
body.playing footer {
  display: none;
}
body.playing header {
  height: 54px;
  min-height: 54px;
}
.playhead {
  flex: none;
  min-height: 48px;
  margin: 8px 0;
  gap: 10px;
}
.playhead h2 {
  font-size: 24px;
}
.back {
  min-height: 42px;
  padding: 10px 18px;
}
.iconbtn {
  min-height: 40px;
  min-width: 40px;
}
.controls {
  flex: none;
  margin: 4px 0;
  min-height: 42px;
  gap: 10px;
}
.controls label {
  font-size: 13px;
}
.controls select,
.controls button {
  min-height: 40px;
  padding: 9px 15px;
  border-radius: 14px;
}
.controls > span {
  font-size: 13px;
  text-align: center;
}
.status {
  flex: none;
  min-height: 26px;
  font-size: 18px;
  margin: 7px 0;
  line-height: 1.3;
}
#gamearea {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 2px 0 12px;
}
.board {
  flex: none;
  min-height: 0;
  min-width: 0;
  max-width: none !important;
  margin: 0 auto;
  gap: var(--gap, 8px);
}
.board .cell {
  min-height: 0;
  min-width: 0;
  aspect-ratio: auto;
  padding: 0;
  font-size: clamp(18px, calc(var(--tile, 70px) * 0.52), 64px);
  border-radius: clamp(7px, calc(var(--tile, 70px) * 0.18), 18px);
}
.memory .cell {
  font-family:
    "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: clamp(22px, calc(var(--tile, 70px) * 0.76), 110px);
  line-height: 1;
}
.memory .cell:not(.open):not(.matched) {
  font-family: inherit;
  font-size: clamp(22px, calc(var(--tile, 70px) * 0.45), 65px);
}
.connect {
  padding: 12px;
  gap: var(--gap, 7px);
}
.connect .cell {
  border-radius: 50%;
  font-size: 0;
}
.words {
  gap: var(--gap, 5px);
}
.words .cell {
  font-size: clamp(14px, calc(var(--tile, 45px) * 0.46), 34px);
  border-radius: 10px;
}
.puzzle .cell {
  font-size: clamp(22px, calc(var(--tile, 70px) * 0.46), 62px);
}
.wordlist {
  flex: none;
  gap: 8px;
  min-height: 32px;
  align-items: center;
}
.wordlist span {
  padding: 7px 15px;
  font-size: 14px;
}
.puzzlehint {
  text-align: center;
  position: absolute;
  bottom: 12px;
  max-width: min(600px, 90vw);
  padding: 12px 18px;
  border: 1px solid #c7cdbb;
  border-radius: 18px;
  background: #fffef5;
  box-shadow: 0 6px 25px #273a3020;
  z-index: 3;
  font-size: 14px;
}
.mathbox {
  flex: 1;
  min-height: 0;
  width: min(700px, 100%);
  margin: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}
.equation {
  flex: none;
  font-size: clamp(36px, 7vh, 75px);
  margin: 0;
  line-height: 1.2;
}
.quantity {
  flex: none;
  font-size: 22px;
  margin: 0;
}
.answers {
  flex: 1;
  min-height: 0;
  max-height: 280px;
  gap: 12px;
}
.answers button {
  min-height: 0;
  font-size: clamp(24px, 5vh, 45px);
}
.zerooption {
  white-space: nowrap;
  gap: 6px !important;
  padding: 5px 8px;
}
.zerooption input {
  width: 20px;
  height: 20px;
  accent-color: #365d46;
}
body[data-game="paint"] header {
  display: none;
}
body[data-game="paint"] main {
  max-width: none;
  padding: 0 12px;
}
body[data-game="paint"] .playhead {
  margin: 4px 0;
  min-height: 38px;
}
body[data-game="paint"] .playhead h2 {
  font-size: 20px;
}
body[data-game="paint"] .back {
  min-height: 36px;
  padding: 7px 14px;
}
body[data-game="paint"] #status {
  min-height: 18px;
  font-size: 12px;
  margin: 2px 0;
}
body[data-game="paint"] #gamearea {
  padding: 3px 0 8px;
  gap: 0;
}
body[data-game="paint"] .controls {
  margin: 3px 0;
  gap: 8px;
  min-height: 38px;
  flex-wrap: nowrap;
}
body[data-game="paint"] .controls button {
  min-height: 36px;
  padding: 7px 13px;
  font-size: 12px;
}
body[data-game="paint"] .swatch {
  min-width: 32px;
  width: 32px;
  height: 32px;
  padding: 0 !important;
}
.toolgroup {
  display: flex;
  gap: 7px;
  align-items: center;
  background: #eeefe7;
  border-radius: 16px;
  padding: 5px 8px;
  flex: none;
}
.toolgroup .swatch {
  border-width: 2px;
}
.toolgroup .swatch.active {
  outline-width: 2px;
}
.paintcontrols .brushsize {
  min-width: 34px !important;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 0 !important;
  display: grid;
  place-items: center;
}
.brushsize i {
  display: block;
  border-radius: 50%;
  background: #455741;
}
.brushsize.chosen {
  outline: 2px solid #6b8363;
  background: white;
}
.canvaswrap {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  border-radius: 19px;
  margin: 0;
  box-shadow: 0 3px 0 #e7e9df;
}
canvas#paint {
  height: 100%;
  min-height: 0;
  width: 100%;
}
.shapequestion {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  flex: none;
  font-size: 18px;
}
.shapequestion svg {
  height: 62px;
  width: 70px;
}
.shapeanswers {
  display: grid;
  gap: 12px;
  flex: 1;
  min-height: 0;
  width: min(760px, 100%);
  padding-bottom: 5px;
}
.shapeanswers button {
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 23px;
  background: #ece6d9;
  box-shadow: 0 4px 0 #dbd6c8;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shapeanswers svg {
  height: 80%;
  width: 80%;
  max-width: 140px;
  max-height: 140px;
  filter: drop-shadow(0 6px 2px #37462c16);
}
.shapeanswers button.good {
  background: #d7e6c5;
}
.shapeanswers button.bad {
  background: #f2d6cb;
}
.shapequestion .sample {
  background: #fff;
  border: 1px solid #e0e3da;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
}
.modalcover {
  padding: 12px;
}
.modal {
  max-height: calc(100dvh - 24px);
  padding: 24px;
}
.modal p {
  font-size: 14px;
  line-height: 1.5;
  margin: 12px 0;
}
.modal h2 {
  font-size: 22px;
  margin-bottom: 12px;
}
.modal button {
  padding: 11px 18px;
}
@media (min-width: 1600px) and (min-height: 900px) {
  header {
    height: 76px;
    min-height: 76px;
  }
  .hero {
    padding: 24px 0 16px;
  }
  .hero h1 {
    font-size: 60px;
  }
  .hero p {
    font-size: 17px;
  }
  .cardcopy {
    padding: 15px;
  }
  .desc {
    font-size: 15px;
  }
  .art svg {
    max-height: 215px;
  }
  .toolbar {
    margin-bottom: 18px;
  }
  .bottomnote {
    margin: 15px 0;
  }
  .meta {
    font-size: 11px;
  }
}
@media (max-height: 760px) {
  header {
    height: 54px;
    min-height: 54px;
  }
  .hero {
    padding: 9px 0 5px;
  }
  .hero h1 {
    font-size: 37px;
    margin: 7px 0;
  }
  .hero p {
    font-size: 12px;
  }
  .eyebrow {
    font-size: 9px;
  }
  .toolbar {
    margin: 5px 0 9px;
  }
  .cardcopy {
    padding: 8px 7px 5px;
  }
  .desc {
    font-size: 11px;
    margin: 5px 0 7px;
  }
  .bottomnote {
    margin: 6px 0;
  }
  .grid {
    gap: 11px;
  }
  .art:after {
    bottom: 9px;
  }
  .tag {
    font-size: 8px;
    padding: 3px 6px;
  }
  .playhead {
    margin: 5px 0;
  }
  .status {
    margin: 4px 0;
  }
  body.playing header {
    height: 48px;
    min-height: 48px;
  }
  .brand {
    font-size: 22px;
  }
  .brandmark {
    height: 33px;
    width: 33px;
  }
  .brand small {
    font-size: 8px;
  }
  .mathbox {
    padding: 15px;
    gap: 8px;
  }
}
@media (max-width: 900px) {
  .desc {
    display: none;
  }
  .hero h1 {
    font-size: 36px;
  }
  .cardtop h3 {
    font-size: 16px;
  }
  .cardcopy {
    padding: 9px 5px;
  }
  .arrow {
    display: none;
  }
  .meta {
    margin-top: 8px;
    font-size: 8px;
    letter-spacing: 0.5px;
  }
  .tabs button {
    padding: 9px 13px;
  }
  .toolgroup {
    padding: 4px;
    gap: 5px;
  }
  body[data-game="paint"] .controls {
    gap: 5px;
  }
  body[data-game="paint"] .controls button {
    padding: 7px 9px;
  }
  .toolgroup .swatch {
    width: 29px;
    min-width: 29px;
    height: 29px;
  }
}
@media (max-width: 700px) {
  main {
    padding: 0 12px;
  }
  header {
    padding: 0 14px;
    height: 52px;
    min-height: 52px;
  }
  .brand {
    font-size: 20px;
    gap: 8px;
  }
  .brand small {
    font-size: 7px;
    letter-spacing: 1.5px;
  }
  .brandmark {
    height: 30px;
    width: 30px;
    border-radius: 10px;
  }
  .schooltag {
    display: none;
  }
  .actions {
    gap: 5px;
  }
  .iconbtn {
    min-height: 34px;
    min-width: 34px;
    font-size: 18px;
  }
  .hero {
    padding: 9px 0 4px;
  }
  .hero h1 {
    font-size: 30px;
    margin: 5px 0;
  }
  .hero p {
    font-size: 11px;
    max-width: 85%;
    margin: auto;
  }
  .eyebrow {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .sun {
    left: 1%;
    top: 23px;
    width: 24px;
    height: 24px;
  }
  .spark {
    right: 1%;
    font-size: 26px;
    top: 27px;
  }
  .toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    min-height: 0;
    margin: 5px 0 9px;
  }
  .tabs {
    width: 100%;
    padding: 2px;
  }
  .tabs button {
    font-size: 10px;
    padding: 8px 9px;
    min-height: 34px;
  }
  .age {
    font-size: 10px;
    align-self: auto;
    gap: 5px;
  }
  .age select {
    font-size: 11px;
    min-height: 30px;
    padding: 5px 26px 5px 10px;
  }
  .sectiontitle {
    margin-bottom: 7px;
  }
  .sectiontitle h2 {
    font-size: 12px;
  }
  .sectiontitle span {
    font-size: 9px;
  }
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  .gamecard {
    padding: 5px;
    border-radius: 15px;
    flex-direction: row;
    align-items: stretch;
    gap: 6px;
  }
  .art {
    flex: none;
    width: 37%;
    border-radius: 10px;
    min-height: 0;
  }
  .art svg {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 120px;
  }
  .tag {
    display: none;
  }
  .art:after {
    width: 65%;
    height: 10px;
    bottom: 6px;
    filter: blur(4px);
  }
  .cardcopy {
    padding: 5px 0;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .cardtop h3 {
    font-size: clamp(11px, 2.5vw, 17px);
    white-space: normal;
    line-height: 1.1;
  }
  .meta {
    font-size: 7px;
    letter-spacing: 0;
    margin-top: 6px;
    line-height: 1.2;
    gap: 3px;
  }
  .dot {
    width: 4px;
    height: 4px;
    flex: none;
  }
  .bottomnote {
    font-size: 9px;
    margin: 7px 0;
  }
  .bottomnote b {
    font-size: 12px;
  }
  footer {
    height: 25px;
    min-height: 25px;
    margin: 0 auto;
    padding: 5px 0;
    font-size: 8px;
    gap: 5px;
  }
  footer .footbrand span {
    display: none;
  }
  .playhead {
    min-height: 40px;
    margin: 5px 0;
    gap: 5px;
  }
  .playhead h2 {
    font-size: 18px;
    white-space: nowrap;
  }
  .back {
    padding: 8px 10px;
    font-size: 11px;
    min-height: 34px;
  }
  .controls {
    gap: 6px;
    min-height: 34px;
    flex-wrap: wrap;
    margin: 3px 0;
  }
  .controls label {
    font-size: 11px;
    gap: 4px;
  }
  .controls select,
  .controls button {
    font-size: 11px;
    min-height: 34px;
    padding: 7px 9px;
  }
  .controls > span {
    font-size: 11px;
  }
  .status {
    font-size: 14px;
    min-height: 22px;
    margin: 4px 0;
  }
  .wordlist {
    gap: 5px;
    min-height: 26px;
  }
  .wordlist span {
    font-size: 11px;
    padding: 5px 9px;
  }
  #gamearea {
    padding-bottom: 8px;
    gap: 6px;
  }
  .words .cell {
    border-radius: 7px;
  }
  .shapequestion {
    font-size: 14px;
    gap: 8px;
  }
  .shapequestion svg {
    height: 48px;
    width: 54px;
  }
  .shapeanswers {
    gap: 8px;
  }
  .shapeanswers button {
    border-radius: 16px;
  }
  .equation {
    font-size: 42px;
    letter-spacing: 1px;
  }
  .quantity {
    font-size: 17px;
    letter-spacing: 2px;
  }
  .mathbox {
    border-radius: 22px;
    padding: 15px;
  }
  .answers {
    gap: 10px;
  }
  .answers button {
    font-size: 30px;
  }
  .zerooption {
    font-size: 10px !important;
    padding: 0;
  }
  .zerooption input {
    width: 17px;
    height: 17px;
  }
  body[data-game="paint"] main {
    padding: 0 6px;
  }
  body[data-game="paint"] .playhead h2 {
    font-size: 17px;
  }
  body[data-game="paint"] .playhead {
    min-height: 32px;
    margin: 3px 0;
  }
  body[data-game="paint"] .back {
    font-size: 10px;
    min-height: 30px;
    padding: 6px 8px;
  }
  body[data-game="paint"] .controls {
    flex-wrap: wrap;
    gap: 4px;
    margin: 2px 0;
  }
  body[data-game="paint"] .toolgroup {
    padding: 3px;
    gap: 4px;
    border-radius: 11px;
  }
  body[data-game="paint"] .swatch {
    width: 23px;
    min-width: 23px;
    height: 23px;
  }
  body[data-game="paint"] .controls button {
    font-size: 10px;
    min-height: 28px;
    padding: 5px 8px;
  }
  body[data-game="paint"] .brushsize {
    width: 25px !important;
    min-width: 25px !important;
    height: 25px;
  }
  body[data-game="paint"] #status {
    font-size: 10px;
    min-height: 14px;
    margin: 1px 0;
  }
  body[data-game="paint"] .canvaswrap {
    border-radius: 12px;
  }
  body[data-game="paint"] #gamearea {
    padding-bottom: 5px;
  }
}
@media (max-height: 560px) {
  header {
    height: 42px;
    min-height: 42px;
  }
  .hero {
    padding: 5px 0 2px;
  }
  .hero .eyebrow,
  .hero p,
  .hero .float {
    display: none;
  }
  .hero h1 {
    font-size: 27px;
    margin: 3px 0;
  }
  .toolbar {
    margin: 4px 0 7px;
  }
  .tabs button {
    min-height: 30px;
    padding-top: 6px;
    padding-bottom: 6px;
  }
  .sectiontitle {
    margin-bottom: 5px;
  }
  .bottomnote {
    display: none;
  }
  .desc {
    display: none;
  }
  .cardcopy {
    padding-top: 6px;
    padding-bottom: 5px;
  }
  .meta {
    font-size: 7px;
    margin-top: 5px;
  }
  .cardtop h3 {
    font-size: 14px;
  }
  .tag {
    display: none;
  }
  footer {
    height: 22px;
    min-height: 22px;
    font-size: 9px;
    padding: 4px 0;
  }
  body.playing header {
    height: 40px;
    min-height: 40px;
  }
  .brand small {
    display: none;
  }
  .playhead {
    min-height: 34px;
    margin: 3px 0;
  }
  .playhead h2 {
    font-size: 18px;
  }
  .controls {
    min-height: 30px;
    margin: 2px 0;
  }
  .controls select,
  .controls button {
    min-height: 30px;
    padding: 6px 10px;
  }
  .status {
    min-height: 20px;
    font-size: 14px;
    margin: 3px 0;
  }
  .mathbox {
    padding: 10px;
    gap: 5px;
  }
  .equation {
    font-size: 36px;
  }
  .quantity {
    font-size: 16px;
    line-height: 1.2;
  }
  .answers {
    gap: 8px;
  }
  .answers button {
    font-size: 24px;
    box-shadow: 0 3px 0 #daceb7;
  }
  .shapequestion svg {
    height: 38px;
    width: 44px;
  }
  .modal {
    padding: 16px;
  }
  .modal p {
    font-size: 12px;
    margin: 8px 0;
  }
  .modal h2 {
    font-size: 18px;
    margin-bottom: 8px;
  }
  .modal button {
    font-size: 12px;
    padding: 9px 14px;
  }
}
@media (max-width: 700px) and (max-height: 560px) {
  .cardtop h3 {
    font-size: 11px;
  }
  .meta {
    font-size: 6px;
    margin-top: 3px;
  }
  .grid {
    gap: 5px;
  }
  .gamecard {
    padding: 4px;
    gap: 4px;
  }
  .hero h1 {
    font-size: 25px;
  }
  .tabs button {
    font-size: 9px;
    padding: 5px 7px;
  }
  .age select {
    min-height: 26px;
    padding-top: 4px;
    padding-bottom: 4px;
  }
  .toolbar {
    gap: 4px;
  }
  .sectiontitle span {
    font-size: 8px;
  }
  .playhead h2 {
    font-size: 16px;
  }
  footer {
    font-size: 7px;
  }
  .wordlist span {
    font-size: 10px;
    padding: 4px 7px;
  }
}
body[data-game="paint"] #status {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
}
@media (max-width: 700px) and (max-height: 600px) {
  body[data-game="paint"] main {
    padding: 0 5px;
  }
  body[data-game="paint"] .playhead {
    min-height: 28px;
    margin: 1px 0;
  }
  body[data-game="paint"] .playhead h2 {
    font-size: 15px;
  }
  body[data-game="paint"] .back {
    min-height: 26px;
    padding: 4px 7px;
  }
  body[data-game="paint"] .iconbtn {
    min-height: 26px;
    min-width: 26px;
  }
  body[data-game="paint"] .controls {
    margin: 1px 0;
    gap: 3px;
  }
  body[data-game="paint"] .toolgroup {
    gap: 3px;
    padding: 2px;
  }
  body[data-game="paint"] .swatch {
    width: 19px;
    min-width: 19px;
    height: 19px;
  }
  body[data-game="paint"] .brushsize {
    width: 21px !important;
    min-width: 21px !important;
    height: 21px;
  }
  body[data-game="paint"] .controls button {
    min-height: 24px;
    padding: 4px 7px;
  }
  body[data-game="paint"] #gamearea {
    padding-bottom: 4px;
  }
}

/* Celebrate the achievement while keeping its evidence visible. */
.board {
  position: relative;
}
.board .cell {
  position: relative;
  z-index: 1;
}
.board.has-winner .cell:not(.win) {
  opacity: 0.38;
  filter: saturate(0.55);
}
.board.has-winner .cell.win {
  opacity: 1;
  filter: saturate(1.6);
  outline: 4px solid #e6b74e;
  outline-offset: -4px;
  box-shadow:
    0 0 0 3px #fff7cf,
    0 0 23px #e8bc5870,
    inset 0 0 0 3px #ffffff80;
  animation: victoryGlow 2.2s ease-in-out infinite;
  z-index: 2;
}
.board.has-winner .cell.win:after {
  content: "★";
  position: absolute;
  right: 4%;
  top: 1%;
  font-size: clamp(10px, calc(var(--tile) * 0.19), 26px);
  line-height: 1;
  color: #b28113;
  text-shadow: 0 1px 0 white;
}
.board.connect.has-winner .cell.win {
  outline-width: 5px;
  outline-offset: -5px;
}
.board.connect.has-winner .cell.win:after {
  right: 18%;
  top: 9%;
  font-size: clamp(9px, calc(var(--tile) * 0.21), 22px);
}
.victoryline {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  overflow: visible;
  width: 100%;
  height: 100%;
}
.victoryline line {
  stroke: #f1b949;
  stroke-width: 7;
  stroke-linecap: round;
  opacity: 0.8;
  filter: drop-shadow(0 1px 3px #fff6c4);
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: drawVictory 1.1s ease-out forwards;
}
#status.result-status {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 13px;
  background: linear-gradient(105deg, #e8f0d9, #fff2d2 55%, #f1e5f3);
  border: 1px solid #d3dfbe;
  border-radius: 21px;
  padding: 10px 16px;
  min-height: 64px;
  width: min(950px, 100%);
  align-self: center;
  margin: 6px 0 9px;
  box-shadow: 0 4px 0 #dee5d125;
  text-align: left;
  animation: resultArrive 0.45s ease-out;
}
.result-medal {
  flex: none;
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff8d9;
  font-size: 27px;
  box-shadow: 0 4px 0 #e9d59a;
  animation: medalDance 3s ease-in-out 2;
}
.result-copy {
  flex: 1;
  min-width: 0;
}
.result-copy strong {
  display: block;
  font-size: 21px;
  color: #3b5e3b;
  line-height: 1.2;
}
.result-copy p {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 500;
  color: #66714e;
}
.result-next {
  flex: none;
  border: 0;
  border-radius: 16px;
  background: #365d46;
  color: white;
  min-height: 44px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 4px 0 #244832;
}
.result-next:active {
  transform: translateY(3px);
  box-shadow: none;
}
.board.complete .cell:not(.empty) {
  background-color: #e0edc7;
  box-shadow:
    0 4px 0 #b9ce94,
    inset 0 0 0 2px #afc989;
  animation: pieceFinish 0.6s ease-out both;
  animation-delay: calc(var(--order, 0) * 0.055s);
}
.puzzle.complete .cell.empty:after {
  content: "★";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #b49b50;
  font-size: calc(var(--tile) * 0.5);
}
.memory .cell.pair-focus {
  outline: 4px solid var(--pair-color, #d8b059);
  outline-offset: -4px;
  animation: pairFound 0.65s ease-in-out 2;
}
.memory .cell.matched {
  box-shadow:
    0 4px 0 #b9cd9a,
    inset 0 0 0 3px var(--pair-color, #afc989);
}
.words .cell.found {
  background: #c8dea6;
  color: #334b29;
  font-weight: 800;
  box-shadow: inset 0 0 0 2px #91b671;
}
.words.complete .cell:not(.found) {
  opacity: 0.4;
}
.words.complete .cell.found {
  animation: victoryGlow 2.4s ease-in-out 2;
}
.wordlist .done {
  background: #d1e3b9;
  border: 2px solid #a7c97b;
  color: #3d5b2f;
  font-weight: 800;
  padding: 5px 13px;
}
.mathbox.solved {
  background: linear-gradient(135deg, #e6efd9, #fff1d4);
  box-shadow: inset 0 0 0 2px #c1d7a1;
}
.mathbox.solved .equation {
  color: #466c36;
  animation: answerPop 0.5s ease-out;
}
.mathbox.solved .equation .answer {
  display: inline-block;
  background: #c9e3aa;
  border-radius: 15px;
  padding: 0 12px;
  box-shadow: 0 4px 0 #a7c785;
}
.mathbox.solved .answers button:not(.good) {
  opacity: 0.35;
  box-shadow: none;
}
.mathbox.solved .answers button.good {
  background: #cbe4aa;
  color: #35532a;
  box-shadow:
    0 5px 0 #99bb74,
    inset 0 0 0 3px #9dbf7b;
  animation: answerPop 0.5s ease-out;
}
.math-proof {
  font-size: clamp(13px, 2.2vh, 20px);
  line-height: 1.35;
  font-weight: 700;
  color: #536841;
  padding: 8px 12px;
  background: #ffffff90;
  border-radius: 14px;
  margin: 0;
  flex: none;
}
.shapeanswers.solved button:not(.good) {
  opacity: 0.35;
}
.shapeanswers.solved .good {
  box-shadow:
    0 0 0 4px #b8cf8a,
    0 8px 0 #a4be7a;
  animation: pairFound 0.7s ease-in-out 2;
}
.shapequestion.solved .sample {
  background: #e6f0cd;
  outline: 3px solid #b8cf8a;
}
.shapequestion.solved svg {
  animation: answerPop 0.6s ease-out;
}
.party-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 30;
  contain: strict;
}
.party-piece {
  position: absolute;
  left: var(--left);
  top: -9%;
  width: var(--size);
  height: var(--size);
  background: var(--color);
  border-radius: var(--radius);
  animation: partyRain var(--duration) cubic-bezier(0.16, 0.45, 0.55, 1)
    var(--delay) both;
  will-change: transform;
  opacity: 0.9;
}
.party-piece.star {
  clip-path: polygon(
    50% 0,
    61% 35%,
    98% 35%,
    69% 57%,
    80% 95%,
    50% 73%,
    20% 95%,
    31% 57%,
    2% 35%,
    39% 35%
  );
  border-radius: 0;
}
.party-piece.ribbon {
  height: calc(var(--size) * 2.8);
  width: calc(var(--size) * 0.45);
  border-radius: 5px;
}
.party-spark {
  position: absolute;
  left: var(--x);
  top: var(--y);
  font-size: var(--size);
  color: var(--color);
  line-height: 1;
  animation: sparkBurst 2.2s ease-out var(--delay) both;
  text-shadow: 0 2px 0 #ffffff80;
}
.party-sticker {
  position: absolute;
  bottom: -90px;
  left: var(--left);
  font-size: clamp(32px, 5vw, 64px);
  animation: stickerFloat 5s ease-out var(--delay) both;
  filter: drop-shadow(0 4px 2px #54634220);
}
.party-ring {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 26px;
  height: 26px;
  border: 3px solid var(--color);
  border-radius: 50%;
  animation: ringBloom 1.9s ease-out var(--delay) both;
}
.motionoff .party-layer {
  display: none;
}
@keyframes victoryGlow {
  50% {
    filter: saturate(1.9) brightness(1.09);
    box-shadow:
      0 0 0 3px #fff7cf,
      0 0 30px #e8bc5870,
      inset 0 0 0 3px #ffffff80;
  }
}
@keyframes drawVictory {
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes resultArrive {
  from {
    transform: translateY(10px) scale(0.97);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes medalDance {
  25%,
  75% {
    transform: rotate(-9deg) translateY(-2px);
  }
  50% {
    transform: rotate(9deg);
  }
}
@keyframes pieceFinish {
  from {
    transform: perspective(500px) rotateX(16deg) scale(0.9);
  }
  to {
    transform: none;
  }
}
@keyframes pairFound {
  50% {
    transform: translateY(-3px) scale(1.035);
    filter: brightness(1.08);
  }
}
@keyframes answerPop {
  50% {
    transform: scale(1.045);
  }
}
@keyframes partyRain {
  0% {
    transform: translate3d(0, -4vh, 0) rotate(0);
  }
  100% {
    transform: translate3d(var(--drift), 116vh, 0) rotate(var(--spin));
  }
}
@keyframes sparkBurst {
  0% {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0;
  }
  20% {
    opacity: 0.9;
  }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy)))
      rotate(100deg) scale(0.2);
    opacity: 0;
  }
}
@keyframes stickerFloat {
  0% {
    transform: translateY(0) rotate(-12deg);
    opacity: 0;
  }
  15% {
    opacity: 0.85;
  }
  100% {
    transform: translateY(-112vh) rotate(22deg);
    opacity: 0;
  }
}
@keyframes ringBloom {
  0% {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0;
  }
  20% {
    opacity: 0.65;
  }
  100% {
    transform: translate(-50%, -50%) scale(6);
    opacity: 0;
  }
}
@media (max-width: 700px) {
  #status.result-status {
    padding: 8px 10px;
    gap: 8px;
    min-height: 62px;
    border-radius: 16px;
  }
  .result-medal {
    width: 30px;
    height: 30px;
    font-size: 20px;
  }
  .result-copy strong {
    font-size: 16px;
  }
  .result-copy p {
    font-size: 11px;
    margin-top: 3px;
  }
  .result-next {
    font-size: 11px;
    padding: 8px 11px;
    min-height: 38px;
    max-width: 100px;
  }
  .math-proof {
    font-size: 13px;
    padding: 6px 9px;
  }
  .mathbox.solved .equation .answer {
    padding: 0 7px;
    border-radius: 10px;
  }
  .board.has-winner .cell.win {
    outline-width: 3px;
    outline-offset: -3px;
  }
  .victoryline line {
    stroke-width: 5;
  }
}
@media (max-height: 560px) {
  #status.result-status {
    padding: 6px 10px;
    min-height: 48px;
    margin: 3px 0 5px;
    gap: 8px;
  }
  .result-medal {
    width: 28px;
    height: 28px;
    font-size: 18px;
  }
  .result-copy strong {
    font-size: 15px;
  }
  .result-copy p {
    font-size: 11px;
    line-height: 1.2;
  }
  .result-next {
    min-height: 32px;
    padding: 7px 10px;
    font-size: 11px;
  }
  .math-proof {
    font-size: 12px;
    padding: 5px 8px;
  }
  .mathbox.solved .equation {
    font-size: 30px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .party-layer {
    display: none;
  }
  .board.has-winner .cell.win,
  .victoryline line,
  #status.result-status,
  .result-medal,
  .board.complete .cell,
  .memory .cell.pair-focus,
  .mathbox.solved .equation,
  .mathbox.solved .answers button.good,
  .shapeanswers.solved .good,
  .shapequestion.solved svg {
    animation: none;
  }
  .victoryline line {
    stroke-dashoffset: 0;
  }
}
.motionoff .victoryline line {
  stroke-dashoffset: 0;
}
.memory .cell {
  font-size: clamp(24px, calc(var(--tile, 70px) * 0.78), 175px);
}
body[data-game="memory"] main {
  max-width: none;
  padding: 0 2%;
}
body[data-game="memory"] #gamearea {
  justify-content: center;
}
body[data-game="paint"] .controls {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: center;
}
body[data-game="paint"] .paint-tool {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 7px 16px;
  border-radius: 15px;
  background: #fdfdf9;
  border: 1px solid #d9dfd0;
}
body[data-game="paint"] .tool-icon {
  font-size: 23px;
  line-height: 1;
  min-width: 23px;
}
body[data-game="paint"] .tool-label {
  font-size: 13px;
  white-space: nowrap;
}
body[data-game="paint"] .paint-tool.selected-tool {
  background: #dce8d1;
  box-shadow: inset 0 0 0 2px #8da27e;
}
body[data-game="paint"] .paint-tool.confirm-clear {
  background: #f0c9bc;
  border-color: #cf8f79;
}
#paintpreview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.canvaswrap {
  position: relative;
}
.creative-cover {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: #34423544;
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.creative-dialog {
  background: #fbfaf4;
  border: 1px solid #e1e5d6;
  border-radius: 25px;
  padding: 20px;
  width: min(570px, 100%);
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 20px 90px #27392f33;
}
.creative-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.creative-head h3 {
  font-size: 22px;
  margin: 0;
}
.creative-head button {
  border: 1px solid #d7decd;
  background: white;
  border-radius: 50%;
  min-height: 40px;
  min-width: 40px;
}
.sticker-category {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.sticker-category select {
  padding: 10px;
  border-radius: 13px;
  background: white;
  border: 1px solid #d6ddcb;
  font: inherit;
}
.sticker-category > span {
  font-size: 11px;
  color: #7b8672;
}
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
}
.sticker-grid button {
  background: #f0eddf;
  border: 0;
  border-radius: 15px;
  font-size: clamp(25px, 5vh, 43px);
  height: clamp(40px, 8vh, 70px);
  min-width: 0;
  box-shadow: 0 3px 0 #dddcca;
}
.color-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 11px;
}
.color-choice {
  border: 3px solid white;
  outline: 1px solid #d6d9cc;
  border-radius: 50%;
  height: clamp(30px, 6.5vh, 53px);
  width: clamp(30px, 6.5vh, 53px);
  justify-self: center;
}
.custom-color {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}
.custom-color input {
  width: 65px;
  height: 42px;
  cursor: pointer;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: white;
}
.picker-apply {
  border: 0;
  background: #365d46;
  color: white;
  border-radius: 15px;
  padding: 12px;
  min-height: 42px;
}
.shape-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.shape-picker button {
  border: 0;
  background: #e9eadc;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 72px;
}
.shape-picker b {
  font-size: 35px;
  color: #7e9d81;
  line-height: 1;
}
.shape-picker span {
  font-size: 12px;
}
.fill-option {
  font-size: 14px;
  display: flex;
  gap: 9px;
  align-items: center;
}
.fill-option input {
  width: 22px;
  height: 22px;
  accent-color: #71967d;
}
.picker-note {
  font-size: 14px;
  line-height: 1.4;
  margin: 0;
  color: #6d7b61;
}
.size-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.size-grid button {
  border: 0;
  border-radius: 16px;
  background: #e3e9d6;
  display: flex;
  flex-direction: column;
  gap: 13px;
  align-items: center;
  justify-content: center;
  min-height: 95px;
  font-size: 13px;
}
.size-grid i {
  display: block;
  border-radius: 50%;
  background: #71967d;
}
@media (max-width: 900px) {
  body[data-game="paint"] .paint-tool {
    padding: 7px 10px;
    gap: 4px;
  }
  body[data-game="paint"] .tool-label {
    font-size: 11px;
  }
}
@media (max-width: 700px) {
  body[data-game="paint"] .controls {
    gap: 4px;
    margin: 2px 0;
    min-height: 38px;
  }
  body[data-game="paint"] .paint-tool {
    padding: 5px;
    min-width: 34px;
    width: 34px;
    min-height: 34px;
    border-radius: 11px;
  }
  body[data-game="paint"] .tool-label {
    display: none;
  }
  body[data-game="paint"] .tool-icon {
    font-size: 20px;
    min-width: 20px;
  }
  .creative-dialog {
    padding: 14px;
    gap: 11px;
    border-radius: 20px;
  }
  .creative-head h3 {
    font-size: 18px;
  }
  .sticker-category {
    font-size: 12px;
    gap: 5px;
  }
  .sticker-category select {
    padding: 8px;
    max-width: 180px;
  }
  .sticker-category > span {
    font-size: 9px;
  }
  .sticker-grid {
    gap: 6px;
  }
  .sticker-grid button {
    font-size: 30px;
    height: 50px;
    border-radius: 12px;
  }
  .shape-picker {
    gap: 7px;
  }
  .shape-picker button {
    min-height: 60px;
  }
  .shape-picker b {
    font-size: 28px;
  }
  .color-grid {
    gap: 9px;
  }
  .custom-color {
    font-size: 12px;
  }
  .size-grid {
    gap: 6px;
  }
  .size-grid button {
    font-size: 11px;
    min-height: 80px;
  }
  .picker-note {
    font-size: 12px;
  }
  .fill-option {
    font-size: 12px;
  }
}
@media (max-height: 560px) {
  .creative-dialog {
    padding: 12px;
    gap: 9px;
  }
  .creative-head h3 {
    font-size: 17px;
  }
  .creative-head button {
    min-height: 32px;
    min-width: 32px;
  }
  .sticker-grid button {
    height: 44px;
    font-size: 28px;
  }
  .sticker-category select {
    padding: 7px;
  }
  .shape-picker button {
    min-height: 53px;
  }
  .shape-picker b {
    font-size: 27px;
  }
  .color-choice {
    width: 34px;
    height: 34px;
  }
  .picker-apply {
    padding: 8px;
    min-height: 34px;
  }
  .size-grid button {
    min-height: 72px;
  }
  .custom-color input {
    height: 33px;
  }
}

body[data-game="puzzle"] main {
  max-width: none;
  padding: 0 2%;
}
.puzzle-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  flex: 1;
  width: 100%;
  min-height: 0;
}
.puzzle-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  gap: 9px;
  align-items: center;
}
.puzzle-pane h3 {
  font-size: 17px;
  margin: 0;
  flex: none;
  color: #69765f;
}
.puzzle-stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.puzzle-reference {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 5px;
}
.puzzle-reference img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  border: 7px solid #fffdf5;
  border-radius: 23px;
  box-shadow: 0 5px 0 #d8dece;
}
.picture-caption {
  font-size: 11px;
  margin: 0;
  color: #839075;
  flex: none;
}
.picture-puzzle .cell {
  background-color: #eee9dc !important;
  background-repeat: no-repeat;
  border-radius: 10px;
  box-shadow: 0 4px 0 #c5d1bd;
  border: 0;
  font-size: 0 !important;
}
.picture-puzzle .empty {
  background-image: none;
  background-color: #e6e8da !important;
  box-shadow: inset 0 3px 6px #4c5e3220;
}
.picture-puzzle .empty:after {
  content: "✦";
  color: #acb999;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: calc(var(--tile) * 0.3);
}
.picture-puzzle.picture-complete {
  gap: 0;
  border: 5px solid #b5cb82;
  border-radius: 17px;
  box-shadow: 0 0 25px #bfd88955;
  overflow: hidden;
}
.picture-puzzle.picture-complete .cell {
  border-radius: 0;
  box-shadow: none;
  animation: none;
}
.reference-complete img {
  border-color: #d7e7b7;
}
.puzzle-pane:first-child {
  padding-bottom: 23px;
}
@media (max-width: 700px) {
  .puzzle-layout {
    gap: 10px;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  }
  .puzzle-pane {
    gap: 6px;
  }
  .puzzle-pane h3 {
    font-size: 11px;
    text-align: center;
  }
  .puzzle-reference {
    padding: 2px;
  }
  .puzzle-reference img {
    border-width: 4px;
    border-radius: 12px;
  }
  .picture-caption {
    font-size: 9px;
    text-align: center;
    line-height: 1.3;
  }
  .picture-puzzle .cell {
    border-radius: 6px;
  }
  .puzzle-pane:first-child {
    padding-bottom: 26px;
  }
  body[data-game="puzzle"] .controls {
    gap: 5px;
  }
  body[data-game="puzzle"] .controls select {
    max-width: 172px;
  }
}
@media (orientation: portrait) and (max-width: 700px) {
  .puzzle-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 10px;
  }
  .puzzle-pane:first-child {
    padding-bottom: 0;
  }
  .puzzle-pane:last-child {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    grid-template-rows: auto auto;
    column-gap: 12px;
    padding: 0 12px;
  }
  .puzzle-pane:last-child h3 {
    grid-column: 1;
    align-self: end;
    font-size: 15px;
  }
  .puzzle-pane:last-child .puzzle-reference {
    grid-column: 2;
    grid-row: 1/3;
    height: 100%;
    min-height: 0;
  }
  .puzzle-pane:last-child .picture-caption {
    grid-column: 1;
    align-self: start;
  }
  .puzzle-reference img {
    height: 100%;
    max-height: 100%;
    max-width: 100%;
    width: auto;
  }
}
.puzzle-menu-image {
  height: 90%;
  width: auto;
  max-width: 85%;
  aspect-ratio: 1;
  object-fit: contain;
  border: 5px solid #fff9e9;
  border-radius: 14px;
  transform: rotate(-7deg);
  box-shadow: 4px 7px 0 #81927622;
  z-index: 1;
}
@media (max-height: 450px) {
  body[data-game="paint"] .playhead {
    min-height: 28px;
    margin: 1px 0;
  }
  body[data-game="paint"] .playhead h2 {
    font-size: 16px;
  }
  body[data-game="paint"] .back {
    min-height: 26px;
    padding: 4px 10px;
  }
  body[data-game="paint"] .iconbtn {
    min-height: 28px;
    min-width: 28px;
  }
  body[data-game="paint"] .controls {
    min-height: 32px;
    margin: 1px 0;
  }
  body[data-game="paint"] .paint-tool {
    min-height: 30px;
    padding: 4px 10px;
  }
  body[data-game="paint"] .tool-icon {
    font-size: 20px;
  }
  body[data-game="paint"] #gamearea {
    padding-top: 1px;
    padding-bottom: 4px;
  }
}
