:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #181a1f;
  --panel-2: #20232a;
  --line: #30343d;
  --text: #f2f4f7;
  --muted: #9299a6;
  --youtube: #ff4a4a;
  --twitch: #a970ff;
  --vkplay: #2688eb;
  --focus: #ffd166;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, Segoe UI, Arial, sans-serif;
  letter-spacing: 0;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 209, 102, 0.1), transparent 32rem),
    var(--bg);
}

.login-shell {
  width: min(100% - 32px, 380px);
}

.login-card {
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
}

.login-brand {
  margin-bottom: 4px;
}

.login-brand h1 {
  font-size: 22px;
}

.login-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.login-field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
}

.login-field input:focus {
  border-color: var(--focus);
}

.login-button {
  height: 42px;
  padding: 0 16px;
  border: 1px solid #6d5730;
  border-radius: 7px;
  background: #262015;
  color: var(--text);
  font-weight: 700;
}

.login-button:disabled {
  cursor: default;
  opacity: 0.65;
}

.login-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 13px;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: normal;
  text-align: center;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  transition: grid-template-columns 160ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 56px minmax(0, 1fr);
}

.sources-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
}

.brand-row,
.chat-header,
.source-row,
.message {
  border-bottom: 1px solid var(--line);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  flex: 0 0 auto;
}

.brand-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.sidebar-toggle-button svg {
  transition: transform 160ms ease;
}

.sidebar-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.app-shell.sidebar-collapsed .sources-panel {
  gap: 0;
  align-items: center;
  padding: 12px 8px;
}

.app-shell.sidebar-collapsed .brand-row {
  justify-content: center;
  width: 100%;
  padding-bottom: 0;
  border-bottom: 0;
}

.app-shell.sidebar-collapsed .brand-row > div:first-child,
.app-shell.sidebar-collapsed #openOverlayButton,
.app-shell.sidebar-collapsed .sidebar-content {
  display: none;
}

.app-shell.sidebar-collapsed .brand-actions {
  gap: 0;
}

.app-shell.sidebar-collapsed .sidebar-toggle-button svg {
  transform: rotate(180deg);
}

h1 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
}

p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.process-state.ok {
  color: #73d68c;
}

.process-state.bad {
  color: var(--danger);
}

.source-form {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 42px;
  gap: 8px;
}

.source-form input,
.source-form select {
  width: 100%;
  min-width: 0;
  height: 42px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  line-height: 40px;
  outline: none;
}

.source-form select,
.overlay-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--panel-2);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  text-align: center;
  text-align-last: center;
}

.source-form select {
  padding: 0 22px;
}

.source-form input:focus,
.source-form select:focus {
  border-color: var(--focus);
}

.source-form-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.source-form-meta strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.source-form-meta strong.full {
  color: var(--danger);
}

.source-form-status {
  min-height: 14px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.source-form-status.ok {
  color: #73d68c;
}

.source-form-status.error {
  color: var(--danger);
}

.icon-button,
.add-button,
.row-action {
  display: inline-grid;
  place-items: center;
  align-content: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  line-height: 1;
}

.add-button {
  width: 42px;
  height: 42px;
  background: #243228;
  border-color: #315c42;
}

.icon-button svg,
.add-button svg,
.row-action svg {
  width: 19px;
  height: 19px;
  display: block;
  fill: currentColor;
}

.source-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}

.settings-panel,
.auth-panel,
.source-add-panel,
.commands-panel,
.timed-messages-panel,
.sources-list-panel,
.team-panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #15171c;
}

.sidebar-section {
  flex: 0 0 auto;
}

.sidebar-section[open] {
  background: #161922;
  border-color: #363b46;
}

.sidebar-section-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.sidebar-section-summary::-webkit-details-marker {
  display: none;
}

