:root{ --accent:#15fb00; }
.messages-layout { display:grid; grid-template-columns: 320px 1fr; gap:16px; padding:16px; min-height: calc(100vh - 140px); }
.threads { background: rgba(20,20,20,.7); border-radius:16px; }.thread-item { display:flex; gap:12px; padding:12px; cursor:pointer; align-items:center; border-bottom:1px solid rgba(255,255,255,.06); }
.thread-item:hover, .thread-item.active { background: rgba(255,255,255,.06); }
.thread-item img { width:44px; height:44px; border-radius:50%; object-fit:cover; }
.thread-meta { flex:1; }
.thread-meta h4 { margin:0; font-size:14px; }
.thread-meta p { margin:4px 0 0; font-size:12px; opacity:.8; }
.badge { background: var(--accent); color:#000; border-radius:999px; padding:2px 8px; font-size:12px; }
.chat { display:flex; flex-direction:column; background: rgba(20,20,20,.75); border-radius:16px; overflow:hidden; }
.chat-header { padding:10px 12px; border-bottom:1px solid rgba(255,255,255,.06); display:flex; align-items:center; justify-content:space-between; gap:8px; }
.chat-peer { display:flex; gap:12px; align-items:center; }
.chat-peer img { width:40px; height:40px; border-radius:50%; object-fit:cover; }
.chat-actions button{ background:#0b0b0b; border:1px solid rgba(255,255,255,.15); color:#fff; border-radius:10px; padding:6px 10px; cursor:pointer; }
.chat-history { flex:1; overflow:auto; padding:14px; display:flex; flex-direction:column; gap:8px; }
.msg { max-width: 72%; padding:10px 12px; border-radius:14px; background:#111; position:relative; }
.msg.me { align-self:flex-end; background: #0e1a0e; border:1px solid var(--accent); }
.msg .time { display:block; font-size:10px; opacity:.6; margin-top:4px; }
.msg .meta { display:flex; gap:8px; align-items:center; margin-top:4px; opacity:.8; font-size:12px; }
.msg .reactions { display:flex; gap:4px; }
.msg .actions { position:absolute; top:6px; right:6px; display:flex; gap:6px; opacity:.9; }
.msg .actions button{ background:transparent; border:none; color:#aaa; cursor:pointer; }
.msg img.inline { max-width: 320px; border-radius:10px; display:block; }
.chat-input { display:flex; gap:8px; padding:12px; border-top:1px solid rgba(255,255,255,.06); }
.chat-input input[type="text"] { flex:1; padding:12px; border-radius:10px; border:1px solid rgba(255,255,255,.2); background:#0b0b0b; color:#fff; }
.chat-input button { padding:10px 14px; border-radius:10px; background: var(--accent); color:#000; border:none; cursor:pointer; }
#attachBtn{ background:#0b0b0b; color:#fff; border:1px solid rgba(255,255,255,.15); }
@media (max-width: 900px){ .messages-layout{ grid-template-columns:1fr; } .threads{ height: 40vh; } }

.app-header { 
  overflow: visible !important; 
  position: relative;
  z-index: 5000; 
}

.user-menu { position: relative; }

.user-menu .dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 6000;
  display: none;
}

.user-menu.open .dropdown { display: block; }

/* Layout for the chat area */
.chat-wrap { display:flex; gap:14px; height:100%; }
#threadList { width:100%; }
#chatHistory { flex:1; overflow:auto; padding:16px 20px; }

/* Date divider */
.day-divider {
  display:flex; align-items:center; gap:12px; margin:18px 0;
  color:#a6ffa6; opacity:.85; font-size:.9rem; letter-spacing:.04em;
}
.day-divider::before, .day-divider::after {
  content:""; flex:1; height:1px; background:rgba(21,251,0,.3);
}

/* keep it above everything and let it escape containers */
/* Compact floating reaction picker */
/* Compact floating reaction picker (centered emojis) */
.reaction-picker {
  position: fixed;
  z-index: 10000;
  display: flex;
  align-items: center;           /* <— centers vertically */
  gap: 6px;
  background: rgba(0, 0, 0, 0.92);
  border: 2px solid #15fb00;
  border-radius: 999px;
  padding: 8px 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,.6);
  max-width: fit-content;
}

/* Each emoji is a centered 32×32 circle */
.reaction-picker button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;           /* <— center the emoji glyph */
  justify-content: center;       /* <— center horizontally too */
  background: transparent;
  border: 0;
  padding: 0;
  line-height: 1;                /* <— kill tall text metrics */
  font-size: 18px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform .1s ease;
  margin-top: -1px;
}

.reaction-picker button:hover {
  transform: scale(1.2);
}

/* Message bubble */
.msg { 
  position:relative;
  max-width: min(95%, 880px);            /* << same width for both sides */
  margin: 10px 0; padding: 10px 14px;
  background:#0b0b0b; border:2px solid #15fb00; border-radius:14px;
  color:#eaffea;
}
.msg.me { margin-left:auto; }             /* right align self */
.msg .meta { margin-top:6px; opacity:.7; font-size:.78rem; display:flex; gap:10px; }

/* Avatar next to bubbles */
.msg-row { display:flex; align-items:flex-end; gap:10px; }
.msg-row.me { justify-content:flex-end; }
.msg-row .bubble-wrap { max-width: 100%; }

/* Hover toolbar (appears on hover) */
/* Floating toolbar (like the emoji picker) */
.msg-toolbar {
  position: fixed;             /* floats above layout */
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.92);
  border: 2px solid #15fb00;
  border-radius: 999px;
  padding: 6px 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,.6);
}

/* small icon buttons */
.msg-toolbar .icon-btn {
  background: transparent;
  border: 0;
  color: #15fb00;
  cursor: pointer;
  padding: 0 6px;
  font-size: 18px;
  line-height: 1;
}
.msg-toolbar .icon-btn:hover { filter: brightness(1.25); }

/* stop using the in-bubble absolute toolbar */
.msg .toolbar { display: none !important; }

/* Small icon buttons */
.icon-btn {
  background:transparent; border:0; color:#15fb00; cursor:pointer;
  padding:0 6px; font-size:18px; line-height:1;
}
.icon-btn:hover { filter:brightness(1.25); }

/* Emoji picker popover */
.reaction-picker {
  position:absolute; top:-56px; right:6px; display:flex; gap:6px;
  background:#111; border:1px solid #15fb00; border-radius:12px; padding:6px 8px;
  box-shadow:0 6px 16px rgba(0,0,0,.6);
}
.reaction-picker button { font-size:18px; }

/* "More" menu */
.more-menu {
  position:absolute; top:-10px; right:-6px; transform:translateY(-100%);
  background:#111; border:1px solid rgba(21,251,0,.4); border-radius:10px; 
  display:flex; flex-direction:column; min-width:160px; overflow:hidden;
}
.more-menu a {
  padding:8px 10px; color:#eaffea; text-decoration:none; border-bottom:1px solid rgba(255,255,255,.06);
}
.more-menu a:hover { background:#151515; }
.more-menu a:last-child { border-bottom:none; }

/* Seen receipt (for paid) */
.meta .receipt { margin-left:auto; opacity:.85; }

/* Thread list quick look */
.thread-item { display:flex; align-items:center; gap:10px; padding:10px; cursor:pointer; border-radius:10px; }
.thread-item:hover, .thread-item.active { background:rgba(21,251,0,.08); }
.thread-item img { width:38px; height:38px; border-radius:50%; object-fit:cover; border:2px solid #15fb00; }
.thread-meta h4 { margin:0; font-size:1rem; color:#15fb00; }
.thread-meta p { margin:2px 0 0; font-size:.82rem; opacity:.8; }
.badge { margin-left:auto; background:#15fb00; color:#000; font-weight:700; padding:2px 7px; border-radius:999px; }

/* Core message layout */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 6px 0;
}
.msg-row.me { justify-content: flex-end; }

.bubble-wrap { max-width: min(75%, 720px); }

.msg {
  position: relative;
  background: #0b0b0b;
  color: #fff;
  border: 2px solid #15fb00;
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: 0 0 8px rgba(21, 251, 0, 0.3);
  word-break: break-word;
}
.msg.me {
  background: #111;
  border-color: #5eff7e;
}

.msg .inline {
  max-width: 360px;
  border-radius: 8px;
  display: block;
}

/* Meta + reactions inside bubble */
.msg .meta {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.9;
  margin-top: 4px;
  font-size: 0.85rem;
}
.msg .meta .reactions {
  display: inline-flex;
  gap: 4px;
}
.msg .meta .receipt {
  margin-left: auto;
  color: #9cff9c;
}

/* Day divider */
.day-divider {
  text-align: center;
  margin: 12px 0 8px;
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Floating hover toolbar (React / Reply / More) */
.msg-toolbar {
  position: fixed; /* switches to absolute when transforms present */
  z-index: 10000;
  display: inline-flex;
  gap: 6px;
  background: rgba(0,0,0,0.95);
  border: 1px solid #15fb00;
  border-radius: 999px;
  padding: 6px 8px;
  box-shadow: 0 0 12px rgba(21, 251, 0, 0.6);
}
.msg-toolbar .icon-btn {
  border: 1px solid rgba(21,251,0,0.35);
  background: #0b0b0b;
  color: #15fb00;
  border-radius: 999px;
  padding: 6px 8px;
  cursor: pointer;
}
.msg-toolbar .icon-btn:hover { background: #15fb00; color: #000; }

/* Reactions picker (centered above bubble) */
.reaction-picker {
  position: fixed; /* switches to absolute when transforms present */
  z-index: 10001;
  display: inline-flex;
  gap: 6px;
  background: rgba(0,0,0,0.96);
  border: 1px solid #15fb00;
  border-radius: 999px;
  padding: 6px 10px;
  box-shadow: 0 0 14px rgba(21, 251, 0, 0.65);
  align-items: center;         /* centers emojis vertically */
  justify-content: center;     /* centers emojis horizontally */
}
.reaction-picker button {
  border: none;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  padding: 4px 2px;
  cursor: pointer;
}
.reaction-picker button:hover { transform: scale(1.15); }

/* "More" dropdown */
.more-menu {
  position: fixed; /* switches to absolute when transforms present */
  z-index: 10001;
  background: #0b0b0b;
  border: 1px solid #15fb00;
  border-radius: 10px;
  padding: 6px;
  min-width: 150px;
  box-shadow: 0 0 14px rgba(21, 251, 0, 0.4);
}
.more-menu a {
  display: block;
  color: #fff;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
}
.more-menu a:hover { background: rgba(21, 251, 0, 0.15); }

/* =========================================================
   WOW Inbox: Morgue Drawer (Option A)
   ========================================================= */

.morgue-intake{
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(20,20,20,.2));
}
.morgue-h1{
  margin:0;
  font-size: 18px;
  letter-spacing: .12em;
  color: #eaffea;
}
.morgue-subtitle{
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: .18em;
  opacity: .8;
  color: rgba(21,251,0,.9);
}
.morgue-bar{
  margin-top: 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.status-pill{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(21,251,0,.5);
  background: rgba(0,0,0,.55);
  color: #eaffea;
  font-size: 12px;
}
.morgue-counts{
  font-size: 12px;
  opacity: .85;
  white-space: nowrap;
}

.drawer-tabs{
  padding: 10px 12px;
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.drawer-tab{
  width: 100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.55);
  color: #eaffea;
  cursor:pointer;
  position: relative;
  overflow:hidden;
}
.drawer-tab::before{
  content:"";
  position:absolute; inset:-2px;
  background: radial-gradient(120px 60px at 20% 50%, rgba(21,251,0,.22), transparent 60%);
  opacity:.7;
  pointer-events:none;
}
.drawer-tab.active{
  border-color: rgba(21,251,0,.65);
  box-shadow: 0 0 14px rgba(21,251,0,.22);
  transform: translateY(-1px);
}
.drawer-name{
  font-weight: 700;
  letter-spacing:.04em;
}
.drawer-count{
  min-width: 28px;
  text-align:center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(21,251,0,.9);
  color:#000;
  font-weight: 800;
  font-size: 12px;
}

.drawer-panel{
  padding: 0 10px 0px;
}
.thread-list{
  padding: 4px 2px 18px;
}
.thread-empty{
  padding: 14px 12px;
  margin: 10px 6px;
  border-radius: 14px;
  border: 1px dashed rgba(21,251,0,.35);
  background: rgba(0,0,0,.35);
  opacity:.85;
}

/* Thread row accents for buckets */
.thread-item.unread{
  background: rgba(21,251,0,.06);
  border: 1px solid rgba(21,251,0,.20);
}
.thread-item.cold{
  filter: saturate(.7);
  opacity: .92;
}
.thread-stamp{
  margin-left: auto;
  font-size: 10px;
  letter-spacing:.12em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.45);
  opacity: .85;
}
.thread-stamp.cold{
  border-color: rgba(255,255,255,.14);
  background: rgba(0,0,0,.55);
}
.thread-time{
  display:block;
  font-size: 11px;
  opacity: .65;
  margin-top: 2px;
}

/* =========================================================
   WOW Opener: FULL-PAGE Crypt Door Reveal (Option C)
   ========================================================= */

.crypt-gate.hidden { display:none; }

.crypt-gate{
  position: fixed;
  inset: 0;
  z-index: 20000;
  pointer-events: auto;
}

/* subtle darkness while doors are closed */
.crypt-scrim{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(2px);
}

/* Stage contains title + buttons, but DOES NOT constrain doors */
.crypt-stage{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  padding: 18px;
  z-index: 2;
}

/* Title floats above the doors */
.crypt-title{
  position: absolute;
  top: clamp(18px, 6vh, 52px);
  left: 50%;
  transform: translateX(-50%);
  text-align:center;
  color:#eaffea;
  pointer-events: none;
  user-select: none;
  width: min(820px, 92vw);
}
.crypt-kicker{
  font-size: 11px;
  letter-spacing:.2em;
  opacity:.8;
}
.crypt-headline{
  margin-top: 6px;
  font-size: clamp(18px, 3.4vw, 28px);
  letter-spacing:.14em;
  color: rgba(21,251,0,.95);
  text-transform: uppercase;
}
.crypt-sub{
  margin-top: 6px;
  font-size: 12px;
  opacity:.85;
}

/* Buttons sit near bottom center */
.crypt-actions{
  position: absolute;
  bottom: clamp(18px, 6vh, 44px);
  left: 50%;
  transform: translateX(-50%);
  display:flex;
  gap: 10px;
  justify-content:center;
  z-index: 3;
}
.crypt-btn{
  padding: 10px 14px;
  border-radius: 12px;
  border: 0;
  background: rgba(21,251,0,.95);
  color:#000;
  font-weight: 800;
  cursor:pointer;
}
.crypt-skip{
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.18);
  color:#fff;
  cursor:pointer;
}

/* FULL PAGE DOORS (with perspective for realism) */
.crypt-doors{
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  perspective: 1400px;              /* adds depth for 3D tilt */
}

/* Real door halves */
.crypt-door{
  position:absolute;
  top:0;
  bottom:0;
  width: 50%;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;   /* ✅ THIS is what removes the black gap */
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform, filter;
}

/* Left & Right images */
.crypt-door.left{
  left:0;
  background-image: url("../assets/crypt/door-left.png");
  transform-origin: left center;
}
.crypt-door.right{
  right:0;
  background-image: url("../assets/crypt/door-right.png");
  transform-origin: right center;
}

/* Nice “weight” overlays: vignette + grime + inner shadow */
.crypt-door::after{
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(900px 520px at 50% 35%, rgba(21,251,0,.10), transparent 60%),
    linear-gradient(180deg, rgba(0,0,0,.45), rgba(0,0,0,.72));
  box-shadow: inset 0 0 90px rgba(0,0,0,.75);
  pointer-events:none;
}

/* Your seam glow can stay */
.crypt-doors::after{
  content:"";
  position:absolute;
  top:0; bottom:0;
  left:50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(
    180deg,
    transparent,
    rgba(21,251,0,.75),
    rgba(21,251,0,.25),
    rgba(21,251,0,.75),
    transparent
  );
  box-shadow:
    0 0 16px rgba(21,251,0,.40),
    0 0 34px rgba(21,251,0,.22);
  opacity: .45;
  pointer-events:none;
  z-index: 2;
}

/* Smooth, slow mausoleum door open (no “stuck” phase) */
@keyframes cryptOpenLeftReal{
  0%   { transform: translateX(0) rotateY(0deg); filter: brightness(1); }
  50%  { transform: translateX(-55%) rotateY(10deg); filter: brightness(.92); }
  100% { transform: translateX(-110%) rotateY(14deg); filter: brightness(.85); }
}

@keyframes cryptOpenRightReal{
  0%   { transform: translateX(0) rotateY(0deg); filter: brightness(1); }
  50%  { transform: translateX(55%) rotateY(-10deg); filter: brightness(.92); }
  100% { transform: translateX(110%) rotateY(-14deg); filter: brightness(.85); }
}

/* Fade seam quickly once opening starts */
.crypt-gate.opening .crypt-doors::after{
  animation: seamFade .35s ease forwards;
}
@keyframes seamFade{ to{ opacity: 0; } }

/* Center seam + lock */
.crypt-seal{
  position:absolute;
  left:50%;
  top:50%;
  transform: translate(-50%,-50%);
  width: 64px;
  height: 64px;
  display:grid;
  place-items:center;
  border-radius: 999px;
  border: 2px solid rgba(21,251,0,.65);
  background: rgba(0,0,0,.75);
  box-shadow: 0 0 24px rgba(21,251,0,.22);
  z-index: 2;
}

.crypt-gate.opening .crypt-seal{
  animation:
    sealPulse .22s ease-in-out 1,
    cryptSeal 0.85s ease forwards; /* keep your existing fade */
}

@keyframes sealPulse{
  0%{ transform: translate(-50%,-50%) scale(1); }
  50%{ transform: translate(-50%,-50%) scale(1.06); }
  100%{ transform: translate(-50%,-50%) scale(1); }
}

/* Micro shake: heavy door unlock */
.crypt-gate.opening .crypt-doors{
  animation: none !important;
  transform-origin: 50% 50%;
}

@keyframes cryptShake{
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-2px); }
  40%  { transform: translateX(2px); }
  60%  { transform: translateX(-1px); }
  80%  { transform: translateX(1px); }
  100% { transform: translateX(0); }
}

/* OPEN ANIMATION: doors slide OUTWARD revealing the UI beneath */
.crypt-gate.opening .crypt-seal{
  animation: cryptSeal 0.85s ease forwards;
}
.crypt-gate.opening .crypt-scrim{
  animation: cryptScrim 2.8s ease forwards;
}
.crypt-gate.opening .crypt-title,
.crypt-gate.opening .crypt-actions{
  animation: cryptFade 1.6s ease forwards; /* fades earlier than full open */
}

@keyframes cryptSeal     { to { opacity:0; transform: translate(-50%,-50%) scale(.86); } }
@keyframes cryptScrim    { to { opacity: 0; } }
@keyframes cryptFade     { to { opacity: 0; } }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  .crypt-gate.opening .crypt-door.left,
  .crypt-gate.opening .crypt-door.right,
  .crypt-gate.opening .crypt-seal,
  .crypt-gate.opening .crypt-scrim,
  .crypt-gate.opening .crypt-title,
  .crypt-gate.opening .crypt-actions{ animation: none !important; }
}

/* ================================
   Messages Page Background (WOW)
   ================================ */
body.messages-page{
  background: #050605;
  background-image:
    radial-gradient(1200px 700px at 20% 15%, rgba(21,251,0,.10), transparent 60%),
    radial-gradient(900px 600px at 85% 35%, rgba(21,251,0,.07), transparent 60%),
    linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,.85));
  background-size: cover;
  background-position: center;
}

/* Fog layer */
body.messages-page::before{
  content:"";
  position: fixed;
  inset: -30%;
  pointer-events:none;
  z-index: 0;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.06), transparent 55%),
    radial-gradient(circle at 70% 55%, rgba(255,255,255,.05), transparent 60%),
    radial-gradient(circle at 45% 75%, rgba(255,255,255,.04), transparent 60%);
  filter: blur(18px);
  opacity: .55;
  animation: fogDrift 16s ease-in-out infinite;
}

