* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background: #111;
    color: white;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

#video-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
}

video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#waiting-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    padding: 1rem 2rem;
    border-radius: 4px;
    color: #0f0;
    font-size: 1.2rem;
    display: none;
    z-index: 10;
}

/* Botón de chat (siempre visible a la izquierda abajo) */
#chat-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 255, 0, 0.3);
    border: 2px solid #0f0;
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 8px;
}

#chat-button:hover {
    background: rgba(0, 255, 0, 0.5);
}

#chat-button .badge {
    background: #00ff00;
    color: #000;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.3s;
}

#chat-badge.hidden {
    display: none;
}

/* Panel de chat */
#chat-panel {
    position: fixed;
    background: rgba(20, 20, 20, 0.4);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 25;
}

@media (min-width: 768px) {
    #chat-panel {
        top: 0;
        right: 0;
        height: 100%;
        border-left: 2px solid #0f0;
        transform: translateX(100%);
    }
    #chat-panel.open {
        transform: translateX(0);
    }
    #chat-panel {
        width: 20%;
        min-width: 280px;
    }
}

@media (max-width: 767px) {
    #chat-panel {
        bottom: 0;
        left: 0;
        width: 100%;
        height: 50%;
        border-top: 2px solid #0f0;
        transform: translateY(100%);
    }
    #chat-panel.open {
        transform: translateY(0);
    }
    #video-wrapper {
        align-items: flex-start;
    }
}

#chat-header {
    padding: 15px;
    background: rgba(0, 255, 0, 0.2);
    border-bottom: 1px solid #0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-badge {
    background: #0088ff;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    margin-left: 5px;
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message {
    padding: 8px 12px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(1px);
    align-self: flex-start;
}

.message.own {
    background: rgba(0, 255, 0, 0.2);
    align-self: flex-end;
}

.message.admin {
    border-left: 3px solid #ffaa00;
}

.message .sender {
    font-size: 0.8rem;
    color: #0f0;
    margin-bottom: 2px;
}

.message.admin .sender {
    color: #ffaa00;
}

.message .time {
    font-size: 0.7rem;
    color: #aaa;
    margin-top: 2px;
    text-align: right;
}

#chat-input-area {
    padding: 15px;
    background: rgba(0, 0, 0, 0.5);
    border-top: 1px solid #0f0;
    display: flex;
    gap: 10px;
}

#chat-input {
    flex: 1;
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border: 1px solid #0f0;
    color: white;
    border-radius: 8px;
    outline: none;
}

#chat-send {
    background: rgba(0, 255, 0, 0.3);
    border: 2px solid #0f0;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
}

/* Modal de nombre */
#name-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.name-box {
    background: #222;
    padding: 2rem;
    border-radius: 8px;
    border: 2px solid #0f0;
    text-align: center;
}

.name-box input {
    padding: 10px;
    margin: 20px 0;
    width: 200px;
    background: #333;
    border: 1px solid #0f0;
    color: white;
    border-radius: 8px;
}

.name-box button {
    padding: 10px 20px;
    background: #0f0;
    border: none;
    color: black;
    cursor: pointer;
    border-radius: 8px;
}

.error {
    color: #f44;
}

/* Botón de administrador (ahora a la izquierda, encima del botón de chat) */
#admin-button {
    position: fixed;
    bottom: 80px; /* 20px (chat) + altura del botón (aprox 50px) + 10px de separación */
    left: 20px;
    background: rgba(255, 165, 0, 0.3);
    border: 2px solid orange;
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    z-index: 30;
    display: none;
    align-items: center;
    gap: 8px;
}

#admin-button.visible {
    display: flex;
}

#admin-button:hover {
    background: rgba(255, 165, 0, 0.5);
}

/* Panel de usuarios activos (ahora a la izquierda, encima del botón de admin) */
#users-panel {
    position: fixed;
    bottom: 140px; /* 80px (admin) + altura del botón (aprox 50px) + 10px */
    left: 20px;
    width: 250px;
    max-height: 300px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 2px solid orange;
    border-radius: 12px;
    color: white;
    padding: 10px;
    overflow-y: auto;
    z-index: 35;
    display: none;
}

#users-panel.show {
    display: block;
}

#users-panel h4 {
    margin: 0 0 10px 0;
    color: orange;
    text-align: center;
}

#users-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#users-list li {
    padding: 5px;
    border-bottom: 1px solid #555;
}

#users-list li:last-child {
    border-bottom: none;
}