.hup-layer {
  position: fixed;
  inset: 0;
  z-index: 4700;
  pointer-events: none;
}

.hup-menu {
  position: fixed;
  left: var(--hup-left);
  top: var(--hup-top);
  width: clamp(220px, 21vw, 292px);
  max-height: calc(100dvh - 16px);
  overflow: auto;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--line, #a9b4be) 66%, transparent);
  border-radius: 14px;
  color: var(--text, #18212b);
  background: color-mix(in srgb, var(--surface, white) 98%, transparent);
  box-shadow: 0 16px 42px rgba(15, 23, 42, .18), 0 2px 8px rgba(15, 23, 42, .09);
  pointer-events: auto;
  overscroll-behavior: contain;
  transform-origin: top left;
  animation: hup-enter var(--hm-motion-fast, 140ms) var(--hm-ease-enter, cubic-bezier(.2, .8, .2, 1)) both;
}

.hup-menu[data-horizontal="end"] { transform-origin-x: right; }
.hup-menu[data-vertical="above"] { transform-origin-y: bottom; }
.hup-level-enter { animation: hup-level-in var(--hm-motion-micro, 100ms) var(--hm-ease-enter, ease-out) both; }
.hup-reactions { display: flex; justify-content: space-between; gap: 2px; padding: 2px 3px 7px; border-bottom: 1px solid var(--line, rgba(100, 116, 139, .15)); }
.hup-reactions button { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; font-size: 20px; cursor: pointer; transition: transform var(--hm-motion-micro, 100ms) var(--hm-ease-enter, ease-out), background-color var(--hm-motion-micro, 100ms) var(--hm-ease-enter, ease-out); }
.hup-reactions button:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--accent, #229ed9) 11%, transparent); }
.hup-actions { display: grid; gap: 1px; padding-top: 4px; }
.hup-actions > button { display: grid; grid-template-columns: 27px minmax(0, 1fr) auto; align-items: center; min-height: 39px; padding: 4px 8px; border: 0; border-radius: 9px; color: inherit; background: transparent; text-align: start; font: inherit; font-size: 13px; cursor: pointer; }
.hup-actions > button:hover,
.hup-actions > button:focus-visible { outline: 0; background: color-mix(in srgb, var(--accent, #229ed9) 10%, transparent); }
.hup-actions > button:active { transform: scale(.985); }
.hup-copy { min-width: 0; display: grid; gap: 1px; }
.hup-copy b { overflow: hidden; font: inherit; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.hup-copy small { overflow: hidden; color: var(--muted, #71808e); font-size: 10px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.hup-icon { display: grid; place-items: center; color: var(--accent, #229ed9); }
.hup-icon svg { width: 18px; height: 18px; }
.hup-chevron { color: var(--muted, #71808e); font-size: 18px; }
.hup-back { border-bottom: 1px solid var(--line, rgba(100, 116, 139, .15)) !important; border-radius: 7px !important; }
.hup-danger,
.hup-danger .hup-icon { color: var(--danger, #df3f52) !important; }
.hup-closing .hup-menu { animation: hup-leave var(--hm-motion-instant, 70ms) var(--hm-ease-exit, ease-in) both; pointer-events: none; }

html.dark .hup-menu,
html.amoled .hup-menu { color: var(--text, #edf2f6); box-shadow: 0 18px 48px rgba(0, 0, 0, .42); }

@keyframes hup-enter { from { opacity: 0; transform: translateY(-3px) scale(.975); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes hup-leave { to { opacity: 0; transform: translateY(-2px) scale(.985); } }
@keyframes hup-level-in { from { opacity: .65; transform: translateX(5px); } to { opacity: 1; transform: none; } }

.hup-mode-sheet {
  display: flex;
  align-items: flex-end;
  padding: 10px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: rgba(2, 10, 18, .5);
  pointer-events: auto;
}

.hup-mode-sheet .hup-menu {
  position: relative;
  inset: auto;
  width: min(100%, 520px);
  max-height: min(78dvh, 680px);
  margin: 0 auto;
  padding: 8px;
  border-radius: 22px;
  transform-origin: bottom center;
  animation-name: hup-sheet-enter;
}

.hup-mode-sheet .hup-actions > button { min-height: 48px; padding-inline: 11px; border-radius: 12px; }
.hup-mode-sheet .hup-reactions { padding: 5px 4px 9px; }
.hup-mode-sheet .hup-reactions button { width: 42px; height: 42px; font-size: 23px; }
.hup-mode-sheet.hup-closing .hup-menu { animation-name: hup-sheet-leave; }

@keyframes hup-sheet-enter { from { opacity: .7; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes hup-sheet-leave { to { opacity: 0; transform: translateY(12px); } }

@media (pointer: coarse), (max-width: 700px) {
  .hup-mode-menu { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .hup-menu,
  .hup-level-enter,
  .hup-closing .hup-menu { animation: none !important; }
  .hup-actions > button,
  .hup-reactions button { transition: none; }
}