/* Scanlines + vignette */
body.messages-page::after{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events:none;
  z-index: 0;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255,255,255,.03),
      rgba(255,255,255,.03) 1px,
      transparent 1px,
      transparent 4px
    ),
    radial-gradient(closest-side, transparent 60%, rgba(0,0,0,.75));
  opacity: .25;
  mix-blend-mode: overlay;
}

@keyframes fogDrift{
  0%{ transform: translate3d(-2%, -1%, 0) scale(1.02); }
  50%{ transform: translate3d(2%, 1%, 0) scale(1.04); }
  100%{ transform: translate3d(-2%, -1%, 0) scale(1.02); }
}

/* Make sure your UI sits above the background layers */
.messages-layout, .app-header, .app-footer{
  position: relative;
  z-index: 1;
}

/* Crypt gate must ALWAYS be above everything */
#cryptGate,
.crypt-gate{
  position: fixed !important;
  inset: 0;
  z-index: 2147483647 !important; /* "always on top" */
  pointer-events: auto;
}

/* --- FORCE header menus ABOVE the page UI --- */
.app-header {
  position: relative;
  z-index: 50000 !important;
  overflow: visible !important;
}

.header-right,
.user-menu {
  position: relative;
  z-index: 50001 !important;
}

.user-menu .dropdown { display: none; }
.user-menu.open .dropdown { display: block; }

