/* ============================================================
   DGN Chat - Core Styles (Phase 1)
   Dark-First, responsive, kein Framework-Ballast.
   ============================================================ */

:root {
  --bg:          #0a0e13;
  --panel:       #12171f;
  --panel-2:     #1a2028;
  --border:      #242d3a;
  --border-soft: #1d2530;
  --fg:          #e4ebf2;
  --fg-dim:      #aab4bf;
  --muted:       #6b7684;
  --accent:      #5cb0ff;
  --accent-2:    #7ac4ff;
  --ok:          #51d88a;
  --warn:        #ffb454;
  --err:         #ff6b6b;
  --live:        #ff3b5c;
  --dj:          #c77dff;
  --admin:       #ff6b6b;
  --mod:         #9b7fff;
  --vip:         #ffd166;

  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 8px 32px rgba(0,0,0,.5);
  --font:        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono:        "JetBrains Mono", "SF Mono", Consolas, monospace;

  /* Schriftgroessen — ueber JS per data-fontsize auf #app ueberschreibbar */
  --fs-base:     15px;
  --fs-msg:      15px;
  --fs-time:     12px;
  --fs-author:   15px;
  --fs-roomname: 17px;
}

#app[data-fontsize="small"]  { --fs-base:14px; --fs-msg:14px; --fs-time:11px; --fs-author:14px; --fs-roomname:16px; }
#app[data-fontsize="normal"] { --fs-base:15px; --fs-msg:15px; --fs-time:12px; --fs-author:15px; --fs-roomname:17px; }
#app[data-fontsize="large"]  { --fs-base:16px; --fs-msg:17px; --fs-time:13px; --fs-author:17px; --fs-roomname:19px; }
#app[data-fontsize="xlarge"] { --fs-base:17px; --fs-msg:19px; --fs-time:14px; --fs-author:19px; --fs-roomname:21px; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  font-family: var(--font);
  background: transparent;
  color: var(--fg);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Theme-Hintergrundbild (Stufe A): Admin lädt Bild im Design-Tab hoch.
   Wird live bei allen Usern angewendet via #dgn-theme-bg <div> direkt nach <body>.
   Smart-Fit-Modus: zusätzliches #dgn-theme-bg-blur als geblurter Hintergrund-Fill,
   wird per body[data-bg-mode="smart"] aktiviert (Spotify/Netflix-Stil). */
#dgn-theme-bg-blur {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  display: none;
  background-image: var(--theme-bg-image, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(40px);
  transform: scale(1.12);
  opacity: var(--theme-bg-opacity, 1);
}
#dgn-theme-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: var(--theme-bg-image, none);
  background-size: var(--theme-bg-size, cover);
  background-position: var(--theme-bg-position, center);
  background-repeat: var(--theme-bg-repeat, no-repeat);
  /* KEIN background-attachment: fixed — das Element ist selbst position:fixed,
     redundant, plus es bricht die contain-Skalierung in Chrome/Edge. */
  opacity: var(--theme-bg-opacity, 1);
  filter: blur(var(--theme-bg-blur, 0px));
}
body[data-bg-mode="smart"] #dgn-theme-bg-blur {
  display: block;
}
#dgn-theme-dim {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: rgba(0, 0, 0, var(--theme-bg-dim, 0));
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
button { font: inherit; }

/* ==================== APP LAYOUT ====================
   Named grid areas — verhindert Placement-Bugs unabhaengig von DOM-Reihenfolge
   --rp-width: Breite des rechten Panels (per JS gesetzt, default 300px)
   ============================================================ */
:root { --rp-width: 300px; }

#app {
  display: grid;
  grid-template-areas: "sidebar main";
  grid-template-columns: 260px 1fr;
  grid-template-rows: 1fr;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}
#sidebar     { grid-area: sidebar; }
#main        { grid-area: main; }
#right-panel { grid-area: rightpanel; display: none; }

/* Mit rechtem Panel */
#app.has-right-panel {
  grid-template-areas: "sidebar main rightpanel";
  grid-template-columns: 260px 1fr var(--rp-width);
}

/* Sidebar rechts — Panel erscheint dann links von Main */
#app.sidebar-right {
  grid-template-areas: "main sidebar";
  grid-template-columns: 1fr 260px;
}
#app.sidebar-right #sidebar {
  border-right: none;
  border-left: 1px solid var(--border);
}
#app.sidebar-right.has-right-panel {
  grid-template-areas: "rightpanel main sidebar";
  grid-template-columns: var(--rp-width) 1fr 260px;
}

/* Sidebar-Overlay: IMMER aus dem Grid-Flow heraus */
#sidebar-overlay { grid-area: unset !important; }

/* ==================== SIDEBAR ==================== */
#sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--dj));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; font-weight: 700;
}
.brand-name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .3px;
}

.section {
  padding: 14px 10px 6px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.section.flex-grow { flex: 1; overflow: hidden; min-height: 0; }
.section-title {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .8px;
  color: var(--muted);
  padding: 0 8px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-title .count {
  background: var(--border);
  color: var(--fg-dim);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
}

.room-list, .user-list {
  list-style: none;
  margin: 0; padding: 0;
  overflow-y: auto;
}
.user-list { flex: 1; }

.room-list li {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-dim);
  transition: background .1s;
  font-size: 13px;
}
.room-list li:hover { background: var(--panel-2); color: var(--fg); }
.room-list li.active {
  background: rgba(92, 176, 255, .12);
  color: var(--accent);
  font-weight: 600;
}
.room-list li::before { content: "#"; color: var(--muted); }
.room-list li.has-password::before { content: "🔒"; }
.room-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-item-count {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
  border: 1px solid transparent;
  transition: all .15s;
}
.room-item-count.active {
  background: rgba(81, 216, 138, .15);
  color: var(--ok);
  border-color: rgba(81, 216, 138, .35);
}
.room-list li.active .room-item-count.active {
  background: rgba(92, 176, 255, .18);
  color: var(--accent);
  border-color: rgba(92, 176, 255, .45);
}

.user-list li {
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
}
.user-list li:hover { background: var(--panel-2); }

.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
  position: relative;
}
.user-avatar::after {
  content: "";
  position: absolute;
  bottom: -1px; right: -1px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--muted);
  border: 2px solid var(--panel);
}
.user-avatar.status-online::after  { background: var(--ok); }
.user-avatar.status-afk::after     { background: var(--warn); }
.user-avatar.status-away::after    { background: var(--muted); }
.user-avatar.status-dnd::after     { background: var(--err); }
.user-avatar.status-live_dj::after {
  background: var(--live);
  box-shadow: 0 0 0 0 rgba(255,59,92,.7);
  animation: pulseLive 1.5s infinite;
}
@keyframes pulseLive {
  0%   { box-shadow: 0 0 0 0 rgba(255,59,92,.7); }
  70%  { box-shadow: 0 0 0 6px rgba(255,59,92,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,59,92,0); }
}

