:root {
  --sct-font-family: Arial, sans-serif;
  --sct-font-size: 14px;
  --sct-bg: #111827;
  --sct-text: #f9fafb;
  --sct-primary: #2563eb;
  --sct-primary-hover: #1d4ed8;
  --sct-button-text: #f9fafb;
  --sct-upload-button-bg: #2563eb;
  --sct-upload-button-hover: #1d4ed8;
  --sct-upload-button-text: #f9fafb;
  --sct-upload-button-border: #1d4ed8;
  --sct-button-accept: #16a34a;
  --sct-button-accept-hover: #15803d;
  --sct-button-accept-text: #f9fafb;
  --sct-button-cancel: #dc2626;
  --sct-button-cancel-hover: #b91c1c;
  --sct-button-cancel-text: #f9fafb;
  --sct-surface: #1f2937;
  --sct-surface-alt: #111827;
  --sct-input-bg: #0f172a;
  --sct-input-text: #f9fafb;
  --sct-input-border: #374151;
  --sct-select-bg: #0f172a;
  --sct-select-text: #f9fafb;
  --sct-select-border: #374151;
  --sct-control-height: 36px;
  --sct-checkbox-scale-percent: 100;
  --sct-control-padding-x: 10px;
  --sct-page-section-gap: 14px;
  --sct-card-radius: 12px;
  --sct-card-padding: 12px;
  --sct-card-gap: 12px;
  --sct-card-header-gap: 10px;
  --sct-card-header-icon-size-pct: 70;
  --sct-card-header-icon-gap: 8px;
  --sct-card-header-icon-indent: 0px;
  --sct-card-title-subtitle-gap: 6px;
  --sct-card-subtitle-body-gap: 10px;
  --sct-row-box-radius: 10px;
  --sct-row-box-padding: 10px;
  --sct-row-field-gap: 8px;
  --sct-row-section-gap: 4px;
  --sct-row-title-size: 12px;
  --sct-row-subtext-size: 12px;
  --sct-row-action-gap: 8px;
  --sct-surface-deep: #020617;
  --sct-border: #374151;
  --sct-muted: #4b5563;
  --sct-link: #93c5fd;
  --sct-poll-color-1: #2563eb;
  --sct-poll-color-2: #16a34a;
  --sct-poll-color-3: #dc2626;
  --sct-poll-color-4: #d97706;
  --sct-page-title-size: 28px;
  --sct-page-subtitle-size: 14px;
  --sct-page-title-subtitle-gap: 6px;
  --sct-page-icon-size-pct: 100;
  --sct-page-icon-gap: 12px;
  --sct-sidebar-left: 16px;
  --sct-sidebar-rail-width: 148px;
  --sct-sidebar-content-offset: calc(var(--sct-sidebar-left) + var(--sct-sidebar-rail-width) + 16px);
  --sct-ui-icon-base-size: 16px;
  --sct-button-icon-size: 15px;
  --sct-icon-size: 16px;
  --sct-icon-color: currentColor;
  --sct-chat-item-bg: #374151;
  --sct-chat-item-border-color: #4b5563;
  --sct-chat-item-text-color: #f9fafb;
  --sct-chat-user-gradient-reach: 32%;
  --sct-chat-user-gradient-opacity: 36%;
  --sct-chat-badge-display: inline-flex;
  --sct-chat-render-badges: 1;
  --sct-chat-render-split: 0;
  --sct-chat-adaptive-burst-mode: 1;
  --sct-chat-burst-mode: 0;
  --sct-chat-burst-backlog-threshold: 60;
  --sct-chat-burst-defer-layout: 1;
  --sct-chat-sse-batch-enabled: 1;
  --sct-chat-sse-batch-window-ms: 16;
  --sct-chat-sse-batch-max-size: 40;
  --sct-chat-animations-enabled: 1;
  --sct-chat-animation-move-duration: 220;
  --sct-chat-animation-move-easing: ease-out;
  --sct-chat-animation-enter-duration: 260;
  --sct-chat-animation-enter-easing: ease-out;
  --sct-chat-animation-enter-offset-x: 36px;
  --sct-chat-animation-enter-start-opacity: 0;
  --sct-chat-animation-max-tracked: 40;
  --sct-chat-layout-visible-only: 1;
  --sct-chat-layout-viewport-buffer: 220;
  --sct-chat-username-color: #93c5fd;
  --sct-chat-top-section-height: 28px;
  --sct-chat-username-top-scale: 100;
  --sct-chat-meta-badge-top-scale: 56;
  --sct-chat-meta-spore-icon-top-scale: 56;
  --sct-chat-meta-spore-count-top-scale: 42;
  --sct-chat-username-max-chars: 18;
  --sct-chat-item-radius: 6px;
  --sct-chat-item-padding-y: 8px;
  --sct-chat-item-padding-x: 8px;
  --sct-chat-container-padding-left: 12px;
  --sct-chat-container-padding-right: 12px;
  --sct-chat-item-gap: 8px;
  --sct-chat-gap: 8px;
  --sct-chat-message-font-size: 14px;
  --sct-chat-message-top-gap: 6px;
  --sct-chat-message-inset-left: 0px;
  --sct-chat-message-inset-right: 0px;
  --sct-chat-message-inset-bottom: 0px;
  --sct-chat-message-max-chars: 260;
  --sct-chat-box-scale: 1;
  --sct-chat-avatar-peek-enabled: 1;
  --sct-chat-avatar-peek-anchor-x: 50%;
  --sct-chat-avatar-peek-anchor-y: 100%;
  --sct-chat-avatar-peek-rotation: -10deg;
  --sct-chat-avatar-peek-scale: 1.5;
  --sct-chat-avatar-peek-offset-x: 0px;
  --sct-chat-avatar-peek-offset-y: 0px;
  --sct-chat-avatar-peek-edge-space: 72px;
  --sct-chat-message-text-offset-x: 0px;
  --sct-chat-message-text-offset-y: 0px;
  --sct-chat-message-offset-y: 0px;
  --sct-chat-message-auto-safe-lines: 2;
  --sct-chat-message-auto-step-percent: 10;
  --sct-chat-message-auto-min-percent: 65;
  --sct-chat-username-weight: 700;
  --sct-chat-username-stroke-black-width: 4.8px;
  --sct-chat-username-stroke-outer-width: 7.4px;
  --sct-chat-username-offset-x: -1px;
  --sct-chat-username-offset-y: 0px;
  --sct-chat-spore-offset-x: 0px;
  --sct-chat-spore-offset-y: 0px;
  --sct-chat-meta-offset-x: 0px;
  --sct-chat-meta-offset-y: 0px;
  --sct-chat-meta-left-padding: 0px;
  --sct-chat-meta-badge-spore-gap: 8px;
  --sct-chat-badge-gap: 4px;
  --sct-chat-message-refresh-count: 20;
  --sct-chat-history-size: 250;
  --sct-chat-avatar-platform-size-scale: 1;
  --sct-chat-avatar-platform-offset-x: 0px;
  --sct-chat-avatar-platform-offset-y: 0px;
  --sct-chat-donation-event-bg: #1f2937;
  --sct-chat-donation-event-border-color: #9f7aea;
  --sct-chat-donation-event-text-color: #ede9fe;
  --sct-chat-donation-event-font-size: 13px;
  --sct-chat-donation-event-radius: 8px;
  --sct-chat-donation-event-padding-top: 6px;
  --sct-chat-donation-event-padding-right: 8px;
  --sct-chat-donation-event-padding-bottom: 6px;
  --sct-chat-donation-event-padding-left: 8px;
  --sct-chat-donation-event-margin-top: 6px;
  --sct-chat-donation-event-margin-right: 0px;
  --sct-chat-donation-event-margin-bottom: 0px;
  --sct-chat-donation-event-margin-left: 0px;
  --sct-chat-donation-event-icon-size: 16px;
  --sct-chat-donation-event-icon-gap: 8px;
  --sct-chat-donation-event-icon-offset-x: 0px;
  --sct-chat-donation-event-icon-offset-y: 0px;
  --sct-chat-reply-bg: #1f2937;
  --sct-chat-reply-border-color: #4b5563;
  --sct-chat-reply-text-color: #d1d5db;
  --sct-chat-reply-font-size: 11px;
  --sct-chat-reply-radius: 4px;
  --sct-chat-reply-padding-x: 6px;
  --sct-chat-reply-padding-y: 2px;
  --sct-chat-reply-gap: 4px;
  --sct-chat-reply-max-lines: 1;
  --sct-chat-reply-max-width: 100%;
  --sct-title-color: #f9fafb;
  --sct-title-size: 32px;
  --sct-logo-size: 44px;
  --sct-top-gradient-color: #ffffff;
  --sct-top-gradient-size: 240px;
  --sct-side-gradient-color: #1d4ed8;
  --sct-side-gradient-size: 220px;
}

