/* =============================================
   TWITCH IRL DASHBOARD – style.css
   ============================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Mobile: kein blaues Flash beim Tippen, kein 300ms Delay */
button, a, input, select, label, summary {
  -webkit-tap-highlight-color: transparent;
}
button {
  touch-action: manipulation;
}

:root {
  --bg-0:          #0e0e10;
  --bg-1:          #18181b;
  --bg-2:          #1f1f23;
  --bg-3:          #26262c;
  --border:        #2e2e35;
  --text-1:        #efeff1;
  --text-2:        #adadb8;
  --text-3:        #6e6e7a;
  --purple:        #9147ff;
  --purple-dim:    #5c2fa6;
  --teal:          #00c8af;
  --orange:        #ff6905;
  --gold:          #f2a900;
  --blue:          #5bc8e8;
  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     14px;
  --header-h:      52px;
  --divider-h:     12px;
  --chat-font-size: 14px;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  color: var(--text-1);
  font-family: 'Segoe UI Variable', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* =============================================
   SCREENS (Setup / Login)
   ============================================= */

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-0);
  z-index: 100;
  padding: 16px;
}

.setup-box,
.login-box {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.brand h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
}

.brand p {
  color: var(--text-2);
  font-size: 13px;
}

.setup-desc {
  color: var(--text-2);
  text-align: center;
  font-size: 13px;
}

.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-2);
  border-radius: var(--radius-md);
  padding: 16px;
}

.step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--text-2);
}

.step-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--purple);
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step strong { color: var(--text-1); }

.step code {
  display: inline-block;
  margin-top: 4px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-family: 'Consolas', monospace;
  font-size: 12px;
  color: var(--teal);
  word-break: break-all;
}

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

.input-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-group input {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-1);
  font-size: 14px;
  font-family: 'Consolas', monospace;
  outline: none;
  transition: border-color 0.15s;
}

.input-group input:focus { border-color: var(--purple); }

/* =============================================
   BUTTONS
   ============================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  user-select: none;
  white-space: nowrap;
  touch-action: manipulation;
}

.btn:active { transform: scale(0.96); }
.btn-full   { width: 100%; }
.btn-large  { padding: 14px 22px; font-size: 15px; }
.btn-sm     { padding: 7px 14px; min-height: 34px; font-size: 12px; font-weight: 600; }

.voice-test-btn {
  background: var(--bg-3);
  color: var(--text-1);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.voice-test-btn:hover { background: var(--bg-4, var(--bg-3)); border-color: var(--purple); color: var(--purple); }

.btn-primary {
  background: var(--purple);
  color: white;
}
.btn-primary:hover { background: #a970ff; }

.btn-twitch {
  background: var(--purple);
  color: white;
}
.btn-twitch:hover { background: #a970ff; }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-2); color: var(--text-1); }

.icon-btn {
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px;
  min-width: 44px;
  min-height: 44px;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  touch-action: manipulation;
}
.icon-btn:hover  { background: var(--bg-2); color: var(--text-1); }
.icon-btn:active { background: var(--bg-3); color: var(--text-1); transform: scale(0.88); }

/* =============================================
   DASHBOARD LAYOUT
   ============================================= */

#dashboard {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Alle direkten und indirekten Flex-Kinder des Dashboards
   dürfen unter ihre Inhaltsbreite schrumpfen und nie horizontal überlaufen */
#dashboard > * {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* --- Header --- */
#header {
  flex: 0 0 var(--header-h);
  height: var(--header-h);
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  gap: 12px;
  z-index: 10;
}

#user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

#user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--purple);
  display: block;
  cursor: pointer;
  transition: border-color 0.15s, opacity 0.15s;
}
#user-avatar:hover { border-color: var(--text-2); opacity: 0.85; }
#avatar-wrapper.open #user-avatar { border-color: var(--text-1); }

.avatar-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  min-width: 140px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 200;
  animation: fade-in-down 0.12s ease;
}
.avatar-menu[hidden] { display: none; }

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

.avatar-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}
.avatar-menu-item:hover {
  background: color-mix(in srgb, #e74c3c 12%, var(--bg-3));
  color: #e74c3c;
}
.avatar-menu-item:active { transform: scale(0.97); }

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

#user-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-label {
  font-size: 10px;
  color: var(--text-3);
  margin-right: 6px;
}

/* Klickbare Panel-View-Toggle im Header */
.status-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-right: 6px;
  user-select: none;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  transition: background 0.3s;
  flex-shrink: 0;
}
.status-dot.status-connected    { background: #0fca50; }
.status-dot.status-connecting   { background: var(--gold); animation: pulse-dot 1s infinite; }
.status-dot.status-disconnected { background: #e63535; }
.status-dot.status-error        { background: #e63535; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

#header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* =============================================
   PANEL HEADER (shared)
   ============================================= */

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
  flex-shrink: 0;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-2);
}

.panel-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.event-badge {
  background: var(--purple);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
}

.swipe-hint-label {
  font-size: 11px;
  color: var(--text-3);
  font-style: italic;
}

/* =============================================
   EVENTS PANEL
   ============================================= */

#events-panel {
  flex: none;
  height: 40%;
  min-height: 80px;
  max-height: 70%;
  overflow: hidden;           /* Scrollen nur im inneren events-scroll */
  overflow-x: hidden;
  min-width: 0;               /* Flex-Kind darf unter Inhaltsbreite schrumpfen */
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-0);
  display: flex;
  flex-direction: column;
}

/* Scrollbarer Bereich innerhalb des Events-Panels */
#events-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
#events-scroll::-webkit-scrollbar { width: 4px; }
#events-scroll::-webkit-scrollbar-track { background: transparent; }
#events-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

#events-container {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Flash on new event — auf events-scroll damit er sichtbar ist */
#events-panel.raid-flash #events-scroll,
#events-panel.raid-flash {
  animation: raid-flash 0.8s ease;
}
@keyframes raid-flash {
  0%   { background: var(--bg-0); }
  20%  { background: #2a1400; }
  100% { background: var(--bg-0); }
}

/* =============================================
   EVENT CARDS
   ============================================= */

.event-card {
  background: var(--bg-2);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--event-color, var(--purple));
  position: relative;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  touch-action: pan-y;
  animation: card-pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
}

.event-card:active { cursor: grabbing; }

@keyframes card-pop-in {
  0%   { transform: translateY(-14px) scale(0.93); opacity: 0; }
  100% { transform: translateY(0)     scale(1);    opacity: 1; }
}