.user-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* Klick auf Name → Name ins Eingabefeld */
  cursor: text;
  transition: text-decoration .1s;
}
.user-name:hover {
  text-decoration: underline;
}
.user-badge {
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.user-badge.live     { background: var(--live);  color: #fff; animation: pulseBadge 1.8s infinite; }
.user-badge.dj       { background: var(--dj);    color: #fff; }
.user-badge.admin    { background: var(--admin); color: #fff; }
.user-badge.mod      { background: var(--mod);   color: #fff; }
.user-badge.vip      { background: var(--vip);   color: #000; }
.user-badge.invisible{ background: transparent; padding: 0; font-size: 12px; }
@keyframes pulseBadge {
  0%, 100% { opacity: 1; }
  50%      { opacity: .55; }
}

/* ME (unten in Sidebar) */
.me {
  padding: 12px 14px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-2);
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}
.me-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff;
}
.me-info { flex: 1; min-width: 0; }
.me-name {
  font-weight: 600;
  font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.me-coins {
  margin-top: 2px;
  color: #fbbf24;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.me-role {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
}
.me-role.role-superadmin, .me-role.role-admin { color: var(--admin); }
.me-role.role-mod { color: var(--mod); }
.me-role.role-dj  { color: var(--dj); }
.me-role.role-vip { color: var(--vip); }

/* Sidebar Action-Buttons (DJ-Panel, Wunschbox) */
.sidebar-actions {
  padding: 8px 14px 0;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}

/* Update-Banner in der Sidebar (für Admin/Superadmin sichtbar wenn Update verfügbar) */
.update-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: linear-gradient(135deg, rgba(255,180,84,.18), rgba(255,180,84,.06));
  border: 1px solid rgba(255,180,84,.45);
  border-radius: 8px;
  color: var(--fg);
  text-decoration: none;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
  animation: updateBannerPulse 2.5s ease-in-out infinite;
}
.update-banner:hover {
  background: linear-gradient(135deg, rgba(255,180,84,.28), rgba(255,180,84,.12));
  border-color: var(--warn);
  transform: translateY(-1px);
  color: var(--fg);
}
.update-banner.critical {
  background: linear-gradient(135deg, rgba(255,107,107,.2), rgba(255,107,107,.06));
  border-color: rgba(255,107,107,.55);
  animation: updateBannerPulseCrit 1.5s ease-in-out infinite;
}
.update-banner-icon {
  font-size: 20px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 4px rgba(255,180,84,.5));
}
.update-banner-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.update-banner-title {
  font-weight: 700;
  font-size: 12px;
  color: var(--warn);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.update-banner.critical .update-banner-title { color: var(--err); }
.update-banner-version {
  font-size: 10.5px;
  color: var(--fg-dim);
  font-family: var(--mono);
}
.update-banner-arrow {
  font-size: 14px;
  color: var(--fg-dim);
  flex-shrink: 0;
  transition: transform .15s;
}
.update-banner:hover .update-banner-arrow {
  transform: translateX(3px);
  color: var(--fg);
}
@keyframes updateBannerPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,180,84,0); }
  50%      { box-shadow: 0 0 0 3px rgba(255,180,84,.15); }
}
@keyframes updateBannerPulseCrit {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,107,107,0); }
  50%      { box-shadow: 0 0 0 4px rgba(255,107,107,.25); }
}
.sidebar-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.sidebar-action-btn:hover {
  transform: translateY(-1px);
}
.sidebar-action-btn.dj-btn {
  background: linear-gradient(135deg, rgba(255,59,92,.10), rgba(199,125,255,.08));
  border-color: rgba(255,59,92,.3);
  color: var(--live);
}
.sidebar-action-btn.dj-btn:hover {
  background: var(--live);
  color: #fff;
  border-color: var(--live);
}
.sidebar-action-btn.wish-btn {
  background: linear-gradient(135deg, rgba(255,209,102,.08), rgba(255,180,84,.08));
  border-color: rgba(255,209,102,.3);
  color: var(--vip);
}
.sidebar-action-btn.wish-btn:hover:not(:disabled) {
  background: var(--vip);
  color: #000;
  border-color: var(--vip);
}
a.sidebar-action-btn { text-decoration: none; }
.sidebar-action-btn.website-btn { color: var(--accent); }
.sidebar-action-btn.website-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.sidebar-action-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.sidebar-action-btn:disabled:hover {
  transform: none;
}
.sidebar-action-icon { font-size: 16px; line-height: 1; }
.sidebar-action-label { flex: 1; text-align: left; }

/* Commands-Picker */
.commands-picker {
  position: fixed;
  z-index: 250;
  width: 380px;
  max-height: 420px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  animation: popIn .15s ease-out;
}
.commands-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.commands-header-title { font-weight: 700; font-size: 14px; }
.commands-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.cmd-group-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin: 8px 8px 4px;
  font-weight: 600;
}
.cmd-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .1s;
}
.cmd-item:hover { background: var(--panel-2); }
.cmd-item-icon { font-size: 20px; line-height: 1; padding-top: 2px; }
.cmd-item-info { flex: 1; }
.cmd-item-name { font-weight: 700; font-size: 13px; color: var(--accent); font-family: var(--mono); }
.cmd-item-desc { font-size: 11px; color: var(--fg-dim); line-height: 1.4; margin-top: 2px; }
.cmd-item-role { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; margin-top: 2px; }
.cmd-item.disabled { opacity: .35; cursor: not-allowed; }

/* PN-Button in Sidebar — gross und beschriftet */
.me-pm {
  padding: 10px 14px;
  border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}
.me-pm-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(92,176,255,.10), rgba(199,125,255,.08));
  border: 1px solid rgba(92,176,255,.3);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.me-pm-btn:hover {
  background: var(--accent);
  color: #0a0e13;
  border-color: var(--accent);
  transform: translateY(-1px);
}
.me-pm-icon {
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}
.me-pm-label {
  flex: 1;
  text-align: left;
  line-height: 24px;
}
.pm-badge {
  background: var(--err);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  animation: pmPulse 2s infinite;
}
@keyframes pmPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Sound Toggle */
.me-sound {
  color: var(--muted);
  font-size: 16px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  cursor: pointer;
}
.me-sound:hover { color: var(--accent); background: rgba(92,176,255,.12); }
.me-sound.muted { opacity: .4; }

/* PN-Panel Overlay */
.pm-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 480px;
  max-width: 95vw;
  max-height: 80vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 300;
  display: flex;
  flex-direction: column;
  animation: pmFadeIn .15s ease-out;
}
@keyframes pmFadeIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.96); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.pm-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: grab;
  user-select: none;
}
.pm-panel-header:active { cursor: grabbing; }
.pm-panel-title {
  font-size: 16px;
  font-weight: 700;
}
.pm-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.pm-close:hover { color: var(--fg); background: var(--panel-2); }
.pm-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 0;
  max-height: 50vh;
}
.pm-panel-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}
.pm-panel-footer input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 20px;
  font-size: 14px;
  outline: none;
}
.pm-panel-footer input:focus { border-color: var(--accent); }
.pm-panel-footer button {
  padding: 10px 18px;
  background: var(--accent);
  color: #0a0e13;
  border: none;
  border-radius: 20px;
  font-weight: 700;
  cursor: pointer;
}

