:root {
  --sky-top: #6ec4ea;
  --ink: #1b3550;
  --ink-soft: #46607a;
  --card: #fffdf8;
  --pink: #ff5cad;
  --red: #ff3b5c;
  --blue: #2f8fe8;
  --green: #2fbe62;
  --yellow: #ffd429;
  --shadow: 0 14px 40px rgba(27, 53, 80, 0.16);
  --radius: 28px;
  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-ui: "Nunito", "Fredoka", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-ui);
  background: #8fd0ee;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
}

html.embed,
html.embed body {
  height: 100%;
  min-height: 100%;
}

html.embed #app {
  height: 100%;
  min-height: 100%;
}

html.embed .site-foot {
  display: none;
}

.sky {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(110, 196, 234, 0.08) 0%, rgba(255, 250, 230, 0.02) 48%, rgba(123, 201, 111, 0.12) 100%),
    url("../assets/sky.jpg") center top / cover no-repeat;
  pointer-events: none;
}

.sky::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22%;
  background: linear-gradient(180deg, transparent, rgba(74, 168, 86, 0.14));
  pointer-events: none;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(160deg, #4da3d4, #2f7fbd);
  color: #fff;
  font-family: var(--font-display);
  font-size: 14px;
  box-shadow: 0 6px 14px rgba(47, 127, 189, 0.35);
}

.brand-name {
  font-size: 15px;
  letter-spacing: -0.02em;
}

.hud {
  display: flex;
  gap: 10px;
}

.stat {
  min-width: 76px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.86);
  box-shadow: 0 6px 16px rgba(27, 53, 80, 0.1);
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.stat span:last-child {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.9);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(27, 53, 80, 0.12);
  cursor: pointer;
}

.icon-btn:hover {
  transform: translateY(-1px);
}

.listen-btn {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: #2f7fbd;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 5;
}

.title-screen,
.win-screen {
  display: grid;
  place-items: center;
  padding: 72px 16px 64px;
}

.title-card,
.win-card {
  width: min(560px, 100%);
  padding: 18px 18px 22px;
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(8px);
}

.hero {
  display: block;
  width: 100%;
  height: 168px;
  object-fit: cover;
  object-position: center 30%;
  border-radius: 20px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #2f7fbd;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(32px, 6vw, 46px);
  letter-spacing: -0.03em;
}

.lede {
  margin: 0 auto 8px;
  max-width: 38ch;
  color: var(--ink-soft);
  line-height: 1.45;
}

.ages {
  margin: 0 0 16px;
  font-weight: 800;
  color: #2f7fbd;
  font-size: 13px;
}

.mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.play-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  padding: 10px 12px;
  border: 0;
  border-radius: 18px;
  background: #eef6fb;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 6px 0 #c5d8e6;
}

.play-btn.primary {
  background: linear-gradient(180deg, #ff7ab3, #ff4d8d);
  color: #fff;
  box-shadow: 0 6px 0 #d12e6c;
}

.play-btn:hover {
  transform: translateY(-1px);
}

.play-btn:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #c5d8e6;
}

.play-btn.primary:active {
  box-shadow: 0 3px 0 #d12e6c;
}

.play-kicker {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.8;
}

.play-screen {
  pointer-events: none;
}

.prompt {
  position: absolute;
  top: 72px;
  left: 50%;
  z-index: 18;
  transform: translateX(-50%);
  min-width: 180px;
  padding: 8px 22px 10px;
  border-radius: 22px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
  text-align: center;
  pointer-events: none;
}

.prompt.free .prompt-kicker {
  visibility: hidden;
  height: 0;
  margin: 0;
}

.prompt-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.prompt-letter {
  margin: 0;
  font-family: var(--font-display);
  font-size: 56px;
  line-height: 0.95;
}

.prompt-word {
  margin: 0;
  font-weight: 800;
  color: #2f7fbd;
}

.sky-field {
  position: absolute;
  inset: 0;
  z-index: 12;
  overflow: hidden;
  pointer-events: auto;
}

