/* 7 Nov 2026 — name & object balloons (trial), see balloons.js.
   Layering: in front of the stage backdrop and behind everything on the stage (z 1 and up):
   the cake, the sentence, every button and the team bar. They rise from under the bottom
   buttons, inside the team bar's column, and stop under the bar. */
.balloon-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.name-balloon {
  position: absolute;
  transform: translateY(var(--rise));
  animation: balloon-rise var(--rise-dur, 8s) cubic-bezier(.3, .05, .35, 1) var(--delay, 0s) both;
  transition: width .5s ease, height .5s ease;
  will-change: transform, opacity;
}
.name-balloon .balloon-sway {
  width: 100%; height: 100%; transform-origin: 50% 0;
  /* the sway runs from the moment the balloon exists (it is still below the screen then), so
     there is no jump when it reaches the bar — rising, bumping and swaying are one motion */
  animation: balloon-sway var(--sway-dur, 3.4s) ease-in-out var(--sway-delay, 0s) infinite alternate;
}
/* faces always stay in front: a person's balloon is never covered by an object or a channel;
   among the others, the newer one floats over the older one */
.name-balloon.person { z-index: var(--z, 60); }
.name-balloon:not(.person) { z-index: var(--z, 20); }
.name-balloon img {
  position: absolute; left: 0; top: 0;
  display: block; width: 100%; height: 100%; object-fit: contain; object-position: top center;
  max-width: none; user-select: none; -webkit-user-drag: none;
  filter: drop-shadow(0 6px 8px rgba(110, 60, 10, .25));
}
/* a bunch: the copies lean apart from their tied strings and bob a little out of step */
.name-balloon.bunch img {
  transform-origin: 50% 100%; transform: rotate(var(--tilt, 0deg));
  animation: bunch-bob 2.8s ease-in-out var(--bob, 0s) infinite alternate;
}
@keyframes bunch-bob {
  from { transform: rotate(var(--tilt, 0deg)) translateY(0); }
  to   { transform: rotate(calc(var(--tilt, 0deg) * 1.25)) translateY(-3%); }
}
/* straight up at a steady helium pace, slowing near the top, a small bump against the bar, settled */
@keyframes balloon-rise {
  0%   { transform: translateY(var(--rise)); }
  82%  { transform: translateY(-5px); animation-timing-function: cubic-bezier(.45, 0, .55, 1); }
  91%  { transform: translateY(3px); animation-timing-function: cubic-bezier(.45, 0, .55, 1); }
  100% { transform: translateY(0); }
}
@keyframes balloon-sway {
  from { transform: rotate(-3deg); }
  to   { transform: rotate(3deg); }
}
/* a balloon that was dragged stays exactly where it was let go */
.name-balloon.moved { animation: none; transform: none; transition: none; }
/* let go: it drifts back up under the bar, slowing as it arrives */
.name-balloon.moved.floating { transition: top var(--float-dur, 2s) cubic-bezier(.3, .15, .25, 1); }
/* a tapped balloon is selected: a soft golden ring, and − / + under it */
.name-balloon.selected img { filter: drop-shadow(0 0 6px #ffd76a) drop-shadow(0 0 14px rgba(255, 200, 80, .9)); }
.balloon-tools { position: fixed; z-index: 60; display: flex; gap: 10px; padding: 6px; border-radius: 999px;
  background: rgba(60, 30, 10, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.balloon-tools button { width: 44px; height: 44px; border-radius: 50%; border: 2px solid #f2c94c; background: #fff6e4;
  color: #6b3b0e; font: 800 26px/1 system-ui, sans-serif; display: grid; place-items: center; cursor: pointer; touch-action: manipulation; }
.balloon-tools button:active { transform: scale(.92); }
.name-balloon.dragging { z-index: 301; cursor: grabbing; }
/* a chosen balloon comes to the front, even over a face */
.name-balloon.selected, .name-balloon.front { z-index: 300; }
.name-balloon.dragging .balloon-sway { animation-play-state: paused; }
/* question / right / wrong / penalty / victory: they fly up off the top of the screen */
.name-balloon.is-leaving { animation: balloon-away 1.05s cubic-bezier(.45, 0, .7, .35) var(--leave-delay, 0s) both; /* 14 Nov 2026: faster, so they are gone before the question */ /* 'both': it holds its place during the stagger delay instead of dropping back below the screen */ }
@keyframes balloon-away {
  0%   { transform: translateY(var(--from, 0px)); }
  12%  { transform: translateY(calc(var(--from, 0px) + 6px)); }
  100% { transform: translateY(var(--away, -120vh)); }
}
@media (prefers-reduced-motion: reduce) {
  .name-balloon { transform: none; animation: balloon-fade-in .6s ease var(--delay, 0s) both; }
  .name-balloon .balloon-sway, .name-balloon.bunch img { animation: none; }
  .name-balloon.is-leaving { animation: none; opacity: 0; transition: opacity .6s ease; }
  @keyframes balloon-fade-in { from { opacity: 0; } to { opacity: 1; } }
}
/* the question (and the sentence) are written over the balloons: a soft cream halo keeps every letter readable */
body.balloons-up .question-box,
body.balloons-up .sentence,
body.balloons-up .voice-instruction {
  text-shadow: 0 0 2px #fff6e4, 0 0 6px #fff6e4, 0 0 12px rgba(255, 246, 228, .95), 0 0 22px rgba(255, 246, 228, .8);
}
/* 8 Nov 2026: no − / + buttons on a balloon any more (a tapped balloon still glows, comes to the front and can be dragged) */
.balloon-tools { display: none !important; }

/* 10 Nov 2026: while a balloon is held its value's name shows on it */
.name-balloon .balloon-label { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(.6); opacity: 0; pointer-events: none; white-space: nowrap;
  background: #fffaf0; color: #3a1d24; border: 3px solid #d9a35c; border-radius: 999px; padding: 6px 16px; font: 900 clamp(18px, 3.2vw, 30px)/1.1 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .35); transition: opacity .15s ease, transform .2s cubic-bezier(.2, 1.6, .4, 1); z-index: 3; }
.name-balloon.telling .balloon-label { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.name-balloon.is-leaving.go-back { z-index: 1 !important; }
/* 13 Nov 2026: a silhouette (a person with no balloon of their own) always shows the name */
.name-balloon.sil .sil-name { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); z-index: 2; max-width: 96%; padding: .12em .5em .16em; border-radius: 999px;
  background: rgba(255, 248, 228, .94); color: #5a2410; font-weight: 900; font-size: clamp(14px, 3.4vw, 22px); line-height: 1.1; text-align: center; white-space: nowrap; box-shadow: 0 2px 8px rgba(60, 30, 0, .3); pointer-events: none; }
.name-balloon.sil.telling .balloon-label { opacity: 0; }

/* 16 Nov 2026: the pillow balloon shows no label; its pillows fall onto the cake */
.name-balloon[data-balloon="pillow"] .balloon-label, .name-balloon[data-balloon="pillow"] .sil-name { display: none !important; }
.pillow-rain { position: fixed; inset: 0; pointer-events: none; z-index: 2147482000; }
.pillow-rain img { position: absolute; height: auto; filter: drop-shadow(0 4px 6px rgba(0,0,0,.28)); will-change: transform; }

.pillow-tint { position: fixed; inset: 0; pointer-events: none; z-index: 2147481999; opacity: 0; mix-blend-mode: screen; }
/* 17 Nov 2026 (user): pillow balloons rising in front of the cake with the music */
.pillow-ups { position: fixed; inset: 0; pointer-events: none; z-index: 2147482001; overflow: hidden; }
.pillow-ups img { position: absolute; height: auto; filter: drop-shadow(0 10px 14px rgba(0,0,0,.3)); will-change: transform; }
/* 18 Nov 2026 (user): the pillow party — lights join with the music */
.pillow-lights { position: fixed; inset: 0; pointer-events: none; z-index: 2147482000; overflow: hidden; mix-blend-mode: screen; }
.pillow-lights .pl-beam { position: absolute; bottom: -6vh; width: 18vmax; height: 140vh; margin-left: -9vmax; transform-origin: 50% 100%; opacity: 0;
  background: linear-gradient(to top, color-mix(in srgb, var(--c) 95%, transparent) 0%, color-mix(in srgb, var(--c) 50%, transparent) 45%, transparent 85%);
  clip-path: polygon(44% 100%, 56% 100%, 100% 0, 0 0); filter: blur(5px); }
.pillow-lights .pl-dot { position: absolute; width: 24vmin; height: 24vmin; margin: -12vmin; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 70%, transparent) 0%, transparent 65%); }
.pillow-ups img.pu-heart { filter: drop-shadow(0 8px 12px rgba(0,0,0,.28)); }
.pillow-dim { position: fixed; inset: 0; pointer-events: none; z-index: 2147481998; opacity: 0; background: radial-gradient(ellipse at 50% 55%, rgba(30, 12, 45, .22), rgba(20, 8, 35, .5)); }