.sidebar-section-summary > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.sidebar-section-summary strong {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-section-summary small {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-chevron {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: var(--muted);
  transition: transform 140ms ease, fill 140ms ease;
}

.sidebar-section[open] > .sidebar-section-summary .section-chevron {
  transform: rotate(180deg);
  fill: var(--focus);
}

.source-add-panel .source-form,
.auth-panel .auth-actions,
.settings-panel .filter-fields,
.commands-panel .chat-command-form,
.timed-messages-panel .timed-message-form,
.sources-list-panel .source-list {
  margin-top: 12px;
}

.auth-title-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #ff5d5d;
  box-shadow: 0 0 0 2px rgba(255, 93, 93, .12);
}

.status-dot.ok {
  background: #4ee078;
  box-shadow: 0 0 0 2px rgba(78, 224, 120, .14), 0 0 10px rgba(78, 224, 120, .18);
}

.status-dot.bad {
  background: #ff5d5d;
  box-shadow: 0 0 0 2px rgba(255, 93, 93, .12);
}

.team-panel {
  background:
    linear-gradient(180deg, rgba(255, 209, 102, .055), transparent 72%),
    #15171c;
}

.team-content {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.team-group-title {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.team-group {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.team-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 7px 8px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 7px;
  background: rgba(255, 255, 255, .035);
}

.team-link:hover {
  border-color: rgba(255, 209, 102, .38);
  background: rgba(255, 209, 102, .075);
}

.team-link span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
}

.team-link.developer span:first-child {
  color: var(--focus);
}

.team-link-badge {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 28px;
  height: 20px;
  padding: 0 6px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.team-link-badge.twitch {
  color: #fff;
  background: #9146ff;
}

.team-link-badge.telegram {
  color: #fff;
  background: #229ed9;
}

.auth-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.auth-heading h2 {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.settings-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.settings-heading h2 {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
}

.settings-heading p {
  margin-top: 3px;
}

.mini-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  height: 31px;
  min-height: 31px;
  padding: 0 9px;
  border: 1px solid #6d5730;
  border-radius: 6px;
  background: #262015;
  line-height: 29px;
  white-space: nowrap;
}

.mini-button.danger {
  color: var(--danger);
}

.filter-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.settings-save-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.meme-command-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.overlay-link-check {
  margin-top: 10px;
}

.meme-command-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.meme-command-heading h3 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
}

.meme-command-heading span {
  color: var(--muted);
  font: 700 11px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.filter-field {
  min-width: 0;
}

.filter-field span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.filter-field textarea {
  width: 100%;
  min-height: 58px;
  resize: vertical;
  color: var(--text);
  background: #0f1014;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 9px;
  outline: none;
}

.filter-field textarea:focus {
  border-color: var(--focus);
}

.settings-result {
  min-height: 17px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.settings-result.ok {
  color: #73d68c;
}

.settings-result.error {
  color: var(--danger);
}

.chat-command-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.chat-command-form input,
.chat-command-form textarea {
  min-width: 0;
  color: var(--text);
  background: #0f1014;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

.chat-command-form input {
  height: 34px;
  padding: 0 9px;
  font: 700 13px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.chat-command-form textarea {
  grid-column: 1 / -1;
  min-height: 62px;
  resize: vertical;
  padding: 8px 9px;
}

.chat-command-form input:focus,
.chat-command-form textarea:focus {
  border-color: var(--focus);
}

.chat-command-form .mini-button {
  height: 34px;
  min-height: 34px;
}

.timed-message-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.timed-message-form textarea,
.timed-message-interval input {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: #0f1014;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

.timed-message-form textarea {
  min-height: 62px;
  resize: vertical;
  padding: 8px 9px;
}

.timed-message-form textarea:focus,
.timed-message-interval input:focus {
  border-color: var(--focus);
}

.timed-message-interval {
  display: grid;
  gap: 4px;
}

.timed-message-interval span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.timed-message-interval input {
  height: 34px;
  padding: 0 9px;
  font: 700 13px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.timed-message-platforms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.timed-message-platforms label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 6px;
  background: rgba(0, 0, 0, .16);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.timed-message-platforms input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--focus);
}

.timed-message-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.timed-message-item strong {
  color: #9ecbff;
}

.timed-message-countdown {
  color: #7dd3fc;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.chat-command-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.chat-command-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 6px;
  background: rgba(0, 0, 0, .18);
}

.chat-command-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.chat-command-main strong {
  color: var(--focus);
  font: 800 12px/1.15 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.chat-command-main span {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-action.compact {
  width: 30px;
  height: 30px;
}

.command-empty {
  color: var(--muted);
  font-size: 12px;
}

.source-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
}

.platform-dot {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  text-decoration: none;
  transition: filter 120ms ease, transform 120ms ease;
}

.platform-dot:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.platform-dot svg,
.message-platform svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

.platform-dot img,
.message-platform img {
  width: 22px;
  height: 22px;
  display: block;
  object-fit: contain;
  border-radius: 5px;
}

.platform-dot.youtube {
  background: var(--youtube);
}

.platform-dot.twitch {
  background: var(--twitch);
}

.platform-dot.vkplay {
  background: var(--vkplay);
}

.source-meta {
  min-width: 0;
}

.source-title,
.source-status {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.source-title {
  font-weight: 700;
  font-size: 14px;
}

.source-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.source-title-row .source-title {
  min-width: 0;
}

.source-status {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.row-action {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  line-height: 1;
}

.row-action.text-action {
  width: auto;
  min-width: 46px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.row-action.start {
  color: #b7f7cc;
  border-color: #2f7047;
  background: #183021;
}

.row-action.stop {
  color: #ffd4d4;
  border-color: #6c3939;
  background: #302020;
}

.row-action.danger {
  color: var(--danger);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  grid-template-areas:
    "chat-header"
    "message-toolbar"
    "saved-messages"
    "messages"
    "chat-send";
  min-width: 0;
  min-height: 0;
  height: 100vh;
  overflow: hidden;
  background: #0d0f12;
}

.chat-header {
  grid-area: chat-header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding: 14px 18px;
  background: rgba(24, 26, 31, 0.96);
}

.totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(88px, 1fr));
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.totals > div {
  min-width: 0;
  padding-left: 10px;
  border-left: 3px solid var(--line);
}

.metric-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.totals .youtube {
  border-color: var(--youtube);
}

.totals .twitch {
  border-color: var(--twitch);
}

.totals .vkplay {
  border-color: var(--vkplay);
}

.metric-label {
  display: block;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-toggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border-radius: 5px;
  color: #b7c1d1;
  border-color: rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .04);
  position: relative;
}

.metric-toggle svg {
  width: 14px;
  height: 14px;
  display: block;
  fill: currentColor;
}

.metric-toggle:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .09);
}

.metric-toggle.is-hidden {
  color: #ff8e8e;
  border-color: rgba(255, 107, 107, .3);
  background: rgba(255, 107, 107, .08);
}

.metric-toggle.is-hidden::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 2px;
  background: currentColor;
  transform: rotate(-42deg);
  border-radius: 999px;
}

.totals strong {
  display: block;
  margin-top: 2px;
  font-size: 19px;
  line-height: 1.1;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.overlay-alert-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.alert-editor-button {
  min-width: 62px;
  gap: 6px;
}

.alert-editor-button .meme-left {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.alert-play-button {
  width: 44px;
  min-width: 44px;
  padding: 0;
}

.alert-play-button svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

.alert-play-button:disabled {
  opacity: .6;
  cursor: default;
}

.alert-editor-button.is-active {
  color: #fff;
  border-color: rgba(255, 209, 102, .45);
  background: rgba(255, 209, 102, .08);
}

.alert-editor-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 36;
  width: min(430px, calc(100vw - 48px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #15171c;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .38);
}

.meme-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px 34px auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.meme-select {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111319;
  font: 700 13px/1 Arial, sans-serif;
}

.meme-upload-button {
  position: relative;
  min-width: 92px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.meme-upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.meme-delete-button,
.meme-preview-mute-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
}

.meme-delete-button svg,
.meme-preview-mute-button svg {
  width: 17px;
  height: 17px;
  display: block;
  fill: currentColor;
}

.meme-preview-mute-button.is-muted {
  color: var(--focus);
  border-color: rgba(255, 202, 102, .5);
  background: rgba(255, 202, 102, .12);
}

.meme-upload-status {
  min-height: 16px;
  margin: -3px 0 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.meme-upload-status.ok {
  color: #7af59b;
}

.meme-upload-status.error {
  color: #ff7b7b;
}

.meme-storage-panel {
  margin: 2px 0 10px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 6px;
  background: rgba(0, 0, 0, .18);
}

.meme-storage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.meme-storage-head strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.meme-storage-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #0b0d11;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}

.meme-storage-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4ee078, #ffd166);
  transition: width 180ms ease, background 180ms ease;
}

.meme-storage-bar span.warn {
  background: linear-gradient(90deg, #ffd166, #ff9f43);
}

.meme-storage-bar span.danger {
  background: linear-gradient(90deg, #ff8a65, #ff5d5d);
}

.alert-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  cursor: crosshair;
  border: 1px solid #39404d;
  border-radius: 6px;
  background:
    linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px),
    radial-gradient(circle at 18% 18%, rgba(145, 71, 255, .14), transparent 26%),
    #0b0d11;
  background-size: 32px 32px, 32px 32px, auto, auto;
}

.alert-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 209, 102, .18);
  pointer-events: none;
}

.alert-stage::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: 10px;
  top: 10px;
  width: 78px;
  height: calc(100% - 20px);
  border: 1px solid rgba(201, 154, 74, .42);
  background:
    linear-gradient(rgba(201, 154, 74, .3), rgba(201, 154, 74, .3)) 12px 12px / 54px 5px no-repeat,
    repeating-linear-gradient(
      to bottom,
      transparent 0 24px,
      rgba(201, 154, 74, .18) 24px 25px,
      transparent 25px 32px
    ),
    rgba(8, 8, 7, .72);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, .8);
  pointer-events: none;
}

.alert-marker {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
  transform: translate(-50%, -50%) scale(var(--alert-scale, 1));
  border: 2px solid rgba(255, 209, 102, .9);
  border-radius: 8px;
  background: rgba(255, 209, 102, .08);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .38);
}

.alert-marker:active {
  cursor: grabbing;
}

.alert-marker::before,
.alert-marker::after {
  content: "";
  position: absolute;
  background: rgba(255, 209, 102, .9);
  pointer-events: none;
}

.alert-marker::before {
  left: 50%;
  top: -10px;
  bottom: -10px;
  width: 2px;
  transform: translateX(-50%);
}

.alert-marker::after {
  left: -10px;
  right: -10px;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
}

.alert-marker video {
  width: 76px;
  height: 76px;
  display: block;
  object-fit: contain;
  pointer-events: none;
  transform-origin: center;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .55));
}

.alert-rotate-control,
.alert-scale-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 42px;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.alert-rotate-control input,
.alert-scale-control input {
  width: 100%;
  accent-color: var(--focus);
}

.alert-rotate-control output,
.alert-scale-control output {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.alert-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.admin-settings {
  position: relative;
  flex: 0 0 auto;
}

.admin-settings-button {
  width: 36px;
  height: 36px;
}

.admin-settings-button.is-active,
.admin-settings-button:hover {
  color: #fff;
  border-color: rgba(255, 209, 102, .45);
  background: rgba(255, 209, 102, .08);
}

.admin-settings-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: 312px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #15171c;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .36);
}

.setting-check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.setting-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--focus);
}