/* Raid gets extra glow */
.event-raid-special {
  box-shadow: 0 0 0 1px #ff6905, 0 4px 20px rgba(255,105,5,0.25);
  animation: card-pop-in 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) both,
             raid-glow 0.8s ease 0.35s;
}
@keyframes raid-glow {
  0%   { box-shadow: 0 0 0 1px #ff6905, 0 4px 40px rgba(255,105,5,0.6); }
  100% { box-shadow: 0 0 0 1px #ff6905, 0 4px 20px rgba(255,105,5,0.25); }
}

/* Inner layout */
.event-card-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.event-label {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 4px;
  color: white;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  line-height: 1;
  height: auto;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  background: var(--event-color, var(--purple));
}

.event-body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.event-icon {
  font-size: 24px;
  flex-shrink: 0;
  line-height: 1;
}

.event-info {
  flex: 1;
  min-width: 0;
}

.event-title {
  font-size: 16px;
  font-weight: 900;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-detail {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-time {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* Swipe overlay indicator */
.swipe-indicator {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 16px;
  background: linear-gradient(to left, rgba(0,200,175,0.18) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.swipe-indicator span {
  font-size: 12px;
  font-weight: 700;
  color: var(--teal);
  display: flex;
  align-items: center;
  gap: 5px;
}

.event-card.swiping-far .swipe-indicator {
  opacity: 1;
}


/* =============================================
   DIVIDER
   ============================================= */

#divider {
  flex: 0 0 var(--divider-h);
  height: var(--divider-h);
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: row-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: background 0.15s;
  z-index: 5;
}

#divider:hover { background: var(--bg-3); }

.divider-grip {
  display: flex;
  gap: 3px;
  align-items: center;
}

.divider-grip span {
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--text-3);
  transition: background 0.15s;
  display: block;
}

#divider:hover .divider-grip span { background: var(--text-2); }

/* =============================================
   CHAT PANEL
   ============================================= */

#chat-panel {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  background: var(--bg-0);
  overflow: hidden;
}

#chat-messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

#chat-messages::-webkit-scrollbar { width: 4px; }
#chat-messages::-webkit-scrollbar-track { background: transparent; }
#chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.chat-message {
  padding: 4px 6px;
  border-radius: 4px;
  font-size: var(--chat-font-size);
  line-height: 1.45;
  word-break: break-word;
  transition: background 0.1s;
}

.chat-message:hover { background: var(--bg-2); }

.chat-badges {
  margin-right: 2px;
  font-size: 12px;
}

.badge-icon {
  display: inline-block;
  margin-right: 2px;
  font-size: 11px;
}

.chat-username {
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.15s;
}
.chat-username:hover { opacity: 0.8; }

.chat-colon {
  color: var(--text-3);
  margin-right: 2px;
}

.chat-text { color: var(--text-1); font-weight: 500; }

.chat-emote {
  height: 28px;
  width: auto;
  max-width: 112px;
  vertical-align: middle;
  display: inline-block;
  margin: 0 2px;
  image-rendering: auto;
}

.twitch-emote { height: 28px; }

/* =============================================
   CHANNEL POINTS REWARDS PANEL
   ============================================= */

#rewards-panel {
  display: none;
  flex-direction: column;
  max-height: 260px;
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  animation: slide-up 0.2s ease;
}

#rewards-panel.open { display: flex; }

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

.rewards-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.rewards-panel-header .panel-title { flex: 1; }

#rewards-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.rewards-placeholder {
  width: 100%;
  color: var(--text-3);
  font-size: 13px;
  padding: 12px 4px;
  text-align: center;
}

.rewards-error { color: #ff6b6b; }

.reward-card {
  background: var(--bg-2);
  border-radius: var(--radius-md);
  overflow: hidden;
  width: 150px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}

.reward-card:hover { border-color: var(--purple); }

.reward-color-strip {
  height: 4px;
  width: 100%;
  flex-shrink: 0;
}

.reward-body {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 4px;
}

.reward-img {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  flex-shrink: 0;
}

.reward-img-fallback {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.reward-info { flex: 1; min-width: 0; }

.reward-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reward-cost {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  margin-top: 2px;
}

.reward-trigger-btn {
  margin: 6px 8px 8px;
  background: var(--purple);
  border: none;
  border-radius: 4px;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 8px;
  cursor: pointer;
  width: calc(100% - 16px);
  transition: background 0.15s;
}

.reward-trigger-btn:hover { background: #a970ff; }

/* Toggle button active state */
.rewards-toggle-btn.active {
  color: var(--purple);
  background: rgba(145, 71, 255, 0.15);
}

/* =============================================
   EMOTE PICKER
   ============================================= */

#emote-picker {
  display: none;
  flex-direction: column;
  max-height: 240px;
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  animation: slide-up 0.2s ease;
}

#emote-picker.open { display: flex; }

.emote-picker-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#emote-search {
  flex: 1;
  min-width: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-1);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s;
}
#emote-search:focus { border-color: var(--purple); }
#emote-search::placeholder { color: var(--text-3); }

#emote-grid {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-content: flex-start;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
#emote-grid::-webkit-scrollbar { width: 4px; }
#emote-grid::-webkit-scrollbar-track { background: transparent; }
#emote-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.emote-item {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
  transition: background 0.1s;
  position: relative;
}
.emote-item:hover { background: var(--bg-3); }
.emote-item img { max-width: 36px; max-height: 36px; object-fit: contain; }

.emote-picker-empty {
  width: 100%;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  padding: 24px 16px;
}

.emote-picker-btn.active {
  color: var(--purple);
  background: rgba(145, 71, 255, 0.15);
}

/* =============================================
   EMOTE AUTOCOMPLETE
   ============================================= */

#emote-autocomplete {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 -6px 20px rgba(0,0,0,0.45);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.ac-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.1s;
}
.ac-item:hover,
.ac-item.ac-active { background: var(--bg-3); }

.ac-emote-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.ac-code {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}

.ac-source {
  font-size: 10px;
  color: var(--text-3);
  margin-left: auto;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* =============================================
   CHAT INPUT
   ============================================= */

#chat-input-area {
  order: 100; /* immer als letztes Flex-Item im Dashboard */
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

#chat-input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-1);
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s;
}

#chat-input:focus        { border-color: var(--purple); }
#chat-input::placeholder { color: var(--text-3); }

#chat-send-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: var(--purple);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  touch-action: manipulation;
}

#chat-send-btn:hover  { background: #a970ff; }
#chat-send-btn:active { transform: scale(0.90); }

/* =============================================
   AUTO-SCROLL TOGGLE
   ============================================= */

.auto-scroll-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.auto-scroll-toggle input { display: none; }

.toggle-track {
  width: 36px;
  height: 22px;
  border-radius: 11px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.auto-scroll-toggle input:checked + .toggle-track {
  background: var(--purple);
  border-color: var(--purple);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform 0.2s, background 0.2s;
}

.auto-scroll-toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(14px);
  background: white;
}

/* =============================================
   EMPTY STATES
   ============================================= */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 16px;
  color: var(--text-3);
  text-align: center;
}

.empty-state p { font-size: 13px; }
.empty-state .empty-sub { font-size: 12px; color: var(--text-3); }

/* Im Chat-Bereich: Empty-State füllt den gesamten schwarzen Platz */
#chat-messages .empty-state {
  flex: 1;
  padding-top: 0;
  padding-bottom: 0;
}

/* =============================================
   VIEWER BADGE
   ============================================= */

.name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

#viewer-badge {
  display: none;
  align-items: center;
  gap: 4px;
  background: rgba(230,53,53,0.15);
  border: 1px solid rgba(230,53,53,0.35);
  border-radius: 10px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-1);
}

.live-dot-red {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e63535;
  animation: pulse-dot 1.5s ease infinite;
  flex-shrink: 0;
}

/* =============================================
   SETTINGS PANEL
   ============================================= */

#settings-panel {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-0);
  z-index: 150;
  flex-direction: column;
  animation: fade-in 0.18s ease;
}

#settings-panel.open { display: flex; }

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

#settings-header {
  flex: 0 0 var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 800;
  color: var(--text-1);
}

#settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.setting-group-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 8px;
  padding-left: 4px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  gap: 16px;
  margin-bottom: 2px;
}

.setting-row.setting-row-col {
  flex-direction: column;
  align-items: stretch;
}

.setting-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}

.setting-value {
  font-size: 13px;
  font-weight: 800;
  color: var(--purple);
}

.setting-slider {
  width: 100%;
  margin-top: 12px;
  accent-color: var(--purple);
  height: 6px;
  cursor: pointer;
  /* Größere Touch-Fläche für den Thumb */
  padding: 8px 0;
  box-sizing: content-box;
}

.setting-label-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}

.setting-desc {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
}

/* =============================================
   TOAST
   ============================================= */

#toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
  pointer-events: none;
}

