/* assets/style.css */
:root {
    --bg: #050505;
    --panel: rgba(0, 0, 0, 0.5);
    --border: #333;
    --text: #fff;
    --muted: #aaa;
    --accent: #2d6cdf;
    --accent-hover: #3f7ae4;
    --bubble-self: #14243d;
    --bubble-other: #1a1a1a;
}

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

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    overflow-y: auto;
    font-family: Arial, sans-serif;
    color: #ffffff;
}

body {
  margin: 0;
  padding: 0;
  background-image: url("../bilder/saturn.jpg");
  background-size: cover;        /* Bild fÃ¼llt den ganzen Bildschirm */
  background-position: center;   /* Zentriert das Bild */
  background-repeat: no-repeat;  /* Kein Kacheln */
  background-attachment: fixed;  /* Bleibt beim Scrollen fix */
}

.app-shell {
    max-width: none;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 10px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}



/* Header */
.header-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

.rsp-chat-header-player {
    width: 70% !important;
    min-width: 280px;
    max-width: 900px;
    flex: 1 1 70% !important;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.toggle-online-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* Main Layout */
.main-layout {
    display: flex;
    gap: 15px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Online Panel */
.online-panel {
    width: 260px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 15px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.online-panel.collapsed {
    width: 0;
    padding: 0;
    overflow: hidden;
    opacity: 0;
}

.online-title {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.online-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.online-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
}

.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    display: inline-block;
}

/* Chat Panel */
.chat-panel {
    flex: 1;
    min-width: 0;
    min-height: 0;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-window {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

/* Messages */
.message-row {
    display: flex;
}

.message-row.self {
    justify-content: flex-end;
}

.message-row.other {
    justify-content: flex-start;
}

.message-bubble {
  flex: 1 1 auto;
  width: 100%;
  max-width: none !important;

  padding: 8px 12px;
  border-radius: 12px;

  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255,255,255,0.1);

  color: #ffffff;

  display: block;

  /* WICHTIG für Umbruch */
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.message-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
    font-size: 0.75rem;
    color: var(--muted);
}

.message-text {
    word-wrap: break-word;
    line-height: 1.4;
}

.system-note {
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
    padding: 10px;
}

/* Input Panel */
.input-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 15px;
}

.message-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#messageInput {
    flex: 1;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2px;
    color: var(--text);
    font-family: inherit;
    resize: vertical;
    min-height: 30px;
    max-height: 30px;
}

#messageInput:focus {
    outline: none;
    border-color: var(--accent);
}

.form-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.left-icons {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text);
    font-size: 1.1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255,255,255,0.15);
    transform: translateY(-1px);
}

.send-icon-btn {
    background: var(--accent);
    border-color: transparent;
}

.send-icon-btn:hover {
    background: var(--accent-hover);
}

/* Emoji Picker */
.emoji-picker {
    position: fixed;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.emoji-option {
    background: rgba(255,255,255,0.08);
    border: none;
    border-radius: 8px;
    padding: 8px;
    font-size: 1.2rem;
    cursor: pointer;
}

.emoji-option:hover {
    background: rgba(255,255,255,0.2);
}

/* Notifications */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 18px;
    transform: translateX(400px);
    transition: transform 0.3s;
    z-index: 2000;
}

.notification.show {
    transform: translateX(0);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
    .app-shell {
        padding: 10px;
    }
    
    .main-layout {
        flex-direction: column;
    }
    
    .online-panel {
        width: 100%;
        order: 2;
    }
    
    .message-form {
        flex-direction: column;
    }
    
    .form-actions {
        justify-content: space-between;
    }
    
    .message-bubble {
        max-width: 85%;
    }
}

@media (min-width: 1200px) {
    .message-bubble {
        max-width: 60%;
    }
}

/* ===== CHAT INPUT LAYOUT FIX ===== */

/* Formular untereinander */
.message-form {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px;
  width: 100%;
}

