:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #171a21;
  --panel-soft: #1f2430;
  --line: #2a3242;
  --text: #ecf2ff;
  --muted: #9aa9c4;
  --accent: #2ec4b6;
  --accent-strong: #2ec4b6;
  --accent-soft: #183f3b;
  --danger: #ff6b6b;
  --input-bg: #10151d;
  --message-app: #1b2230;
  --message-twitch: #231f33;
  --message-kick: #1d2a1d;
  --message-tiktok: #2a1f24;
  --message-youtube: #2c1d1f;
  --source-twitch: #8f7bf8;
  --source-kick: #53d769;
  --source-tiktok: #ff5476;
  --source-youtube: #ff4c4c;
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f1f5fb;
  --line: #d7dfeb;
  --text: #1c2a3f;
  --muted: #5f6f86;
  --accent: #017f72;
  --accent-strong: #017f72;
  --accent-soft: #d9f0ec;
  --danger: #c64747;
  --input-bg: #f8fbff;
  --message-app: #f7faff;
  --message-twitch: #f4f1ff;
  --message-kick: #f1faee;
  --message-tiktok: #fff2f6;
  --message-youtube: #fff3f1;
  --source-twitch: #5d4fc4;
  --source-kick: #1f8c3c;
  --source-tiktok: #cc3659;
  --source-youtube: #c53030;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  transition: background 400ms ease, color 300ms ease;
}

.chat-shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  transition: background 400ms ease;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  flex-shrink: 0;
}

.chat-brand {
  min-width: 0;
}

.chat-title {
  font-size: 17px;
  font-weight: 700;
}

.chat-subtitle {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.channel-badge,
.mirror-badge,
.admin-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--line);
}

.channel-badge {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 700;
}

.mirror-badge {
  color: var(--muted);
  background: transparent;
}

.chat-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.chat-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
}

.settings-toggle-btn {
  min-width: 36px;
  height: 36px;
  padding: 0;
  font-size: 14px;
}

.admin-badge {
  color: #f7b267;
  border-color: #a86d25;
  background: rgba(168, 109, 37, 0.18);
}

.auth-area {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
  flex: 1 1 auto;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.auth-user {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.auth-user img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
}

.auth-user .name {
  max-width: clamp(92px, 22vw, 180px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
}

.auth-provider {
  font-size: 11px;
  line-height: 1;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-soft);
}

.auth-provider-kick {
  color: #2ebd59;
  border-color: rgba(46, 189, 89, 0.45);
}

.auth-provider-twitch {
  color: #8f7bf8;
  border-color: rgba(143, 123, 248, 0.45);
}

.auth-btn,
.send-btn,
.icon-btn,
.emote-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
}

.auth-btn {
  text-decoration: none;
  font-size: 12px;
  padding: 7px 10px;
  font-weight: 600;
  white-space: nowrap;
}

.auth-btn.logout {
  color: var(--danger);
}

.auth-btn-kick {
  border-color: rgba(46, 189, 89, 0.45);
}

.auth-btn-twitch {
  border-color: rgba(143, 123, 248, 0.45);
}

.settings-panel {
  position: absolute;
  bottom: 92px;
  right: 12px;
  z-index: 18;
  width: min(280px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  padding: 10px;
}

.settings-panel-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

.settings-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  padding: 5px 2px;
  cursor: pointer;
}

.settings-option input {
  margin: 0;
}

.chat-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.message-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 14px;
  line-height: 1.45;
  touch-action: pan-y;
  transition: transform 160ms ease, opacity 300ms ease, background 200ms ease;
  will-change: transform;
  animation: msg-slide-in 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes msg-slide-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.message-row.swipe-active {
  user-select: none;
}

.message-row.swipe-active {
  transition: none;
}

.message-row.swipe-return {
  transition: transform 160ms ease;
}

.message-source-twitch {
  background: transparent;
}

.message-source-app {
  background: transparent;
}

.message-source-kick {
  background: transparent;
}

.message-source-tiktok {
  background: transparent;
}

.message-source-youtube {
  background: transparent;
}