body {
  font-family: var(--sct-font-family);
  font-size: var(--sct-font-size);
  margin: 0;
  padding: 20px 20px 24px var(--sct-sidebar-content-offset);
  background-color: var(--sct-bg);
  background-image:
    linear-gradient(to right, var(--sct-side-gradient-color) 0%, transparent var(--sct-side-gradient-size)),
    linear-gradient(to bottom, var(--sct-top-gradient-color) 0%, transparent var(--sct-top-gradient-size));
  background-repeat: no-repeat;
  color: var(--sct-text);
  box-sizing: border-box;
  min-height: 100vh;
}

[hidden] {
  display: none !important;
}

input[type='text'],
input[type='number'],
input[type='search'],
input[type='email'],
input[type='url'],
input[type='password'],
textarea,
select {
  background-color: var(--sct-input-bg);
  color: var(--sct-input-text);
  border-color: var(--sct-input-border);
}

input[type='text']:focus,
input[type='number']:focus,
input[type='search']:focus,
input[type='email']:focus,
input[type='url']:focus,
input[type='password']:focus,
textarea:focus {
  outline: 2px solid #ffffff;
  outline-offset: 1px;
}

select {
  background-color: var(--sct-select-bg);
  color: var(--sct-select-text);
  border-color: var(--sct-select-border);
}

input[type='text'],
input[type='number'],
input[type='search'],
input[type='email'],
input[type='url'],
input[type='password'],
select {
  min-height: 0;
  height: var(--sct-control-height);
  padding-top: 0;
  padding-bottom: 0;
  padding-left: var(--sct-control-padding-x);
  padding-right: var(--sct-control-padding-x);
  box-sizing: border-box;
}

.sct-upload-control {
  display: inline-grid;
  justify-items: start;
  gap: 5px;
  max-width: 100%;
}

.sct-upload-native-input {
  display: none;
}

.sct-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--sct-control-height);
  padding: 0 var(--sct-control-padding-x, 16px);
  border: 1px solid var(--sct-upload-button-border);
  border-radius: 6px;
  background: var(--sct-upload-button-bg);
  color: var(--sct-upload-button-text);
  cursor: pointer;
  font: inherit;
}

.sct-upload-button:hover { background: var(--sct-upload-button-hover); }
.sct-icon.sct-upload-button-icon {
  --sct-icon-size: var(--sct-button-icon-size);
  --sct-icon-color: var(--sct-upload-button-text);
}
.sct-upload-file-name { max-width: 100%; overflow: hidden; color: var(--sct-text); font-size: 12px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }

.sct-page {
  display: flex;
  flex-direction: column;
  gap: var(--sct-page-section-gap);
}

/* Control shape shared by every page, matching the recipe on the UI Template page (ui-template-page.css). */
.sct-page input[type='text'],
.sct-page input[type='number'],
.sct-page input[type='search'],
.sct-page input[type='email'],
.sct-page input[type='url'],
.sct-page input[type='password'],
.sct-page textarea {
  border: 1px solid var(--sct-input-border);
  border-radius: 8px;
  box-sizing: border-box;
  font: inherit;
}

.sct-page select {
  border: 1px solid var(--sct-select-border);
  border-radius: 8px;
  box-sizing: border-box;
  font: inherit;
}

.sct-page input[type='text'],
.sct-page input[type='number'],
.sct-page input[type='search'],
.sct-page input[type='email'],
.sct-page input[type='url'],
.sct-page input[type='password'],
.sct-page select {
  height: var(--sct-control-height);
  min-height: var(--sct-control-height);
  padding: 0 var(--sct-control-padding-x, 10px);
}

.sct-page textarea {
  padding: 8px var(--sct-control-padding-x, 10px);
}

:where(.sct-page button:has(> .sct-icon)) {
  gap: 8px;
}

.sct-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sct-page-section-gap);
}

.sct-page-heading {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--sct-page-icon-gap);
  min-width: 0;
}

.sct-page-heading-text {
  display: flex;
  flex-direction: column;
  gap: var(--sct-page-title-subtitle-gap);
  min-width: 0;
}

.sct-page-title {
  margin: 0;
  font-size: var(--sct-page-title-size);
  line-height: 1.1;
}

.sct-page-subtitle {
  margin: 0;
  font-size: var(--sct-page-subtitle-size);
  line-height: 1.35;
  color: color-mix(in srgb, var(--sct-text) 82%, white 18%);
}

.sct-card {
  border: 1px solid color-mix(in srgb, var(--sct-border) 84%, white 16%);
  border-radius: var(--sct-card-radius);
  background: color-mix(in srgb, var(--sct-surface) 86%, black 14%);
  padding: var(--sct-card-padding);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--sct-card-gap);
}

.sct-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sct-card-header-gap);
  min-height: calc(var(--sct-control-height) + 4px);
}

.sct-card-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sct-card-header-gap);
  min-height: calc(var(--sct-control-height) + 4px);
  padding: var(--sct-card-padding);
  border: none;
  background: color-mix(in srgb, var(--sct-surface-alt) 80%, black 20%);
  color: var(--sct-text);
  text-align: left;
  cursor: pointer;
}

.sct-card-header h4,
.sct-card-header h3 {
  margin: 0;
}

.sct-card-title-with-icon {
  display: flex;
  align-items: center;
  gap: var(--sct-card-header-icon-gap);
  padding-left: var(--sct-card-header-icon-indent);
}

.sct-card-subtitle {
  margin: 0;
  color: color-mix(in srgb, var(--sct-text) 72%, white 28%);
  font-size: 12px;
  min-height: 1.2em;
}