/* keep chat header BELOW the header dropdown */
.chat-header {
  position: relative;
  z-index: 1 !important;
}

/* ===== FORCE SLOW CRYPT OPEN (wins over everything) ===== */
:root{
  --cryptOpenDur: 9.0s; /* <- make bigger if you want even slower */
  --cryptOpenEase: cubic-bezier(.06,.92,.12,1);
}

/* doors */
.crypt-gate.opening .crypt-door.left{
  animation: cryptOpenLeftReal var(--cryptOpenDur) var(--cryptOpenEase) forwards !important;
}
.crypt-gate.opening .crypt-door.right{
  animation: cryptOpenRightReal var(--cryptOpenDur) var(--cryptOpenEase) forwards !important;
}

/* sync the other fades so they don’t “finish early” */
.crypt-gate.opening .crypt-scrim{
  animation: cryptScrim var(--cryptOpenDur) ease forwards !important;
}
.crypt-gate.opening .crypt-title,
.crypt-gate.opening .crypt-actions{
  animation: cryptFade 2.8s ease forwards !important;
}
.crypt-gate.opening .crypt-doors::after{
  animation: seamFade 1.2s ease forwards !important;
}

/* FINAL: Smooth slow open (no "stuck") */
@keyframes cryptOpenLeftReal{
  0%   { transform: translateX(0) rotateY(0deg); filter: brightness(1); }
  100% { transform: translateX(-110%) rotateY(14deg); filter: brightness(.85); }
}

