/* ---- top bar ------------------------------------------------------------ */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(16px, env(safe-area-inset-top)) 24px 0;
  z-index: 10;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

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

.logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--shadow-sm);
}
.logo svg { width: 22px; height: 22px; stroke-width: 3; }

h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.connection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 6px;
  padding: 5px 11px 5px 9px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
}
.connection[data-state="live"] .status-dot {
  background: #22c55e;
  box-shadow: 0 0 0 0 rgb(34 197 94 / 0.5);
  animation: pulse 2.4s ease-out infinite;
}
.connection[data-state="offline"] .status-dot { background: #ef4444; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgb(34 197 94 / 0.45); }
  70%, 100% { box-shadow: 0 0 0 7px rgb(34 197 94 / 0); }
}

.people {
  display: flex;
  padding-left: 8px;
}

.avatar {
  --c: #888;
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-left: -8px;
  border-radius: 50%;
  background: var(--c);
  color: #fff;
  font-size: 12px;
  font-weight: 650;
  border: 2.5px solid var(--bg);
  box-shadow: var(--shadow-sm);
  cursor: default;
  animation: pop-in 0.35s var(--ease);
  transition: transform 0.2s var(--ease);
}
.avatar:hover { transform: translateY(-2px); z-index: 1; }
.avatar.me::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--bg);
}

@keyframes pop-in {
  from { transform: scale(0.4); opacity: 0; }
}


@media (max-width: 640px) {
  .topbar { padding-inline: 14px; }
  h1 { display: none; }
}

/* ---- room bar (inside a room) ------------------------------------------- */

.room-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.pill svg { width: 16px; height: 16px; }
.pill:hover { background: var(--surface-solid); }
.pill.danger:hover { color: var(--danger); }
.pill:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }

.room-name-label {
  overflow: hidden;
  max-width: 320px;
  padding: 4px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
}
/* The owner can click it to rename the room; for everyone else it's plain text. */
.room-name-label:not(:disabled) { cursor: pointer; }
.room-name-label:not(:disabled):hover { background: var(--hover); }
.room-name-label:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }

.badge {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .room-name-label, .room-bar .badge { display: none; }
  .connection { display: none; }
}

.top-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ---- the you menu (auth.md step 5) -------------------------------------- */

.pill.you[hidden] { display: none; }
.pill.you { --c: #888; max-width: 180px; }
.you-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
}
.you-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.you-menu {
  position: fixed;
  z-index: 11;
  width: 220px;
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px) saturate(1.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  box-shadow: var(--shadow-lg);
}
.you-menu[hidden] { display: none; }
.you-head {
  display: grid;
  gap: 2px;
  padding: 4px 10px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.you-head strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
}
.you-head span { color: var(--muted); font-size: 12.5px; }
.you-item {
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.you-item:hover { background: var(--hover); }
.you-item:focus-visible { outline: 2px solid #3b82f6; outline-offset: -2px; }
.you-item[hidden] { display: none; }
