/* ── PHAZE H5 Chat ──────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

#h5chat {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  /* PHAZE house default — pure CSS, no image (xsun bg removed) */
  background: radial-gradient(120% 90% at 50% -10%, #1c1340 0%, #0d0a1e 55%, #07060f 100%);
  overflow: hidden;
  position: relative;
  font-family: Tahoma, Arial, sans-serif;
  font-size: 11px;
  color: #d4d4e8;
}

/* ── Connection overlay — loading bar over the chat ───────────────────────── */
#h5-connstatus {
  position: absolute; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(7,6,15,.82); backdrop-filter: blur(6px);
  opacity: 1; transition: opacity .4s ease;
}
#h5-connstatus.hidden { opacity: 0; pointer-events: none; }
.cs-card { text-align: center; width: min(320px, 82%); }
.cs-logo {
  font-size: 26px; font-weight: 900; letter-spacing: .18em;
  background: linear-gradient(90deg, #a78bfa 0%, #06b6d4 40%, #a78bfa 60%, #a78bfa 100%);
  background-size: 200% auto;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  animation: csLogoShimmer 2.5s linear infinite;
  margin-bottom: 10px;
}
@keyframes csLogoShimmer { to { background-position: -200% center; } }
.cs-msg { font-size: 13px; font-weight: 800; color: #e2d9f3; }
.cs-barwrap {
  height: 10px; margin: 12px 0 8px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(124,58,237,.35); border-radius: 7px;
  overflow: hidden;
}
.cs-bar {
  height: 100%; width: 10%; border-radius: 7px;
  background: linear-gradient(90deg, #7c3aed, #06b6d4, #7c3aed);
  background-size: 200% 100%;
  animation: csBarFlow 1.4s linear infinite;
  transition: width .5s ease;
  box-shadow: 0 0 12px rgba(124,58,237,.6);
}
.cs-bar.error { background: linear-gradient(90deg, #b91c1c, #ef4444); animation: none; }
@keyframes csBarFlow { to { background-position: -200% 0; } }
.cs-sub { font-size: 10px; color: rgba(255,255,255,.45); min-height: 13px; }
.cs-tip { font-size: 10px; color: rgba(167,139,250,.7); font-style: italic; margin-top: 10px; }

/* ── Announce bar ─────────────────────────────────────────────────────────── */
#h5-announce {
  display: none; align-items: center; gap: 6px;
  padding: 4px 10px; font-size: 10px;
  color: #fff; background: linear-gradient(90deg, #5a00e0, #2a0088);
  border-bottom: 1px solid #7c3aed; flex-shrink: 0;
}
#h5-announce.visible { display: flex; }
.ann-close { background: none; border: none; color: rgba(255,255,255,.6); cursor: pointer; font-size: 14px; margin-left: auto; }

/* ── Tab bar (mockup: sits between messages and smiley row) ───────────────── */
#h5-toptabs {
  display: flex; align-items: flex-end;
  padding: 4px 6px 0;
  background: rgba(5,5,20,.92);
  border-top: 1px solid rgba(124,58,237,.25);
  flex-shrink: 0; min-height: 28px;
  backdrop-filter: blur(4px);
}
#h5-pmtabs {
  display: flex; align-items: flex-end; gap: 2px;
  flex: 1; overflow-x: auto; scrollbar-width: none;
}
#h5-pmtabs::-webkit-scrollbar { display: none; }

.pmtab {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 12px 3px;
  background: rgba(124,58,237,.15);
  border: 1px solid rgba(124,58,237,.25);
  border-bottom: none;
  border-radius: 5px 5px 0 0;
  color: rgba(180,160,255,.8);
  font-size: 10px; font-weight: 700;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  font-family: Tahoma, Arial, sans-serif;
  position: relative; bottom: -1px;
  transition: background .1s, color .1s;
}
.pmtab:hover { background: rgba(124,58,237,.3); color: #c4b5fd; }
.pmtab.active {
  background: rgba(124,58,237,.4);
  color: #e9d5ff;
  border-color: rgba(124,58,237,.5);
  border-bottom-color: rgba(124,58,237,.4);
}
.pm-unread {
  background: #7c3aed; color: #fff;
  font-size: 8px; font-weight: 700;
  border-radius: 6px; padding: 0 3px; min-width: 11px; text-align: center;
}
.pm-close { opacity: 0; font-size: 12px; color: #888; margin-left: 1px; }
.pmtab:hover .pm-close { opacity: 1; }
.pm-close:hover { color: #f87171; }

#h5-topright {
  display: flex; align-items: center; gap: 6px;
  padding: 0 6px 4px; flex-shrink: 0;
}
.online-count { font-size: 10px; color: #a78bfa; font-weight: 700; white-space: nowrap; }
.top-btn {
  background: rgba(124,58,237,.2); border: 1px solid rgba(124,58,237,.3);
  border-radius: 3px; color: #c4b5fd; font-size: 11px;
  cursor: pointer; padding: 1px 6px; font-family: inherit;
  transition: background .1s;
}
.top-btn:hover { background: rgba(124,58,237,.4); }

/* ── Main body ────────────────────────────────────────────────────────────── */
#h5-body {
  display: flex; flex: 1; min-height: 0;
  padding: 0; gap: 0; overflow: visible;
  position: relative;
}

/* ── Message panel ────────────────────────────────────────────────────────── */
#h5-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background: transparent;
  border-right: 1px solid rgba(124,58,237,.2);
  overflow: hidden;
  position: relative;
}

/* ── Messages ─────────────────────────────────────────────────────────────── */
#h5-messages {
  flex: 1; overflow-y: auto;
  padding: 8px 10px 6px;
  /* near-opaque deep purple, mockup style — room bg stays as a subtle tint */
  background: rgba(13,10,28,.93);
  display: flex; flex-direction: column; gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(124,58,237,.4) transparent;
}
#h5-messages::-webkit-scrollbar { width: 6px; }
#h5-messages::-webkit-scrollbar-track { background: transparent; }
#h5-messages::-webkit-scrollbar-thumb { background: rgba(124,58,237,.4); border-radius: 3px; }

.msg-wrap {
  position: relative;
  border-radius: 4px;
}
.msg-wrap:hover { background: rgba(124,58,237,.06); }
.msg-wrap:hover .msg { background: transparent; }
.msg-wrap:hover .msg-react-btn { opacity: 1; }
.msg {
  display: flex; align-items: center; flex-wrap: nowrap;
  gap: 7px; padding: 3px 7px; line-height: 1.55; min-height: 26px;
  border-radius: 7px;
}
.msg:hover { background: transparent; }

/* ── Reaction add button ── */
.msg-react-btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: rgba(15,15,30,.95); border: 1px solid rgba(124,58,237,.3);
  border-radius: 6px; padding: 2px 6px; font-size: 13px; cursor: pointer;
  opacity: 0; transition: opacity .12s, background .12s; line-height: 1;
  color: rgba(255,255,255,.6); user-select: none; z-index: 10;
}
.msg-react-btn:hover { background: rgba(124,58,237,.25); color: #fff; }

/* ── Reaction picker popup ── */
.reaction-picker {
  position: fixed; z-index: 2000;
  background: rgba(12,12,24,.97); border: 1px solid rgba(124,58,237,.35);
  border-radius: 10px; padding: 6px 8px;
  display: flex; gap: 2px; flex-wrap: wrap; max-width: 220px;
  box-shadow: 0 8px 30px rgba(0,0,0,.6);
  animation: fadeUp .12s ease both;
}
.reaction-picker .rp-em {
  font-size: 20px; padding: 4px 5px; border-radius: 6px; cursor: pointer;
  transition: background .1s, transform .1s; line-height: 1;
}
.reaction-picker .rp-em:hover { background: rgba(124,58,237,.25); transform: scale(1.2); }

/* ── Reaction bar ── */
.msg-reactions {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 2px 5px 4px 30px; min-height: 0;
}
.msg-reactions:empty { display: none; }
.rxn-pill {
  display: inline-flex; align-items: center; gap: 3px;
  background: rgba(124,58,237,.12); border: 1px solid rgba(124,58,237,.22);
  border-radius: 20px; padding: 1px 7px 1px 4px;
  font-size: 12px; cursor: pointer; transition: background .12s, border-color .12s;
  user-select: none; line-height: 1.4;
}
.rxn-pill:hover { background: rgba(124,58,237,.25); border-color: rgba(124,58,237,.5); }
.rxn-pill.mine { background: rgba(124,58,237,.22); border-color: rgba(124,58,237,.45); }
.rxn-pill .rxn-count { font-size: 11px; color: rgba(255,255,255,.55); font-weight: 600; }
.msg.grouped { padding-left: 30px; }
.msg.grouped .msg-gap { width: 0; }
.msg.system { padding: 2px 8px; }
.msg.system .msg-text {
  font-size: 10px; color: #6b7280; font-style: italic;
}
.msg.pm-in  { background: rgba(124,58,237,.12); }
.msg.pm-out { background: rgba(16,185,129,.08); }
.msg.action { color: #a78bfa; font-style: italic; }
.action-name { font-style: normal; font-weight: 700; }
.msg.dice {
  background: rgba(124,58,237,.15); border-radius: 5px;
  margin: 2px 0; padding: 5px 8px; align-items: center; gap: 8px;
  border: 1px solid rgba(124,58,237,.25);
}
.dice-result { display: flex; align-items: center; gap: 10px; }
.dice-label { font-size: 11px; color: #a78bfa; }
.dice-label strong { color: #c4b5fd; }

/* ── 3D Dice cube ─────────────────────────────────────────────────────── */
.dice-scene {
  width: 32px; height: 32px;
  perspective: 120px;
  flex-shrink: 0;
}
.dice-cube {
  width: 32px; height: 32px;
  position: relative;
  transform-style: preserve-3d;
  animation: dice-roll 0.9s cubic-bezier(.25,.1,.25,1) forwards;
}
.dice-cube.non-d6 {
  animation: dice-slam 0.5s cubic-bezier(.22,1,.36,1) forwards;
}
.dice-face-el {
  position: absolute;
  width: 32px; height: 32px;
  border: 2px solid rgba(167,139,250,.7);
  border-radius: 6px;
  background: rgba(15,15,35,.95);
  display: flex; align-items: center; justify-content: center;
  backface-visibility: hidden;
}
.dice-face-el .pip-grid {
  display: grid;
  width: 22px; height: 22px;
  gap: 3px;
}
.pip-grid.p1 { grid-template: repeat(3,1fr)/repeat(3,1fr); }
.pip-grid.p2 { grid-template: repeat(2,1fr)/repeat(1,1fr); }
.pip-grid.p3 { grid-template: repeat(3,1fr)/repeat(1,1fr); }
.pip-grid.p4 { grid-template: repeat(2,1fr)/repeat(2,1fr); }
.pip-grid.p5 { grid-template: repeat(3,1fr)/repeat(3,1fr); }
.pip-grid.p6 { grid-template: repeat(3,1fr)/repeat(2,1fr); }
.pip { width: 5px; height: 5px; border-radius: 50%; background: #c4b5fd; }
.pip.h { visibility: hidden; }

/* face positions */
.dice-face-el.front  { transform: translateZ(16px); }
.dice-face-el.back   { transform: rotateY(180deg) translateZ(16px); }
.dice-face-el.right  { transform: rotateY( 90deg) translateZ(16px); }
.dice-face-el.left   { transform: rotateY(-90deg) translateZ(16px); }
.dice-face-el.top    { transform: rotateX( 90deg) translateZ(16px); }
.dice-face-el.bottom { transform: rotateX(-90deg) translateZ(16px); }

/* non-d6 flat face */
.dice-face-el.flat {
  transform: translateZ(16px);
  font-size: 13px; font-weight: 700; color: #c4b5fd;
}

/* roll animation: spin 2+ full rotations then land on result */
@keyframes dice-roll {
  0%   { transform: rotateX(0deg)    rotateY(0deg)    rotateZ(0deg); }
  30%  { transform: rotateX(360deg)  rotateY(180deg)  rotateZ(90deg); }
  60%  { transform: rotateX(540deg)  rotateY(360deg)  rotateZ(45deg); }
  85%  { transform: rotateX(var(--rx)) rotateY(var(--ry)) rotateZ(4deg); }
  100% { transform: rotateX(var(--rx)) rotateY(var(--ry)) rotateZ(0deg); }
}
@keyframes dice-slam {
  0%   { transform: translateZ(16px) translateZ(-40px) scale(.4); opacity: 0; }
  70%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.msg-av-wrap {
  position: relative;
  width: 30px; height: 30px;
  flex-shrink: 0;
}
.msg-av {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover; cursor: pointer;
  image-rendering: pixelated;
  display: block;
  border: 1px solid rgba(124,58,237,.4);
  box-shadow: 0 0 6px rgba(124,58,237,.15);
}
.msg-av:hover { border-color: #7c3aed; }
.msg-pawn {
  position: absolute; bottom: -3px; right: -5px;
  width: 10px; height: 15px;
  image-rendering: pixelated; pointer-events: none;
}
.msg-sep { color: #4b5563; font-size: 10px; flex-shrink: 0; }
.msg-name {
  font-size: 12px; font-weight: 700; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.msg-name:hover { text-decoration: underline; }
.msg-time { font-size: 9px; color: #4b5563; white-space: nowrap; flex-shrink: 0; margin-left: 2px; }
.msg-text {
  display: inline; font-size: 12px; color: #e3e3f0;
  word-break: break-word; flex: 1; min-width: 0;
}
.msg-text a { color: #818cf8; }
.msg-text.gagged { opacity: .3; text-decoration: line-through; }
.gag-badge { font-size: 8px; background: rgba(220,38,38,.2); color: #f87171; border-radius: 2px; padding: 0 2px; }
.power-badge { width: 11px; height: 11px; image-rendering: pixelated; vertical-align: middle; }
.smiley { width: 19px; height: 19px; vertical-align: middle; }
/* animated sprite strip: bg slides one frame at a time via steps() */
.smx {
  display: inline-block; width: 19px; height: 19px;
  background-repeat: no-repeat; background-size: auto 100%;
}
@keyframes smx-play { to { background-position-x: var(--end, 0); } }

/* xat rank colors — adapted for dark theme */
.rank-mainowner { color: #ff6b9d; }
.rank-admin  { color: #f87171; }
.rank-owner  { color: #fbbf24; }
.rank-mod    { color: #34d399; }
.rank-member { color: #818cf8; }
.rank-guest  { color: #9ca3af; }
.rank-bot    { color: #c084fc; }

/* ── Typing indicator ─────────────────────────────────────────────────────── */
#h5-typing {
  padding: 2px 8px; font-size: 9px; color: #6b7280; font-style: italic;
  display: flex; align-items: center; gap: 4px; min-height: 14px;
  flex-shrink: 0; background: rgba(8,8,24,.4);
}
.typing-dots { display: inline-flex; gap: 2px; align-items: center; }
.typing-dots span {
  width: 3px; height: 3px; border-radius: 50%;
  background: #7c3aed; animation: tdot 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes tdot { 0%,80%,100%{opacity:.3;transform:scale(.8)} 40%{opacity:1;transform:scale(1)} }

/* ── Smiley strip ─────────────────────────────────────────────────────────── */
#h5-smstrip {
  display: flex; align-items: center;
  padding: 0 6px; gap: 2px;
  background: rgba(5,5,20,.9);
  border-top: 1px solid rgba(124,58,237,.25);
  flex-shrink: 0;
  height: 42px; overflow: hidden;
}
#h5-smstrip-left {
  display: flex; align-items: center; gap: 1px; flex: 1; overflow: hidden;
}
#h5-smstrip-right {
  display: flex; align-items: center; gap: 3px;
  flex-shrink: 0; padding-left: 6px;
  border-left: 1px solid rgba(124,58,237,.2); margin-left: 3px;
}
.smstrip-item {
  width: 34px; height: 34px; flex-shrink: 0;
  cursor: pointer; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  transition: background .1s, transform .08s;
}
.smstrip-item:hover { background: rgba(124,58,237,.25); transform: scale(1.15); }
.smstrip-item img { width: 27px; height: 27px; image-rendering: pixelated; display: block; }
.smstrip-more {
  font-size: 13px; font-weight: 700; color: rgba(167,139,250,.6);
  cursor: pointer; padding: 0 3px; flex-shrink: 0;
  background: none; border: none; font-family: inherit; line-height: 1;
}
.smstrip-more:hover { color: #a78bfa; }
.smstrip-right-btn {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border-radius: 4px; flex-shrink: 0;
  font-size: 14px; color: #6b7280; background: none; border: none; font-family: inherit;
  transition: background .1s, color .1s;
}
.smstrip-right-btn:hover { background: rgba(124,58,237,.2); color: #a78bfa; }
.smstrip-right-btn.btn-disconnected { color: #f87171; }
.smstrip-right-btn.btn-disconnected:hover { background: rgba(248,113,113,.1); color: #fca5a5; }
.smstrip-brand {
  display: flex; align-items: center; justify-content: center;
  padding: 2px 8px;
  background: linear-gradient(135deg, #7c3aed, #4c1d95);
  border-radius: 4px; font-size: 10px; font-weight: 900;
  color: #e9d5ff; letter-spacing: .08em; flex-shrink: 0;
  border: 1px solid rgba(167,139,250,.3);
}

/* ── Input bar ────────────────────────────────────────────────────────────── */
#h5-inputbar {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 6px 8px;
  background: rgba(5,5,20,.95);
  border-top: 1px solid rgba(124,58,237,.2);
  flex-shrink: 0; min-height: 44px;
}
#h5-input {
  flex: 1;
  background: rgba(20,20,40,.9);
  border: 1px solid rgba(124,58,237,.35); border-radius: 14px;
  padding: 6px 14px; color: #e2e8f0;
  font-size: 12px; font-family: Tahoma, Arial, sans-serif;
  outline: none; resize: none; line-height: 1.3;
  max-height: 120px; overflow-y: auto; scrollbar-width: none;
  transition: border-color .15s;
}
#h5-input:focus { border-color: rgba(124,58,237,.7); background: rgba(25,25,50,.95); }
#h5-input:disabled { background: rgba(10,10,25,.6); color: #4b5563; cursor: not-allowed; }
#h5-input::placeholder { color: #374151; }
.xat-send-btn {
  height: 30px; padding: 0 18px;
  background: linear-gradient(135deg, #06b6d4, #7c3aed);
  border: 1px solid rgba(103,232,249,.35); border-radius: 14px;
  color: #f0fdff; font-size: 12px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-family: Tahoma, Arial, sans-serif; white-space: nowrap;
  transition: background .1s, transform .08s;
}
.xat-send-btn:hover { background: linear-gradient(135deg, #22d3ee, #8b5cf6); }
.xat-send-btn:active { transform: scale(.97); }

/* ── Sidebar (right) ──────────────────────────────────────────────────────── */
#h5-sidebar {
  width: 185px; flex-shrink: 0;
  display: flex; flex-direction: row;
  transition: width .2s ease;
  overflow: visible;
}
#h5-sidebar.collapsed { width: 0; }

#h5-sidebar-toggle {
  position: absolute;
  right: 185px; top: 50%; transform: translateY(-50%);
  width: 13px; height: 40px;
  background: rgba(124,58,237,.5);
  border: 1px solid rgba(124,58,237,.4); border-right: none;
  border-radius: 4px 0 0 4px;
  color: rgba(229,209,255,.8); font-size: 9px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  z-index: 20; padding: 0;
  font-family: inherit;
  transition: background .12s, right .2s ease;
}
#h5-sidebar.collapsed #h5-sidebar-toggle { right: 0; }
#h5-sidebar-toggle:hover { background: rgba(124,58,237,.8); color: #fff; }

#h5-sidebar-content {
  width: 185px; flex-shrink: 0;
  display: flex; flex-direction: column; overflow: hidden;
  background: rgba(12,9,26,.95);
  border-left: 1px solid rgba(124,58,237,.25);
  backdrop-filter: blur(6px);
  transition: width .2s ease, opacity .15s ease;
}
#h5-sidebar.collapsed #h5-sidebar-content { width: 0; opacity: 0; pointer-events: none; }

#h5-utabs {
  display: flex;
  border-bottom: 1px solid rgba(124,58,237,.2); flex-shrink: 0;
}
.utab {
  flex: 1; padding: 5px 2px 4px;
  background: transparent;
  border: none;
  color: #6b7280; font-size: 10px; font-weight: 700;
  cursor: pointer; font-family: Tahoma, Arial, sans-serif;
  transition: color .1s, background .1s; text-align: center;
  border-bottom: 2px solid transparent;
}
.utab:hover { color: #a78bfa; background: rgba(124,58,237,.06); }
.utab.active { color: #c4b5fd; border-bottom-color: #7c3aed; }

#h5-userlist, #h5-friendslist {
  display: flex; flex-direction: column; flex: 1; overflow: hidden;
}
#h5-userlist.hidden, #h5-friendslist.hidden { display: none; }
#h5-userlist-inner, #h5-friendslist-inner {
  overflow-y: auto; flex: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(124,58,237,.3) transparent;
}
#h5-userlist-inner::-webkit-scrollbar { width: 4px; }
#h5-userlist-inner::-webkit-scrollbar-thumb { background: rgba(124,58,237,.3); border-radius: 2px; }

.ulist-group {
  padding: 4px 8px 3px; font-size: 8px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: #4b5563;
  background: rgba(124,58,237,.06);
  border-bottom: 1px solid rgba(124,58,237,.1);
}
.ulist-gcount { color: #6b7280; margin-left: 3px; }
.ulist-empty { padding: 12px 8px; text-align: center; font-size: 10px; color: #4b5563; font-style: italic; }

.uentry {
  display: flex; align-items: center; gap: 7px;
  margin: 3px 6px; padding: 5px 8px;
  cursor: pointer; font-size: 11px;
  background: rgba(124,58,237,.08);
  border: 1px solid rgba(124,58,237,.12);
  border-radius: 9px;
  transition: background .08s, border-color .08s;
}
.uentry:hover { background: rgba(124,58,237,.18); border-color: rgba(124,58,237,.35); }
.uentry.is-me { background: rgba(124,58,237,.22); border-color: rgba(124,58,237,.4); }
.uentry.is-gagged { opacity: .4; }
.uentry-av-wrap { position: relative; flex-shrink: 0; }
.uentry-av {
  width: 24px; height: 24px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  border: 1px solid rgba(124,58,237,.3);
  image-rendering: pixelated;
}
.uentry-pawn {
  width: 8px; height: 12px;
  image-rendering: pixelated; flex-shrink: 0; margin-left: 1px;
}
.uentry-pawn-icon {
  width: 10px; height: 16px;
  flex-shrink: 0; display: block; margin: 0 auto;
}
.friend-online-dot {
  position: absolute; bottom: -1px; right: -2px;
  width: 7px; height: 7px; border-radius: 50%;
  background: #22c55e; border: 1.5px solid #0a0a18;
}
.uentry-rank-dot {
  position: absolute; bottom: -1px; right: -2px;
  width: 6px; height: 6px; border-radius: 50%;
  border: 1px solid rgba(8,8,24,.8);
}
.uentry.rank-admin  .uentry-rank-dot { background: #f87171; }
.uentry.rank-owner  .uentry-rank-dot { background: #fbbf24; }
.uentry.rank-mod    .uentry-rank-dot { background: #34d399; }
.uentry.rank-member .uentry-rank-dot { background: #818cf8; }
.uentry.rank-guest  .uentry-rank-dot { background: #4b5563; }
.uentry.rank-bot    .uentry-rank-dot { background: #c084fc; }
.uname {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; font-weight: 700;
}
.friend-dot { color: #7c3aed; font-size: 9px; flex-shrink: 0; }

/* ── Get-a-chat CTA (site purple theme) ───────────────────────────────────── */
#h5-cta-bot {
  display: flex; align-items: center; justify-content: center;
  margin: 6px 8px; padding: 7px 10px;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  border: 1px solid rgba(124,58,237,.5);
  border-radius: 9px;
  color: #fff; font-size: 11px; font-weight: 800;
  text-decoration: none; letter-spacing: .02em;
  flex-shrink: 0; cursor: pointer;
  box-shadow: 0 2px 10px rgba(124,58,237,.35);
  transition: transform .1s, box-shadow .1s, filter .1s;
}
#h5-cta-bot:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(124,58,237,.5); }
#h5-cta-bot:active { transform: none; }

.h5-sidebar-btn {
  display: flex; align-items: center; justify-content: center;
  margin: 4px 8px; padding: 7px 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 9px;
  color: rgba(255,255,255,.6); font-size: 11px; font-weight: 700;
  cursor: pointer; font-family: inherit; letter-spacing: .02em;
  flex-shrink: 0; transition: background .15s, color .15s;
  width: calc(100% - 16px);
}
.h5-sidebar-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.h5-sidebar-btn.btn-disconnected { color: #f59e0b; border-color: rgba(245,158,11,.3); }

/* ── Sidebar footer ───────────────────────────────────────────────────────── */

.h5-footer-stat { font-size: 8px; color: #4b5563; white-space: nowrap; }

#h5-footer-signin.disconnected { color: #f87171; border-color: rgba(248,113,113,.3); }

/* ── Smiley picker ────────────────────────────────────────────────────────── */
#h5-smpicker {
  position: absolute; bottom: 76px; left: 0; right: 163px;
  max-height: 220px;
  background: rgba(10,10,28,.97);
  border: 1px solid rgba(124,58,237,.35); border-radius: 8px 8px 0 0;
  z-index: 300; display: none; flex-direction: column; overflow: hidden;
  box-shadow: 0 -4px 24px rgba(0,0,0,.5);
  backdrop-filter: blur(8px);
}
#h5-smpicker.open { display: flex; }
#h5-smpicker-search { padding: 6px 6px 4px; flex-shrink: 0; }
#h5-sm-search {
  width: 100%; background: rgba(20,20,40,.9); border: 1px solid rgba(124,58,237,.3);
  border-radius: 5px; padding: 4px 10px; color: #d1d5db;
  font-size: 11px; outline: none; font-family: inherit;
}
#h5-sm-search:focus { border-color: rgba(124,58,237,.6); }
#h5-smpicker-tabs {
  display: flex; gap: 2px; padding: 3px 6px; flex-shrink: 0;
  overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid rgba(124,58,237,.2);
}
#h5-smpicker-tabs::-webkit-scrollbar { display: none; }
.sm-tab {
  padding: 3px 8px; background: none; border: 1px solid transparent;
  border-radius: 4px; color: #6b7280; font-size: 10px; cursor: pointer;
  white-space: nowrap; font-family: inherit; font-weight: 700;
  transition: color .1s, background .1s;
}
.sm-tab:hover { background: rgba(124,58,237,.15); color: #a78bfa; }
.sm-tab.active { background: rgba(124,58,237,.25); border-color: rgba(124,58,237,.4); color: #c4b5fd; }
#h5-smpicker-grid {
  display: flex; flex-wrap: wrap; gap: 2px; padding: 4px;
  overflow-y: auto;
}
.sm-item { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 4px; cursor: pointer; transition: background .1s; }
.sm-item:hover { background: rgba(124,58,237,.2); }
.sm-item img { width: 20px; height: 20px; image-rendering: pixelated; }

/* ── User dialog (faithful xDialog port from DialogActions.as) ────────────── */
#h5-ctxmenu {
  position: fixed; width: 340px;
  background: rgba(12,11,30,.98); border: 1px solid rgba(124,58,237,.45);
  border-radius: 12px; box-shadow: 0 14px 50px rgba(0,0,0,.7), 0 0 0 1px rgba(124,58,237,.12);
  z-index: 500; display: none; padding: 0 0 10px;
  font-family: Tahoma, Arial, sans-serif;
  backdrop-filter: blur(10px);
  animation: fadeUp .14s ease;
  overflow: hidden;
}
#h5-ctxmenu.open { display: block; }

/* title bar — "Name (id)" + close, like xDialog chrome */
.xdlg-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 8px 7px 12px;
  background: linear-gradient(180deg, rgba(124,58,237,.45), rgba(124,58,237,.22));
  border-bottom: 1px solid rgba(124,58,237,.35);
}
.xdlg-title-txt {
  font-size: 12px; font-weight: 700; color: #efe7ff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.xdlg-id { font-weight: 400; color: rgba(255,255,255,.55); }
.xdlg-close {
  width: 20px; height: 20px; flex-shrink: 0;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  border-radius: 5px; color: #cbd5e1; font-size: 10px; line-height: 1;
  cursor: pointer; font-family: inherit;
  transition: background .1s, color .1s;
}
.xdlg-close:hover { background: rgba(239,68,68,.3); color: #fff; }

.xdlg-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 8px; }

/* 2-column chunky button grid — disabled buttons grey out, never hide */
.xdlg-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px; padding: 4px 10px 0;
}
.xdlg-btn {
  padding: 8px 6px;
  background: linear-gradient(180deg, rgba(124,58,237,.30), rgba(124,58,237,.14));
  border: 1px solid rgba(124,58,237,.4);
  border-radius: 8px;
  color: #e2d9f3; font-size: 11px; font-weight: 700;
  cursor: pointer; font-family: Tahoma, Arial, sans-serif;
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .1s, transform .06s, border-color .1s;
}
.xdlg-btn:hover { background: linear-gradient(180deg, rgba(124,58,237,.5), rgba(124,58,237,.28)); border-color: rgba(167,139,250,.6); }
.xdlg-btn:active { transform: scale(.97); }
.xdlg-btn.danger { border-color: rgba(248,113,113,.4); color: #fca5a5; background: linear-gradient(180deg, rgba(239,68,68,.22), rgba(239,68,68,.08)); }
.xdlg-btn.danger:hover { background: linear-gradient(180deg, rgba(239,68,68,.4), rgba(239,68,68,.18)); }
.xdlg-btn.disabled {
  background: rgba(255,255,255,.03);
  border-color: rgba(255,255,255,.07);
  color: rgba(255,255,255,.22);
  cursor: default; pointer-events: none;
}

.ctx-header { display: flex; align-items: center; gap: 10px; padding: 10px 12px 8px; border-bottom: 1px solid rgba(124,58,237,.2); }
.ctx-av {
  width: 44px; height: 44px; border-radius: 10px; image-rendering: pixelated;
  border: 2px solid rgba(124,58,237,.45); cursor: pointer; flex-shrink: 0;
  transition: border-color .12s;
}
.ctx-av:hover { border-color: #a78bfa; }
.ctx-name { font-size: 13px; font-weight: 700; color: #c4b5fd; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-name em { font-size: 10px; color: #6b7280; font-style: normal; }
.ctx-rank { font-size: 10px; color: #9ca3af; text-transform: capitalize; display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.ctx-status { font-size: 10px; color: #6b7280; font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.ctx-divider { height: 1px; background: rgba(124,58,237,.15); margin: 3px 0; }
.ctx-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 12px;
  background: none; border: none; color: #d1d5db; font-size: 12px;
  cursor: pointer; text-align: left; transition: background .08s, color .08s; font-family: inherit;
}
.ctx-item:hover { background: rgba(124,58,237,.15); color: #e9d5ff; }
.ctx-item.danger { color: #f87171; }
.ctx-item.danger:hover { background: rgba(248,113,113,.1); color: #fca5a5; }

/* ── Toasts ───────────────────────────────────────────────────────────────── */
#h5-toast-area {
  position: fixed; bottom: 80px; right: 10px;
  display: flex; flex-direction: column; gap: 5px;
  z-index: 600; pointer-events: none;
}
.toast {
  background: rgba(10,10,28,.97); border: 1px solid rgba(124,58,237,.35);
  border-radius: 8px; padding: 6px 12px; font-size: 11px; color: #d1d5db;
  max-width: 240px; box-shadow: 0 4px 16px rgba(0,0,0,.4);
  opacity: 0; transform: translateY(4px); transition: all .2s;
  font-family: Tahoma, Arial, sans-serif;
  backdrop-filter: blur(8px);
}
.toast.show { opacity: 1; transform: none; }
.toast.toast-error { border-color: rgba(248,113,113,.4); color: #fca5a5; }

/* ── Mockup two-line messages ─────────────────────────────────────────────── */
.msg.msg2 { align-items: flex-start; gap: 9px; padding: 5px 8px; }
.msg2 .msg-av-wrap { width: 34px; height: 34px; }
.msg2 .msg-av { width: 34px; height: 34px; border-radius: 9px; }
.msg-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.msg-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.msg2 .msg-text { font-size: 12px; color: #d6d6e7; line-height: 1.45; }
.msg.grouped { padding-left: 51px; }
.msg-gap { display: none; }

.rank-pill {
  font-size: 8px; font-weight: 800; letter-spacing: .06em;
  padding: 1px 5px; border-radius: 4px; flex-shrink: 0; line-height: 1.5;
}
.pill-admin { background: rgba(248,113,113,.16); color: #f87171; }
.pill-owner { background: rgba(251,191,36,.16);  color: #fbbf24; }
.pill-mod   { background: rgba(52,211,153,.16);  color: #34d399; }
.pill-bot   { background: rgba(192,132,252,.16); color: #c084fc; }

/* ── Mockup visitor rows: avatar+dot | name / pawn+rank ───────────────────── */
.uentry-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.uentry-sub {
  font-size: 9px; color: rgba(255,255,255,.35);
  display: flex; align-items: center; gap: 4px;
}
.uentry-online-dot {
  position: absolute; bottom: -1px; right: -2px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e; border: 2px solid #0c091a;
}

/* ── Real xat pawn (SVG, tinted via currentColor like Flash ColorTransform) ── */
.pawn-i { width: 10px; height: 16px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.msg-pawn.pawn-i {
  position: absolute; bottom: -4px; right: -6px;
  width: 11px; height: 17px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.6));
  pointer-events: none;
}
.uentry-pawn.pawn-i { width: 8px; height: 13px; margin-right: 1px; }

/* ── Sidebar Sign Out (mockup gray button) ────────────────────────────────── */

/* ── zoom power: avatar enlarges on hover ─────────────────────────────────── */
.ph-zoomable { transition: transform .15s ease; cursor: zoom-in; }
.msg-av.ph-zoomable:hover, .uentry-av.ph-zoomable:hover {
  transform: scale(2.8); z-index: 60; position: relative;
  box-shadow: 0 4px 20px rgba(0,0,0,.7); border-radius: 6px;
}

/* ── status line (status power) ───────────────────────────────────────────── */
.uentry-status {
  font-size: 9px; color: rgba(255,255,255,.5); font-style: italic;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px;
}

/* ── PHAZE Power Badges ───────────────────────────────────────────────────── */
.phaze-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 3px;
  vertical-align: middle;
  line-height: 1.4;
  letter-spacing: 0.03em;
  font-family: Tahoma, Arial, sans-serif;
}
.phaze-badge-verified {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #000;
  box-shadow: 0 0 4px rgba(245,158,11,.5);
}
.phaze-badge-og {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  box-shadow: 0 0 4px rgba(124,58,237,.5);
}
.phaze-badge-dev {
  background: linear-gradient(135deg, #10b981, #34d399);
  color: #000;
  box-shadow: 0 0 4px rgba(16,185,129,.5);
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* visitor sidebar becomes a slide-in overlay (reachable via its toggle) */
  #h5-sidebar {
    position: absolute; top: 0; right: 0; bottom: 0; z-index: 40;
    width: 185px; transform: translateX(100%); transition: transform .22s ease;
  }
  #h5-sidebar.mobile-open { transform: translateX(0); box-shadow: -8px 0 30px rgba(0,0,0,.6); }
  #h5-sidebar.collapsed { width: 185px; } /* ignore desktop collapse on mobile */
  #h5-sidebar-toggle { right: 0 !important; left: -13px; }
  #h5-sidebar.mobile-open #h5-sidebar-toggle { left: auto; right: 185px !important; }
  #h5-sidebar-content { width: 185px !important; opacity: 1 !important; pointer-events: auto !important; }
  #h5-main { border-right: none; }
  #h5-smpicker { right: 0; }
}

/* ── Gameban modal (mod UI) ──────────────────────────────────────────────── */
#gameban-modal {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center;
}
.gbm-box {
  background: #0f0f23; border: 1px solid rgba(124,58,237,.4);
  border-radius: 10px; padding: 20px; width: 320px;
  display: flex; flex-direction: column; gap: 8px;
}
.gbm-title { font-size: 15px; font-weight: 700; color: #c4b5fd; margin-bottom: 4px; }
.gbm-label { font-size: 11px; color: #a78bfa; }
.gbm-select, .gbm-input {
  background: #08081a; border: 1px solid rgba(124,58,237,.3);
  color: #e2e8f0; border-radius: 5px; padding: 6px 8px; font-size: 13px; width: 100%;
}
.gbm-btns { display: flex; gap: 8px; margin-top: 6px; }
.gbm-cancel, .gbm-confirm {
  flex: 1; padding: 8px; border-radius: 5px; border: none; cursor: pointer; font-size: 13px;
}
.gbm-cancel { background: rgba(255,255,255,.08); color: #e2e8f0; }
.gbm-confirm.danger { background: #dc2626; color: #fff; font-weight: 700; }

/* ── Gameban overlay (banned user UI) ───────────────────────────────────── */
#gameban-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: #08081a; display: flex; align-items: center; justify-content: center;
}
.gbo-card {
  background: #0f0f23; border: 1px solid rgba(124,58,237,.35);
  border-radius: 12px; padding: 24px; width: min(480px, 96vw);
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
}
.gbo-title  { font-size: 20px; font-weight: 700; color: #f87171; }
.gbo-sub    { font-size: 13px; color: #a78bfa; }
.gbo-expires { font-size: 11px; color: #64748b; }
#gbo-arena  { width: 100%; margin: 8px 0; }
#gbo-status { font-size: 13px; color: #e2e8f0; min-height: 18px; }
.gbo-canvas { display: block; margin: 0 auto; border: 1px solid rgba(124,58,237,.3); border-radius: 4px; }
.gbo-race   { font-family: monospace; font-size: 13px; color: #e2e8f0; background: #08081a;
               border-radius: 6px; padding: 10px; text-align: left; width: 100%; }
.gbo-code   { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.gbo-code-q { font-size: 18px; font-weight: 700; color: #c4b5fd; }
.gbo-code-inp {
  background: #08081a; border: 1px solid rgba(124,58,237,.4);
  color: #e2e8f0; border-radius: 6px; padding: 8px 12px; font-size: 14px;
  width: 220px; text-align: center;
}
.gbo-code-btn {
  background: #7c3aed; color: #fff; border: none; border-radius: 6px;
  padding: 8px 20px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.gbo-code-btn:hover { background: #6d28d9; }
.gbo-code-btn:disabled { opacity: .5; cursor: default; }
.gbo-slot { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.gbo-slot-reels { font-size: 36px; letter-spacing: 8px; min-height: 48px; }
.gbo-slot-hint  { font-size: 12px; color: #a78bfa; }

/* Scroll-to-bottom button */
.scroll-down-btn {
  position: absolute; bottom: 68px; right: 14px;
  background: rgba(124,58,237,.85); color: #fff; border: none;
  border-radius: 20px; padding: 5px 12px; font-size: 12px; font-weight: 700;
  cursor: pointer; backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
  transition: opacity .2s, transform .2s;
  z-index: 10;
}
.scroll-down-btn:hover { background: #7c3aed; transform: translateY(-2px); }
.scroll-down-btn.hidden { display: none; }

/* @mention highlight */
.mention { background: rgba(139,92,246,.2); color: #c4b5fd;
           border-radius: 3px; padding: 0 3px; font-weight: 600; }
.mention-me { background: rgba(234,179,8,.2); color: #fde68a; animation: mention-pulse .6s ease 2; }
@keyframes mention-pulse { 0%,100%{background:rgba(234,179,8,.2)} 50%{background:rgba(234,179,8,.45)} }

/* Character count */
.char-count { font-size: 10px; color: rgba(255,255,255,.4); align-self: flex-end; padding: 0 4px 4px; white-space: nowrap; }
.char-count.warn { color: #f87171; }
.char-count.hidden { display: none; }
