/* Crosstalk: its own look, nothing borrowed from the rest of the site.
   Quiet near-black, soft rounded panels, one violet accent. Built to stay
   readable at 280px wide, since it lives in a small window beside a game. */

:root {
  --bg: #0f1015;
  --surface: #171821;
  --surface-2: #1f2130;
  --line: #2a2d3f;
  --ink: #eceef6;
  --dim: #9aa0b8;
  --mute: #6c7390;
  --accent: #8b7cff;
  --accent-ink: #14112b;
  --good: #3ddc97;
  --bad: #ff6b81;
  --size: 15px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: var(--size)/1.4 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; padding: 10px; gap: 8px; }

/* top bar */
.bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; margin-right: 4px; }
.brand svg { width: 22px; height: 22px; flex: none; }
.brand h1 { font-size: 15px; font-weight: 700; margin: 0; letter-spacing: 0.2px; }
.status { font-size: 12px; color: var(--mute); display: inline-flex; align-items: center; gap: 5px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--mute); }
.status[data-state="on"] { color: var(--dim); }
.status[data-state="on"]::before { background: var(--good); }
.status[data-state="bad"] { color: var(--bad); }
.status[data-state="bad"]::before { background: var(--bad); }
.grow { flex: 1 1 0; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.ic {
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  color: var(--dim); padding: 4px 8px; font-size: 12.5px; font-weight: 600;
}
.ic:hover { background: var(--surface-2); color: var(--ink); }
.ic.primary { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
:is(button, input, a, .feed):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* add a channel */
.add { display: flex; gap: 6px; }
.add input {
  flex: 1 1 auto; min-width: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px;
}
.add input::placeholder { color: var(--mute); }
.add input:focus { border-color: var(--accent); }
.btn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 8px 14px; font-weight: 700; }
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.5; cursor: default; }

.roombar { margin: 0; font-size: 13px; color: var(--dim); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.viewer .add, .viewer .chip button { display: none; }
.viewer .chip { padding-right: 10px; }

.note { margin: 0; color: var(--bad); font-size: 13px; }

/* channels */
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 13px;
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tag, var(--accent)); flex: none; }
.chip .live { font-size: 10px; font-weight: 700; letter-spacing: 0.4px; color: var(--good); }
.chip[data-live="no"] .name { color: var(--dim); }
.chip[data-state="bad"] { border-color: var(--bad); }
.chip button { background: none; border: 0; border-radius: 50%; color: var(--mute); width: 22px; height: 22px; line-height: 1; font-size: 16px; padding: 0; }
.chip button:hover { background: var(--surface-2); color: var(--bad); }

/* the chat */
.feed {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-wrap: anywhere;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.empty { color: var(--dim); padding: 6px 0; }
.empty p { margin: 0 0 10px; }
.empty b { color: var(--ink); }

.msg { padding: 3px 0; }
.msg .tag {
  display: inline-block; font-size: 0.72em; font-weight: 700; padding: 0 6px; margin-right: 6px;
  border-radius: 999px; color: var(--accent-ink); background: var(--tag, var(--accent)); vertical-align: 1px;
}
.msg.multi { border-left: 3px solid var(--tag, var(--accent)); padding-left: 8px; margin-left: -3px; }
.feed[data-tag="bar"] .msg .tag { display: none; }
.msg .tag.pic { padding: 0; background: none; width: 1.5em; height: 1.5em; vertical-align: middle; margin-right: 6px; }
.msg .tag.pic img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; box-shadow: 0 0 0 2px var(--tag, var(--accent)); }
.msg .who { font-weight: 700; }
.msg .colon { color: var(--mute); margin-right: 4px; }
.msg .text { color: var(--ink); }
.msg img.emote { height: 1.7em; width: auto; vertical-align: middle; margin: -2px 1px; }
.msg.gone .text { color: var(--mute); font-style: italic; }
.msg .rep { display: block; color: var(--mute); font-size: 0.85em; }
.sys { color: var(--mute); padding: 4px 0; font-size: 0.9em; }

.jump {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px;
  padding: 6px 14px; font-size: 13px; font-weight: 700; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

/* the small window: the way home is just in the way */
.popout .home, .popout #popout { display: none; }
.popout .app { padding: 8px; }

@media (max-width: 340px) {
  .ic { padding: 4px 6px; }
  .brand h1 { font-size: 14px; }
}