@keyframes cryptOpenRightReal{
  0%   { transform: translateX(0) rotateY(0deg); filter: brightness(1); }
  100% { transform: translateX(110%) rotateY(-14deg); filter: brightness(.85); }
}

/* ✅ Bond Ritual transcript card */
.bond-row{
  display:flex;
  justify-content:center;
  margin: 14px 0;
}
.bond-card{
  width: min(760px, 100%);
  border: 1px solid rgba(21,251,0,.55);
  background: rgba(0,0,0,.45);
  border-radius: 16px;
  padding: 14px 14px 10px;
  box-shadow: 0 0 18px rgba(21,251,0,.18);
}
.bond-title{
  font-weight: 900;
  letter-spacing: .08em;
  color: #eaffea;
  margin-bottom: 4px;
}
.bond-sub{
  font-size: 12px;
  opacity: .85;
  margin-bottom: 10px;
  color: rgba(21,251,0,.9);
}
.bond-q{
  border-radius: 12px;
  padding: 10px 12px;
  margin: 10px 0;
  background: rgba(21,251,0,.06);
  border: 1px solid rgba(21,251,0,.18);
}
.bond-qtext{
  font-weight: 800;
  margin-bottom: 6px;
}
.bond-a{
  display:flex;
  gap: 8px;
  margin-top: 6px;
  opacity: .95;
}
.bond-who{
  min-width: 70px;
  color: rgba(21,251,0,.95);
  font-weight: 900;
}
.bond-time{
  font-size: 11px;
  opacity: .75;
  margin-top: 10px;
}
.bond-empty{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(21,251,0,.35);
  opacity: .9;
}


