/* —— guez.io confirm / alert / prompt dialogs —— */
.pm-dialog[hidden] { display: none !important; }
.pm-dialog {
  position: fixed;
  inset: 0;
  z-index: 13000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.pm-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}
.pm-dialog__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 22rem;
  border: 1px solid #3f3f46;
  background: #18181b;
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.85);
  padding: 1rem 1.1rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.pm-dialog__title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #f4f4f5;
  letter-spacing: 0.01em;
}
.pm-dialog__message {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #a1a1aa;
}
.pm-dialog__message[hidden] { display: none !important; }
.pm-dialog__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.pm-dialog__field[hidden] { display: none !important; }
.pm-dialog__input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #3f3f46;
  background: #09090b;
  color: #e4e4e7;
  font-size: 1rem; /* no iOS zoom */
  padding: 0.5rem 0.6rem;
  outline: none;
}
.pm-dialog__input:focus {
  border-color: rgba(52, 211, 153, 0.55);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.18);
}
.pm-dialog__hint {
  margin: 0;
  font-size: 0.6875rem;
  color: #71717a;
}
.pm-dialog__hint[hidden] { display: none !important; }
.pm-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-top: 0.25rem;
}
.pm-dialog__btn {
  border: 1px solid #3f3f46;
  background: #09090b;
  color: #e4e4e7;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  min-height: 2rem;
}
.pm-dialog__btn--ghost:hover {
  border-color: #52525b;
  color: #fff;
}
.pm-dialog__btn--primary {
  border-color: rgba(16, 185, 129, 0.45);
  background: #059669;
  color: #fff;
}
.pm-dialog__btn--primary:hover {
  background: #10b981;
}
.pm-dialog__btn--danger {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(185, 28, 28, 0.9);
  color: #fff;
}
.pm-dialog__btn--danger:hover {
  background: rgba(220, 38, 38, 0.95);
}
.pm-dialog__btn:focus-visible {
  outline: 2px solid rgba(52, 211, 153, 0.45);
  outline-offset: 2px;
}