/* Konversations-Liste */
.pm-conv {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  transition: background .1s;
}
.pm-conv:hover { background: var(--panel-2); }
.pm-conv.has-unread { background: rgba(92,176,255,.06); }
.pm-conv-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 14px;
  flex-shrink: 0;
}
.pm-conv-info { flex: 1; min-width: 0; }
.pm-conv-name { font-weight: 600; font-size: 13px; }
.pm-conv-preview {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pm-conv-meta {
  text-align: right;
  flex-shrink: 0;
}
.pm-conv-time { font-size: 10px; color: var(--muted); }
.pm-conv-delete {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity .15s, color .15s;
}
.pm-conv:hover .pm-conv-delete { opacity: 1; }
.pm-conv-delete:hover { color: var(--err); background: rgba(255,107,107,.1); }

.pm-conv-badge {
  background: var(--accent);
  color: #0a0e13;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  margin-top: 4px;
  display: inline-block;
}

/* Einzelne PM-Nachrichten */
.pm-msg {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.pm-msg.mine { flex-direction: row-reverse; }
.pm-msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}
.pm-msg:not(.mine) .pm-msg-bubble {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.pm-msg.mine .pm-msg-bubble {
  background: var(--accent);
  color: #0a0e13;
  border-bottom-right-radius: 4px;
}
.pm-msg-time {
  font-size: 10px;
  color: var(--muted);
  align-self: flex-end;
  padding-bottom: 2px;
}
.pm-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.me-admin,
.me-logout {
  color: var(--fg-dim);
  font-size: 18px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  flex-shrink: 0;
  line-height: 1;
  transition: all .15s;
}
.me-admin:hover { color: var(--accent); background: rgba(92,176,255,.12); }
.me-logout { font-size: 16px; }
.me-logout:hover { color: var(--err); background: rgba(255,107,107,.12); }

/* Mobile: Buttons in der me-Leiste etwas kompakter aber voll sichtbar */
@media (max-width: 768px) {
  .me { gap: 6px; padding: 10px 12px; }
  .me-avatar { width: 32px; height: 32px; }
  .me-sound,
  .me-admin,
  .me-logout {
    padding: 5px 7px;
    min-width: 30px;
    min-height: 30px;
  }
}

/* ==================== MAIN CHAT AREA ==================== */
#main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

#chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.header-main { flex: 1; min-width: 160px; }

/* Radio-Info (Now-Playing, Schedule, Listeners) */
.radio-info {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(255,59,92,.08), rgba(199,125,255,.08));
  border: 1px solid rgba(255,59,92,.25);
  border-radius: var(--radius-sm);
  font-size: 12px;
  flex: 1 0 100%;
  order: 3;
  margin-top: 8px;
}
.radio-part { display: flex; align-items: center; gap: 6px; }
.radio-label { color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-size: 10px; font-weight: 700; }
.radio-dj    { font-weight: 700; }
.radio-show  { color: var(--fg); }
.radio-current .radio-label { color: var(--live); }

/* Force Off-Air Button in ON AIR Bar (nur Mod/Admin sichtbar) */
.radio-force-off {
  margin-left: 10px;
  padding: 3px 9px;
  background: rgba(255, 107, 107, .15);
  border: 1px solid rgba(255, 107, 107, .5);
  color: var(--err);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.radio-force-off:hover {
  background: var(--err);
  color: #fff;
  border-color: var(--err);
}
@media (max-width: 768px) {
  .radio-force-off {
    padding: 2px 6px !important;
    font-size: 10px !important;
    margin-left: 4px;
  }
}
.radio-live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--live);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(255,59,92,.7);
  animation: pulseLive 1.5s infinite;
}
.radio-next { color: var(--fg-dim); }
.radio-np   { color: var(--accent); }
.radio-listeners { color: var(--fg-dim); }
.room-name { font-size: var(--fs-roomname); font-weight: 700; }
.room-name::before { content: "# "; color: var(--muted); font-weight: 400; }
.room-topic { font-size: 12px; color: var(--muted); margin-top: 2px; }
.header-actions { display: flex; gap: 6px; }

.icon-btn {
  min-width: 36px; height: 36px;
  padding: 0 8px;
  background: transparent;
  color: var(--fg-dim);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: background .1s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--fg); }

/* Action-Buttons im Header (DJ-Panel, Wunsch) — mit Label, groesser */
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
  white-space: nowrap;
}
.action-btn:hover {
  background: var(--accent);
  color: #0a0e13;
  border-color: var(--accent);
  transform: translateY(-1px);
}
.action-btn-icon { font-size: 15px; line-height: 1; }
.action-btn-label { font-size: 13px; }
#btn-dj-panel {
  background: linear-gradient(135deg, rgba(255,59,92,.12), rgba(199,125,255,.12));
  border-color: rgba(255,59,92,.4);
  color: var(--live);
}
#btn-dj-panel:hover {
  background: var(--live);
  color: #fff;
  border-color: var(--live);
}
#btn-wish {
  background: linear-gradient(135deg, rgba(255,209,102,.10), rgba(255,180,84,.10));
  border-color: rgba(255,209,102,.4);
  color: var(--vip);
}
#btn-wish:hover:not(:disabled) {
  background: var(--vip);
  color: #000;
  border-color: var(--vip);
}
.action-btn.btn-disabled {
  opacity: .4;
  cursor: not-allowed;
}
.action-btn.btn-disabled:hover {
  transform: none;
  background: inherit;
}

/* Tool-Buttons im Send-Form (Smiley, A-, A+) */
.send-tools {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}
.tool-btn {
  width: 40px; height: 40px;
  background: var(--panel-2);
  color: var(--fg-dim);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  transition: all .1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.tool-btn:hover {
  background: var(--accent);
  color: #0a0e13;
  border-color: var(--accent);
  transform: scale(1.05);
}
#btn-smiley { font-size: 18px; }
#btn-font-up, #btn-font-down {
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: -.5px;
}

