/* The video floating over a player's head.

   A child of the character element, so it follows walking, jumping, climbing and
   platform changes for free rather than being tracked in world space. */

.nw-tv {
  position: absolute;
  left: 50%;
  bottom: 190px;                 /* clear of the name plate and the chat bubble */
  width: 160px;
  transform: translateX(-50%) scale(.85);
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms cubic-bezier(.2, .9, .3, 1.2);
  pointer-events: auto;
  z-index: 30;                   /* above the character and its name */
}
.nw-tv.is-in { opacity: 1; transform: translateX(-50%) scale(1); }
/* Leaving is quicker than arriving — a screen lingering after someone turns it
   off reads as a bug. */
.nw-tv.is-out { opacity: 0; transition-duration: 150ms; }

.nw-screen {
  position: relative;
  width: 160px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #05070d;
  border: 1px solid rgba(125, 211, 252, .45);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .55), 0 0 18px rgba(56, 189, 248, .28);
  cursor: pointer;
}
.nw-thumb,
.nw-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* The thumbnail is the floor: it shows through whenever the video is not
   decoding, so a budgeted-out screen still answers "what are they watching". */
.nw-video { opacity: 1; transition: opacity 160ms ease; }
.nw-tv.is-thumb .nw-video { opacity: 0; }
.nw-tv.is-missing .nw-screen { border-color: rgba(255, 255, 255, .18); }

/* Hover: subtle, and only for other people's screens. */
.nw-hint,
.nw-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 6px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .82));
  color: #eef2ff;
  font: 700 9px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  opacity: 0;
  transition: opacity 140ms ease;
  pointer-events: none;
}
.nw-tv:hover .nw-hint { opacity: 1; }
/* Once it has sound, the bar replaces the hint permanently. */
.nw-tv.is-active .nw-hint { opacity: 0 !important; }
.nw-tv.is-active .nw-bar { opacity: 1; pointer-events: auto; }
.nw-tv.is-active .nw-screen { border-color: rgba(74, 222, 128, .75); box-shadow: 0 10px 26px rgba(0,0,0,.55), 0 0 20px rgba(74, 222, 128, .4); }

/* Your own screen is never interactive: you already hear it from your own
   player, and there is nothing to discover about your own video. */
.nw-tv.is-self .nw-screen { cursor: default; }
.nw-tv.is-self .nw-hint,
.nw-tv.is-self .nw-bar { display: none; }

.nw-speaker { font-size: 10px; line-height: 1; }
.nw-open {
  border: 0;
  border-radius: 5px;
  padding: 3px 7px;
  background: linear-gradient(180deg, #38bdf8, #0284c7);
  color: #fff;
  font: 800 9px/1 system-ui, sans-serif;
  cursor: pointer;
  pointer-events: auto;
}
.nw-open:hover { filter: brightness(1.15); }

/* Title and creator, shown on hover only — the screen stays clean otherwise. */
.nw-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  margin-top: 3px;
  max-width: 160px;
  opacity: 0;
  transition: opacity 140ms ease;
  pointer-events: none;
  text-align: center;
}
.nw-tv:hover .nw-meta,
.nw-tv.is-active .nw-meta { opacity: 1; }
.nw-title,
.nw-creator {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .9);
}
.nw-title { color: #fff; font: 800 10px/1.2 system-ui, sans-serif; }
.nw-creator { color: #9fb6c9; font: 600 9px/1.2 system-ui, sans-serif; }

@media (max-width: 720px) {
  /* Smaller and tighter on a phone, where the character is a bigger share of the
     screen and a 160px screen would swallow the fight. */
  .nw-tv, .nw-screen, .nw-meta, .nw-title, .nw-creator { width: 112px; max-width: 112px; }
  .nw-tv { bottom: 160px; }
}

/* The speaker is a real toggle, not just an indicator: muting must not depend on
   knowing the screen itself is clickable. Once a screen has been interacted with
   the bar stays up so the toggle stays reachable. */
.nw-tv.is-touched .nw-hint { opacity: 0 !important; }
.nw-tv.is-touched .nw-bar { opacity: 1; pointer-events: auto; }
.nw-speaker {
  border: 0;
  border-radius: 5px;
  padding: 3px 5px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}
.nw-speaker:hover { background: rgba(255, 255, 255, .26); }