:where(.sct-card, .sessions-current-card, .sessions-create-card, .sessions-list-card, .sessions-detail-card) > .sct-card-subtitle {
  margin-top: calc(var(--sct-card-title-subtitle-gap) - var(--sct-card-gap));
}

:where(.sct-card, .sessions-current-card, .sessions-create-card, .sessions-list-card, .sessions-detail-card) > .sct-card-subtitle:not(:last-child) {
  margin-bottom: calc(var(--sct-card-subtitle-body-gap) - var(--sct-card-gap));
}

.sct-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--sct-card-gap);
  min-width: 0;
}

.sct-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sct-card-header-gap);
  margin-top: auto;
  min-height: var(--sct-control-height);
}

.sct-card-footer-status {
  margin: 0;
  font-size: 12px;
  color: color-mix(in srgb, var(--sct-text) 76%, white 24%);
}

.sct-card-footer-status.is-placeholder {
  visibility: hidden;
}

.sct-card-footer-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--sct-row-action-gap);
  flex-wrap: wrap;
}

.sct-field-checkbox {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--sct-control-height);
  border: 1px solid color-mix(in srgb, var(--sct-border) 82%, white 18%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--sct-surface-alt) 86%, black 14%);
  padding: 8px 10px;
  box-sizing: border-box;
}

.sct-field-checkbox-label {
  color: var(--sct-text);
}

.sct-field-checkbox input[type='checkbox'] {
  width: calc(var(--sct-control-height) * var(--sct-checkbox-scale-percent) / 100);
  height: calc(var(--sct-control-height) * var(--sct-checkbox-scale-percent) / 100);
  flex: 0 0 calc(var(--sct-control-height) * var(--sct-checkbox-scale-percent) / 100);
}

.sct-edit-row {
  border: 1px solid color-mix(in srgb, var(--sct-border) 84%, white 16%);
  border-radius: var(--sct-row-box-radius);
  background: color-mix(in srgb, var(--sct-surface-alt) 82%, black 18%);
  padding: var(--sct-row-box-padding);
  display: grid;
  gap: var(--sct-row-field-gap);
}

.sct-edit-row-field {
  display: flex;
  flex-direction: column;
  gap: var(--sct-row-section-gap);
  min-width: 0;
}

.sct-edit-row-field > .sct-edit-row-title {
  font-size: var(--sct-row-title-size);
  color: color-mix(in srgb, var(--sct-text) 74%, white 26%);
  line-height: 1.2;
}

.sct-edit-row-field > .sct-edit-row-subtext {
  font-size: var(--sct-row-subtext-size);
  color: color-mix(in srgb, var(--sct-text) 72%, white 28%);
  line-height: 1.35;
}

.sct-edit-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sct-row-action-gap);
}

@media (max-width: 760px) {
  .sct-card-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .sct-card-footer-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}

.toolbar-left {
  justify-self: start;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.current-session-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--sct-border);
  background: color-mix(in srgb, var(--sct-surface) 88%, black 12%);
  max-width: min(32vw, 420px);
}

.current-session-pill-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--sct-text) 66%, #9ca3af 34%);
  flex: 0 0 auto;
}

.current-session-pill-name {
  font-size: 13px;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-poll-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--sct-border);
  background: color-mix(in srgb, var(--sct-surface) 88%, black 12%);
  max-width: min(32vw, 420px);
}

.current-poll-pill-timer {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding-left: 8px;
  border-left: 1px solid var(--sct-border);
  font-size: 12px;
  font-weight: 700;
  color: color-mix(in srgb, var(--sct-button-accept) 85%, white 15%);
}

.current-poll-pill-timer.is-ending-soon {
  color: #f59e0b;
}

.toolbar-title {
  justify-self: center;
  margin: 0;
  text-align: center;
  color: var(--sct-title-color);
  font-size: var(--sct-title-size);
}

.toolbar-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.site-logo {
  height: var(--sct-logo-size);
  width: auto;
  display: block;
}

.toolbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.listener-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--sct-border);
  background: color-mix(in srgb, var(--sct-surface) 88%, black 12%);
}

.listener-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.listener-status-dot.is-ssn-connected {
  color: #22c55e;
  background: #22c55e;
}

.listener-status-dot.is-ssn-disconnected {
  color: #64748b;
  background: #64748b;
}

.listener-status-dot.is-connecting {
  color: #f59e0b;
  background: #f59e0b;
}

.listener-status-dot.is-error {
  color: #ef4444;
  background: #ef4444;
}

.listener-status-text {
  font-weight: 600;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app-shell {
  position: relative;
  min-height: calc(100vh - 88px);
}

.app-main {
  min-width: 0;
}

.sidebar-rail {
  position: fixed;
  left: var(--sct-sidebar-left);
  top: 20px;
  width: var(--sct-sidebar-rail-width);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  z-index: 1050;
}

.sidebar-logo-btn {
  border: none;
  background: transparent;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  line-height: 0;
}

.sidebar-logo-btn:hover {
  background: transparent;
  transform: none;
  opacity: 0.95;
}

.sidebar-btn {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  text-align: left;
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.sidebar-btn-content {
  width: 100%;
  justify-content: space-between;
  flex-direction: row-reverse;
}

.sidebar-btn:hover:not(:disabled) {
  transform: translateX(2px);
}

.sidebar-btn.is-active {
  background: color-mix(in srgb, var(--sct-primary) 74%, white 26%);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28);
}

.sidebar-btn-muted,
.sidebar-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sidebar-panel,
.console-panel {
  position: fixed;
  z-index: 1040;
  background: color-mix(in srgb, var(--sct-surface) 86%, black 14%);
  border: 1px solid color-mix(in srgb, var(--sct-border) 84%, white 16%);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s linear;
}

.sidebar-panel.is-open,
.console-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sidebar-panel {
  left: var(--sct-sidebar-content-offset);
  top: 88px;
  width: min(360px, calc(100vw - var(--sct-sidebar-content-offset) - 16px));
  height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  border-radius: var(--sct-card-radius);
  overflow: hidden;
  transform: translateX(-18px);
}

.sidebar-panel.is-open {
  transform: translateX(0);
}

.sidebar-panel-chat {
  width: min(360px, calc(100vw - var(--sct-sidebar-content-offset) - 16px));
  bottom: 0;
  height: auto;
}

.sidebar-panel-pages {
  width: min(280px, calc(100vw - var(--sct-sidebar-content-offset) - 16px));
}

/* Matches the UI Template collapsible card header (.ui-template-card-header). */
.sidebar-panel-header,
.console-panel-header {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: var(--sct-card-header-gap);
  min-height: calc(var(--sct-control-height) + 4px);
  padding: var(--sct-card-padding);
  box-sizing: border-box;
  border-bottom: 1px solid var(--sct-border);
  background: color-mix(in srgb, var(--sct-surface-alt) 78%, black 22%);
}

.sidebar-panel-title {
  display: inline-flex;
  align-items: center;
  gap: var(--sct-card-header-icon-gap);
  min-width: 0;
  flex: 0 1 auto;
  white-space: nowrap;
}


.current-pill-icon {
  --sct-icon-size: 6px;
  --sct-icon-color: #ffffff;
  flex: 0 0 auto;
}

.current-session-pill,
.current-poll-pill {
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.current-session-pill:hover,
.current-poll-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
  border-color: color-mix(in srgb, var(--sct-primary) 50%, var(--sct-border) 50%);
}

.sidebar-panel-title > span:last-child {
  white-space: nowrap;
}

.sidebar-panel-title-icon {
  --sct-icon-color: #ffffff;
}

/* Copied from frontend/styles/pages/ui-template-page.css: the standalone chat popout window loads only this stylesheet
   but needs the same range pill and icon button recipes as the sidebar chat panel. */
.ui-template-range-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--sct-control-height);
  padding: 0 7px;
  border: 1px solid color-mix(in srgb, var(--sct-border) 82%, white 18%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--sct-surface-alt) 86%, black 14%);
}