/* =========================================================
   SIMPLIFIED INBOX: show ONLY avatar + username
   ========================================================= */
.drawer-tabs, .morgue-bar { display: none !important; }

/* Thread row: avatar + name only */
.thread-meta p,
.thread-meta .thread-time,
.thread-time,
.badge,
.thread-stamp { display:none !important; }

.thread-item{
  padding: 12px 12px !important;
}

.thread-item img{
  width: 46px !important;
  height: 46px !important;
}

.thread-meta h4{
  font-size: 15px !important;
  letter-spacing: .02em;
}

/* Unread: subtle glow (no numbers) */
.thread-item.unread{
  box-shadow: 0 0 10px rgba(21,251,0,.18);
}

/* =========================
   Messenger-like upgrades (2026-02-13)
   ========================= */

.sr-only{
  position:absolute !important;
  width:1px;height:1px;
  padding:0;margin:-1px;
  overflow:hidden;clip:rect(0,0,0,0);
  white-space:nowrap;border:0;
}

.thread-search{
  padding: 10px 12px 14px;
}
.thread-search input{
  width: 100%;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid rgba(21,251,0,0.35);
  background: rgba(0,0,0,0.35);
  color: #fff;
  outline: none;
}
.thread-search input::placeholder{ color: rgba(255,255,255,0.55); }

