/* ==========================================================================
   Time Pass — social.css
   The live radar's people-dots, the player action sheet, the friends list
   and the chat drawer. Paired with js/social.js.

   The radar shell itself (rings, sweep, the layered 3D parallax) already
   lives in css/signal.css — this file only adds the parts that represent
   actual human beings on it, so the two can't fight over the same rules.
   ========================================================================== */

/* ---- People on the radar -------------------------------------------------- */

.radar-person {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  /* Above the sweep, so a person is never hidden behind the animation
     that's supposed to be revealing them. */
  z-index: 3;
}

.radar-person-dot {
  position: relative;
  display: block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  /* The yellow-green the brief asked for: the site's volt token, which is
     already the "you, live, right now" colour everywhere else. */
  background: #CCFF33;
  box-shadow: 0 0 12px 3px rgba(204, 255, 51, 0.65);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* The expanding ring. It's on ::after so the dot itself stays a stable,
   easy-to-hit target while the halo does the moving. */
.radar-person-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(204, 255, 51, 0.55);
  animation: radarPersonPing 2.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes radarPersonPing {
  0% { transform: scale(0.7); opacity: 0.85; }
  80%, 100% { transform: scale(2.4); opacity: 0; }
}

.radar-person:hover .radar-person-dot,
.radar-person:focus-visible .radar-person-dot {
  transform: scale(1.35);
  box-shadow: 0 0 18px 5px rgba(204, 255, 51, 0.85);
}

/* Friends read cyan instead of green, so you can pick the people you
   actually know out of a crowded board at a glance. */
.radar-person.is-friend .radar-person-dot {
  background: #2EC5FF;
  box-shadow: 0 0 12px 3px rgba(46, 197, 255, 0.65);
}
.radar-person.is-friend .radar-person-dot::after { border-color: rgba(46, 197, 255, 0.55); }

.radar-person-name {
  max-width: 74px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.52rem;
  letter-spacing: 0.02em;
  color: rgba(245, 246, 240, 0.6);
  opacity: 0;
  transform: translateY(-2px);
  transition: all 0.25s ease;
  pointer-events: none;
}

.radar-person:hover .radar-person-name,
.radar-person:focus-visible .radar-person-name {
  opacity: 1;
  transform: translateY(0);
  color: rgba(245, 246, 240, 0.95);
}

/* On touch there is no hover, so names are simply always on — a radar of
   unlabelled dots you can't hover is a guessing game. */
@media (pointer: coarse) {
  .radar-person-name { opacity: 1; transform: none; }
}

#radarNote {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  text-align: center;
  font-size: 0.66rem;
  line-height: 1.5;
  color: rgba(245, 246, 240, 0.35);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .radar-person-dot::after { animation: none; opacity: 0.5; }
}

/* ---- Player action sheet -------------------------------------------------- */

.ps-head { display: flex; align-items: center; gap: 0.9rem; }

.ps-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  /* The wrapper is only a box now — the face inside carries the shape and
     its own colour, so a wrapper border/background would double-draw it. */
  background: none;
  border: 0;
  padding: 0;
  line-height: 0;
}

.ps-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 30px;
  min-height: 30px;
  background: rgba(204, 255, 51, 0.12);
  color: #E8FFA6;
  font-family: 'Rajdhani', ui-sans-serif, sans-serif;
  font-weight: 700;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
}
/* ---- Faces --------------------------------------------------------------- */

/* Not circles.
   The site's entire visual language is the cut corner — the nav dock, every
   game tile, every badge, the hud-clip helpers in signal.css. A round avatar
   dropped into that reads as pasted in from another product. Same clip path
   as hud-clip-sm, so a face sits in the grammar everything else already uses.

   The clip is on .tp-avatar itself (the <img> or <svg> avatars.js emits), so
   it applies wherever a face appears without every call site remembering. */
.tp-avatar {
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  border-radius: 0 !important;
  flex-shrink: 0;
}

/* The "no picture yet" state. avatars.js emits a bare <span> with an SVG in
   it; without these it is an inline box with no size, so the width/height it
   is given is ignored and the glyph renders wherever the text baseline
   happens to be — which read as a missing avatar rather than an empty one. */
.tp-avatar-empty {
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(233,238,245,0.45);
  box-sizing: border-box;
}