.admin-settings-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.overlay-select {
  height: 36px;
  min-height: 36px;
  min-width: 172px;
  padding: 0 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  font: inherit;
  line-height: 34px;
}

.overlay-select.is-exclusive {
  border-color: rgba(244, 187, 82, 0.9);
  color: #ffd36b;
  background-color: #20180b;
  box-shadow: 0 0 0 1px rgba(244, 187, 82, 0.18), 0 0 18px rgba(244, 187, 82, 0.12);
}

.overlay-select option {
  color: var(--text);
  background: var(--panel-2);
}

.overlay-select option.exclusive-overlay-option {
  color: #ffd36b;
  background: #1b1408;
  font-weight: 700;
}

.ghost-button {
  display: inline-grid;
  place-items: center;
  height: 36px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  line-height: 34px;
  white-space: nowrap;
}

.ghost-button.danger {
  color: var(--danger);
}

.messages {
  grid-area: messages;
  min-height: 0;
  overflow: auto;
  padding: 8px 18px;
  scrollbar-width: thin;
}

.message-toolbar {
  grid-area: message-toolbar;
  display: grid;
  grid-template-columns: minmax(180px, 360px) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 20, 25, .96);
}

.message-search-field {
  min-width: 0;
}

.message-search-field input {
  width: 100%;
  height: 34px;
  padding: 0 11px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #111319;
  outline: none;
}