.avail-pm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9999px;
  background: transparent;
  color: #a1a1aa;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.avail-pm-btn i {
  font-size: 1.5rem;
  line-height: 1;
}
.avail-pm-btn:hover {
  color: #6ee7b7;
  border-color: #3f3f46;
  background: rgba(16, 185, 129, 0.08);
}
.pm-modal[hidden] { display: none !important; }
.pm-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  /* Filled by visualViewport handler when the mobile keyboard opens */
  --pm-keyboard-inset: 0px;
  --pm-vv-height: 100dvh;
}
.pm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}
.pm-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 28rem;
  max-height: min(32rem, 90vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #3f3f46;
  background: #18181b;
  box-shadow: 0 24px 48px -20px rgba(0, 0, 0, 0.85);
}
/* Mobile: true full-screen chat — solid shell, no leaderboard peek-through */
@media (max-width: 639px) {
  .pm-modal {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
    /* Geometry is set in JS to match visualViewport; fallback covers full screen */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    background: #09090b;
    overscroll-behavior: none;
    touch-action: none;
  }
  .pm-modal__backdrop {
    background: #09090b;
    /* Extra coverage in case of sub-pixel gaps around the keyboard */
    top: -20vh;
    bottom: -20vh;
    left: -10vw;
    right: -10vw;
  }
  .pm-modal__panel {
    max-width: none;
    width: 100%;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    border: none;
    box-shadow: none;
    border-radius: 0;
    background: #18181b;
    /* Allow internal scrolling only */
    touch-action: pan-y;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .pm-modal__thread {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }
  .pm-modal__compose {
    background: #18181b;
    /* Keep compose above any residual gap */
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    /* Allow taps on emoji grid / buttons (parent .pm-modal is touch-action: none) */
    touch-action: manipulation;
  }
  .pm-modal__picker,
  .pm-modal__emoji-grid,
  .pm-modal__emoji-item,
  .pm-modal__emoji-tab,
  .pm-modal__toolbar,
  .pm-modal__tool {
    touch-action: manipulation;
    pointer-events: auto;
  }
  html.pm-chat-open,
  html.pm-chat-open body,
  body.pm-chat-open {
    overflow: hidden !important;
    overscroll-behavior: none !important;
    touch-action: none;
    /* iOS: body is position:fixed via JS — prevent rubber-band */
    height: 100% !important;
    max-height: 100% !important;
  }
  /* 16px inputs prevent iOS auto-zoom on focus */
  .pm-modal__input,
  .pm-modal__search,
  .pm-modal__gif-search,
  .pm-notifications__search {
    font-size: 16px !important;
  }
}
@media (min-width: 640px) {
  .pm-modal__panel {
    max-width: 40rem;
    max-height: min(38rem, 90vh);
  }
}
.pm-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #27272a;
}
.pm-modal__title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #f4f4f5;
  min-width: 0;
  flex: 1;
}
.pm-modal__title-name {
  font-weight: 600;
}
.pm-modal__presence {
  flex-shrink: 0;
  padding: 0.2rem 1rem 0.45rem;
  font-size: 0.75rem;
  line-height: 1.2;
  color: #71717a;
  border-bottom: 1px solid #27272a;
  min-height: 1.25rem;
}
.pm-modal__presence--online {
  color: #6ee7b7;
}
.pm-modal__presence--online::before {
  content: '';
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: #34d399;
  margin-right: 0.4rem;
  vertical-align: middle;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.25);
}
.pm-modal__presence--typing {
  color: #a5b4fc;
  font-style: italic;
}
.pm-modal__presence--offline {
  color: #52525b;
}
.pm-modal__head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.pm-modal__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid #3f3f46;
  border-radius: 0;
  background: rgba(9, 9, 11, 0.9);
  color: #a1a1aa;
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}
.pm-modal__icon-btn i {
  font-size: 0.75rem;
  line-height: 1;
}
.pm-modal__icon-btn:hover {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(16, 185, 129, 0.08);
  color: #6ee7b7;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.18);
}
.pm-modal__icon-btn:focus-visible {
  outline: 2px solid rgba(52, 211, 153, 0.45);
  outline-offset: 2px;
}
.pm-modal__icon-btn[data-pm-clear]:hover {
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(127, 29, 29, 0.22);
  color: #fecaca;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.14);
}
/* Overflow menu (Block lives here to avoid accidental taps) */
.pm-modal__more {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.pm-modal__more-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 5;
  min-width: 9.5rem;
  border: 1px solid #3f3f46;
  background: #18181b;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  padding: 0.25rem 0;
}
.pm-modal__more-menu[hidden] { display: none !important; }
.pm-modal__more-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #e4e4e7;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
}
.pm-modal__more-item:hover {
  background: rgba(39, 39, 42, 0.85);
}
.pm-modal__more-item--danger {
  color: #fca5a5;
}
.pm-modal__more-item--danger:hover {
  background: rgba(127, 29, 29, 0.28);
  color: #fecaca;
}
/* Legacy block styles (kept if old markup still cached briefly) */
.pm-modal__block {
  display: none !important;
}
/* Close = same icon-btn frame; glyph via FA xmark (matches archive/clear centering) */
.pm-modal__close {
  /* inherits .pm-modal__icon-btn; no extra font-size that throws off the × */
  flex-shrink: 0;
}
@media (max-width: 639px) {
  .pm-modal__head-actions {
    align-items: center;
  }
  .pm-modal__icon-btn {
    width: 2rem;
    height: 2rem;
  }
}
.pm-modal__thread {
  flex: 1;
  min-height: 10rem;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color-scheme: dark;
  scrollbar-width: thin;
  scrollbar-color: #27272a #09090b;
}
.pm-modal__thread::-webkit-scrollbar {
  width: 10px;
}
.pm-modal__thread::-webkit-scrollbar-track {
  background: #09090b !important;
  border-radius: 0 !important;
}
.pm-modal__thread::-webkit-scrollbar-thumb {
  background-color: #18181b !important;
  background-image: none !important;
  border-radius: 0 !important;
  border: 1px solid #3f3f46;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.pm-modal__thread::-webkit-scrollbar-thumb:hover {
  background-color: #0a0a0a !important;
  border-color: rgba(52, 211, 153, 0.85) !important;
  box-shadow:
    0 0 0 1px rgba(16, 185, 129, 0.3),
    0 0 14px rgba(16, 185, 129, 0.35) !important;
}
.pm-modal__thread::-webkit-scrollbar-corner {
  background: #09090b;
}
.pm-modal__empty {
  margin: auto 0;
  text-align: center;
  font-size: 0.8125rem;
  color: #71717a;
}
.pm-bubble {
  position: relative;
  width: fit-content;
  max-width: min(72%, 18rem);
  padding: 0.4rem 0.55rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  word-break: break-word;
}
@media (min-width: 640px) {
  .pm-bubble {
    max-width: min(62%, 20rem);
  }
}
.pm-bubble--mine {
  align-self: flex-end;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #d1fae5;
}
.pm-bubble--theirs {
  align-self: flex-start;
  background: #09090b;
  border: 1px solid #3f3f46;
  color: #e4e4e7;
}
.pm-bubble--unread {
  border-color: rgba(96, 165, 250, 0.45);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.12);
}
.pm-bubble--theirs.pm-bubble--unread {
  background: rgba(30, 58, 138, 0.12);
}
.pm-bubble__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-top: 0.3rem;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(63, 63, 70, 0.45);
}
.pm-bubble--mine .pm-bubble__foot {
  border-top-color: rgba(16, 185, 129, 0.22);
}
.pm-bubble__meta {
  display: block;
  font-size: 0.75rem;
  line-height: 1.35;
  color: #a1a1aa;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
.pm-bubble--mine .pm-bubble__meta {
  color: rgba(167, 243, 208, 0.82);
}
.pm-bubble__unread-tag {
  color: #93c5fd;
  font-weight: 600;
  font-size: 0.75rem;
}
.pm-bubble__mark-unread {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 0.25rem;
  background: transparent;
  color: #71717a;
  cursor: pointer;
  font-size: 0.7rem;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.pm-bubble:hover .pm-bubble__mark-unread,
.pm-bubble__mark-unread:focus-visible {
  opacity: 1;
}
.pm-bubble__mark-unread:hover {
  color: #93c5fd;
  border-color: #3f3f46;
  background: rgba(39, 39, 42, 0.65);
}
.pm-modal__compose {
  flex-shrink: 0;
  border-top: 1px solid #27272a;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
}
.pm-modal__toolbar {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: wrap;
}
.pm-modal__tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 0.25rem;
  background: transparent;
  color: #a1a1aa;
  cursor: pointer;
  font-size: 0.75rem;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.pm-modal__tool:hover:not(:disabled) {
  color: #e4e4e7;
  border-color: #3f3f46;
  background: rgba(39, 39, 42, 0.65);
}
.pm-modal__tool:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pm-modal__tool--active {
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(16, 185, 129, 0.12);
}
.pm-modal__tool--recording {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(127, 29, 29, 0.28);
  animation: pm-pulse-rec 1.1s ease-in-out infinite;
}
@keyframes pm-pulse-rec {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}
.pm-bubble__body {
  display: block;
  white-space: pre-wrap;
}
.pm-bubble__body strong { font-weight: 700; }
.pm-bubble__body em { font-style: italic; }
.pm-bubble__body s { text-decoration: line-through; opacity: 0.88; }
.pm-bubble__code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78em;
  padding: 0.05rem 0.25rem;
  border-radius: 0.2rem;
  background: rgba(0, 0, 0, 0.28);
}
.pm-bubble--mine .pm-bubble__code {
  background: rgba(0, 0, 0, 0.22);
}
.pm-modal__input {
  width: 100%;
  box-sizing: border-box;
  height: 4.5rem;
  max-height: 4.5rem;
  resize: none !important;
  overflow-y: auto;
  background: #09090b;
  border: 1px solid #3f3f46;
  padding: 0.55rem 0.65rem;
  /* ≥16px on mobile via media query; desktop keeps compact look */
  font-size: 1rem;
  color: #e4e4e7;
  color-scheme: dark;
  scrollbar-width: thin;
  scrollbar-color: #27272a #09090b;
  /* Avoid browser zoom / text-size adjust quirks */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
@media (min-width: 640px) {
  .pm-modal__input {
    font-size: 0.8125rem;
  }
}
.pm-modal__input::-webkit-scrollbar {
  width: 10px;
}
.pm-modal__input::-webkit-scrollbar-track {
  background: #09090b !important;
  border-radius: 0 !important;
}
.pm-modal__input::-webkit-scrollbar-thumb {
  background-color: #18181b !important;
  background-image: none !important;
  border-radius: 0 !important;
  border: 1px solid #3f3f46;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.pm-modal__input::-webkit-scrollbar-thumb:hover {
  background-color: #0a0a0a !important;
  border-color: rgba(52, 211, 153, 0.85) !important;
  box-shadow:
    0 0 0 1px rgba(16, 185, 129, 0.3),
    0 0 14px rgba(16, 185, 129, 0.35) !important;
}
.pm-modal__input::-webkit-scrollbar-corner {
  background: #09090b;
}
.pm-modal__input:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.25);
}
.pm-modal__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.pm-modal__counter {
  font-size: 0.6875rem;
  color: #52525b;
  font-variant-numeric: tabular-nums;
}
.pm-modal__send {
  padding: 0.4rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: #059669;
  border: none;
  color: #fff;
  cursor: pointer;
}
.pm-modal__send:hover { background: #10b981; }
.pm-modal__send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.blocked-users-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.blocked-users-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #27272a;
  background: #09090b;
}
.blocked-users-list__meta { font-size: 0.875rem; min-width: 0; }
.blocked-users-list__char { font-weight: 600; color: #f4f4f5; }
.blocked-users-list__unblock {
  border: 1px solid #3f3f46;
  background: transparent;
  color: #a1a1aa;
  cursor: pointer;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  border-radius: 0.25rem;
  flex-shrink: 0;
}
.blocked-users-list__unblock:hover { border-color: #52525b; color: #e4e4e7; }

.pm-modal__error {
  margin: 0;
  font-size: 0.75rem;
  color: #f87171;
}

.pm-modal__toolbar-sep {
  width: 1px;
  height: 1.1rem;
  margin: 0 0.15rem;
  background: #3f3f46;
  align-self: center;
}
.pm-modal__file { display: none !important; }
.pm-modal__attach-preview {
  padding: 0.35rem 0 0;
  max-height: 7rem;
  overflow: auto;
  flex-shrink: 0;
}
.pm-modal__attach-preview[hidden] { display: none !important; }
.pm-modal__attach-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.55rem;
  border: 1px solid #3f3f46;
  background: #09090b;
  min-height: 4.5rem;
}
.pm-modal__attach-thumb {
  width: 4.5rem;
  height: 4.5rem;
  object-fit: cover;
  border: 1px solid #27272a;
  background: #000;
  flex-shrink: 0;
  display: block;
}
/* Mobile: compact attachment so the text field stays visible above the keyboard */
@media (max-width: 767px) {
  .pm-modal__compose {
    /* Compose stays a compact column: preview → input always visible */
    max-height: min(46dvh, 22rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .pm-modal__attach-preview {
    max-height: 4.25rem;
    padding-top: 0.15rem;
    order: -1; /* keep preview above tools/input; still in flow */
  }
  .pm-modal__attach-card {
    min-height: 0;
    padding: 0.35rem 0.45rem;
    gap: 0.45rem;
  }
  .pm-modal__attach-thumb {
    width: 2.75rem;
    height: 2.75rem;
  }
  .pm-modal__attach-name {
    font-size: 0.75rem;
  }
  .pm-modal__attach-size {
    display: none;
  }
  .pm-modal__input {
    /* Prefer a shorter field when a media is attached so typing stays on-screen */
    height: 3.25rem;
    max-height: 3.25rem;
    flex-shrink: 0;
  }
  .pm-modal__compose:has(.pm-modal__attach-preview:not([hidden])) .pm-modal__input {
    height: 2.85rem;
    max-height: 2.85rem;
  }
}
.pm-modal__attach-thumb--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #71717a;
  font-size: 1.25rem;
}
.pm-modal__attach-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}
.pm-modal__attach-name {
  font-size: 0.8125rem;
  color: #e4e4e7;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.pm-modal__attach-size {
  font-size: 0.6875rem;
  color: #71717a;
}
.pm-modal__attach-remove {
  border: 0;
  padding: 0;
  background: none;
  color: #fca5a5;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.pm-modal__attach-remove:hover { color: #fecaca; text-decoration: underline; }
.pm-modal__attach-audio {
  width: min(14rem, 70vw);
  max-width: 100%;
  height: 2.25rem;
}
.pm-modal__attach-once-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fbbf24;
  cursor: pointer;
  user-select: none;
  margin-top: 0.1rem;
}
.pm-modal__attach-once-toggle input {
  accent-color: #f59e0b;
  width: 0.95rem;
  height: 0.95rem;
  margin: 0;
  cursor: pointer;
}
.pm-modal__tool[data-pm-ephemeral][hidden] {
  display: none !important;
}

/* Fullscreen view-once viewer */
.pm-ephemeral-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(0, 0, 0, 0.94);
  display: flex;
  flex-direction: column;
  touch-action: none;
}
.pm-ephemeral-overlay__bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
  color: #fde68a;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pm-ephemeral-overlay__close {
  border: 0;
  background: transparent;
  color: #e4e4e7;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
}
.pm-ephemeral-overlay__stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem 1.25rem;
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
}
.pm-ephemeral-overlay__media {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #000;
}
.pm-ephemeral-overlay__loading {
  color: #a1a1aa;
  font-size: 0.875rem;
}
.pm-bubble__once-loading {
  color: #a1a1aa;
  font-size: 0.75rem;
  padding: 0.5rem;
}
.pm-bubble__media {
  position: relative;
  margin: 0 0 0.35rem;
  overflow: hidden;
  border: 1px solid rgba(63, 63, 70, 0.85);
  background: #000;
  max-width: min(16rem, 72vw);
}
.pm-bubble--mine .pm-bubble__media {
  border-color: rgba(16, 185, 129, 0.35);
}
.pm-bubble__media--audio {
  background: transparent;
  border-color: transparent;
  max-width: min(18rem, 80vw);
  padding: 0.15rem 0;
}
.pm-bubble--mine .pm-bubble__media--audio {
  border-color: transparent;
}
.pm-bubble__audio {
  display: block;
  width: 100%;
  max-width: 16rem;
  height: 2.4rem;
}
.pm-bubble__media--once,
.pm-bubble__media--expired {
  background: rgba(9, 9, 11, 0.95);
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem;
}
.pm-bubble__once-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  border: 1px dashed rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.06);
  color: #fde68a;
  cursor: pointer;
  padding: 0.75rem 0.6rem;
  font-size: 0.8125rem;
  font-weight: 600;
}
.pm-bubble__once-btn:hover {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.7);
}
.pm-bubble__once-hint {
  font-size: 0.6875rem;
  font-weight: 500;
  color: #a1a1aa;
}
.pm-bubble__once-label {
  font-size: 0.75rem;
  color: #71717a;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.pm-bubble__once-timer {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 2;
  min-width: 1.75rem;
  padding: 0.15rem 0.35rem;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fde68a;
  font-size: 0.6875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  pointer-events: none;
}
.pm-bubble__image,
.pm-bubble__video {
  display: block;
  width: 100%;
  max-height: 16rem;
  object-fit: contain;
  background: #000;
  vertical-align: middle;
}
.pm-bubble__image-link {
  display: block;
  line-height: 0;
}
.pm-bubble__body + .pm-bubble__foot,
.pm-bubble__media + .pm-bubble__body {
  margin-top: 0.15rem;
}

