/* ==========================================================================
   Anonymous chat (shares sidebar/thread/composer styles with AI chat)
   ========================================================================== */
.page--chat { overflow: hidden; background: var(--paper); }
.chat {
  height: 100%;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr) 0px;
  transition: grid-template-columns .6s var(--ease-out);
}
.chat.info-open { grid-template-columns: 330px minmax(0, 1fr) 300px; }

/* Sidebar ------------------------------------------------------------------ */
.chat__side, .ai__side {
  display: flex; flex-direction: column; gap: 14px;
  min-height: 0;
  padding: 22px 18px 16px;
  border-right: var(--bw) solid var(--ink);
  background: var(--paper);
}
.side__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 10px; }
.side__head h1 { font-size: 40px; }
@media (max-width: 379px) { .side__head h1 { font-size: 34px; } }
.side__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side__actions .btn { padding: 0 10px; }
.side__lists { flex: 1; min-height: 0; overflow: hidden; margin: 0 -18px; }
.side__track {
  display: grid; grid-template-columns: 50% 50%;
  width: 200%; height: 100%;
  transition: transform .7s var(--ease-spring-soft);
}
.side__track[data-tab="dms"] { transform: translateX(-50%); }
.convo-list { overflow-y: auto; padding: 2px 12px 12px; display: grid; align-content: start; gap: 4px; }
.convo {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px;
  border-radius: 14px;
  border: var(--bw) solid transparent;
  transition: background-color .2s, border-color .2s, transform .3s var(--ease-out);
}
.convo:hover { background: var(--paper-2); transform: translateX(3px); }
.convo.is-active { background: var(--lime); border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.convo__hash {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  border: var(--bw) solid var(--ink);
  font: 800 20px var(--font-mono);
  background: var(--paper);
}
.convo__main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.convo__main b { font-size: 14.5px; display: flex; align-items: center; gap: 6px; }
.convo__main small { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo.is-active small { color: var(--ink); }
.convo__presence { font-size: 11px; font-weight: 650; color: var(--text-2); }
.convo__presence.is-online { color: var(--ink); }
.convo__side { flex: none; display: grid; justify-items: end; gap: 4px; }
.convo__side small { font-size: 10.5px; color: var(--text-2); }
.convo-list .empty { padding: 30px 10px; display: grid; justify-items: center; gap: 8px; color: var(--text-2); font-size: 14px; }
.side__foot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); padding-top: 4px; border-top: 1.5px dashed var(--line-strong); padding-top: 12px; }

