/* Live 'Em — who's playing (identity/watcher.js): the life-light on your own avatar, and the Watcher's voice. */

/* the light: Round 1's ball (game.js drawBall) as an 8 px dot, its core, its warm rings and its soft glow */
.liveem-light {
  --lx: 0px;
  --ly: 0px;
  position: absolute;
  z-index: 2;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgb(255, 250, 232) 0 30%,
    rgb(255, 240, 200) 48%,
    rgb(255, 205, 135) 70%,
    rgba(255, 205, 135, 0) 100%
  );
  box-shadow: 0 0 6px 2px rgba(255, 226, 170, 0.55);
  pointer-events: none;
  translate: var(--lx) var(--ly);
  animation: liveem-pulse 0.45s ease-in-out infinite alternate; /* the ball's 1 + 0.06·sin(7t): out and back in 0.9 s */
  transition:
    opacity 0.15s ease-out,
    translate 0.15s ease-out;
}
@keyframes liveem-pulse {
  to {
    scale: 1.06;
  }
}
/* (no weight: a host that is already positioned, like Round 3's absolute name chip, stays as it is) */
:where(.liveem-light-host) {
  position: relative;
}
/* pinned to a chip's top-right corner, so the name's ellipsis never clips it */
.liveem-light--tr {
  top: -3px;
  right: -3px;
}
/* on a round portrait's rim at 1 o'clock */
.liveem-light--rim {
  left: 75%;
  top: 6.7%;
  --lx: -50%;
  --ly: -50%;
}
/* on a square portrait's top edge at 1 o'clock */
.liveem-light--edge {
  left: 79%;
  top: 0;
  --lx: -50%;
  --ly: -50%;
}
/* inside a chip's right end, just after the name (the chip keeps room for it) */
.liveem-light--end {
  right: 8px;
  top: 50%;
  --ly: -50%;
}
.liveem-light-host--end {
  padding-right: 24px;
}
.liveem-light--after,
.liveem-light--before,
.liveem-light--above {
  position: relative;
  display: inline-block;
  vertical-align: 0.12em;
}
.liveem-light--after {
  margin-left: 7px;
}
.liveem-light--before {
  margin-right: 8px;
}
.liveem-light--above {
  display: block;
  margin: 2px auto 10px;
}
/* a round portrait with the light on its rim: the ring the dot sits on */
.liveem-ring {
  position: relative;
  display: block;
  flex: none;
  line-height: 0;
}
/* life moves the body without you: the light lifts 6 px and dims, then settles back in 150 ms */
.liveem-light.is-away {
  opacity: 0.45;
  translate: var(--lx) calc(var(--ly) - 6px);
}
/* paused: the light on the HUD dims (the one on the pause sheet stays lit) */
.liveem-light.is-held {
  opacity: 0.45;
}
/* the summit: the light rises off the portrait and fades above the HUD */
.liveem-light.is-leaving {
  animation: liveem-leave 1.5s ease-in forwards;
}
@keyframes liveem-leave {
  to {
    translate: var(--lx) calc(var(--ly) - 64px);
    opacity: 0;
  }
}

/* the Watcher's voice: one line of italic serif with a dark halo instead of a box, no sound, never in the way */
.watcher-line {
  position: fixed;
  z-index: 60;
  margin: 0;
  width: max-content;
  max-width: min(88vw, 30em);
  translate: -50% 0;
  font:
    italic 400 clamp(15px, 2.2vh, 20px) / 1.35 Georgia,
    "Iowan Old Style",
    serif;
  color: #fff3d6;
  text-align: center;
  text-wrap: balance;
  text-shadow:
    0 0 14px rgba(0, 0, 0, 0.85),
    0 1px 2px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.watcher-line.is-on {
  opacity: 1;
}
.watcher-sentence {
  position: relative;
  z-index: 0;
  display: inline-block;
}
/* under each sentence, a dark copy stroked 2 px round the letters: on Round 2's brightest sand the halo alone left
   1.5:1 at the letter edges; with it the brightest pixel within 1 px of a letter measures over 4.5:1 */
.watcher-sentence::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: -1;
  color: transparent;
  -webkit-text-stroke: 4px rgba(0, 0, 0, 0.8);
}
.watcher-line.is-held {
  visibility: hidden;
}
/* the same voice, still (the name step's hint, the reveal) */
.watcher-voice {
  font:
    italic 400 15px / 1.45 Georgia,
    "Iowan Old Style",
    serif;
  color: #fff3d6;
  text-shadow:
    0 0 14px rgba(0, 0, 0, 0.85),
    0 1px 2px rgba(0, 0, 0, 0.9);
}
.liveem-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (prefers-reduced-motion: reduce) {
  /* no pulse and no lift: the light only dims; lines show and hide at once */
  .liveem-light {
    animation: none;
    transition: opacity 0.15s ease-out;
  }
  .liveem-light.is-away {
    translate: var(--lx) var(--ly);
  }
  .liveem-light.is-leaving {
    animation: liveem-fade 1.5s ease-in forwards;
  }
  .watcher-line {
    transition: none;
  }
}
@keyframes liveem-fade {
  to {
    opacity: 0;
  }
}