.balloon {
  position: absolute;
  left: 0;
  top: 0;
  width: 100px;
  height: 214px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  will-change: transform;
}

.balloon-visual {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: 50% 32%;
}

.balloon-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 8px 10px rgba(27, 53, 80, 0.18));
}

.balloon-letter {
  position: absolute;
  top: 6%;
  left: 12%;
  right: 12%;
  height: 42%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

.balloon.is-target .balloon-art {
  filter:
    drop-shadow(0 0 5px #fff)
    drop-shadow(0 0 10px rgba(255, 77, 141, 0.7))
    drop-shadow(0 8px 10px rgba(27, 53, 80, 0.18));
}

.balloon.popping {
  pointer-events: none;
}

.balloon.popping .balloon-visual {
  animation: pop 0.28s ease-out forwards;
}

.balloon.miss .balloon-visual {
  animation: wiggle 0.38s ease;
}

@keyframes pop {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  40% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(0.2);
    opacity: 0;
  }
}

@keyframes wiggle {
  0%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-8deg);
  }
  75% {
    transform: rotate(8deg);
  }
}

.fx {
  position: absolute;
  inset: 0;
  z-index: 13;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.alpha-strip {
  position: absolute;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 11;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  width: min(920px, calc(100% - 20px));
  transform: translateX(-50%);
  padding: 8px;
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow);
  pointer-events: none;
}

.chip {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e7eef4;
  color: #7a8ea0;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
}

.chip.got {
  background: var(--green);
  color: #fff;
}

.chip.now {
  background: #ff4d8d;
  color: #fff;
  transform: scale(1.08);
}

.win-score {
  margin: 0 0 18px;
  font-size: 20px;
}

.site-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  z-index: 20;
  display: flex;
  justify-content: center;
  gap: 6px;
  color: #1b3550cc;
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}

.site-foot a {
  color: inherit;
  pointer-events: auto;
}

body.is-playing .site-foot {
  display: none;
}

.float-word {
  position: absolute;
  z-index: 12;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: #1b3550;
  text-shadow: 0 2px 0 #fff;
  pointer-events: none;
  animation: float-up 0.9s ease-out forwards;
}

@keyframes float-up {
  to {
    transform: translateY(-48px);
    opacity: 0;
  }
}

[hidden] {
  display: none !important;
}

@media (max-width: 640px) {
  .hero {
    height: 128px;
  }

  .mode-row {
    grid-template-columns: 1fr;
  }

  .prompt-letter {
    font-size: 44px;
  }

  .brand-name {
    display: none;
  }

  .chip {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }

  .balloon {
    width: 82px;
    height: 176px;
  }

  .balloon-letter {
    font-size: 32px;
  }
}

/* Short frames (the game sits inside the post page at 520-640px tall): the menu card and its two buttons fit
   without scrolling, and the score bar keeps every button inside the frame on narrow phones. */
@media (max-height: 600px) {
  .title-screen,
  .win-screen {
    padding: 60px 12px 12px;
  }

  .hero {
    height: 92px;
    margin-bottom: 8px;
  }

  h1,
  h2 {
    font-size: 30px;
    margin-bottom: 4px;
  }

  .lede {
    font-size: 14px;
    line-height: 1.35;
    margin-bottom: 4px;
  }

  .ages {
    margin-bottom: 10px;
  }

  .mode-row {
    grid-template-columns: 1fr 1fr;
  }

  .play-btn {
    min-height: 60px;
    padding: 8px;
    font-size: 16px;
  }
}

@media (max-width: 420px) {
  .topbar {
    gap: 6px;
    padding: calc(8px + env(safe-area-inset-top)) 10px 6px;
  }

  body.is-playing .brand {
    display: none;
  }

  .hud,
  .top-actions {
    gap: 6px;
  }

  .stat {
    min-width: 58px;
    padding: 4px 8px;
  }

  .stat span:last-child {
    font-size: 16px;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .balloon.popping .balloon-visual,
  .balloon.miss .balloon-visual,
  .float-word {
    animation: none;
  }
}
