:root {
  --ink: #26306a;
  --ink-soft: #8a91b8;
  --bg: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  cursor: none;
  font-family: 'Nunito', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Fixed 1080x1920 canvas, scaled to fit whatever screen it runs on. */
#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1080px;
  height: 1920px;
  transform-origin: 0 0;
  overflow: hidden;
  /* Robot artwork (941x1672, same 9:16 ratio) is the whole backdrop; bubbles sit on top. */
  /* Shifted down 80px so the robot sits lower; the white page colour fills the gap at the top. */
  background: #fff url(/display/background.png) 50% 80px / 1080px 1920px no-repeat;
}

#ribbon { position: absolute; inset: 0; width: 100%; height: 100%; }
#decor { position: absolute; inset: 0; pointer-events: none; }
#wishes { position: absolute; inset: 0; }

/* ---------- decorative orbs & blurred far-away bubbles ---------- */
.orb {
  position: absolute;
  will-change: transform;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,.95) 0 12%, rgba(255,255,255,0) 30%),
    radial-gradient(circle at 70% 75%, rgba(255,255,255,.6), rgba(255,255,255,0) 40%),
    radial-gradient(circle at 50% 50%, var(--o1, #b7d3ff) 0%, var(--o2, #c9b6ff) 100%);
  box-shadow: inset -6px -8px 16px rgba(110,120,255,.25), 0 10px 24px rgba(120,130,220,.25);
  opacity: .9;
  animation: drift var(--dur, 9s) ease-in-out infinite alternate;
  animation-delay: var(--delay, 0s);
}
@keyframes drift {
  from { transform: translate(0, 0); }
  to { transform: translate(var(--dx, 10px), var(--dy, -24px)); }
}

.far {
  position: absolute;
  will-change: transform;
  border-radius: 34px;
  background: linear-gradient(135deg, rgba(200,205,255,.7), rgba(190,225,255,.45));
  filter: blur(14px);
  opacity: .55;
  animation: drift var(--dur, 12s) ease-in-out infinite alternate;
}

/* ---------- wish bubbles ---------- */
.wish {
  --x: 540; --y: 1100; --r: 0deg; --s: 1;
  position: absolute;
  left: 0;
  top: 0;
  width: 360px;
  transform: translate(calc(var(--x) * 1px - 50%), calc(var(--y) * 1px - 50%)) rotate(var(--r)) scale(var(--s));
  transition:
    transform 1.6s cubic-bezier(.22, 1, .36, 1),
    opacity .9s ease;
  will-change: transform;
}
.wish.leaving { transition: transform 1.6s cubic-bezier(.5, 0, .3, 1), opacity 1.2s ease .2s; opacity: 0; }
.wish.removing { transition: transform .5s ease, opacity .5s ease; opacity: 0; }

.wish-float {
  will-change: transform;
  animation: bob var(--bob, 6s) ease-in-out infinite alternate;
  animation-delay: var(--bob-delay, 0s);
}
@keyframes bob {
  from { transform: translate3d(0, -7px, 0) rotate(-.6deg); }
  to { transform: translate3d(0, 7px, 0) rotate(.6deg); }
}

.wish-card {
  --rim: #8fb8ff; --rim2: #c7a8ff; --av1: #6aa8ff; --av2: #3d6bf0; --tint: rgba(170,200,255,.30);
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 160px;
  padding: 26px 26px 24px 22px;
  border-radius: 44px;
  background:
    linear-gradient(160deg, rgba(255,255,255,.85) 0%, rgba(255,255,255,.35) 45%, var(--tint) 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,.9),
    inset 0 10px 18px rgba(255,255,255,.95),
    inset 0 -14px 26px color-mix(in srgb, var(--rim) 45%, transparent),
    inset 10px 0 22px color-mix(in srgb, var(--rim2) 30%, transparent),
    inset -10px 0 22px color-mix(in srgb, var(--rim) 30%, transparent),
    0 0 0 5px color-mix(in srgb, var(--rim) 22%, transparent),
    0 28px 50px -16px color-mix(in srgb, var(--rim) 70%, transparent),
    0 8px 18px rgba(80, 90, 170, .10);
}
/* iridescent rim */
.wish-card::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 47px;
  padding: 4px;
  background: linear-gradient(130deg, #ffffff 0%, var(--rim) 30%, var(--rim2) 55%, #ffffff 75%, var(--rim) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: .9;
  pointer-events: none;
}
/* glossy sheen */
.wish-card::after {
  content: '';
  position: absolute;
  left: 34px;
  right: 60px;
  top: 9px;
  height: 22px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,0));
  pointer-events: none;
}

