:root {
  --box-width: 800px;
  --base-font-size: 16px;
}

/* Grundlayout */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: #e9ecf1;
  background: linear-gradient(180deg, #0b1020, #0f162a 60%, #0a0e17);
  display: flex;
  justify-content: center;
  padding: 2px;
}

img:not([src]),
img[src=""] {
  display: none;
}

/* zentrale Breite */
.wrap {
  width: var(--box-width);
  max-width: 100%;
  display: grid;
  gap: 2px;
  transition: width 0.2s ease;
}

/* Cards */
.card {
  background: transparent;
  border: 1px solid rgba(122, 148, 255, 0.18);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: saturate(120%) blur(8px);
  -webkit-backdrop-filter: saturate(120%) blur(8px);
  position: relative;
  overflow: hidden;
  padding: 10px;
}
.card:before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(1200px 200px at 50% -10%, rgba(122, 162, 255, 0.07), transparent 60%);
}

/* ===== SCHMALERE TOOLBAR-BUTTONS ===== */
.toolbar {
  display: flex;
  gap: 2px;
  align-items: stretch;
  overflow: hidden;
}

/* Allgemeine Button-Stile */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-overflow: ellipsis;
  background: linear-gradient(180deg, #1b2340, #1a2950 160%);
  border: 1px solid rgba(122, 162, 255, 0.28);
  color: #e9ecf1;
  border-radius: 8px;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 2px 4px;
  text-align: center;
  line-height: 1;
  font-size: 11px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease, border-color 0.2s ease;
  min-height: 24px;
}

/* Speziell für die obere Toolbar - EXTRA SCHMAL */
.card:first-child .toolbar .btn {
  padding: 1px 3px !important;
  min-height: 28px !important;
  font-size: 10px !important;
  line-height: 1 !important;
  border-radius: 6px !important;
}

/* Aktiv- oder Fokuszustand – für ALLE Buttons */
.btn:active,
.btn:focus-visible,
.btn.active {
  color: #fff !important;
  background: linear-gradient(180deg, #2c66ff, #1a5bff 60%) !important;
  border-color: rgba(122, 162, 255, 0.4) !important;
  box-shadow: 0 0 8px rgba(26, 91, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

/* Icons in den Buttons anpassen */
.toolbar .btn .icon {
  width: 12px !important;
  height: 12px !important;
}

/* Noch kompakter für sehr kleine Buttons */
.card:first-child .toolbar .btn .icon {
  width: 10px !important;
  height: 10px !important;
}

/* Garantie für schmale Buttons */
.card:first-child .toolbar {
  min-height: 26px !important;
  padding: 1px !important;
}

/* Composer */
.composer {
  display: flex;
  gap: 2px;
  margin-top: 2px;
}
.composer #message {
  flex: 1;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid rgba(122, 162, 255, 0.28);
  background: linear-gradient(180deg, #0d1324, rgba(0, 0, 0, 0.02));
  color: #e9ecf1;
  font-size: 15px;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}
.composer #message::placeholder {
  color: #aab2c5;
}
#sendBtn {
  border: none;
  color: #fff;
  font-weight: 700;
  border-radius: 10px;
  padding: 3px;
  cursor: pointer;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 18px rgba(26, 91, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
#sendBtn:hover {
  filter: saturate(110%);
}
#sendBtn:active {
  transform: translateY(1px);
}

/* === MAIN (immer 600px hoch!) === */
.main {
  position: relative;
  height: 600px;
  overflow: hidden;
  background: transparent;
  color: #fff;
  transition: background 0.3s ease;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* ===== GRID LAYOUT ANPASSUNGEN ===== */
.grid {
  display: grid;
  grid-template-columns: 2fr 1.0fr;
  gap: 2px;
  height: 100%;
  transition: grid-template-columns 0.3s ease;
}

/* 2. DESKTOP-ANSICHT (SWITCHER-AKTIV: 2fr 0.5fr) - MIT HINTERGRUND */
main.desktopSwitcher .grid {
  grid-template-columns: 2fr 0.5fr;
}

/* DESKTOP HINTERGRUNDBILD NUR BEI AKTIVEM SWITCHER */
main.desktopSwitcher .main {
  background-image: url('https://new-generation-of-chat.eu/test/templates/image/3iddde%20zu%20m%20hg%20.png');
}

/* 3. RESPONSIVE ANPASSUNGEN */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: 2fr 1fr;
  }
}