/* ==================== MESSAGES ==================== */
.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px;
  overscroll-behavior: contain;
}
.chat-messages::-webkit-scrollbar { width: 10px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
.chat-messages::-webkit-scrollbar-thumb:hover { background: var(--border-soft); }

.msg {
  display: flex;
  flex-wrap: wrap;            /* damit Reactions in eigene Zeile umbrechen */
  gap: 10px;
  padding: 5px 0;
  font-size: var(--fs-msg);
  line-height: 1.55;
  word-wrap: break-word;
}
/* Nick-Highlight: nur SICHTBAR FÜR DEN ERWÄHNTEN (rein client-seitig per JS) */
.msg.mentioned {
  background: linear-gradient(90deg, rgba(255,180,84,.18), rgba(255,180,84,.04) 60%, transparent);
  border-left: 3px solid var(--warn, #ffb454);
  padding-left: 8px;
  margin-left: -11px;          /* -3px Border, -8px Padding -> Layout-bündig */
  border-radius: 2px;
  animation: mentionPulse 1.2s ease-out 1;
}
@keyframes mentionPulse {
  0%   { box-shadow: 0 0 0 0   rgba(255,180,84,.5); }
  100% { box-shadow: 0 0 0 12px rgba(255,180,84,0);  }
}
.msg-time {
  color: var(--muted);
  font-size: var(--fs-time);
  font-family: var(--mono);
  min-width: 56px;
  padding-top: 3px;
  user-select: none;
}
.msg-author {
  font-weight: 600;
  flex-shrink: 0;
}
.msg-body {
  flex: 1;
  word-break: break-word;
}
.msg-body .msg-author { margin-right: 6px; }
.msg-body .msg-author::after { content: ":"; color: var(--muted); font-weight: 400; }

/* Action (/me) + Dice + Coin — gleiche Darstellung */
.msg.action .msg-body,
.msg.dice   .msg-body,
.msg.coin   .msg-body,
.msg.bet    .msg-body { color: var(--fg-dim); font-style: italic; }

.msg.action .msg-body .msg-author::after,
.msg.dice   .msg-body .msg-author::after,
.msg.coin   .msg-body .msg-author::after,
.msg.bet    .msg-body .msg-author::after { content: ""; }

.msg.action .msg-body::before { content: "* ";  color: var(--muted); }
.msg.dice   .msg-body::before { content: "🎲 "; }
.msg.coin   .msg-body::before { content: "🪙 "; }
.msg.bet    .msg-body::before { content: "🪙 "; }

/* Whisper */
.msg.whisper { background: rgba(199, 125, 255, .06); border-left: 3px solid var(--dj); padding-left: 12px; margin-left: -12px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.msg.whisper .msg-body::before { content: "🔒 "; }

/* System */
.msg.system .msg-body {
  color: var(--muted);
  font-style: italic;
  font-size: 12px;
}
.msg.system .msg-body::before { content: "— "; }

/* Wish — hervorgehobene Wunsch-Nachricht, NUR der DJ sieht das */
.msg.wish {
  background: linear-gradient(90deg, rgba(255,209,102,.10), transparent);
  border-left: 3px solid var(--vip);
  padding: 8px 12px;
  margin: 4px -12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.msg.wish .msg-body {
  color: var(--fg);
  font-size: var(--fs-msg);
  font-style: normal;
}
.msg.wish .msg-body::before { content: "💌 "; font-style: normal; }

/* Bot — Chatbot-Antwort, gut lesbar (normale Schrift), dezent hervorgehoben, bleibt stehen */
.msg.bot {
  background: linear-gradient(90deg, rgba(124,160,255,.09), transparent);
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  margin: 4px -12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.msg.bot .msg-body {
  color: var(--fg);
  font-size: var(--fs-msg);
  font-style: normal;
}
.msg.bot .msg-body::before { content: "🤖 "; }
.msg.bot .msg-bot-name { font-weight: 700; color: var(--accent); margin-right: 4px; }

/* ==================== INTERAKTIONS-WIDGETS (Timer, Poll, Shoutout, Raffle) ==================== */
.msg-widget {
  margin: 10px 0;
  padding: 16px 20px;
  border-radius: var(--radius);
  text-align: center;
  animation: widgetPop .3s ease-out;
}
@keyframes widgetPop {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}

/* Timer */
.msg-widget.widget-timer {
  background: linear-gradient(135deg, rgba(255,180,84,.12), rgba(255,107,107,.10));
  border: 1px solid rgba(255,180,84,.4);
}
.timer-icon { font-size: 28px; margin-bottom: 6px; }
.timer-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.timer-countdown {
  font-size: 48px;
  font-weight: 800;
  color: var(--warn);
  font-family: var(--mono);
  line-height: 1.1;
  margin: 8px 0;
}
.timer-countdown.urgent { color: var(--err); animation: timerPulse .5s infinite; }
.timer-countdown.done { color: var(--ok); font-size: 24px; }
@keyframes timerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.timer-by { font-size: 11px; color: var(--muted); }

/* Poll */
.msg-widget.widget-poll {
  background: linear-gradient(135deg, rgba(92,176,255,.12), rgba(199,125,255,.08));
  border: 1px solid rgba(92,176,255,.4);
}
.poll-icon { font-size: 28px; margin-bottom: 6px; }
.poll-question { font-size: 18px; font-weight: 700; color: var(--fg); margin: 8px 0; }
.poll-by { font-size: 11px; color: var(--muted); }

/* Shoutout */
.msg-widget.widget-shoutout {
  background: linear-gradient(135deg, rgba(81,216,138,.12), rgba(92,176,255,.08));
  border: 1px solid rgba(81,216,138,.4);
}
.shoutout-icon { font-size: 36px; margin-bottom: 4px; }
.shoutout-name { font-size: 22px; font-weight: 800; color: var(--ok); }
.shoutout-by { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Entry-Bild beim Join */
.msg-widget.widget-entry {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(255,140,0,.12), rgba(255,107,107,.08));
  border: 1px solid rgba(255,140,0,.4);
  text-align: left;
  padding: 12px 16px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.msg-widget.widget-entry:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255,140,0,.2);
}
.entry-img {
  max-height: 110px;
  max-width: 180px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.1);
}
.entry-icon {
  font-size: 48px;
  flex-shrink: 0;
  width: 80px;
  text-align: center;
}
.entry-text {
  flex: 1;
  min-width: 0;
}
.entry-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}
.entry-name {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
  margin-top: 2px;
  word-break: break-word;
}
@media (max-width: 640px) {
  .msg-widget.widget-entry { gap: 10px; padding: 10px 12px; }
  .entry-img   { max-height: 70px; max-width: 100px; }
  .entry-icon  { font-size: 32px; width: 50px; }
  .entry-name  { font-size: 16px; }
  .entry-label { font-size: 9px; }
}

/* Entry-Bild Opt-Out Toggle im User-Popup */
.popup-entry-img {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.entry-img-toggle-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all .1s;
  text-align: left;
}
.entry-img-toggle-btn:hover { background: var(--border); }
.entry-img-toggle-btn.active {
  background: rgba(255,140,0,.15);
  border-color: #ff8c00;
  color: #fbbf24;
}
.entry-img-toggle-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}
.entry-img-toggle-label {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}
.entry-img-toggle-hint {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.3;
  padding: 0 4px;
}

/* Nick-Highlight Sound-Toggle im User-Popup */
.popup-mention {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mention-toggle-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all .1s;
  text-align: left;
}
.mention-toggle-btn:hover { background: var(--border); }
.mention-toggle-btn.active {
  background: rgba(255,180,84,.15);
  border-color: var(--warn, #ffb454);
  color: #fbbf24;
}
.mention-toggle-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}
.mention-toggle-label {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}
.mention-toggle-hint {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.3;
  padding: 0 4px;
}

/* Raffle */
.msg-widget.widget-raffle {
  background: linear-gradient(135deg, rgba(255,209,102,.15), rgba(255,59,92,.08));
  border: 1px solid rgba(255,209,102,.4);
}
.raffle-icon { font-size: 36px; margin-bottom: 4px; }
.raffle-winner { font-size: 24px; font-weight: 800; color: var(--vip); }
.raffle-by { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Welcome Box (optionale Raum-Begruessung, nur beim Betreten) */
.welcome-box {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(92,176,255,.10), rgba(199,125,255,.08));
  border: 1px solid rgba(92,176,255,.3);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 6px 0 18px;
  animation: welcomeFadeIn .3s ease-out;
}
@keyframes welcomeFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.welcome-box-icon {
  font-size: 30px;
  flex-shrink: 0;
  line-height: 1;
}
.welcome-box-content {
  flex: 1;
  font-size: var(--fs-msg);
  line-height: 1.6;
  color: var(--fg);
}
.welcome-box-content strong { color: var(--accent); }
.welcome-box-content em     { color: var(--fg-dim); }
.welcome-box-content .smiley { max-height: 48px; vertical-align: middle; }
.welcome-box-content a { color: var(--accent); }

/* Typing Indicator */
.typing-indicator {
  height: 20px;
  padding: 0 20px;
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

/* ==================== SEND FORM ==================== */
.send-form {
  display: flex;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
  align-items: center;
}
#send-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 22px;
  outline: none;
  font-size: var(--fs-msg);
  transition: border-color .1s;
}
#send-input:focus { border-color: var(--accent); }
.send-btn {
  padding: 12px 20px;
  background: var(--accent);
  color: #0a0e13;
  border: none;
  border-radius: 22px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .1s, background .1s;
}
.send-btn:hover { background: var(--accent-2); }
.send-btn:active { transform: scale(.97); }

/* ==================== AUTH PAGE ==================== */
body.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at top, #161d2a, var(--bg));
  padding: 20px;
}
.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-logo {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--accent), var(--dj));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff; font-weight: 700;
}
.auth-card h1 { margin: 0; font-size: 22px; letter-spacing: .3px; }
.auth-sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.auth-form { text-align: left; }
.auth-form label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin: 14px 0 4px;
}
.auth-form input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
}
.auth-form input:focus { border-color: var(--accent); }
.auth-btn {
  width: 100%;
  padding: 12px;
  margin-top: 20px;
  background: var(--accent);
  color: #0a0e13;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.auth-btn:hover { background: var(--accent-2); }
.auth-err {
  background: rgba(255,107,107,.1);
  border: 1px solid var(--err);
  color: var(--err);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 14px;
}
.auth-switch {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
}
.auth-tabs {
  display: flex;
  gap: 4px;
  margin: 18px 0 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: 8px 10px;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: background .1s, color .1s;
}
.auth-tab:hover { color: var(--fg); }
.auth-tab.active {
  background: var(--panel-2);
  color: var(--accent);
}
.auth-hint {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(92,176,255,.06);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 11px;
  color: var(--fg-dim);
  line-height: 1.5;
}

/* Guest-Badge in User-Liste */
.user-badge.guest {
  background: var(--muted);
  color: var(--panel);
}

/* ==================== PHASE 2: BBCODE + INLINE ==================== */
.msg-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
}
.msg-body a:hover { color: var(--accent-2); border-bottom-style: solid; }

