/* The House's side of the hosts' rooms (#/chat, #/chat-room/…, #/crew). */
.cha-page { max-width: none; }
.cha-back { margin: 0 0 6px; }

/* The title row: the room's name with its state beside it, and «End the event» at the far end. */
.cha-head { align-items: center; }
.cha-title { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 6px 14px; min-width: 0; }
.cha-title .page-title { margin: 4px 0 2px; text-wrap: balance; }
.cha-title > .tag { margin-top: 15px; white-space: nowrap; }
.cha-intro { max-width: 760px; line-height: 1.65; margin: 0 0 14px; }

/* The alliance this event's room belongs to. */
.cha-ally { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
.cha-ally label { margin: 0; font-weight: 400; }
.cha-ally input { width: 200px; max-width: 100%; font-family: inherit; }

/* The three links. */
.cha-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
@media (max-width: 1100px) { .cha-links { grid-template-columns: 1fr; } }
.card.cha-link { padding: 14px 16px; }
.card.cha-link > .card-h { padding: 0; flex-wrap: wrap; row-gap: 2px; }
.card.cha-link > p { padding-inline: 0; margin: 0 0 8px; line-height: 1.6; }
.card.cha-link > p:last-child { margin: 10px 0 0; }
.cha-url { display: flex; min-width: 0; direction: ltr; unicode-bidi: isolate; font-size: 12.5px; background: #f6f2e8; border: 1px solid var(--ui-line, #e4ddca); border-radius: 8px; padding: 6px 8px; margin: 8px 0 2px; user-select: all; }
.cha-url-a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cha-url-b { flex: none; white-space: nowrap; }
.cha-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cha-qr { width: 240px; margin: 8px auto; }
.cha-qr svg { display: block; width: 100%; height: auto; }

/* The room: messages and the box to write in, and beside them who is in it. */
.cha-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 980px) { .cha-grid { grid-template-columns: 1fr; } }
.cha-chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.cha-list { max-height: min(62vh, 620px); min-height: 120px; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: #f6f2e8; }
.cha-list > .empty { margin: auto; padding: 28px 12px; }
.cha-msg { max-width: 85%; align-self: flex-start; background: #fffdf8; border: 1px solid var(--ui-line, #e4ddca); border-radius: 12px; padding: 6px 10px; overflow-wrap: anywhere; }
.cha-msg.rep { align-self: stretch; max-width: 100%; background: #111110; color: #f3eedf; border: 2px solid #bdb797; }
.cha-msg.house { align-self: stretch; max-width: 100%; background: #111110; color: #fbf7ea; border: 2px solid #bdb797; text-align: center; }
.cha-msg.final { border-width: 3px; }
.cha-who { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; font-weight: 700; color: #8f8a68; }
.cha-name { min-width: 0; overflow-wrap: anywhere; }
.cha-msg.rep .cha-who, .cha-msg.house .cha-who { color: #bdb797; justify-content: center; }
.cha-msg.rep .cha-who { justify-content: flex-start; }
.cha-time { flex: none; white-space: nowrap; font-weight: 400; color: #7a7468; font-size: 11.5px; }
.cha-msg { position: relative; }
.cha-who:has(.cha-del) { padding-inline-end: 20px; }
.cha-msg.house .cha-who:has(.cha-del) { padding-inline: 20px; }
.cha-del { position: absolute; top: 5px; inset-inline-end: 6px; border: 0; background: transparent; color: #9a3b2e; cursor: pointer; font-size: 15px; line-height: 1; opacity: 0; }
.cha-msg:hover .cha-del, .cha-del:focus-visible { opacity: .8; }
.cha-text { white-space: pre-wrap; line-height: 1.55; }
.cha-msg.house .cha-text { font-weight: 700; font-size: 1.05em; }
.cha-compose { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--ui-line, #e4ddca); background: #fffdf8; }
.cha-compose[hidden] { display: none; }
.cha-compose textarea { display: block; width: 100%; box-sizing: border-box; resize: vertical; min-height: 64px; }
.cha-compose-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cha-compose-acts .grow { flex: 1; }
.cha-hint { margin: 0; padding: 0 12px 12px; background: #fffdf8; line-height: 1.6; }
.cha-hint.cha-closed { padding-top: 12px; border-top: 1px solid var(--ui-line, #e4ddca); }
.cha-voice { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.cha-voice audio { height: 34px; flex: 0 1 260px; min-width: 0; max-width: 260px; }
.cha-voice span { flex: none; white-space: nowrap; font-size: 12px; color: #7a7468; }
.cha-msg.house .cha-voice { justify-content: center; }
.cha-rec { display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--ui-line, #e4ddca); background: #111110; color: #bdb797; }
.cha-rec[hidden] { display: none; }
.cha-rec #cha-rec-t { flex: 1; }
.cha-dot { width: 11px; height: 11px; border-radius: 50%; background: #d4483b; animation: cha-blink 1s infinite; }
@keyframes cha-blink { 50% { opacity: .3; } }
.cha-photo { display: inline-block; margin: 3px 0; } .cha-photo img { display: block; max-width: 240px; max-height: 260px; border-radius: 10px; } .cha-msg.house .cha-photo { margin: 4px auto; display: block; width: max-content; }

/* People: one block each, the same edge for every line in it. */
.card.cha-people > .card-h { padding: 16px 18px 0; flex-wrap: wrap; }
.card.cha-people > .cha-left-h { padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--ui-line, #e4ddca); }
.card.cha-people > .empty { padding: 28px 18px 32px; }
.cha-person { padding: 12px 18px; border-top: 1px solid var(--ui-line, #e4ddca); line-height: 1.55; overflow-wrap: anywhere; }
.cha-persons > .cha-person:first-child { border-top: 0; }
.cha-person > .small { margin-top: 2px; }
.cha-person .cha-acts { margin-top: 8px; }
.cha-person .cha-acts + .cha-acts { margin-top: 6px; }
.card.cha-pending { margin-bottom: 14px; border: 1.5px solid #bdb797; }
.card.cha-pending > .card-h { padding: 14px 18px 0; margin-bottom: 4px; }
table.cha-kv { margin: 0 18px 14px; width: calc(100% - 36px); }
.cha-kv td { padding: 7px 0; vertical-align: top; border-top: 1px solid var(--ui-line, #e4ddca); }
.cha-kv tr:first-child td { border-top: 0; }
.cha-kv td:first-child { width: 34%; padding-inline-end: 12px; }

/* A row of two: what it is, and at its end what you do with it. */
.cha-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px 14px; flex-wrap: wrap; }
.cha-row-main { flex: 1 1 260px; min-width: 0; }
.cha-row-end { flex: none; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* The list of rooms: the name and its counts, and its state at the far end. */
.card.cha-rooms { padding: 0; overflow: hidden; margin-bottom: 14px; }
.cha-rooms > .card-h { padding: 14px 18px 0; margin-bottom: 4px; }
.cha-room { display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--ui-line, #e4ddca); color: inherit; text-decoration: none; }
.cha-room:first-child { border-top: 0; }
.cha-room:hover { background: #fbf6ea; }
.cha-room-main { flex: 1 1 240px; min-width: 0; }
.cha-room-main .small { margin-top: 3px; }
.cha-room-st { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.cha-rooms .cha-row { padding: 12px 18px; border-top: 1px solid var(--ui-line, #e4ddca); }
.cha-rooms > .card-h + .cha-row { border-top: 0; }

/* The Blacktape Crew in the office */
.cha-hist { color: #7a5a12; margin-top: 2px; }
.cha-crew { margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: #faf6ea; border: 1px solid #ebe2c8; line-height: 1.6; }
.cha-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cha-thumbs a { position: relative; display: block; }
.cha-thumbs img { width: 78px; height: 104px; object-fit: cover; border-radius: 8px; display: block; }
.cha-thumbs span { position: absolute; inset-inline-start: 4px; bottom: 4px; font-size: 10.5px; background: rgba(17, 17, 16, .75); color: #fff; padding: 0 5px; border-radius: 6px; }
.cha-thumbs span:empty { display: none; }
.cha-calls .card-h { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.cha-call { padding: 12px 0; border-top: 1px solid var(--ui-line, #e4ddca); }
.cha-call:first-of-type { border-top: 0; }
.cha-call.closed { opacity: .75; }
.cha-call-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.cha-call-room { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.cha-answers { margin-top: 8px; border-top: 1px solid var(--ui-line, #e4ddca); }
.cha-answers > .cha-row { padding: 10px 0; border-top: 1px solid var(--ui-line, #e4ddca); }
.cha-answers > .cha-row:first-child { border-top: 0; }
/* The calls, the private lines and the Crew's opening card: cards of their own, padded like the rest. */
.card.cha-calls, .card.cha-private, .card.cha-crew-open { padding: 14px 18px; margin-bottom: 14px; }
.cha-calls > .card-h { margin-bottom: 4px; }
.cha-calls > .empty, .cha-call .empty { padding: 18px 8px 10px; }
.cha-call .small { margin-top: 3px; }
.card.cha-crew-open > p { padding-inline: 0; }
.cha-private > .cha-dm { padding: 10px 0; border-top: 1px solid var(--ui-line, #e4ddca); color: inherit; text-decoration: none; }
.cha-private > .card-h + .cha-dm { border-top: 0; }
.cha-private > .cha-dm:hover { background: #fbf6ea; }

/* A line of data in the other script sits on the same side as the lines around it, not on its own side. */
html[dir=rtl] .cha-page [dir=auto]:not(.cha-text):not(input):not(textarea) { text-align: right; }
html[dir=ltr] .cha-page [dir=auto]:not(.cha-text):not(input):not(textarea) { text-align: left; }

/* The phone. */
@media (max-width: 760px) {
  .cha-title .page-title { line-height: 1.2; }
  .cha-title > .tag { margin-top: 10px; }
  .cha-head > .row { width: 100%; }
  .cha-list { max-height: min(60vh, 460px); }
  .cha-ally input { flex: 1 1 160px; width: auto; }
  .cha-room-st { justify-content: flex-start; flex-basis: 100%; }
  .cha-person, .cha-room, .cha-rooms .cha-row { padding-inline: 14px; }
  .card.cha-people > .card-h { padding-inline: 14px; }
  .card.cha-calls, .card.cha-private, .card.cha-crew-open { padding-inline: 14px; }
  table.cha-kv { margin-inline: 14px; width: calc(100% - 28px); }
  #view table.cha-kv { display: table; }
}

/* The review of 2026-10-24, second pass. */
/* On a wide screen the chat and the list of who is in the room stand side by side at about one height: the list scrolls
   in its own panel under its heading, and the chat stays in view. The chat used to end a third of the way down while
   the list ran on for 2,300px beside an empty half page. */
@media (min-width: 981px) {
  .cha-grid > .cha-chat { position: sticky; top: calc(var(--top-h, 64px) + 12px); }
  .cha-people > .cha-persons { max-height: calc(min(62vh, 620px) + 180px); overflow-y: auto; overscroll-behavior: contain; }
}
/* A host's particulars on the Arabic screen: each English piece moves to the next line whole, never torn across two
   lines with the Arabic commas falling between its halves. */
html[dir=rtl] .cha-page .small > bdi { display: inline-block; max-width: 100%; }

/* The third review, second core pass (2026-10-24). */
/* A link's box: the address to its last «/», the token cut where the line ends, and the token's last characters. */
/* The address never shrinks (a shrink of a fraction of a pixel drew its own «…»); the token gives way, down to its «…». */
.cha-url { overflow: hidden; }
.cha-url-a { flex: none; white-space: nowrap; overflow: visible; text-overflow: clip; }
.cha-url-m { flex: 0 1 auto; min-width: 1.1em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cha-url-b { flex: none; white-space: nowrap; }
/* The list of who is in the room, in its own panel on a wide screen: its foot fades while more hosts are below it. */
@media (min-width: 981px) {
  .cha-people > .cha-persons.cha-more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 64px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 64px), transparent); }
}
/* On a phone a row of link and host buttons is an even grid, two by two, one left over across the row: never 2, 3 and 1. */
@media (max-width: 760px) {
  .cha-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .cha-acts > .btn { width: 100%; margin: 0; justify-content: center; text-align: center; white-space: normal; padding-inline: 8px; }
  .cha-acts > .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