/* ===== MOBIL LAYOUT ===== */
@media (max-width: 800px) {
  .main {
    background-image: url('https://leih-dir-einen.eu/templates/w_p_action_action/tuesday.jpg') !important;
  }
  
  main.desktopSwitcher .main {
    background-image: url('https://leih-dir-einen.eu/templates/w_p_action_action/tuesday.jpg') !important;
  }
}

@media (max-width: 550px) {
  .grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    gap: 2px;
  }

  .pane:last-child {
    max-height: 120px;
    order: 2;
    display: none !important;
  }

  .messages {
    order: 1;
  }

  main.show-userlist .pane:last-child {
    display: block !important;
    height: 100%;
    max-height: none !important;
    order: 1;
  }

  main.show-userlist .messages {
    display: none !important;
  }

  main.show-userlist .grid {
    grid-template-rows: 1fr;
  }
}

.pane {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.12));
  border: 1px solid rgba(122, 148, 255, 0.14);
  border-radius: 8px;
  overflow: auto;
  padding: 3px;
}

/* Nachrichten-Container */
.messages {
  font-size: var(--base-font-size);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
  padding-right: 2px;
  scroll-behavior: smooth;
  box-sizing: border-box;
}

/* Einzelne Nachricht */
.msg {
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 2px;
  background-color: transparent;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}

/* Audio bar */
.audio-bar {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 3px;
  height: 14px;
  display: flex;
  align-items: center;
}

/* === Hintergrund (Track) mit festen Segment-Strichen === */
.audio-bar .track {
  position: relative;
  width: 100%;
  height: 100%;
  background: transparent;
  border: 1px solid rgba(122, 148, 255, 0.18);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 22px;
}

.audio-bar .track::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent calc((100% / 24) - 1px),
      rgba(0, 0, 0, 0.4) calc((100% / 24) - 1px),
      rgba(0, 0, 0, 0.4) calc(100% / 24)
    );
  border-radius: inherit;
}

.audio-bar .track::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.15), transparent 60%);
  mix-blend-mode: screen;
  opacity: 0.3;
  pointer-events: none;
  border-radius: inherit;
  z-index: 4;
}

/* === Progress/VU-Balken (darunter, bewegt sich) === */
.audio-bar .progress {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform: scaleX(var(--vu-level, 0));
  transition: transform 60ms linear;
  will-change: transform;
  background: linear-gradient(
    90deg,
    #16a34a 0%,
    #22c55e 30%,
    #eab308 60%,
    #f97316 80%,
    #ef4444 100%
  );
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
  border-radius: inherit;
  z-index: 2;
}

/* sanfter "Atmungs"-Effekt beim Spielen */
.audio-bar .progress.vu-playing {
  animation: vu-breathe 1.4s ease-in-out infinite alternate;
}
@keyframes vu-breathe {
  0% {
    filter: brightness(1) saturate(1);
  }
  100% {
    filter: brightness(1.15) saturate(1.15);
  }
}

/* Für Nutzer mit weniger Bewegung */
@media (prefers-reduced-motion: reduce) {
  .audio-bar .progress {
    transition: none;
  }
  .audio-bar .progress.vu-playing {
    animation: none;
  }
}

/* ===== USER LIST - FIX FÜR WENIGE USER ===== */
#userList {
  display: flex !important;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  gap: 2px;
}

.user {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 2px;
  align-items: center;
  padding: 3px;
  border-radius: 10px;
  background-color: transparent;
  min-height: 24px;
  flex-shrink: 0; /* Verhindert Schrumpfen */
}

.user:hover {
  background: rgba(122, 162, 255, 0.08);
}
.user.muted {
  opacity: 0.55;
}

/* Garantie für gleichmäßige Abstände unabhängig von der User-Anzahl */
.pane:last-child {
  display: flex;
  flex-direction: column;
}

/* Scrollverhalten korrigieren */
.pane:last-child {
  overflow-y: auto;
  max-height: 100%;
}

