:root {
  --ink: #25365c;
  --world: #a8e8ef;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--world);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(ellipse at 85% 0, #ffffff70, transparent 65%), var(--world);
}
button,
a,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
}
button:disabled {
  cursor: default;
}
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible {
  outline: 5px solid #273b83;
  outline-offset: 4px;
}
button {
  transition: transform 0.15s;
}
button:not(:disabled):active {
  transform: scale(0.96);
}
a {
  color: inherit;
  text-decoration: none;
}
svg {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
img {
  max-width: 100%;
}
h1,
h2,
p {
  margin: 0;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.app-shell {
  padding: 16px 22px 22px;
  min-height: 100dvh;
  max-width: 1800px;
  margin: auto;
}
.home-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-size: 28px;
  font-weight: 800;
  display: flex;
  gap: 10px;
  align-items: center;
}
.brand:first-letter {
  color: #278d61;
}
.round-button {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 3px solid #fff;
  border-radius: 24px;
  background: #fffdf5;
  box-shadow: 0 5px 0 #28376519;
  flex-shrink: 0;
  font-size: 30px;
}
.round-button svg {
  width: 32px;
  height: 32px;
}
.parents-button {
  width: 48px;
  height: 48px;
  border-radius: 18px;
  font-size: 27px;
  background: #ffffff90;
}
.home-button {
  background: #ffda48;
  color: #304576;
  border-color: #fff4c5;
}
#home-screen {
  height: calc(100dvh - 94px);
  min-height: 530px;
  display: flex;
  flex-direction: column;
}
.welcome {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  height: clamp(115px, 20vh, 210px);
  flex-shrink: 0;
}
.welcome h1 {
  font-size: clamp(36px, 4.6vw, 70px);
  letter-spacing: -2px;
  white-space: nowrap;
  color: #285382;
}
.welcome img {
  height: 120%;
  width: auto;
  max-width: 46%;
  object-fit: contain;
}
.game-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  min-height: 0;
  gap: 18px;
  flex: 1;
  padding-top: 8px;
}
.game-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--tile);
  border: 5px solid #fffefa;
  border-radius: 32px;
  box-shadow: 0 7px 0 #3b4c6824;
  overflow: hidden;
  padding: 8px 8px 12px;
  position: relative;
}
.game-card:hover {
  transform: translateY(-4px);
}
.card-art {
  position: relative;
  flex: 1;
  min-height: 0;
  height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
}
.card-art > .character {
  width: auto;
  height: 100%;
  max-height: 250px;
  max-width: 100%;
  aspect-ratio: 1;
}
.card-prop {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 39%;
  max-width: 100px;
  height: 46%;
  transform: rotate(12deg);
  filter: drop-shadow(0 4px 0 #26355326);
}
.card-prop > .character {
  display: none;
}
.card-name {
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 900;
  background: #fffffff0;
  border-radius: 15px;
  padding: 7px 10px;
  display: block;
  position: relative;
}
.character {
  display: block;
  aspect-ratio: 1;
  background-image: url("../assets/images/character-atlas.png");
  background-size: 300% 200%;
  background-repeat: no-repeat;
  background-position: var(--cx) var(--cy);
}
.playing .app-shell {
  max-width: none;
  height: 100dvh;
  min-height: 300px;
  padding: 12px 20px 20px;
  overflow: hidden;
}
#play-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}
.play-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
  height: 68px;
}
.play-header h1 {
  font-size: clamp(25px, 3vw, 38px);
  letter-spacing: -0.6px;
  outline: none;
}
.header-spacer {
  width: 64px;
  flex-shrink: 0;
}
#game-instruction {
  text-align: center;
  font-size: clamp(18px, 2.3vw, 27px);
  line-height: 1.15;
  margin: 12px 0 16px;
  flex-shrink: 0;
  font-weight: 700;
}
#game-instruction:empty {
  display: none;
}
#game-root {
  flex: 1;
  min-height: 0;
  display: flex;
  width: 100%;
  position: relative;
}
#game-root > div {
  width: 100%;
  min-height: 0;
}
.cheer {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%) scale(0.5);
  opacity: 0;
  z-index: 5;
  pointer-events: none;
  white-space: nowrap;
  font-weight: 900;
  font-size: clamp(38px, 7vw, 80px);
  padding: 16px 30px;
  border: 5px solid white;
  border-radius: 35px;
  background: #ffdc42;
  box-shadow: 0 10px 0 #a87d3622;
  color: #5c3ea5;
}
.cheer span {
  color: #fff7cd;
}
.cheer.show {
  animation: cheer 1.1s ease both;
}
.learning-game {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.buddy-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 5vw, 70px);
  flex: 1;
  min-height: 0;
  position: relative;
}
.buddy-stage > .character {
  width: min(46%, 430px);
  max-height: 100%;
  height: auto;
  aspect-ratio: 1;
}
.target-bubble {
  width: clamp(130px, 24vw, 280px);
  aspect-ratio: 1;
  border-radius: 34%;
  background: #ffffffdc;
  border: 6px solid white;
  display: grid;
  place-items: center;
  padding: 20px;
  box-shadow: 0 10px 0 #35486412;
  position: relative;
}
.target-bubble:before {
  content: "";
  position: absolute;
  left: -22px;
  top: 60%;
  border-style: solid;
  border-width: 15px 26px 15px 0;
  border-color: transparent white transparent transparent;
}
.target-bubble svg {
  width: 100%;
  height: 100%;
}
.big-choices {
  display: flex;
  justify-content: center;
  gap: clamp(16px, 4vw, 50px);
  height: clamp(155px, 31vh, 310px);
  flex-shrink: 0;
  padding: 0 4% 10px;
}
.big-choice {
  min-width: 0;
  width: min(38%, 350px);
  height: 100%;
  padding: 20px;
  border-radius: 36px;
  background: #fff;
  border: 6px solid #ffffff;
  box-shadow: 0 9px 0 #3d507b25;
  display: grid;
  place-items: center;
}
.big-choice svg {
  width: 100%;
  height: 100%;
  max-width: 220px;
  max-height: 220px;
}
.big-choice.correct {
  background: #c5ff8c;
  border-color: #5cae40;
}
.attention {
  animation: attention 0.6s ease;
}
.bounce {
  animation: bounce 0.45s ease;
}
.pop-in {
  animation: pop-in 0.3s ease-out;
}
.parents-dialog {
  max-width: 470px;
  width: calc(100% - 32px);
  padding: 28px;
  border: 5px solid white;
  border-radius: 30px;
  background: #f1fbff;
  color: var(--ink);
  box-shadow: 0 20px 80px #13295650;
}
.parents-dialog::backdrop {
  background: #26345066;
  backdrop-filter: blur(4px);
}
.parents-dialog h2 {
  font-size: 30px;
  margin: 12px 0 18px;
}
.parents-dialog p {
  font-size: 16px;
  line-height: 1.6;
  margin: 16px 0;
}
.parents-dialog #close-parents {
  float: right;
  width: 48px;
  height: 48px;
  font-size: 23px;
  border-radius: 17px;
}
.setting-button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 60px;
  border-radius: 18px;
  background: #d9eaff;
  margin: 14px 0;
  padding: 15px;
  font-size: 17px;
  font-weight: 700;
}
.setting-button svg {
  width: 27px;
  height: 27px;
  flex-shrink: 0;
}
.parents-dialog .parent-note {
  font-size: 13px;
  color: #51617c;
}
@keyframes cheer {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  20%,
  75% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -65%) scale(1.1);
  }
}
@keyframes bounce {
  50% {
    transform: translateY(-20px) rotate(-5deg);
  }
}
@keyframes attention {
  50% {
    transform: scale(1.08);
  }
}
@keyframes pop-in {
  from {
    transform: scale(0.85);
    opacity: 0.3;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
@media (max-width: 900px) {
  .app-shell {
    padding: 14px;
  }
  .game-grid {
    gap: 13px;
  }
  .game-card {
    border-radius: 25px;
    border-width: 4px;
  }
  .card-name {
    font-size: 19px;
    padding: 7px 3px;
  }
  .playing .app-shell {
    padding: 12px;
  }
  .big-choices {
    padding-left: 0;
    padding-right: 0;
  }
  .target-bubble {
    padding: 16px;
  }
  .buddy-stage > .character {
    width: 48%;
  }
}
@media (max-width: 700px) and (orientation: portrait) {
  #home-screen {
    min-height: 760px;
  }
  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));
    gap: 12px;
  }
  .welcome {
    height: 120px;
    gap: 8px;
  }
  .welcome h1 {
    font-size: 36px;
    letter-spacing: -1.5px;
  }
  .welcome img {
    height: 120px;
    max-width: 50%;
  }
  .card-art {
    max-height: 185px;
  }
  .game-card {
    padding: 4px 6px 8px;
  }
  .card-art > .character {
    height: 100%;
    max-height: 185px;
    width: auto;
    max-width: 100%;
  }
  .card-prop {
    width: 34%;
    height: 50%;
  }
  .card-name {
    font-size: 23px;
    padding: 5px;
  }
  .brand {
    font-size: 25px;
  }
  .play-header {
    height: 60px;
  }
  .play-header .round-button {
    width: 58px;
    height: 58px;
    border-radius: 21px;
  }
  .header-spacer {
    width: 58px;
  }
  #game-instruction {
    margin: 12px 0;
    font-size: 22px;
  }
  .buddy-stage {
    flex-direction: column;
    gap: 0;
  }
  .buddy-stage > .character {
    height: min(42vh, 340px);
    width: auto;
    max-height: 70%;
    max-width: 90%;
  }
  .target-bubble {
    position: absolute;
    right: 3%;
    bottom: 1%;
    width: clamp(100px, 32vw, 170px);
    border-radius: 30%;
    padding: 14px;
  }
  .big-choices {
    height: clamp(160px, 29vh, 300px);
    gap: 16px;
    padding-bottom: 10px;
  }
  .big-choice {
    width: 46%;
    padding: 14px;
    border-radius: 30px;
  }
  .learning-game {
    gap: 12px;
  }
}
@media (max-width: 380px) {
  .brand {
    font-size: 22px;
  }
  .welcome h1 {
    font-size: 29px;
  }
  .welcome {
    height: 100px;
  }
  .welcome img {
    height: 100px;
  }
  .card-name {
    font-size: 20px;
  }
  #game-instruction {
    font-size: 19px;
  }
  .big-choices {
    height: 26vh;
    min-height: 125px;
  }
  .big-choice {
    border-width: 4px;
  }
  .cheer {
    font-size: 35px;
    padding: 14px;
  }
  .playing .app-shell {
    padding: 8px;
  }
}
@media (max-height: 550px) and (orientation: landscape) {
  .playing .app-shell {
    padding: 8px 14px;
  }
  .play-header {
    height: 48px;
  }
  .play-header .round-button {
    width: 48px;
    height: 48px;
    border-radius: 16px;
  }
  .play-header h1 {
    font-size: 25px;
  }
  #game-instruction {
    font-size: 18px;
    margin: 5px 0 7px;
  }
  .learning-game {
    flex-direction: row;
    gap: 16px;
  }
  .buddy-stage {
    width: 50%;
    flex: 1;
  }
  .buddy-stage > .character {
    width: 65%;
    height: auto;
    max-height: 100%;
  }
  .target-bubble {
    width: 40%;
    padding: 10px;
  }
  .big-choices {
    width: 50%;
    height: 100%;
    gap: 12px;
    align-items: center;
  }
  .big-choice {
    height: 80%;
    width: 48%;
    padding: 12px;
  }
  .header-spacer {
    width: 48px;
  }
  .welcome {
    height: 100px;
  }
  .cheer {
    font-size: 40px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
  .cheer.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}
