/* ================================
   Neon Theme + Layout (Original & Desktop Fixes)
   ================================ */
:root{
   --bg:#050708;
   --panel:#0b1012;
   --text:#e6ffe6;
   --muted:#9bd09b;
   --accent:#00ff00;
   --accent-dark:#00a300;
   --stroke:rgba(0,255,0,.25);
   --backgroundImage : url('../bg.jpg');
}

/* Base / Page stretch */
*{ box-sizing:border-box; }
html, body{ height:100%; }
body{
   margin:0;
   font-family: system-ui,Segoe UI,Roboto,Arial;
   background:
     radial-gradient(1200px 600px at 20% -10%, rgba(0,255,0,.08), transparent 60%),
     var(--bg);
   color:var(--text);

   /* stretch layout: header on top, main fills rest */
   display:flex;
   flex-direction:column;
}

/* ================================
   Header (Player über volle Breite)
   ================================ */
.app-header{
   width:100%;
   min-height:120px;
   background:linear-gradient(180deg,#0f1719,#0b1012);
   border-bottom:1px solid var(--stroke);
   box-shadow:0 6px 30px rgba(0,255,0,.08);
   position:relative;
   z-index:10;
   padding:0;
}

.header-player,
.header-player .wrapper{
   width:100%;
   height:100%;
}

.header-player .content{
   display:flex;
   align-items:center;
   justify-content:space-between;
   height:100%;
   padding:0 16px;
   gap:12px;
}
.header-player .header{
   display:flex;
   align-items:center;
   gap:10px;
   position:relative;
   top:0;
}
.header-player .controls{
   display:flex;
   align-items:center;
   gap:12px;
   padding:6px 16px;
}

/* Buttons im Header */
.control-button{
   background:transparent;
   border:none;
   color:var(--text);
   font-size:20px; /* Explizite Größe für Desktop */
   cursor:pointer;
}
.control-button:hover{ transform: translateY(-1px); }
.control-button:focus-visible{
   outline:2px solid var(--accent);
   outline-offset:2px;
}

#volumeControl{
   width:120px;
   accent-color: var(--accent);
}

.hero, .hero::after{ pointer-events:none; }
.content, .controls{ pointer-events:auto; position:relative; z-index:2; }

/* ================================
   Main / Grid (Desktop 2-Spalten)
   ================================ */
main#app{
   flex:1 1 auto;
   display:grid;
   grid-template-columns: 1fr 200px; 
   grid-template-rows: 1fr auto; 
   gap:16px;
   padding:16px;
   min-height:0;
}

.panel{
   background:linear-gradient(180deg,#0a0f11,#0b0f10);
   border:1px solid rgba(255,255,255,.05);
   border-radius:16px;
   box-shadow:0 10px 40px rgba(0,0,0,.55), inset 0 0 0 1px rgba(0,255,0,.05);
}

/* Sidebar: Desktop Positionierung (im Grid sichtbar) */
.sidebar {
   grid-column: 2;
   grid-row: 1 / span 2;
   display:flex;
   flex-direction:column;
   padding:12px;
   overflow-y:auto; 
   z-index:20;
}

/* ================================
   Chatbox, Messages & Composer
   ================================ */
.chatbox{
   position: relative;
   overflow: hidden; 
   display: flex;
   flex-direction: column;
   min-height: 0;
}

.chatbox::before{
   content: "";
   position: absolute; inset: 0;
   background-image: var(--backgroundImage);
   background-repeat: no-repeat;
   background-position: center center; 
   background-size: 100% 100%;
   opacity: .30;
   filter: saturate(120%) contrast(110%);
   pointer-events: none;
}

#messages{
   --msg-zoom: 1; 
   flex: 1 1 auto;
   min-height: 0;
   overflow: auto; 
   padding: 16px;
   scroll-behavior: smooth;
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,.04); border-radius: 8px; }
::-webkit-scrollbar-thumb { background: rgba(0,255,0,.25); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,255,0,.35); }

/* Chat-Nachrichten Container */
.chat-message {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 1rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: calc(1rem * var(--msg-zoom));
    backdrop-filter: blur(2px); /* „Glas“ nur hinter der Message */
}

.msg-bold { font-weight: 700; }
.msg-italic { font-style: italic; }
.msg-underline {
   text-decoration: underline;
   text-underline-offset: 3px;
}

.composer{
   padding:12px;
   background:#0a0f10;
   display:grid;
   gap:8px;
}
.row{ display:flex; gap:8px; align-items:center; }
.row > *{ flex:1; }

input[type="text"], input[type="color"], button{
   border:1px solid rgba(0,255,0,.18);
   background:#0a0f10;
   color:var(--text);
   border-radius:12px;
   padding:10px 12px;
   outline:none;
   box-shadow: inset 0 0 20px rgba(0,255,0,.05);
}

button{ cursor:pointer; transition: transform .04s ease; }
button:active{ transform: translateY(1px); }

.primary{
   background: linear-gradient(180deg, var(--accent), var(--accent-dark));
   color:#031103; border:none; font-weight:900;
   text-shadow:0 1px 0 rgba(255,255,255,.15);
   box-shadow:0 8px 30px rgba(0,255,0,.25);
}

.toolbar{
   display:flex;
   gap:8px;
   flex-wrap:wrap;
}

.textSend{
   display:flex;
   gap:8px;
   align-items:center;
}