.toast {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text-1);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast-error { border-color: #e63535; color: #ff6b6b; }

/* =============================================
   CHAT HEADER RIGHT
   ============================================= */

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =============================================
   CHAT MODE BUTTONS
   ============================================= */

.chatmode-btns {
  display: flex;
  align-items: center;
  gap: 2px;
}

.chatmode-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  min-height: 36px;
  min-width: 36px;
  font-size: 15px;
  cursor: pointer;
  color: var(--text-3);
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
  line-height: 1;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatmode-btn:hover  { background: var(--bg-2); color: var(--text-1); }
.chatmode-btn:active { background: var(--bg-3); transform: scale(0.88); }

.chatmode-btn.active {
  background: rgba(145,71,255,0.18);
  border-color: var(--purple);
  color: var(--purple);
}

/* =============================================
   UPTIME DISPLAY
   ============================================= */

#uptime-display {
  display: none;
  align-items: center;
  gap: 3px;
  background: rgba(0,200,175,0.12);
  border: 1px solid rgba(0,200,175,0.3);
  border-radius: 10px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
  color: var(--teal);
}

#uptime-display svg { flex-shrink: 0; fill: var(--teal); }

/* =============================================
   BATTERY DISPLAY
   ============================================= */

#battery-display {
  display: none;
  align-items: center;
  gap: 3px;
  border-radius: 10px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid transparent;
  transition: background 0.4s, border-color 0.4s, color 0.4s;
}

#battery-display.bat-ok {
  background: rgba(0,200,175,0.12);
  border-color: rgba(0,200,175,0.3);
  color: var(--teal);
}

#battery-display.bat-warn {
  background: rgba(242,169,0,0.12);
  border-color: rgba(242,169,0,0.3);
  color: var(--gold);
}

#battery-display.bat-crit {
  background: rgba(230,53,53,0.15);
  border-color: rgba(230,53,53,0.4);
  color: #ff6b6b;
  animation: pulse-dot 1.2s ease infinite;
}

#battery-display.bat-charging {
  background: rgba(145,71,255,0.12);
  border-color: rgba(145,71,255,0.35);
  color: var(--purple);
  animation: none;
}

#battery-icon { flex-shrink: 0; }

/* =============================================
   KI CHAT-ZUSAMMENFASSUNG
   ============================================= */

#chat-summary-bar {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(145,71,255,0.1), rgba(0,200,175,0.07));
  border-bottom: 1px solid rgba(145,71,255,0.2);
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
  animation: slide-down 0.2s ease;
}

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

.chat-summary-icon {
  flex-shrink: 0;
  font-size: 15px;
  margin-top: 1px;
}

#chat-summary-text {
  flex: 1;
  min-width: 0;
}

#chat-summary-text.loading {
  color: var(--text-3);
  font-style: italic;
  animation: pulse-dot 1.2s ease infinite;
}

.chat-summary-actions {
  display: flex;
  gap: 1px;
  flex-shrink: 0;
  margin-top: -1px;
}

.chat-summary-actions button {
  background: none;
  border: none;
  padding: 6px 10px;
  min-width: 36px;
  min-height: 36px;
  cursor: pointer;
  color: var(--text-3);
  font-size: 16px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s, transform 0.1s;
  font-family: inherit;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-summary-actions button:hover  { color: var(--text-1); background: var(--bg-2); }
.chat-summary-actions button:active { color: var(--text-1); background: var(--bg-3); transform: scale(0.88); }

/* =============================================
   FIRST-MSG & KEYWORD HIGHLIGHT
   ============================================= */

.chat-message.first-msg {
  background: rgba(242, 169, 0, 0.08);
  border-left: 2px solid var(--gold);
  padding-left: 6px;
}

.chat-message.keyword-hit {
  background: rgba(145, 71, 255, 0.12);
  border-left: 2px solid var(--purple);
  padding-left: 6px;
}

/* Both at the same time — keyword wins */
.chat-message.first-msg.keyword-hit {
  background: rgba(145, 71, 255, 0.15);
  border-left: 2px solid var(--purple);
}

/* =============================================
   ACKNOWLEDGED EVENT CARDS
   ============================================= */

.event-card.acknowledged {
  opacity: 0.4;
  filter: grayscale(1);
  cursor: default;
  touch-action: none;
  pointer-events: none;
}

.event-card.acknowledged .swipe-indicator { display: none; }

/* =============================================
   STREAM INFO PANEL
   ============================================= */

#stream-info-panel {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-0);
  z-index: 150;
  flex-direction: column;
  animation: fade-in 0.18s ease;
}

#stream-info-panel.open { display: flex; }

/* =============================================
   OBS PANEL
   ============================================= */

#obs-panel {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-0);
  z-index: 150;
  flex-direction: column;
  animation: fade-in 0.18s ease;
}
#obs-panel.open { display: flex; }

#obs-panel-header {
  flex: 0 0 var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 800;
  color: var(--text-1);
}

#obs-panel-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  box-sizing: border-box;
}

/* Verbindungsstatus-Dot im Panel-Header (mini) */
#obs-panel-status-dot {
  width: 8px;
  height: 8px;
}

/* OBS-Button im Header zeigt grünen Punkt wenn verbunden */
#obs-btn.obs-connected { color: var(--teal); }

/* Light-Theme */
body[data-theme="light"] #obs-panel { background: var(--bg-0); }

#stream-info-header {
  flex: 0 0 var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 800;
  color: var(--text-1);
}

#stream-info-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.info-input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-1);
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.info-input:focus { border-color: var(--purple); }
.info-input::placeholder { color: var(--text-3); }

#game-search-results {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
}

.game-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--bg-2);
  border: 1px solid var(--border);
  transition: background 0.15s, border-color 0.15s;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}

.game-result-item:hover { background: var(--bg-3); border-color: var(--purple); }

.game-result-item img {
  border-radius: 3px;
  flex-shrink: 0;
  object-fit: cover;
}

/* =============================================
   MOD CONTEXT MENU (Modal)
   ============================================= */

#mod-context-menu {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.12s ease;
}

#mod-context-menu.open { display: flex; }

.mod-menu-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}

.mod-menu-title {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.mod-menu-title strong {
  color: var(--text-1);
  font-size: 14px;
}

.mod-menu-btn {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-2);
  color: var(--text-1);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}

.mod-menu-btn:hover { background: var(--bg-3); border-color: var(--text-3); }

.mod-menu-btn-danger {
  color: #ff6b6b;
  border-color: rgba(230,53,53,0.3);
}

.mod-menu-btn-danger:hover { background: rgba(230,53,53,0.12); border-color: #e63535; }

.mod-menu-btn-cancel {
  color: var(--text-3);
  margin-top: 4px;
  text-align: center;
}

/* =============================================
   KOMPAKT-MODUS
   ============================================= */

#events-container.compact { gap: 3px; }

#events-container.compact .event-card-inner {
  padding: 6px 8px;
  gap: 7px;
}

#events-container.compact .event-icon { font-size: 18px; }
#events-container.compact .event-title { font-size: 13px; }
#events-container.compact .event-detail { font-size: 11px; }
#events-container.compact .event-time { font-size: 10px; }

#events-container.compact .event-label {
  font-size: 8px;
  min-height: 24px;
  padding: 2px 3px;
}

/* =============================================
   EVENT FILTER PILLS
   ============================================= */

.event-filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.event-filter-pill input { display: none; }

.event-filter-pill label {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 9px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  color: var(--text-3);
  user-select: none;
  touch-action: manipulation;
}

.event-filter-pill label:active { transform: scale(0.94); }

.event-filter-pill input:checked + label {
  border-color: var(--purple);
  background: rgba(145,71,255,0.15);
  color: var(--text-1);
}

/* =============================================
   STREAM INFO TABS
   ============================================= */

.stream-info-tabs {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
}

.stream-tab-btn {
  flex: 1;
  padding: 14px 8px;
  min-height: 48px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, transform 0.1s;
  letter-spacing: 0.02em;
  touch-action: manipulation;
}

.stream-tab-btn:hover  { color: var(--text-2); }
.stream-tab-btn:active { transform: scale(0.95); }

.stream-tab-btn.active {
  color: var(--purple);
  border-bottom-color: var(--purple);
}