.pm-bubble__actions {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}
.pm-bubble__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: #71717a;
  cursor: pointer;
  border-radius: 0;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.pm-bubble__action i { font-size: 0.7rem; }
.pm-bubble__action:hover {
  color: #e4e4e7;
  border-color: #3f3f46;
  background: rgba(39, 39, 42, 0.65);
}
.pm-bubble__action--danger:hover {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(127, 29, 29, 0.22);
}
.pm-bubble__mark-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: #71717a;
  cursor: pointer;
}

/* Voice hold-to-record — kill iOS loupe / callout / selection */
.pm-modal__toolbar,
.pm-modal__tool--voice,
.pm-modal__tool--voice * {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-tap-highlight-color: transparent;
}
.pm-modal__tool--voice {
  touch-action: none;
  -webkit-user-drag: none;
}
.pm-modal__tool--voice.pm-modal__tool--recording {
  transform: scale(1.12);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.65);
  background: rgba(127, 29, 29, 0.35);
}
.pm-modal__tool--voice.pm-modal__tool--cancel {
  color: #a1a1aa;
  border-color: #52525b;
  background: rgba(39, 39, 42, 0.8);
  animation: none;
}
.pm-modal__tool-gif {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
}

.pm-modal__record-hud {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(127, 29, 29, 0.18);
  color: #fecaca;
  font-size: 0.8125rem;
}
.pm-modal__record-hud[hidden] { display: none !important; }
.pm-modal__record-hud--cancel {
  border-color: #52525b;
  background: rgba(39, 39, 42, 0.65);
  color: #a1a1aa;
}
.pm-modal__record-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 9999px;
  background: #ef4444;
  flex-shrink: 0;
  animation: pm-pulse-rec 1.1s ease-in-out infinite;
}
.pm-modal__record-hud--cancel .pm-modal__record-dot {
  background: #71717a;
  animation: none;
}
.pm-modal__record-time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  min-width: 2.5rem;
}
.pm-modal__record-hint {
  margin-left: auto;
  font-size: 0.75rem;
  color: inherit;
  opacity: 0.9;
}