/* Mobile Anpassung */
@media (max-width: 550px) {
  #userList {
    gap: 1px;
  }
  
  .user {
    min-height: 28px;
    grid-template-columns: auto 1fr;
  }
  
  .user .icon-btn {
    display: none;
  }
}

/* Icons */
.emoji-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.icon-btn {
  cursor: pointer;
  border: 1px solid rgba(122, 148, 255, 0.25);
  border-radius: 10px;
  padding: 3px;
  background: linear-gradient(180deg, #1b2340, #1a2950 150%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}
.icon-btn:hover {
  background: linear-gradient(180deg, #223056, #1a2950);
}
.icon {
  width: 18px;
  height: 18px;
}
.icon path {
  fill: currentColor;
}

/* Scrollbars */
.pane::-webkit-scrollbar {
  height: 12px;
  width: 12px;
}
.pane::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(122, 162, 255, 0.35), rgba(122, 162, 255, 0.25));
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}

/* === Audio Player Skin === */
.player-card {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 2px;
  background: transparent;
  border: 1px solid rgba(122, 148, 255, 0.18);
  border-radius: 12px;
  padding: 3px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  align-items: stretch;
}
.player-cover {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: none;
}
.player-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 10px;
  box-shadow: none;
}
.player-body {
  display: grid;
  gap: 2px;
  align-content: center;
}
.player-title {
  text-align: right;
  color: #dbe2ee;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-controls {
  display: grid;
  grid-template-columns: auto auto 1fr auto auto auto;
  gap: 2px;
  align-items: center;
}
.player-play {
  width: 32px;
  height: 32px;
  padding: 3px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
  background: linear-gradient(180deg, #252c3a, #1c2332);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 2px 8px rgba(0, 0, 0, 0.25);
}
.player-play:active {
  transform: translateY(1px);
}
.player-time {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: #c7cfdf;
  opacity: 0.9;
}
.player-timeline {
  height: 8px;
  border-radius: 999px;
  background: #2a3140;
  overflow: hidden;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.35);
}
.player-timeline__bar {
  width: 35%;
  height: 100%;
  background: linear-gradient(90deg, #3a465a, #6aa0ff);
  box-shadow: 0 0 14px rgba(122, 162, 255, 0.35) inset;
}
.player-volume {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 120px;
}
.player-volicon {
  opacity: 0.85;
}
.player-volume input[type="range"] {
  accent-color: #1e90ff;
  width: 120px;
  height: 4px;
}
.player-now {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-top: 3px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
  overflow: hidden;
  position: relative;
}
.player-now .note {
  color: #ff5a7c;
}
.player-now strong {
  color: #ffd5de;
  font-weight: 700;
}
.player-now b {
  color: #ffffff;
}
.scroll-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  position: relative;
  line-height: 1.2;
}
.scroll-text span {
  display: inline-block;
  white-space: nowrap;
  padding-right: 2rem;
  animation: marquee-loop 15s linear infinite;
}
.scroll-text:hover span {
  animation-play-state: paused;
}

@keyframes vu-stripes {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 40px 0;
  }
}

.layout-placed {
  position: absolute !important;
  box-sizing: border-box;
  transition: all 0.2s ease;
}
.layout-placed::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.btn.layout-placed {
  color: transparent !important;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
.btn.layout-placed.active {
  background: rgba(0, 0, 0, 0.4) !important;
  border-color: rgba(0, 0, 0, 0.4) !important;
}

.nodisplay,
.main.absolute-layout .grid,
.main.absolute-layout .audio-bar:not(.layout-placed) {
  display: none;
}

/* Bonus: Zähler leicht hervorheben, wenn > 0 */
#shoutcastBtn.active,
#userAllBtn.active {
  filter: saturate(120%);
}

/* Keyframes werden dynamisch gesetzt; Name muss existieren */
@keyframes marquee-loop {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}

/* Wird nur aktiv, wenn setup() aktiv ist */
.layout-editing [data-editable] {
  position: absolute;
  outline: 2px dashed rgba(0, 120, 255, 0.7);
  background-color: rgba(0, 100, 255, 0.05);
  transition: outline-color 0.2s ease;
}

.layout-editing [data-editable] .draggable {
  cursor: move;
  user-select: none;
}
.layout-editing [data-editable] .resize-handle {
  pointer-events: auto;
}