/* Poll-Options Abstände */
#poll-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Select passend zu info-input stylen */
select.info-input {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%236e6e7a'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* =============================================
   STREAM PREVIEW PANEL — draggbares PiP-Overlay
   (top/left/width/height werden per JS gesetzt)
   ============================================= */

#stream-preview-panel {
  position: fixed;
  z-index: 900;
  border-radius: 10px;
  box-shadow: 0 6px 28px rgba(0,0,0,0.75);
  background: #111;
  overflow: hidden;
  user-select: none;
  touch-action: none;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.88);
  transform-origin: center center;
  transition: opacity 0.22s, transform 0.22s;
}
#stream-preview-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}
/* Sanfter Übergang (Ecken-Snap + Größenwechsel) */
#stream-preview-panel.preview-snap {
  transition: opacity 0.25s, transform 0.25s,
              left   0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              top    0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              width  0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              height 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Ganzes Panel ist Drag-Fläche (Buttons überschreiben den Cursor) */
#stream-preview-panel { cursor: grab; }
#stream-preview-panel:active { cursor: grabbing; }

/* ---- Kontrollleiste ---- */
#stream-preview-bar {
  height: 28px;
  background: rgba(0,0,0,0.88);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
  gap: 4px;
  border-radius: 10px 10px 0 0;
  flex-shrink: 0;
}
#stream-preview-bar button { cursor: pointer; touch-action: manipulation; }

/* Qualitäts-Buttons */
#preview-quality-btns { display: flex; gap: 2px; }
.pq-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 4px;
  color: rgba(255,255,255,0.5);
  font-size: 9px;
  font-weight: 800;
  width: 22px;
  height: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.02em;
}
.pq-btn:hover  { background: rgba(255,255,255,0.2);  color: #fff; }
.pq-btn.active { background: var(--purple); color: #fff; }

/* Pause/Refresh-Buttons */
#preview-bar-right { display: flex; align-items: center; gap: 2px; }
#preview-bar-right button {
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 4px;
  color: rgba(255,255,255,0.6);
  width: 24px;
  height: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s;
}
#preview-bar-right button:hover  { background: rgba(255,255,255,0.22); color: #fff; }
#preview-bar-right button:active { transform: scale(0.88); }

/* ---- Bildbereich ---- */
#stream-preview-inner {
  position: relative;
  width: 100%;
  height: calc(100% - 28px);
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#stream-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
#stream-preview-img.loaded { display: block; }

#stream-preview-offline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
}


#preview-btn.active {
  color: var(--purple);
  background: rgba(145,71,255,0.15);
}

/* =============================================
   CLIP BUTTON ANIMATION
   ============================================= */

#clip-btn.clipping {
  animation: clip-pulse 0.6s ease;
  color: var(--teal);
}

@keyframes clip-pulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* =============================================
   OBS WEBSOCKET
   ============================================= */

.obs-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 2px;
  font-size: 13px;
  color: var(--text-2);
}

.obs-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}

.obs-dot-green  { background: #2ecc71; box-shadow: 0 0 6px rgba(46,204,113,0.5); }
.obs-dot-red    { background: #e74c3c; }
.obs-dot-yellow { background: var(--gold); animation: pulse-dot 1s infinite; }

.obs-disconnect-btn {
  margin-left: auto;
  padding: 4px 12px;
  font-size: 12px;
}

.obs-scene-grid {
  display: grid;
  /* Automatisch so viele Spalten wie reinpassen, mindestens 120px breit */
  grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr));
  gap: 7px;
  margin-top: 4px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Wrapper für Szene + Stern */
.obs-scene-item {
  position: relative;
}

.obs-scene-btn {
  width: 100%;
  min-width: 0;
  padding: 12px 32px 12px 12px; /* rechts Platz für Stern */
  min-height: 48px;
  background: var(--bg-3);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-3);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  touch-action: manipulation;
  box-sizing: border-box;
}

/* Inaktive Szene — bewusst grau */
.obs-scene-btn.obs-scene-inactive {
  background: var(--bg-3);
  border-color: transparent;
  color: var(--text-3);
}

.obs-scene-btn.obs-scene-inactive:hover  { background: var(--bg-2); border-color: var(--border); color: var(--text-2); }
.obs-scene-btn:active { transform: scale(0.96); }

/* Aktive Szene — knallig grün */
.obs-scene-btn.obs-scene-active {
  background: rgba(46, 204, 113, 0.18);
  border-color: #2ecc71;
  color: #fff;
  font-weight: 800;
  text-shadow: 0 0 12px rgba(46,204,113,0.4);
}

/* Favorit-Akzent — goldener linker Rand */
.obs-scene-btn.obs-scene-fav {
  border-left-color: var(--gold) !important;
  border-left-width: 3px;
}

/* Stern-Button */
.obs-scene-star {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 16px;
  line-height: 1;
  padding: 8px;
  cursor: pointer;
  color: var(--text-3);
  opacity: 0.45;
  transition: opacity 0.15s, transform 0.15s, color 0.15s;
  touch-action: manipulation;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.obs-scene-item:hover .obs-scene-star { opacity: 1; }

.obs-scene-star:hover  { transform: translateY(-50%) scale(1.2); }
.obs-scene-star:active { transform: translateY(-50%) scale(0.88); opacity: 1; }

.obs-scene-star.obs-star-on {
  color: var(--gold);
  opacity: 1;
}

.obs-scene-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0;
}

.obs-scene-divider::before,
.obs-scene-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.obs-scene-divider span {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  white-space: nowrap;
}

.obs-https-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  margin-top: 8px;
  border-radius: var(--radius-md);
  background: rgba(242,169,0,0.1);
  border: 1px solid rgba(242,169,0,0.35);
  font-size: 12px;
  font-weight: 500;
  color: var(--gold);
  line-height: 1.5;
}

.obs-https-warning svg {
  flex-shrink: 0;
  margin-top: 1px;
  fill: var(--gold);
}

/* ---- Cloudflare Tunnel hint ---- */
.obs-cloud-hint {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.obs-cloud-hint summary {
  padding: 12px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}
.obs-cloud-hint summary::-webkit-details-marker { display: none; }
.obs-cloud-hint summary:hover { color: var(--text-1); }
.obs-cloud-hint[open] summary {
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
}

.obs-cloud-hint-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.55;
}

.obs-cloud-hint-body p { color: var(--text-2); }
.obs-cloud-hint-body p strong { color: var(--text-1); }

.obs-cloud-hint-body code {
  display: block;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-family: 'Consolas', monospace;
  font-size: 12px;
  color: var(--teal);
  word-break: break-all;
  user-select: all;
}

.obs-dl-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--purple);
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
}
.obs-dl-link:hover { text-decoration: underline; }

.obs-hint-note {
  font-size: 11px !important;
  color: var(--text-3) !important;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 2px;
}

/* =============================================
   VIEW MODES — Vollbild Events / Vollbild Chat
   ============================================= */

/* Events-only: Events füllt den ganzen Inhaltsbereich */
#dashboard.view-events-only #events-panel {
  height: auto !important;
  max-height: none !important;
  flex: 1 !important;
}
#dashboard.view-events-only #divider,
#dashboard.view-events-only #chat-panel,
#dashboard.view-events-only #chat-input-area,
#dashboard.view-events-only #emote-picker,
#dashboard.view-events-only #rewards-panel {
  display: none !important;
}

/* Chat-only: Chat füllt den ganzen Inhaltsbereich */
#dashboard.view-chat-only #events-panel,
#dashboard.view-chat-only #divider {
  display: none !important;
}
#dashboard.view-chat-only #chat-panel {
  flex: 1 !important;
}


/* =============================================
   OUTDOOR MODE
   ============================================= */

