/* Let the cake and its candle carry the interaction. */
#wish-scene :is(a,button,[tabindex="0"]):focus-visible {
  outline: 2px solid #f1cc9f;
  outline-offset: 4px;
}
#wish-scene {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: auto;
  overscroll-behavior: contain;
  color: #faecda;
  background: radial-gradient(ellipse at 49% 36%, #694650 0%, #513649 38%, #352638 74%, #312532 100%);
  padding: max(.35rem, env(safe-area-inset-top)) max(13px, env(safe-area-inset-right))
    max(1.35rem, env(safe-area-inset-bottom)) max(13px, env(safe-area-inset-left));
}
.wish-stage {
  width: min(100%, 42rem);
  margin: auto;
  flex: none;
  text-align: center;
}
.wish-tools { display: flex; justify-content: flex-start; }
.wish-back,.wish-mic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  min-height: 44px;
  padding: .25em .6em;
  border: 0;
  background: none;
  color: #f3dece;
  text-decoration: none;
  font: 400 .875rem/1.5 system-ui, sans-serif;
}
.wish-back:hover,.wish-mic:hover { color: #fff7ed; }
.wish-back svg {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#wish-title {
  --wish-heading-size: clamp(1.75rem, 1.42rem + 1.5vw, 2.6rem);
  --wish-celebration-size: clamp(2.55rem, 1.95rem + 2.6vw, 3.7rem);
  display: grid;
  align-items: center;
  min-block-size: max(calc(var(--wish-heading-size) * 1.4), calc(var(--wish-celebration-size) * 1.16));
  margin: calc(var(--wish-heading-size) * .1) 0;
  color: inherit;
  font: 400 var(--wish-heading-size)/1.4 LetterKai, var(--serif);
  letter-spacing: .12em;
}
#wish-scene[data-lit="false"] #wish-title {
  font-size: var(--wish-celebration-size);
  line-height: 1.16;
  letter-spacing: .10em;
  padding-inline-start: .55em;
  color: #fff0dc;
}
#wish-title:focus, #wish-result:focus { outline: 0; }
.wish-portrait {
  position: relative;
  isolation: isolate;
  width: min(100%, 35rem);
  height: clamp(270px, 58svh, 515px);
  margin-inline: auto;
}
.wish-portrait::before {
  content: "";
  position: absolute;
  inset: 0 5% 3%;
  z-index: -1;
  background: radial-gradient(ellipse 42% 29% at 50% 23%, #f1b1731e, transparent 92%),
    radial-gradient(ellipse 42% 38% at 51% 59%, #d99b7122, transparent);
  opacity: 1;
  transition: opacity .82s cubic-bezier(.22,.57,.25,1);
}
#wish-scene[data-lit="false"] .wish-portrait::before { opacity: 0; }
.wish-still, #wish-model, #wish-model canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.wish-still { object-fit: contain; padding: 4.25% 8.75%; pointer-events: none; opacity: 0; }
#wish-scene[data-picture="lit"]:not([data-render="3d"]) #wish-still,
#wish-scene[data-picture="out"]:not([data-render="3d"]) #wish-still-out { opacity: 1; }
/* If the unlit file is slow, quench only the flame on the held frame. */
#wish-scene[data-lit="false"] #wish-still {
  --wick-cut: radial-gradient(ellipse 15px 23px at var(--flame-x, 50%) var(--flame-y, 15%), transparent 65%, #000 98%);
  -webkit-mask-image: var(--wick-cut);
  mask-image: var(--wick-cut);
}
#wish-model {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
}
#wish-model.is-3d { cursor: grab; opacity: 1; visibility: visible; pointer-events: auto; }
#wish-model.turning { cursor: grabbing; }
#wish-model canvas { display: block; pointer-events: none; }
.wish-salute {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.wish-flame {
  position: absolute;
  z-index: 1;
  top: var(--flame-y, 15%);
  left: var(--flame-x, 50%);
  width: 48px;
  height: 52px;
  transform: translate(-50%, -50%);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  touch-action: pan-y pinch-zoom;
  -webkit-tap-highlight-color: transparent;
}
#wish-scene .wish-flame:focus-visible {
  outline: 2px solid #ffdfb5;
  outline-offset: 1px;
}
.wish-interaction { display: flow-root; min-height: 3.2rem; }
#wish-scene[data-lit="false"] .wish-interaction {
  min-height: max(3.2rem, var(--wish-release-height, 0px));
}
.wish-hint,.wish-result {
  margin: .02rem 0 .3rem;
  color: #efded1;
  font: 400 .9rem/1.7 LetterSong, var(--serif);
}
.wish-hint { min-block-size: calc(1.7em + 1.46rem); }
.wish-turn {
  display: block;
  color: #dcc6bf;
  font-size: .86rem;
}
.wish-mic {
  text-decoration: underline;
  text-underline-offset: .26em;
  text-decoration-color: #c4a39b;
}
.wish-mic[aria-pressed="true"] { color: #fff7ed; text-decoration-color: currentColor; }
.wish-result { margin: .15rem 0 0; min-block-size: 1.7em; overflow-wrap: anywhere; }
@media (max-width: 360px) { .wish-result { min-block-size: 3.4em; } }
/* Preserve a polite announcement when focus has not moved to the new heading. */
#wish-scene[data-lit="false"] .wish-result {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  min-block-size: 0;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (prefers-reduced-motion: no-preference) {
  #wish-scene[data-swap] :is(.wish-still, #wish-model.is-3d) { transition: opacity .18s ease-out; }
  #wish-scene[data-lit="false"] #wish-title { animation: wish-ending .34s ease-out both; }
  @keyframes wish-ending { from { opacity: .55; } to { opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) {
  .wish-portrait::before { transition: none; }
}
@media (max-height: 500px) {
  .wish-portrait { height: 270px; }
}