.ui-template-range-pill input[type='range'] {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}

.ui-template-action-icon-button {
  display: grid;
  place-items: center;
  justify-content: center;
  width: var(--sct-control-height);
  min-width: var(--sct-control-height);
  height: var(--sct-control-height);
  min-height: var(--sct-control-height);
  padding: 0;
  flex: 0 0 auto;
}

.ui-template-action-icon-button.is-active {
  background: color-mix(in srgb, var(--sct-primary) 55%, var(--sct-button-cancel) 45%);
}

.chat-popout-btn {
  width: var(--sct-control-height);
  min-width: var(--sct-control-height);
  height: var(--sct-control-height);
  min-height: var(--sct-control-height);
  padding: 0;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.chat-popout-btn .sct-icon {
  --sct-icon-size: var(--sct-button-icon-size);
}

.chat-popout-btn.is-active {
  background: var(--sct-primary-hover);
}

.ui-template-list-zoom-control .ui-template-action-icon-button {
  display: grid;
  place-items: center;
  width: 22px;
  min-width: 22px;
  height: 22px;
  min-height: 22px;
  flex: 0 0 22px;
  padding: 0;
  background: transparent;
  color: var(--sct-text);
}

.ui-template-list-zoom-control .ui-template-action-icon-button .sct-icon {
  --sct-icon-size: 14px;
}

.btn-cancel .sct-icon,
.btn-accept .sct-icon,
.btn-add .sct-icon {
  --sct-icon-size: var(--sct-button-icon-size);
}

.sidebar-panel-header-controls {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  flex: 1 1 0;
}

.chat-zoom-pill {
  flex: 0 1 auto;
  min-width: 0;
}

.chat-zoom-pill input[type='range'] {
  width: clamp(54px, 18vw, 108px);
  min-width: 24px;
}

.sidebar-panel-chat .sidebar-panel-title {
  flex: 0 0 auto;
}

.sidebar-panel-chat .sidebar-panel-title-icon {
  --sct-icon-size: clamp(12px, 1.8vw, 16px);
}

.sidebar-panel-body {
  flex: 1;
  min-height: 0;
  padding: var(--sct-card-padding);
  overflow: hidden;
}

.sidebar-panel-pages .sidebar-panel-body {
  overflow-y: auto;
}

.sidebar-panel-chat .sidebar-panel-body {
  padding: 8px;
  display: flex;
  min-height: 0;
  box-sizing: border-box;
}

.sidebar-panel-chat-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--sct-border);
  background: color-mix(in srgb, var(--sct-surface) 86%, black 14%);
}

.sidebar-panel-chat-compose input[type='text'] {
  width: 100%;
  height: var(--sct-control-height);
  min-height: var(--sct-control-height);
  padding: 0 var(--sct-control-padding-x, 10px);
  /* Matches the UI Template page's input recipe (frontend/styles/pages/ui-template-page.css). */
  border: 1px solid var(--sct-input-border);
  border-radius: 8px;
  background: var(--sct-input-bg);
  color: var(--sct-input-text);
  box-sizing: border-box;
  font: inherit;
}

.sidebar-panel-chat-compose button {
  white-space: nowrap;
}

.pages-panel-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pages-panel-list li {
  margin-bottom: 0;
}

.pages-panel-list .page-link {
  display: flex;
  align-items: center;
  min-height: var(--sct-control-height);
  padding: var(--sct-row-box-padding);
  box-sizing: border-box;
  border: 1px solid var(--sct-border);
  border-radius: var(--sct-row-box-radius);
  background: color-mix(in srgb, var(--sct-surface-alt) 78%, black 22%);
  color: var(--sct-text);
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.pages-panel-link-content {
  width: 100%;
  justify-content: space-between;
}

.pages-panel-link-text {
  min-width: 0;
}

.pages-panel-link-icon {
  --sct-icon-color: currentColor;
}

.pages-panel-list .page-link:hover {
  text-decoration: none;
  transform: translateX(2px);
  background: color-mix(in srgb, var(--sct-primary) 22%, var(--sct-surface-alt) 78%);
  border-color: color-mix(in srgb, var(--sct-primary) 54%, white 46%);
}

.pages-panel-list .page-link:active {
  transform: translateX(1px) scale(0.995);
}

.console-panel {
  left: var(--sct-sidebar-content-offset);
  right: 16px;
  bottom: 16px;
  height: 280px;
  display: flex;
  flex-direction: column;
  border-radius: var(--sct-card-radius);
  overflow: hidden;
  transform: translateY(18px);
}

.console-panel.is-open {
  transform: translateY(0);
}

.console-panel-actions {
  padding: var(--sct-card-padding) var(--sct-card-padding) 0;
  flex: 0 0 auto;
}

.console-panel-log {
  flex: 1 1 auto;
  min-height: 0;
  margin: var(--sct-card-gap) var(--sct-card-padding) var(--sct-card-padding);
}

.panel-resize-handle {
  position: absolute;
  z-index: 2;
}

.panel-resize-handle-top {
  top: 0;
  left: 0;
  width: 100%;
  height: 10px;
  cursor: ns-resize;
}

.panel-resize-handle-right {
  top: 56px;
  right: 0;
  width: 10px;
  height: calc(100% - 56px);
  cursor: ew-resize;
}

.panel-resize-handle-bottom {
  left: 0;
  bottom: 0;
  width: 100%;
  height: 10px;
  cursor: ns-resize;
}

.panel-resize-handle-corner {
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--sct-control-height);
  padding-top: 0;
  padding-bottom: 0;
  padding-left: var(--sct-control-padding-x, 16px);
  padding-right: var(--sct-control-padding-x, 16px);
  border: none;
  border-radius: 6px;
  background: var(--sct-primary);
  color: var(--sct-button-text);
  cursor: pointer;
  line-height: 1;
  font-size: var(--sct-font-size);
  box-sizing: border-box;
}

button:hover {
  background: var(--sct-primary-hover);
}

.btn-accept,
.btn-add {
  background: var(--sct-button-accept);
  color: var(--sct-button-accept-text);
}

.btn-accept:hover,
.btn-add:hover {
  background: var(--sct-button-accept-hover);
}

.btn-cancel {
  background: var(--sct-button-cancel);
  color: var(--sct-button-cancel-text);
}

.btn-cancel:hover {
  background: var(--sct-button-cancel-hover);
}