/* ---- Farb-Overrides ---- */
body.outdoor-mode {
  --bg-0:     #000000;   /* Reines Schwarz – spart OLED-Akku */
  --bg-1:     #0c0c0c;
  --bg-2:     #141414;
  --bg-3:     #1e1e1e;
  --border:   #424242;
  --text-1:   #ffffff;
  --text-2:   #e8e8e8;
  --text-3:   #aaaaaa;
  --purple:   #be80ff;   /* Heller für Sonnen-Lesbarkeit */
  --teal:     #00f0d0;
  --gold:     #ffc200;
  --orange:   #ff7c1a;
}

/* ---- Alle Animationen & Transitions deaktivieren ---- */
body.outdoor-mode *,
body.outdoor-mode *::before,
body.outdoor-mode *::after {
  animation-duration:       0.01ms !important;
  animation-iteration-count: 1     !important;
  transition-duration:      0.01ms !important;
  transition-delay:         0ms    !important;
}

/* ---- Größere Schrift & Buttons ---- */
body.outdoor-mode .btn        { min-height: 52px; font-size: 16px; font-weight: 700; }
body.outdoor-mode .btn-large  { min-height: 56px; font-size: 17px; }
body.outdoor-mode .icon-btn   { min-width: 52px; min-height: 52px; }
body.outdoor-mode .chatmode-btn { min-height: 46px; padding: 8px 12px; font-size: 18px; }
body.outdoor-mode #chat-send-btn  { width: 52px; height: 52px; }
body.outdoor-mode #chat-input     { min-height: 52px; font-size: 17px; }
body.outdoor-mode .stream-tab-btn { min-height: 56px; font-size: 15px; font-weight: 800; padding: 16px 8px; }
body.outdoor-mode .obs-scene-btn  { min-height: 56px; font-size: 14px; font-weight: 700; }

/* ---- Chat-Lesbarkeit ---- */
body.outdoor-mode .chat-message  { font-size: 17px; line-height: 1.65; }
body.outdoor-mode .chat-username { font-weight: 900; }
body.outdoor-mode .event-title   { font-size: 18px; font-weight: 900; }
body.outdoor-mode .event-detail  { font-size: 15px; }

/* ---- Event Cards: kein Schatten, dickerer Rand ---- */
body.outdoor-mode .event-card {
  box-shadow: none;
  border-left-width: 5px;
}

/* ---- OBS Aktiv-Szene: volle Farbe statt halbtransparent ---- */
body.outdoor-mode .obs-scene-btn.obs-scene-active {
  background: #2ecc71;
  color: #000;
  font-weight: 900;
  border-color: #2ecc71;
  text-shadow: none;
}

/* ---- Chatmode-Active: voller Kontrast ---- */
body.outdoor-mode .chatmode-btn.active {
  background: var(--purple);
  color: #000;
}

/* outdoor-mode: FAB-Indikator statt Header-Badge – siehe FAB-Sektion */

/* Kein Box-Shadow überall im Outdoor-Mode */
body.outdoor-mode .mod-menu-card,
body.outdoor-mode .toast,
body.outdoor-mode .setup-box,
body.outdoor-mode .login-box { box-shadow: none; }

/* Stärkere Borders = besser lesbar in der Sonne */
body.outdoor-mode .setting-row,
body.outdoor-mode .event-card,
body.outdoor-mode .obs-scene-btn.obs-scene-inactive { border-color: var(--border); }

/* =============================================
   MOBILE / TOUCH OPTIMIERUNGEN
   pointer: coarse = Touchscreen (Finger, kein Maus-Cursor)
   ============================================= */

/* =============================================
   PANEL HEADER BUTTONS (kompakt, für Events/Chat Header)
   ============================================= */

.panel-btn {
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px;
  min-width: 34px;
  min-height: 34px;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  touch-action: manipulation;
  flex-shrink: 0;
}
.panel-btn:hover  { background: var(--bg-2); color: var(--text-1); }
.panel-btn:active { background: var(--bg-3); transform: scale(0.88); }
.panel-btn.active { color: var(--purple); background: rgba(145,71,255,0.12); }

/* =============================================
   EVENTS FILTER BAR
   ============================================= */

#events-filter-bar {
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  animation: slide-down 0.18s ease;
}
#events-filter-bar .event-filter-grid {
  margin-top: 0;
}

/* =============================================
   CHAT INLINE BARS (Keyword / AI)
   ============================================= */

#chat-keyword-bar,
#chat-ai-bar {
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  animation: slide-down 0.18s ease;
}

.chat-filter-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}

.chat-filter-input {
  flex: 1;
  min-width: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  color: var(--text-1);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s;
  min-height: 36px;
}
.chat-filter-input:focus { border-color: var(--purple); }
.chat-filter-input::placeholder { color: var(--text-3); }

.chat-filter-label {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-filter-range {
  flex: 1;
  accent-color: var(--purple);
  cursor: pointer;
  padding: 4px 0;
  box-sizing: content-box;
}

.chat-filter-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--purple);
  min-width: 30px;
  text-align: right;
  flex-shrink: 0;
}

/* =============================================
   QUICK-PANEL — Seitlicher Schnellzugriff
   ============================================= */

/* Backdrop: schließt Panel per Tap */
#qp-backdrop {
  position: fixed;
  inset: 0;
  z-index: 190;
  display: none;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fade-in 0.15s ease;
}
#qp-backdrop.open { display: block; }

/* Panel-Container: rechts fixiert, vertikal zentriert */
#quick-panel {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 195;
  display: flex;
  flex-direction: row;   /* body links, tab rechts */
  align-items: center;
  pointer-events: none;  /* nur aktive Kinder reagieren */
}

/* Tab-Handle — immer sichtbar (jetzt ein div mit 3 Zonen) */
#qp-tab {
  width: 22px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 10px 0 0 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  pointer-events: auto;
  flex-shrink: 0;
  position: relative;
}

/* ▲▼ Verschiebe-Buttons */
.qp-move-btn {
  width: 22px;
  height: 28px;
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.qp-move-btn:hover  { background: var(--bg-3); color: var(--text-1); }
.qp-move-btn:active { background: var(--bg-0); transform: scale(0.88); }

/* Haupt-Toggle-Button (öffnet / schließt das Panel) */
#qp-tab-toggle {
  width: 22px;
  flex: 1;
  min-height: 44px;
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  touch-action: manipulation;
  transition: background 0.15s;
}
#qp-tab-toggle:hover  { background: var(--bg-3); }
#qp-tab-toggle:active { background: var(--bg-0); }

/* Pfeil-Icon — dreht wenn offen */
#qp-arrow {
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  color: var(--text-2);
  flex-shrink: 0;
}
#quick-panel.qp-open #qp-arrow {
  transform: rotate(180deg);
}

/* Aktiv-Dot auf dem Tab */
#qp-active-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  border: 1.5px solid var(--bg-2);
  display: none;
  flex-shrink: 0;
}
#quick-panel.qp-has-active #qp-active-dot { display: block; }

/* Panel-Body — fährt von rechts rein */
#quick-panel-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 16px 0 0 16px;
  box-shadow: -4px 0 24px rgba(0,0,0,0.4);
  /* Versteckt: kein Platz, kein Klick */
  max-width: 0;
  overflow: hidden;
  padding-left: 0;
  padding-right: 0;
  gap: 0;
  opacity: 0;
  pointer-events: none;
  transition: max-width  0.3s cubic-bezier(0.4,0,0.2,1),
              opacity    0.25s ease,
              padding    0.3s cubic-bezier(0.4,0,0.2,1),
              gap        0.3s;
}
#quick-panel.qp-open #quick-panel-body {
  max-width: 90px;
  padding: 12px 8px;
  gap: 6px;
  opacity: 1;
  pointer-events: auto;
}

/* Einzelne Aktions-Buttons */
.qp-btn {
  width: 66px;
  height: 76px;
  border-radius: 14px;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  color: var(--text-1);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  touch-action: manipulation;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  flex-shrink: 0;
}
.qp-btn:hover  { background: var(--bg-3); border-color: var(--text-3); }
.qp-btn:active { transform: scale(0.90); }