.msg-body .bb-s { text-decoration: line-through; opacity: .7; }
.msg-body .bb-code {
  font-family: var(--mono);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  border: 1px solid var(--border);
}
.msg-body .bb-quote {
  margin: 4px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--accent);
  background: rgba(92,176,255,.06);
  color: var(--fg-dim);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.msg-body .bb-quote-cite {
  display: block;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: none;
  margin-bottom: 3px;
  opacity: .85;
}
.msg-body .bb-quote-cite::before { content: '💬 '; opacity: .7; }

/* ==================== MESSAGE ACTION-BAR (Quote + React) ==================== */
/* Buttons direkt am Textende (inline), zart transparent bis hover */
.msg-actions {
  display: inline-flex;
  gap: 4px;
  margin-left: 10px;
  vertical-align: middle;
  opacity: .35;
  transition: opacity .15s;
}
.msg:hover .msg-actions,
.msg:focus-within .msg-actions {
  opacity: 1;
}
.msg-act-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--fg);
  cursor: pointer;
  font-size: 16px;
  padding: 3px 9px;
  border-radius: 6px;
  line-height: 1.2;
  transition: all .12s;
}
.msg-act-btn:hover {
  background: var(--accent);
  color: #0a0e13;
  border-color: var(--accent);
  transform: scale(1.1);
}

/* Mobile: Action-Bar immer voll sichtbar + bigger Touch-Targets */
@media (max-width: 768px) {
  .msg-actions { opacity: 1; margin-left: 6px; }
  .msg-act-btn { font-size: 17px; padding: 4px 10px; }
}

/* ==================== REACTIONS ==================== */
.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 2px 0 2px;
  padding-left: 66px;          /* Einrueckung wie msg-body (56px msg-time + 10px gap) */
  flex-basis: 100%;            /* eigene Zeile innerhalb des wrappenden .msg flex-Containers */
  max-width: 100%;
}
.reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all .12s;
  color: var(--fg-dim);
  line-height: 1.4;
}
.reaction-pill:hover {
  background: var(--bg);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.reaction-pill.mine {
  background: rgba(92,176,255,.15);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.reaction-emoji { font-size: 13px; line-height: 1; }
.reaction-count { font-size: 11px; font-weight: 700; min-width: 10px; text-align: center; }

@media (max-width: 768px) {
  .msg-reactions { padding-left: 0; }
  .reaction-pill { padding: 3px 10px; font-size: 13px; }
}

/* Reaction-Picker Popup */
.reaction-picker {
  position: fixed;
  display: flex;
  gap: 4px;
  padding: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 9998;
  animation: popIn .12s ease-out;
}
.reaction-pick-btn {
  background: none;
  border: none;
  font-size: 22px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .1s;
  line-height: 1;
}
.reaction-pick-btn:hover {
  background: var(--bg);
  transform: scale(1.25);
}
@media (max-width: 768px) {
  .reaction-pick-btn { font-size: 26px; padding: 8px 10px; }
}

.msg-body .smiley {
  vertical-align: middle;
  /* Keine max-height: Smileys in Originalgröße (wie hochgeladen). */
  max-height: none;
  margin: 0 2px;
  cursor: pointer;
  transition: transform .1s, filter .1s;
}
.msg-body .smiley:hover {
  transform: scale(1.15);
  filter: drop-shadow(0 2px 4px rgba(255,140,0,.4));
}
.msg-body .smiley:active {
  transform: scale(0.95);
}

.clickable-nick { cursor: pointer; transition: opacity .1s; }
.clickable-nick:hover { opacity: .7; text-decoration: underline; }

.whisper-prefix {
  color: var(--dj);
  font-size: 11px;
  font-weight: 600;
  margin-right: 4px;
}

.notice-fade {
  animation: fadeNotice 5s forwards;
  opacity: .9;
  background: rgba(255,180,84,.05);
  border-left: 2px solid var(--warn);
  padding-left: 10px !important;
}
@keyframes fadeNotice {
  0% { opacity: 0; transform: translateY(-4px); }
  10% { opacity: .9; transform: translateY(0); }
  80% { opacity: .9; }
  100% { opacity: 0; }
}

/* ==================== CHAT MODAL (ersetzt alert/confirm/prompt) ==================== */
.chat-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: overlayIn .15s ease-out;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.chat-modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
  min-width: 280px;
  max-width: 440px;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn .18s cubic-bezier(.3, 1.3, .5, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-10px) scale(.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.chat-modal-header {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(135deg, rgba(92, 176, 255, .08), rgba(199, 125, 255, .05));
}
.chat-modal-title {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  color: var(--fg);
}
.chat-modal-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  transition: all .15s;
}
.chat-modal-close:hover { background: var(--panel-2); color: var(--fg); }

.chat-modal-body {
  padding: 16px 18px;
  color: var(--fg);
  font-size: 13.5px;
  line-height: 1.5;
}
.chat-modal-text {
  color: var(--fg-dim);
  margin-bottom: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-modal-text:last-child { margin-bottom: 0; }

.chat-modal-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  padding: 9px 12px;
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.chat-modal-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(92, 176, 255, .18);
}
textarea.chat-modal-input { resize: vertical; min-height: 70px; }
.chat-modal-label {
  display: block;
  margin: 14px 0 6px;
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 700;
}
.chat-modal-select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  outline: none;
}
.chat-modal-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(92, 176, 255, .18); }
.chat-modal-error { min-height: 18px; margin-top: 9px; color: var(--err); font-size: 12px; }