/* Eingabefeld volle Breite */
#messageInput {
  width: 100% !important;
  min-height: 30px;
  max-height: 30px;
  height: 80px;
  font-size: 1rem;
  padding: 2px;
  border-radius: 12px;
}

/* Button-Zeile darunter */
.form-actions {
  display: flex !important;
  gap: 10px;
  width: 100%;
  align-items: center;
}

/* Linke Buttons (Emoji / Admin / Logout) */
.left-icons {
  display: flex;
  gap: 8px;
}

/* SEND Button gro */
.send-main-btn {
  flex: 1;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-weight: bold;
  cursor: pointer;
}

/* Hover Effekt */
.send-main-btn:hover {
  background: var(--accent-hover);
}


/* Kleine Buttons (Emoji / Admin / Logout) */
.icon-btn,
.admin-link-btn {
  padding: 6px 10px;
  font-size: 0.9rem;
  border-radius: 8px;
  min-height: 32px;
}

/* SEND Button etwas kleiner aber noch dominant */
.send-main-btn {
  padding: 8px 12px;
  font-size: 0.95rem;
  min-height: 34px;
}

/* Buttons wieder sichtbar machen */
.primary-btn,
.send-main-btn,
.admin-link-btn,
.icon-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

/* ===== Gallery modal + preview ===== */
.hidden { display: none !important; }
body.modal-open { overflow: hidden; }
.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
}
.gallery-dialog {
  position: relative;
  z-index: 1;
  width: min(960px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  background: #111827;
  border: 1px solid #334155;
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.45);
  overflow: hidden;
}
.gallery-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #334155;
  background: #0f172a;
}
.gallery-dialog-header h2 { margin: 0 0 4px; font-size: 1.1rem; }
.gallery-dialog-header p { margin: 0; color: #94a3b8; font-size: .92rem; }
.gallery-close-btn { min-width: 38px; }
.gallery-modal-body {
  padding: 16px;
  overflow: auto;
}
.gallery-modal-status {
  color: #cbd5e1;
  padding: 12px 0;
}

.gallery-upload-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 220px) auto;
  gap: 10px;
  margin-bottom: 14px;
  align-items: center;
}
.gallery-upload-form input[type="text"],
.gallery-upload-form input[type="file"] {
  width: 100%;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e5e7eb;
  border-radius: 12px;
  padding: 10px 12px;
}
.gallery-upload-form input[type="file"] {
  padding: 8px 10px;
}
.gallery-upload-btn {
  white-space: nowrap;
}

