:root {
  color-scheme: dark;
  font: 18px/1.5 system-ui, sans-serif;
  background: transparent;
  color: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; background: #000; }
#app {
  height: 100vh;
  height: 100dvh;
  max-width: 1200px;
  margin: auto;
  display: flex;
  flex-direction: column;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  gap: 12px;
}
header { display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 14px; font-weight: 800; letter-spacing: .1em; }
.brand span { color: #8c8c95; font-weight: 400; margin-left: 10px; letter-spacing: 0; }
button, input, select {
  font: inherit;
  border: 1px solid #34343b;
  border-radius: 10px;
  background: #16161b;
  color: #fff;
  padding: 10px;
}
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #aaa; outline-offset: 2px; }
#counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
#counts.no-active-counts { display: none; }
.count { border: 1px solid #29292f; border-radius: 12px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; }
.count strong { margin-left: auto; font-size: 28px; font-variant-numeric: tabular-nums; }
.count small { font-size: 13px; }
.count-label { display: flex; flex-direction: column; }
.last-message { color: #999; font-size: 11px !important; }
.icon { display: inline-block; width: 24px; height: 24px; flex-shrink: 0; vertical-align: middle; }
.icon svg { width: 100%; height: 100%; display: block; }
#connection, #feedback { font-size: 12px; color: #999; min-height: 18px; }
#connection.bad { color: #ff9b9b; }
#chat { flex: 1; overflow: auto; overflow-wrap: anywhere; min-height: 0; scrollbar-color: #333 #000; }
.message { padding: 10px 3px; }
.message .name { font-weight: 750; margin: 0 9px; }
.message .body { white-space: pre-wrap; }
.message.event { border-left: 2px solid #aaa; padding-left: 12px; background: #101013; }
.details { display: block; font-size: 14px; color: #ccc; margin-top: 4px; }
.emote { height: 1.6em; max-width: 5em; object-fit: contain; vertical-align: middle; }
#empty { font-size: 15px; color: #888; text-align: center; margin-top: 15vh; }
#obs-visibility { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; }
#obs-visibility label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
#obs-visibility input { width: 18px; height: 18px; margin: 0; padding: 0; }
#compose { display: flex; gap: 8px; }
#message { min-width: 0; flex: 1; }
#send { background: #e8e8ed; color: #111; font-weight: 700; }
#feedback { margin-top: 5px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

html.obs, html.obs body, body.obs, body.obs #app, body.obs #chat {
  background: transparent !important;
  background-color: rgba(0, 0, 0, 0) !important;
}
.obs header, .obs footer, .obs #connection { display: none; }
.obs #app { max-width: none; }
.obs .count.unavailable { display: none; }
.obs .platform-disabled { display: none !important; }
.obs #chat { scrollbar-width: none; -ms-overflow-style: none; }
.obs #chat::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* Viewer overlay: high contrast on a dark stream background without bright boxes. */
.obs #counts {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: clamp(7px, 1.1vw, 12px);
}
.obs .count {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 14px;
  background: rgba(20, 20, 24, .94);
  box-shadow: 0 7px 22px rgba(0, 0, 0, .38);
  color: #fff;
  padding: clamp(9px, 1.2vw, 14px);
}
.obs .count small,
.obs .count strong,
.obs #connection,
.obs #connection.bad,
.obs #feedback,
.obs #empty,
.obs .message,
.obs .message .name,
.obs .message .body,
.obs .details {
  color: #fff;
}
.obs #connection, .obs #feedback {
  font-size: 12px;
  font-weight: 700;
}
.obs .message {
  display: grid;
  grid-template-columns: 26px auto minmax(0, 1fr);
  align-items: start;
  gap: 5px 9px;
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 13px;
  background: rgba(20, 20, 24, .92);
  box-shadow: 0 5px 18px rgba(0, 0, 0, .34);
}
.obs .message .icon { margin-top: 1px; }
.obs .message .name {
  margin: 0;
  line-height: 1.45;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .75);
}
.obs .message .body {
  min-width: 0;
  line-height: 1.45;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .75);
}
.obs .message .details {
  grid-column: 2 / -1;
  margin-top: 0;
  color: #e5e5e8;
}
.obs .message[data-platform="twitch"] .name { color: #b98cff; }
.obs .message[data-platform="kick"] .name { color: #72ff40; }
.obs .message[data-platform="youtube"] .name { color: #ff657f; }
.obs .message.event {
  border-left-width: 3px;
  background: rgba(26, 26, 31, .96);
}
.message.event-follow, .obs .message.event-follow { border-left-color: #53fc18; }
.message.event-raid, .obs .message.event-raid { border-left-color: #55b8ff; }
.message.event-support, .obs .message.event-support { border-left-color: #ffd54a; }
.message.event-status { border-left-color: #8c8c95; }

@media (max-width: 520px) {
  :root { font-size: 16px; }
  #app { gap: 8px; }
  .count { padding: 8px; gap: 5px; flex-wrap: wrap; }
  .count strong { font-size: 25px; }
  .count small { font-size: 11px; }
  .count .icon { width: 18px; height: 18px; }
  #compose { flex-wrap: wrap; }
  #platform { width: 105px; }
  #send { padding: 10px 12px; }
  header button { font-size: 12px; }
  .brand span { display: none; }
  .obs #counts { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .obs .message {
    grid-template-columns: 22px auto minmax(0, 1fr);
    padding: 8px 10px;
    gap: 4px 7px;
  }
  .obs .message .icon { width: 22px; height: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