.chat-list {
  background: color-mix(in srgb, var(--sct-surface-alt) 78%, black 22%);
  border: 1px solid var(--sct-border);
  border-radius: var(--sct-row-box-radius);
  padding: 12px var(--sct-chat-container-padding-right, 12px) 12px var(--sct-chat-container-padding-left, 12px);
  height: 360px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.sidebar-panel-chat .chat-list.chat-panel-list {
  flex: 1;
  height: auto;
  max-height: none;
  min-height: 0;
  margin-bottom: 0;
  border-radius: var(--sct-row-box-radius);
  width: 100%;
}

.sct-chat-box {
  display: flex;
  flex-direction: column;
  gap: var(--sct-chat-gap);
  zoom: var(--sct-chat-box-scale, 1);
}

.sidebar-panel-chat .sct-chat-box {
  zoom: calc(var(--sct-chat-box-scale, 1) * var(--sct-chat-local-scale, 1));
}

/* Standalone chat popout window (frontend/chat-popout.html) - mirrors the sidebar chat panel's look without
   the fixed-overlay positioning, since this content fills its own separate OS window instead. */
.chat-popout-body {
  padding: 0;
  background-image: none;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
}

.chat-popout-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  min-height: 0;
  background: color-mix(in srgb, var(--sct-surface) 86%, black 14%);
}

.chat-popout-body-panel {
  padding: 8px;
  display: flex;
  min-height: 0;
  box-sizing: border-box;
}

.chat-popout-list {
  flex: 1;
  height: auto;
  max-height: none;
  min-height: 0;
  margin-bottom: 0;
  border-radius: var(--sct-row-box-radius);
  width: 100%;
}

.chat-popout-shell .sct-chat-box {
  zoom: calc(var(--sct-chat-box-scale, 1) * var(--sct-chat-local-scale, 1));
}

.debug-console {
  background: var(--sct-surface-deep);
  border: 1px solid var(--sct-border);
  border-radius: var(--sct-row-box-radius);
  padding: 12px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  font-family: Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
}

.dock-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dock-list li {
  margin-bottom: 6px;
}

.page-link {
  color: var(--sct-link);
  text-decoration: none;
}

.page-link:hover {
  text-decoration: underline;
}

.sct-icon {
  --sct-icon-size: var(--sct-ui-icon-base-size, 16px);
  --sct-icon-color: currentColor;
  --sct-icon-src: none;
  display: inline-block;
  width: var(--sct-icon-size);
  height: var(--sct-icon-size);
  min-width: var(--sct-icon-size);
  min-height: var(--sct-icon-size);
  flex: 0 0 auto;
  vertical-align: middle;
  background-color: var(--sct-icon-color);
  -webkit-mask-image: var(--sct-icon-src);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-image: var(--sct-icon-src);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.sct-icon.is-empty {
  display: none;
}

.sct-icon--sm {
  --sct-icon-size: calc(var(--sct-ui-icon-base-size, 16px) - 2px);
}

.sct-icon--md {
  --sct-icon-size: calc(var(--sct-ui-icon-base-size, 16px) + 2px);
}

.sct-icon--lg {
  --sct-icon-size: calc(var(--sct-ui-icon-base-size, 16px) + 6px);
}

.sct-card-header-icon {
  --sct-icon-size: calc(var(--sct-card-header-icon-size-pct) * 0.01 * var(--sct-control-height));
}

/* must follow .sct-icon to override --sct-icon-size via cascade order */
.sct-page-heading-icon {
  --sct-icon-size: calc(
    var(--sct-page-icon-size-pct) * 0.01 *
    (var(--sct-page-title-size) * 1.1 + var(--sct-page-subtitle-size) * 1.35 + var(--sct-page-title-subtitle-gap))
  );
  flex-shrink: 0;
}

.sct-icon-label-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.message {
  position: relative;
  display: block;
  margin-bottom: var(--sct-chat-gap);
  padding: var(--sct-chat-item-padding-y) var(--sct-chat-item-padding-x);
  background-color: var(--sct-chat-item-bg);
  background-image: linear-gradient(
    to right,
    color-mix(in srgb, var(--sct-chat-message-user-color, transparent) var(--sct-chat-user-gradient-opacity, 36%), transparent) 0%,
    transparent var(--sct-chat-user-gradient-reach, 32%)
  );
  border: 1px solid var(--sct-chat-message-border-color, var(--sct-chat-item-border-color));
  border-radius: var(--sct-chat-item-radius);
  color: var(--sct-chat-item-text-color);
  font-size: var(--sct-chat-message-font-size);
}

.sct-chat-message {
  position: relative;
  /* Scopes the ::before peek art's stacking to this message only, so it can't bleed behind/in-front-of neighboring messages. */
  isolation: isolate;
  display: block;
  margin-bottom: var(--sct-chat-gap);
  margin-left: calc(var(--sct-chat-avatar-peek-enabled, 0) * var(--sct-chat-avatar-peek-edge-space, 0px));
}

/* Peeking avatar art sits behind .sct-chat-message-body (the actual bubble surface) via z-index within the
   isolated stacking context above, so the bubble occludes the overlapping part while the rest peeks out to the left.
   Anchored to the message's own top-left corner (top:0/left:0) so its position never depends on bubble height. */
.sct-chat-message.has-avatar-peek::before {
  content: '';
  position: absolute;
  z-index: 0;
  left: 0;
  top: 0;
  width: 88px;
  aspect-ratio: 2 / 3;
  height: auto;
  background-image: var(--sct-chat-message-avatar-peek-url, none);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: bottom center;
  transform-origin: var(--sct-chat-avatar-peek-anchor-x, 50%) var(--sct-chat-avatar-peek-anchor-y, 100%);
  transform:
    translate(calc(-100% + var(--sct-chat-avatar-peek-offset-x, 0px)), var(--sct-chat-avatar-peek-offset-y, 0px))
    rotate(var(--sct-chat-avatar-peek-rotation, 0deg))
    scale(var(--sct-chat-avatar-peek-scale, 1));
  pointer-events: none;
}

.sct-chat-message-top-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--sct-chat-item-gap);
  min-height: var(--sct-chat-top-section-height, 28px);
}

.sct-chat-message-top-row::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--sct-chat-message-border-color, var(--sct-chat-item-border-color));
  opacity: var(--sct-chat-render-split, 0);
  pointer-events: none;
}

.sct-chat-message-top-right-meta {
  display: inline-flex;
  justify-self: end;
  align-items: center;
  padding-left: var(--sct-chat-meta-left-padding, 0px);
  gap: var(--sct-chat-meta-badge-spore-gap, 8px);
  transform: translate(var(--sct-chat-meta-offset-x, var(--sct-chat-spore-offset-x, 0px)), var(--sct-chat-meta-offset-y, var(--sct-chat-spore-offset-y, 0px)));
}

.sct-chat-message-spore-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sct-chat-message-role-badges {
  display: inline-flex;
  align-items: center;
  gap: var(--sct-chat-badge-gap, 4px);
}

.sct-chat-message-role-badge {
  --sct-icon-color: var(--sct-chat-item-border-color);
  flex: 0 0 auto;
}

.sct-chat-message-spore-icon {
  width: calc(var(--sct-chat-top-section-height, 28px) * var(--sct-chat-meta-spore-icon-top-scale, 56) / 100);
  height: calc(var(--sct-chat-top-section-height, 28px) * var(--sct-chat-meta-spore-icon-top-scale, 56) / 100);
  object-fit: contain;
}