.gallery-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.gallery-picker-card {
  border: 1px solid #334155;
  background: #1e293b !important;
  border-radius: 16px;
  color: #e5e7eb;
  text-align: left;
  padding: 10px;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
  position: relative;
}
.gallery-picker-card:hover {
  transform: translateY(-1px);
  border-color: #3b82f6;
  background: #243247;
}
.gallery-picker-card.is-sending { opacity: .7; pointer-events: none; }
.gallery-picker-image {
  display: block;
  width: 100%; 
  margin-bottom: 35px;
}
.gallery-picker-title {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
}
.gallery-picker-date {
  display: block;
  color: #94a3b8;
  font-size: .82rem;
}
.chat-gallery-preview {
  display: grid;
  gap: 8px;
}
.chat-gallery-link { display: inline-block; }
.chat-gallery-image {
  display: block;
  width: 100%;
  max-width: 350px;
  height: 200px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #0f172a;
}
.chat-gallery-caption {
  font-weight: 700;
  color: #e5e7eb;
}
.message-text.is-gallery-text { color: #cbd5e1; }
@media (max-width: 700px) {
  .gallery-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .gallery-modal-body { padding: 12px; }
  .gallery-upload-form { grid-template-columns: 1fr; }
  .gallery-modal-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .gallery-picker-image { height: 150px; }
}

.chat-gallery-caption { display: none; }

/* Online-Liste lesbarer machen */
.online-panel {
  background: rgba(0, 0, 0, 0.5) !important;
}

.online-item {
  background: rgba(255, 255, 255, 0.08) !important;
}

/* Username heller */
.online-item span,
.online-item div {
  color: #ffffff !important;
  font-weight: 500;
}

/* Titel "Online" */
.online-title {
  color: #ffffff !important;
}


.message-row {
    align-items: flex-end;
    gap: 10px;
}

.chat-avatar {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    border: 2px solid rgba(255,255,255,0.22);
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    background: rgba(255,255,255,0.08);
}

.chat-avatar.is-fallback {
    background: linear-gradient(135deg, var(--avatar-color, #2d6cdf), rgba(255,255,255,0.18));
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.message-row.self {
    flex-direction: row-reverse;
}

.message-row.self .message-meta {
    justify-content: flex-end;
}

.online-item {
    gap: 12px;
}

.online-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
}

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


/* ===== FINAL FIX: Smiley Button sichtbar ===== */
.form-actions {
  display: flex !important;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.left-icons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.icon-btn {
  min-width: 42px !important;
  min-height: 38px !important;
  padding: 8px 12px !important;
  font-size: 18px !important;
  line-height: 1 !important;
  color: #ffffff !important;
  background: rgba(255,255,255,0.14) !important;
  border: 1px solid rgba(255,255,255,0.22) !important;
  position: relative;
  z-index: 20;
}

.icon-btn:hover {
  background: rgba(255,255,255,0.24) !important;
}

.smiley-btn,
#emojiBtn,
button[title*="Emoji"],
button[title*="Smiley"],
button[aria-label*="Emoji"],
button[aria-label*="Smiley"] {
  min-width: 46px !important;
  min-height: 40px !important;
  padding: 8px 12px !important;
  border-radius: 10px !important;
  border: 1px solid rgba(0,0,0,0.15) !important;
  background: #ffcc00 !important;
  color: #000000 !important;
  font-size: 22px !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  box-shadow: 0 6px 16px rgba(0,0,0,0.28) !important;
  position: relative;
  z-index: 30 !important;
}

.smiley-btn:hover,
#emojiBtn:hover,
button[title*="Emoji"]:hover,
button[title*="Smiley"]:hover,
button[aria-label*="Emoji"]:hover,
button[aria-label*="Smiley"]:hover {
  background: #ffd84d !important;
  transform: translateY(-1px);
}

.emoji-picker {
  z-index: 9999 !important;
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
}


/* ===== Modul-Smileys: linker Bereich + 10 pro Reihe ===== */
.smiley-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.smiley-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.smiley-picker-dialog {
  position: relative;
  z-index: 1;
  width: 980px;
  height: 560px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(12, 16, 26, 0.96);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.45);
}

.smiley-picker-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(135deg, rgba(57, 77, 120, 0.55), rgba(18, 24, 38, 0.95));
}
.smiley-picker-header h2 { margin: 0 0 4px; font-size: 1.1rem; color: #fff; }
.smiley-picker-header p { margin: 0; color: #cbd5e1; font-size: .92rem; }
.smiley-picker-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 0;
  flex: 1;
}
.smiley-picker-sidebar {
  background: rgba(255,255,255,0.04);
  border-right: 1px solid rgba(255,255,255,0.1);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}
.smiley-category-tab {
  border: none;
  border-radius: 14px;
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(45,108,223,.82), rgba(98, 76, 182, .82));
  box-shadow: 0 8px 16px rgba(0,0,0,.18);
}
.smiley-category-tab:nth-child(2n) { background: linear-gradient(135deg, rgba(2,132,199,.84), rgba(14,165,233,.74)); }
.smiley-category-tab:nth-child(3n) { background: linear-gradient(135deg, rgba(16,185,129,.84), rgba(34,197,94,.74)); }
.smiley-category-tab:nth-child(4n) { background: linear-gradient(135deg, rgba(245,158,11,.86), rgba(249,115,22,.76)); }
.smiley-category-tab:nth-child(5n) { background: linear-gradient(135deg, rgba(236,72,153,.86), rgba(168,85,247,.76)); }
.smiley-category-tab.active {
  outline: 2px solid rgba(255,255,255,0.92);
  transform: translateX(4px);
}
.smiley-picker-content {
  min-width: 0;
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
}
.smiley-picker-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
}
.smiley-picker-item-card {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.05);
  border-radius: 14px;
  padding: 8px 6px;
  min-height: 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.smiley-picker-item-card:hover {
  background: rgba(255,255,255,0.12);
  transform: translateY(-1px);
}
.smiley-picker-item-image {
  width: 42px;
  height: 42px;
  object-fit: contain;
  display: block;
}
.smiley-picker-item-code {
  display: none;
}
.inline-smiley {
  width: auto !important;
  height: auto !important;
  max-width: 40px !important;
  max-height: 40px !important;
  object-fit: contain;
  vertical-align: middle;
  margin: 0 2px;
}

.message-text {
  word-break: break-word;
}
@media (max-width: 1100px) {
  .smiley-picker-dialog { width: 900px; }
  .smiley-picker-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .smiley-picker-dialog { width: calc(100vw - 16px); height: calc(100vh - 16px); }
  .smiley-picker-layout { grid-template-columns: 170px 1fr; }
  .smiley-picker-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .smiley-picker-layout { grid-template-columns: 1fr; }
  .smiley-picker-sidebar { flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.1); }
  .smiley-category-tab.active { transform: none; }
  .smiley-picker-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}


