:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #181b22;
  --panel-2: #202631;
  --line: #343b49;
  --text: #f6f7fb;
  --muted: #a5adba;
  --blue: #6aa9ff;
  --green: #49d17d;
  --red: #ff6374;
  --yellow: #f2c94c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input { font: inherit; }

button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--blue);
  color: #08111f;
  font-weight: 700;
  cursor: pointer;
}

button:hover { filter: brightness(1.08); }
button:disabled {
  cursor: wait;
  opacity: 0.68;
  filter: none;
}

.app {
  width: min(960px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  align-items: stretch;
  gap: 18px;
}

.app-view {
  min-height: 0;
}

.auth {
  width: min(420px, 100%);
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1, h2, h3 { margin: 0; }
h1 { font-size: clamp(34px, 8vw, 54px); }
h2 { font-size: 26px; }
h3 { font-size: 18px; margin-bottom: 12px; }

.tabs {
  margin: 24px 0 12px;
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.tabs button {
  min-height: 38px;
  background: transparent;
  color: var(--muted);
}

.tabs button.active {
  background: var(--panel-2);
  color: var(--text);
}

.panel, dialog, .hero-panel, .person {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.auth-panel, .dialog-body {
  padding: 18px;
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #11141a;
  color: var(--text);
  outline: none;
}

input { min-height: 46px; }
textarea { resize: vertical; min-height: 120px; }

input[type="file"] { padding: 10px; }
input:focus { border-color: var(--blue); }

.message {
  min-height: 20px;
  margin: 0;
  color: var(--yellow);
}

.hidden { display: none !important; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-nav {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, auto));
  align-items: center;
  justify-content: end;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-logo {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #6aa9ff, #49d17d);
  color: #07111d;
  font-size: 34px;
  font-weight: 900;
}

.brand-lockup .site-logo {
  width: 42px;
  height: 42px;
  font-size: 25px;
}

.auth-title {
  display: grid;
  gap: 8px;
}

.site-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.lobby, .feed, .profile-page {
  width: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 22px;
}

.feed {
  grid-template-rows: auto auto 1fr;
}

.profile-page {
  grid-template-rows: auto;
}

.topbar, .controls, .top-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.top-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  align-items: center;
}

.nav-button {
  min-height: 36px;
  padding: 0 12px;
  background: transparent;
  color: var(--text);
  border-color: var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

.nav-button.active {
  background: var(--panel-2);
  border-color: var(--blue);
}

.logout-button {
  width: 38px;
  min-height: 36px;
  padding: 0;
  background: var(--panel-2);
  color: var(--muted);
  border-color: var(--line);
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  background: currentColor;
  mask: var(--icon) center / contain no-repeat;
  -webkit-mask: var(--icon) center / contain no-repeat;
}

.icon-home { --icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 11.5 12 4l9 7.5V21h-6v-6H9v6H3z'/%3E%3C/svg%3E"); }
.icon-headset { --icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 3a8 8 0 0 0-8 8v5a3 3 0 0 0 3 3h2v-8H6a6 6 0 0 1 12 0h-3v8h2a3 3 0 0 0 3-3v-5a8 8 0 0 0-8-8z'/%3E%3C/svg%3E"); }
.icon-share { --icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18 16.1c-.8 0-1.5.3-2 .8L8.9 12.8a3 3 0 0 0 0-1.6L16 7.1A3 3 0 1 0 15 5l-7.1 4.1a3 3 0 1 0 0 5.8L15 19a3 3 0 1 0 3-2.9z'/%3E%3C/svg%3E"); }
.icon-user { --icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 12a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9zm0 2c-4.4 0-8 2.2-8 5v2h16v-2c0-2.8-3.6-5-8-5z'/%3E%3C/svg%3E"); }
.icon-logout { --icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 3H4v18h6v-3H7V6h3zm3.6 4.4L16.2 10H10v4h6.2l-2.6 2.6L16.4 19 23 12l-6.6-7z'/%3E%3C/svg%3E"); }
.icon-admin { --icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2 4 5v6c0 5 3.4 9.7 8 11 4.6-1.3 8-6 8-11V5zm1 6v3h3v2h-3v3h-2v-3H8v-2h3V8z'/%3E%3C/svg%3E"); }
.icon-sound { --icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 9v6h4l5 4V5L7 9zm13.5 3a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4zm-2.5-9.5v2.2a8 8 0 0 1 0 14.6v2.2a10 10 0 0 0 0-19z'/%3E%3C/svg%3E"); }

.logout-button.muted {
  color: var(--red);
}

.admin-menu {
  position: relative;
}

.admin-bottom {
  justify-self: center;
  position: relative;
  padding-top: 4px;
}

.admin-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 220px;
  padding: 8px;
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  z-index: 5;
}

.admin-bottom .admin-menu-list {
  left: 50%;
  right: auto;
  top: auto;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
}

.admin-menu-list button {
  width: 100%;
  text-align: left;
}

.top-actions button:not(.nav-button):not(.logout-button),
menu button,
.user-actions button {
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--line);
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 16px;
  min-height: 520px;
}

.voice-panel, .chat-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  display: grid;
  gap: 16px;
}

.voice-panel {
  grid-template-rows: auto auto auto 1fr auto auto;
}

.chat-panel {
  grid-template-rows: auto auto 1fr auto;
}

.voice-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.voice-panel p {
  margin: 8px 0 0;
  color: var(--muted);
}

.voice-status {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141820;
  color: var(--muted);
  font-size: 13px;
}

.app-coming {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141820;
  color: var(--muted);
}

.app-coming strong {
  color: var(--text);
}

.app-coming a {
  width: fit-content;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--green);
  color: #07140d;
  font-weight: 800;
  text-decoration: none;
}

.join-call {
  width: min(280px, 100%);
  min-height: 50px;
  background: var(--green);
  color: #07140d;
}

.people {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-content: center;
  gap: 12px;
}

.person {
  min-height: 128px;
  padding: 18px;
  display: grid;
  place-items: center;
  gap: 10px;
}

.avatar, .big-avatar {
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--panel-2);
  border: 2px solid var(--line);
  font-weight: 800;
}

.avatar {
  width: 62px;
  height: 62px;
  font-size: 22px;
}

.big-avatar {
  width: 92px;
  height: 92px;
  font-size: 32px;
}

.avatar img, .big-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.person.speaking .avatar {
  border-color: var(--green);
  box-shadow: 0 0 0 6px rgba(73, 209, 125, 0.12);
}

.name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag {
  color: var(--muted);
  font-size: 12px;
}

.voice-actions, .controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.control {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  padding: 0;
}

.control.primary { background: var(--green); color: #07140d; }
.control.primary[aria-pressed="true"] { background: var(--yellow); color: #1f1700; }
.control.danger { background: var(--red); color: #2b0509; }

.chat-messages {
  min-height: 280px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px;
}

.voice-presence,
.site-presence {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.presence-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.presence-user {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141820;
  color: var(--text);
}

.online-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(73, 209, 125, 0.12);
}

.presence-user .avatar {
  width: 26px;
  height: 26px;
  border-width: 1px;
  font-size: 11px;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  place-self: center;
}

.chat-message {
  width: fit-content;
  max-width: 86%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141820;
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.chat-message.mine {
  align-self: flex-end;
  background: #18304c;
  flex-direction: row-reverse;
}

.chat-message strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--muted);
}

.chat-message p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-delete {
  min-height: 24px;
  width: 24px;
  margin-top: 6px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
  font-size: 16px;
  line-height: 1;
}

.chat-delete:hover {
  color: var(--red);
}

.chat-message .avatar {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-width: 1px;
  font-size: 12px;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

dialog {
  width: min(720px, calc(100vw - 24px));
  color: var(--text);
}

dialog::backdrop { background: rgba(0, 0, 0, 0.68); }

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0;
  margin: 0;
}

.admin-body {
  max-height: 82vh;
  overflow: auto;
}

.profile-block {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141820;
}

.profile-block h3 {
  margin: 0;
}

.user-list {
  display: grid;
  gap: 10px;
}

.user-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.user-edit {
  display: grid;
  gap: 10px;
}

.status-pill {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.site-footer {
  align-self: end;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.site-footer button,
.site-footer a {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 400;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer button:hover {
  color: var(--text);
}

.content-body {
  display: grid;
  gap: 14px;
  color: var(--muted);
}

.update-note {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141820;
}

.update-note p {
  margin: 8px 0 0;
}

.post-form, .feed-post {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.post-form {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.feed-posts {
  display: grid;
  gap: 14px;
}

.feed-post {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-head .avatar {
  width: 42px;
  height: 42px;
  border-width: 1px;
  font-size: 15px;
}

.post-head div {
  display: grid;
  gap: 3px;
  flex: 1;
}

.post-head span {
  color: var(--muted);
  font-size: 12px;
}

.feed-post p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.feed-post img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11141a;
}

.check {
  display: flex;
  align-items: center;
}

.check input {
  width: auto;
  min-height: auto;
}

@media (max-width: 640px) {
  .app { padding: 16px; }
  .user-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }
  .logout-button {
    justify-content: center;
  }
  .topbar { align-items: stretch; flex-direction: column; }
  .tabs, .user-row { grid-template-columns: 1fr; }
  .main-grid { grid-template-columns: 1fr; min-height: auto; }
  .chat-form { grid-template-columns: 1fr; }
}