/* ====== STYLE EDITOR PANEL ====== */
#sidebar .layout-style-editor[data-panel] {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  box-sizing: border-box;
  padding: 3px;
  background: #fafafa;
  border-left: 1px solid #e2e2e2;
  box-shadow: -3px 0 12px rgba(0, 0, 0, 0.05);
  overflow-y: auto;
  font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

/* ====== HEAD / SELECT-BEREICH ====== */
#sidebar .layout-style-editor .lse-title {
  color: black;
}
#sidebar .layout-style-editor .lse-select-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 16px;
}

#sidebar .layout-style-editor .lse-select-wrap > label {
  font-size: 12px;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#sidebar .layout-style-editor .lse-select {
  width: 100%;
  padding: 3px;
  border: 1px solid #dcdcdc;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#sidebar .layout-style-editor .lse-select:focus {
  border-color: #2684ff;
  box-shadow: 0 0 0 2px rgba(38, 132, 255, 0.2);
  outline: none;
}

/* ====== ROW-KARTEN ====== */
#sidebar .layout-style-editor .lse-row {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.2s, transform 0.2s;
}

#sidebar .layout-style-editor .lse-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

/* ====== ROW-HEAD ====== */
#sidebar .layout-style-editor .lse-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

#sidebar .layout-style-editor .lse-row-name {
  font-weight: 600;
  font-size: 14px;
  color: #333;
}

#sidebar .layout-style-editor .lse-row-head button {
  background: #f3f3f3;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 12px;
  padding: 3px;
  cursor: pointer;
  transition: background 0.2s;
}

#sidebar .layout-style-editor .lse-row-head button:hover {
  background: #e8e8e8;
}

/* ====== GRID / CONTROLS ====== */
#sidebar .layout-style-editor .lse-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Label + Input vertikal */
#sidebar .layout-style-editor .lse-grid > label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#sidebar .layout-style-editor .lse-grid > label > span {
  font-size: 12px;
  color: #666;
}

/* Inputs allgemein */
#sidebar .layout-style-editor .lse-grid input[type="number"],
#sidebar .layout-style-editor .lse-grid input[type="url"],
#sidebar .layout-style-editor .lse-grid input[type="text"] {
  width: 100%;
  padding: 3px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}

#sidebar .layout-style-editor .lse-grid input:focus {
  border-color: #2684ff;
  box-shadow: 0 0 0 2px rgba(38, 132, 255, 0.15);
  outline: none;
}

/* Color Inputs */
#sidebar .layout-style-editor .lse-grid input[type="color"] {
  width: 100%;
  height: 38px;
  padding: 3px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

/* Buttons unter Inputs (z. B. Open / Clear) */
#sidebar .layout-style-editor .lse-grid > label button {
  margin-top: 2px;
  padding: 3px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #f9f9f9;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

#sidebar .layout-style-editor .lse-grid > label button:hover {
  background: #f1f1f1;
}

/* Fokus & Hover states */
#sidebar .layout-style-editor input:focus,
#sidebar .layout-style-editor select:focus,
#sidebar .layout-style-editor button:focus {
  outline: none;
}

/* ====== Scrollbar (modern, dezent) ====== */
#sidebar .layout-style-editor[data-panel]::-webkit-scrollbar {
  width: 8px;
}
#sidebar .layout-style-editor[data-panel]::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}
#sidebar .layout-style-editor[data-panel]::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.3);
}

/* ===== RESPONSIVE ANPASSUNGEN FÜR SCHMALE BUTTONS ===== */
@media (max-width: 650px) {
  .card:first-child .toolbar .btn {
    padding: 1px 2px !important;
    min-height: 20px !important;
    font-size: 9px !important;
  }
  
  .card:first-child .toolbar .btn .icon {
    width: 9px !important;
    height: 9px !important;
  }
  
  .toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    overflow-x: visible;
    padding-bottom: 0;
    justify-content: flex-start;
  }

  .btn {
    padding: 2px 3px;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: calc(25% - 2px);
    text-align: center;
    line-height: 1;
    height: auto;
    min-height: 24px;
  }
}