/* =====================================================
   FINAL CHAT STYLE: [Avatar] [Name] [Zeit] [Nachricht]
   Keine Bubble, kein Versatz, alles in einer Reihe
   ===================================================== */

/* komplette Nachrichtenzeile */
.chat-window .message-row,
.chat-window .message-row.self,
.chat-window .message-row.other,
.chat-window .message-row.system-message {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 3px 0 !important;
  text-align: left !important;
}

/* Avatar immer links */
.chat-window .chat-avatar,
.chat-window .message-row > .chat-avatar {
  order: 1 !important;
  flex: 0 0 38px !important;
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  max-width: 38px !important;
  border-radius: 50% !important;
  margin: 0 !important;
}

/* Content-Bereich wird eine horizontale Zeile */
.chat-window .message-content {
  order: 2 !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 7px !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Falls app.js message-line verwendet */
.chat-window .message-line {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 7px !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  flex-wrap: wrap !important;
}

/* Header darf keinen Block bilden: Name direkt neben Avatar */
.chat-window .message-header {
  order: 1 !important;
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 5px !important;
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Username direkt neben Avatar */
.chat-window .message-username,
.chat-window .username {
  order: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  flex: 0 0 auto !important;
  width: auto !important;
  white-space: nowrap !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Zeit direkt nach Name */
.chat-window .message-time {
  order: 2 !important;
  display: inline-flex !important;
  align-items: center !important;
  flex: 0 0 auto !important;
  width: auto !important;
  white-space: nowrap !important;
  opacity: .65 !important;
  font-size: 11px !important;
  line-height: 1.2 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* alte Meta in Bubble nicht anzeigen */
.chat-window .message-meta {
  display: none !important;
}

/* Bubble komplett entfernen */
.chat-window .message-bubble,
.chat-window .message-content .message-bubble,
.chat-window .message-line .message-bubble {
  all: unset !important;
  order: 2 !important;
  display: contents !important;
}

/* Nachricht direkt nach Name/Zeit mit leichtem Hintergrund */
.chat-window .message-text,
.chat-window .message-bubble .message-text {
  order: 3 !important;
  display: inline-block !important;
  width: auto !important;
  max-width: min(72vw, 900px) !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 4px 8px !important;
  border-radius: 7px !important;
  background: rgba(0, 0, 0, 0.4) !important;
  color: #ffffff !important;
  line-height: 1.35 !important;
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
}

.chat-window .message-text:hover {
  background: rgba(0, 0, 0, 0.55) !important;
}

/* eigene Nachrichten nicht spiegeln */
.chat-window .message-row.self {
  flex-direction: row !important;
  justify-content: flex-start !important;
}

/* Systemnachrichten normal groß */
.chat-window .system-message .message-text {
  font-size: 1rem !important;
  font-weight: 600 !important;
}

/* Galerie/Bilder sauber halten */
.chat-window .chat-gallery-preview {
  display: inline-grid !important;
  gap: 6px !important;
  max-width: 350px !important;
}

.chat-window .chat-gallery-image {
  max-width: 350px !important;
  height: auto !important;
  border-radius: 10px !important;
}

/* farbige Würfelzahlen */
.chat-window .dice-number-color {
  font-weight: 900 !important;
}

/* Mobile */
@media (max-width: 768px) {
  .chat-window .message-row,
  .chat-window .message-row.self,
  .chat-window .message-row.other,
  .chat-window .message-row.system-message {
    gap: 6px !important;
    align-items: center !important;
  }

  .chat-window .chat-avatar,
  .chat-window .message-row > .chat-avatar {
    flex-basis: 34px !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
  }

  .chat-window .message-content,
  .chat-window .message-line {
    gap: 5px !important;
  }

  .chat-window .message-text {
    max-width: calc(100vw - 130px) !important;
    padding: 3px 7px !important;
    font-size: 13px !important;
  }

  .chat-window .message-time {
    font-size: 10px !important;
  }
}

/* =====================================================
   LETZTER CHAT-BILD-FIX
   Problem: Bild kam vor dem Namen. Jetzt: Avatar -> Name/Zeit -> Bild/Text.
   ===================================================== */

/* Nachrichtenzeile stabil */
.chat-window .message-row,
.chat-window .message-row.self,
.chat-window .message-row.other {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
}

/* Avatar immer links und rund */
.chat-window .chat-avatar,
.chat-window .message-row > .chat-avatar {
  order: 1 !important;
  flex: 0 0 38px !important;
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  max-width: 38px !important;
  border-radius: 50% !important;
  overflow: hidden !important;
}

.chat-window .chat-avatar img,
.chat-window .message-row > .chat-avatar img {
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  border-radius: 50% !important;
  display: block !important;
}

/* Inhalt rechts vom Avatar */
.chat-window .message-content,
.chat-window .message-line {
  order: 2 !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 7px !important;
  flex-wrap: wrap !important;
  min-width: 0 !important;
}

/* Name/Zeit IMMER vor Bild/Text */
.chat-window .message-header {
  order: 1 !important;
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 5px !important;
  flex: 0 0 auto !important;
}

.chat-window .message-username,
.chat-window .username,
.chat-window .message-time {
  display: inline-flex !important;
  width: auto !important;
  white-space: nowrap !important;
}

/* Text/Bild nach dem Namen */
.chat-window .message-text {
  order: 2 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: wrap !important;
  width: auto !important;
  max-width: none !important;
}

/* Falls das Bild/A-Link direkt im message-content liegt */
.chat-window .message-content > a:not(.username),
.chat-window .message-content > img,
.chat-window .message-line > a:not(.username),
.chat-window .message-line > img,
.chat-window .chat-gallery-preview,
.chat-window .chat-gallery-link {
  order: 2 !important;
}

/* ALLE Chat-Bilder klein, aber Avatar und Smileys bleiben geschützt */
.chat-window .message-content img:not(.inline-smiley),
.chat-window .message-line img:not(.inline-smiley),
.chat-window .message-text img:not(.inline-smiley),
.chat-window .chat-gallery-image {
  max-width: 180px !important;
  max-height: 180px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  border-radius: 8px !important;
}

.chat-window .inline-smiley {
  max-width: 350px !important;
  max-height: 240px !important;
  width: auto !important;
  height: auto !important;
}

/* Mobile noch kleiner */
@media (max-width: 768px) {
  .chat-window .message-content img:not(.inline-smiley),
  .chat-window .message-line img:not(.inline-smiley),
  .chat-window .message-text img:not(.inline-smiley),
  .chat-window .chat-gallery-image {
    max-width: 110px !important;
    max-height: 110px !important;
  }
}

/* =====================================================
   FIX: Nachrichten nutzen die Breite vom mittleren Chatbereich
   ohne das restliche Layout zu zerstören
   ===================================================== */

/* Chatbereich darf den freien Platz sauber benutzen */
.chat-panel,
.chat-window {
  width: 100% !important;
  min-width: 0 !important;
}

/* Jede Nachrichtenzeile bleibt im mittleren Bereich */
.chat-window .message-row,
.chat-window .message-row.self,
.chat-window .message-row.other,
.chat-window .message-row.system-message {
  width: 100% !important;
  max-width: 100% !important;
}

/* Inhalt rechts vom Avatar darf bis zum rechten Rand gehen */
.chat-window .message-content,
.chat-window .message-line {
  flex: 1 1 auto !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

/* Nur Textnachrichten bekommen volle verfügbare Breite */
.chat-window .message-text:not(.is-gallery-text) {
  flex: 1 1 auto !important;
  width: auto !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

/* Galerie/Bilder bleiben klein, damit sie das Layout nicht sprengen */
.chat-window .chat-gallery-preview,
.chat-window .chat-gallery-link,
.chat-window .message-text.is-gallery-text {
  flex: 0 1 auto !important;
  width: auto !important;
  max-width: 350px !important;
}

/* Mobile bleibt stabil */
@media (max-width: 768px) {
  .chat-window .message-content,
  .chat-window .message-line {
    width: 100% !important;
    max-width: 100% !important;
  }

  .chat-window .message-text:not(.is-gallery-text) {
    max-width: 100% !important;
    font-size: 13px !important;
  }
}

/* ===== PLAYER LAUFSCHRIFT FIX ===== */

.rsp-chat-header-player {
  position: relative;
  overflow: hidden;
}

.rsp-chat-header-player * {
  white-space: nowrap;
}

/* typischer Titel im Player (falls span/div verwendet wird) */
.rsp-chat-header-player span,
.rsp-chat-header-player .track-title,
.rsp-chat-header-player .marquee,
.rsp-chat-header-player .nowplaying {
  display: inline-block;
  padding-left: 100%;
  animation: playerScroll 15s linear infinite;
}

@keyframes playerScroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}


/* ONLINE STABLE AVATAR FIX */
.online-item { display:flex !important; align-items:center !important; gap:10px !important; }
.online-name-text { color:#fff !important; font-weight:600 !important; white-space:nowrap !important; }
.online-avatar { width:34px !important; height:34px !important; min-width:34px !important; max-width:34px !important; border-radius:50% !important; overflow:hidden !important; display:inline-flex !important; align-items:center !important; justify-content:center !important; }
.online-avatar img { width:100% !important; height:100% !important; object-fit:cover !important; display:block !important; border-radius:50% !important; }
.online-avatar.is-fallback { background:linear-gradient(135deg,#2d6cdf,rgba(255,255,255,.18)) !important; color:#fff !important; font-weight:800 !important; }

/* ===== PROFIL MODAL KOMPLETT FIX ===== */
.profile-modal.hidden { display: none !important; }
.profile-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
   background: rgba(0,0,0,.60);  
}
.profile-backdrop { position: absolute; inset: 0; background: transparent; }
.profile-dialog {
  position: relative;
  z-index: 1;
  width: min(720px, 96vw);
  height: min(760px, 92vh);
  border: 1px solid #334155;
  border-radius: 22px;
  background: #0f172a;
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.profile-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid #334155;
  background: #111827;
}
.profile-dialog-header h2 { margin: 0; font-size: 20px; }
.profile-dialog-header p { margin: 4px 0 0; opacity: .72; font-size: 13px; }
.profile-modal-body { flex: 1; min-height: 0; background: #0f172a; }
.profile-frame { width: 100%; height: 100%; border: 0; display: block; background: #0f172a; }
@media (max-width: 720px) {
  .profile-modal { padding: 8px; align-items: stretch; }
  .profile-dialog { width: 100%; height: 100%; border-radius: 16px; }
}