.message-search-field input:focus {
  border-color: var(--focus);
}

.message-search-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
  white-space: nowrap;
}

.saved-toggle {
  justify-self: end;
  gap: 7px;
  min-width: 128px;
  overflow: hidden;
  white-space: nowrap;
}

.saved-toggle.is-active {
  color: var(--focus);
  border-color: rgba(255, 209, 102, .55);
  background: rgba(255, 209, 102, .11);
}

.saved-toggle span {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
}

.saved-messages-panel {
  grid-area: saved-messages;
  min-height: 0;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 16, 20, .98);
}

.saved-messages-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.saved-messages-head strong {
  font-size: 13px;
}

.saved-messages-head span {
  color: var(--muted);
  font-size: 12px;
}

.saved-messages-list {
  max-height: min(320px, 36vh);
  overflow: auto;
  border: 1px solid rgba(255, 209, 102, .14);
  border-radius: 7px;
  background: rgba(255, 209, 102, .035);
  scrollbar-width: thin;
}

.saved-message {
  padding-left: 10px;
  padding-right: 10px;
  background: rgba(255, 209, 102, .035);
}

.saved-empty {
  display: grid;
  place-items: center;
  min-height: 72px;
  color: var(--muted);
  font-size: 13px;
}

.chat-send-form {
  grid-area: chat-send;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  grid-template-areas:
    "input send targets"
    "status status status";
  gap: 8px;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: rgba(24, 26, 31, 0.96);
}