/* Chat header back button (mobile) */
.chat-back{
  display:none;
  align-items:center;
  justify-content:center;
  width:42px;height:42px;
  border-radius:999px;
  border:1px solid rgba(21,251,0,0.35);
  background: rgba(0,0,0,0.35);
  color:#15fb00;
  font-size:20px;
  cursor:pointer;
}

/* Composer: Messenger-ish row */
.chat-input{
  display:flex;
  align-items:center;
  gap:10px;
}
.chat-input .input-wrap{
  flex:1;
  display:flex;
  align-items:center;
  gap:8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(21,251,0,0.35);
  background: rgba(0,0,0,0.35);
}
.chat-input .input-wrap input{
  flex:1;
  border:none;
  outline:none;
  background:transparent;
  color:#fff;
  padding:0;
  min-width: 0;
}
.chat-input .icon-btn{
  width:44px;height:44px;
  border-radius:999px;
  border:1px solid rgba(21,251,0,0.35);
  background: rgba(0,0,0,0.25);
  color:#15fb00;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
}
.chat-input .icon-btn.inside{
  width:38px;height:38px;
  border: none;
  background: transparent;
}
.chat-input .send-btn{
  min-width: 74px;
  height: 44px;
  border-radius: 999px;
  border:1px solid #15fb00;
  background:#15fb00;
  color:#000;
  font-weight:900;
  cursor:pointer;
}
.chat-input .icon-btn:disabled,
.chat-input .send-btn:disabled{
  opacity:.5;
  cursor:not-allowed;
}

