/* ── Akimi Islands — mini-games ───────────────────────────────────────────
   One shell, four games. Everything is oversized on purpose: a six-year-old
   aiming with a finger on a moving tablet needs a much bigger target than an
   adult with a mouse.
   ───────────────────────────────────────────────────────────────────────── */

.play-prompt {
  pointer-events: auto;
  border: none;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 24px 11px 14px;
  border-radius: var(--r-pill);
  background: var(--sun);
  color: #4A3300;
  font-size: 18px;
  box-shadow: var(--shadow-md);
  min-height: var(--tap);
  animation: talk-in .4s var(--ease) both, talk-nudge 2.4s ease-in-out 1s infinite;
}
.play-prompt:active { transform: translateY(3px); box-shadow: var(--shadow-sm); }
.play-face { font-size: 27px; line-height: 1; }
.play-words { font-weight: 500; }
.play-words b { font-weight: 700; }

/* ── The panel ────────────────────────────────────────────────────────── */

.mg-panel {
  width: min(560px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 18px 22px 20px;
  animation: panel-in .38s var(--ease) both;
}

.mg-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.mg-icon { font-size: 34px; line-height: 1; }
.mg-titles { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.mg-name { font-size: 22px; font-weight: 700; }
.mg-best { font-size: 14px; color: var(--ink-soft); }

/* ── How to play ──────────────────────────────────────────────────────── */

.mg-intro { text-align: center; padding: 14px 0 8px; }
.mg-how { font-size: 19px; line-height: 1.45; margin-bottom: 22px; }

/* ── Playing ──────────────────────────────────────────────────────────── */

.mg-stage { display: flex; flex-direction: column; gap: 12px; min-height: 0; }

.mg-say {
  align-self: center;
  padding: 8px 20px;
  border-radius: var(--r-pill);
  background: rgba(27, 42, 56, .07);
  font-size: 17px;
  font-weight: 600;
  text-align: center;
}
.mg-say[data-mood="good"] { background: #DCF7EC; color: #0E7A55; }
/* "Soft" is what a wrong answer gets. Warm, never red. */
.mg-say[data-mood="soft"] { background: #FFF0D9; color: #8A5A12; }

.mg-board { overflow-y: auto; padding: 2px; }

/* Progress pips shared by the question games */
.mg-pips { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.mg-pip {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: rgba(27, 42, 56, .14);
  transition: background .3s ease, transform .3s var(--ease);
}
.mg-pip.on { background: var(--mint); transform: scale(1.12); }

/* ── Memory Match ─────────────────────────────────────────────────────── */

.mg-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), 1fr);
  gap: 10px;
}

.mg-card {
  aspect-ratio: 3 / 4;
  min-height: 74px;
  border: none;
  border-radius: var(--r-md);
  background: var(--grape);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: clamp(28px, 8vw, 40px);
  transition: transform .22s var(--ease), background .22s ease;
}
.mg-card:active { transform: scale(.95); }
.mg-card-back { color: #fff; font-weight: 700; font-size: 30px; }
.mg-card-face { display: none; }

.mg-card.up { background: var(--white); }
.mg-card.up .mg-card-back { display: none; }
.mg-card.up .mg-card-face { display: block; animation: pop-in .3s var(--ease) both; }

.mg-card.done { background: #DCF7EC; transform: scale(.94); cursor: default; }

/* ── Math Adventure ───────────────────────────────────────────────────── */

.mg-question {
  font-size: 21px;
  line-height: 1.45;
  text-align: center;
  padding: 6px 4px 4px;
  min-height: 3.2em;      /* stops the buttons jumping between questions */
}

.mg-choices { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.mg-choice {
  min-width: 92px;
  min-height: 76px;
  padding: 10px 22px;
  border: none;
  border-radius: var(--r-md);
  background: var(--white);
  box-shadow: var(--shadow-md);
  font-family: inherit;
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: transform .18s var(--ease), background .25s ease, opacity .25s ease;
}
.mg-choice:active { transform: translateY(3px); }
.mg-choice.right { background: var(--mint); color: #08312A; }
/* A wrong pick fades out of the way. No cross, no red, no "wrong". */
.mg-choice.soft { opacity: .38; box-shadow: none; }

/* ── Bubble Pop ───────────────────────────────────────────────────────── */

.mg-target {
  display: flex;
  align-items: center;
  justify-content: center;
  /* The wording is a whole sentence, so on a narrow phone it wraps above the
     number rather than squeezing the circle out of shape. */
  flex-wrap: wrap;
  gap: 12px;
  text-align: center;
  font-size: 19px;
  font-weight: 600;
}
.mg-target b {
  display: grid;
  place-items: center;
  flex: none;
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--sun);
  color: #4A3300;
  font-size: 30px;
}

.mg-pond {
  position: relative;
  height: min(46vh, 340px);
  margin-top: 10px;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, #CFF1FB 0%, #9FE0F5 100%);
  overflow: hidden;
}

.mg-bubble {
  position: absolute;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #10323F;
  font-family: inherit;
  font-size: 24px;
  font-weight: 700;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .12), 0 3px 8px rgba(16, 50, 63, .22);
  display: grid;
  place-items: center;
}
.mg-bubble.popping { animation: bubble-pop .18s ease forwards; }
@keyframes bubble-pop { to { transform: scale(1.6); opacity: 0; } }

.wobble { animation: wobble .4s ease; }
@keyframes wobble {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}

.mg-timer {
  height: 12px;
  margin-top: 10px;
  border-radius: var(--r-pill);
  background: rgba(27, 42, 56, .12);
  overflow: hidden;
}
.mg-timer-fill { height: 100%; width: 100%; background: var(--mint); border-radius: var(--r-pill); }

/* ── Word Builder ─────────────────────────────────────────────────────── */

.mg-clue { text-align: center; font-size: 72px; line-height: 1.1; margin-bottom: 6px; }

.mg-slots { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }

.mg-slot {
  width: 54px; height: 64px;
  border: 3px dashed rgba(27, 42, 56, .22);
  border-radius: var(--r-sm);
  background: transparent;
  font-family: inherit;
  font-size: 30px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
}
.mg-slot.filled { border-style: solid; border-color: transparent; background: var(--white); box-shadow: var(--shadow-sm); }
.mg-slots.right .mg-slot { background: var(--mint); color: #08312A; }

.mg-tiles { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; }

.mg-tile {
  width: 54px; height: 60px;
  border: none;
  border-radius: var(--r-sm);
  background: var(--sun);
  color: #4A3300;
  box-shadow: var(--shadow-sm);
  font-family: inherit;
  font-size: 28px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .18s var(--ease), opacity .2s ease;
}
.mg-tile:active { transform: translateY(3px); }
.mg-tile.used { opacity: .22; cursor: default; }

/* ── How you did ──────────────────────────────────────────────────────── */

.mg-over { text-align: center; padding: 12px 0 6px; }

.mg-stars { display: flex; gap: 14px; justify-content: center; margin-bottom: 16px; }
.mg-star {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: rgba(27, 42, 56, .1);
  display: grid;
  place-items: center;
  font-size: 34px;
  transition: transform .35s var(--ease), background .35s ease;
}
.mg-star::after { content: '⭐'; filter: grayscale(1); opacity: .35; transition: filter .35s, opacity .35s; }
.mg-star.on { background: #FFF3D4; transform: scale(1.18); }
.mg-star.on::after { filter: none; opacity: 1; }

.mg-over-title { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.mg-over-note { font-size: 17px; color: var(--ink-soft); margin-bottom: 20px; }
.mg-over-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Small screens ────────────────────────────────────────────────────── */

@media (max-width: 560px) {
  .mg-panel { padding: 14px 16px 16px; }
  .mg-question { font-size: 19px; }
  .mg-choice { min-width: 80px; min-height: 68px; font-size: 28px; }
  .mg-clue { font-size: 58px; }
  .mg-slot, .mg-tile { width: 46px; }
  .mg-how { font-size: 17px; }
  .play-prompt { font-size: 17px; padding: 10px 18px 10px 12px; }
}

@media (max-height: 520px) {
  .mg-clue { font-size: 44px; }
  .mg-pond { height: 40vh; }
  .mg-question { font-size: 18px; min-height: 2.6em; }
  .mg-star { width: 44px; height: 44px; font-size: 28px; }
}