.chat-send-form input {
  grid-area: input;
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #111319;
  outline: none;
}

.chat-send-form input:focus {
  border-color: var(--focus);
}

.chat-send-button {
  grid-area: send;
  min-width: 106px;
}

.chat-send-targets {
  grid-area: targets;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-send-target {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #fff;
  background: var(--panel-2);
  opacity: .45;
}

.chat-send-target[hidden] {
  display: none;
}

.chat-send-target svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}

.chat-send-target img {
  width: 20px;
  height: 20px;
  display: block;
}

.chat-send-target.twitch {
  background: rgba(169, 112, 255, .14);
  border-color: rgba(169, 112, 255, .38);
}

.chat-send-target.youtube {
  background: rgba(255, 74, 74, .14);
  border-color: rgba(255, 74, 74, .38);
}

.chat-send-target.vkplay {
  background: rgba(38, 136, 235, .14);
  border-color: rgba(38, 136, 235, .38);
}

.chat-send-target.is-selected {
  opacity: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}

.chat-send-target:disabled {
  cursor: default;
  opacity: .22;
}

.chat-send-status {
  grid-area: status;
  min-height: 15px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.chat-send-status.ok {
  color: #73d68c;
}

.chat-send-status.error {
  color: var(--danger);
}

.empty {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
  font-size: 15px;
}

.message {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  animation: message-in 160ms ease-out;
}

.message-platform {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  flex: 0 0 auto;
  text-decoration: none;
  transition: filter 120ms ease, transform 120ms ease;
}

.message-platform.youtube {
  background: var(--youtube);
}

.message-platform.twitch {
  background: var(--twitch);
}

.message-platform.vkplay {
  background: var(--vkplay);
}

.message-body {
  min-width: 0;
  line-height: 1.45;
  overflow-wrap: anywhere;
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
}

.message-main {
  min-width: 0;
}

.message-text {
  vertical-align: middle;
}

.message-link {
  color: #6fb7ff;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.message-link:hover {
  color: #9ed0ff;
}

.reply-context {
  display: flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  gap: 5px;
  margin: 0 0 4px;
  padding: 4px 7px;
  overflow: hidden;
  color: var(--muted);
  background: rgba(38, 136, 235, .12);
  border-left: 2px solid rgba(38, 136, 235, .7);
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.25;
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
  white-space: nowrap;
}

.message.has-reply {
  background: linear-gradient(90deg, rgba(38, 136, 235, .06), transparent 34%);
}

.reply-user {
  flex: 0 0 auto;
  color: #9ecbff;
  font-weight: 800;
}

.reply-text {
  min-width: 0;
  overflow: hidden;
  display: block;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.username {
  font-weight: 800;
  margin-right: 5px;
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
  vertical-align: middle;
}

.username-colon {
  display: inline-block;
  margin-right: 5px;
  font-weight: 800;
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
  vertical-align: middle;
}

.message-tools {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding-top: 0;
  white-space: nowrap;
}

.time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.message-save,
.message-delete {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border-radius: 5px;
  font-family: Arial, sans-serif;
  font-size: 0;
  font-weight: 700;
  line-height: 1;
}

.message-save {
  color: #ffd166;
  border-color: rgba(255, 209, 102, .28);
  background: rgba(255, 209, 102, .08);
}

.message-delete {
  color: #ff8e8e;
  border-color: rgba(255, 107, 107, .28);
  background: rgba(255, 107, 107, .08);
}

.message-save::before,
.message-delete::before {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
}

.message-save::before {
  content: "\2606";
}

.message-save.is-saved::before {
  content: "\2605";
}

.message-save:hover,
.message-save.is-saved {
  color: #fff1b5;
  border-color: rgba(255, 209, 102, .7);
  background: rgba(255, 209, 102, .2);
}

.message-delete::before {
  content: "\00d7";
}

.message-delete:hover {
  color: #fff;
  border-color: rgba(255, 107, 107, .7);
  background: rgba(255, 107, 107, .22);
}

.message-save:disabled,
.message-delete:disabled {
  opacity: .45;
  cursor: default;
}

.native-badge,
.emote {
  display: inline-block;
  vertical-align: middle;
  object-fit: contain;
}

.native-badge {
  width: 18px;
  height: 18px;
  margin-right: 4px;
}

.native-text-badge {
  display: inline-flex;
  align-items: center;
  max-width: 78px;
  height: 18px;
  margin-right: 4px;
  padding: 0 6px;
  overflow: hidden;
  border-radius: 5px;
  color: #fff;
  background: #7c3aed;
  font: 800 11px/18px Arial, sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.badge {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 5px;
  padding: 0;
  border-radius: 4px;
  line-height: 1;
  vertical-align: middle;
  background: #30343d;
}

.badge svg {
  width: 14px;
  height: 14px;
  display: block;
  fill: currentColor;
}

.badge.owner {
  color: #231400;
  background: #ffd166;
}

.badge.vkplay-badge.owner {
  color: #fff;
  background: #2887ff;
}

.badge.vkplay-badge.owner svg {
  width: 15px;
  height: 15px;
}

.badge.mod {
  color: #061423;
  background: #80c7ff;
}

.badge.vkplay-badge.mod {
  color: #fff;
  background: #23c75a;
}

.badge.vkplay-badge.mod svg {
  width: 18px;
  height: 18px;
}

.badge.member {
  color: #04150c;
  background: #67e39d;
}

.badge.verified {
  color: #061423;
  background: #ffd84a;
}

.badge.youtube-badge.verified {
  width: 16px;
  height: 16px;
  margin: 0 4px;
  border-radius: 50%;
  color: #fff;
  background: #3ea6ff;
}

.badge.youtube-badge.verified svg {
  width: 12px;
  height: 12px;
}

.badge.youtube-badge.mod {
  width: 17px;
  height: 17px;
  margin: 0 4px;
  color: #3ea6ff;
  background: transparent;
}

.badge.youtube-badge.mod svg {
  width: 17px;
  height: 17px;
}

.badge.topfan {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: auto;
  min-width: 35px;
  height: 18px;
  margin: 0 5px;
  padding: 0 6px 0 5px;
  border-radius: 4px;
  color: #fff;
  background: #7e3ff2;
  vertical-align: middle;
}

.badge.topfan .crown-icon {
  display: block;
  width: 14px;
  height: 14px;
  color: #fff;
  fill: currentColor;
  flex: 0 0 auto;
}

.badge.topfan .badge-rank {
  color: #fff;
  font: 800 11px/1 Arial, sans-serif;
}

.badge.vk-helmet {
  color: #de6f23;
  background: transparent;
}

.badge.vk-helmet svg {
  width: 18px;
  height: 18px;
}

.emote {
  max-width: 24px;
  max-height: 24px;
  margin: 0 2px;
}

.reply-context .reply-emote {
  max-width: 18px;
  max-height: 18px;
  margin: 0 1px;
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .sources-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .app-shell.sidebar-collapsed .sources-panel {
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .chat-header {
    align-items: stretch;
    flex-direction: column;
  }

  .message-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .saved-toggle {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-send-form {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "input input"
      "send targets"
      "status status";
  }
}