.chat-modal-actions {
  display: flex;
  gap: 8px;
  padding: 12px 18px 16px;
  justify-content: flex-end;
  border-top: 1px solid var(--border-soft);
  background: var(--bg);
}
.chat-modal-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--fg);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  min-width: 96px;
}
.chat-modal-btn:hover { background: var(--border); }
.chat-modal-ok {
  background: var(--accent);
  border-color: var(--accent);
  color: #0a0e13;
}
.chat-modal-ok:hover { background: var(--accent-2); border-color: var(--accent-2); }
.chat-modal-danger {
  background: var(--err);
  border-color: var(--err);
  color: #fff;
}
.chat-modal-danger:hover { background: #ff8383; border-color: #ff8383; }
.chat-modal-cancel {
  background: transparent;
  color: var(--fg-dim);
}
.chat-modal-cancel:hover { background: var(--panel-2); color: var(--fg); }

/* Mobile: Modal volle Breite */
@media (max-width: 768px) {
  .chat-modal { max-width: none; }
  .chat-modal-btn { flex: 1; min-width: 0; padding: 10px 12px; }
}

/* ==================== POPUPS ==================== */
.popup {
  position: fixed;
  z-index: 200;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--fg);
  animation: popIn .15s ease-out;
}
@keyframes popIn {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

.user-popup { min-width: 240px; padding: 14px; }
.popup-header {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.popup-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 18px;
}
.popup-name { font-weight: 700; font-size: 15px; }
.popup-role {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
}
.popup-role.role-superadmin, .popup-role.role-admin { color: var(--admin); }
.popup-role.role-mod { color: var(--mod); }
.popup-role.role-dj  { color: var(--dj); }
.popup-role.role-vip { color: var(--vip); }

.popup-dj {
  margin-bottom: 10px;
  padding: 8px 10px;
  background: rgba(255,59,92,.08);
  border: 1px solid var(--live);
  border-radius: var(--radius-sm);
}
.popup-dj-live { color: var(--live); font-weight: 700; font-size: 12px; }
.popup-dj-np { color: var(--fg-dim); font-size: 11px; margin-top: 2px; }

.popup-bio {
  font-size: 12px;
  color: var(--fg-dim);
  margin-bottom: 10px;
  line-height: 1.5;
}
.popup-actions {
  display: flex;
  gap: 6px;
}
.popup-actions button {
  flex: 1;
  padding: 7px 10px;
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  transition: background .1s;
}
.popup-actions button:hover { background: var(--border); }

/* Invisible-Mode Toggle im eigenen User-Popup (nur Admin/Superadmin) */
.popup-ghost {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ghost-toggle-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all .1s;
  text-align: left;
}
.ghost-toggle-btn:hover { background: var(--border); }
.ghost-toggle-btn.active {
  background: rgba(139,92,246,.15);
  border-color: #8b5cf6;
  color: #c4b5fd;
}
.ghost-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}
.ghost-label {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}
.ghost-hint {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.3;
  padding: 0 4px;
}

/* Mod-Aktionen im User-Popup */
.popup-mod-actions {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.popup-mod-actions .btn-warn {
  background: rgba(255,180,84,.15);
  border-color: var(--warn);
  color: var(--warn);
}
.popup-mod-actions .btn-warn:hover {
  background: var(--warn);
  color: #000;
}
.popup-mod-actions .btn-danger-sm {
  background: rgba(255,107,107,.12);
  border-color: var(--err);
  color: var(--err);
}
.popup-mod-actions .btn-danger-sm:hover {
  background: var(--err);
  color: #fff;
}

/* Mod-Modal (Kick/Ban) */
.mod-modal {
  width: 400px;
  max-width: 95vw;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  animation: pmFadeIn .15s ease-out;
}
.mod-modal-target {
  text-align: center;
  font-size: 18px;
  margin-bottom: 12px;
}
.mod-modal-desc {
  font-size: 12px;
  color: var(--fg-dim);
  line-height: 1.5;
  margin-bottom: 18px;
  padding: 10px 12px;
  background: rgba(255,107,107,.06);
  border-left: 3px solid var(--err);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.mod-modal .btn-danger {
  background: var(--err);
  color: #fff;
}

/* ==================== RADIO AUDIO PLAYER ==================== */
.radio-player {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 2px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.radio-play-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #0a0e13;
  font-size: 11px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform .1s, background .1s;
}
.radio-play-btn:hover { transform: scale(1.08); }
.radio-play-btn:active { transform: scale(0.95); }
.radio-play-btn.playing { background: #ff3b5c; color: #fff; }
.radio-play-btn.loading { background: #888; color: #fff; cursor: wait; animation: radio-pulse 1.2s ease-in-out infinite; }
@keyframes radio-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}
.radio-volume-btn {
  font-size: 13px;
  opacity: 0.75;
  pointer-events: none;
  user-select: none;
}
.radio-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 70px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  margin: 0;
}
.radio-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--panel-2);
  cursor: pointer;
  transition: transform .1s;
}
.radio-volume-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.radio-volume-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--panel-2);
  cursor: pointer;
}

/* ==================== SENDEPLAN POPUP ==================== */
.radio-schedule-btn {
  margin-left: auto;
  padding: 6px 12px;
  background: var(--panel-2);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .1s;
}
.radio-schedule-btn:hover {
  background: var(--accent);
  color: #0a0e13;
  border-color: var(--accent);
}

.schedule-popup {
  padding: 22px;
  width: 500px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.schedule-scroll {
  overflow-y: auto;
  flex: 1;
  margin: -4px -4px 0;
  padding: 4px;
}
.schedule-empty {
  padding: 40px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.schedule-day {
  margin-bottom: 18px;
}
.schedule-day-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.schedule-show {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  margin-bottom: 4px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  position: relative;
}
.schedule-show:hover { border-color: var(--accent); }
.schedule-time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
  min-width: 90px;
  padding-top: 2px;
}
.schedule-info { flex: 1; min-width: 0; }
.schedule-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--fg);
}
.schedule-genre {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}
.schedule-dj {
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
}
.schedule-desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.5;
}
.schedule-recurring {
  color: var(--muted);
  font-size: 14px;
  padding-top: 4px;
  user-select: none;
}

