/* Chorus — merged Twitch + YouTube chat reader (Broadcast design).
   Bold, glanceable, calm. Brand colour appears ONLY in the per-row source glyph block and the
   header live dots — never as a full-row fill. Tokens come from tokens.css. */

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-dim);
  border-right: 1px solid var(--border-dim);
}

/* ─────────────────────────── STATUS BAR ─────────────────────────── */
.bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--s4);
  height: 52px;
  padding: 0 var(--s4) 0 var(--s4);
  border-bottom: 1px solid var(--border-dim);
  background: linear-gradient(180deg, #0e0f13, var(--bg-panel));
}

/* left: real stream uptime */
.uptime {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.uptime .rec {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--live);
  animation: rec-pulse 2s var(--ease-inout) infinite;
}
.uptime .clock {
  font-family: var(--font-mono);
  font-size: var(--fs-base);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.uptime[data-offline] .rec { background: var(--text-disabled); animation: none; }
.uptime[data-offline] .clock { color: var(--text-muted); }
@keyframes rec-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* divider between uptime and source counts */
.dots {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-left: var(--s4);
  border-left: 1px solid var(--border-dim);
}
.src-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.src-dot .dot {
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  background: var(--text-disabled);
  transition: background var(--dur-fast) var(--ease-out);
}
.src-dot[data-state="live"] { color: var(--text-secondary); }
.src-dot[data-platform="twitch"][data-state="live"] .dot { background: var(--tw); }
.src-dot[data-platform="youtube"][data-state="live"] .dot { background: var(--yt); }
.src-dot[data-state="lagging"] .dot { background: var(--warning); }
.src-dot[data-state="error"] .dot { background: var(--danger); }
.src-dot .cnt { color: var(--text-muted); font-weight: 500; }
.src-dot[data-state="live"] .cnt { color: var(--text-primary); }

.spacer { flex: 1; }

/* right: total live viewers — bold headline number, eye glyph instead of a word */
.total {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.total .eye {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
}
.total .n {
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ─────────────────────────── FEED ─────────────────────────── */
.chat {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.feed {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-anchor: none;
  padding: var(--s2) 0 var(--s4);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}
.feed::-webkit-scrollbar { width: 8px; }
.feed::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 4px; }
.feed::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.26); }

.msg {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 10px;
  padding: 9px var(--s5) 9px 16px;
  align-items: start;
}
.msg[data-source="twitch"]:hover { background: rgba(145, 70, 255, 0.07); }
.msg[data-source="youtube"]:hover { background: rgba(240, 40, 45, 0.06); }

/* source glyph block — the always-visible source marker (compact) */
.glyph {
  width: 16px;
  height: 16px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  margin-top: 2px;
}
.msg[data-source="twitch"] .glyph { background: var(--tw); }
.msg[data-source="youtube"] .glyph { background: var(--yt); }
.glyph svg { width: 10px; height: 10px; }
.glyph svg path { fill: #fff; }

.bodycol { min-width: 0; }
.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
  line-height: var(--lh-tight);
}
.handle {
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: -0.01em;
}
.badges {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.badge {
  width: 14px;
  height: 14px;
}
.badge.broadcaster { color: var(--pin); }
.badge.moderator { color: var(--success); }
.badge.vip { color: #ff79c6; }
.badge.subscriber { color: var(--accent-hover); }
.badge.verified { color: var(--tw-handle); }

.ts {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.body {
  font-size: 15.5px;
  line-height: var(--lh-normal);
  color: var(--text-chat);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.body .mention { color: var(--text-mention); }
.body .ticker { color: var(--text-ticker); font-family: var(--font-mono); font-size: 0.92em; }
.body .link { color: var(--accent-hover); text-decoration: none; word-break: break-all; }
.body .link:hover { text-decoration: underline; }

/* emotes inline (rows.ts sets height=18; keep aligned, no line jitter) */
.chat-emote {
  width: auto;
  vertical-align: -0.3em;
  margin: 0 1px;
}
.msg[data-emote-only] .chat-emote { height: 30px !important; vertical-align: -0.5em; }

/* new-message entrance — opacity+transform only, ease-out, no bounce/glow */
.msg.enter { animation: msg-in 180ms var(--ease-out); }
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ─────────────────────────── RESUME PILL ─────────────────────────── */
.resume {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(22px);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  border-radius: var(--r-lg);
  background: var(--bg-overlay);
  border: 1px solid var(--border-base);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}
.chat.paused .resume {
  opacity: 1;
  transform: translateX(-50%);
  pointer-events: auto;
}
.resume svg { width: 14px; height: 14px; }
.resume .dotpair { display: flex; gap: 3px; }
.resume .dotpair i { width: 6px; height: 6px; border-radius: var(--r-full); }
.resume .dotpair i:nth-child(1) { background: var(--tw); }
.resume .dotpair i:nth-child(2) { background: var(--yt); }
