/* StreamCozy, Cozy Chat (page /chat/). Built from the tokens and parts of styles.css (design "Cozy Universe",
   docs/plattform/DESIGN.md): the box lets the sky through like every other box, lavender marks the own action only. */

/* (the class "chat" belongs to an older part of styles.css) */
.cozychat { min-height: calc(100svh - 9rem); padding-block: clamp(1rem, 3vw, 2.25rem) clamp(2rem, 5vw, 4rem); }
.chat-public { grid-template-columns: minmax(0, 1fr); max-width: 44rem; }
.chat-room { max-width: 62rem; }

/* Head: title with the number of people, one line of what this is, the three rooms. */
.chat-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 0.5rem 1.5rem; }
.chat-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.chat-title h1 { font-size: var(--fs-h2); line-height: 1.1; }
.chat-online { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.8rem; border-radius: var(--r-pill); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: var(--fs-small); color: var(--text-dim); }
.chat-online .live-dot { background: var(--mint); }
.chat-lead { grid-column: 1; max-width: 38rem; color: var(--text-dim); }
.chat-tabs { grid-column: 2; grid-row: 1 / span 2; margin-inline-start: 0; align-self: end; }
.chat-tabs button { white-space: nowrap; }

/* The box: messages above, what the user can do below. */
/* Text has to stay readable over stars and clouds: a darker veil and a little blur behind the box. */
.chat-box { display: flex; flex-direction: column; margin-top: 1.25rem; border-radius: var(--r); background: linear-gradient(rgba(18, 14, 48, 0.55), rgba(18, 14, 48, 0.55)), var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); overflow: hidden; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.chat-state { padding: 1.5rem clamp(1rem, 3vw, 1.75rem) 0; color: var(--text-dim); }
.chat-list { flex: none; display: flex; flex-direction: column; gap: 0.15rem; height: clamp(18rem, 58vh, 44rem); margin: 0; padding: 1rem clamp(0.5rem, 2vw, 1.25rem); list-style: none; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.chat-list:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.chat-msg { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 0.75rem; padding: 0.5rem 0.6rem; border-radius: var(--r-sm); }
.chat-msg:hover, .chat-msg:focus-within { background: var(--surface); }
.chat-avatar { width: 2.25rem; height: 2.25rem; font-size: 0.95rem; background: var(--surface-3); color: var(--text); }
.chat-msg.is-mine .chat-avatar { background: var(--accent); color: var(--accent-ink); }
.chat-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 0.6rem; }
.chat-name { font-weight: 800; overflow-wrap: anywhere; }
.chat-team { padding: 0.05rem 0.5rem; border-radius: var(--r-pill); background: rgba(123, 232, 176, 0.14); color: var(--mint); font-size: 0.75rem; font-weight: 800; }
.chat-time { font-size: var(--t-small); font-weight: 500; color: var(--text-mute); }
.chat-text { margin-top: 0.1rem; color: var(--text); overflow-wrap: anywhere; }

/* The small tools of a message show when the pointer or the keyboard is on it; on touch screens they are always there. */
.chat-tools { display: flex; gap: 0.15rem; opacity: 0; transition: opacity 160ms ease; }
.chat-msg:hover .chat-tools, .chat-msg:focus-within .chat-tools { opacity: 1; }
@media (hover: none) { .chat-tools { opacity: 0.7; } }
.chat-tool { width: 2.25rem; height: 2.25rem; color: var(--text-mute); }
.chat-tool:hover { color: var(--text); }
.chat-tool .ico { width: 1.05rem; height: 1.05rem; }

/* Below the messages: the field, or the reason why there is none. */
.chat-write, .chat-gate { display: flex; align-items: center; gap: 0.75rem; padding: 0.9rem clamp(0.75rem, 2.500vw, 1.5rem); border-top: 1px solid var(--line); }
.chat-write input { flex: 1; min-width: 0; padding: 0.8rem 1.1rem; border: 0; border-radius: var(--r-pill); background: var(--bg-deep); color: var(--text); font: inherit; box-shadow: inset 0 0 0 1px var(--line-2); }
.chat-write input::placeholder { color: var(--text-mute); }
.chat-write input:focus { outline: none; box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 4px rgba(196, 181, 253, 0.15); }
.chat-send { flex: none; }
.chat-gate { flex-wrap: wrap; justify-content: space-between; }
.chat-gate p { flex: 1; min-width: min(100%, 16rem); color: var(--text-dim); }

.chat-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.35rem 1.5rem; padding: 0 clamp(0.75rem, 2.500vw, 1.5rem) 0.9rem; font-size: var(--fs-small); color: var(--text-mute); }
.chat-me { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; }
.chat-me b { color: var(--text-dim); overflow-wrap: anywhere; }
.chat-link { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }
.chat-link:hover { color: var(--accent-hi); }
.chat-link .ico { width: 0.95rem; height: 0.95rem; }

/* Dialogs: name and rules, report. */
.chat-dialog h3 { margin-top: 1.5rem; font-size: 1.05rem; font-weight: 800; }
.chat-dialog .field { display: block; margin-top: 1.25rem; }
.chat-dialog .field input { background: var(--bg-deep); }
.chat-rules { display: grid; gap: 0.5rem; margin: 0.75rem 0 0; padding-inline-start: 1.2rem; color: var(--text-dim); }
.chat-rules li::marker { color: var(--accent); }
.chat-dialog .form-message:empty { display: none; }
.chat-quote { margin: 1rem 0 0; padding: 0.75rem 1rem; border-radius: var(--r-sm); background: var(--bg-deep); color: var(--text-dim); overflow-wrap: anywhere; max-height: 8rem; overflow-y: auto; }

@media (max-width: 760px) {
  .chat-head { grid-template-columns: minmax(0, 1fr); }
  .chat-tabs { grid-column: 1; grid-row: auto; display: flex; width: 100%; margin-top: 0.5rem; overflow-x: auto; scrollbar-width: none; }
  .chat-tabs button { flex: 1 0 auto; }
  .chat-list { height: clamp(16rem, 52vh, 34rem); }
  .chat-send span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .chat-send { padding-inline: 1rem; }
}