/* Main thread --------------------------------------------------------------- */
.chat__main, .ai__main {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; grid-template-columns: minmax(0, 1fr);
  min-width: 0; min-height: 0;
  background-color: var(--paper-2);
  background-image: var(--bricks-paper);
}
.thread__head, .ai__head {
  display: flex; align-items: center; gap: 12px;
  min-height: 74px; padding: 12px 22px;
  background: var(--paper);
  border-bottom: var(--bw) solid var(--ink);
}
.thread__back { display: none; }
.thread__hash {
  flex: none; width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--ink); color: var(--lime);
  font: 800 22px var(--font-mono);
}
.thread__title { flex: 1; min-width: 0; }
.thread__title h2 { display: flex; align-items: center; gap: 8px; min-width: 0; font-family: var(--font-display); font-weight: 900; text-transform: uppercase; font-size: 30px; line-height: .95; }
.thread__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread__title h2 .demo-badge { flex: none; }
.thread__sub-badge { display: none; margin-right: 6px; vertical-align: 1px; }
.thread__title p { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread__actions { display: flex; gap: 8px; flex: none; }

.thread { overflow-y: auto; padding: 18px 22px 10px; display: flex; flex-direction: column; gap: 4px; }
.day-sep { display: flex; align-items: center; gap: 12px; margin: 14px 0 8px; font: 600 11px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1.5px; background: var(--line); }
.msg-sys {
  align-self: center;
  display: flex; align-items: center; gap: 8px;
  max-width: 560px; margin: 6px 0 10px; padding: 8px 14px;
  border-radius: var(--r-pill);
  border: 1.5px dashed var(--line-strong);
  background: var(--paper);
  font-size: 12.5px; color: var(--text-2); text-align: center;
}
.msg { position: relative; display: flex; gap: 10px; align-items: flex-start; max-width: min(640px, 86%); margin-top: 10px; }
.msg.is-grouped { margin-top: 2px; }
.msg__av { width: 28px; flex: none; }
.msg__col { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.msg__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12.5px; }
.msg__meta b { font-weight: 750; }
.msg__meta time { color: var(--text-2); font: 500 11px var(--font-mono); }
.msg__bubble {
  padding: 10px 14px;
  border-radius: 4px 18px 18px 18px;
  background: var(--paper);
  border: var(--bw) solid var(--ink);
  font-size: 15px; line-height: 1.45;
  overflow-wrap: anywhere;
  box-shadow: 2px 2px 0 var(--ink);
}
.msg.is-grouped .msg__bubble { border-radius: 18px; }
.msg__bubble.is-hidden { font-style: italic; color: var(--text-2); background: transparent; border-style: dashed; box-shadow: none; }
.msg--me { align-self: flex-end; flex-direction: row-reverse; }
.msg--me .msg__col { justify-items: end; }
.msg--me .msg__bubble { background: var(--ink); color: var(--paper); border-radius: 18px 4px 18px 18px; box-shadow: 2px 2px 0 var(--lime), 2px 2px 0 2px var(--ink); }
.msg--me.is-grouped .msg__bubble { border-radius: 18px; }
.msg__reacts { display: flex; gap: 4px; flex-wrap: wrap; }
.react {
  height: 24px; padding: 0 9px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--ink);
  background: var(--paper);
  font: 600 11.5px var(--font-mono);
  transition: background-color .2s, transform .2s var(--ease-out);
}
.react b { font-weight: 800; margin-left: 2px; }
.react:hover { transform: translateY(-1px); }
.react.is-on { background: var(--lime); }
.msg__receipt { color: var(--text-2); font-size: 11px; line-height: 1.2; }
.msg__flag { display: inline-flex; align-items: center; gap: 5px; font: 600 11px var(--font-mono); color: var(--text-2); }
.msg__tools {
  position: absolute; top: -12px; right: -8px;
  display: flex; gap: 2px; padding: 3px;
  border-radius: var(--r-pill);
  background: var(--paper);
  border: 1.5px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  opacity: 0; transform: translateY(6px) scale(.9); pointer-events: none;
  transition: opacity .18s, transform .3s var(--ease-spring);
}
.msg--me .msg__tools { right: auto; left: -8px; }
.msg:hover .msg__tools, .msg:focus-within .msg__tools { opacity: 1; transform: none; pointer-events: auto; }
.msg__tool { height: 26px; min-width: 26px; padding: 0 8px; border-radius: var(--r-pill); font: 600 11px var(--font-mono); display: inline-grid; place-items: center; }
.msg__tool:hover { background: var(--lime); }
.msg__tool--flag:hover { background: var(--ink); color: var(--lime); }

.typing { min-height: 0; display: flex; align-items: center; gap: 8px; padding: 0 22px; font-size: 13px; color: var(--text-2); }
.typing:not(:empty) { min-height: 34px; }
.typing .avatar { --s: 22px; border-width: 1.5px; }