/* Aktiver Zustand (Modus ist an) */
.qp-btn.qp-active {
  background: rgba(145,71,255,0.18);
  border-color: var(--purple);
}
.qp-btn.qp-active .qp-label { color: var(--purple); }

/* Outdoor aktiv: goldene Hervorhebung */
#qp-outdoor.qp-active {
  background: rgba(255,194,0,0.15);
  border-color: var(--gold);
}
#qp-outdoor.qp-active .qp-label { color: var(--gold); }

/* Outdoor-Mode: Tab bekommt goldenen Akzent */
body.outdoor-mode #qp-tab {
  border-color: rgba(255,194,0,0.5);
  box-shadow: -2px 0 10px rgba(255,194,0,0.2);
}

.qp-icon  { font-size: 24px; line-height: 1; pointer-events: none; }
.qp-label {
  font-size: 9px;
  font-weight: 800;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  pointer-events: none;
  white-space: nowrap;
}
.qp-desc {
  font-size: 7.5px;
  font-weight: 400;
  color: var(--text-3);
  opacity: 0.55;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 62px;
  pointer-events: none;
  line-height: 1.1;
  margin-top: 1px;
}
.qp-btn:hover .qp-desc { opacity: 0.85; }

/* =============================================
   QUICK-PANEL SORTIER-LISTE (Settings)
   ============================================= */

/* Mute-Button Zustand */
#events-mute-btn { color: var(--text-3); }
#events-mute-btn.sound-on { color: var(--teal); }

/* QP-Order-Item deaktiviert */
.qp-order-item.qp-order-disabled {
  opacity: 0.45;
}
.qp-order-item.qp-order-disabled .qp-order-name {
  text-decoration: line-through;
}

/* Mini-Toggle in der QP-Reihenfolgeliste */
.qp-toggle-wrap {
  display: flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.qp-toggle-wrap input { display: none; }
.qp-toggle-wrap .toggle-track {
  width: 30px;
  height: 18px;
  border-radius: 9px;
}
.qp-toggle-wrap .toggle-thumb {
  width: 12px;
  height: 12px;
  top: 2px;
  left: 2px;
}
.qp-toggle-wrap input:checked + .toggle-track {
  background: var(--purple);
  border-color: var(--purple);
}
.qp-toggle-wrap input:checked + .toggle-track .toggle-thumb {
  transform: translateX(12px);
  background: white;
}

.qp-order-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.qp-order-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.qp-order-item.qp-order-moving {
  background: var(--bg-3);
  border-color: var(--purple);
  transform: scale(1.02);
}

.qp-order-grip {
  color: var(--text-3);
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
  cursor: default;
  padding: 0 2px;
}

.qp-order-icon {
  font-size: 22px;
  flex-shrink: 0;
  line-height: 1;
}

.qp-order-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  min-width: 0;
}

.qp-order-btns {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.qp-order-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.qp-order-btn:hover  { background: var(--bg-1); color: var(--text-1); }
.qp-order-btn:active { transform: scale(0.88); }
.qp-order-btn:disabled {
  opacity: 0.25;
  pointer-events: none;
}

/* ── Eigene Module in Einstellungen ── */
.settings-modules-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.settings-modules-empty {
  font-size: 13px;
  color: var(--text-3);
  padding: 10px 0;
}
.settings-module-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 10px;
}
.settings-module-icon {
  font-size: 22px;
  flex-shrink: 0;
  line-height: 1;
}
.settings-module-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.settings-module-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
}
.settings-module-desc {
  font-size: 11px;
  color: var(--text-3);
}
.settings-module-del-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-3);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.settings-module-del-btn:hover {
  background: color-mix(in srgb, #e74c3c 12%, var(--bg-2));
  border-color: #e74c3c;
  color: #e74c3c;
}
.settings-module-del-btn:active { transform: scale(0.88); }

@media (pointer: coarse) {

  /* Header-Actions: etwas mehr Luft zwischen den Buttons */
  #header-actions { gap: 2px; }

  /* Chat-Input-Bereich etwas mehr Padding */
  #chat-input-area { padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); gap: 8px; }

  /* Emote + Rewards Buttons im Input auch 44px */
  #emote-picker-btn,
  #rewards-toggle-btn { min-width: 44px; min-height: 44px; padding: 12px; }

  /* OBS Grid: mehr Luft auf Touch-Screens, größere Tipp-Ziele */
  .obs-scene-grid { gap: 8px; }
  .obs-scene-btn  { min-height: 52px; font-size: 14px; }

  /* Mod-Menu Buttons: mehr Luft */
  .mod-menu-btn { padding: 16px 16px; font-size: 15px; }

  /* Settings Rows: etwas mehr Padding zum Antippen */
  .setting-row { padding: 16px 16px; }

  /* Scrollbar auf Touch ausblenden — sieht cleaner aus */
  * {
    scrollbar-width: none;
  }
  *::-webkit-scrollbar { display: none; }

  /* Reward Trigger Button: größer */
  .reward-trigger-btn { padding: 9px 8px; font-size: 12px; }

  /* Emote-Item: schon 44x44 aber sicherstellen */
  .emote-item { width: 48px; height: 48px; }

  /* Game-Suchergebnis: gut tappbar */
  .game-result-item { padding: 12px 14px; font-size: 14px; }

  /* AC-Item (Emote Autocomplete) */
  .ac-item { padding: 10px 14px; }

  /* Swipe-Hint weniger Platz wegnehmen */
  .swipe-hint-label { display: none; }

  /* Theme-Grid kompakter */
  .theme-grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .theme-chip { padding: 6px 2px; font-size: 10px; }
  .theme-swatch { width: 24px; height: 24px; }

  /* Divider: größeres Touch-Ziel (leichter zu greifen) */
  #divider { flex: 0 0 22px; height: 22px; }
  .divider-grip span { height: 3px; width: 26px; }

  /* Event-Cards: mehr Luft auf dem Handy */
  .event-card-inner { padding: 12px 14px; }
  #events-container { gap: 8px; padding: 10px; }
  .panel-header { padding: 10px 14px; }
}

/* =============================================
   BETA GATE
   ============================================= */

.beta-box {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px 36px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}

/* Brand / Logo */
.beta-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.relay-logo {
  filter: drop-shadow(0 0 18px rgba(145,71,255,0.45));
}

.relay-wordmark {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text-1);
  line-height: 1;
}

.relay-tagline {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}

/* Es geht in kürze los */
.beta-coming-soon {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
}

.beta-dot-pulse {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--purple);
  flex-shrink: 0;
  animation: pulse-dot 1.8s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1;   transform: scale(1);    box-shadow: 0 0 0 0 rgba(145,71,255,0.6); }
  50%       { opacity: 0.8; transform: scale(1.15); box-shadow: 0 0 0 6px rgba(145,71,255,0); }
}

/* Beta-Badge */
.beta-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--purple) 50%, transparent);
  background: color-mix(in srgb, var(--purple) 12%, transparent);
  color: var(--purple);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Passwort-Formular */
.beta-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.beta-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.beta-input-icon {
  position: absolute;
  left: 13px;
  color: var(--text-3);
  pointer-events: none;
}

.beta-input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px 12px 38px;
  color: var(--text-1);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.beta-input:focus { border-color: var(--purple); }
.beta-input.shake {
  animation: input-shake 0.35s ease;
  border-color: var(--orange);
}

@keyframes input-shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px); }
  40%     { transform: translateX(6px); }
  60%     { transform: translateX(-4px); }
  80%     { transform: translateX(4px); }
}

.beta-error {
  font-size: 12px;
  color: var(--orange);
  text-align: center;
  font-weight: 600;
}
.beta-login-hint {
  font-size: 13px;
  color: var(--text-2);
  text-align: center;
  line-height: 1.45;
  margin-bottom: 14px;
  opacity: 0.85;
}

/* =============================================
   MODULE SYSTEM
   ============================================= */

