/* ============================================================
   WEEP WORLD — who is online, chat, names over heads (js/social.js)
   ============================================================
   Same box-art skin as skin.css: glass panels with a gold hairline, Barlow
   Condensed for words, the pixel font only for the number on the button. */

/* ============ Names and speech bubbles ============ */
.hud > .name-tags {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.ntag-wrap {
  position: absolute;
  left: 0; top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  will-change: transform;
}
.ntag {
  font-family: var(--ww-ui);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  line-height: 1;
  padding: 3px 7px 4px;
  background: rgba(8, 6, 12, 0.72);
  border-radius: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.30);
  white-space: nowrap;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.nbubble {
  position: relative;
  max-width: 220px;
  padding: 6px 10px 7px;
  background: var(--ww-cream);
  color: #14030a;
  font-family: var(--ww-ui);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.36);
  text-align: center;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  animation: nbubble-in 180ms cubic-bezier(.2, .9, .3, 1.3);
}
.nbubble::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -6px;
  width: 12px; height: 12px;
  background: var(--ww-cream);
  transform: translateX(-50%) rotate(45deg);
  z-index: -1;
}
@keyframes nbubble-in {
  from { transform: translateY(6px) scale(0.85); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ============ Online button ============ */
.btn-online {
  width: auto;
  min-width: 42px;
  padding: 0 11px;
  gap: 7px;
  font-family: var(--pixel-font);
  font-size: 14px;
  color: var(--ww-cream);
}
.btn-online b { font-weight: 400; }
.btn-online .on-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--money);
  box-shadow: 0 0 8px var(--money);
  animation: on-dot-pulse 2.4s ease-in-out infinite;
}
.btn-online[aria-expanded="true"] { border-color: var(--ww-line-hi); color: var(--ww-gold); }
.btn-online.bump { animation: online-bump 700ms ease; }
@keyframes on-dot-pulse { 50% { opacity: 0.45; } }
@keyframes online-bump {
  0% { transform: scale(1); }
  25% { transform: scale(1.18); border-color: var(--money); }
  100% { transform: scale(1); }
}

/* ============ Online panel ============ */
.online-panel {
  position: absolute;
  top: 94px;
  right: 20px;
  width: 330px;
  max-height: calc(100% - 200px);
  display: flex;
  flex-direction: column;
  background: var(--ww-glass-hi);
  border: 1px solid var(--ww-line);
  border-top: 3px solid var(--ww-gold);
  box-shadow: var(--ww-shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  /* Over the First Night card and the nudges (5–8), under the black fades
     that cover a map change (30+). */
  z-index: 12;
  animation: op-in 180ms ease-out;
}
@keyframes op-in {
  from { transform: translateX(14px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.op-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--ww-line);
}
.op-kicker { font-family: var(--ww-ui); font-weight: 700; font-size: 11px; letter-spacing: 2.5px; color: var(--ww-pink-soft); }
.op-title { font-family: var(--ww-display); font-size: 24px; letter-spacing: 1px; color: var(--ww-gold); line-height: 1.1; }
.op-close {
  background: none; border: 1px solid var(--ww-line); color: var(--ww-cream);
  width: 30px; height: 30px; font-size: 14px; cursor: pointer;
}
.op-close:hover { border-color: var(--ww-line-hi); }
.op-list { overflow-y: auto; padding: 4px 0 8px; }
.op-sec + .op-sec { border-top: 1px solid rgba(255, 255, 255, 0.06); }
.op-city {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 4px;
  font-family: var(--ww-ui);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--ww-dim);
}
.op-city-name { color: var(--ww-cream); }
.op-here { font-size: 10px; color: #14030a; background: var(--ww-gold); padding: 1px 5px; letter-spacing: 1.5px; }
.op-city-n { margin-left: auto; font-family: var(--pixel-font); font-size: 12px; }
.op-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
}
.op-row:hover { background: rgba(255, 255, 255, 0.03); }
.op-row.muted .op-name { opacity: 0.45; text-decoration: line-through; }
.op-who { flex: 1; min-width: 0; }
.op-name {
  font-family: var(--ww-ui);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.op-you {
  margin-left: 7px;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--ww-dim);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 0 4px;
  vertical-align: 3px;
}
.op-status { font-family: var(--ww-ui); font-weight: 600; font-size: 13px; color: var(--ww-dim); }
.op-acts { display: flex; gap: 4px; flex-shrink: 0; }
.op-btn {
  font-family: var(--ww-ui);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1.5px;
  color: var(--ww-gold);
  background: rgba(255, 200, 60, 0.06);
  border: 1px solid var(--ww-line);
  padding: 5px 7px;
  cursor: pointer;
}
.op-btn:hover { border-color: var(--ww-line-hi); background: rgba(255, 200, 60, 0.14); }
.op-btn.op-mute { color: var(--ww-dim); }
.op-empty {
  margin: 8px 14px 4px;
  font-family: var(--ww-ui);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.35;
  color: var(--ww-dim);
}
.op-foot {
  padding: 9px 14px 11px;
  border-top: 1px solid var(--ww-line);
  font-family: var(--ww-ui);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--ww-dim);
}
.op-foot kbd {
  font-family: var(--pixel-font);
  font-size: 10px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--ww-line-hi);
  color: var(--ww-gold);
  padding: 2px 4px;
}

/* ============ Chat ============ */
/* Bottom left, above the weapon bar. Closed, it is a see-through list of the
   last few lines that fades out; it must not catch clicks meant for the
   street (the trigger is a mousedown on the canvas underneath). */