.composer { padding: 10px 22px 14px; background: var(--paper); border-top: var(--bw) solid var(--ink); }
.composer__box {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 6px 6px 6px 16px;
  border: var(--bw) solid var(--ink);
  border-radius: 26px;
  background: var(--paper);
  transition: box-shadow .2s var(--ease-out);
}
.composer__box:focus-within { box-shadow: 4px 4px 0 var(--ink); }
.composer textarea { flex: 1; min-height: 40px; max-height: 160px; padding: 9px 0; border: 0; background: none; font-size: 15px; line-height: 1.45; }
.composer textarea::placeholder { color: var(--text-3); }
.composer textarea:focus-visible { outline: none; } /* the box shows focus via :focus-within */
.composer__send { width: 46px; height: 46px; padding: 0; flex: none; }
.composer__hint { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.composer__hint .kbd { height: 19px; min-width: 19px; font-size: 10px; }

/* Info panel ----------------------------------------------------------------- */
.chat__info {
  min-width: 0; overflow: hidden auto;
  border-left: var(--bw) solid var(--ink);
  background: var(--paper);
  display: grid; align-content: start; gap: 20px;
  padding: 22px 18px;
}
.chat:not(.info-open) .chat__info { padding: 0; border-left: 0; }
.info__about p { margin: 8px 0 6px; font-size: 14.5px; }
.info__about small { color: var(--text-2); font-size: 11.5px; }
.info__group { display: grid; gap: 10px; }
.members { display: grid; gap: 2px; }
.member { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 12px; }
.member:hover { background: var(--paper-2); }
.member__name { flex: 1; min-width: 0; display: grid; font-size: 13.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.member__name small { font: 600 10.5px var(--font-mono); color: var(--text-2); }
.member__tools { display: flex; opacity: .35; transition: opacity .2s; }
.member:hover .member__tools, .member:focus-within .member__tools { opacity: 1; }
.rules { display: grid; gap: 8px; font-size: 13.5px; color: var(--text-2); padding-left: 16px; list-style: disc; }
.info__card { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 18px; border: var(--bw) solid var(--ink); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.info__card h3 { font-size: 18px; }
.info__actions { display: grid; gap: 8px; }
.info__note { display: flex; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.info__note .i { flex: none; margin-top: 2px; }

/* Member picker ---------------------------------------------------------------- */
.pick-list { display: grid; gap: 6px; max-height: 320px; overflow-y: auto; padding: 2px 4px 4px 2px; }
.pick {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 14px;
  border: var(--bw) solid var(--line);
  cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.pick:hover { border-color: var(--ink); }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick__main { flex: 1; display: grid; gap: 2px; }
.pick__main b { font-size: 14.5px; }
.pick__main small { font-size: 12.5px; color: var(--text-2); }
.pick__dot { width: 24px; height: 24px; border-radius: 50%; border: var(--bw) solid var(--ink); display: grid; place-items: center; color: transparent; }
.pick:has(input:checked) { border-color: var(--ink); background: var(--lime); box-shadow: 3px 3px 0 var(--ink); }
.pick:has(input:checked) .pick__dot { background: var(--ink); color: var(--lime); }
.pick:has(input:focus-visible) { outline: 2.5px solid var(--ink); outline-offset: 3px; }
.pick.is-off { opacity: .45; cursor: not-allowed; }

/* Random match ------------------------------------------------------------------ */
.modal--match { width: min(560px, 100%); overflow: hidden; }
.match { display: grid; }
.match__step { grid-area: 1 / 1; }
.match:not([data-step="setup"]) .match__step--setup,
.match:not([data-step="search"]) .match__step--search,
.match:not([data-step="found"]) .match__step--found { visibility: hidden; pointer-events: none; }
.match__toggle { padding: 12px 14px; border: var(--bw) solid var(--ink); border-radius: 14px; gap: 14px; font-size: 14.5px; cursor: pointer; }
.match__center { justify-content: center; text-align: center; }
.match__step--search, .match__step--found { display: grid; justify-items: center; gap: 14px; padding-top: 18px; }
.radar { position: relative; width: 200px; height: 200px; display: grid; place-items: center; }
.radar i {
  position: absolute; inset: 0; border-radius: 50%;
  border: var(--bw) solid var(--ink);
  animation: radar 2.4s var(--ease-out) infinite;
}
.radar i:nth-child(2) { animation-delay: .8s; }
.radar i:nth-child(3) { animation-delay: 1.6s; background: var(--lime); opacity: .4; border-color: transparent; }
@keyframes radar { from { transform: scale(.25); opacity: 1; } to { transform: scale(1); opacity: 0; } }
.radar__me { position: relative; z-index: 1; }
.reel { height: 28px; overflow: hidden; border-radius: var(--r-pill); border: var(--bw) solid var(--ink); padding: 0 16px; background: var(--paper-2); }
.reel__track { display: grid; }
.reel__track span { height: 28px; display: grid; place-items: center; font: 600 13px var(--font-mono); }
.match__status { color: var(--text-2); font-size: 14px; }
.pair { display: flex; align-items: center; justify-content: center; gap: 0; margin: 6px 0 4px; }
.pair__a, .pair__b { display: inline-block; }
.pair__a { margin-right: -18px; position: relative; z-index: 1; }
.pair__b { margin-left: -18px; }
.pair__spark {
  position: relative; z-index: 2;
  width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--lime); border: var(--bw) solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}

/* Responsive ------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .chat, .chat.info-open { grid-template-columns: 300px minmax(0, 1fr) 0px; }
  .chat.info-open .chat__info {
    position: absolute; right: 0; top: 0; bottom: 0; width: 300px; z-index: 5;
    box-shadow: -8px 0 0 rgba(11, 11, 11, .08);
  }
}
@media (max-width: 860px) {
  .chat, .chat.info-open { grid-template-columns: 100% 100% 0; overflow: clip; }
  .chat__side, .chat__main { grid-row: 1; transition: transform .55s var(--ease-out); }
  .chat__side { grid-column: 1; }
  .chat__main { grid-column: 1; transform: translateX(100%); z-index: 2; }
  .chat[data-view="thread"] .chat__main { transform: none; }
  .chat[data-view="thread"] .chat__side { transform: translateX(-30%); }
  .thread__back { display: inline-grid; }
  .thread__actions .btn span, .thread__actions .btn--ghost { display: none; }
  .thread__actions .btn { width: 42px; padding: 0; }
  .thread__head { padding: 10px 12px; gap: 8px; min-height: 64px; }
  .thread__title h2 { font-size: 22px; }
  .thread__title h2 .demo-badge { display: none; } /* phones: badge moves to the subtitle so the name keeps its room */
  .thread__sub-badge { display: inline-flex; height: 16px; padding: 0 5px; font-size: 9px; }
  .thread__title p { font-size: 12px; }
  .thread__hash { width: 36px; height: 36px; border-radius: 11px; font-size: 18px; }
  .thread__head > .avatar { --s: 36px; }
  .thread { padding: 14px 12px 8px; }
  .composer { padding: 8px 12px 10px; }
  .composer__hint { display: none; }
  .msg { max-width: 92%; }
  .msg__tools { opacity: 1; position: static; transform: none; pointer-events: auto; box-shadow: none; border: 0; background: none; align-self: flex-end; }
  .msg__tool { display: none; }
  .msg__tool--flag { display: inline-grid; }
}

/* Anonymity card + simulated labels */
.anon-card { display: grid; gap: 6px; padding: 12px; border: 1.5px dashed var(--ink); border-radius: 14px; font-size: 13.5px; }
.anon-card__who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.anon-card__who b { overflow-wrap: anywhere; }
.anon-card small { color: var(--text-2); font-size: 12px; line-height: 1.4; }
/* short phone screens: keep the identity line, give the conversation list the room */
@media (max-width: 860px) and (max-height: 720px) { .anon-card { padding: 8px 12px; } .anon-card small { display: none; } }

.chat__info .mod-state { margin-bottom: 2px; }
[data-contact-notice][hidden] { display: none; }
.report-urgent { margin-top: 14px; } /* the safety escape hatch sits above the form, never under the sticky actions */
.modal #rep-detail { min-height: 76px; }