/* Emoji / GIF pickers */
.pm-modal__picker {
  border: 1px solid #3f3f46;
  background: #09090b;
  max-height: 14rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.pm-modal__picker[hidden] { display: none !important; }
.pm-modal__picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid #27272a;
  flex-shrink: 0;
}
.pm-modal__picker-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #a1a1aa;
}
.pm-modal__picker-close {
  border: 0;
  background: transparent;
  color: #71717a;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.1rem 0.25rem;
}
.pm-modal__picker-close:hover { color: #e4e4e7; }
.pm-modal__picker-empty {
  margin: 0;
  padding: 1rem 0.75rem;
  text-align: center;
  font-size: 0.8125rem;
  color: #71717a;
}

.pm-modal__emoji-tabs {
  display: flex;
  gap: 0.15rem;
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid #27272a;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}
.pm-modal__emoji-tabs::-webkit-scrollbar { display: none; }
.pm-modal__emoji-tab {
  border: 1px solid transparent;
  background: transparent;
  width: 1.85rem;
  height: 1.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 0.25rem;
  flex-shrink: 0;
}
.pm-modal__emoji-tab:hover { background: rgba(39, 39, 42, 0.75); }
.pm-modal__emoji-tab.is-active {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(16, 185, 129, 0.1);
}
.pm-modal__emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.1rem;
  padding: 0.35rem;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}
.pm-modal__emoji-item {
  border: 0;
  background: transparent;
  font-size: 1.25rem;
  line-height: 1.4;
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 0.25rem;
  /* Ensure taps register on the button (not only the glyph) */
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: auto;
  z-index: 1;
  position: relative;
  -webkit-tap-highlight-color: rgba(52, 211, 153, 0.25);
}
.pm-modal__emoji-item:hover,
.pm-modal__emoji-item:active {
  background: rgba(39, 39, 42, 0.85);
}
/* Flash when an emoji was successfully inserted into the composer */
.pm-modal__input.pm-modal__input--emoji-flash {
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.75);
  border-color: rgba(52, 211, 153, 0.85);
}
.pm-modal__emoji-grid {
  pointer-events: auto;
  touch-action: pan-y;
}
.pm-modal__picker {
  pointer-events: auto;
  position: relative;
  z-index: 3;
}

.pm-modal__gif-search-wrap {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #27272a;
  flex-shrink: 0;
}
.pm-modal__gif-search {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #3f3f46;
  background: #18181b;
  color: #e4e4e7;
  font-size: 1rem; /* no iOS zoom */
  padding: 0.4rem 0.5rem;
  outline: none;
}
@media (min-width: 640px) {
  .pm-modal__gif-search { font-size: 0.8125rem; }
}
.pm-modal__gif-search:focus {
  border-color: rgba(52, 211, 153, 0.55);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.18);
}
.pm-modal__gif-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem;
  padding: 0.35rem;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}
.pm-modal__gif-item {
  border: 1px solid #27272a;
  background: #000;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 1;
}
.pm-modal__gif-item:hover {
  border-color: rgba(52, 211, 153, 0.55);
}
.pm-modal__gif-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pm-modal__gif-credit {
  margin: 0;
  padding: 0.25rem 0.5rem 0.4rem;
  font-size: 0.625rem;
  color: #52525b;
  text-align: right;
  flex-shrink: 0;
}

@media (max-width: 639px) {
  .pm-modal__picker {
    max-height: min(40dvh, 16rem);
  }
  .pm-modal__emoji-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}