/* Bigger faces get a proportionally bigger cut, or the corner disappears. */
.ps-avatar .tp-avatar {
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
}


.ps-actions { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 1.5rem; }

.ps-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  border-radius: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(245, 246, 240, 0.85);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.7rem 1rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.ps-action:hover { border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.08); }

.ps-action.ps-primary {
  border-color: rgba(204, 255, 51, 0.5);
  background: rgba(204, 255, 51, 0.14);
  color: #E8FFA6;
}
.ps-action.ps-primary:hover { background: rgba(204, 255, 51, 0.22); }

.ps-action.ps-danger { border-color: rgba(255, 122, 84, 0.3); color: #FFC9B8; }
.ps-action.ps-danger:hover { background: rgba(255, 77, 46, 0.12); border-color: rgba(255, 122, 84, 0.55); }

/* ---- Friends list --------------------------------------------------------- */

.fr-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.4rem 0.15rem;
  border: 0;
  background: none;
  text-align: left;
  color: inherit;
}

.fr-click { cursor: pointer; border-radius: 0.45rem; transition: background 0.2s ease; }
.fr-click:hover { background: rgba(255, 255, 255, 0.04); }

.fr-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  color: rgba(245, 246, 240, 0.8);
}

.fr-online {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #CCFF33;
  box-shadow: 0 0 8px 2px rgba(204, 255, 51, 0.6);
}

.fr-badge {
  flex-shrink: 0;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9999px;
  background: #FF4D2E;
  color: #fff;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.fr-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(245, 246, 240, 0.6);
  cursor: pointer;
  transition: all 0.25s ease;
}

.fr-mini:hover { color: #F5F6F0; border-color: rgba(255, 255, 255, 0.35); }

.fr-mini.fr-yes {
  border-color: rgba(204, 255, 51, 0.45);
  background: rgba(204, 255, 51, 0.12);
  color: #CCFF33;
}
.fr-mini.fr-yes:hover { background: rgba(204, 255, 51, 0.22); }

/* ---- Chat drawer ---------------------------------------------------------- */

.chat-drawer {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: min(22rem, calc(100vw - 2.5rem));
  height: min(28rem, calc(100vh - 6rem));
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #1A1C26;
  box-shadow: 0 30px 60px -25px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  animation: chatIn 0.3s cubic-bezier(0.22, 0.9, 0.32, 1) both;
}

@keyframes chatIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

/* On a phone the drawer is the screen — a 22rem floating panel over a
   375px viewport is just a cramped modal with wasted edges. */
@media (max-width: 480px) {
  .chat-drawer {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 85vh;
    border-radius: 1rem 1rem 0 0;
  }
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.chat-name {
  font-family: 'Rajdhani', ui-sans-serif, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #F5F6F0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-sub {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.62rem;
  color: rgba(245, 246, 240, 0.35);
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.chat-msg { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; max-width: 85%; }
.chat-msg.is-mine { align-self: flex-end; align-items: flex-end; }

.chat-bubble {
  padding: 0.5rem 0.75rem;
  border-radius: 0.9rem 0.9rem 0.9rem 0.2rem;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(245, 246, 240, 0.88);
  font-size: 0.82rem;
  line-height: 1.5;
  /* User text: a pasted URL or a long unbroken string must wrap rather
     than stretch the bubble past the drawer. */
  overflow-wrap: anywhere;
}

.chat-msg.is-mine .chat-bubble {
  border-radius: 0.9rem 0.9rem 0.2rem 0.9rem;
  background: rgba(204, 255, 51, 0.16);
  color: #EFFFC9;
}

.chat-time {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.55rem;
  color: rgba(245, 246, 240, 0.28);
  padding: 0 0.25rem;
}

.chat-compose {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-compose .cb-field { flex: 1; padding: 0.55rem 0.75rem; font-size: 0.82rem; }

.chat-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid rgba(204, 255, 51, 0.45);
  background: rgba(204, 255, 51, 0.14);
  color: #CCFF33;
  cursor: pointer;
  transition: all 0.25s ease;
}

.chat-send:hover { background: rgba(204, 255, 51, 0.24); }
.chat-send:disabled { opacity: 0.45; cursor: not-allowed; }

@media (prefers-reduced-motion: reduce) {
  .chat-drawer { animation: none; }
}