.message-time {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  min-width: 44px;
  opacity: 0.9;
}

.chat-shell.hide-timestamps .message-time,
.chat-shell.hide-timestamps .thread-item-time {
  display: none;
}

.message-content {
  min-width: 0;
  flex: 1 1 0%;
}

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

.message-meta {
  display: inline;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
}

.message-user {
  font-weight: 700;
  cursor: pointer;
}

.message-user:hover {
  text-decoration: underline;
}

.message-source-badge {
  font-size: 10px;
  border: 0;
  color: var(--source-twitch);
  padding: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.9;
}

.message-source-logo {
  width: 12px;
  height: 12px;
  object-fit: contain;
  flex-shrink: 0;
  vertical-align: middle;
  opacity: 0.96;
}

.chat-shell.show-platform-logos .message-source-badge {
  display: none;
}

.chat-shell.show-platform-logos .message-source-badge.fallback {
  display: inline;
}

.chat-shell:not(.show-platform-logos) .message-source-logo {
  display: none;
}

.chat-shell.compact-messages .messages {
  gap: 0;
}

.chat-shell.compact-messages .message-row {
  padding: 1px 0;
}

.chat-shell.compact-messages .message-main {
  gap: 5px;
}

.chat-shell.compact-messages .message-time {
  min-width: 40px;
  font-size: 10px;
}

.message-source-badge.kick {
  color: var(--source-kick);
}

.message-source-badge.tiktok {
  color: var(--source-tiktok);
}

.message-source-badge.youtube {
  color: var(--source-youtube);
}

.message-text {
  min-width: 0;
  display: inline;
  word-break: break-word;
  white-space: pre-wrap;
}

.message-reply-context {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}

.reply-user {
  color: var(--accent);
}

.reply-quote {
  color: var(--muted);
}

.message-threaded {
  margin-left: 12px;
  border-left: 1px dashed var(--line);
  padding-left: 8px;
}

.mention {
  color: var(--accent);
  font-weight: 700;
  transition: color 200ms ease;
}

.mention:hover {
  text-decoration: underline;
}

.mention.self {
  color: #f0a500;
  background: rgba(240, 165, 0, 0.12);
  border-radius: 4px;
  padding: 1px 4px;
  animation: mention-pulse 1.5s ease-in-out;
}

@keyframes mention-pulse {
  0%, 100% { box-shadow: none; }
  30% { box-shadow: 0 0 0 3px rgba(240, 165, 0, 0.25); }
  60% { box-shadow: 0 0 0 1px rgba(240, 165, 0, 0.1); }
}

.message-mentioned-me {
  background: rgba(240, 165, 0, 0.08);
  animation: mention-row-glow 2s ease-out;
}

@keyframes mention-row-glow {
  0% { background: rgba(240, 165, 0, 0.2); }
  100% { background: rgba(240, 165, 0, 0.08); }
}

.link-preview-card {
  display: flex;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 8px;
  overflow: hidden;
  max-width: 400px;
  animation: card-fade-in 300ms ease-out both;
  transition: border-color 200ms ease;
}

.link-preview-card:hover {
  border-color: var(--accent);
}

@keyframes card-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.link-preview-image {
  width: 100px;
  height: auto;
  object-fit: cover;
  flex-shrink: 0;
}

.link-preview-content {
  padding: 8px 12px;
  min-width: 0;
}

.link-preview-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-preview-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.message-emote {
  width: auto;
  height: 28px;
  max-width: 128px;
  vertical-align: middle;
  transition: transform 150ms ease;
}

.message-emote:hover {
  transform: scale(1.3);
}

.message-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
  transition: color 150ms ease, text-underline-offset 150ms ease;
}

.message-link:hover {
  color: var(--text);
  text-underline-offset: 4px;
}

.message-image-wrap {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  vertical-align: middle;
}

.message-image-trigger {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
  background: var(--panel-soft);
  cursor: pointer;
  line-height: 0;
}

.message-image-preview,
.message-video-preview {
  display: block;
  width: 74px;
  max-width: 74px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
}

