/* Table chat's widget (Word Krieg’s journal 012; specs/chat.md), as design/_shared/base.css draws it in the mockups `design/match_table_chat*.html`. Structure only: every colour, font and radius is a token. The widget fills the panel's body in the Chat tab (`.panel__body--chat`). */

.chat-widget { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* The list: the newest at the bottom, scrolling on its own above the compose row */
.chat-widget__list { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; padding: 8px 16px; }
.chat { list-style: none; margin: auto 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
/* A message on a thin stone of its sender's colour, in the board's face, at most 78% of the list wide */
.chat__message { max-width: 78%; min-height: 24px; padding: 4px 8px; border-style: solid; border-width: 0; image-rendering: pixelated; color: var(--color-text-on-colour); font-family: var(--font-board); font-size: var(--font-size-s); font-weight: var(--font-weight-bold); letter-spacing: 0.02em; line-height: 16px; overflow-wrap: anywhere; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.chat__message--theirs { align-self: flex-start; }
.chat__message--mine { align-self: flex-end; }
.chat__message--amber { border-image: var(--art-panel-stone-amber); }
.chat__message--violet { border-image: var(--art-panel-stone-violet); }
.chat__message--blue { border-image: var(--art-panel-stone-blue); }
.chat__message--green { border-image: var(--art-panel-stone-green); }
/* A quick phrase, shown in the reader's language */
.chat__message--phrase { font-style: italic; outline: 1px solid var(--color-line); outline-offset: -1px; }
/* Sent, not yet kept: faded until the server answers */
.chat__message--pending { opacity: 0.55; }
.chat__reported { margin-left: 6px; color: var(--color-text-muted); font-family: var(--font-ui); font-style: normal; }

/* Collapsed, under the table at full size: the last message, the phrases and Compose; a tap on the message opens Chat. On a panel too short for all three, Compose first, then the phrases */
.chat-widget--collapsed { gap: 8px; padding: 8px 0 12px; overflow: hidden; }
.chat-widget--collapsed .chat-widget__list { flex: 0 1 auto; padding: 4px 16px 0; overflow: hidden; cursor: pointer; }
.chat-peek { flex: none; display: flex; flex-direction: column; gap: 8px; }
.chat-peek__compose { margin: 0 16px; min-height: 48px; }
.chat-widget--short .chat-widget__list { display: none; }
.chat-widget--short .chat-peek { flex-direction: column-reverse; }

/* The compose row: the phrases, the field and Send */
.chat-compose { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 8px 16px 12px; border-top: 2px solid var(--color-line); }
/* The quick phrases, each on the secondary Lip, 48 tall, 8 apart, the row running to the panel's edges and swiping */
.chat-compose__phrases { flex: none; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 0 16px; }
.chat-compose .chat-compose__phrases { margin: 0 -16px; }
.chat-compose__phrases::-webkit-scrollbar { display: none; }
.chat-compose__phrases::after { content: ""; flex: none; width: 1px; }
.chat-compose__phrase { flex: none; min-height: 48px; padding: 0 22px; font-size: var(--font-size-s); font-weight: var(--font-weight-semibold); white-space: nowrap; }
.chat-compose__row { display: flex; gap: 8px; }
.chat-compose__field { flex: 1; min-width: 0; min-height: 48px; padding: 0 12px; border: 0; border-radius: 0; clip-path: var(--shape-cut); background: var(--color-bg); color: var(--color-text); font: inherit; font-size: var(--font-size-s); }
.chat-compose__field::placeholder { color: var(--color-text-muted); }
/* Send: a 48 × 48 primary Lip */
.chat-compose__send { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; flex: none; padding: 0; }
.chat-compose__send:active:not(:disabled) { padding: 8px 0 0; }
/* A free text refused: the reason over the phrases, the text kept in the field */
.chat-compose__reason { margin: 0; color: var(--color-danger); font-size: var(--font-size-s); font-weight: var(--font-weight-semibold); }
.chat-compose__reason[hidden] { display: none; }
.chat-compose__field--refused { box-shadow: inset 0 0 0 2px var(--color-danger); }
/* The field with focus (the keyboard up): the phrases and Block give way */
.chat-widget--typing .chat-compose__phrases, .chat-widget--typing .chat-block { display: none; }

/* A chat closed, its opponent deleted: a line in the compose row's place */
.chat-closed { flex: none; margin: 0; padding: 16px 24px 20px; border-top: 2px solid var(--color-line); color: var(--color-text-muted); font-size: var(--font-size-s); text-align: center; }
.chat-widget--collapsed .chat-closed { border-top: 0; }

/* Block Ana: a quiet Lip, 48 tall, pinned at the top of Chat open while the opponent can be blocked */
.chat-block { flex: none; display: flex; justify-content: flex-end; padding: 8px 16px 0; }
.chat-block__button { min-height: 48px; padding: 0 16px; font-size: var(--font-size-s); }

/* A message's sheet: the message quoted in its sender's colour, the sender, the actions stacked */
.sheet__quote { margin: 0; padding: 10px 14px; border-radius: 0; clip-path: var(--shape-cut); font-size: var(--font-size-m); overflow-wrap: anywhere; quotes: auto; }
.sheet__quote::before { content: open-quote; }
.sheet__quote::after { content: close-quote; }
.sheet__quote--green { background: var(--color-green-soft); }
.sheet__quote--blue { background: var(--color-blue-soft); }
.sheet__from { margin: 0 0 6px 14px; color: var(--color-text-muted); font-size: var(--font-size-s); }
.sheet__stack { display: flex; flex-direction: column; gap: 10px; }
