:root {
  --bg-darkest: #1e2124;
  --bg-dark: #2c2f33;
  --bg-mid: #23272a;
  --bg-light: #36393f;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --danger: #ed4245;
  --danger-hover: #c93639;
  --text-normal: #dcddde;
  --text-muted: #96989d;
  --green: #3ba55d;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-mid);
  color: var(--text-normal);
  height: 100vh;
  overflow: hidden;
}

.hidden { display: none !important; }

.screen { height: 100vh; width: 100vw; }

/* ---------- Экран входа ---------- */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #23272a, #2c2f33);
}
.login-box {
  background: var(--bg-dark);
  padding: 40px;
  border-radius: var(--radius);
  text-align: center;
  width: 340px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.login-box h1 { margin: 0 0 8px; color: #fff; }
.login-box p { color: var(--text-muted); margin-bottom: 20px; font-size: 14px; }
.login-box input {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius);
  border: none;
  background: var(--bg-mid);
  color: var(--text-normal);
  margin-bottom: 16px;
  font-size: 15px;
}
.login-box button {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  font-weight: 600;
}
.login-box button:hover { background: var(--accent-hover); }

/* ---------- Основной экран ---------- */
#app-screen {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--bg-dark);
  padding: 16px 12px;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-section { margin-bottom: 28px; }
.sidebar-section h2 {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  margin: 0 0 10px 4px;
}

#voice-controls { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.btn {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: none;
  background: var(--bg-light);
  color: var(--text-normal);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  transition: background 0.15s;
}
.btn:hover { background: #40444b; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn.active { background: var(--green); color: #fff; }

.user-list { list-style: none; margin: 0; padding: 0; }
.user-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--text-normal);
}
.user-list li .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); flex-shrink: 0;
}
.user-list li .muted-icon { margin-left: auto; opacity: 0.7; font-size: 12px; }
.user-list li .sharing-icon { margin-left: auto; font-size: 12px; }

/* ---------- Область чата ---------- */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-light);
  min-width: 0;
}

.screens-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  padding: 10px;
}
.screens-grid:empty { display: none; }
.screen-tile {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.screen-tile video { width: 100%; display: block; max-height: 320px; object-fit: contain; background: #000; }
.screen-tile .label {
  position: absolute; bottom: 6px; left: 8px;
  background: rgba(0,0,0,0.6); padding: 2px 8px; border-radius: 4px; font-size: 12px;
}

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.message {
  margin-bottom: 12px;
  line-height: 1.4;
  word-wrap: break-word;
}
.message .author { font-weight: 600; color: #fff; margin-right: 8px; }
.message .time { font-size: 11px; color: var(--text-muted); margin-left: 6px; }
.message .text { color: var(--text-normal); }
.message.system { color: var(--text-muted); font-style: italic; font-size: 13px; }

.chat-form {
  display: flex;
  padding: 16px 20px 20px;
  gap: 10px;
}
.chat-form input {
  flex: 1;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: none;
  background: var(--bg-mid);
  color: var(--text-normal);
  font-size: 14px;
}
.chat-form button { flex-shrink: 0; }

/* Стили для списков пользователей */
#user-list, #voice-user-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 12px;
    max-height: 250px;
    overflow-y: auto;
}

.user-item {
    transition: background 0.2s;
}

.user-item:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Красивый скроллбар */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}
/* Скроллбар */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: var(--bg-darkest); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
