/* A small hand-cut paper charm belongs to the scene and never intercepts a hit. */
#receive .opening-hint-row {
  --hint-ink: #473029;
  --hint-spark: #ffe4a0;
  --hint-rest: -1deg;
  --hint-turn: -9deg;
  --hint-tilt: 2deg;
  --hint-rise: 19px;
  --hint-overshoot: 1.065;
  position: absolute;
  z-index: 8;
  bottom: 16px;
  left: 17px;
  right: 17px;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

#receive .opening-hint-cue {
  position: relative;
  width: max-content;
  max-width: min(100%, 370px);
  transform: rotate(var(--hint-rest));
  transform-origin: 50% 78%;
  opacity: 1;
  transition: opacity .2s ease;
}

#receive .opening-hint-row[data-state="waiting"] .opening-hint-cue {
  opacity: .94;
  transform: rotate(var(--hint-rest)) scale(.96);
}
#receive .opening-hint-row[data-state="resting"] .opening-hint-cue { opacity: 0; }

#receive .opening-hint {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 39px;
  padding: 11px 26px 12px;
  margin: 0;
  color: var(--hint-ink);
  font: 400 clamp(14px, 4.1vw, 17px)/1.25 var(--ui-display, Georgia, serif);
  letter-spacing: -.012em;
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 1px #fff2d473;
  filter: drop-shadow(0 2px 1px #291c1a45) drop-shadow(0 6px 8px #08091353);
}

/* Painted paper ends stay undistorted while the quiet centre grows with the text. */
#receive .opening-hint::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: -2px -3px;
  border: 13px solid transparent;
  border-image-source: var(--painted-vellum);
  border-image-slice: 30% 14% fill;
  border-image-width: 13px 28px;
  filter: brightness(var(--painted-light, 1)) saturate(var(--painted-colour, 1));
  opacity: 1;
  pointer-events: none;
}

#receive .opening-hint-sparks { position: absolute; inset: 0; z-index: -1; }
#receive .opening-hint-sparks i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  opacity: 0;
  background: var(--hint-spark);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  filter: drop-shadow(0 0 3px var(--hint-spark));
}
#receive .opening-hint-sparks i:nth-child(1) { --spark-x: -137px; --spark-y: -21px; --spark-r: -20deg; }
#receive .opening-hint-sparks i:nth-child(2) { --spark-x: -97px; --spark-y: -45px; --spark-r: 32deg; width: 4px; height: 7px; }
#receive .opening-hint-sparks i:nth-child(3) { --spark-x: -38px; --spark-y: -58px; --spark-r: -44deg; width: 4px; height: 4px; }
#receive .opening-hint-sparks i:nth-child(4) { --spark-x: 56px; --spark-y: -54px; --spark-r: 28deg; width: 4px; height: 4px; }
#receive .opening-hint-sparks i:nth-child(5) { --spark-x: 108px; --spark-y: -38px; --spark-r: -35deg; width: 3px; height: 8px; }
#receive .opening-hint-sparks i:nth-child(6) { --spark-x: 137px; --spark-y: -13px; --spark-r: 41deg; }

#receive .has-opening-hints:not(.opening-flat) .turn-hint { visibility: hidden; }
#receive :is(.opening-final, .opening-revealed) .opening-hint-row { visibility: hidden; }

/* Ink and glints pick up the light of each world. */
body[data-theme="arctic"] #receive .opening-hint-row {
  --hint-ink: #314b55;
  --hint-spark: #c8f5f5;
  --hint-turn: 6deg;
  --hint-tilt: -1deg;
  --hint-rise: 25px;
  --hint-overshoot: 1.04;
}
body[data-theme="candy"] #receive .opening-hint-row {
  --hint-ink: #694447;
  --hint-spark: #ffe0ce;
  --hint-turn: -12deg;
  --hint-tilt: 3deg;
  --hint-rise: 17px;
  --hint-overshoot: 1.09;
}
body[data-theme="midnight"] #receive .opening-hint-row {
  --hint-ink: #51402f;
  --hint-spark: #f6d49a;
  --hint-turn: -4deg;
  --hint-tilt: 1deg;
  --hint-rise: 13px;
  --hint-overshoot: 1.035;
}
body[data-theme="workshop"] #receive .opening-hint-row {
  --hint-ink: #3c4b3d;
  --hint-spark: #ffe0a8;
  --hint-turn: 10deg;
  --hint-tilt: -2deg;
  --hint-rise: 18px;
  --hint-overshoot: 1.075;
}
body[data-theme="gingerbread"] #receive .opening-hint-row {
  --hint-ink: #67432d;
  --hint-spark: #ffe0b2;
  --hint-turn: -8deg;
  --hint-tilt: 2deg;
  --hint-rise: 17px;
  --hint-overshoot: 1.065;
}
body[data-theme="neon"] #receive .opening-hint-row {
  --hint-ink: #4d405c;
  --hint-spark: #c0f3e8;
  --hint-turn: -5deg;
  --hint-tilt: 1deg;
  --hint-rise: 10px;
  --hint-overshoot: 1.08;
}
body[data-theme="newyear"] #receive .opening-hint-row {
  --hint-ink: #574538;
  --hint-spark: #efd6ad;
  --hint-turn: 10deg;
  --hint-tilt: -2deg;
  --hint-rise: 23px;
  --hint-overshoot: 1.08;
}

@media (max-width: 360px) {
  #receive .opening-hint-row { left: 16px; right: 16px; bottom: 13px; }
  #receive .opening-hint { min-height: 36px; padding: 10px 23px 11px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  #receive .opening-hint-cue { transition: none; }
  #receive .opening-hint-sparks { display: none; }
}