.message-video-preview {
  cursor: pointer;
}

.message-voice-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  max-width: 320px;
}

.message-voice-player {
  height: 32px;
  width: 100%;
}

.message-transcription {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  border-top: 1px solid var(--line);
  padding-top: 6px;
}

.reply-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
  flex-shrink: 0;
}

.reply-bar-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}

.chat-footer {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: var(--panel-soft);
  flex-shrink: 0;
}

.chat-footer::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.4;
}

.input-composer-inner {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.input-composer-inner:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(46, 196, 182, 0.15);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.input-composer-inner .icon-btn,
.input-composer-inner .send-btn {
  background: transparent;
  border: none;
  border-radius: 0;
  height: 36px;
  min-width: 40px;
}

.input-composer-inner #chatInput {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0 4px;
}

.input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
  min-width: 0;
}

.voice-recording-wrap,
.voice-preview-wrap {
  position: absolute;
  inset: 0;
  background: var(--input-bg);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 15px;
  z-index: 2;
}

.voice-recording-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  min-width: 65px;
}

.voice-recording-dot {
  width: 10px;
  height: 10px;
  background: var(--danger);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--danger);
  animation: voice-dot-pulse 0.8s infinite alternate;
}

@keyframes voice-dot-pulse {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0.4; transform: scale(1.3); }
}

.voice-visualizer-inline {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 24px;
}

.voice-bar {
  width: 3px;
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
  transition: height 0.1s ease;
}

.voice-preview-wrap {
  gap: 10px;
}

.voice-preview-player-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.voice-preview-player-wrap audio {
  display: none;
}

.voice-preview-playback-info {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.voice-play-pause {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  width: 20px;
}

.voice-preview-waveform {
  flex: 1;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
}

.voice-preview-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
}

.voice-preview-time {
  font-size: 11px;
  color: var(--muted);
  min-width: 35px;
  text-align: right;
}

.voice-send-btn {
  color: var(--accent-strong);
}

.voice-btn.recording {
  color: var(--danger);
  animation: voice-dot-pulse 0.8s infinite alternate;
}

.composer-auth {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.auth-points-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.auth-entry-btn,
.auth-avatar-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 150ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.auth-entry-btn:hover,
.auth-avatar-btn:hover {
  transform: scale(1.05);
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(46, 196, 182, 0.15);
}

.auth-entry-btn:active,
.auth-avatar-btn:active {
  transform: scale(0.95);
}

.auth-entry-btn {
  height: 36px;
  min-width: 74px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
}

.auth-avatar-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  overflow: hidden;
}

.auth-avatar-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-avatar-provider-kick {
  border-color: rgba(46, 189, 89, 0.45);
}

.auth-avatar-provider-twitch {
  border-color: rgba(143, 123, 248, 0.45);
}

.scroll-paused {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 8px 10px;
  background: var(--panel-soft);
  flex-shrink: 0;
}

.scroll-paused:not(.hidden) {
  animation: slide-up 200ms ease-out;
}

@keyframes slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.scroll-paused-text {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.scroll-paused-btn {
  min-width: 74px;
  height: 30px;
  font-size: 12px;
  color: var(--accent);
}

.powered-by {
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  line-height: 1.2;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  flex-shrink: 0;
  position: relative;
}

.powered-by::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.2;
}

.powered-by a {
  color: var(--accent);
  text-decoration: none;
  transition: color 200ms ease;
}

.powered-by a:hover {
  text-decoration: underline;
  color: var(--text);
}

.icon-btn {
  min-width: 34px;
  height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

.icon-btn.small {
  min-width: 28px;
  height: 28px;
  padding: 0;
}

.send-btn {
  min-width: 44px;
  height: 36px;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  transition: transform 100ms ease, color 150ms ease;
}

.send-btn:hover:not(:disabled) {
  transform: scale(1.1);
}

.send-btn:active:not(:disabled) {
  transform: scale(0.9);
}

.send-btn-icon {
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#chatInput {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  padding: 0 10px;
  outline: none;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

#chatInput::placeholder {
  color: var(--muted);
  transition: opacity 300ms ease;
}

#chatInput:focus::placeholder {
  opacity: 0.5;
}

#chatInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(46, 196, 182, 0.1);
}

#chatInput:disabled,
.send-btn:disabled,
.icon-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.emote-panel,
.thread-panel {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 92px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  max-height: min(68vh, 640px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 6;
}

.emote-panel:not(.hidden),
.thread-panel:not(.hidden) {
  animation: panel-slide-up 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes panel-slide-up {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.thread-panel {
  left: auto;
  width: min(390px, calc(100% - 20px));
}

.emote-panel-head,
.thread-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.emote-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  flex-wrap: nowrap;
  scrollbar-width: none;
}

.emote-tabs::-webkit-scrollbar {
  display: none;
}

.emote-tab-btn {
  flex: 1 0 auto;
  min-width: 60px;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 0;
}

.emote-tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.emote-tab-btn.active {
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.emote-search-wrap {
  padding: 8px 10px 0;
}

#gifSearchContainer {
  margin-bottom: 10px;
}

#gifSearchInput {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--input-bg);
  color: var(--text);
  padding: 0 10px;
  outline: none;
}

.emote-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 0 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#emoteSearchInput {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--input-bg);
  color: var(--text);
  padding: 0 10px;
  outline: none;
}

#emoteSearchInput::placeholder {
  color: var(--muted);
}

#emoteSearchInput:focus {
  border-color: var(--accent);
}

.emote-section {
  padding: 8px 10px;
}

.emote-section h3 {
  margin: 0 0 6px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
}

.emote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
  overflow: visible;
}

.emote-grid#gifGrid {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

.gif-item {
  min-height: 120px;
}

.gif-item img {
  max-width: 100%;
  max-height: 120px;
}

.emote-grid.unicode {
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
}