.wish-card.t1 { --rim: #b8a1ff; --rim2: #8fd0ff; --av1: #b996ff; --av2: #7c5cf0; --tint: rgba(205,185,255,.35); }
.wish-card.t2 { --rim: #84dfc0; --rim2: #9cc8ff; --av1: #6fe0b5; --av2: #2fae86; --tint: rgba(175,240,215,.35); }
.wish-card.t3 { --rim: #ffa5cd; --rim2: #c8a6ff; --av1: #ff9cc2; --av2: #ec5f96; --tint: rgba(255,195,225,.35); }
.wish-card.t4 { --rim: #ffc396; --rim2: #ffb0c8; --av1: #f6b07c; --av2: #d97a4a; --tint: rgba(255,220,190,.40); }

.avatar {
  flex: none;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, var(--av1), var(--av2));
  box-shadow: inset 0 3px 6px rgba(255,255,255,.5), inset 0 -6px 10px rgba(0,0,0,.12), 0 8px 18px color-mix(in srgb, var(--av2) 40%, transparent);
}
.avatar svg { width: 42px; height: 42px; }

.wish-text { min-width: 0; flex: 1; }
.msg {
  color: var(--ink);
  font-weight: 700;
  font-size: 31px; /* fitText() in display.js shrinks this when a wish needs more than 3 lines */
  line-height: 1.22;
  overflow-wrap: anywhere;
}
.meta {
  margin-top: 8px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 21px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wish.hint .wish-card { min-height: 130px; }
.wish.hint .msg { font-size: 28px; }

/* sparkle burst when a bubble pops */
.spark {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--c, #b9c8ff));
  box-shadow: 0 0 12px var(--c, #b9c8ff);
  animation: spark 1.1s ease-out forwards;
}
@keyframes spark {
  from { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.2); opacity: 0; }
}

/* splash when a new bubble lands */
.splash-dot {
  position: absolute;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff 0 18%, var(--c) 70%);
  box-shadow: 0 0 calc(var(--size) * .8) var(--c);
  pointer-events: none;
  animation: splash var(--dur) cubic-bezier(.15, .7, .3, 1) forwards;
}
@keyframes splash {
  0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.15); opacity: 0; }
}
.splash-star {
  position: absolute;
  width: var(--size);
  height: var(--size);
  background: #fff;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  filter: drop-shadow(0 0 6px var(--c));
  pointer-events: none;
  animation: splash var(--dur) cubic-bezier(.15, .7, .3, 1) forwards;
}
.splash-ring {
  position: absolute;
  width: 400px;
  height: 180px;
  border-radius: 60px;
  border: 4px solid var(--c);
  box-shadow: 0 0 24px var(--c), inset 0 0 18px var(--c);
  pointer-events: none;
  animation: ring .8s ease-out forwards;
}
@keyframes ring {
  from { transform: translate(-50%, -50%) rotate(var(--r)) scale(.9); opacity: .9; }
  to { transform: translate(-50%, -50%) rotate(var(--r)) scale(1.35); opacity: 0; }
}

/* ---------- QR card ---------- */
.qr-card {
  position: absolute;
  left: 36px;
  bottom: 30px;
}
.qr-box {
  width: 212px;
  height: 212px;
}
.qr-box img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.qr-caption {
  margin-top: 12px;
  color: #2b3157;
  font-weight: 800;
  font-size: 36px;
  line-height: 1.12;
}
.qr-arrow {
  position: absolute;
  left: 224px;
  top: 120px;
  width: 80px;
  height: 94px;
}

.status {
  position: absolute;
  top: 24px;
  right: 24px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.8);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 20px;
}
