ul#nav {
  list-style-type: none;
  margin: 0;
  padding: 0;
  background-color: #333333;
  display: flex;
  overflow: visible;
  justify-content: flex-end;
  position: relative;
}

ul#nav li.left {
  margin-right: auto;
}

/* logo: fit the bar height */
ul#nav li.left a {
  display: flex;
  align-items: center;
  height: 100%;
  box-sizing: border-box;
  padding: 6px 16px;
}
ul#nav li.left a:hover { background-color: transparent; }
ul#nav li.left img {
  display: block;
  height: 32px;
  width: auto;
}
/* inline themed logo (nav.js swaps the <img> for it so it can follow the accent colour) */
ul#nav li.left svg {
  display: block;
  height: 32px;
  width: auto;
}

ul#nav li a {
  display: block;
  color: white;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
}

ul#nav li a:hover {
  background-color: #111111;
}

/* keep labels on one line; tighten spacing before the phone layout kicks in */
ul#nav > li > a { white-space: nowrap; }
@media (max-width: 1280px) and (min-width: 1101px) {
  ul#nav > li > a { padding-left: 10px; padding-right: 10px; }
}

.dropdown { 
  position: relative; 
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #333333;
  list-style: none;
  padding-top: 4px;
  margin: 0;
  z-index: 999;
  min-width: 160px;
}

.dropdown::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 4px;
}

.dropdown:hover .dropdown-menu { 
  display: block; 
}

.dropdown-menu li {
  list-style: none;
}

.dropdown-menu li a { 
  display: block; 
  padding: 8px 16px; 
  white-space: nowrap; 
}

.dropdown-menu li a:hover {
  background-color: #111111;
}

ul#nav li.nav-toggle { display: none; }

/* account: avatar circle (or "Log in") + notification bell */
ul#nav li.nav-user a,
ul#nav li.nav-bell > a {
  display: flex;
  align-items: center;
  height: 100%;
  box-sizing: border-box;
}
ul#nav li.nav-user a.avatar { padding-top: 0; padding-bottom: 0; }
.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: bold;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px #333333, 0 0 0 3px #555;
}
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
ul#nav li.nav-user a.avatar:hover { background-color: transparent; }
ul#nav li.nav-user a.avatar:hover .nav-avatar { box-shadow: 0 0 0 2px #333333, 0 0 0 3px #aaa; }

/* discord icon button */
ul#nav li.nav-discord > a {
  display: flex;
  align-items: center;
  height: 100%;
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
  color: #ddd;
}
ul#nav li.nav-discord > a:hover { color: #fff; background-color: #5865f2; }

/* avatar menu */
ul#nav li.nav-user { position: relative; }
.user-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 8px;
  min-width: 180px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow: hidden;
  text-align: left;
}
.user-menu.open { display: block; }
.user-menu-head {
  padding: 10px 14px;
  border-bottom: 1px solid #3a3a3a;
  color: #fff;
  font-weight: bold;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
ul#nav .user-menu a {
  display: block;
  padding: 9px 14px;
  text-align: left;
  font-size: 14px;
  color: #ddd;
}
ul#nav .user-menu a:hover { background: #333; color: #fff; text-decoration: none; }
ul#nav .user-menu a.user-menu-logout { border-top: 1px solid #3a3a3a; color: #ff8a8d; }

.nav-bell { position: relative; }
ul#nav li.nav-bell > a { position: relative; padding-top: 0; padding-bottom: 0; }
.bell-count {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  box-sizing: border-box;
  border-radius: 8px;
  background: #e5484d;
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  line-height: 16px;
  text-align: center;
}
.bell-count.show { display: block; }

.bell-panel {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  width: 340px;
  max-width: calc(100vw - 16px);
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  text-align: left;
  overflow: hidden;
}
.bell-panel.open { display: block; }
.bell-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #3a3a3a;
  color: #fff;
  font-weight: bold;
  font-size: 14px;
}
.bell-head button {
  background: none;
  border: none;
  color: #aaa;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.bell-head button:hover { color: #fff; }
.bell-list { max-height: 360px; overflow-y: auto; }
ul#nav .bell-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  border-bottom: 1px solid #333;
  text-align: left;
  white-space: normal;
  font-size: 13px;
  line-height: 1.4;
  color: #ddd;
}
ul#nav .bell-item:hover { background: #333; text-decoration: none; }
ul#nav .bell-item.unread { background: #2f2a33; }
.bell-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
}
.bell-icon.ok { background: #2f8f4e; }
.bell-icon.no { background: #b3373b; }
.bell-time { display: block; color: #888; font-size: 11px; margin-top: 2px; }
.bell-empty { padding: 24px 14px; color: #888; text-align: center; font-size: 13px; }

@media (max-width: 1100px) {
  ul#nav {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  ul#nav li.nav-toggle { display: block; }
  ul#nav li.nav-toggle a { font-size: 22px; line-height: 1; padding: 12px 18px; }

  ul#nav > li:not(.left):not(.nav-toggle):not(.nav-bell):not(.nav-user):not(.nav-discord) { display: none; width: 100%; order: 10; }
  ul#nav.open > li:not(.left):not(.nav-toggle):not(.nav-bell):not(.nav-user):not(.nav-discord) { display: block; }

  /* bell + avatar stay in the top bar next to the menu button */
  ul#nav li.left { order: 0; }
  ul#nav li.nav-discord { order: 1; }
  ul#nav li.nav-discord > a { padding: 0 10px; }
  ul#nav li.nav-bell { order: 1; position: static; }
  ul#nav li.nav-user { order: 2; }
  ul#nav li.nav-toggle { order: 3; }
  ul#nav li.nav-bell > a, ul#nav li.nav-user a.avatar, ul#nav li.nav-user > a { padding: 0 10px; }
  ul#nav .user-menu a { padding: 12px 14px; }
  .bell-panel { right: 8px; top: 100%; }

  ul#nav li a { text-align: left; padding: 14px 18px; }

  .dropdown-menu {
    position: static;
    display: none;
    padding: 0 0 0 16px;
    background: #2a2a2a;
    min-width: 0;
  }
  .dropdown::after { display: none; }
  .dropdown:hover .dropdown-menu { display: none; }
  .dropdown.open .dropdown-menu { display: block; }
  .dropdown-menu li a { white-space: normal; padding: 12px 18px; }
}