@media (max-width: 550px) {
  .main {
    height: 500px;
  }

  .composer {
    flex-direction: column;
    gap: 2px;
  }

  .composer #message {
    min-height: 40px;
  }

  #sendBtn {
    padding: 3px;
    font-size: 14px;
    width: 100%;
  }

  .audio-bar {
    display: none !important;
  }
}

@media (max-width: 450px) {
  body {
    padding: 2px;
  }

  .wrap {
    gap: 2px;
  }

  .card {
    padding: 2px;
    border-radius: 8px;
  }

  .main {
    height: 450px;
  }

  .toolbar {
    gap: 1px;
  }

  .btn {
    padding: 1px 2px;
    font-size: 9px;
    border-radius: 5px;
    min-width: calc(25% - 1px);
    flex: 1;
    min-height: 28px;
    white-space: normal;
    word-break: break-word;
    line-height: 1;
  }

  .card .toolbar .btn {
    min-width: calc(25% - 1px) !important;
    font-size: 9px !important;
    padding: 1px 2px !important;
    min-height: 28px !important;
  }

  .card:first-child .toolbar .btn {
    padding: 0px 1px !important;
    min-height: 18px !important;
    font-size: 8px !important;
  }
  
  .card:first-child .toolbar {
    min-height: 28px !important;
  }

  .toolbar .btn:nth-child(1),
  .toolbar .btn:nth-child(2),
  .toolbar .btn:nth-child(3),
  .toolbar .btn:nth-child(4),
  .toolbar .btn:nth-child(5),
  .toolbar .btn:nth-child(6),
  .toolbar .btn:nth-child(7),
  .toolbar .btn:nth-child(8),
  .toolbar .btn:nth-child(9) {
    font-size: 8px;
    padding: 1px;
  }

  .msg {
    padding: 2px;
    margin-bottom: 1px;
    font-size: 13px;
  }

  .user {
    padding: 2px;
    grid-template-columns: auto 1fr;
    gap: 1px;
  }

  .user .icon-btn {
    display: none;
  }

  .audio-bar {
    left: 2px;
    right: 2px;
    bottom: 2px;
  }

  .icon-btn {
    width: 24px;
    height: 24px;
    padding: 2px;
  }

  .icon {
    width: 12px;
    height: 12px;
  }

  .composer #message {
    font-size: 14px;
    padding: 2px;
  }
}

/* Extra kleine Displays unter 380px */
@media (max-width: 380px) {
  .main {
    height: 420px;
  }

  .toolbar {
    gap: 1px;
  }

  .btn {
    min-width: calc(25% - 1px);
    padding: 1px;
    font-size: 8px;
    min-height: 20px;
  }

  .card .toolbar .btn {
    min-width: calc(25% - 1px) !important;
    font-size: 8px !important;
    padding: 1px !important;
    min-height: 20px !important;
  }

  .card:first-child .toolbar .btn {
    padding: 0px 1px !important;
    min-height: 16px !important;
    font-size: 7px !important;
  }

  .toolbar .btn:nth-child(1),
  .toolbar .btn:nth-child(3),
  .toolbar .btn:nth-child(8),
  .toolbar .btn:nth-child(9) {
    font-size: 7px;
    padding: 0px;
  }

  .grid {
    gap: 1px;
  }

  .pane:last-child {
    max-height: 100px;
  }
}

/* Sehr kleine Displays unter 320px */
@media (max-width: 320px) {
  .main {
    height: 400px;
  }

  .toolbar {
    gap: 1px;
  }

  .btn {
    min-width: calc(50% - 1px);
    font-weight: 700;
    padding: 1px;
    font-size: 9px;
    min-height: 20px;
  }

  .card .toolbar .btn {
    min-width: calc(50% - 1px) !important;
    font-size: 9px !important;
    padding: 1px !important;
    min-height: 20px !important;
  }
}

/* Garantie dass ALLE Buttons gleich groß sind und Abstand haben */
.card .toolbar {
  display: flex !important;
  flex-wrap: wrap !important;
}

.card .toolbar .btn {
  flex: 1 !important;
  text-align: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Zusätzlicher visueller Abstand durch leichte Schatten */
@media (max-width: 650px) {
  .btn {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(122, 162, 255, 0.2);
  }
}

.btn,
.btn:hover,
.btn:active,
.btn:focus-visible,
.btn.active,
#sendBtn {
  font-weight: 700 !important;
}