.sct-chat-message-spore-count {
  font-size: calc(var(--sct-chat-top-section-height, 28px) * var(--sct-chat-meta-spore-count-top-scale, 42) / 100);
  font-weight: 700;
  line-height: 1;
  color: color-mix(in srgb, var(--sct-text) 84%, white 16%);
}

.sct-chat-message-platform-icon {
  width: calc(var(--sct-chat-top-section-height, 28px) * var(--sct-chat-meta-spore-icon-top-scale, 56) / 100);
  height: calc(var(--sct-chat-top-section-height, 28px) * var(--sct-chat-meta-spore-icon-top-scale, 56) / 100);
  object-fit: contain;
  flex: 0 0 auto;
}

/* Legacy standalone widget (chat-widget.js) still creates a plain .message-avatar; frontend/js/chat-box.js no longer renders a circular avatar. */
.message-avatar {
  position: relative;
  z-index: 2;
  width: var(--sct-chat-top-section-height, 28px);
  height: var(--sct-chat-top-section-height, 28px);
  min-width: var(--sct-chat-top-section-height, 28px);
  min-height: var(--sct-chat-top-section-height, 28px);
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--sct-muted);
  margin-top: 0;
}

.sct-chat-message-avatar-platform-icon {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: calc(
    var(--sct-chat-top-section-height, 28px)
    * var(--sct-chat-avatar-platform-size-scale, 1)
  );
  height: calc(
    var(--sct-chat-top-section-height, 28px)
    * var(--sct-chat-avatar-platform-size-scale, 1)
  );
  margin-top: 0;
  transform: translate(
    calc(-50% + var(--sct-chat-avatar-platform-offset-x, 0px)),
    calc(-50% + var(--sct-chat-avatar-platform-offset-y, 0px))
  );
  object-fit: contain;
  border-radius: 0;
  pointer-events: none;
  opacity: 1;
}

.message-body {
  display: block;
  width: 100%;
  min-width: 0;
}

.sct-chat-message-body {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  min-width: 0;
  /* width:100% must include the border/padding below, otherwise this (now non-flex-stretched) box renders
     wider than its .sct-chat-message parent and clips past the chat list's right edge. */
  box-sizing: border-box;
  padding: var(--sct-chat-item-padding-y) var(--sct-chat-item-padding-x);
  background-color: var(--sct-chat-item-bg);
  background-image: linear-gradient(
    to right,
    color-mix(in srgb, var(--sct-chat-message-user-color, transparent) var(--sct-chat-user-gradient-opacity, 36%), transparent) 0%,
    transparent var(--sct-chat-user-gradient-reach, 32%)
  );
  border: 1px solid var(--sct-chat-message-border-color, var(--sct-chat-item-border-color));
  border-radius: var(--sct-chat-item-radius);
  color: var(--sct-chat-item-text-color);
  font-size: var(--sct-chat-message-font-size);
}

.sct-chat-message-text,
.message-text {
  margin-top: var(--sct-chat-message-top-gap, 6px);
  margin-left: var(--sct-chat-message-inset-left, 0px);
  margin-right: var(--sct-chat-message-inset-right, 0px);
  margin-bottom: var(--sct-chat-message-inset-bottom, 0px);
}

.message-header,
.sct-chat-message-header {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  min-height: var(--sct-chat-top-section-height, 28px);
  overflow: visible;
}

.sct-chat-message-badges {
  display: var(--sct-chat-badge-display, inline-flex);
  flex-wrap: nowrap;
}

.username,
.sct-chat-message-username {
  display: inline-flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: var(--sct-chat-top-section-height, 28px);
  overflow: visible;
  line-height: 1;
  --sct-chat-username-outline-color: var(--sct-chat-username-color);
}

.sct-chat-username-svg {
  display: block;
  overflow: visible;
  margin-left: var(--sct-chat-username-offset-x, -1px);
  margin-top: var(--sct-chat-username-offset-y, 0px);
  transform-origin: left center;
}

.sct-chat-username-svg-text {
  font-weight: var(--sct-chat-username-weight);
  stroke-linejoin: round;
  stroke-linecap: round;
  paint-order: stroke fill;
}

.sct-chat-username-svg-text-outer {
  fill: transparent;
  stroke: var(--sct-chat-username-outline-color);
  stroke-width: var(--sct-chat-username-stroke-outer-width, 7.4px);
}

.sct-chat-username-svg-text-inner {
  fill: transparent;
  stroke: #000000;
  stroke-width: var(--sct-chat-username-stroke-black-width, 4.8px);
}

.sct-chat-username-svg-text-fill {
  fill: #ffffff;
  stroke: none;
}

.sct-chat-message-username.is-user-action-target {
  cursor: pointer;
  text-decoration: none;
}

.sct-chat-message-username.is-user-action-target:hover {
  filter: brightness(1.06);
}

.user-actions-menu {
  position: fixed;
  z-index: 1700;
  min-width: 220px;
  display: none;
  flex-direction: column;
  gap: 3px;
  padding: 7px;
  border: 1px solid var(--sct-border);
  border-radius: var(--sct-row-box-radius);
  background: var(--sct-surface);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.38);
  pointer-events: none;
}

.user-actions-menu.is-open {
  display: flex;
  pointer-events: auto;
}

.user-actions-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 6px 8px;
}

.user-actions-menu-user {
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  color: var(--sct-text);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-actions-menu-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--sct-border);
  flex-shrink: 0;
}

.user-actions-menu-avatar[hidden] {
  display: none;
}

.user-actions-menu-item {
  justify-content: space-between;
  width: 100%;
}

.user-actions-menu-item:has(.sct-icon) {
  gap: 8px;
}

.user-actions-menu-item.is-negative {
  background: var(--sct-button-cancel);
  color: var(--sct-button-cancel-text);
}

.user-actions-menu-item.is-negative:hover {
  background: var(--sct-button-cancel-hover);
}

.user-actions-menu-item-label {
  min-width: 0;
  cursor: pointer;
}

.user-actions-menu-item-trailing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.user-actions-menu-item-icon {
  --sct-icon-size: var(--sct-button-icon-size);
  --sct-icon-color: currentColor;
}

.user-actions-menu-item-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  --team-indicator-color: var(--sct-primary);
  border: 1px solid color-mix(in srgb, var(--team-indicator-color) 70%, white 30%);
  background: color-mix(in srgb, var(--team-indicator-color) 35%, black 65%);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.user-actions-menu-item:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--sct-primary) 56%, white 44%);
  outline-offset: -2px;
}

/* Mirrors .ui-template-toast (ui-template-page.css), which the standalone chat popout does not load. */
.sct-toast-stack {
  position: fixed;
  z-index: 1800;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  max-width: min(460px, calc(100vw - 36px));
  pointer-events: none;
}

.sct-toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: var(--sct-row-box-padding);
  border: 1px solid var(--sct-border);
  border-radius: var(--sct-row-box-radius);
  background: var(--sct-surface);
  color: var(--sct-text);
  box-shadow: 0 16px 38px rgb(0 0 0 / 0.36);
  font-size: 13px;
  animation: sct-toast-in 0.18s ease-out;
}

.sct-toast-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sct-toast-icon {
  --sct-icon-size: var(--sct-button-icon-size);
  --sct-icon-color: var(--sct-button-accept);
}

.sct-toast.is-error .sct-toast-icon {
  --sct-icon-color: var(--sct-button-cancel);
}

