/* Balloon Colours: original CSS and inline-SVG artwork, no fonts or images fetched from anywhere. */
:root {
  --ink: #1d2b4f;
  --card: #fffdf6;
  --sky-top: #8fd3ff;
  --sky-bottom: #e8f7ff;
  --focus: #1d2b4f;
  --red: #d62f2f;
  --blue: #2a6fdb;
  --yellow: #ffd60a;
  --green: #2f9e57;
  --orange: #f07814;
  --purple: #8b4fc4;
  --size: min(36vw, 22dvh);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--sky-top);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.defs { position: absolute; width: 0; height: 0; }

#app {
  position: relative; height: 100vh; height: 100dvh; overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  display: flex; flex-direction: column;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }

/* sky, clouds, hills */
.sky { position: absolute; inset: 0; background: linear-gradient(var(--sky-top), var(--sky-bottom) 70%); z-index: 0; overflow: hidden; }
.cloud { position: absolute; width: 120px; height: 38px; background: #fff; border-radius: 40px; opacity: .9; animation: drift 60s linear infinite; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 56px; height: 56px; left: 18px; top: -26px; }
.cloud::after { width: 42px; height: 42px; left: 62px; top: -18px; }
.c1 { top: 14%; left: -140px; }
.c2 { top: 38%; left: -140px; animation-duration: 85s; animation-delay: -30s; transform: scale(.7); }
.c3 { top: 62%; left: -140px; animation-duration: 110s; animation-delay: -70s; transform: scale(.55); }
@keyframes drift { to { translate: calc(100vw + 300px) 0; } }
.hill { position: absolute; bottom: -12%; width: 130%; height: 26%; border-radius: 50% 50% 0 0; }
.h1 { left: -20%; background: #8fd68a; }
.h2 { right: -30%; bottom: -16%; background: #6cc276; height: 24%; }

.screen { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* round buttons (sound, replay) */
.round-btn {
  width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--ink);
  background: var(--card); display: grid; place-items: center; padding: 0;
  box-shadow: 0 4px 0 rgba(29,43,79,.25);
}
.round-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(29,43,79,.25); }
.round-btn .ico { width: 34px; height: 34px; }
#sound { position: absolute; z-index: 5; right: calc(12px + env(safe-area-inset-right)); top: calc(12px + env(safe-area-inset-top)); }
#sound .ico-off { display: none; }
#app[data-sound="off"] #sound .ico-on { display: none; }
#app[data-sound="off"] #sound .ico-off { display: block; }
#app[data-sound="off"] #sound { background: #e9e6dc; }
#replay[aria-disabled="true"] { opacity: .45; }

/* start screen */
.start { align-items: center; justify-content: center; text-align: center; gap: 2vh; padding: 16px; }
.start h1 { font-size: clamp(40px, 11vw, 84px); line-height: 1.12; margin: 0; letter-spacing: .5px; text-shadow: 0 3px 0 #fff; }
.hero { display: flex; gap: 6px; align-items: flex-end; justify-content: center; height: min(34dvh, 220px); }
.hero .b { width: min(24vw, 110px); height: auto; animation: bob 4s ease-in-out infinite; }
.hero .b2 { width: min(30vw, 138px); animation-delay: -1.3s; }
.hero .b3 { animation-delay: -2.4s; }
.big-btn {
  min-width: 200px; min-height: 84px; padding: 0 44px; border-radius: 48px; border: 4px solid var(--ink);
  background: #ffd23f; font-size: 36px; font-weight: 800; box-shadow: 0 6px 0 rgba(29,43,79,.3);
}
.big-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(29,43,79,.3); }
.promise { max-width: 30ch; margin: 0; font-size: 17px; line-height: 1.35; background: rgba(255,253,246,.85); padding: 8px 14px; border-radius: 14px; }

/* colours for svg balloons */
.col-red { color: var(--red); } .col-blue { color: var(--blue); } .col-yellow { color: var(--yellow); }
.col-green { color: var(--green); } .col-orange { color: var(--orange); } .col-purple { color: var(--purple); }

/* game */
.game { padding: 12px 14px 8px; gap: 6px; }
.prompt-bar { display: flex; align-items: center; gap: 10px; padding-right: 76px; min-height: 64px; }
.prompt {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: var(--card);
  border: 3px solid var(--ink); border-radius: 22px; padding: 8px 14px; font-size: clamp(22px, 6.4vw, 34px); font-weight: 800; line-height: 1.15;
}
.swatch { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--sw, #ccc); border: 3px solid var(--ink); }
#replay { flex: none; margin-left: 0; }
/* the sound button sits top right on every screen; keep the replay button just left of the text */
.prompt-bar { flex-direction: row; }

.voice-note { margin: 0; font-size: 15px; line-height: 1.3; background: rgba(255,253,246,.92); border-radius: 12px; padding: 6px 12px; align-self: flex-start; }

.field { flex: 1; min-height: 0; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 2dvh clamp(8px, 4vw, 40px); padding: 4px 0; }
.balloon {
  position: relative; width: var(--size); height: calc(var(--size) * 1.28); padding: 0; border: 0; background: none;
  animation: bob 3.6s ease-in-out infinite; min-width: 88px; min-height: 112px;
}
.balloon:nth-child(2) { animation-delay: -.9s; } .balloon:nth-child(3) { animation-delay: -1.8s; } .balloon:nth-child(4) { animation-delay: -2.6s; }
.balloon svg { width: 100%; height: 100%; display: block; pointer-events: none; overflow: visible; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-9px) rotate(1.5deg); } }

.balloon.wobble { animation: wobble .6s ease-in-out 1; }
@keyframes wobble { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-7deg); } 45% { transform: rotate(6deg); } 70% { transform: rotate(-3deg); } }
.balloon.nope { filter: saturate(.55) brightness(1.05); }