/* Korrektur der spezifischen Media Query */
@media (max-width: 320px) {
  .btn {
    font-weight: 700 !important;
  }

  .card .toolbar .btn {
    font-weight: 700 !important;
  }
}

#liveBtn, #chatbotBtn,#hgBtn,#mitgliedBtn,.msg.muted,.footer{ 
  display: none !important; 
}

/* Extra kleine Displays unter 380px */
@media (max-width: 380px) {
  .main {
    height: 420px;
  }

  .toolbar {
    gap: 1px;
    padding-bottom: 2px; /* Mehr Platz für Interaktion */
  }

  .btn {
    min-width: calc(33.333% - 1px); /* 3 Buttons pro Reihe statt 4 */
    padding: 2px 1px;
    font-size: 8px;
    min-height: 24px; /* Höhere Buttons für bessere Bedienbarkeit */
  }

  /* Garantiere, dass Login-Button immer sichtbar ist */
  .toolbar .btn:nth-last-child(-n+3) {
    background: rgba(44, 102, 255, 0.15); /* Hervorhebung für wichtige Buttons */
    border-color: rgba(122, 162, 255, 0.3);
  }

  /* Player auf wesentliche Elemente reduzieren */
  .player-card {
    grid-template-columns: 60px 1fr; /* Kleinere Cover-Größe */
    gap: 1px;
    padding: 2px;
  }

  .player-controls {
    grid-template-columns: auto 1fr auto; /* Nur Play-Button, Timeline, Volume */
    gap: 1px;
  }

  .player-time,
  .player-now,
  .player-volicon:not(.icon) {
    display: none !important; /* Nur essenzielle Elemente anzeigen */
  }

  .player-volume {
    min-width: 60px;
  }

  .player-volume input[type="range"] {
    width: 60px;
  }

  .player-play {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
}

/* Sehr kleine Displays unter 320px */
@media (max-width: 320px) {
  .main {
    height: 380px;
  }

  .toolbar {
    gap: 1px;
  }

  .btn {
    min-width: calc(50% - 1px); /* 2 Buttons pro Reihe */
    padding: 3px 1px;
    font-size: 9px;
    min-height: 26px;
  }

  /* Wichtige Buttons hervorheben */
  #loginBtn, 
  #settingsBtn {
    background: linear-gradient(180deg, #2c66ff, #1a5bff 60%) !important;
    border-color: rgba(122, 162, 255, 0.5) !important;
    z-index: 2;
  }

  /* Player noch weiter vereinfachen */
  .player-card {
    grid-template-columns: 50px 1fr;
  }

  .player-controls {
    grid-template-columns: auto 1fr; /* Nur Play-Button und Timeline */
  }

  .player-volume {
    display: none !important;
  }

  .player-title {
    font-size: 12px;
  }
}

/* Extrem kleine Displays unter 280px */
@media (max-width: 280px) {
  .main {
    height: 350px;
  }

  .btn {
    min-width: 100%; /* 1 Button pro Reihe - vertikales Layout */
    margin-bottom: 1px;
    min-height: 28px;
    font-size: 10px;
  }

  /* Login-Button immer oben positionieren */
  #loginBtn {
    order: -1; /* Ganz nach oben */
    background: linear-gradient(180deg, #2c66ff, #1a5bff 60%) !important;
    border-color: rgba(122, 162, 255, 0.6) !important;
    box-shadow: 0 0 10px rgba(26, 91, 255, 0.4) !important;
  }

  .player-card {
    grid-template-columns: 1fr; /* Vertikales Layout für Player */
  }

  .player-cover {
    height: 80px;
    width: 80px;
    margin: 0 auto;
  }
}

/* Zusätzliche Garantie für sichtbare Buttons */
.toolbar {
  position: relative;
  z-index: 10;
}

/* Touch-Optimierung für sehr kleine Displays */
@media (max-width: 380px) and (max-height: 600px) {
  .btn {
    min-height: 28px;
    padding: 4px 2px;
  }
  
  /* Größerer Touch-Bereich für wichtige Aktionen */
  #loginBtn {
    min-height: 32px;
  }
}