/* ==================== WISH/DJ POPUP ==================== */
.wish-popup, .dj-panel-popup {
  padding: 24px;
  width: 360px;
  max-width: 90vw;
}
.wish-popup .popup-title,
.dj-panel-popup .popup-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.popup-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 12px 0 4px;
  font-weight: 600;
}
.wish-popup input[type="text"],
.wish-popup textarea,
.dj-panel-popup input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
}
.wish-popup input:focus,
.wish-popup textarea:focus,
.dj-panel-popup input:focus { border-color: var(--accent); }
.wish-popup .popup-actions,
.dj-panel-popup .popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.wish-popup .popup-actions button,
.dj-panel-popup .popup-actions button {
  flex: 1;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.wish-popup .popup-actions button.primary,
.dj-panel-popup .popup-actions button.primary {
  background: var(--accent);
  color: #0a0e13;
  border-color: var(--accent);
}
.wish-popup .popup-actions button:hover,
.dj-panel-popup .popup-actions button:hover {
  background: var(--border);
}
.wish-popup .popup-actions button.primary:hover,
.dj-panel-popup .popup-actions button.primary:hover {
  background: var(--accent-2);
}

/* ==================== SMILEY PICKER ==================== */
.smiley-picker {
  width: 320px;
  max-height: 300px;
  overflow-y: auto;
  padding: 10px;
}
.smiley-picker .sp-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

/* Ordner-Tabs (Kategorien) */
.smiley-picker-wrap {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}
.smiley-tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.smiley-tabs {
  display: flex;
  gap: 3px;
  padding: 6px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;           /* mehrzeilig bei vielen Ordnern */
  flex-shrink: 0;
  max-height: 40%;           /* nicht mehr als 40% der Picker-Höhe */
  overflow-y: auto;
}
.smiley-tabs::-webkit-scrollbar { width: 4px; }
.smiley-tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.smiley-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 14px;          /* Pill-Style damit mehrere Zeilen gut aussehen */
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .1s, color .1s, border-color .1s, transform .1s;
}
.smiley-tab:hover {
  background: var(--border);
  color: var(--text);
  transform: translateY(-1px);
}
.smiley-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0a0e13;
}
.smiley-tab-count {
  background: rgba(255,255,255,.08);
  padding: 1px 5px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
}
.smiley-tab.active .smiley-tab-count { background: rgba(0,0,0,.2); color: #0a0e13; }

.smiley-cat-pane { display: none; }
.smiley-cat-pane.active { display: block; }
.smiley-empty {
  padding: 30px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.smiley-cat-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin: 6px 4px 4px;
}
.smiley-cat {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.smiley-pick {
  /* Original-Upload-Größe, ohne Squashing; nur eine Notbremse nach oben damit ein versehentlicher 1000px-Upload den Picker nicht zerreißt */
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 96px;
  object-fit: contain;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 4px;
  background: transparent;
  transition: background .1s, transform .1s;
}
.smiley-pick:hover {
  background: var(--border);
  transform: scale(1.1);
}

/* ==================== CHAT IMAGES ==================== */
.chat-image-wrap {
  margin: 6px 0;
  max-width: 300px;
}
.chat-image {
  display: block;
  width: 100%;
  max-width: 300px !important;
  max-height: 200px !important;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  object-fit: contain;
}
.chat-image:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}

/* Vollbild-Overlay fuer angeklickte Bilder */
.image-lightbox {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 500;
  background: rgba(0,0,0,.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: lbFadeIn .15s ease-out;
}
@keyframes lbFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.image-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
.image-lightbox-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.5);
  font-size: 12px;
}

/* Logo */
.brand-logo-img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: contain;
}

/* Image drop overlay */
.image-drop-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(92,176,255,.15);
  border: 3px dashed var(--accent);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  pointer-events: none;
}

/* ==================== EMOJI PICKER ==================== */
.emoji-picker {
  width: 340px;
  max-height: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  animation: popIn .15s ease-out;
}
.emoji-header {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.emoji-search {
  flex: 1;
  padding: 7px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--fg);
  font-size: 13px;
  outline: none;
}
.emoji-search:focus { border-color: var(--accent); }
.emoji-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
}
.emoji-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-soft);
  overflow-x: auto;
}
.emoji-tab {
  background: none;
  border: none;
  font-size: 18px;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .1s;
  flex-shrink: 0;
}
.emoji-tab:hover { background: var(--panel-2); }
.emoji-tab.active { background: rgba(92,176,255,.15); }
.emoji-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.emoji-cat { display: none; }
.emoji-cat.active { display: block; }
.emoji-cat-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin: 4px 4px 6px;
  font-weight: 600;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}
.emoji-item {
  background: none;
  border: none;
  font-size: 22px;
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .1s, transform .1s;
  line-height: 1.2;
}
.emoji-item:hover {
  background: var(--panel-2);
  transform: scale(1.2);
}

/* Mobile: Emoji-Picker volle Breite (zentriert, nie am Rand abgeschnitten) */
@media (max-width: 768px) {
  .emoji-picker {
    width: calc(100vw - 16px) !important;
    max-width: 380px !important;
    max-height: 55vh !important;
  }
  .emoji-grid { grid-template-columns: repeat(7, 1fr); }
  .emoji-item { font-size: 24px; padding: 5px; }
}
.profile-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 420px;
  max-width: 95vw;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 300;
  animation: pmFadeIn .15s ease-out;
  padding: 24px;
}
.profile-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.profile-avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  border: 3px solid var(--border);
}
.profile-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-avatar-actions {
  display: flex;
  gap: 8px;
}
.profile-field {
  margin-bottom: 16px;
}
.profile-field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.profile-field input[type="text"],
.profile-field input[type="email"],
.profile-field input[type="color"],
.profile-field textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
}
.profile-field input:focus,
.profile-field textarea:focus { border-color: var(--accent); }
.profile-field input[type="color"] {
  height: 44px;
  padding: 4px;
  cursor: pointer;
}
.profile-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 18px;
  margin-top: 6px;
  border-top: 1px solid var(--border);
}
.profile-actions .btn,
.profile-actions .btn-secondary {
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .12s, background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.profile-actions .btn-secondary {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.profile-actions .btn-secondary:hover {
  background: var(--bg);
  color: var(--fg);
  border-color: var(--muted);
}
.profile-actions .btn:not(.btn-secondary) {
  background: var(--accent);
  color: #0a0e13;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
.profile-actions .btn:not(.btn-secondary):hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}

/* Avatar im Sidebar */
.me-avatar { cursor: pointer; transition: opacity .15s; overflow: hidden; }
.me-avatar:hover { opacity: .8; }
.me-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Avatar in User-Liste */
.user-avatar img.user-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* ==================== RIGHT PANEL (Andock-Panel) ==================== */
#right-panel {
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: none;           /* wird per JS auf flex gesetzt */
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  position: relative;
  min-width: 200px;
}
#app.has-right-panel #right-panel { display: flex; }

/* Resize-Handle: linker Rand des Panels, horizontal ziehen */
#rp-resize-handle {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  cursor: col-resize;
  z-index: 10;
  background: transparent;
  transition: background .15s;
}
#rp-resize-handle:hover { background: var(--accent); opacity: .4; }

/* Section: eine angedockte Einheit im Panel */
.rp-section {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 140px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.rp-section:last-child { border-bottom: none; }

/* Body der Section */
.rp-section-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Splitter zwischen zwei Sections */
.rp-splitter {
  height: 6px;
  background: var(--border);
  cursor: row-resize;
  flex-shrink: 0;
  transition: background .15s;
  position: relative;
}
.rp-splitter:hover { background: var(--accent); }
.rp-splitter::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 2px;
  background: var(--muted);
  border-radius: 1px;
}

/* Smiley-Picker im Panel */
.rp-section-body .smiley-grid-wrap {
  padding: 8px;
}
.rp-section-body .smiley-pick {
  width: 32px; height: 32px;
  cursor: pointer;
  border-radius: 4px;
  transition: transform .1s;
}
.rp-section-body .smiley-pick:hover { transform: scale(1.2); }
.rp-section-body .smiley-cat-title {
  font-size: 10px; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
  padding: 6px 0 2px;
}
.rp-section-body .smiley-cat { display: flex; flex-wrap: wrap; gap: 4px; }