/* Toast */
.ddd-toast{
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  transition: all .2s ease;
  z-index: 99999;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(21,251,0,0.55);
  background: rgba(0,0,0,0.85);
  color: #fff;
  font-weight: 800;
  pointer-events: none;
}
.ddd-toast.show{
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* Emoji panel */
.emoji-panel{
  position: fixed;
  width: 270px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(21,251,0,0.55);
  background: rgba(0,0,0,0.92);
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  z-index: 99998;
}
.emoji-panel.hidden{ display:none; }
.emoji-panel .emoji-btn{
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(21,251,0,0.15);
  background: rgba(255,255,255,0.06);
  cursor:pointer;
  font-size: 18px;
  line-height: 1;
}

/* =========================================================
   Composer v3 — mobile-friendly (Mic + Plus + Input + Send)
   ========================================================= */
.messages-page .chat{ position:relative; }

.messages-page .chat-input{
  position: sticky;
  bottom: 0;
  z-index: 50;
  background: rgba(0,0,0,0.70);
  backdrop-filter: blur(10px);
  align-items: center;
  gap: 10px;
  padding: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

.messages-page .chat-input .icon-btn{
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0b0b0b;
  border: 1px solid rgba(255,255,255,.18);
  color: #15fb00;
  flex: 0 0 auto;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.messages-page #plusBtn{ font-size: 24px; }

.messages-page .input-wrap{
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}

.messages-page #messageInput{
  width: 100%;
  height: 42px;
  border-radius: 999px;
  padding: 0 44px 0 14px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(11,11,11,.95);
  color: #fff;
}

.messages-page #emojiBtn.inside{
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 0;
  background: transparent;
}

.messages-page .send-btn{
  height: 42px;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 800;
  background: #15fb00;
  color: #000;
  border: 0;
  flex: 0 0 auto;
}

/* + Tray */
.messages-page .plus-panel{
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(100% + 10px);
  background: rgba(0,0,0,0.94);
  border: 1px solid rgba(21,251,0,.55);
  border-radius: 16px;
  padding: 10px;
  display: flex;
  gap: 10px;
  justify-content: space-around;
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
}
.messages-page .plus-panel.hidden{ display:none; }

.messages-page .plus-item{
  flex: 1;
  background: rgba(20,20,20,0.82);
  border: 1px solid rgba(255,255,255,0.14);
  color: #eaffea;
  border-radius: 14px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}
.messages-page .plus-item .ico{ font-size: 18px; line-height: 1; }
.messages-page .plus-item .label{ font-size: 12px; opacity: .85; letter-spacing: .04em; }

/* Prevent footer from fighting the composer on mobile */
@media (max-width: 820px){
  .messages-page .app-footer{ display:none; }
  .messages-layout{ padding: 0 !important; gap: 0 !important; }
  .messages-page .threads,
  .messages-page .chat{ border-radius: 0 !important; }
  .messages-page .chat-history{ padding-bottom: 110px; }
}

/* -------------------------
   Icebreaker modal
------------------------- */
.ice-modal{
  position: fixed;
  inset: 0;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,0.65);
  z-index: 9999;
  padding: 16px;
}
.ice-modal.hidden{ display:none; }
.ice-card{
  width: min(520px, 100%);
  background: rgba(0,0,0,0.88);
  border: 1px solid rgba(21,251,0,0.35);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.6);
}
.ice-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.ice-title{ margin:0; font-size:18px; }
.ice-x{
  background: transparent;
  border: 0;
  color: #15fb00;
  font-size: 20px;
  cursor: pointer;
}
.ice-sub{ margin:8px 0 10px; opacity:.85; font-size: 13px; font-family: system-ui, sans-serif; }
.ice-select{
  width: 100%;
  background: rgba(255,255,255,0.06);
  color: #fff;
  border: 1px solid rgba(21,251,0,0.25);
  border-radius: 12px;
  padding: 10px;
  font-family: system-ui, sans-serif;
}
.ice-actions{ display:flex; gap:10px; justify-content:flex-end; margin-top:12px; }
.ice-btn{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(21,251,0,0.35);
  background: rgba(21,251,0,0.12);
  color: #fff;
  font-family: system-ui, sans-serif;
  cursor: pointer;
}
.ice-btn.primary{ background: rgba(21,251,0,0.22); }

