/* Every right-click / long-press menu, the Hub look (owner 2026-10-01: "really take a look at all menus"): a stone
   panel, the header naming what was clicked (Menu.setTitle), left-aligned rows, dividers between groups (.menu-sep on
   the first row of a group) and destructive rows in red (.menu-danger). Gold kept out (owner: cleaner). */
.contextmenu {
  position: fixed;
  width: auto;
  min-width: 140px;
  max-width: 240px;
  padding: 4px;
  z-index: 99999;
  border: 1px solid rgba(0, 0, 0, 0.9);
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.25)), url("/png/bg3.png");
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

/* Override modal's display:none when contextmenu is shown via JS */
.contextmenu.modal {
  /* display is set by JS, z-index should be highest */
  z-index: 99999;
}

.contextmenu>.menu-header {
  cursor: auto;
  text-align: left;
  padding: 4px 8px 6px;
  margin-bottom: 3px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: #cfc8b8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 0 #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contextmenu button {
  display: block;
  width: 100%;
  padding: 5px 10px;
  border: 0px;
  border-radius: 4px;
  margin: 1px 0;
  background: transparent;
  color: #efe9da;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  text-shadow: 0 1px 0 #000;
  white-space: nowrap;
}

.contextmenu button:hover {
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.4);
  color: #ffffff;
}

.contextmenu button.menu-sep {
  position: relative;
  margin-top: 6px;
}

.contextmenu button.menu-sep::before {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: -4px;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.contextmenu button.menu-danger { color: #f0a898; }
.contextmenu button.menu-danger:hover { color: #ffd0c6; }

/* Touch devices — bigger context menu for finger targets. Keyed on
   pointer:coarse (any touch-primary device) and force-mobile, NOT viewport
   size: the old max-width:768px query missed every landscape TABLET
   (1024x768+), which got the tiny 80px desktop menu (Elwray86 2026-08-23:
   'hard to select join party or follow'). Row height follows the
   #chat-entry-menu precedent (40px rows, proven comfortable). Hybrid
   laptops are safe: pointer:coarse tests the PRIMARY pointer. */
@media (max-width: 768px), (max-height: 500px), (pointer: coarse) {
  .contextmenu {
    min-width: 170px;
    padding: 4px;
  }

  .contextmenu>.menu-header {
    padding: 6px 10px 8px;
    font-size: 13px;
  }

  .contextmenu button {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 14px;
  }

  /* Chat copy/message menu (opened by long-press on mobile) — bigger touch rows */
  #chat-entry-menu {
    min-width: 170px;
  }

  #chat-entry-menu button {
    min-height: 40px;
    font-size: 14px;
    padding: 8px 10px;
  }
}

/* O menu da friend list e' um menu como os outros (mesma pedra, mesmas linhas):
   so a ancora do submenu de emoji e a grade ficam proprias, abaixo. */
#friend-list-menu>.friend-emoji-anchor {
  display: block;
  width: 100%;
  margin: 0;
  position: relative;
}

.friend-emoji-submenu {
  position: absolute;
  left: 100%;
  top: 0;
  z-index: 100000;
  width: 90px;
  padding: 2px;
  border: 1px solid black;
  background-image: url("/png/bg.png");
  box-shadow: 0 0 6px black;
  pointer-events: auto;
}

.friend-emoji-grid {
  display: grid;
  grid-template-columns: repeat(3, 28px);
  grid-template-rows: repeat(3, 28px);
  gap: 0;
  margin: 0;
  padding: 0;
}

.friend-emoji-cell {
  display: block;
  width: 28px;
  height: 28px;
  padding: 1px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}

.friend-emoji-cell:hover,
.friend-emoji-cell:focus-visible {
  border-color: white;
  outline: none;
  background-image: url("/png/bg2.png");
}

/* Explicit restore: generic .contextmenu button reset is scoped with
   :not(.friend-emoji-cell), but this higher-specificity rule keeps the
   28px grid + focus border intact even if the cascade shifts. */
.contextmenu button.friend-emoji-cell {
  width: 28px;
  height: 28px;
  padding: 1px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 0;
}

.friend-emoji-glyph {
  display: block;
  width: 24px;
  height: 24px;
  margin: 0;
}

.friend-emoji-icon {
  display: inline-block;
  margin-left: 4px;
  color: white;
  font-size: 10px;
  vertical-align: middle;
}

/* As celulas da grade de emoji nao sao linhas de menu: o hover generico das
   linhas (fundo + barra a esquerda) nao vale para elas */
.contextmenu button.friend-emoji-cell:hover,
.contextmenu button.friend-emoji-cell:focus-visible {
  box-shadow: none;
  background-color: transparent;
}