/* Wunschbox im Panel */
.wish-dock-inner {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wish-status {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.45;
  border: 1px solid transparent;
  margin-bottom: 2px;
}
.wish-status-info {
  background: linear-gradient(135deg, rgba(92, 176, 255, .12), rgba(92, 176, 255, .04));
  border-color: rgba(92, 176, 255, .35);
  color: var(--fg);
}
.wish-status-blocked {
  background: linear-gradient(135deg, rgba(255, 107, 107, .15), rgba(255, 107, 107, .05));
  border-color: rgba(255, 107, 107, .45);
  color: var(--fg);
}
.wish-status b { color: var(--accent); }
.wish-status-blocked b { color: var(--err); }
.wish-dock-inner input[type="text"],
.wish-dock-inner textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
}
.wish-dock-inner input:focus,
.wish-dock-inner textarea:focus { border-color: var(--accent); }
.wish-dock-inner textarea { resize: vertical; min-height: 64px; }
.wish-dock-inner .wish-send-btn {
  padding: 9px 12px;
  background: var(--accent);
  color: #0a0e13;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  margin-top: 4px;
}
.wish-dock-inner .wish-send-btn:hover { background: var(--accent-2); }

/* Popup-Header (wird auch als Section-Header wiederverwendet) */
.side-dock-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.side-dock-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-dock-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--fg);
  font-size: 16px;
  padding: 6px 10px;
  border-radius: 5px;
  line-height: 1;
  transition: all .15s;
  flex-shrink: 0;
  min-width: 32px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.side-dock-btn:hover {
  background: var(--accent);
  color: #0a0e13;
  border-color: var(--accent);
  transform: scale(1.05);
}

/* .side-dock-content veraltet – ersetzt durch .rp-section-body */

/* Dock-Button in Popups */
.popup-dock-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg-dim);
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.popup-dock-btn:hover { background: var(--panel-2); color: var(--accent); border-color: var(--accent); }

/* ==================== DJ WUNSCHLISTE ==================== */
.wishlist-panel {
  width: 380px;
  max-width: 95vw;
  max-height: 70vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  resize: both;
  min-width: 300px;
  min-height: 260px;
}

.wishlist-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.wishlist-toolbar span {
  flex: 1;
  font-size: 11px;
  color: var(--muted);
}

.wishlist-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wish-item {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: opacity .2s;
}
.wish-item.played {
  opacity: .45;
  border-style: dashed;
}
.wish-item-song {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}
.wish-item-greeting {
  font-size: 13px;
  color: var(--fg-dim);
  font-style: italic;
}
.wish-item-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.wish-item-meta .wish-sender {
  font-weight: 600;
  color: var(--accent);
}
.wish-item-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.wish-item-actions button {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg-dim);
  cursor: pointer;
  transition: all .15s;
}
.wish-item-actions .btn-played {
  background: var(--ok);
  color: #0a0e13;
  border-color: var(--ok);
  font-weight: 600;
}
.wish-item-actions .btn-played:hover { background: #3ec97a; }
.wish-item-actions .btn-delete:hover { background: var(--err); color: #fff; border-color: var(--err); }
.wish-item.played .btn-played { background: var(--bg); color: var(--muted); border-color: var(--border); font-weight: normal; }

.wishlist-empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 16px;
  font-size: 13px;
}

.wishlist-btn { color: var(--dj); }
.wishlist-btn:hover { color: var(--fg); }

/* ==================== HAMBURGER ==================== */
.hamburger-btn {
  display: none;
  position: relative;
  background: none;
  border: none;
  color: var(--fg);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  flex-shrink: 0;
}
.hamburger-btn:hover { background: var(--hover); }

/* Roter Benachrichtigungs-Punkt auf dem Hamburger (nur wenn .has-notify) */
.hamburger-btn.has-notify::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  background: var(--err);
  border: 2px solid var(--panel);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255, 107, 107, .6);
  animation: hamburger-pulse 1.8s ease-in-out infinite;
}
@keyframes hamburger-pulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%      { transform: scale(1.2); opacity: .8; }
}

/* ==================== SIDEBAR OVERLAY ==================== */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
}
#sidebar-overlay.active { display: block; }

/* ==================== MOBILE ==================== */
@media (max-width: 768px) {
  /* Viewport-Hoehe: 100dvh passt sich an wenn Tastatur aufgeht */
  html {
    height: -webkit-fill-available; /* iOS Safari: kein overflow durch Browser-Chrome */
  }
  body { height: 100%; overflow: hidden; }
  #app {
    grid-template-areas: "main" !important;
    grid-template-columns: 1fr !important;
    height: 100vh;                  /* Fallback */
    height: -webkit-fill-available; /* iOS Safari */
    height: 100dvh;                 /* Chrome 108+ / Firefox: passt sich Tastatur an */
    overflow-x: hidden;
  }
  /* Right-Panel + Dock auf Mobile ausblenden (nur Popup-Version) */
  #right-panel { display: none !important; }
  #app.has-right-panel {
    grid-template-areas: "main" !important;
    grid-template-columns: 1fr !important;
  }
  /* Radio-Info auf Mobile: overflow verhindern, Sendeplan-Button kompakt */
  .radio-info { overflow: hidden; max-width: 100%; }
  .radio-schedule-btn { font-size: 10px !important; padding: 4px 8px !important; }
  /* Radio-Player kompakter auf Mobile */
  .radio-volume-slider { width: 52px; }
  .radio-play-btn { width: 22px; height: 22px; font-size: 9px; }

  /* Sidebar als Drawer */
  #sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 82vw;
    max-width: 300px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 200;
    box-shadow: 4px 0 24px rgba(0,0,0,.5);
  }
  #app.sidebar-right #sidebar {
    left: auto;
    right: 0;
    transform: translateX(100%);
  }
  #sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  /* Hamburger anzeigen */
  .hamburger-btn { display: flex; align-items: center; }

  /* Uhrzeit ausblenden */
  .msg-time { display: none !important; }

  /* Header kompakter */
  #chat-header {
    padding: 8px 10px;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
  }
  .header-main {
    flex: 1;
    min-width: 0;
  }
  .room-name {
    font-size: 15px !important;
  }
  .room-topic {
    font-size: 11px !important;
  }

  /* Radio-Info kompakter */
  .radio-info {
    font-size: 11px !important;
    flex-wrap: wrap;
    gap: 4px !important;
    padding: 4px 8px !important;
  }

  /* Chat-Nachrichten */
  .chat-messages {
    padding: 8px 10px !important;
  }
  .msg {
    padding: 3px 0 !important;
  }
  .msg-body {
    font-size: 14px !important;
  }
  .msg-author {
    font-size: 13px !important;
  }

  /* Send-Form mobil */
  .send-form {
    padding: 6px 8px !important;
    gap: 4px !important;
    flex-shrink: 0;
  }
  .send-tools {
    gap: 2px !important;
  }
  .tool-btn {
    width: 32px !important;
    height: 32px !important;
    font-size: 14px !important;
  }
  #send-input {
    font-size: 15px !important;
    padding: 8px 10px !important;
  }
  .send-btn {
    padding: 8px 14px !important;
    font-size: 13px !important;
  }

  /* Popups vollbild auf Mobile — Transform/Resize/Min-Width aus inline-style ueberschreiben */
  .popup {
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    bottom: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: 85vh !important;
    resize: none !important;
    overflow-y: auto !important;
  }
  /* Wishbox-Popup: genug Platz fuer Input + Textarea + Send-Button */
  .wish-popup {
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .wish-popup .wish-dock-inner { padding: 12px !important; }
  .smiley-picker {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 60px !important;
    top: auto !important;
    width: 100% !important;
    max-height: 55vh !important;
    height: 55vh !important;
    border-radius: 12px 12px 0 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  .smiley-picker .side-dock-header {
    border-radius: 12px 12px 0 0;
  }

  /* Typing Indicator */
  .typing-indicator {
    font-size: 11px !important;
    padding: 2px 8px !important;
  }
}