/* =========================================
   FINAL messages layout — single source
   ========================================= */

/* Desktop */
.messages-page .messages-layout{
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  height: calc(100vh - 140px);
  min-height: 0;
  align-items: stretch;
}

.messages-page .threads{
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.messages-page .drawer-panel{
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.messages-page .thread-list{
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 18px;
}

.messages-page .chat{
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.messages-page .chat-history{
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 16px;
}

.messages-page .chat-input{
  flex: 0 0 auto;
}

/* Header layout */
.messages-page .chat-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.messages-page .chat-peer{
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.messages-page .chat-peer > div{
  min-width: 0;
}

.messages-page .peer-name{
  display: block;
  min-width: 0;
  margin: 0;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messages-page .chat-actions{
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

/* Mobile */
@media (max-width: 820px){
  .messages-page .messages-layout{
    display: block !important;
    height: auto !important;
    min-height: auto !important;
    padding: 0 !important;
    gap: 0 !important;
  }

  .messages-page .threads,
  .messages-page .chat{
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    border-radius: 0 !important;
  }

  body.messages-page:not(.chat-open) .chat{
    display: none !important;
  }

  body.messages-page.chat-open .threads{
    display: none !important;
  }

  body.messages-page.chat-open .chat{
    display: flex !important;
    flex-direction: column;
    min-height: calc(100dvh - 235px);
    overflow: hidden;
  }

  .messages-page .drawer-panel{
    height: auto;
    overflow: visible;
  }

  .messages-page .thread-list{
    height: auto;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .messages-page .thread-list::-webkit-scrollbar{
    width: 0;
    height: 0;
    display: none;
  }

  .messages-page .chat-history{
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 110px;
  }

  .messages-page .chat-header{
    flex-wrap: wrap;
    align-items: center;
  }

  .messages-page .chat-actions{
    width: 100%;
    justify-content: center;
  }

  .messages-page .chat-back{
    display: none;
  }

  body.messages-page.chat-open .chat-back{
    display: inline-flex !important;
  }

  .messages-page .app-footer{
    display: none !important;
  }
}

@media (min-width: 821px){
  .messages-page .thread-list{
    scrollbar-width: thin;
    scrollbar-color: rgba(21,251,0,0.45) rgba(255,255,255,0.06);
  }

  .messages-page .thread-list::-webkit-scrollbar{
    width: 12px;
  }

  .messages-page .thread-list::-webkit-scrollbar-thumb{
    background: rgba(21,251,0,0.45);
    border-radius: 999px;
    border: 2px solid rgba(0,0,0,0.45);
  }

  .messages-page .thread-list::-webkit-scrollbar-track{
    background: rgba(255,255,255,0.06);
    border-radius: 999px;
  }
}