/* ── Modules Panel (Full-Screen, wie OBS-Panel) ── */
#modules-panel {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-0);
  z-index: 150;
  flex-direction: column;
  overflow: hidden;
}
#modules-panel.open { display: flex; }

#modules-panel-header,
#modules-editor-header {
  flex: 0 0 var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
}

#modules-list-page,
#modules-editor-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

#modules-panel-body,
#modules-editor-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 40px;
}

.modules-hint {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
}

/* ── Modul-Karten ── */
#module-list { display: flex; flex-direction: column; gap: 8px; }

.module-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}
.module-card-active {
  border-color: var(--purple);
  background: color-mix(in srgb, var(--purple) 8%, var(--bg-2));
}
.module-card-icon {
  font-size: 22px;
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}
.module-card-info { flex: 1; min-width: 0; }
.module-card-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.module-card-desc {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}
.module-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.module-activate-btn { white-space: nowrap; }
.module-active-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--purple);
  background: color-mix(in srgb, var(--purple) 15%, var(--bg-0));
  padding: 3px 8px;
  border-radius: 20px;
}
.module-card-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  opacity: 0.6;
  transition: opacity 0.15s;
}
.module-card-icon-btn:hover { opacity: 1; }

/* ── Editor ── */
.module-name-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 14px;
}
.module-name-input:focus { outline: none; border-color: var(--purple); }

.module-icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.module-icon-opt {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}
.module-icon-opt.active  { border-color: var(--purple); background: color-mix(in srgb, var(--purple) 15%, var(--bg-2)); }
.module-icon-opt:hover   { border-color: var(--text-3); }

/* Layout-Picker */
.module-layout-row { display: flex; gap: 10px; }
.module-layout-opt {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  transition: border-color 0.15s, background 0.15s;
}
.module-layout-opt.active {
  border-color: var(--purple);
  background: color-mix(in srgb, var(--purple) 12%, var(--bg-2));
  color: var(--purple);
}
.module-layout-preview {
  width: 52px; height: 44px;
  border-radius: 6px;
  border: 1.5px solid currentColor;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 3px;
}
.module-layout-split > div { flex: 1; background: currentColor; border-radius: 3px; opacity: 0.35; }
.module-layout-single > div { flex: 1; background: currentColor; border-radius: 3px; opacity: 0.35; }

/* Block-Picker */
.module-slots { display: flex; flex-direction: column; gap: 14px; }
.module-slot  { display: flex; flex-direction: column; gap: 6px; }
.module-slot-label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.module-block-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.module-block-opt {
  padding: 7px 12px;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.module-block-opt.active {
  border-color: var(--purple);
  background: color-mix(in srgb, var(--purple) 15%, var(--bg-2));
  color: var(--purple);
}
.module-block-opt:hover { border-color: var(--text-3); }

/* ── Dynamische Dashboard-Blöcke ── */
.module-dyn-block {
  display: flex;
  flex-direction: column;
  overflow: hidden;          /* kein horizontales Herausragen */
  min-width: 0;              /* Flex-Kind darf unter Inhalt schrumpfen */
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-1);
}
.module-block-hdr {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  background: var(--bg-2);
  min-width: 0;
}
#module-obs-body,
#module-preview-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  min-width: 0;
  box-sizing: border-box;
}
.module-block-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  padding: 32px 16px;
  gap: 4px;
}
.module-preview-img {
  width: 100%;
  border-radius: var(--radius-sm);
  display: block;
}

/* ── Quick-Picker (Bottom-Sheet) ── */
#module-quick-picker {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 600;
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  max-height: 60vh;
  display: flex;
  flex-direction: column;
}
#module-quick-picker.open { transform: translateY(0); }

.module-quick-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-1);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#module-quick-list {
  overflow-y: auto;
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
}
.module-quick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--text-1);
  font-size: 14px;
  transition: background 0.1s;
}
.module-quick-row:hover   { background: var(--bg-2); }
.module-quick-row.active  { color: var(--purple); }
.module-quick-icon        { font-size: 20px; width: 28px; text-align: center; }
.module-quick-name        { flex: 1; font-weight: 600; }
.module-quick-check       { font-size: 16px; color: var(--purple); font-weight: 800; }

/* ── Stream-Stats Block ── */
#module-stats-body {
  padding: 12px; display: flex; flex-direction: column; gap: 12px;
  overflow-y: auto; overflow-x: hidden; flex: 1; min-width: 0; box-sizing: border-box;
}
.mstat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(130px, 100%), 1fr));
  gap: 10px;
  width: 100%;
}
.mstat-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 14px 8px;
  background: var(--bg-2); border-radius: var(--radius); border: 1px solid var(--border);
  min-width: 0;
}
.mstat-icon  { font-size: 20px; }
.mstat-val   { font-size: 22px; font-weight: 800; color: var(--text-1); line-height: 1; min-width: 0; }
.mstat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); font-weight: 700; text-align: center; }
.mstat-info  { display: flex; flex-direction: column; gap: 6px; width: 100%; min-width: 0; }
.mstat-row   {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px;
  background: var(--bg-2); border-radius: var(--radius-sm);
  min-width: 0; overflow: hidden;
}
.mstat-info-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); font-weight: 700; }
.mstat-info-val   { font-size: 13px; color: var(--text-1); font-weight: 600; word-break: break-word; overflow-wrap: anywhere; }