.hud > .chat-box {
  position: absolute;
  left: 20px;
  bottom: 96px;
  width: 400px;
  max-width: calc(100vw - 40px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  z-index: 6;
}
.chat-log {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  max-height: 172px;
  overflow: hidden;
  scrollbar-width: thin;
}
.chat-line {
  max-width: 100%;
  padding: 3px 9px 4px 8px;
  background: rgba(8, 6, 12, 0.66);
  border-left: 2px solid rgba(255, 255, 255, 0.18);
  font-family: var(--ww-ui);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.25;
  color: var(--ww-cream);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  overflow-wrap: anywhere;
  opacity: 0;
  transition: opacity 600ms ease;
}
.chat-line.fresh { opacity: 1; transition-duration: 120ms; }
.chat-line .cl-name {
  font: inherit;
  font-weight: 700;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-shadow: inherit;
}
.chat-line span.cl-name { cursor: default; }
.chat-line .cl-where { font-size: 12px; letter-spacing: 1px; color: var(--ww-dim); font-weight: 700; }
.chat-line .cl-dim { color: var(--ww-dim); }
.chat-line.me { border-left-color: var(--ww-gold); }
.chat-line.dm { border-left-color: var(--ww-pink); background: rgba(60, 8, 26, 0.72); }
.chat-line.dm .cl-text { color: #ffd0dc; }
.chat-line.sys { color: var(--ww-dim); font-size: 14px; font-style: italic; border-left-color: transparent; }
.chat-line.sys .cl-name { font-style: normal; }
.chat-line.intro { color: var(--ww-cream); font-style: normal; border-left-color: var(--money); }
.chat-line.err { color: #ffc2c8; font-size: 14px; border-left-color: var(--danger); }

/* Open: a solid panel, every line visible, the log scrolls. */
.chat-box.open .chat-log {
  max-height: min(300px, 38vh);
  overflow-y: auto;
  pointer-events: auto;
  padding: 8px;
  background: var(--ww-glass);
  border: 1px solid var(--ww-line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.chat-box.open .chat-line { opacity: 1; background: transparent; padding-left: 6px; }
.chat-box.open .chat-line.dm { background: rgba(60, 8, 26, 0.55); }

.chat-form {
  display: flex;
  gap: 0;
  pointer-events: auto;
  background: var(--ww-glass-hi);
  border: 1px solid var(--ww-line-hi);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.36);
}
.chat-to {
  flex-shrink: 0;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--ww-ui);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1.5px;
  color: #14030a;
  background: var(--ww-gold);
  border: none;
  padding: 0 10px;
  cursor: pointer;
}
.chat-to.dm { background: var(--ww-pink); color: #fff; }
.chat-to.dm::after { content: '  ✕'; }
.chat-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ww-cream);
  font-family: var(--ww-ui);
  font-weight: 600;
  font-size: 17px;
  padding: 9px 10px;
}
.chat-input::placeholder { color: var(--ww-dim); }
.chat-send, .chat-close {
  flex-shrink: 0;
  font-family: var(--ww-ui);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1.5px;
  color: var(--ww-gold);
  background: none;
  border: none;
  border-left: 1px solid var(--ww-line);
  padding: 0 12px;
  cursor: pointer;
}
.chat-close { display: none; }
.chat-open-btn { display: none; }

/* ============ Phones ============ */
/* The handheld layout: the HUD ends above the control tray, the weapon bar is
   scaled down in the bottom-left corner, and there is no keyboard to press
   Enter on — so a CHAT button sits above the weapon bar and opens the box. */
body.mobile .hud > .chat-box {
  left: 8px;
  bottom: 58px;
  width: min(66vw, 300px);
}
/* Three short lines: the camera keeps you in the lower middle of a phone
   screen, and a taller log would stand on your own character. */
body.mobile .chat-log { max-height: 66px; }
body.mobile .chat-box.open { width: calc(100vw - 16px); }
body.mobile .chat-line { font-size: 13px; padding: 2px 7px 3px 6px; }
body.mobile .chat-line.sys, body.mobile .chat-line.err { font-size: 12px; }
body.mobile .chat-box.open .chat-log { max-height: 30vh; }
body.mobile .chat-input { font-size: 16px; } /* under 16px makes iOS zoom the page */
body.mobile .chat-close { display: block; }
body.mobile .chat-open-btn {
  display: block;
  align-self: flex-start;
  pointer-events: auto;
  font-family: var(--ww-ui);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--ww-gold);
  background: var(--ww-glass-hi);
  border: 1px solid var(--ww-line-hi);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.33);
  padding: 6px 10px;
}
body.mobile .chat-box.open .chat-open-btn { display: none; }
body.mobile .btn-online { min-width: 38px; height: 38px; padding: 0 8px; gap: 5px; font-size: 9px; }
body.mobile .online-panel {
  left: 8px;
  right: 8px;
  top: calc(var(--hud-strip-h, 42px) + 12px);
  width: auto;
  max-height: calc(100% - var(--hud-strip-h, 42px) - 24px);
}
/* In portrait the camera-mode bar sits under the status strip (world3d.css),
   above the whole HUD, so the list starts below it. */
@media (orientation: portrait) {
  body.mobile:has(.world-camera:not([hidden]) [data-camera-mode]) .online-panel {
    top: calc(var(--hud-strip-h, 42px) + 78px);
    max-height: calc(100% - var(--hud-strip-h, 42px) - 90px);
  }
}
body.mobile .op-name { font-size: 16px; }
body.mobile .op-btn { padding: 7px 8px; }
body.mobile .op-foot { display: none; }
body.mobile .ntag { font-size: 11px; }
body.mobile .nbubble { font-size: 13px; max-width: 170px; }