.balloon.popped { animation: pop .38s ease-out forwards; pointer-events: none; }
@keyframes pop { 0% { transform: scale(1); opacity: 1; } 35% { transform: scale(1.22); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
.bits { position: absolute; left: 50%; top: 36%; width: 0; height: 0; pointer-events: none; }
.bits i { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: currentColor; animation: fly .7s ease-out forwards; }
@keyframes fly { from { transform: translate(0,0) scale(1); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; } }

.balloon.enter { animation: enter .5s ease-out 1, bob 3.6s ease-in-out .5s infinite; }
@keyframes enter { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.feedback { margin: 0; min-height: 2.6em; text-align: center; font-size: clamp(19px, 5vw, 26px); font-weight: 800; line-height: 1.25; display: grid; place-items: center; }
.feedback:not(:empty) { text-shadow: 0 2px 0 #fff; }

.foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 4px; }
.stars { display: flex; gap: 6px; background: rgba(255,253,246,.9); padding: 8px 12px; border-radius: 18px; }
.stars i { width: 28px; height: 28px; background: #d9d4c3; clip-path: polygon(50% 0, 62% 35%, 98% 36%, 69% 57%, 80% 92%, 50% 71%, 20% 92%, 31% 57%, 2% 36%, 38% 35%); }
.stars i.on { background: #ffc300; }
#stars[data-celebrate="1"] i.on { animation: twinkle .6s ease-in-out 2; }
@keyframes twinkle { 50% { transform: scale(1.35) rotate(15deg); } }

.hold-btn { position: relative; display: flex; align-items: center; gap: 8px; min-height: 60px; padding: 4px 16px 4px 8px; border-radius: 32px; border: 3px solid var(--ink); background: rgba(255,253,246,.9); touch-action: none; -webkit-touch-callout: none; }
.hold-btn .ring { width: 44px; height: 44px; transform: rotate(-90deg); flex: none; }
.ring-bg { fill: none; stroke: #d9d4c3; stroke-width: 5; }
.ring-fg { fill: none; stroke: #2f9e57; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.hold-label { display: flex; flex-direction: column; text-align: left; font-weight: 800; font-size: 15px; line-height: 1.1; }
.hold-label small { font-weight: 600; font-size: 13px; opacity: .85; }
.hold-btn[data-holding="1"] { background: #fff; }

/* grown-ups menu */
.parent { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(29,43,79,.55); padding: 16px; }
.parent-card { width: min(420px, 100%); background: var(--card); border: 4px solid var(--ink); border-radius: 26px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.parent-card h2 { margin: 0; font-size: 28px; }
.p-btn { min-height: 56px; border-radius: 16px; border: 3px solid var(--ink); background: #fff; font-size: 19px; font-weight: 700; padding: 8px 14px; }
.p-btn.primary { background: #ffd23f; }
.p-note { margin: 0; font-size: 15px; line-height: 1.4; }

/* narrow phones, short landscape phones */
@media (max-height: 700px) and (min-height: 461px) {
  :root { --size: min(34vw, 19dvh); }
  #app[data-voice="none"], #app[data-voice="error"] { --size: min(30vw, 16dvh); }
  .round-btn { width: 54px; height: 54px; }
  .prompt-bar { min-height: 54px; padding-right: 66px; }
  .prompt { font-size: clamp(20px, 6vw, 28px); }
  .feedback { min-height: 2.3em; }
}
@media (max-width: 380px) {
  .prompt { padding: 6px 10px; gap: 8px; }
  .swatch { width: 22px; height: 22px; }
  .prompt-bar { gap: 6px; }
  .stars { gap: 3px; padding: 6px 8px; }
  .stars i { width: 18px; height: 18px; }
  .hold-btn { padding-right: 12px; gap: 6px; }
  .hold-btn .ring { width: 38px; height: 38px; }
  .foot { gap: 8px; }
}
@media (max-width: 330px) {
  .hold-label small { display: none; }
}
@media (max-height: 460px) {
  :root { --size: min(20vw, 30dvh); }
  .start { flex-direction: row; flex-wrap: wrap; gap: 12px 24px; }
  .start h1 { font-size: 36px; }
  .hero { height: 90px; }
  .feedback { min-height: 1.4em; font-size: 18px; }
  .game { padding-top: 6px; gap: 2px; }
}

/* reduced motion: nothing floats, drifts, pops or wobbles; feedback stays visible as text and a still change */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .balloon.popped { opacity: 0; }
  .balloon.nope { outline: 4px dashed var(--ink); outline-offset: 6px; border-radius: 40%; }
  .bits { display: none; }
}

/* Credits stay behind the grown-ups hold and remain readable on narrow screens. */
.parent-card { max-height: calc(100dvh - 32px); overflow-y: auto; }
#credits { text-align: left; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
#credits summary { cursor: pointer; padding: 8px 0; }
#credits pre { white-space: pre-wrap; font: inherit; }
.parent-card > * { flex-shrink: 0; }
@media (max-height: 440px) {
  .parent-card { padding: 12px; gap: 6px; }
  .parent-card .p-btn { min-height: 44px; font-size: 17px; padding: 6px 12px; }
  .parent-card .p-note { font-size: 13px; }
  #credits summary { padding: 4px 0; }
}