@keyframes sct-toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sct-floating-popup,
.user-actions-popup,
.viewers-spore-popup {
  position: fixed;
  z-index: 1710;
  width: min(340px, calc(100vw - 20px));
  border: 1px solid var(--sct-border, #374151);
  border-radius: 10px;
  background: var(--sct-surface, #111827);
  box-shadow: 0 20px 34px rgba(0, 0, 0, 0.35);
  padding: 12px;
  color: var(--sct-text, #f9fafb);
}

.sct-floating-popup-title,
.user-actions-popup-title,
.viewers-spore-popup-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.sct-floating-popup-meta,
.user-actions-popup-meta,
.viewers-spore-popup-meta {
  color: color-mix(in srgb, var(--sct-text, #f9fafb) 68%, #9ca3af 32%);
  margin-bottom: 8px;
  font-size: 13px;
}

.sct-floating-popup-label,
.user-actions-popup-label,
.viewers-spore-popup-label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: color-mix(in srgb, var(--sct-text, #f9fafb) 62%, #9ca3af 38%);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sct-floating-popup-input,
.user-actions-popup-input,
.viewers-spore-popup-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--sct-input-border, #374151);
  background: var(--sct-input-bg, #0f172a);
  color: var(--sct-input-text, #f9fafb);
}

.sct-floating-popup-actions,
.user-actions-popup-actions,
.viewers-spore-popup-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.sct-floating-popup-actions-wrap,
.user-actions-popup-actions-wrap {
  flex-wrap: wrap;
}

.sct-floating-popup-fields,
.user-actions-timeout-fields,
.viewers-timeout-fields {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.sct-floating-popup-field,
.user-actions-timeout-field,
.viewers-timeout-field {
  flex: 1 1 0;
  min-width: 0;
}

.sct-floating-popup-field .sct-floating-popup-label,
.user-actions-timeout-field .user-actions-popup-label,
.viewers-timeout-field .viewers-spore-popup-label {
  margin-bottom: 6px;
}

/* Edit Spores popup: matches the UI Template Shop Patterns spore-field input recipe (input + stepper + trailing spore icon) */
.user-actions-spore-popup-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-actions-spore-popup-icon {
  --sct-icon-size: var(--sct-button-icon-size);
}

.user-actions-spore-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px auto;
  column-gap: 5px;
  align-items: center;
  width: 100%;
  height: var(--sct-control-height);
  min-width: 0;
  padding: 0 var(--sct-control-padding-x, 10px);
  border: 1px solid var(--sct-input-border);
  border-radius: 8px;
  background: var(--sct-input-bg);
  color: var(--sct-input-text);
  box-sizing: border-box;
}

.user-actions-spore-input input[type='number'] {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  appearance: textfield;
  -webkit-appearance: textfield;
  -moz-appearance: textfield;
}

.user-actions-spore-input input[type='number']::-webkit-inner-spin-button,
.user-actions-spore-input input[type='number']::-webkit-outer-spin-button {
  appearance: none !important;
  -webkit-appearance: none !important;
  display: none !important;
  opacity: 0 !important;
  margin: 0 !important;
}

.user-actions-spore-input:focus-within {
  outline: 2px solid #ffffff;
  outline-offset: 1px;
}

.user-actions-spore-input input[type='number']:focus {
  outline: 0;
}

.user-actions-spore-input::after {
  width: var(--sct-button-icon-size);
  height: var(--sct-button-icon-size);
  content: '';
  background: currentColor;
  mask: url('/assets/ui-icons/Spore%20Icon.PNG') center / contain no-repeat;
  -webkit-mask: url('/assets/ui-icons/Spore%20Icon.PNG') center / contain no-repeat;
}

.user-actions-spore-stepper {
  display: grid;
  grid-template-rows: 1fr 1fr;
  width: 18px;
  height: calc(var(--sct-control-height) - 8px);
  overflow: hidden;
  border-radius: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.user-actions-spore-input:focus-within .user-actions-spore-stepper,
.user-actions-spore-input:hover .user-actions-spore-stepper {
  opacity: 1;
  pointer-events: auto;
}

.user-actions-spore-stepper button {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--sct-button-text);
}

.user-actions-spore-stepper button[data-sct-number-step='up'] {
  background: var(--sct-button-accept);
  color: var(--sct-button-accept-text);
}

.user-actions-spore-stepper button[data-sct-number-step='up']:hover {
  background: var(--sct-button-accept-hover);
}

.user-actions-spore-stepper button[data-sct-number-step='down'] {
  background: var(--sct-button-cancel);
  color: var(--sct-button-cancel-text);
}

.user-actions-spore-stepper button[data-sct-number-step='down']:hover {
  background: var(--sct-button-cancel-hover);
}

.user-actions-spore-stepper .sct-icon {
  --sct-icon-size: 9px;
}

.user-actions-spore-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-weight: 700;
}

.user-actions-spore-preview-value {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.user-actions-spore-preview-value .sct-icon {
  --sct-icon-size: var(--sct-button-icon-size);
}

.user-actions-spore-preview-arrow {
  --sct-icon-size: var(--sct-button-icon-size);
  --sct-icon-color: color-mix(in srgb, var(--sct-text) 60%, white 40%);
}

/* Timeout popup: compact stepper arrows for each duration unit, matching the spore stepper recipe at a smaller scale */
.user-actions-duration-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14px;
  column-gap: 4px;
  align-items: center;
  width: 48px;
  height: calc(var(--sct-control-height) - 10px);
  min-width: 0;
  padding: 0 2px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  box-sizing: border-box;
}

.user-actions-duration-input input[type='number'] {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  appearance: textfield;
  -webkit-appearance: textfield;
  -moz-appearance: textfield;
}

.user-actions-duration-input input[type='number']::-webkit-inner-spin-button,
.user-actions-duration-input input[type='number']::-webkit-outer-spin-button {
  appearance: none !important;
  -webkit-appearance: none !important;
  display: none !important;
  opacity: 0 !important;
  margin: 0 !important;
}

.user-actions-duration-stepper {
  display: grid;
  grid-template-rows: 1fr 1fr;
  width: 14px;
  height: calc(var(--sct-control-height) - 16px);
  overflow: hidden;
  border-radius: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.user-actions-duration-input:focus-within .user-actions-duration-stepper,
.user-actions-duration-input:hover .user-actions-duration-stepper {
  opacity: 1;
  pointer-events: auto;
}

.user-actions-duration-stepper button {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--sct-button-text);
}

.user-actions-duration-stepper button[data-sct-number-step='up'] {
  background: var(--sct-button-accept);
  color: var(--sct-button-accept-text);
}

.user-actions-duration-stepper button[data-sct-number-step='up']:hover {
  background: var(--sct-button-accept-hover);
}

.user-actions-duration-stepper button[data-sct-number-step='down'] {
  background: var(--sct-button-cancel);
  color: var(--sct-button-cancel-text);
}

.user-actions-duration-stepper button[data-sct-number-step='down']:hover {
  background: var(--sct-button-cancel-hover);
}

.user-actions-duration-stepper .sct-icon {
  --sct-icon-size: 8px;
}

.user-actions-timeout-session-row {
  display: flex;
  justify-content: flex-start;
  margin-top: 8px;
}

.user-actions-timeout-session-row button {
  width: 100%;
}

.user-actions-timeout-session-row .sct-icon {
  --sct-icon-size: var(--sct-button-icon-size);
}

.user-actions-popup-timeout .sct-duration-input {
  width: 100%;
  justify-content: space-between;
  box-sizing: border-box;
}

.sct-duration-input {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  width: max-content;
  max-width: 100%;
  min-height: var(--sct-control-height, 36px);
  box-sizing: border-box;
  padding: 4px 6px;
  border: 1px solid var(--sct-input-border, #374151);
  border-radius: 8px;
  background: var(--sct-input-bg, #0f172a);
  color: var(--sct-input-text, #f9fafb);
}

.sct-duration-input:focus-within {
  outline: 2px solid #ffffff;
  outline-offset: 1px;
}

.sct-duration-unit {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.sct-duration-unit + .sct-duration-unit {
  padding-left: 6px;
  border-left: 1px solid color-mix(in srgb, var(--sct-input-border, #374151) 78%, #ffffff 22%);
}

.sct-duration-unit input[type='number'] {
  width: 48px;
  min-width: 0;
  height: calc(var(--sct-control-height, 36px) - 10px);
  box-sizing: border-box;
  padding: 0 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
}

.sct-duration-unit > span[aria-hidden='true'] {
  color: color-mix(in srgb, currentColor 70%, #ffffff 30%);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.sct-chat-message-badges {
  display: var(--sct-chat-badge-display, inline-flex);
  align-items: center;
  gap: var(--sct-chat-badge-gap, 4px);
  flex-wrap: nowrap;
}

.sct-chat-message-badge-image {
  width: calc(var(--sct-chat-top-section-height, 28px) * var(--sct-chat-meta-badge-top-scale, 56) / 100);
  height: calc(var(--sct-chat-top-section-height, 28px) * var(--sct-chat-meta-badge-top-scale, 56) / 100);
  object-fit: contain;
  vertical-align: middle;
}

.sct-chat-message-badge-svg {
  width: calc(var(--sct-chat-top-section-height, 28px) * var(--sct-chat-meta-badge-top-scale, 56) / 100);
  height: calc(var(--sct-chat-top-section-height, 28px) * var(--sct-chat-meta-badge-top-scale, 56) / 100);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--sct-chat-item-text-color);
  line-height: 0;
}

.sct-chat-message-badge-svg svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: currentColor;
}

.sct-chat-message-badge-text {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--sct-chat-item-border-color);
  border-radius: 999px;
  padding: 0 6px;
  line-height: 1.3;
  font-size: calc(var(--sct-chat-top-section-height, 28px) * var(--sct-chat-meta-badge-top-scale, 56) / 150);
  color: var(--sct-chat-item-text-color);
  background: color-mix(in srgb, var(--sct-surface) 80%, white 20%);
}

.message-text,
.sct-chat-message-text {
  font-size: calc(var(--sct-chat-message-font-size, 14px) * var(--sct-chat-message-text-scale, 1));
  margin-top: calc(var(--sct-chat-message-top-gap, 6px) + var(--sct-chat-message-offset-y, 0px));
  margin-left: var(--sct-chat-message-inset-left, 0px);
  margin-right: var(--sct-chat-message-inset-right, 0px);
  margin-bottom: var(--sct-chat-message-inset-bottom, 0px);
  transform: translate(var(--sct-chat-message-text-offset-x, 0px), var(--sct-chat-message-text-offset-y, 0px));
  white-space: pre-wrap;
  word-break: break-word;
}

.sct-chat-message-event-box {
  margin-top: var(--sct-chat-donation-event-margin-top);
  margin-right: var(--sct-chat-donation-event-margin-right);
  margin-bottom: var(--sct-chat-donation-event-margin-bottom);
  margin-left: var(--sct-chat-donation-event-margin-left);
  border: 1px solid var(--sct-chat-donation-event-border-color);
  border-radius: var(--sct-chat-donation-event-radius);
  background: var(--sct-chat-donation-event-bg);
  color: var(--sct-chat-donation-event-text-color);
  font-size: var(--sct-chat-donation-event-font-size);
  font-weight: 600;
  line-height: 1.35;
  padding-top: var(--sct-chat-donation-event-padding-top);
  padding-right: var(--sct-chat-donation-event-padding-right);
  padding-bottom: var(--sct-chat-donation-event-padding-bottom);
  padding-left: var(--sct-chat-donation-event-padding-left);
  overflow-wrap: anywhere;
}

.sct-chat-message-event-content {
  display: flex;
  align-items: center;
  gap: var(--sct-chat-donation-event-icon-gap);
}

.sct-chat-message-event-icon {
  --sct-icon-color: var(--sct-chat-donation-event-text-color);
  --sct-icon-size: var(--sct-chat-donation-event-icon-size);
  flex: 0 0 auto;
  align-self: center;
  transform: translateX(var(--sct-chat-donation-event-icon-offset-x));
}

.sct-chat-message-event-text {
  min-width: 0;
  flex: 1 1 auto;
}

/* The quote of the message being replied to, at the top of the bubble. Kept compact: it clamps to a few lines and
   only grows as wide as its text. Sizing and spacing come from the Reply Box settings. */
.sct-chat-message-reply {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--sct-chat-reply-max-lines, 1);
  box-sizing: border-box;
  width: fit-content;
  max-width: var(--sct-chat-reply-max-width, 100%);
  margin-bottom: var(--sct-chat-reply-gap, 4px);
  padding: var(--sct-chat-reply-padding-y, 2px) var(--sct-chat-reply-padding-x, 6px);
  overflow: hidden;
  border: 1px solid var(--sct-chat-reply-border-color, #4b5563);
  border-radius: var(--sct-chat-reply-radius, 4px);
  background: var(--sct-chat-reply-bg, #1f2937);
  color: var(--sct-chat-reply-text-color, #d1d5db);
  font-size: var(--sct-chat-reply-font-size, 11px);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.sct-chat-message-reply-username {
  margin-right: 0.4em;
  font-weight: 700;
}

.sct-chat-inline-image {
  max-height: 1.1em;
  width: auto;
  height: auto;
  vertical-align: text-bottom;
  object-fit: contain;
  display: inline-block;
  margin: 0 0.15em;
}

.sct-chat-inline-link {
  color: var(--sct-link);
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

.message-text img {
  max-height: 0.9em;
  width: auto;
  height: auto;
  vertical-align: middle;
  object-fit: contain;
  display: inline-block;
  margin: 0 0.15em;
}

.sct-chat-message-text img {
  max-height: 0.9em;
  width: auto;
  height: auto;
  vertical-align: middle;
  object-fit: contain;
  display: inline-block;
  margin: 0 0.15em;
}

@media (max-width: 860px) {
  .toolbar {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .toolbar-left,
  .toolbar-right,
  .toolbar-title {
    justify-self: center;
  }

  .current-session-pill {
    max-width: min(92vw, 560px);
  }

  .current-poll-pill {
    max-width: min(92vw, 560px);
  }

  body {
    padding-left: 20px;
  }

  .sidebar-rail {
    position: static;
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    margin-bottom: 12px;
  }

  .sidebar-panel,
  .console-panel {
    left: 20px;
    width: calc(100vw - 40px);
  }
}