.unicode-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.unicode-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.unicode-group-title {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.emote-item {
  min-height: 42px;
  min-width: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: transform 120ms ease, background 120ms ease;
}

.emote-item:hover {
  transform: scale(1.2);
  background: var(--accent-soft);
}

.emote-item:active {
  transform: scale(0.95);
}

.emote-item img {
  width: auto;
  height: auto;
  max-width: 36px;
  max-height: 36px;
  object-fit: contain;
}
.emote-item-tenor img {
  width: auto;
  height: auto;
  object-fit: contain;
}
.emote-item.basic {
  font-size: 18px;
}

.emote-item.unicode {
  font-size: 19px;
}

.thread-messages {
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.thread-panel-foot {
  border-top: 1px solid var(--line);
  padding: 8px 10px;
  display: flex;
  justify-content: flex-end;
}

.thread-item {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px;
  background: var(--panel-soft);
  font-size: 12px;
}

.thread-item.root {
  border-color: var(--accent);
}

.thread-item-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.thread-item-user {
  font-weight: 700;
}

.thread-item-time {
  color: var(--muted);
  font-size: 10px;
}

.system-badge {
  font-size: 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 1px 4px;
  margin-left: 4px;
  color: var(--muted);
}

.message-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  margin-right: 4px;
  user-select: none;
  vertical-align: middle;
  animation: badge-pop 300ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes badge-pop {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.message-badge-img {
  height: 18px;
  width: auto;
  display: block;
  object-fit: contain;
}

.system-emoji {
  vertical-align: middle;
}

.info-row,
.error-row {
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  font-size: 12px;
}

.emote-grid .info-row,
.emote-grid .error-row {
  grid-column: 1 / -1;
}

.info-row {
  color: var(--muted);
  background: var(--panel-soft);
}

.error-row {
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.45);
  background: rgba(255, 107, 107, 0.08);
}

.context-menu {
  position: absolute;
  z-index: 20;
  min-width: 190px;
  max-width: min(280px, calc(100% - 16px));
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 4px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
}

.context-menu:not(.hidden) {
  animation: menu-pop 180ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes menu-pop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.context-menu-item {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 13px;
  padding: 8px 9px;
  cursor: pointer;
}

.context-menu-item:hover {
  background: var(--panel-soft);
}

.context-menu-item.active {
  color: var(--accent);
}

.context-menu-item.danger {
  color: var(--danger);
}

.context-menu-separator {
  height: 1px;
  background: var(--line);
  margin: 4px 2px;
}

.image-preview-modal {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(7, 10, 15, 0.9);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
}

.image-preview-modal:not(.hidden) {
  animation: modal-fade-in 200ms ease-out both;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.image-preview-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
}

.image-preview-modal img {
  max-width: min(94vw, 1100px);
  max-height: min(78vh, 900px);
  width: auto;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #000;
}

#imagePreviewOpenLink {
  color: var(--accent);
  font-size: 13px;
}

.pinned-messages {
  background: var(--accent-soft);
  border-bottom: 1px solid var(--accent);
  padding: 8px 12px;
  font-size: 13px;
  max-height: 100px;
  overflow-y: auto;
}

.pinned-messages:not(.hidden) {
  animation: pinned-slide-down 300ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes pinned-slide-down {
  from { max-height: 0; padding: 0 12px; opacity: 0; }
  to { max-height: 100px; padding: 8px 12px; opacity: 1; }
}

.pinned-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  animation: msg-slide-in 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pinned-text {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre-wrap;
}

.pinned-user {
  font-weight: 700;
}

.pinned-item:last-child {
  margin-bottom: 0;
}

.poll-container {
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.poll-container:not(.hidden) {
  animation: panel-slide-up 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.poll-question {
  font-weight: 700;
  margin-bottom: 10px;
}

.poll-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.poll-option-btn {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  text-align: left;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 200ms ease, transform 100ms ease;
}

.poll-option-btn:hover {
  border-color: var(--accent);
  transform: translateX(2px);
}

.poll-option-btn:active {
  transform: scale(0.98);
}

.poll-option-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--accent);
  opacity: 0.2;
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.poll-option-text {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
}


.voice-action-btn.send {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .chat-main {
    padding: 6px;
  }
}

@media (max-width: 620px) {
  .chat-footer {
    gap: 6px;
    padding: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .input-composer-inner .icon-btn,
  .input-composer-inner .send-btn {
    height: 34px;
    min-width: 36px;
  }

  .auth-entry-btn {
    min-width: 68px;
    height: 34px;
    font-size: 11px;
    padding: 0 8px;
  }

  .auth-avatar-btn {
    width: 34px;
    height: 34px;
  }


  .message-row {
    font-size: 13px;
  }

  .thread-panel,
  .emote-panel {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: 82px;
  }

  .message-image-preview {
    width: 62px;
    max-width: 62px;
    height: 40px;
  }

  .scroll-paused {
    padding: 8px;
  }
}

@media (max-width: 360px) {
  .chat-footer {
    gap: 5px;
    padding: 7px;
    padding-bottom: calc(7px + env(safe-area-inset-bottom));
  }

  .input-composer-inner .icon-btn,
  .input-composer-inner .send-btn {
    height: 32px;
    min-width: 32px;
  }

  .auth-entry-btn {
    min-width: 60px;
    height: 32px;
    font-size: 10px;
    padding: 0 7px;
  }

  .auth-avatar-btn {
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 300px) {
  .auth-entry-btn {
    min-width: 54px;
    font-size: 10px;
  }

  .thread-panel,
  .emote-panel {
    bottom: 78px;
  }
}

@media (max-width: 280px) {
  .chat-main {
    padding: 4px;
  }
  .message-row {
    font-size: 13px;
    gap: 3px;
  }
  .chat-footer {
    padding: 4px;
    gap: 4px;
  }
  .input-composer-inner .icon-btn {
    min-width: 28px;
    padding: 0 4px;
  }
  .voice-recording-wrap {
    padding: 0 4px;
    gap: 6px;
  }
  .voice-visualizer-inline {
    display: none;
  }
  .voice-recording-status {
    min-width: 50px;
    font-size: 11px;
  }
  .voice-preview-wrap {
    padding: 0 4px;
    gap: 4px;
  }
  .voice-preview-playback-info {
    gap: 6px;
  }
  .voice-preview-time {
    font-size: 9px;
    min-width: 28px;
  }
}

.rainbow-nick {
  display: inline-block;
  background: linear-gradient(to right, #ff0000, #ff8800, #ffff00, #00ff00, #0088ff, #0000ff, #8800ff, #ff0000);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  animation: rainbow-scroll 5s linear infinite;
  font-weight: bold !important;
}

@keyframes rainbow-scroll {
  to { background-position: 200% center; }
}

.mention .rainbow-nick,
.reply-user.rainbow-nick,
.mention.self.rainbow-nick {
  -webkit-text-fill-color: transparent;
  background: linear-gradient(to right, #ff0000, #ff8800, #ffff00, #00ff00, #0088ff, #0000ff, #8800ff, #ff0000) !important;
  background-size: 200% auto !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  animation: rainbow-scroll 5s linear infinite;
}

.mention.self.rainbow-nick {
  position: relative;
  border-radius: 4px;
  padding: 1px 4px;
}

.mention.self.rainbow-nick::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(240, 165, 0, 0.12);
  border-radius: 4px;
  z-index: -1;
}

.autocomplete-panel {
  position: absolute;
  bottom: 100%;
  left: 10px;
  right: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4);
  z-index: 100;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 5px;
}

.autocomplete-panel:not(.hidden) {
  animation: panel-slide-up 180ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  transition: background 120ms ease, transform 100ms ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item.selected,
.autocomplete-item:hover {
  background: var(--panel-soft);
  color: var(--accent);
  transform: translateX(3px);
}

.autocomplete-item img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.autocomplete-item .symbol {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.autocomplete-item .code {
  font-weight: 600;
}

.autocomplete-item .desc {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}

/* Velocity Physics */
[data-velocity="1"] .message-row {
  transition-duration: 100ms;
}

[data-velocity="2"] .message-row {
  transition-duration: 60ms;
}

[data-velocity="3"] .message-row {
  transition-duration: 30ms;
  filter: contrast(1.1);
}

.velocity-shake {
  animation: chat-shake 0.2s infinite alternate;
}

@keyframes chat-shake {
  from { transform: translateX(0); }
  to { transform: translateX(1px); }
}

[data-velocity="3"] .velocity-shake {
  animation: chat-shake-intense 0.1s infinite alternate;
}

@keyframes chat-shake-intense {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-0.5deg); }
  30% { transform: translate(3px, 2px) rotate(0deg); }
  50% { transform: translate(-1px, 1px) rotate(0.5deg); }
  70% { transform: translate(3px, 1px) rotate(-0.5deg); }
  90% { transform: translate(-1px, -1px) rotate(0deg); }
  100% { transform: translate(1px, 2px) rotate(0.5deg); }
}


/* ===== Enhanced UI Polish ===== */

/* Custom scrollbar */
.chat-main::-webkit-scrollbar {
  width: 6px;
}

.chat-main::-webkit-scrollbar-track {
  background: transparent;
}

.chat-main::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px;
  transition: background 200ms ease;
}

.chat-main::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.emote-panel-body::-webkit-scrollbar,
.thread-messages::-webkit-scrollbar {
  width: 5px;
}

.emote-panel-body::-webkit-scrollbar-thumb,
.thread-messages::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px;
}

/* Connection status dot */
.chat-shell::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  z-index: 50;
  opacity: 0.8;
  transition: background 300ms ease, box-shadow 300ms ease;
  animation: status-pulse 3s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* Disconnected state */
.chat-shell[data-disconnected]::after {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
  animation: status-pulse-danger 1s ease-in-out infinite;
}

@keyframes status-pulse-danger {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Message action (/me) style enhancement */
.message-action .message-text {
  border-left: 2px solid currentColor;
  padding-left: 6px;
  margin-left: 2px;
}

/* Smooth theme transition for all elements */
.chat-shell,
.chat-footer,
.chat-main,
.input-composer-inner,
.emote-panel,
.thread-panel,
.context-menu,
.reply-bar,
.scroll-paused,
.powered-by {
  transition: background 350ms ease, border-color 350ms ease, color 300ms ease;
}

/* Subtle hover on message rows for better interactivity feel */
.message-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 200ms ease;
  border-radius: 1px;
}

.message-row {
  position: relative;
}

.message-row:hover::before {
  opacity: 0.5;
}

/* Emote tab active indicator animation */
.emote-tab-btn {
  position: relative;
  overflow: hidden;
}

.emote-tab-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 200ms ease, left 200ms ease;
}

.emote-tab-btn.active::after {
  width: 100%;
  left: 0;
}

/* Reply bar entrance */
.reply-bar {
  animation: slide-up 200ms ease-out;
}

/* Voice recording pulse ring */
.voice-btn.recording::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--danger);
  animation: recording-ring 1.2s ease-out infinite;
}

@keyframes recording-ring {
  from { transform: scale(0.8); opacity: 1; }
  to { transform: scale(1.4); opacity: 0; }
}

.voice-btn {
  position: relative;
}

/* Thread item entrance */
.thread-item {
  animation: msg-slide-in 200ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Image preview hover zoom hint */
.message-image-trigger {
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.message-image-trigger:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Confetti celebration flash */
@keyframes celebration-flash {
  0% { box-shadow: inset 0 0 0 0 rgba(46, 196, 182, 0); }
  30% { box-shadow: inset 0 0 30px 0 rgba(46, 196, 182, 0.08); }
  100% { box-shadow: inset 0 0 0 0 rgba(46, 196, 182, 0); }
}

.chat-shell.celebrating {
  animation: celebration-flash 1.5s ease-out;
}

/* Smooth username color transitions */
.message-user {
  transition: opacity 150ms ease;
}

.message-user:hover {
  opacity: 0.8;
}

/* Settings panel entrance */
.settings-panel:not(.hidden) {
  animation: menu-pop 180ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}


/* ===== OBS OVERLAY MODE ===== */
.chat-shell.obs-overlay {
  background: transparent !important;
  border: none !important;
}

.chat-shell.obs-overlay .chat-footer,
.chat-shell.obs-overlay .powered-by,
.chat-shell.obs-overlay .scroll-paused,
.chat-shell.obs-overlay .reply-bar,
.chat-shell.obs-overlay .emote-panel,
.chat-shell.obs-overlay .thread-panel,
.chat-shell.obs-overlay .context-menu,
.chat-shell.obs-overlay .image-preview-modal,
.chat-shell.obs-overlay .pinned-messages,
.chat-shell.obs-overlay .poll-container,
.chat-shell.obs-overlay .autocomplete-panel,
.chat-shell.obs-overlay::after {
  display: none !important;
}

.chat-shell.obs-overlay .chat-main {
  background: transparent;
  padding: 8px;
}

.chat-shell.obs-overlay .message-row {
  background: rgba(0, 0, 0, 0.5) !important;
  border-radius: 6px;
  padding: 4px 8px;
  margin-bottom: 3px;
  backdrop-filter: blur(4px);
}

.chat-shell.obs-overlay .message-time {
  display: none;
}

.chat-shell.obs-overlay .message-user {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.chat-shell.obs-overlay .message-text {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.chat-shell.obs-overlay .message-source-badge,
.chat-shell.obs-overlay .message-source-logo {
  display: none !important;
}

/* ===== REVERSED CHAT MODE ===== */
.chat-shell.reversed-chat .chat-main {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.chat-shell.reversed-chat .messages {
  flex-direction: column;
}

.chat-shell.reversed-chat .message-row {
  animation: msg-slide-in-reversed 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes msg-slide-in-reversed {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== REACTIONS ===== */
.message-reactions {
  display: none;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
  padding-left: 0;
  width: 100%;
  flex-basis: 100%;
}

.message-reactions.has-reactions {
  display: flex;
}

.message-row:hover .message-reactions {
  display: flex;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: transform 100ms ease, border-color 150ms ease, background 150ms ease;
  line-height: 1;
}

.reaction-btn:hover {
  border-color: var(--accent);
  transform: scale(1.1);
}

.reaction-btn:active {
  transform: scale(0.9);
}

.reaction-btn.reacted {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.reaction-btn img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.reaction-btn .reaction-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.reaction-btn.reacted .reaction-count {
  color: var(--accent);
}

.reaction-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 22px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
  opacity: 0;
}

.message-row:hover .reaction-add-btn {
  opacity: 1;
}

.reaction-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Compact mode hides reactions padding */
.chat-shell.compact-messages .message-reactions {
  padding-left: 0;
}

/* OBS overlay hides reactions */
.chat-shell.obs-overlay .message-reactions {
  display: none;
}

/* Points display */
.points-display {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  padding: 1px 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 150ms ease;
  white-space: nowrap;
  line-height: 1.2;
}

.points-display:hover {
  background: var(--accent-soft);
}

.points-display.hidden {
  display: none;
}

/* Rewards popup */
.rewards-popup {
  position: absolute;
  bottom: 60px;
  left: 6px;
  z-index: 18;
  width: min(260px, calc(100% - 12px));
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: panel-slide-up 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.rewards-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
}

.rewards-popup-body {
  padding: 10px 12px;
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reward-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.reward-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.reward-name {
  font-size: 13px;
  font-weight: 600;
}

.reward-desc {
  font-size: 11px;
  color: var(--muted);
}

.reward-limits {
  font-size: 10px;
  color: var(--muted);
  opacity: 0.7;
}

.reward-redeem-btn {
  flex-shrink: 0;
  padding: 4px 10px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 150ms ease, transform 100ms ease;
}

.reward-redeem-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #000;
}

.reward-redeem-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.reward-redeem-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* OBS exit button */
.obs-exit-btn {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 9999;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0.3;
  transition: opacity 200ms ease;
}
.obs-exit-btn:hover {
  opacity: 1;
}
.chat-shell:not(.obs-overlay) .obs-exit-btn {
  display: none;
}

/* Gamble animation */
.gamble-animation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  pointer-events: none;
  animation: gamble-overlay-fade 3s ease-out forwards;
}

@keyframes gamble-overlay-fade {
  0% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

.gamble-animation {
  text-align: center;
  animation: gamble-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gamble-win .gamble-icon { font-size: 64px; }
.gamble-lose .gamble-icon { font-size: 64px; }

.gamble-text {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  margin-top: 8px;
}

.gamble-amount {
  font-size: 32px;
  font-weight: 900;
  margin-top: 4px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.8);
}

.gamble-win .gamble-amount { color: #2ebd59; }
.gamble-lose .gamble-amount { color: #ff6b6b; }

@keyframes gamble-bounce {
  from { transform: scale(0.3); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Prediction UI */
.prediction-container {
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.prediction-container:not(.hidden) {
  animation: panel-slide-up 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.prediction-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 14px;
}

.prediction-pool {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 600;
}

.prediction-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prediction-option {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  transition: border-color 200ms ease;
}

.prediction-option:hover {
  border-color: var(--accent);
}

.prediction-option-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  opacity: 0.15;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 8px 0 0 8px;
}

.prediction-option-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prediction-option-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.prediction-option-label {
  font-weight: 600;
  font-size: 13px;
}

.prediction-option-total {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.prediction-option-bottom {
  display: flex;
  align-items: center;
  gap: 6px;
}

.prediction-bet-input {
  width: 70px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text);
  padding: 0 6px;
  font-size: 12px;
}

.prediction-bet-btn {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, transform 100ms ease;
}

.prediction-bet-btn:hover {
  background: var(--accent);
  color: #000;
}

.prediction-bet-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.prediction-mod-btn {
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}

.prediction-mod-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.prediction-resolve-btn {
  height: 28px;
  width: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 150ms ease, background 150ms ease;
}

.prediction-resolve-btn:hover {
  border-color: #f7b267;
  background: rgba(247, 178, 103, 0.1);
}

.prediction-lock-badge {
  font-size: 14px;
}