.textSend input{
    /* FIX: Auf Desktop füllt der Input den restlichen Platz */
    flex-grow: 1;
    width: auto; 
}

.pill{
   display:inline-block;
   background:#061012;
   padding:6px 10px;
   border-radius:99px;
   margin:4px 0;
   border:1px solid rgba(0,255,0,.18);
   box-shadow: inset 0 0 10px rgba(0,255,0,.08);
}
.pill.active{
   outline:2px solid rgba(0,255,0,.7);
   box-shadow:0 0 14px rgba(0,255,0,.35), inset 0 0 10px rgba(0,255,0,.1);
}

/* Login Panel & Utility */
.login{ max-width:460px; margin: 16px auto; padding:16px; }
.hidden{ display:none !important; }

/* ================================
   Emoji Popup
   ================================ */
.emoji-popup{
   position:fixed;
   top:0; left:0;
   width:240px; 
   max-height:50vh; 
   overflow:auto;
   background:#0a0f10;
   border:1px solid rgba(0,255,0,.25);
   border-radius:12px;
   box-shadow:0 8px 24px rgba(0,0,0,.6), 0 0 0 1px rgba(0,255,0,.08) inset;
   padding:8px;
   z-index:9999;
}

.emoji-grid{
   display:grid;
   grid-template-columns: repeat(6, 1fr);
   gap:4px;
}

.emoji-btn{
   font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",system-ui,Segoe UI,Roboto,Arial,sans-serif;
   font-size:20px; 
   line-height:28px;
   width:28px;
   height:28px;
   display:flex;
   align-items:center;
   justify-content:center;
   background:transparent;
   border:none;
   border-radius:6px;
   cursor:pointer;
   transition: transform .08s ease, background-color .08s ease;
   color:inherit;
}
.emoji-btn:hover{
   transform: scale(1.2);
   background: rgba(0,255,0,.1);
}

.emoji-popup, .emoji-popup *{
   filter:none !important;
   mix-blend-mode: normal !important;
}

/* Online-Liste */
.online-list{
   list-style:none;
   margin:0;
   padding:0;
   display:flex;
   flex-direction:column;
   gap:6px;
}

.online-list li{
   display:flex;
   align-items:center;
   gap:8px;
   background:#061012;
   padding:6px 10px;
   border-radius:8px;
   border:1px solid rgba(0,255,0,.18);
   box-shadow: inset 0 0 6px rgba(0,255,0,.08);
   font-size:0.9rem;
}

.status-dot{
   width:10px;
   height:10px;
   border-radius:50%;
   background:var(--accent);
   box-shadow:0 0 6px var(--accent);
}

/* Home-Button */
a.home-btn {
   display: inline-block;
   margin-left: auto;
   padding: 8px 16px;
   background: linear-gradient(180deg, #00ff00, #00a300);
   color: #031103;
   font-weight: 700;
   border-radius: 8px;
   text-decoration: none;
   font-family: system-ui, sans-serif;
   box-shadow: 0 4px 12px rgba(0,255,0,.3);
   transition: background 0.2s, transform 0.1s;
}
a.home-btn:hover {
   background: linear-gradient(180deg, #00cc00, #008800);
   transform: translateY(-1px);
   text-decoration: none;
}
a.home-btn:active {
   transform: translateY(1px);
}

/* Toggle-Button default ausblenden (Desktop),
   wird auf Mobile eingeblendet */
#toggleSidebar {
  display: none;
}

/* ================================
   2. Media Query: Mobile-Layout (max-width: 800px)
   ================================ */
body.is-mobile main#app{
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto; 
}

body.is-mobile .chatbox {
    grid-column: 1;
    grid-row: 1;
    min-height: 40vh;
}

body.is-mobile .composer {
    grid-column: 1;
    grid-row: 2;
}

body.is-mobile .sidebar {
    position: fixed; 
    top: 0;
    right: 0;
    height: 100vh;
    width: 300px; 
    z-index: 20; 
    transform: translateX(100%); 
    transition: transform 0.3s ease-out; 
    background: var(--panel); 
    border-left: 1px solid var(--stroke);
    border-radius: 0; 
    box-shadow: -10px 0 40px rgba(0,0,0,.55), 
                0 0 0 1px rgba(0,255,0,.05) inset;
}

body.is-mobile .sidebar.is-open {
    transform: translateX(0);
}

body.is-mobile #toggleSidebar {
    display: block;
}

/* ================================
   3. Media Query: Small-Handy-Optimierung (max-width: 452px)
   ================================ */
@media (max-width: 452px){
    /* 1. Header-Anpassung: Vertikal stapeln */
    .header-player .content{
        flex-direction: column; 
        align-items: flex-start;
        padding: 8px 16px;
        gap: 8px;
    }
    
    /* 2. Controls über die volle Breite ziehen und rechts ausrichten */
    .header-player .controls{
        width: 100%;
        justify-content: flex-end;
        padding: 0;
    }
    
    /* 3. Composer (Textfeld und Senden-Button) vertikal stapeln */
    .textSend{
        flex-direction: column;
        gap: 6px;
    }
    
    .textSend input{
        width: 100%;
    }
    
    /* 4. Emoji Popup anpassen */
    .emoji-popup{
        width: 200px;
    }
    
    .emoji-grid{
        grid-template-columns: repeat(5, 1fr);
    }
}