/* ── Mod-Tools Block ── */
#module-modtools-body {
  padding: 10px 12px; overflow-y: auto; overflow-x: hidden;
  flex: 1; display: flex; flex-direction: column; gap: 2px;
  min-width: 0; box-sizing: border-box;
}
.modtool-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
  min-width: 0;
}
.modtool-row:last-child { border-bottom: none; }
.modtool-info  { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.modtool-name  { font-size: 13px; font-weight: 700; color: var(--text-1); }
.modtool-desc  { font-size: 11px; color: var(--text-3); }
.modtool-speed-row {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 6px 0 12px; border-bottom: 1px solid var(--border);
  min-width: 0;
}
.modtool-speed-btn {
  flex: 1 1 auto;               /* gleichmäßig verteilen, umbrechen wenn nötig */
  min-width: 52px;
  padding: 8px 10px; border-radius: 20px; font-size: 12px; font-weight: 700;
  text-align: center;
  background: var(--bg-2); border: 1.5px solid var(--border); color: var(--text-2); cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.15s, background 0.15s;
}
.modtool-speed-btn.active {
  border-color: var(--purple);
  background: color-mix(in srgb, var(--purple) 15%, var(--bg-2));
  color: var(--purple);
}

/* ── Clips Block ── */
#module-clips-body { flex: 1; overflow-y: auto; overflow-x: hidden; min-width: 0; }
#mclips-list { display: flex; flex-direction: column; gap: 1px; }
.mclip-card {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 12px; text-decoration: none; color: var(--text-1);
  background: var(--bg-1); border-bottom: 1px solid var(--border);
  min-width: 0; overflow: hidden;
  transition: background 0.1s;
}
.mclip-card:active { background: var(--bg-2); }
.mclip-thumb {
  width: 64px; height: 36px; object-fit: cover; border-radius: 4px; flex-shrink: 0;
}
.mclip-nothumb {
  width: 64px; height: 36px; border-radius: 4px; background: var(--bg-3);
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.mclip-info  { flex: 1; min-width: 0; overflow: hidden; }
.mclip-title {
  font-size: 12px; font-weight: 700; color: var(--text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mclip-meta  { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ── Notes Block ── */
#module-notes-body { flex: 1; display: flex; overflow: hidden; min-width: 0; }
.module-notes-textarea {
  flex: 1; width: 100%; min-width: 0; resize: none; border: none; outline: none;
  background: var(--bg-1); color: var(--text-1);
  font-size: 13px; line-height: 1.55; padding: 12px;
  font-family: inherit; box-sizing: border-box;
}
.notes-saved-hint {
  font-size: 11px; color: var(--teal); font-weight: 600;
  margin-left: auto; opacity: 0.85;
}

/* ── Notizen Quick-Panel Overlay ── */
.notes-qp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.notes-qp-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.notes-qp-card {
  width: 100%;
  max-width: 600px;
  background: var(--bg-1);
  border-radius: var(--radius) var(--radius) 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: 72vh;
  transform: translateY(40px);
  transition: transform .22s ease;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.notes-qp-overlay.open .notes-qp-card {
  transform: translateY(0);
}
.notes-qp-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.notes-qp-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  flex: 1;
}
.notes-qp-counter {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 600;
  background: var(--bg-2);
  border-radius: 10px;
  padding: 2px 8px;
  flex-shrink: 0;
}
.notes-qp-textarea {
  flex: 1;
  width: 100%;
  min-height: 160px;
  max-height: 50vh;
  resize: none;
  border: none;
  outline: none;
  background: var(--bg-1);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.6;
  padding: 12px 16px;
  font-family: inherit;
  overflow-y: auto;
}
.notes-qp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}
.notes-qp-saved-hint {
  font-size: 11px;
  color: var(--teal);
  font-weight: 600;
  opacity: 0;
  transition: opacity .3s;
  flex: 1;
}

/* ── Notizen Manager Overlay ── */
.notes-manager-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1300;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.notes-manager-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.notes-manager-card {
  width: 100%;
  max-width: 600px;
  background: var(--bg-1);
  border-radius: var(--radius) var(--radius) 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  transform: translateY(40px);
  transition: transform .22s ease;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.notes-manager-overlay.open .notes-manager-card {
  transform: translateY(0);
}
.notes-manager-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.notes-manager-title {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
}
.notes-manager-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.notes-manager-empty {
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  padding: 24px 0;
}
.notes-mgr-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 10px;
  transition: border-color .15s;
}
.notes-mgr-row.notes-mgr-active {
  border-color: var(--purple);
  background: color-mix(in srgb, var(--purple) 8%, var(--bg-2));
}
.notes-mgr-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  cursor: pointer;
}
.notes-mgr-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notes-mgr-date {
  font-size: 11px;
  color: var(--text-3);
}
.notes-mgr-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.notes-mgr-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: background .15s, color .15s;
}
.notes-mgr-btn:hover:not(:disabled) { background: var(--bg-1); color: var(--text-1); }
.notes-mgr-btn:active:not(:disabled) { transform: scale(0.88); }
.notes-mgr-btn:disabled { opacity: 0.25; pointer-events: none; }
.notes-mgr-del:hover { background: color-mix(in srgb,#e74c3c 14%,var(--bg-2)) !important; color: #e74c3c !important; border-color: #e74c3c !important; }

/* =============================================
   THEMES
   ============================================= */

/* ── Weiß-Mode ──────────────────────────────── */
body[data-theme="light"] {
  --bg-0:       #f0f2f5;
  --bg-1:       #ffffff;
  --bg-2:       #e8eaed;
  --bg-3:       #d8dade;
  --border:     #bfc3cb;
  --text-1:     #111318;
  --text-2:     #44474f;
  --text-3:     #72767e;
  --purple:     #7c2ce8;
  --purple-dim: #5a1eb8;
  --teal:       #007a6e;
  --orange:     #d44e00;
  --gold:       #b07a00;
  --blue:       #1565a8;
}

/* ── Lila Nacht ─────────────────────────────── */
body[data-theme="purple"] {
  --bg-0:       #0d0b1a;
  --bg-1:       #14102a;
  --bg-2:       #1c1838;
  --bg-3:       #251f4a;
  --border:     #352d60;
  --text-1:     #e8e0ff;
  --text-2:     #a89dcc;
  --text-3:     #6b5f99;
  --purple:     #c084fc;
  --purple-dim: #9333ea;
  --teal:       #67e8f9;
  --orange:     #fb923c;
  --gold:       #fbbf24;
  --blue:       #93c5fd;
}

/* ── Neon Grün ──────────────────────────────── */
body[data-theme="neon"] {
  --bg-0:       #020c04;
  --bg-1:       #091608;
  --bg-2:       #0e2010;
  --bg-3:       #152a16;
  --border:     #1c4020;
  --text-1:     #c8ffd4;
  --text-2:     #7ec890;
  --text-3:     #3a7a48;
  --purple:     #00e55a;
  --purple-dim: #00b844;
  --teal:       #00ffcc;
  --orange:     #ff6600;
  --gold:       #ccff00;
  --blue:       #00ccff;
}

/* ── Warmton ────────────────────────────────── */
body[data-theme="warm"] {
  --bg-0:       #100b06;
  --bg-1:       #1c1208;
  --bg-2:       #261a0c;
  --bg-3:       #322410;
  --border:     #4a3218;
  --text-1:     #ffe8cc;
  --text-2:     #c09060;
  --text-3:     #7a5030;
  --purple:     #ff9933;
  --purple-dim: #cc6600;
  --teal:       #ffcc44;
  --orange:     #ff4400;
  --gold:       #ffee00;
  --blue:       #cc9900;
}

/* Light-Theme: spezifische Overrides für Container, die eigene bg-Farben setzen */
body[data-theme="light"] .chat-message        { border-bottom-color: var(--border); }
body[data-theme="light"] .event-card          { box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
body[data-theme="light"] #header              { background: var(--bg-1); border-bottom: 1px solid var(--border); }
body[data-theme="light"] #settings-panel      { background: var(--bg-0); }
body[data-theme="light"] .setting-group       { background: var(--bg-1); border: 1px solid var(--border); }
body[data-theme="light"] .mod-menu-card       { background: var(--bg-1); border-color: var(--border); }
body[data-theme="light"] .toast               { background: #2a2a2a; color: #fff; }
body[data-theme="light"] .summary-card        { background: var(--bg-1); }

/* =============================================
   THEME-PICKER
   ============================================= */

.theme-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.theme-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 4px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  background: var(--bg-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 11px;
  color: var(--text-2);
  font-weight: 600;
  outline: none;
}
.theme-chip:hover  { border-color: var(--border); }
.theme-chip.active { border-color: var(--purple); color: var(--text-1); }

.theme-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
}

/* =============================================
   CHAT HISTORY DIVIDER
   ============================================= */

.chat-history-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  user-select: none;
  pointer-events: none;
}
.chat-history-divider::before,
.chat-history-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  opacity: 0.6;
}

/* =============================================
   REPLY BAR
   ============================================= */

#chat-reply-bar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: color-mix(in srgb, var(--purple) 12%, var(--bg-2));
  border-top: 1px solid color-mix(in srgb, var(--purple) 30%, var(--border));
  font-size: 12px;
  color: var(--text-2);
  min-height: 34px;
  flex-shrink: 0;
}
#chat-reply-bar.visible { display: flex; }

.reply-bar-icon {
  color: var(--purple);
  flex-shrink: 0;
  font-size: 14px;
  line-height: 1;
}
.reply-bar-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.reply-bar-name {
  font-weight: 700;
  color: var(--text-1);
}
.reply-bar-msg-preview {
  color: var(--text-3);
}
#reply-bar-close-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s;
}
#reply-bar-close-btn:hover { color: var(--text-1); }

/* =============================================
   STREAM-END SUMMARY OVERLAY
   ============================================= */

#stream-summary-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0,0,0,0.80);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
#stream-summary-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.summary-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 22px 22px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 90vh;
  overflow-y: auto;
}

.summary-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.summary-emoji { font-size: 38px; line-height: 1; }
.summary-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-1);
}
.summary-subtitle {
  font-size: 13px;
  color: var(--text-2);
}

.summary-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.summary-stat {
  background: var(--bg-2);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}
.summary-stat-icon { font-size: 18px; line-height: 1; }
.summary-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.2;
}
.summary-stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.summary-close-btn { align-self: stretch; }
